pdf.worker.js 1.1 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553
  1. /* Copyright 2017 Mozilla Foundation
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. (function webpackUniversalModuleDefinition(root, factory) {
  16. if(typeof exports === 'object' && typeof module === 'object')
  17. module.exports = factory();
  18. else if(typeof define === 'function' && define.amd)
  19. define("pdfjs-dist/build/pdf.worker", [], factory);
  20. else if(typeof exports === 'object')
  21. exports["pdfjs-dist/build/pdf.worker"] = factory();
  22. else
  23. root["pdfjs-dist/build/pdf.worker"] = root.pdfjsDistBuildPdfWorker = factory();
  24. })(this, function() {
  25. return /******/ (function(modules) { // webpackBootstrap
  26. /******/ // The module cache
  27. /******/ var installedModules = {};
  28. /******/ // The require function
  29. /******/ function __w_pdfjs_require__(moduleId) {
  30. /******/ // Check if module is in cache
  31. /******/ if(installedModules[moduleId])
  32. /******/ return installedModules[moduleId].exports;
  33. /******/ // Create a new module (and put it into the cache)
  34. /******/ var module = installedModules[moduleId] = {
  35. /******/ i: moduleId,
  36. /******/ l: false,
  37. /******/ exports: {}
  38. /******/ };
  39. /******/ // Execute the module function
  40. /******/ modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__);
  41. /******/ // Flag the module as loaded
  42. /******/ module.l = true;
  43. /******/ // Return the exports of the module
  44. /******/ return module.exports;
  45. /******/ }
  46. /******/ // expose the modules object (__webpack_modules__)
  47. /******/ __w_pdfjs_require__.m = modules;
  48. /******/ // expose the module cache
  49. /******/ __w_pdfjs_require__.c = installedModules;
  50. /******/ // identity function for calling harmony imports with the correct context
  51. /******/ __w_pdfjs_require__.i = function(value) { return value; };
  52. /******/ // define getter function for harmony exports
  53. /******/ __w_pdfjs_require__.d = function(exports, name, getter) {
  54. /******/ if(!__w_pdfjs_require__.o(exports, name)) {
  55. /******/ Object.defineProperty(exports, name, {
  56. /******/ configurable: false,
  57. /******/ enumerable: true,
  58. /******/ get: getter
  59. /******/ });
  60. /******/ }
  61. /******/ };
  62. /******/ // getDefaultExport function for compatibility with non-harmony modules
  63. /******/ __w_pdfjs_require__.n = function(module) {
  64. /******/ var getter = module && module.__esModule ?
  65. /******/ function getDefault() { return module['default']; } :
  66. /******/ function getModuleExports() { return module; };
  67. /******/ __w_pdfjs_require__.d(getter, 'a', getter);
  68. /******/ return getter;
  69. /******/ };
  70. /******/ // Object.prototype.hasOwnProperty.call
  71. /******/ __w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  72. /******/ // __webpack_public_path__
  73. /******/ __w_pdfjs_require__.p = "";
  74. /******/ // Load entry module and return exports
  75. /******/ return __w_pdfjs_require__(__w_pdfjs_require__.s = 37);
  76. /******/ })
  77. /************************************************************************/
  78. /******/ ([
  79. /* 0 */
  80. /***/ (function(module, exports, __w_pdfjs_require__) {
  81. "use strict";
  82. /* WEBPACK VAR INJECTION */(function(global) {
  83. var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this;
  84. var FONT_IDENTITY_MATRIX = [
  85. 0.001,
  86. 0,
  87. 0,
  88. 0.001,
  89. 0,
  90. 0
  91. ];
  92. var TextRenderingMode = {
  93. FILL: 0,
  94. STROKE: 1,
  95. FILL_STROKE: 2,
  96. INVISIBLE: 3,
  97. FILL_ADD_TO_PATH: 4,
  98. STROKE_ADD_TO_PATH: 5,
  99. FILL_STROKE_ADD_TO_PATH: 6,
  100. ADD_TO_PATH: 7,
  101. FILL_STROKE_MASK: 3,
  102. ADD_TO_PATH_FLAG: 4
  103. };
  104. var ImageKind = {
  105. GRAYSCALE_1BPP: 1,
  106. RGB_24BPP: 2,
  107. RGBA_32BPP: 3
  108. };
  109. var AnnotationType = {
  110. TEXT: 1,
  111. LINK: 2,
  112. FREETEXT: 3,
  113. LINE: 4,
  114. SQUARE: 5,
  115. CIRCLE: 6,
  116. POLYGON: 7,
  117. POLYLINE: 8,
  118. HIGHLIGHT: 9,
  119. UNDERLINE: 10,
  120. SQUIGGLY: 11,
  121. STRIKEOUT: 12,
  122. STAMP: 13,
  123. CARET: 14,
  124. INK: 15,
  125. POPUP: 16,
  126. FILEATTACHMENT: 17,
  127. SOUND: 18,
  128. MOVIE: 19,
  129. WIDGET: 20,
  130. SCREEN: 21,
  131. PRINTERMARK: 22,
  132. TRAPNET: 23,
  133. WATERMARK: 24,
  134. THREED: 25,
  135. REDACT: 26
  136. };
  137. var AnnotationFlag = {
  138. INVISIBLE: 0x01,
  139. HIDDEN: 0x02,
  140. PRINT: 0x04,
  141. NOZOOM: 0x08,
  142. NOROTATE: 0x10,
  143. NOVIEW: 0x20,
  144. READONLY: 0x40,
  145. LOCKED: 0x80,
  146. TOGGLENOVIEW: 0x100,
  147. LOCKEDCONTENTS: 0x200
  148. };
  149. var AnnotationFieldFlag = {
  150. READONLY: 0x0000001,
  151. REQUIRED: 0x0000002,
  152. NOEXPORT: 0x0000004,
  153. MULTILINE: 0x0001000,
  154. PASSWORD: 0x0002000,
  155. NOTOGGLETOOFF: 0x0004000,
  156. RADIO: 0x0008000,
  157. PUSHBUTTON: 0x0010000,
  158. COMBO: 0x0020000,
  159. EDIT: 0x0040000,
  160. SORT: 0x0080000,
  161. FILESELECT: 0x0100000,
  162. MULTISELECT: 0x0200000,
  163. DONOTSPELLCHECK: 0x0400000,
  164. DONOTSCROLL: 0x0800000,
  165. COMB: 0x1000000,
  166. RICHTEXT: 0x2000000,
  167. RADIOSINUNISON: 0x2000000,
  168. COMMITONSELCHANGE: 0x4000000
  169. };
  170. var AnnotationBorderStyleType = {
  171. SOLID: 1,
  172. DASHED: 2,
  173. BEVELED: 3,
  174. INSET: 4,
  175. UNDERLINE: 5
  176. };
  177. var StreamType = {
  178. UNKNOWN: 0,
  179. FLATE: 1,
  180. LZW: 2,
  181. DCT: 3,
  182. JPX: 4,
  183. JBIG: 5,
  184. A85: 6,
  185. AHX: 7,
  186. CCF: 8,
  187. RL: 9
  188. };
  189. var FontType = {
  190. UNKNOWN: 0,
  191. TYPE1: 1,
  192. TYPE1C: 2,
  193. CIDFONTTYPE0: 3,
  194. CIDFONTTYPE0C: 4,
  195. TRUETYPE: 5,
  196. CIDFONTTYPE2: 6,
  197. TYPE3: 7,
  198. OPENTYPE: 8,
  199. TYPE0: 9,
  200. MMTYPE1: 10
  201. };
  202. var VERBOSITY_LEVELS = {
  203. errors: 0,
  204. warnings: 1,
  205. infos: 5
  206. };
  207. var OPS = {
  208. dependency: 1,
  209. setLineWidth: 2,
  210. setLineCap: 3,
  211. setLineJoin: 4,
  212. setMiterLimit: 5,
  213. setDash: 6,
  214. setRenderingIntent: 7,
  215. setFlatness: 8,
  216. setGState: 9,
  217. save: 10,
  218. restore: 11,
  219. transform: 12,
  220. moveTo: 13,
  221. lineTo: 14,
  222. curveTo: 15,
  223. curveTo2: 16,
  224. curveTo3: 17,
  225. closePath: 18,
  226. rectangle: 19,
  227. stroke: 20,
  228. closeStroke: 21,
  229. fill: 22,
  230. eoFill: 23,
  231. fillStroke: 24,
  232. eoFillStroke: 25,
  233. closeFillStroke: 26,
  234. closeEOFillStroke: 27,
  235. endPath: 28,
  236. clip: 29,
  237. eoClip: 30,
  238. beginText: 31,
  239. endText: 32,
  240. setCharSpacing: 33,
  241. setWordSpacing: 34,
  242. setHScale: 35,
  243. setLeading: 36,
  244. setFont: 37,
  245. setTextRenderingMode: 38,
  246. setTextRise: 39,
  247. moveText: 40,
  248. setLeadingMoveText: 41,
  249. setTextMatrix: 42,
  250. nextLine: 43,
  251. showText: 44,
  252. showSpacedText: 45,
  253. nextLineShowText: 46,
  254. nextLineSetSpacingShowText: 47,
  255. setCharWidth: 48,
  256. setCharWidthAndBounds: 49,
  257. setStrokeColorSpace: 50,
  258. setFillColorSpace: 51,
  259. setStrokeColor: 52,
  260. setStrokeColorN: 53,
  261. setFillColor: 54,
  262. setFillColorN: 55,
  263. setStrokeGray: 56,
  264. setFillGray: 57,
  265. setStrokeRGBColor: 58,
  266. setFillRGBColor: 59,
  267. setStrokeCMYKColor: 60,
  268. setFillCMYKColor: 61,
  269. shadingFill: 62,
  270. beginInlineImage: 63,
  271. beginImageData: 64,
  272. endInlineImage: 65,
  273. paintXObject: 66,
  274. markPoint: 67,
  275. markPointProps: 68,
  276. beginMarkedContent: 69,
  277. beginMarkedContentProps: 70,
  278. endMarkedContent: 71,
  279. beginCompat: 72,
  280. endCompat: 73,
  281. paintFormXObjectBegin: 74,
  282. paintFormXObjectEnd: 75,
  283. beginGroup: 76,
  284. endGroup: 77,
  285. beginAnnotations: 78,
  286. endAnnotations: 79,
  287. beginAnnotation: 80,
  288. endAnnotation: 81,
  289. paintJpegXObject: 82,
  290. paintImageMaskXObject: 83,
  291. paintImageMaskXObjectGroup: 84,
  292. paintImageXObject: 85,
  293. paintInlineImageXObject: 86,
  294. paintInlineImageXObjectGroup: 87,
  295. paintImageXObjectRepeat: 88,
  296. paintImageMaskXObjectRepeat: 89,
  297. paintSolidColorImageMask: 90,
  298. constructPath: 91
  299. };
  300. var verbosity = VERBOSITY_LEVELS.warnings;
  301. function setVerbosityLevel(level) {
  302. verbosity = level;
  303. }
  304. function getVerbosityLevel() {
  305. return verbosity;
  306. }
  307. function info(msg) {
  308. if (verbosity >= VERBOSITY_LEVELS.infos) {
  309. console.log('Info: ' + msg);
  310. }
  311. }
  312. function warn(msg) {
  313. if (verbosity >= VERBOSITY_LEVELS.warnings) {
  314. console.log('Warning: ' + msg);
  315. }
  316. }
  317. function deprecated(details) {
  318. console.log('Deprecated API usage: ' + details);
  319. }
  320. function error(msg) {
  321. if (verbosity >= VERBOSITY_LEVELS.errors) {
  322. console.log('Error: ' + msg);
  323. console.log(backtrace());
  324. }
  325. throw new Error(msg);
  326. }
  327. function backtrace() {
  328. try {
  329. throw new Error();
  330. } catch (e) {
  331. return e.stack ? e.stack.split('\n').slice(2).join('\n') : '';
  332. }
  333. }
  334. function assert(cond, msg) {
  335. if (!cond) {
  336. error(msg);
  337. }
  338. }
  339. var UNSUPPORTED_FEATURES = {
  340. unknown: 'unknown',
  341. forms: 'forms',
  342. javaScript: 'javaScript',
  343. smask: 'smask',
  344. shadingPattern: 'shadingPattern',
  345. font: 'font'
  346. };
  347. function isSameOrigin(baseUrl, otherUrl) {
  348. try {
  349. var base = new URL(baseUrl);
  350. if (!base.origin || base.origin === 'null') {
  351. return false;
  352. }
  353. } catch (e) {
  354. return false;
  355. }
  356. var other = new URL(otherUrl, base);
  357. return base.origin === other.origin;
  358. }
  359. function isValidProtocol(url) {
  360. if (!url) {
  361. return false;
  362. }
  363. switch (url.protocol) {
  364. case 'http:':
  365. case 'https:':
  366. case 'ftp:':
  367. case 'mailto:':
  368. case 'tel:':
  369. return true;
  370. default:
  371. return false;
  372. }
  373. }
  374. function createValidAbsoluteUrl(url, baseUrl) {
  375. if (!url) {
  376. return null;
  377. }
  378. try {
  379. var absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  380. if (isValidProtocol(absoluteUrl)) {
  381. return absoluteUrl;
  382. }
  383. } catch (ex) {
  384. }
  385. return null;
  386. }
  387. function shadow(obj, prop, value) {
  388. Object.defineProperty(obj, prop, {
  389. value: value,
  390. enumerable: true,
  391. configurable: true,
  392. writable: false
  393. });
  394. return value;
  395. }
  396. function getLookupTableFactory(initializer) {
  397. var lookup;
  398. return function () {
  399. if (initializer) {
  400. lookup = Object.create(null);
  401. initializer(lookup);
  402. initializer = null;
  403. }
  404. return lookup;
  405. };
  406. }
  407. var PasswordResponses = {
  408. NEED_PASSWORD: 1,
  409. INCORRECT_PASSWORD: 2
  410. };
  411. var PasswordException = function PasswordExceptionClosure() {
  412. function PasswordException(msg, code) {
  413. this.name = 'PasswordException';
  414. this.message = msg;
  415. this.code = code;
  416. }
  417. PasswordException.prototype = new Error();
  418. PasswordException.constructor = PasswordException;
  419. return PasswordException;
  420. }();
  421. var UnknownErrorException = function UnknownErrorExceptionClosure() {
  422. function UnknownErrorException(msg, details) {
  423. this.name = 'UnknownErrorException';
  424. this.message = msg;
  425. this.details = details;
  426. }
  427. UnknownErrorException.prototype = new Error();
  428. UnknownErrorException.constructor = UnknownErrorException;
  429. return UnknownErrorException;
  430. }();
  431. var InvalidPDFException = function InvalidPDFExceptionClosure() {
  432. function InvalidPDFException(msg) {
  433. this.name = 'InvalidPDFException';
  434. this.message = msg;
  435. }
  436. InvalidPDFException.prototype = new Error();
  437. InvalidPDFException.constructor = InvalidPDFException;
  438. return InvalidPDFException;
  439. }();
  440. var MissingPDFException = function MissingPDFExceptionClosure() {
  441. function MissingPDFException(msg) {
  442. this.name = 'MissingPDFException';
  443. this.message = msg;
  444. }
  445. MissingPDFException.prototype = new Error();
  446. MissingPDFException.constructor = MissingPDFException;
  447. return MissingPDFException;
  448. }();
  449. var UnexpectedResponseException = function UnexpectedResponseExceptionClosure() {
  450. function UnexpectedResponseException(msg, status) {
  451. this.name = 'UnexpectedResponseException';
  452. this.message = msg;
  453. this.status = status;
  454. }
  455. UnexpectedResponseException.prototype = new Error();
  456. UnexpectedResponseException.constructor = UnexpectedResponseException;
  457. return UnexpectedResponseException;
  458. }();
  459. var NotImplementedException = function NotImplementedExceptionClosure() {
  460. function NotImplementedException(msg) {
  461. this.message = msg;
  462. }
  463. NotImplementedException.prototype = new Error();
  464. NotImplementedException.prototype.name = 'NotImplementedException';
  465. NotImplementedException.constructor = NotImplementedException;
  466. return NotImplementedException;
  467. }();
  468. var MissingDataException = function MissingDataExceptionClosure() {
  469. function MissingDataException(begin, end) {
  470. this.begin = begin;
  471. this.end = end;
  472. this.message = 'Missing data [' + begin + ', ' + end + ')';
  473. }
  474. MissingDataException.prototype = new Error();
  475. MissingDataException.prototype.name = 'MissingDataException';
  476. MissingDataException.constructor = MissingDataException;
  477. return MissingDataException;
  478. }();
  479. var XRefParseException = function XRefParseExceptionClosure() {
  480. function XRefParseException(msg) {
  481. this.message = msg;
  482. }
  483. XRefParseException.prototype = new Error();
  484. XRefParseException.prototype.name = 'XRefParseException';
  485. XRefParseException.constructor = XRefParseException;
  486. return XRefParseException;
  487. }();
  488. var NullCharactersRegExp = /\x00/g;
  489. function removeNullCharacters(str) {
  490. if (typeof str !== 'string') {
  491. warn('The argument for removeNullCharacters must be a string.');
  492. return str;
  493. }
  494. return str.replace(NullCharactersRegExp, '');
  495. }
  496. function bytesToString(bytes) {
  497. assert(bytes !== null && typeof bytes === 'object' && bytes.length !== undefined, 'Invalid argument for bytesToString');
  498. var length = bytes.length;
  499. var MAX_ARGUMENT_COUNT = 8192;
  500. if (length < MAX_ARGUMENT_COUNT) {
  501. return String.fromCharCode.apply(null, bytes);
  502. }
  503. var strBuf = [];
  504. for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  505. var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  506. var chunk = bytes.subarray(i, chunkEnd);
  507. strBuf.push(String.fromCharCode.apply(null, chunk));
  508. }
  509. return strBuf.join('');
  510. }
  511. function stringToBytes(str) {
  512. assert(typeof str === 'string', 'Invalid argument for stringToBytes');
  513. var length = str.length;
  514. var bytes = new Uint8Array(length);
  515. for (var i = 0; i < length; ++i) {
  516. bytes[i] = str.charCodeAt(i) & 0xFF;
  517. }
  518. return bytes;
  519. }
  520. function arrayByteLength(arr) {
  521. if (arr.length !== undefined) {
  522. return arr.length;
  523. }
  524. assert(arr.byteLength !== undefined);
  525. return arr.byteLength;
  526. }
  527. function arraysToBytes(arr) {
  528. if (arr.length === 1 && arr[0] instanceof Uint8Array) {
  529. return arr[0];
  530. }
  531. var resultLength = 0;
  532. var i, ii = arr.length;
  533. var item, itemLength;
  534. for (i = 0; i < ii; i++) {
  535. item = arr[i];
  536. itemLength = arrayByteLength(item);
  537. resultLength += itemLength;
  538. }
  539. var pos = 0;
  540. var data = new Uint8Array(resultLength);
  541. for (i = 0; i < ii; i++) {
  542. item = arr[i];
  543. if (!(item instanceof Uint8Array)) {
  544. if (typeof item === 'string') {
  545. item = stringToBytes(item);
  546. } else {
  547. item = new Uint8Array(item);
  548. }
  549. }
  550. itemLength = item.byteLength;
  551. data.set(item, pos);
  552. pos += itemLength;
  553. }
  554. return data;
  555. }
  556. function string32(value) {
  557. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  558. }
  559. function log2(x) {
  560. var n = 1, i = 0;
  561. while (x > n) {
  562. n <<= 1;
  563. i++;
  564. }
  565. return i;
  566. }
  567. function readInt8(data, start) {
  568. return data[start] << 24 >> 24;
  569. }
  570. function readUint16(data, offset) {
  571. return data[offset] << 8 | data[offset + 1];
  572. }
  573. function readUint32(data, offset) {
  574. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  575. }
  576. function isLittleEndian() {
  577. var buffer8 = new Uint8Array(2);
  578. buffer8[0] = 1;
  579. var buffer16 = new Uint16Array(buffer8.buffer);
  580. return buffer16[0] === 1;
  581. }
  582. function isEvalSupported() {
  583. try {
  584. new Function('');
  585. return true;
  586. } catch (e) {
  587. return false;
  588. }
  589. }
  590. var Uint32ArrayView = function Uint32ArrayViewClosure() {
  591. function Uint32ArrayView(buffer, length) {
  592. this.buffer = buffer;
  593. this.byteLength = buffer.length;
  594. this.length = length === undefined ? this.byteLength >> 2 : length;
  595. ensureUint32ArrayViewProps(this.length);
  596. }
  597. Uint32ArrayView.prototype = Object.create(null);
  598. var uint32ArrayViewSetters = 0;
  599. function createUint32ArrayProp(index) {
  600. return {
  601. get: function () {
  602. var buffer = this.buffer, offset = index << 2;
  603. return (buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24) >>> 0;
  604. },
  605. set: function (value) {
  606. var buffer = this.buffer, offset = index << 2;
  607. buffer[offset] = value & 255;
  608. buffer[offset + 1] = value >> 8 & 255;
  609. buffer[offset + 2] = value >> 16 & 255;
  610. buffer[offset + 3] = value >>> 24 & 255;
  611. }
  612. };
  613. }
  614. function ensureUint32ArrayViewProps(length) {
  615. while (uint32ArrayViewSetters < length) {
  616. Object.defineProperty(Uint32ArrayView.prototype, uint32ArrayViewSetters, createUint32ArrayProp(uint32ArrayViewSetters));
  617. uint32ArrayViewSetters++;
  618. }
  619. }
  620. return Uint32ArrayView;
  621. }();
  622. exports.Uint32ArrayView = Uint32ArrayView;
  623. var IDENTITY_MATRIX = [
  624. 1,
  625. 0,
  626. 0,
  627. 1,
  628. 0,
  629. 0
  630. ];
  631. var Util = function UtilClosure() {
  632. function Util() {
  633. }
  634. var rgbBuf = [
  635. 'rgb(',
  636. 0,
  637. ',',
  638. 0,
  639. ',',
  640. 0,
  641. ')'
  642. ];
  643. Util.makeCssRgb = function Util_makeCssRgb(r, g, b) {
  644. rgbBuf[1] = r;
  645. rgbBuf[3] = g;
  646. rgbBuf[5] = b;
  647. return rgbBuf.join('');
  648. };
  649. Util.transform = function Util_transform(m1, m2) {
  650. return [
  651. m1[0] * m2[0] + m1[2] * m2[1],
  652. m1[1] * m2[0] + m1[3] * m2[1],
  653. m1[0] * m2[2] + m1[2] * m2[3],
  654. m1[1] * m2[2] + m1[3] * m2[3],
  655. m1[0] * m2[4] + m1[2] * m2[5] + m1[4],
  656. m1[1] * m2[4] + m1[3] * m2[5] + m1[5]
  657. ];
  658. };
  659. Util.applyTransform = function Util_applyTransform(p, m) {
  660. var xt = p[0] * m[0] + p[1] * m[2] + m[4];
  661. var yt = p[0] * m[1] + p[1] * m[3] + m[5];
  662. return [
  663. xt,
  664. yt
  665. ];
  666. };
  667. Util.applyInverseTransform = function Util_applyInverseTransform(p, m) {
  668. var d = m[0] * m[3] - m[1] * m[2];
  669. var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  670. var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  671. return [
  672. xt,
  673. yt
  674. ];
  675. };
  676. Util.getAxialAlignedBoundingBox = function Util_getAxialAlignedBoundingBox(r, m) {
  677. var p1 = Util.applyTransform(r, m);
  678. var p2 = Util.applyTransform(r.slice(2, 4), m);
  679. var p3 = Util.applyTransform([
  680. r[0],
  681. r[3]
  682. ], m);
  683. var p4 = Util.applyTransform([
  684. r[2],
  685. r[1]
  686. ], m);
  687. return [
  688. Math.min(p1[0], p2[0], p3[0], p4[0]),
  689. Math.min(p1[1], p2[1], p3[1], p4[1]),
  690. Math.max(p1[0], p2[0], p3[0], p4[0]),
  691. Math.max(p1[1], p2[1], p3[1], p4[1])
  692. ];
  693. };
  694. Util.inverseTransform = function Util_inverseTransform(m) {
  695. var d = m[0] * m[3] - m[1] * m[2];
  696. return [
  697. m[3] / d,
  698. -m[1] / d,
  699. -m[2] / d,
  700. m[0] / d,
  701. (m[2] * m[5] - m[4] * m[3]) / d,
  702. (m[4] * m[1] - m[5] * m[0]) / d
  703. ];
  704. };
  705. Util.apply3dTransform = function Util_apply3dTransform(m, v) {
  706. return [
  707. m[0] * v[0] + m[1] * v[1] + m[2] * v[2],
  708. m[3] * v[0] + m[4] * v[1] + m[5] * v[2],
  709. m[6] * v[0] + m[7] * v[1] + m[8] * v[2]
  710. ];
  711. };
  712. Util.singularValueDecompose2dScale = function Util_singularValueDecompose2dScale(m) {
  713. var transpose = [
  714. m[0],
  715. m[2],
  716. m[1],
  717. m[3]
  718. ];
  719. var a = m[0] * transpose[0] + m[1] * transpose[2];
  720. var b = m[0] * transpose[1] + m[1] * transpose[3];
  721. var c = m[2] * transpose[0] + m[3] * transpose[2];
  722. var d = m[2] * transpose[1] + m[3] * transpose[3];
  723. var first = (a + d) / 2;
  724. var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
  725. var sx = first + second || 1;
  726. var sy = first - second || 1;
  727. return [
  728. Math.sqrt(sx),
  729. Math.sqrt(sy)
  730. ];
  731. };
  732. Util.normalizeRect = function Util_normalizeRect(rect) {
  733. var r = rect.slice(0);
  734. if (rect[0] > rect[2]) {
  735. r[0] = rect[2];
  736. r[2] = rect[0];
  737. }
  738. if (rect[1] > rect[3]) {
  739. r[1] = rect[3];
  740. r[3] = rect[1];
  741. }
  742. return r;
  743. };
  744. Util.intersect = function Util_intersect(rect1, rect2) {
  745. function compare(a, b) {
  746. return a - b;
  747. }
  748. var orderedX = [
  749. rect1[0],
  750. rect1[2],
  751. rect2[0],
  752. rect2[2]
  753. ].sort(compare), orderedY = [
  754. rect1[1],
  755. rect1[3],
  756. rect2[1],
  757. rect2[3]
  758. ].sort(compare), result = [];
  759. rect1 = Util.normalizeRect(rect1);
  760. rect2 = Util.normalizeRect(rect2);
  761. if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
  762. result[0] = orderedX[1];
  763. result[2] = orderedX[2];
  764. } else {
  765. return false;
  766. }
  767. if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
  768. result[1] = orderedY[1];
  769. result[3] = orderedY[2];
  770. } else {
  771. return false;
  772. }
  773. return result;
  774. };
  775. Util.sign = function Util_sign(num) {
  776. return num < 0 ? -1 : 1;
  777. };
  778. var ROMAN_NUMBER_MAP = [
  779. '',
  780. 'C',
  781. 'CC',
  782. 'CCC',
  783. 'CD',
  784. 'D',
  785. 'DC',
  786. 'DCC',
  787. 'DCCC',
  788. 'CM',
  789. '',
  790. 'X',
  791. 'XX',
  792. 'XXX',
  793. 'XL',
  794. 'L',
  795. 'LX',
  796. 'LXX',
  797. 'LXXX',
  798. 'XC',
  799. '',
  800. 'I',
  801. 'II',
  802. 'III',
  803. 'IV',
  804. 'V',
  805. 'VI',
  806. 'VII',
  807. 'VIII',
  808. 'IX'
  809. ];
  810. Util.toRoman = function Util_toRoman(number, lowerCase) {
  811. assert(isInt(number) && number > 0, 'The number should be a positive integer.');
  812. var pos, romanBuf = [];
  813. while (number >= 1000) {
  814. number -= 1000;
  815. romanBuf.push('M');
  816. }
  817. pos = number / 100 | 0;
  818. number %= 100;
  819. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  820. pos = number / 10 | 0;
  821. number %= 10;
  822. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  823. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  824. var romanStr = romanBuf.join('');
  825. return lowerCase ? romanStr.toLowerCase() : romanStr;
  826. };
  827. Util.appendToArray = function Util_appendToArray(arr1, arr2) {
  828. Array.prototype.push.apply(arr1, arr2);
  829. };
  830. Util.prependToArray = function Util_prependToArray(arr1, arr2) {
  831. Array.prototype.unshift.apply(arr1, arr2);
  832. };
  833. Util.extendObj = function extendObj(obj1, obj2) {
  834. for (var key in obj2) {
  835. obj1[key] = obj2[key];
  836. }
  837. };
  838. Util.getInheritableProperty = function Util_getInheritableProperty(dict, name, getArray) {
  839. while (dict && !dict.has(name)) {
  840. dict = dict.get('Parent');
  841. }
  842. if (!dict) {
  843. return null;
  844. }
  845. return getArray ? dict.getArray(name) : dict.get(name);
  846. };
  847. Util.inherit = function Util_inherit(sub, base, prototype) {
  848. sub.prototype = Object.create(base.prototype);
  849. sub.prototype.constructor = sub;
  850. for (var prop in prototype) {
  851. sub.prototype[prop] = prototype[prop];
  852. }
  853. };
  854. Util.loadScript = function Util_loadScript(src, callback) {
  855. var script = document.createElement('script');
  856. var loaded = false;
  857. script.setAttribute('src', src);
  858. if (callback) {
  859. script.onload = function () {
  860. if (!loaded) {
  861. callback();
  862. }
  863. loaded = true;
  864. };
  865. }
  866. document.getElementsByTagName('head')[0].appendChild(script);
  867. };
  868. return Util;
  869. }();
  870. var PageViewport = function PageViewportClosure() {
  871. function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) {
  872. this.viewBox = viewBox;
  873. this.scale = scale;
  874. this.rotation = rotation;
  875. this.offsetX = offsetX;
  876. this.offsetY = offsetY;
  877. var centerX = (viewBox[2] + viewBox[0]) / 2;
  878. var centerY = (viewBox[3] + viewBox[1]) / 2;
  879. var rotateA, rotateB, rotateC, rotateD;
  880. rotation = rotation % 360;
  881. rotation = rotation < 0 ? rotation + 360 : rotation;
  882. switch (rotation) {
  883. case 180:
  884. rotateA = -1;
  885. rotateB = 0;
  886. rotateC = 0;
  887. rotateD = 1;
  888. break;
  889. case 90:
  890. rotateA = 0;
  891. rotateB = 1;
  892. rotateC = 1;
  893. rotateD = 0;
  894. break;
  895. case 270:
  896. rotateA = 0;
  897. rotateB = -1;
  898. rotateC = -1;
  899. rotateD = 0;
  900. break;
  901. default:
  902. rotateA = 1;
  903. rotateB = 0;
  904. rotateC = 0;
  905. rotateD = -1;
  906. break;
  907. }
  908. if (dontFlip) {
  909. rotateC = -rotateC;
  910. rotateD = -rotateD;
  911. }
  912. var offsetCanvasX, offsetCanvasY;
  913. var width, height;
  914. if (rotateA === 0) {
  915. offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;
  916. offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;
  917. width = Math.abs(viewBox[3] - viewBox[1]) * scale;
  918. height = Math.abs(viewBox[2] - viewBox[0]) * scale;
  919. } else {
  920. offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;
  921. offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;
  922. width = Math.abs(viewBox[2] - viewBox[0]) * scale;
  923. height = Math.abs(viewBox[3] - viewBox[1]) * scale;
  924. }
  925. this.transform = [
  926. rotateA * scale,
  927. rotateB * scale,
  928. rotateC * scale,
  929. rotateD * scale,
  930. offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY,
  931. offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY
  932. ];
  933. this.width = width;
  934. this.height = height;
  935. this.fontScale = scale;
  936. }
  937. PageViewport.prototype = {
  938. clone: function PageViewPort_clone(args) {
  939. args = args || {};
  940. var scale = 'scale' in args ? args.scale : this.scale;
  941. var rotation = 'rotation' in args ? args.rotation : this.rotation;
  942. return new PageViewport(this.viewBox.slice(), scale, rotation, this.offsetX, this.offsetY, args.dontFlip);
  943. },
  944. convertToViewportPoint: function PageViewport_convertToViewportPoint(x, y) {
  945. return Util.applyTransform([
  946. x,
  947. y
  948. ], this.transform);
  949. },
  950. convertToViewportRectangle: function PageViewport_convertToViewportRectangle(rect) {
  951. var tl = Util.applyTransform([
  952. rect[0],
  953. rect[1]
  954. ], this.transform);
  955. var br = Util.applyTransform([
  956. rect[2],
  957. rect[3]
  958. ], this.transform);
  959. return [
  960. tl[0],
  961. tl[1],
  962. br[0],
  963. br[1]
  964. ];
  965. },
  966. convertToPdfPoint: function PageViewport_convertToPdfPoint(x, y) {
  967. return Util.applyInverseTransform([
  968. x,
  969. y
  970. ], this.transform);
  971. }
  972. };
  973. return PageViewport;
  974. }();
  975. var PDFStringTranslateTable = [
  976. 0,
  977. 0,
  978. 0,
  979. 0,
  980. 0,
  981. 0,
  982. 0,
  983. 0,
  984. 0,
  985. 0,
  986. 0,
  987. 0,
  988. 0,
  989. 0,
  990. 0,
  991. 0,
  992. 0,
  993. 0,
  994. 0,
  995. 0,
  996. 0,
  997. 0,
  998. 0,
  999. 0,
  1000. 0x2D8,
  1001. 0x2C7,
  1002. 0x2C6,
  1003. 0x2D9,
  1004. 0x2DD,
  1005. 0x2DB,
  1006. 0x2DA,
  1007. 0x2DC,
  1008. 0,
  1009. 0,
  1010. 0,
  1011. 0,
  1012. 0,
  1013. 0,
  1014. 0,
  1015. 0,
  1016. 0,
  1017. 0,
  1018. 0,
  1019. 0,
  1020. 0,
  1021. 0,
  1022. 0,
  1023. 0,
  1024. 0,
  1025. 0,
  1026. 0,
  1027. 0,
  1028. 0,
  1029. 0,
  1030. 0,
  1031. 0,
  1032. 0,
  1033. 0,
  1034. 0,
  1035. 0,
  1036. 0,
  1037. 0,
  1038. 0,
  1039. 0,
  1040. 0,
  1041. 0,
  1042. 0,
  1043. 0,
  1044. 0,
  1045. 0,
  1046. 0,
  1047. 0,
  1048. 0,
  1049. 0,
  1050. 0,
  1051. 0,
  1052. 0,
  1053. 0,
  1054. 0,
  1055. 0,
  1056. 0,
  1057. 0,
  1058. 0,
  1059. 0,
  1060. 0,
  1061. 0,
  1062. 0,
  1063. 0,
  1064. 0,
  1065. 0,
  1066. 0,
  1067. 0,
  1068. 0,
  1069. 0,
  1070. 0,
  1071. 0,
  1072. 0,
  1073. 0,
  1074. 0,
  1075. 0,
  1076. 0,
  1077. 0,
  1078. 0,
  1079. 0,
  1080. 0,
  1081. 0,
  1082. 0,
  1083. 0,
  1084. 0,
  1085. 0,
  1086. 0,
  1087. 0,
  1088. 0,
  1089. 0,
  1090. 0,
  1091. 0,
  1092. 0,
  1093. 0,
  1094. 0,
  1095. 0,
  1096. 0,
  1097. 0,
  1098. 0,
  1099. 0,
  1100. 0,
  1101. 0,
  1102. 0,
  1103. 0,
  1104. 0x2022,
  1105. 0x2020,
  1106. 0x2021,
  1107. 0x2026,
  1108. 0x2014,
  1109. 0x2013,
  1110. 0x192,
  1111. 0x2044,
  1112. 0x2039,
  1113. 0x203A,
  1114. 0x2212,
  1115. 0x2030,
  1116. 0x201E,
  1117. 0x201C,
  1118. 0x201D,
  1119. 0x2018,
  1120. 0x2019,
  1121. 0x201A,
  1122. 0x2122,
  1123. 0xFB01,
  1124. 0xFB02,
  1125. 0x141,
  1126. 0x152,
  1127. 0x160,
  1128. 0x178,
  1129. 0x17D,
  1130. 0x131,
  1131. 0x142,
  1132. 0x153,
  1133. 0x161,
  1134. 0x17E,
  1135. 0,
  1136. 0x20AC
  1137. ];
  1138. function stringToPDFString(str) {
  1139. var i, n = str.length, strBuf = [];
  1140. if (str[0] === '\xFE' && str[1] === '\xFF') {
  1141. for (i = 2; i < n; i += 2) {
  1142. strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
  1143. }
  1144. } else {
  1145. for (i = 0; i < n; ++i) {
  1146. var code = PDFStringTranslateTable[str.charCodeAt(i)];
  1147. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1148. }
  1149. }
  1150. return strBuf.join('');
  1151. }
  1152. function stringToUTF8String(str) {
  1153. return decodeURIComponent(escape(str));
  1154. }
  1155. function utf8StringToString(str) {
  1156. return unescape(encodeURIComponent(str));
  1157. }
  1158. function isEmptyObj(obj) {
  1159. for (var key in obj) {
  1160. return false;
  1161. }
  1162. return true;
  1163. }
  1164. function isBool(v) {
  1165. return typeof v === 'boolean';
  1166. }
  1167. function isInt(v) {
  1168. return typeof v === 'number' && (v | 0) === v;
  1169. }
  1170. function isNum(v) {
  1171. return typeof v === 'number';
  1172. }
  1173. function isString(v) {
  1174. return typeof v === 'string';
  1175. }
  1176. function isArray(v) {
  1177. return v instanceof Array;
  1178. }
  1179. function isArrayBuffer(v) {
  1180. return typeof v === 'object' && v !== null && v.byteLength !== undefined;
  1181. }
  1182. function isSpace(ch) {
  1183. return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A;
  1184. }
  1185. function createPromiseCapability() {
  1186. var capability = {};
  1187. capability.promise = new Promise(function (resolve, reject) {
  1188. capability.resolve = resolve;
  1189. capability.reject = reject;
  1190. });
  1191. return capability;
  1192. }
  1193. (function PromiseClosure() {
  1194. if (globalScope.Promise) {
  1195. if (typeof globalScope.Promise.all !== 'function') {
  1196. globalScope.Promise.all = function (iterable) {
  1197. var count = 0, results = [], resolve, reject;
  1198. var promise = new globalScope.Promise(function (resolve_, reject_) {
  1199. resolve = resolve_;
  1200. reject = reject_;
  1201. });
  1202. iterable.forEach(function (p, i) {
  1203. count++;
  1204. p.then(function (result) {
  1205. results[i] = result;
  1206. count--;
  1207. if (count === 0) {
  1208. resolve(results);
  1209. }
  1210. }, reject);
  1211. });
  1212. if (count === 0) {
  1213. resolve(results);
  1214. }
  1215. return promise;
  1216. };
  1217. }
  1218. if (typeof globalScope.Promise.resolve !== 'function') {
  1219. globalScope.Promise.resolve = function (value) {
  1220. return new globalScope.Promise(function (resolve) {
  1221. resolve(value);
  1222. });
  1223. };
  1224. }
  1225. if (typeof globalScope.Promise.reject !== 'function') {
  1226. globalScope.Promise.reject = function (reason) {
  1227. return new globalScope.Promise(function (resolve, reject) {
  1228. reject(reason);
  1229. });
  1230. };
  1231. }
  1232. if (typeof globalScope.Promise.prototype.catch !== 'function') {
  1233. globalScope.Promise.prototype.catch = function (onReject) {
  1234. return globalScope.Promise.prototype.then(undefined, onReject);
  1235. };
  1236. }
  1237. return;
  1238. }
  1239. var STATUS_PENDING = 0;
  1240. var STATUS_RESOLVED = 1;
  1241. var STATUS_REJECTED = 2;
  1242. var REJECTION_TIMEOUT = 500;
  1243. var HandlerManager = {
  1244. handlers: [],
  1245. running: false,
  1246. unhandledRejections: [],
  1247. pendingRejectionCheck: false,
  1248. scheduleHandlers: function scheduleHandlers(promise) {
  1249. if (promise._status === STATUS_PENDING) {
  1250. return;
  1251. }
  1252. this.handlers = this.handlers.concat(promise._handlers);
  1253. promise._handlers = [];
  1254. if (this.running) {
  1255. return;
  1256. }
  1257. this.running = true;
  1258. setTimeout(this.runHandlers.bind(this), 0);
  1259. },
  1260. runHandlers: function runHandlers() {
  1261. var RUN_TIMEOUT = 1;
  1262. var timeoutAt = Date.now() + RUN_TIMEOUT;
  1263. while (this.handlers.length > 0) {
  1264. var handler = this.handlers.shift();
  1265. var nextStatus = handler.thisPromise._status;
  1266. var nextValue = handler.thisPromise._value;
  1267. try {
  1268. if (nextStatus === STATUS_RESOLVED) {
  1269. if (typeof handler.onResolve === 'function') {
  1270. nextValue = handler.onResolve(nextValue);
  1271. }
  1272. } else if (typeof handler.onReject === 'function') {
  1273. nextValue = handler.onReject(nextValue);
  1274. nextStatus = STATUS_RESOLVED;
  1275. if (handler.thisPromise._unhandledRejection) {
  1276. this.removeUnhandeledRejection(handler.thisPromise);
  1277. }
  1278. }
  1279. } catch (ex) {
  1280. nextStatus = STATUS_REJECTED;
  1281. nextValue = ex;
  1282. }
  1283. handler.nextPromise._updateStatus(nextStatus, nextValue);
  1284. if (Date.now() >= timeoutAt) {
  1285. break;
  1286. }
  1287. }
  1288. if (this.handlers.length > 0) {
  1289. setTimeout(this.runHandlers.bind(this), 0);
  1290. return;
  1291. }
  1292. this.running = false;
  1293. },
  1294. addUnhandledRejection: function addUnhandledRejection(promise) {
  1295. this.unhandledRejections.push({
  1296. promise: promise,
  1297. time: Date.now()
  1298. });
  1299. this.scheduleRejectionCheck();
  1300. },
  1301. removeUnhandeledRejection: function removeUnhandeledRejection(promise) {
  1302. promise._unhandledRejection = false;
  1303. for (var i = 0; i < this.unhandledRejections.length; i++) {
  1304. if (this.unhandledRejections[i].promise === promise) {
  1305. this.unhandledRejections.splice(i);
  1306. i--;
  1307. }
  1308. }
  1309. },
  1310. scheduleRejectionCheck: function scheduleRejectionCheck() {
  1311. if (this.pendingRejectionCheck) {
  1312. return;
  1313. }
  1314. this.pendingRejectionCheck = true;
  1315. setTimeout(function rejectionCheck() {
  1316. this.pendingRejectionCheck = false;
  1317. var now = Date.now();
  1318. for (var i = 0; i < this.unhandledRejections.length; i++) {
  1319. if (now - this.unhandledRejections[i].time > REJECTION_TIMEOUT) {
  1320. var unhandled = this.unhandledRejections[i].promise._value;
  1321. var msg = 'Unhandled rejection: ' + unhandled;
  1322. if (unhandled.stack) {
  1323. msg += '\n' + unhandled.stack;
  1324. }
  1325. warn(msg);
  1326. this.unhandledRejections.splice(i);
  1327. i--;
  1328. }
  1329. }
  1330. if (this.unhandledRejections.length) {
  1331. this.scheduleRejectionCheck();
  1332. }
  1333. }.bind(this), REJECTION_TIMEOUT);
  1334. }
  1335. };
  1336. var Promise = function Promise(resolver) {
  1337. this._status = STATUS_PENDING;
  1338. this._handlers = [];
  1339. try {
  1340. resolver.call(this, this._resolve.bind(this), this._reject.bind(this));
  1341. } catch (e) {
  1342. this._reject(e);
  1343. }
  1344. };
  1345. Promise.all = function Promise_all(promises) {
  1346. var resolveAll, rejectAll;
  1347. var deferred = new Promise(function (resolve, reject) {
  1348. resolveAll = resolve;
  1349. rejectAll = reject;
  1350. });
  1351. var unresolved = promises.length;
  1352. var results = [];
  1353. if (unresolved === 0) {
  1354. resolveAll(results);
  1355. return deferred;
  1356. }
  1357. function reject(reason) {
  1358. if (deferred._status === STATUS_REJECTED) {
  1359. return;
  1360. }
  1361. results = [];
  1362. rejectAll(reason);
  1363. }
  1364. for (var i = 0, ii = promises.length; i < ii; ++i) {
  1365. var promise = promises[i];
  1366. var resolve = function (i) {
  1367. return function (value) {
  1368. if (deferred._status === STATUS_REJECTED) {
  1369. return;
  1370. }
  1371. results[i] = value;
  1372. unresolved--;
  1373. if (unresolved === 0) {
  1374. resolveAll(results);
  1375. }
  1376. };
  1377. }(i);
  1378. if (Promise.isPromise(promise)) {
  1379. promise.then(resolve, reject);
  1380. } else {
  1381. resolve(promise);
  1382. }
  1383. }
  1384. return deferred;
  1385. };
  1386. Promise.isPromise = function Promise_isPromise(value) {
  1387. return value && typeof value.then === 'function';
  1388. };
  1389. Promise.resolve = function Promise_resolve(value) {
  1390. return new Promise(function (resolve) {
  1391. resolve(value);
  1392. });
  1393. };
  1394. Promise.reject = function Promise_reject(reason) {
  1395. return new Promise(function (resolve, reject) {
  1396. reject(reason);
  1397. });
  1398. };
  1399. Promise.prototype = {
  1400. _status: null,
  1401. _value: null,
  1402. _handlers: null,
  1403. _unhandledRejection: null,
  1404. _updateStatus: function Promise__updateStatus(status, value) {
  1405. if (this._status === STATUS_RESOLVED || this._status === STATUS_REJECTED) {
  1406. return;
  1407. }
  1408. if (status === STATUS_RESOLVED && Promise.isPromise(value)) {
  1409. value.then(this._updateStatus.bind(this, STATUS_RESOLVED), this._updateStatus.bind(this, STATUS_REJECTED));
  1410. return;
  1411. }
  1412. this._status = status;
  1413. this._value = value;
  1414. if (status === STATUS_REJECTED && this._handlers.length === 0) {
  1415. this._unhandledRejection = true;
  1416. HandlerManager.addUnhandledRejection(this);
  1417. }
  1418. HandlerManager.scheduleHandlers(this);
  1419. },
  1420. _resolve: function Promise_resolve(value) {
  1421. this._updateStatus(STATUS_RESOLVED, value);
  1422. },
  1423. _reject: function Promise_reject(reason) {
  1424. this._updateStatus(STATUS_REJECTED, reason);
  1425. },
  1426. then: function Promise_then(onResolve, onReject) {
  1427. var nextPromise = new Promise(function (resolve, reject) {
  1428. this.resolve = resolve;
  1429. this.reject = reject;
  1430. });
  1431. this._handlers.push({
  1432. thisPromise: this,
  1433. onResolve: onResolve,
  1434. onReject: onReject,
  1435. nextPromise: nextPromise
  1436. });
  1437. HandlerManager.scheduleHandlers(this);
  1438. return nextPromise;
  1439. },
  1440. catch: function Promise_catch(onReject) {
  1441. return this.then(undefined, onReject);
  1442. }
  1443. };
  1444. globalScope.Promise = Promise;
  1445. }());
  1446. (function WeakMapClosure() {
  1447. if (globalScope.WeakMap) {
  1448. return;
  1449. }
  1450. var id = 0;
  1451. function WeakMap() {
  1452. this.id = '$weakmap' + id++;
  1453. }
  1454. WeakMap.prototype = {
  1455. has: function (obj) {
  1456. return !!Object.getOwnPropertyDescriptor(obj, this.id);
  1457. },
  1458. get: function (obj, defaultValue) {
  1459. return this.has(obj) ? obj[this.id] : defaultValue;
  1460. },
  1461. set: function (obj, value) {
  1462. Object.defineProperty(obj, this.id, {
  1463. value: value,
  1464. enumerable: false,
  1465. configurable: true
  1466. });
  1467. },
  1468. delete: function (obj) {
  1469. delete obj[this.id];
  1470. }
  1471. };
  1472. globalScope.WeakMap = WeakMap;
  1473. }());
  1474. var StatTimer = function StatTimerClosure() {
  1475. function rpad(str, pad, length) {
  1476. while (str.length < length) {
  1477. str += pad;
  1478. }
  1479. return str;
  1480. }
  1481. function StatTimer() {
  1482. this.started = Object.create(null);
  1483. this.times = [];
  1484. this.enabled = true;
  1485. }
  1486. StatTimer.prototype = {
  1487. time: function StatTimer_time(name) {
  1488. if (!this.enabled) {
  1489. return;
  1490. }
  1491. if (name in this.started) {
  1492. warn('Timer is already running for ' + name);
  1493. }
  1494. this.started[name] = Date.now();
  1495. },
  1496. timeEnd: function StatTimer_timeEnd(name) {
  1497. if (!this.enabled) {
  1498. return;
  1499. }
  1500. if (!(name in this.started)) {
  1501. warn('Timer has not been started for ' + name);
  1502. }
  1503. this.times.push({
  1504. 'name': name,
  1505. 'start': this.started[name],
  1506. 'end': Date.now()
  1507. });
  1508. delete this.started[name];
  1509. },
  1510. toString: function StatTimer_toString() {
  1511. var i, ii;
  1512. var times = this.times;
  1513. var out = '';
  1514. var longest = 0;
  1515. for (i = 0, ii = times.length; i < ii; ++i) {
  1516. var name = times[i]['name'];
  1517. if (name.length > longest) {
  1518. longest = name.length;
  1519. }
  1520. }
  1521. for (i = 0, ii = times.length; i < ii; ++i) {
  1522. var span = times[i];
  1523. var duration = span.end - span.start;
  1524. out += rpad(span['name'], ' ', longest) + ' ' + duration + 'ms\n';
  1525. }
  1526. return out;
  1527. }
  1528. };
  1529. return StatTimer;
  1530. }();
  1531. var createBlob = function createBlob(data, contentType) {
  1532. if (typeof Blob !== 'undefined') {
  1533. return new Blob([data], { type: contentType });
  1534. }
  1535. warn('The "Blob" constructor is not supported.');
  1536. };
  1537. var createObjectURL = function createObjectURLClosure() {
  1538. var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  1539. return function createObjectURL(data, contentType, forceDataSchema) {
  1540. if (!forceDataSchema && typeof URL !== 'undefined' && URL.createObjectURL) {
  1541. var blob = createBlob(data, contentType);
  1542. return URL.createObjectURL(blob);
  1543. }
  1544. var buffer = 'data:' + contentType + ';base64,';
  1545. for (var i = 0, ii = data.length; i < ii; i += 3) {
  1546. var b1 = data[i] & 0xFF;
  1547. var b2 = data[i + 1] & 0xFF;
  1548. var b3 = data[i + 2] & 0xFF;
  1549. var d1 = b1 >> 2, d2 = (b1 & 3) << 4 | b2 >> 4;
  1550. var d3 = i + 1 < ii ? (b2 & 0xF) << 2 | b3 >> 6 : 64;
  1551. var d4 = i + 2 < ii ? b3 & 0x3F : 64;
  1552. buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
  1553. }
  1554. return buffer;
  1555. };
  1556. }();
  1557. function MessageHandler(sourceName, targetName, comObj) {
  1558. this.sourceName = sourceName;
  1559. this.targetName = targetName;
  1560. this.comObj = comObj;
  1561. this.callbackIndex = 1;
  1562. this.postMessageTransfers = true;
  1563. var callbacksCapabilities = this.callbacksCapabilities = Object.create(null);
  1564. var ah = this.actionHandler = Object.create(null);
  1565. this._onComObjOnMessage = function messageHandlerComObjOnMessage(event) {
  1566. var data = event.data;
  1567. if (data.targetName !== this.sourceName) {
  1568. return;
  1569. }
  1570. if (data.isReply) {
  1571. var callbackId = data.callbackId;
  1572. if (data.callbackId in callbacksCapabilities) {
  1573. var callback = callbacksCapabilities[callbackId];
  1574. delete callbacksCapabilities[callbackId];
  1575. if ('error' in data) {
  1576. callback.reject(data.error);
  1577. } else {
  1578. callback.resolve(data.data);
  1579. }
  1580. } else {
  1581. error('Cannot resolve callback ' + callbackId);
  1582. }
  1583. } else if (data.action in ah) {
  1584. var action = ah[data.action];
  1585. if (data.callbackId) {
  1586. var sourceName = this.sourceName;
  1587. var targetName = data.sourceName;
  1588. Promise.resolve().then(function () {
  1589. return action[0].call(action[1], data.data);
  1590. }).then(function (result) {
  1591. comObj.postMessage({
  1592. sourceName: sourceName,
  1593. targetName: targetName,
  1594. isReply: true,
  1595. callbackId: data.callbackId,
  1596. data: result
  1597. });
  1598. }, function (reason) {
  1599. if (reason instanceof Error) {
  1600. reason = reason + '';
  1601. }
  1602. comObj.postMessage({
  1603. sourceName: sourceName,
  1604. targetName: targetName,
  1605. isReply: true,
  1606. callbackId: data.callbackId,
  1607. error: reason
  1608. });
  1609. });
  1610. } else {
  1611. action[0].call(action[1], data.data);
  1612. }
  1613. } else {
  1614. error('Unknown action from worker: ' + data.action);
  1615. }
  1616. }.bind(this);
  1617. comObj.addEventListener('message', this._onComObjOnMessage);
  1618. }
  1619. MessageHandler.prototype = {
  1620. on: function messageHandlerOn(actionName, handler, scope) {
  1621. var ah = this.actionHandler;
  1622. if (ah[actionName]) {
  1623. error('There is already an actionName called "' + actionName + '"');
  1624. }
  1625. ah[actionName] = [
  1626. handler,
  1627. scope
  1628. ];
  1629. },
  1630. send: function messageHandlerSend(actionName, data, transfers) {
  1631. var message = {
  1632. sourceName: this.sourceName,
  1633. targetName: this.targetName,
  1634. action: actionName,
  1635. data: data
  1636. };
  1637. this.postMessage(message, transfers);
  1638. },
  1639. sendWithPromise: function messageHandlerSendWithPromise(actionName, data, transfers) {
  1640. var callbackId = this.callbackIndex++;
  1641. var message = {
  1642. sourceName: this.sourceName,
  1643. targetName: this.targetName,
  1644. action: actionName,
  1645. data: data,
  1646. callbackId: callbackId
  1647. };
  1648. var capability = createPromiseCapability();
  1649. this.callbacksCapabilities[callbackId] = capability;
  1650. try {
  1651. this.postMessage(message, transfers);
  1652. } catch (e) {
  1653. capability.reject(e);
  1654. }
  1655. return capability.promise;
  1656. },
  1657. postMessage: function (message, transfers) {
  1658. if (transfers && this.postMessageTransfers) {
  1659. this.comObj.postMessage(message, transfers);
  1660. } else {
  1661. this.comObj.postMessage(message);
  1662. }
  1663. },
  1664. destroy: function () {
  1665. this.comObj.removeEventListener('message', this._onComObjOnMessage);
  1666. }
  1667. };
  1668. function loadJpegStream(id, imageUrl, objs) {
  1669. var img = new Image();
  1670. img.onload = function loadJpegStream_onloadClosure() {
  1671. objs.resolve(id, img);
  1672. };
  1673. img.onerror = function loadJpegStream_onerrorClosure() {
  1674. objs.resolve(id, null);
  1675. warn('Error during JPEG image loading');
  1676. };
  1677. img.src = imageUrl;
  1678. }
  1679. (function checkURLConstructor(scope) {
  1680. var hasWorkingUrl = false;
  1681. try {
  1682. if (typeof URL === 'function' && typeof URL.prototype === 'object' && 'origin' in URL.prototype) {
  1683. var u = new URL('b', 'http://a');
  1684. u.pathname = 'c%20d';
  1685. hasWorkingUrl = u.href === 'http://a/c%20d';
  1686. }
  1687. } catch (e) {
  1688. }
  1689. if (hasWorkingUrl) {
  1690. return;
  1691. }
  1692. var relative = Object.create(null);
  1693. relative['ftp'] = 21;
  1694. relative['file'] = 0;
  1695. relative['gopher'] = 70;
  1696. relative['http'] = 80;
  1697. relative['https'] = 443;
  1698. relative['ws'] = 80;
  1699. relative['wss'] = 443;
  1700. var relativePathDotMapping = Object.create(null);
  1701. relativePathDotMapping['%2e'] = '.';
  1702. relativePathDotMapping['.%2e'] = '..';
  1703. relativePathDotMapping['%2e.'] = '..';
  1704. relativePathDotMapping['%2e%2e'] = '..';
  1705. function isRelativeScheme(scheme) {
  1706. return relative[scheme] !== undefined;
  1707. }
  1708. function invalid() {
  1709. clear.call(this);
  1710. this._isInvalid = true;
  1711. }
  1712. function IDNAToASCII(h) {
  1713. if (h === '') {
  1714. invalid.call(this);
  1715. }
  1716. return h.toLowerCase();
  1717. }
  1718. function percentEscape(c) {
  1719. var unicode = c.charCodeAt(0);
  1720. if (unicode > 0x20 && unicode < 0x7F && [
  1721. 0x22,
  1722. 0x23,
  1723. 0x3C,
  1724. 0x3E,
  1725. 0x3F,
  1726. 0x60
  1727. ].indexOf(unicode) === -1) {
  1728. return c;
  1729. }
  1730. return encodeURIComponent(c);
  1731. }
  1732. function percentEscapeQuery(c) {
  1733. var unicode = c.charCodeAt(0);
  1734. if (unicode > 0x20 && unicode < 0x7F && [
  1735. 0x22,
  1736. 0x23,
  1737. 0x3C,
  1738. 0x3E,
  1739. 0x60
  1740. ].indexOf(unicode) === -1) {
  1741. return c;
  1742. }
  1743. return encodeURIComponent(c);
  1744. }
  1745. var EOF, ALPHA = /[a-zA-Z]/, ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/;
  1746. function parse(input, stateOverride, base) {
  1747. function err(message) {
  1748. errors.push(message);
  1749. }
  1750. var state = stateOverride || 'scheme start', cursor = 0, buffer = '', seenAt = false, seenBracket = false, errors = [];
  1751. loop:
  1752. while ((input[cursor - 1] !== EOF || cursor === 0) && !this._isInvalid) {
  1753. var c = input[cursor];
  1754. switch (state) {
  1755. case 'scheme start':
  1756. if (c && ALPHA.test(c)) {
  1757. buffer += c.toLowerCase();
  1758. state = 'scheme';
  1759. } else if (!stateOverride) {
  1760. buffer = '';
  1761. state = 'no scheme';
  1762. continue;
  1763. } else {
  1764. err('Invalid scheme.');
  1765. break loop;
  1766. }
  1767. break;
  1768. case 'scheme':
  1769. if (c && ALPHANUMERIC.test(c)) {
  1770. buffer += c.toLowerCase();
  1771. } else if (c === ':') {
  1772. this._scheme = buffer;
  1773. buffer = '';
  1774. if (stateOverride) {
  1775. break loop;
  1776. }
  1777. if (isRelativeScheme(this._scheme)) {
  1778. this._isRelative = true;
  1779. }
  1780. if (this._scheme === 'file') {
  1781. state = 'relative';
  1782. } else if (this._isRelative && base && base._scheme === this._scheme) {
  1783. state = 'relative or authority';
  1784. } else if (this._isRelative) {
  1785. state = 'authority first slash';
  1786. } else {
  1787. state = 'scheme data';
  1788. }
  1789. } else if (!stateOverride) {
  1790. buffer = '';
  1791. cursor = 0;
  1792. state = 'no scheme';
  1793. continue;
  1794. } else if (EOF === c) {
  1795. break loop;
  1796. } else {
  1797. err('Code point not allowed in scheme: ' + c);
  1798. break loop;
  1799. }
  1800. break;
  1801. case 'scheme data':
  1802. if (c === '?') {
  1803. this._query = '?';
  1804. state = 'query';
  1805. } else if (c === '#') {
  1806. this._fragment = '#';
  1807. state = 'fragment';
  1808. } else {
  1809. if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) {
  1810. this._schemeData += percentEscape(c);
  1811. }
  1812. }
  1813. break;
  1814. case 'no scheme':
  1815. if (!base || !isRelativeScheme(base._scheme)) {
  1816. err('Missing scheme.');
  1817. invalid.call(this);
  1818. } else {
  1819. state = 'relative';
  1820. continue;
  1821. }
  1822. break;
  1823. case 'relative or authority':
  1824. if (c === '/' && input[cursor + 1] === '/') {
  1825. state = 'authority ignore slashes';
  1826. } else {
  1827. err('Expected /, got: ' + c);
  1828. state = 'relative';
  1829. continue;
  1830. }
  1831. break;
  1832. case 'relative':
  1833. this._isRelative = true;
  1834. if ('file' !== this._scheme) {
  1835. this._scheme = base._scheme;
  1836. }
  1837. if (EOF === c) {
  1838. this._host = base._host;
  1839. this._port = base._port;
  1840. this._path = base._path.slice();
  1841. this._query = base._query;
  1842. this._username = base._username;
  1843. this._password = base._password;
  1844. break loop;
  1845. } else if (c === '/' || c === '\\') {
  1846. if (c === '\\') {
  1847. err('\\ is an invalid code point.');
  1848. }
  1849. state = 'relative slash';
  1850. } else if (c === '?') {
  1851. this._host = base._host;
  1852. this._port = base._port;
  1853. this._path = base._path.slice();
  1854. this._query = '?';
  1855. this._username = base._username;
  1856. this._password = base._password;
  1857. state = 'query';
  1858. } else if (c === '#') {
  1859. this._host = base._host;
  1860. this._port = base._port;
  1861. this._path = base._path.slice();
  1862. this._query = base._query;
  1863. this._fragment = '#';
  1864. this._username = base._username;
  1865. this._password = base._password;
  1866. state = 'fragment';
  1867. } else {
  1868. var nextC = input[cursor + 1];
  1869. var nextNextC = input[cursor + 2];
  1870. if ('file' !== this._scheme || !ALPHA.test(c) || nextC !== ':' && nextC !== '|' || EOF !== nextNextC && '/' !== nextNextC && '\\' !== nextNextC && '?' !== nextNextC && '#' !== nextNextC) {
  1871. this._host = base._host;
  1872. this._port = base._port;
  1873. this._username = base._username;
  1874. this._password = base._password;
  1875. this._path = base._path.slice();
  1876. this._path.pop();
  1877. }
  1878. state = 'relative path';
  1879. continue;
  1880. }
  1881. break;
  1882. case 'relative slash':
  1883. if (c === '/' || c === '\\') {
  1884. if (c === '\\') {
  1885. err('\\ is an invalid code point.');
  1886. }
  1887. if (this._scheme === 'file') {
  1888. state = 'file host';
  1889. } else {
  1890. state = 'authority ignore slashes';
  1891. }
  1892. } else {
  1893. if ('file' !== this._scheme) {
  1894. this._host = base._host;
  1895. this._port = base._port;
  1896. this._username = base._username;
  1897. this._password = base._password;
  1898. }
  1899. state = 'relative path';
  1900. continue;
  1901. }
  1902. break;
  1903. case 'authority first slash':
  1904. if (c === '/') {
  1905. state = 'authority second slash';
  1906. } else {
  1907. err('Expected \'/\', got: ' + c);
  1908. state = 'authority ignore slashes';
  1909. continue;
  1910. }
  1911. break;
  1912. case 'authority second slash':
  1913. state = 'authority ignore slashes';
  1914. if ('/' !== c) {
  1915. err('Expected \'/\', got: ' + c);
  1916. continue;
  1917. }
  1918. break;
  1919. case 'authority ignore slashes':
  1920. if ('/' !== c && '\\' !== c) {
  1921. state = 'authority';
  1922. continue;
  1923. } else {
  1924. err('Expected authority, got: ' + c);
  1925. }
  1926. break;
  1927. case 'authority':
  1928. if (c === '@') {
  1929. if (seenAt) {
  1930. err('@ already seen.');
  1931. buffer += '%40';
  1932. }
  1933. seenAt = true;
  1934. for (var i = 0; i < buffer.length; i++) {
  1935. var cp = buffer[i];
  1936. if (cp === '\t' || cp === '\n' || cp === '\r') {
  1937. err('Invalid whitespace in authority.');
  1938. continue;
  1939. }
  1940. if (cp === ':' && this._password === null) {
  1941. this._password = '';
  1942. continue;
  1943. }
  1944. var tempC = percentEscape(cp);
  1945. if (null !== this._password) {
  1946. this._password += tempC;
  1947. } else {
  1948. this._username += tempC;
  1949. }
  1950. }
  1951. buffer = '';
  1952. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  1953. cursor -= buffer.length;
  1954. buffer = '';
  1955. state = 'host';
  1956. continue;
  1957. } else {
  1958. buffer += c;
  1959. }
  1960. break;
  1961. case 'file host':
  1962. if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  1963. if (buffer.length === 2 && ALPHA.test(buffer[0]) && (buffer[1] === ':' || buffer[1] === '|')) {
  1964. state = 'relative path';
  1965. } else if (buffer.length === 0) {
  1966. state = 'relative path start';
  1967. } else {
  1968. this._host = IDNAToASCII.call(this, buffer);
  1969. buffer = '';
  1970. state = 'relative path start';
  1971. }
  1972. continue;
  1973. } else if (c === '\t' || c === '\n' || c === '\r') {
  1974. err('Invalid whitespace in file host.');
  1975. } else {
  1976. buffer += c;
  1977. }
  1978. break;
  1979. case 'host':
  1980. case 'hostname':
  1981. if (c === ':' && !seenBracket) {
  1982. this._host = IDNAToASCII.call(this, buffer);
  1983. buffer = '';
  1984. state = 'port';
  1985. if (stateOverride === 'hostname') {
  1986. break loop;
  1987. }
  1988. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  1989. this._host = IDNAToASCII.call(this, buffer);
  1990. buffer = '';
  1991. state = 'relative path start';
  1992. if (stateOverride) {
  1993. break loop;
  1994. }
  1995. continue;
  1996. } else if ('\t' !== c && '\n' !== c && '\r' !== c) {
  1997. if (c === '[') {
  1998. seenBracket = true;
  1999. } else if (c === ']') {
  2000. seenBracket = false;
  2001. }
  2002. buffer += c;
  2003. } else {
  2004. err('Invalid code point in host/hostname: ' + c);
  2005. }
  2006. break;
  2007. case 'port':
  2008. if (/[0-9]/.test(c)) {
  2009. buffer += c;
  2010. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#' || stateOverride) {
  2011. if ('' !== buffer) {
  2012. var temp = parseInt(buffer, 10);
  2013. if (temp !== relative[this._scheme]) {
  2014. this._port = temp + '';
  2015. }
  2016. buffer = '';
  2017. }
  2018. if (stateOverride) {
  2019. break loop;
  2020. }
  2021. state = 'relative path start';
  2022. continue;
  2023. } else if (c === '\t' || c === '\n' || c === '\r') {
  2024. err('Invalid code point in port: ' + c);
  2025. } else {
  2026. invalid.call(this);
  2027. }
  2028. break;
  2029. case 'relative path start':
  2030. if (c === '\\') {
  2031. err('\'\\\' not allowed in path.');
  2032. }
  2033. state = 'relative path';
  2034. if ('/' !== c && '\\' !== c) {
  2035. continue;
  2036. }
  2037. break;
  2038. case 'relative path':
  2039. if (c === EOF || c === '/' || c === '\\' || !stateOverride && (c === '?' || c === '#')) {
  2040. if (c === '\\') {
  2041. err('\\ not allowed in relative path.');
  2042. }
  2043. var tmp;
  2044. if (tmp = relativePathDotMapping[buffer.toLowerCase()]) {
  2045. buffer = tmp;
  2046. }
  2047. if (buffer === '..') {
  2048. this._path.pop();
  2049. if ('/' !== c && '\\' !== c) {
  2050. this._path.push('');
  2051. }
  2052. } else if (buffer === '.' && '/' !== c && '\\' !== c) {
  2053. this._path.push('');
  2054. } else if ('.' !== buffer) {
  2055. if (this._scheme === 'file' && this._path.length === 0 && buffer.length === 2 && ALPHA.test(buffer[0]) && buffer[1] === '|') {
  2056. buffer = buffer[0] + ':';
  2057. }
  2058. this._path.push(buffer);
  2059. }
  2060. buffer = '';
  2061. if (c === '?') {
  2062. this._query = '?';
  2063. state = 'query';
  2064. } else if (c === '#') {
  2065. this._fragment = '#';
  2066. state = 'fragment';
  2067. }
  2068. } else if ('\t' !== c && '\n' !== c && '\r' !== c) {
  2069. buffer += percentEscape(c);
  2070. }
  2071. break;
  2072. case 'query':
  2073. if (!stateOverride && c === '#') {
  2074. this._fragment = '#';
  2075. state = 'fragment';
  2076. } else if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) {
  2077. this._query += percentEscapeQuery(c);
  2078. }
  2079. break;
  2080. case 'fragment':
  2081. if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) {
  2082. this._fragment += c;
  2083. }
  2084. break;
  2085. }
  2086. cursor++;
  2087. }
  2088. }
  2089. function clear() {
  2090. this._scheme = '';
  2091. this._schemeData = '';
  2092. this._username = '';
  2093. this._password = null;
  2094. this._host = '';
  2095. this._port = '';
  2096. this._path = [];
  2097. this._query = '';
  2098. this._fragment = '';
  2099. this._isInvalid = false;
  2100. this._isRelative = false;
  2101. }
  2102. function JURL(url, base) {
  2103. if (base !== undefined && !(base instanceof JURL)) {
  2104. base = new JURL(String(base));
  2105. }
  2106. this._url = url;
  2107. clear.call(this);
  2108. var input = url.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g, '');
  2109. parse.call(this, input, null, base);
  2110. }
  2111. JURL.prototype = {
  2112. toString: function () {
  2113. return this.href;
  2114. },
  2115. get href() {
  2116. if (this._isInvalid) {
  2117. return this._url;
  2118. }
  2119. var authority = '';
  2120. if ('' !== this._username || null !== this._password) {
  2121. authority = this._username + (null !== this._password ? ':' + this._password : '') + '@';
  2122. }
  2123. return this.protocol + (this._isRelative ? '//' + authority + this.host : '') + this.pathname + this._query + this._fragment;
  2124. },
  2125. set href(href) {
  2126. clear.call(this);
  2127. parse.call(this, href);
  2128. },
  2129. get protocol() {
  2130. return this._scheme + ':';
  2131. },
  2132. set protocol(protocol) {
  2133. if (this._isInvalid) {
  2134. return;
  2135. }
  2136. parse.call(this, protocol + ':', 'scheme start');
  2137. },
  2138. get host() {
  2139. return this._isInvalid ? '' : this._port ? this._host + ':' + this._port : this._host;
  2140. },
  2141. set host(host) {
  2142. if (this._isInvalid || !this._isRelative) {
  2143. return;
  2144. }
  2145. parse.call(this, host, 'host');
  2146. },
  2147. get hostname() {
  2148. return this._host;
  2149. },
  2150. set hostname(hostname) {
  2151. if (this._isInvalid || !this._isRelative) {
  2152. return;
  2153. }
  2154. parse.call(this, hostname, 'hostname');
  2155. },
  2156. get port() {
  2157. return this._port;
  2158. },
  2159. set port(port) {
  2160. if (this._isInvalid || !this._isRelative) {
  2161. return;
  2162. }
  2163. parse.call(this, port, 'port');
  2164. },
  2165. get pathname() {
  2166. return this._isInvalid ? '' : this._isRelative ? '/' + this._path.join('/') : this._schemeData;
  2167. },
  2168. set pathname(pathname) {
  2169. if (this._isInvalid || !this._isRelative) {
  2170. return;
  2171. }
  2172. this._path = [];
  2173. parse.call(this, pathname, 'relative path start');
  2174. },
  2175. get search() {
  2176. return this._isInvalid || !this._query || this._query === '?' ? '' : this._query;
  2177. },
  2178. set search(search) {
  2179. if (this._isInvalid || !this._isRelative) {
  2180. return;
  2181. }
  2182. this._query = '?';
  2183. if (search[0] === '?') {
  2184. search = search.slice(1);
  2185. }
  2186. parse.call(this, search, 'query');
  2187. },
  2188. get hash() {
  2189. return this._isInvalid || !this._fragment || this._fragment === '#' ? '' : this._fragment;
  2190. },
  2191. set hash(hash) {
  2192. if (this._isInvalid) {
  2193. return;
  2194. }
  2195. this._fragment = '#';
  2196. if (hash[0] === '#') {
  2197. hash = hash.slice(1);
  2198. }
  2199. parse.call(this, hash, 'fragment');
  2200. },
  2201. get origin() {
  2202. var host;
  2203. if (this._isInvalid || !this._scheme) {
  2204. return '';
  2205. }
  2206. switch (this._scheme) {
  2207. case 'data':
  2208. case 'file':
  2209. case 'javascript':
  2210. case 'mailto':
  2211. return 'null';
  2212. }
  2213. host = this.host;
  2214. if (!host) {
  2215. return '';
  2216. }
  2217. return this._scheme + '://' + host;
  2218. }
  2219. };
  2220. var OriginalURL = scope.URL;
  2221. if (OriginalURL) {
  2222. JURL.createObjectURL = function (blob) {
  2223. return OriginalURL.createObjectURL.apply(OriginalURL, arguments);
  2224. };
  2225. JURL.revokeObjectURL = function (url) {
  2226. OriginalURL.revokeObjectURL(url);
  2227. };
  2228. }
  2229. scope.URL = JURL;
  2230. }(globalScope));
  2231. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  2232. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  2233. exports.OPS = OPS;
  2234. exports.VERBOSITY_LEVELS = VERBOSITY_LEVELS;
  2235. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  2236. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  2237. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  2238. exports.AnnotationFlag = AnnotationFlag;
  2239. exports.AnnotationType = AnnotationType;
  2240. exports.FontType = FontType;
  2241. exports.ImageKind = ImageKind;
  2242. exports.InvalidPDFException = InvalidPDFException;
  2243. exports.MessageHandler = MessageHandler;
  2244. exports.MissingDataException = MissingDataException;
  2245. exports.MissingPDFException = MissingPDFException;
  2246. exports.NotImplementedException = NotImplementedException;
  2247. exports.PageViewport = PageViewport;
  2248. exports.PasswordException = PasswordException;
  2249. exports.PasswordResponses = PasswordResponses;
  2250. exports.StatTimer = StatTimer;
  2251. exports.StreamType = StreamType;
  2252. exports.TextRenderingMode = TextRenderingMode;
  2253. exports.UnexpectedResponseException = UnexpectedResponseException;
  2254. exports.UnknownErrorException = UnknownErrorException;
  2255. exports.Util = Util;
  2256. exports.XRefParseException = XRefParseException;
  2257. exports.arrayByteLength = arrayByteLength;
  2258. exports.arraysToBytes = arraysToBytes;
  2259. exports.assert = assert;
  2260. exports.bytesToString = bytesToString;
  2261. exports.createBlob = createBlob;
  2262. exports.createPromiseCapability = createPromiseCapability;
  2263. exports.createObjectURL = createObjectURL;
  2264. exports.deprecated = deprecated;
  2265. exports.error = error;
  2266. exports.getLookupTableFactory = getLookupTableFactory;
  2267. exports.getVerbosityLevel = getVerbosityLevel;
  2268. exports.globalScope = globalScope;
  2269. exports.info = info;
  2270. exports.isArray = isArray;
  2271. exports.isArrayBuffer = isArrayBuffer;
  2272. exports.isBool = isBool;
  2273. exports.isEmptyObj = isEmptyObj;
  2274. exports.isInt = isInt;
  2275. exports.isNum = isNum;
  2276. exports.isString = isString;
  2277. exports.isSpace = isSpace;
  2278. exports.isSameOrigin = isSameOrigin;
  2279. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  2280. exports.isLittleEndian = isLittleEndian;
  2281. exports.isEvalSupported = isEvalSupported;
  2282. exports.loadJpegStream = loadJpegStream;
  2283. exports.log2 = log2;
  2284. exports.readInt8 = readInt8;
  2285. exports.readUint16 = readUint16;
  2286. exports.readUint32 = readUint32;
  2287. exports.removeNullCharacters = removeNullCharacters;
  2288. exports.setVerbosityLevel = setVerbosityLevel;
  2289. exports.shadow = shadow;
  2290. exports.string32 = string32;
  2291. exports.stringToBytes = stringToBytes;
  2292. exports.stringToPDFString = stringToPDFString;
  2293. exports.stringToUTF8String = stringToUTF8String;
  2294. exports.utf8StringToString = utf8StringToString;
  2295. exports.warn = warn;
  2296. /* WEBPACK VAR INJECTION */}.call(exports, __w_pdfjs_require__(19)))
  2297. /***/ }),
  2298. /* 1 */
  2299. /***/ (function(module, exports, __w_pdfjs_require__) {
  2300. "use strict";
  2301. var sharedUtil = __w_pdfjs_require__(0);
  2302. var isArray = sharedUtil.isArray;
  2303. var EOF = {};
  2304. var Name = function NameClosure() {
  2305. function Name(name) {
  2306. this.name = name;
  2307. }
  2308. Name.prototype = {};
  2309. var nameCache = Object.create(null);
  2310. Name.get = function Name_get(name) {
  2311. var nameValue = nameCache[name];
  2312. return nameValue ? nameValue : nameCache[name] = new Name(name);
  2313. };
  2314. return Name;
  2315. }();
  2316. var Cmd = function CmdClosure() {
  2317. function Cmd(cmd) {
  2318. this.cmd = cmd;
  2319. }
  2320. Cmd.prototype = {};
  2321. var cmdCache = Object.create(null);
  2322. Cmd.get = function Cmd_get(cmd) {
  2323. var cmdValue = cmdCache[cmd];
  2324. return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd);
  2325. };
  2326. return Cmd;
  2327. }();
  2328. var Dict = function DictClosure() {
  2329. var nonSerializable = function nonSerializableClosure() {
  2330. return nonSerializable;
  2331. };
  2332. function Dict(xref) {
  2333. this.map = Object.create(null);
  2334. this.xref = xref;
  2335. this.objId = null;
  2336. this.suppressEncryption = false;
  2337. this.__nonSerializable__ = nonSerializable;
  2338. }
  2339. Dict.prototype = {
  2340. assignXref: function Dict_assignXref(newXref) {
  2341. this.xref = newXref;
  2342. },
  2343. get: function Dict_get(key1, key2, key3) {
  2344. var value;
  2345. var xref = this.xref, suppressEncryption = this.suppressEncryption;
  2346. if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map || typeof key2 === 'undefined') {
  2347. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  2348. }
  2349. if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map || typeof key3 === 'undefined') {
  2350. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  2351. }
  2352. value = this.map[key3] || null;
  2353. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  2354. },
  2355. getAsync: function Dict_getAsync(key1, key2, key3) {
  2356. var value;
  2357. var xref = this.xref, suppressEncryption = this.suppressEncryption;
  2358. if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map || typeof key2 === 'undefined') {
  2359. if (xref) {
  2360. return xref.fetchIfRefAsync(value, suppressEncryption);
  2361. }
  2362. return Promise.resolve(value);
  2363. }
  2364. if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map || typeof key3 === 'undefined') {
  2365. if (xref) {
  2366. return xref.fetchIfRefAsync(value, suppressEncryption);
  2367. }
  2368. return Promise.resolve(value);
  2369. }
  2370. value = this.map[key3] || null;
  2371. if (xref) {
  2372. return xref.fetchIfRefAsync(value, suppressEncryption);
  2373. }
  2374. return Promise.resolve(value);
  2375. },
  2376. getArray: function Dict_getArray(key1, key2, key3) {
  2377. var value = this.get(key1, key2, key3);
  2378. var xref = this.xref, suppressEncryption = this.suppressEncryption;
  2379. if (!isArray(value) || !xref) {
  2380. return value;
  2381. }
  2382. value = value.slice();
  2383. for (var i = 0, ii = value.length; i < ii; i++) {
  2384. if (!isRef(value[i])) {
  2385. continue;
  2386. }
  2387. value[i] = xref.fetch(value[i], suppressEncryption);
  2388. }
  2389. return value;
  2390. },
  2391. getRaw: function Dict_getRaw(key) {
  2392. return this.map[key];
  2393. },
  2394. getKeys: function Dict_getKeys() {
  2395. return Object.keys(this.map);
  2396. },
  2397. set: function Dict_set(key, value) {
  2398. this.map[key] = value;
  2399. },
  2400. has: function Dict_has(key) {
  2401. return key in this.map;
  2402. },
  2403. forEach: function Dict_forEach(callback) {
  2404. for (var key in this.map) {
  2405. callback(key, this.get(key));
  2406. }
  2407. }
  2408. };
  2409. Dict.empty = new Dict(null);
  2410. Dict.merge = function Dict_merge(xref, dictArray) {
  2411. var mergedDict = new Dict(xref);
  2412. for (var i = 0, ii = dictArray.length; i < ii; i++) {
  2413. var dict = dictArray[i];
  2414. if (!isDict(dict)) {
  2415. continue;
  2416. }
  2417. for (var keyName in dict.map) {
  2418. if (mergedDict.map[keyName]) {
  2419. continue;
  2420. }
  2421. mergedDict.map[keyName] = dict.map[keyName];
  2422. }
  2423. }
  2424. return mergedDict;
  2425. };
  2426. return Dict;
  2427. }();
  2428. var Ref = function RefClosure() {
  2429. function Ref(num, gen) {
  2430. this.num = num;
  2431. this.gen = gen;
  2432. }
  2433. Ref.prototype = {
  2434. toString: function Ref_toString() {
  2435. var str = this.num + 'R';
  2436. if (this.gen !== 0) {
  2437. str += this.gen;
  2438. }
  2439. return str;
  2440. }
  2441. };
  2442. return Ref;
  2443. }();
  2444. var RefSet = function RefSetClosure() {
  2445. function RefSet() {
  2446. this.dict = Object.create(null);
  2447. }
  2448. RefSet.prototype = {
  2449. has: function RefSet_has(ref) {
  2450. return ref.toString() in this.dict;
  2451. },
  2452. put: function RefSet_put(ref) {
  2453. this.dict[ref.toString()] = true;
  2454. },
  2455. remove: function RefSet_remove(ref) {
  2456. delete this.dict[ref.toString()];
  2457. }
  2458. };
  2459. return RefSet;
  2460. }();
  2461. var RefSetCache = function RefSetCacheClosure() {
  2462. function RefSetCache() {
  2463. this.dict = Object.create(null);
  2464. }
  2465. RefSetCache.prototype = {
  2466. get: function RefSetCache_get(ref) {
  2467. return this.dict[ref.toString()];
  2468. },
  2469. has: function RefSetCache_has(ref) {
  2470. return ref.toString() in this.dict;
  2471. },
  2472. put: function RefSetCache_put(ref, obj) {
  2473. this.dict[ref.toString()] = obj;
  2474. },
  2475. putAlias: function RefSetCache_putAlias(ref, aliasRef) {
  2476. this.dict[ref.toString()] = this.get(aliasRef);
  2477. },
  2478. forEach: function RefSetCache_forEach(fn, thisArg) {
  2479. for (var i in this.dict) {
  2480. fn.call(thisArg, this.dict[i]);
  2481. }
  2482. },
  2483. clear: function RefSetCache_clear() {
  2484. this.dict = Object.create(null);
  2485. }
  2486. };
  2487. return RefSetCache;
  2488. }();
  2489. function isEOF(v) {
  2490. return v === EOF;
  2491. }
  2492. function isName(v, name) {
  2493. return v instanceof Name && (name === undefined || v.name === name);
  2494. }
  2495. function isCmd(v, cmd) {
  2496. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  2497. }
  2498. function isDict(v, type) {
  2499. return v instanceof Dict && (type === undefined || isName(v.get('Type'), type));
  2500. }
  2501. function isRef(v) {
  2502. return v instanceof Ref;
  2503. }
  2504. function isRefsEqual(v1, v2) {
  2505. return v1.num === v2.num && v1.gen === v2.gen;
  2506. }
  2507. function isStream(v) {
  2508. return typeof v === 'object' && v !== null && v.getBytes !== undefined;
  2509. }
  2510. exports.EOF = EOF;
  2511. exports.Cmd = Cmd;
  2512. exports.Dict = Dict;
  2513. exports.Name = Name;
  2514. exports.Ref = Ref;
  2515. exports.RefSet = RefSet;
  2516. exports.RefSetCache = RefSetCache;
  2517. exports.isEOF = isEOF;
  2518. exports.isCmd = isCmd;
  2519. exports.isDict = isDict;
  2520. exports.isName = isName;
  2521. exports.isRef = isRef;
  2522. exports.isRefsEqual = isRefsEqual;
  2523. exports.isStream = isStream;
  2524. /***/ }),
  2525. /* 2 */
  2526. /***/ (function(module, exports, __w_pdfjs_require__) {
  2527. "use strict";
  2528. var sharedUtil = __w_pdfjs_require__(0);
  2529. var corePrimitives = __w_pdfjs_require__(1);
  2530. var coreJbig2 = __w_pdfjs_require__(29);
  2531. var coreJpg = __w_pdfjs_require__(30);
  2532. var coreJpx = __w_pdfjs_require__(14);
  2533. var Util = sharedUtil.Util;
  2534. var error = sharedUtil.error;
  2535. var info = sharedUtil.info;
  2536. var isInt = sharedUtil.isInt;
  2537. var isArray = sharedUtil.isArray;
  2538. var createObjectURL = sharedUtil.createObjectURL;
  2539. var shadow = sharedUtil.shadow;
  2540. var isSpace = sharedUtil.isSpace;
  2541. var Dict = corePrimitives.Dict;
  2542. var isDict = corePrimitives.isDict;
  2543. var isStream = corePrimitives.isStream;
  2544. var Jbig2Image = coreJbig2.Jbig2Image;
  2545. var JpegImage = coreJpg.JpegImage;
  2546. var JpxImage = coreJpx.JpxImage;
  2547. var Stream = function StreamClosure() {
  2548. function Stream(arrayBuffer, start, length, dict) {
  2549. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  2550. this.start = start || 0;
  2551. this.pos = this.start;
  2552. this.end = start + length || this.bytes.length;
  2553. this.dict = dict;
  2554. }
  2555. Stream.prototype = {
  2556. get length() {
  2557. return this.end - this.start;
  2558. },
  2559. get isEmpty() {
  2560. return this.length === 0;
  2561. },
  2562. getByte: function Stream_getByte() {
  2563. if (this.pos >= this.end) {
  2564. return -1;
  2565. }
  2566. return this.bytes[this.pos++];
  2567. },
  2568. getUint16: function Stream_getUint16() {
  2569. var b0 = this.getByte();
  2570. var b1 = this.getByte();
  2571. if (b0 === -1 || b1 === -1) {
  2572. return -1;
  2573. }
  2574. return (b0 << 8) + b1;
  2575. },
  2576. getInt32: function Stream_getInt32() {
  2577. var b0 = this.getByte();
  2578. var b1 = this.getByte();
  2579. var b2 = this.getByte();
  2580. var b3 = this.getByte();
  2581. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  2582. },
  2583. getBytes: function Stream_getBytes(length) {
  2584. var bytes = this.bytes;
  2585. var pos = this.pos;
  2586. var strEnd = this.end;
  2587. if (!length) {
  2588. return bytes.subarray(pos, strEnd);
  2589. }
  2590. var end = pos + length;
  2591. if (end > strEnd) {
  2592. end = strEnd;
  2593. }
  2594. this.pos = end;
  2595. return bytes.subarray(pos, end);
  2596. },
  2597. peekByte: function Stream_peekByte() {
  2598. var peekedByte = this.getByte();
  2599. this.pos--;
  2600. return peekedByte;
  2601. },
  2602. peekBytes: function Stream_peekBytes(length) {
  2603. var bytes = this.getBytes(length);
  2604. this.pos -= bytes.length;
  2605. return bytes;
  2606. },
  2607. skip: function Stream_skip(n) {
  2608. if (!n) {
  2609. n = 1;
  2610. }
  2611. this.pos += n;
  2612. },
  2613. reset: function Stream_reset() {
  2614. this.pos = this.start;
  2615. },
  2616. moveStart: function Stream_moveStart() {
  2617. this.start = this.pos;
  2618. },
  2619. makeSubStream: function Stream_makeSubStream(start, length, dict) {
  2620. return new Stream(this.bytes.buffer, start, length, dict);
  2621. }
  2622. };
  2623. return Stream;
  2624. }();
  2625. var StringStream = function StringStreamClosure() {
  2626. function StringStream(str) {
  2627. var length = str.length;
  2628. var bytes = new Uint8Array(length);
  2629. for (var n = 0; n < length; ++n) {
  2630. bytes[n] = str.charCodeAt(n);
  2631. }
  2632. Stream.call(this, bytes);
  2633. }
  2634. StringStream.prototype = Stream.prototype;
  2635. return StringStream;
  2636. }();
  2637. var DecodeStream = function DecodeStreamClosure() {
  2638. var emptyBuffer = new Uint8Array(0);
  2639. function DecodeStream(maybeMinBufferLength) {
  2640. this.pos = 0;
  2641. this.bufferLength = 0;
  2642. this.eof = false;
  2643. this.buffer = emptyBuffer;
  2644. this.minBufferLength = 512;
  2645. if (maybeMinBufferLength) {
  2646. while (this.minBufferLength < maybeMinBufferLength) {
  2647. this.minBufferLength *= 2;
  2648. }
  2649. }
  2650. }
  2651. DecodeStream.prototype = {
  2652. get isEmpty() {
  2653. while (!this.eof && this.bufferLength === 0) {
  2654. this.readBlock();
  2655. }
  2656. return this.bufferLength === 0;
  2657. },
  2658. ensureBuffer: function DecodeStream_ensureBuffer(requested) {
  2659. var buffer = this.buffer;
  2660. if (requested <= buffer.byteLength) {
  2661. return buffer;
  2662. }
  2663. var size = this.minBufferLength;
  2664. while (size < requested) {
  2665. size *= 2;
  2666. }
  2667. var buffer2 = new Uint8Array(size);
  2668. buffer2.set(buffer);
  2669. return this.buffer = buffer2;
  2670. },
  2671. getByte: function DecodeStream_getByte() {
  2672. var pos = this.pos;
  2673. while (this.bufferLength <= pos) {
  2674. if (this.eof) {
  2675. return -1;
  2676. }
  2677. this.readBlock();
  2678. }
  2679. return this.buffer[this.pos++];
  2680. },
  2681. getUint16: function DecodeStream_getUint16() {
  2682. var b0 = this.getByte();
  2683. var b1 = this.getByte();
  2684. if (b0 === -1 || b1 === -1) {
  2685. return -1;
  2686. }
  2687. return (b0 << 8) + b1;
  2688. },
  2689. getInt32: function DecodeStream_getInt32() {
  2690. var b0 = this.getByte();
  2691. var b1 = this.getByte();
  2692. var b2 = this.getByte();
  2693. var b3 = this.getByte();
  2694. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  2695. },
  2696. getBytes: function DecodeStream_getBytes(length) {
  2697. var end, pos = this.pos;
  2698. if (length) {
  2699. this.ensureBuffer(pos + length);
  2700. end = pos + length;
  2701. while (!this.eof && this.bufferLength < end) {
  2702. this.readBlock();
  2703. }
  2704. var bufEnd = this.bufferLength;
  2705. if (end > bufEnd) {
  2706. end = bufEnd;
  2707. }
  2708. } else {
  2709. while (!this.eof) {
  2710. this.readBlock();
  2711. }
  2712. end = this.bufferLength;
  2713. }
  2714. this.pos = end;
  2715. return this.buffer.subarray(pos, end);
  2716. },
  2717. peekByte: function DecodeStream_peekByte() {
  2718. var peekedByte = this.getByte();
  2719. this.pos--;
  2720. return peekedByte;
  2721. },
  2722. peekBytes: function DecodeStream_peekBytes(length) {
  2723. var bytes = this.getBytes(length);
  2724. this.pos -= bytes.length;
  2725. return bytes;
  2726. },
  2727. makeSubStream: function DecodeStream_makeSubStream(start, length, dict) {
  2728. var end = start + length;
  2729. while (this.bufferLength <= end && !this.eof) {
  2730. this.readBlock();
  2731. }
  2732. return new Stream(this.buffer, start, length, dict);
  2733. },
  2734. skip: function DecodeStream_skip(n) {
  2735. if (!n) {
  2736. n = 1;
  2737. }
  2738. this.pos += n;
  2739. },
  2740. reset: function DecodeStream_reset() {
  2741. this.pos = 0;
  2742. },
  2743. getBaseStreams: function DecodeStream_getBaseStreams() {
  2744. if (this.str && this.str.getBaseStreams) {
  2745. return this.str.getBaseStreams();
  2746. }
  2747. return [];
  2748. }
  2749. };
  2750. return DecodeStream;
  2751. }();
  2752. var StreamsSequenceStream = function StreamsSequenceStreamClosure() {
  2753. function StreamsSequenceStream(streams) {
  2754. this.streams = streams;
  2755. DecodeStream.call(this, null);
  2756. }
  2757. StreamsSequenceStream.prototype = Object.create(DecodeStream.prototype);
  2758. StreamsSequenceStream.prototype.readBlock = function streamSequenceStreamReadBlock() {
  2759. var streams = this.streams;
  2760. if (streams.length === 0) {
  2761. this.eof = true;
  2762. return;
  2763. }
  2764. var stream = streams.shift();
  2765. var chunk = stream.getBytes();
  2766. var bufferLength = this.bufferLength;
  2767. var newLength = bufferLength + chunk.length;
  2768. var buffer = this.ensureBuffer(newLength);
  2769. buffer.set(chunk, bufferLength);
  2770. this.bufferLength = newLength;
  2771. };
  2772. StreamsSequenceStream.prototype.getBaseStreams = function StreamsSequenceStream_getBaseStreams() {
  2773. var baseStreams = [];
  2774. for (var i = 0, ii = this.streams.length; i < ii; i++) {
  2775. var stream = this.streams[i];
  2776. if (stream.getBaseStreams) {
  2777. Util.appendToArray(baseStreams, stream.getBaseStreams());
  2778. }
  2779. }
  2780. return baseStreams;
  2781. };
  2782. return StreamsSequenceStream;
  2783. }();
  2784. var FlateStream = function FlateStreamClosure() {
  2785. var codeLenCodeMap = new Int32Array([
  2786. 16,
  2787. 17,
  2788. 18,
  2789. 0,
  2790. 8,
  2791. 7,
  2792. 9,
  2793. 6,
  2794. 10,
  2795. 5,
  2796. 11,
  2797. 4,
  2798. 12,
  2799. 3,
  2800. 13,
  2801. 2,
  2802. 14,
  2803. 1,
  2804. 15
  2805. ]);
  2806. var lengthDecode = new Int32Array([
  2807. 0x00003,
  2808. 0x00004,
  2809. 0x00005,
  2810. 0x00006,
  2811. 0x00007,
  2812. 0x00008,
  2813. 0x00009,
  2814. 0x0000a,
  2815. 0x1000b,
  2816. 0x1000d,
  2817. 0x1000f,
  2818. 0x10011,
  2819. 0x20013,
  2820. 0x20017,
  2821. 0x2001b,
  2822. 0x2001f,
  2823. 0x30023,
  2824. 0x3002b,
  2825. 0x30033,
  2826. 0x3003b,
  2827. 0x40043,
  2828. 0x40053,
  2829. 0x40063,
  2830. 0x40073,
  2831. 0x50083,
  2832. 0x500a3,
  2833. 0x500c3,
  2834. 0x500e3,
  2835. 0x00102,
  2836. 0x00102,
  2837. 0x00102
  2838. ]);
  2839. var distDecode = new Int32Array([
  2840. 0x00001,
  2841. 0x00002,
  2842. 0x00003,
  2843. 0x00004,
  2844. 0x10005,
  2845. 0x10007,
  2846. 0x20009,
  2847. 0x2000d,
  2848. 0x30011,
  2849. 0x30019,
  2850. 0x40021,
  2851. 0x40031,
  2852. 0x50041,
  2853. 0x50061,
  2854. 0x60081,
  2855. 0x600c1,
  2856. 0x70101,
  2857. 0x70181,
  2858. 0x80201,
  2859. 0x80301,
  2860. 0x90401,
  2861. 0x90601,
  2862. 0xa0801,
  2863. 0xa0c01,
  2864. 0xb1001,
  2865. 0xb1801,
  2866. 0xc2001,
  2867. 0xc3001,
  2868. 0xd4001,
  2869. 0xd6001
  2870. ]);
  2871. var fixedLitCodeTab = [
  2872. new Int32Array([
  2873. 0x70100,
  2874. 0x80050,
  2875. 0x80010,
  2876. 0x80118,
  2877. 0x70110,
  2878. 0x80070,
  2879. 0x80030,
  2880. 0x900c0,
  2881. 0x70108,
  2882. 0x80060,
  2883. 0x80020,
  2884. 0x900a0,
  2885. 0x80000,
  2886. 0x80080,
  2887. 0x80040,
  2888. 0x900e0,
  2889. 0x70104,
  2890. 0x80058,
  2891. 0x80018,
  2892. 0x90090,
  2893. 0x70114,
  2894. 0x80078,
  2895. 0x80038,
  2896. 0x900d0,
  2897. 0x7010c,
  2898. 0x80068,
  2899. 0x80028,
  2900. 0x900b0,
  2901. 0x80008,
  2902. 0x80088,
  2903. 0x80048,
  2904. 0x900f0,
  2905. 0x70102,
  2906. 0x80054,
  2907. 0x80014,
  2908. 0x8011c,
  2909. 0x70112,
  2910. 0x80074,
  2911. 0x80034,
  2912. 0x900c8,
  2913. 0x7010a,
  2914. 0x80064,
  2915. 0x80024,
  2916. 0x900a8,
  2917. 0x80004,
  2918. 0x80084,
  2919. 0x80044,
  2920. 0x900e8,
  2921. 0x70106,
  2922. 0x8005c,
  2923. 0x8001c,
  2924. 0x90098,
  2925. 0x70116,
  2926. 0x8007c,
  2927. 0x8003c,
  2928. 0x900d8,
  2929. 0x7010e,
  2930. 0x8006c,
  2931. 0x8002c,
  2932. 0x900b8,
  2933. 0x8000c,
  2934. 0x8008c,
  2935. 0x8004c,
  2936. 0x900f8,
  2937. 0x70101,
  2938. 0x80052,
  2939. 0x80012,
  2940. 0x8011a,
  2941. 0x70111,
  2942. 0x80072,
  2943. 0x80032,
  2944. 0x900c4,
  2945. 0x70109,
  2946. 0x80062,
  2947. 0x80022,
  2948. 0x900a4,
  2949. 0x80002,
  2950. 0x80082,
  2951. 0x80042,
  2952. 0x900e4,
  2953. 0x70105,
  2954. 0x8005a,
  2955. 0x8001a,
  2956. 0x90094,
  2957. 0x70115,
  2958. 0x8007a,
  2959. 0x8003a,
  2960. 0x900d4,
  2961. 0x7010d,
  2962. 0x8006a,
  2963. 0x8002a,
  2964. 0x900b4,
  2965. 0x8000a,
  2966. 0x8008a,
  2967. 0x8004a,
  2968. 0x900f4,
  2969. 0x70103,
  2970. 0x80056,
  2971. 0x80016,
  2972. 0x8011e,
  2973. 0x70113,
  2974. 0x80076,
  2975. 0x80036,
  2976. 0x900cc,
  2977. 0x7010b,
  2978. 0x80066,
  2979. 0x80026,
  2980. 0x900ac,
  2981. 0x80006,
  2982. 0x80086,
  2983. 0x80046,
  2984. 0x900ec,
  2985. 0x70107,
  2986. 0x8005e,
  2987. 0x8001e,
  2988. 0x9009c,
  2989. 0x70117,
  2990. 0x8007e,
  2991. 0x8003e,
  2992. 0x900dc,
  2993. 0x7010f,
  2994. 0x8006e,
  2995. 0x8002e,
  2996. 0x900bc,
  2997. 0x8000e,
  2998. 0x8008e,
  2999. 0x8004e,
  3000. 0x900fc,
  3001. 0x70100,
  3002. 0x80051,
  3003. 0x80011,
  3004. 0x80119,
  3005. 0x70110,
  3006. 0x80071,
  3007. 0x80031,
  3008. 0x900c2,
  3009. 0x70108,
  3010. 0x80061,
  3011. 0x80021,
  3012. 0x900a2,
  3013. 0x80001,
  3014. 0x80081,
  3015. 0x80041,
  3016. 0x900e2,
  3017. 0x70104,
  3018. 0x80059,
  3019. 0x80019,
  3020. 0x90092,
  3021. 0x70114,
  3022. 0x80079,
  3023. 0x80039,
  3024. 0x900d2,
  3025. 0x7010c,
  3026. 0x80069,
  3027. 0x80029,
  3028. 0x900b2,
  3029. 0x80009,
  3030. 0x80089,
  3031. 0x80049,
  3032. 0x900f2,
  3033. 0x70102,
  3034. 0x80055,
  3035. 0x80015,
  3036. 0x8011d,
  3037. 0x70112,
  3038. 0x80075,
  3039. 0x80035,
  3040. 0x900ca,
  3041. 0x7010a,
  3042. 0x80065,
  3043. 0x80025,
  3044. 0x900aa,
  3045. 0x80005,
  3046. 0x80085,
  3047. 0x80045,
  3048. 0x900ea,
  3049. 0x70106,
  3050. 0x8005d,
  3051. 0x8001d,
  3052. 0x9009a,
  3053. 0x70116,
  3054. 0x8007d,
  3055. 0x8003d,
  3056. 0x900da,
  3057. 0x7010e,
  3058. 0x8006d,
  3059. 0x8002d,
  3060. 0x900ba,
  3061. 0x8000d,
  3062. 0x8008d,
  3063. 0x8004d,
  3064. 0x900fa,
  3065. 0x70101,
  3066. 0x80053,
  3067. 0x80013,
  3068. 0x8011b,
  3069. 0x70111,
  3070. 0x80073,
  3071. 0x80033,
  3072. 0x900c6,
  3073. 0x70109,
  3074. 0x80063,
  3075. 0x80023,
  3076. 0x900a6,
  3077. 0x80003,
  3078. 0x80083,
  3079. 0x80043,
  3080. 0x900e6,
  3081. 0x70105,
  3082. 0x8005b,
  3083. 0x8001b,
  3084. 0x90096,
  3085. 0x70115,
  3086. 0x8007b,
  3087. 0x8003b,
  3088. 0x900d6,
  3089. 0x7010d,
  3090. 0x8006b,
  3091. 0x8002b,
  3092. 0x900b6,
  3093. 0x8000b,
  3094. 0x8008b,
  3095. 0x8004b,
  3096. 0x900f6,
  3097. 0x70103,
  3098. 0x80057,
  3099. 0x80017,
  3100. 0x8011f,
  3101. 0x70113,
  3102. 0x80077,
  3103. 0x80037,
  3104. 0x900ce,
  3105. 0x7010b,
  3106. 0x80067,
  3107. 0x80027,
  3108. 0x900ae,
  3109. 0x80007,
  3110. 0x80087,
  3111. 0x80047,
  3112. 0x900ee,
  3113. 0x70107,
  3114. 0x8005f,
  3115. 0x8001f,
  3116. 0x9009e,
  3117. 0x70117,
  3118. 0x8007f,
  3119. 0x8003f,
  3120. 0x900de,
  3121. 0x7010f,
  3122. 0x8006f,
  3123. 0x8002f,
  3124. 0x900be,
  3125. 0x8000f,
  3126. 0x8008f,
  3127. 0x8004f,
  3128. 0x900fe,
  3129. 0x70100,
  3130. 0x80050,
  3131. 0x80010,
  3132. 0x80118,
  3133. 0x70110,
  3134. 0x80070,
  3135. 0x80030,
  3136. 0x900c1,
  3137. 0x70108,
  3138. 0x80060,
  3139. 0x80020,
  3140. 0x900a1,
  3141. 0x80000,
  3142. 0x80080,
  3143. 0x80040,
  3144. 0x900e1,
  3145. 0x70104,
  3146. 0x80058,
  3147. 0x80018,
  3148. 0x90091,
  3149. 0x70114,
  3150. 0x80078,
  3151. 0x80038,
  3152. 0x900d1,
  3153. 0x7010c,
  3154. 0x80068,
  3155. 0x80028,
  3156. 0x900b1,
  3157. 0x80008,
  3158. 0x80088,
  3159. 0x80048,
  3160. 0x900f1,
  3161. 0x70102,
  3162. 0x80054,
  3163. 0x80014,
  3164. 0x8011c,
  3165. 0x70112,
  3166. 0x80074,
  3167. 0x80034,
  3168. 0x900c9,
  3169. 0x7010a,
  3170. 0x80064,
  3171. 0x80024,
  3172. 0x900a9,
  3173. 0x80004,
  3174. 0x80084,
  3175. 0x80044,
  3176. 0x900e9,
  3177. 0x70106,
  3178. 0x8005c,
  3179. 0x8001c,
  3180. 0x90099,
  3181. 0x70116,
  3182. 0x8007c,
  3183. 0x8003c,
  3184. 0x900d9,
  3185. 0x7010e,
  3186. 0x8006c,
  3187. 0x8002c,
  3188. 0x900b9,
  3189. 0x8000c,
  3190. 0x8008c,
  3191. 0x8004c,
  3192. 0x900f9,
  3193. 0x70101,
  3194. 0x80052,
  3195. 0x80012,
  3196. 0x8011a,
  3197. 0x70111,
  3198. 0x80072,
  3199. 0x80032,
  3200. 0x900c5,
  3201. 0x70109,
  3202. 0x80062,
  3203. 0x80022,
  3204. 0x900a5,
  3205. 0x80002,
  3206. 0x80082,
  3207. 0x80042,
  3208. 0x900e5,
  3209. 0x70105,
  3210. 0x8005a,
  3211. 0x8001a,
  3212. 0x90095,
  3213. 0x70115,
  3214. 0x8007a,
  3215. 0x8003a,
  3216. 0x900d5,
  3217. 0x7010d,
  3218. 0x8006a,
  3219. 0x8002a,
  3220. 0x900b5,
  3221. 0x8000a,
  3222. 0x8008a,
  3223. 0x8004a,
  3224. 0x900f5,
  3225. 0x70103,
  3226. 0x80056,
  3227. 0x80016,
  3228. 0x8011e,
  3229. 0x70113,
  3230. 0x80076,
  3231. 0x80036,
  3232. 0x900cd,
  3233. 0x7010b,
  3234. 0x80066,
  3235. 0x80026,
  3236. 0x900ad,
  3237. 0x80006,
  3238. 0x80086,
  3239. 0x80046,
  3240. 0x900ed,
  3241. 0x70107,
  3242. 0x8005e,
  3243. 0x8001e,
  3244. 0x9009d,
  3245. 0x70117,
  3246. 0x8007e,
  3247. 0x8003e,
  3248. 0x900dd,
  3249. 0x7010f,
  3250. 0x8006e,
  3251. 0x8002e,
  3252. 0x900bd,
  3253. 0x8000e,
  3254. 0x8008e,
  3255. 0x8004e,
  3256. 0x900fd,
  3257. 0x70100,
  3258. 0x80051,
  3259. 0x80011,
  3260. 0x80119,
  3261. 0x70110,
  3262. 0x80071,
  3263. 0x80031,
  3264. 0x900c3,
  3265. 0x70108,
  3266. 0x80061,
  3267. 0x80021,
  3268. 0x900a3,
  3269. 0x80001,
  3270. 0x80081,
  3271. 0x80041,
  3272. 0x900e3,
  3273. 0x70104,
  3274. 0x80059,
  3275. 0x80019,
  3276. 0x90093,
  3277. 0x70114,
  3278. 0x80079,
  3279. 0x80039,
  3280. 0x900d3,
  3281. 0x7010c,
  3282. 0x80069,
  3283. 0x80029,
  3284. 0x900b3,
  3285. 0x80009,
  3286. 0x80089,
  3287. 0x80049,
  3288. 0x900f3,
  3289. 0x70102,
  3290. 0x80055,
  3291. 0x80015,
  3292. 0x8011d,
  3293. 0x70112,
  3294. 0x80075,
  3295. 0x80035,
  3296. 0x900cb,
  3297. 0x7010a,
  3298. 0x80065,
  3299. 0x80025,
  3300. 0x900ab,
  3301. 0x80005,
  3302. 0x80085,
  3303. 0x80045,
  3304. 0x900eb,
  3305. 0x70106,
  3306. 0x8005d,
  3307. 0x8001d,
  3308. 0x9009b,
  3309. 0x70116,
  3310. 0x8007d,
  3311. 0x8003d,
  3312. 0x900db,
  3313. 0x7010e,
  3314. 0x8006d,
  3315. 0x8002d,
  3316. 0x900bb,
  3317. 0x8000d,
  3318. 0x8008d,
  3319. 0x8004d,
  3320. 0x900fb,
  3321. 0x70101,
  3322. 0x80053,
  3323. 0x80013,
  3324. 0x8011b,
  3325. 0x70111,
  3326. 0x80073,
  3327. 0x80033,
  3328. 0x900c7,
  3329. 0x70109,
  3330. 0x80063,
  3331. 0x80023,
  3332. 0x900a7,
  3333. 0x80003,
  3334. 0x80083,
  3335. 0x80043,
  3336. 0x900e7,
  3337. 0x70105,
  3338. 0x8005b,
  3339. 0x8001b,
  3340. 0x90097,
  3341. 0x70115,
  3342. 0x8007b,
  3343. 0x8003b,
  3344. 0x900d7,
  3345. 0x7010d,
  3346. 0x8006b,
  3347. 0x8002b,
  3348. 0x900b7,
  3349. 0x8000b,
  3350. 0x8008b,
  3351. 0x8004b,
  3352. 0x900f7,
  3353. 0x70103,
  3354. 0x80057,
  3355. 0x80017,
  3356. 0x8011f,
  3357. 0x70113,
  3358. 0x80077,
  3359. 0x80037,
  3360. 0x900cf,
  3361. 0x7010b,
  3362. 0x80067,
  3363. 0x80027,
  3364. 0x900af,
  3365. 0x80007,
  3366. 0x80087,
  3367. 0x80047,
  3368. 0x900ef,
  3369. 0x70107,
  3370. 0x8005f,
  3371. 0x8001f,
  3372. 0x9009f,
  3373. 0x70117,
  3374. 0x8007f,
  3375. 0x8003f,
  3376. 0x900df,
  3377. 0x7010f,
  3378. 0x8006f,
  3379. 0x8002f,
  3380. 0x900bf,
  3381. 0x8000f,
  3382. 0x8008f,
  3383. 0x8004f,
  3384. 0x900ff
  3385. ]),
  3386. 9
  3387. ];
  3388. var fixedDistCodeTab = [
  3389. new Int32Array([
  3390. 0x50000,
  3391. 0x50010,
  3392. 0x50008,
  3393. 0x50018,
  3394. 0x50004,
  3395. 0x50014,
  3396. 0x5000c,
  3397. 0x5001c,
  3398. 0x50002,
  3399. 0x50012,
  3400. 0x5000a,
  3401. 0x5001a,
  3402. 0x50006,
  3403. 0x50016,
  3404. 0x5000e,
  3405. 0x00000,
  3406. 0x50001,
  3407. 0x50011,
  3408. 0x50009,
  3409. 0x50019,
  3410. 0x50005,
  3411. 0x50015,
  3412. 0x5000d,
  3413. 0x5001d,
  3414. 0x50003,
  3415. 0x50013,
  3416. 0x5000b,
  3417. 0x5001b,
  3418. 0x50007,
  3419. 0x50017,
  3420. 0x5000f,
  3421. 0x00000
  3422. ]),
  3423. 5
  3424. ];
  3425. function FlateStream(str, maybeLength) {
  3426. this.str = str;
  3427. this.dict = str.dict;
  3428. var cmf = str.getByte();
  3429. var flg = str.getByte();
  3430. if (cmf === -1 || flg === -1) {
  3431. error('Invalid header in flate stream: ' + cmf + ', ' + flg);
  3432. }
  3433. if ((cmf & 0x0f) !== 0x08) {
  3434. error('Unknown compression method in flate stream: ' + cmf + ', ' + flg);
  3435. }
  3436. if (((cmf << 8) + flg) % 31 !== 0) {
  3437. error('Bad FCHECK in flate stream: ' + cmf + ', ' + flg);
  3438. }
  3439. if (flg & 0x20) {
  3440. error('FDICT bit set in flate stream: ' + cmf + ', ' + flg);
  3441. }
  3442. this.codeSize = 0;
  3443. this.codeBuf = 0;
  3444. DecodeStream.call(this, maybeLength);
  3445. }
  3446. FlateStream.prototype = Object.create(DecodeStream.prototype);
  3447. FlateStream.prototype.getBits = function FlateStream_getBits(bits) {
  3448. var str = this.str;
  3449. var codeSize = this.codeSize;
  3450. var codeBuf = this.codeBuf;
  3451. var b;
  3452. while (codeSize < bits) {
  3453. if ((b = str.getByte()) === -1) {
  3454. error('Bad encoding in flate stream');
  3455. }
  3456. codeBuf |= b << codeSize;
  3457. codeSize += 8;
  3458. }
  3459. b = codeBuf & (1 << bits) - 1;
  3460. this.codeBuf = codeBuf >> bits;
  3461. this.codeSize = codeSize -= bits;
  3462. return b;
  3463. };
  3464. FlateStream.prototype.getCode = function FlateStream_getCode(table) {
  3465. var str = this.str;
  3466. var codes = table[0];
  3467. var maxLen = table[1];
  3468. var codeSize = this.codeSize;
  3469. var codeBuf = this.codeBuf;
  3470. var b;
  3471. while (codeSize < maxLen) {
  3472. if ((b = str.getByte()) === -1) {
  3473. break;
  3474. }
  3475. codeBuf |= b << codeSize;
  3476. codeSize += 8;
  3477. }
  3478. var code = codes[codeBuf & (1 << maxLen) - 1];
  3479. var codeLen = code >> 16;
  3480. var codeVal = code & 0xffff;
  3481. if (codeLen < 1 || codeSize < codeLen) {
  3482. error('Bad encoding in flate stream');
  3483. }
  3484. this.codeBuf = codeBuf >> codeLen;
  3485. this.codeSize = codeSize - codeLen;
  3486. return codeVal;
  3487. };
  3488. FlateStream.prototype.generateHuffmanTable = function flateStreamGenerateHuffmanTable(lengths) {
  3489. var n = lengths.length;
  3490. var maxLen = 0;
  3491. var i;
  3492. for (i = 0; i < n; ++i) {
  3493. if (lengths[i] > maxLen) {
  3494. maxLen = lengths[i];
  3495. }
  3496. }
  3497. var size = 1 << maxLen;
  3498. var codes = new Int32Array(size);
  3499. for (var len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  3500. for (var val = 0; val < n; ++val) {
  3501. if (lengths[val] === len) {
  3502. var code2 = 0;
  3503. var t = code;
  3504. for (i = 0; i < len; ++i) {
  3505. code2 = code2 << 1 | t & 1;
  3506. t >>= 1;
  3507. }
  3508. for (i = code2; i < size; i += skip) {
  3509. codes[i] = len << 16 | val;
  3510. }
  3511. ++code;
  3512. }
  3513. }
  3514. }
  3515. return [
  3516. codes,
  3517. maxLen
  3518. ];
  3519. };
  3520. FlateStream.prototype.readBlock = function FlateStream_readBlock() {
  3521. var buffer, len;
  3522. var str = this.str;
  3523. var hdr = this.getBits(3);
  3524. if (hdr & 1) {
  3525. this.eof = true;
  3526. }
  3527. hdr >>= 1;
  3528. if (hdr === 0) {
  3529. var b;
  3530. if ((b = str.getByte()) === -1) {
  3531. error('Bad block header in flate stream');
  3532. }
  3533. var blockLen = b;
  3534. if ((b = str.getByte()) === -1) {
  3535. error('Bad block header in flate stream');
  3536. }
  3537. blockLen |= b << 8;
  3538. if ((b = str.getByte()) === -1) {
  3539. error('Bad block header in flate stream');
  3540. }
  3541. var check = b;
  3542. if ((b = str.getByte()) === -1) {
  3543. error('Bad block header in flate stream');
  3544. }
  3545. check |= b << 8;
  3546. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  3547. error('Bad uncompressed block length in flate stream');
  3548. }
  3549. this.codeBuf = 0;
  3550. this.codeSize = 0;
  3551. var bufferLength = this.bufferLength;
  3552. buffer = this.ensureBuffer(bufferLength + blockLen);
  3553. var end = bufferLength + blockLen;
  3554. this.bufferLength = end;
  3555. if (blockLen === 0) {
  3556. if (str.peekByte() === -1) {
  3557. this.eof = true;
  3558. }
  3559. } else {
  3560. for (var n = bufferLength; n < end; ++n) {
  3561. if ((b = str.getByte()) === -1) {
  3562. this.eof = true;
  3563. break;
  3564. }
  3565. buffer[n] = b;
  3566. }
  3567. }
  3568. return;
  3569. }
  3570. var litCodeTable;
  3571. var distCodeTable;
  3572. if (hdr === 1) {
  3573. litCodeTable = fixedLitCodeTab;
  3574. distCodeTable = fixedDistCodeTab;
  3575. } else if (hdr === 2) {
  3576. var numLitCodes = this.getBits(5) + 257;
  3577. var numDistCodes = this.getBits(5) + 1;
  3578. var numCodeLenCodes = this.getBits(4) + 4;
  3579. var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  3580. var i;
  3581. for (i = 0; i < numCodeLenCodes; ++i) {
  3582. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  3583. }
  3584. var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  3585. len = 0;
  3586. i = 0;
  3587. var codes = numLitCodes + numDistCodes;
  3588. var codeLengths = new Uint8Array(codes);
  3589. var bitsLength, bitsOffset, what;
  3590. while (i < codes) {
  3591. var code = this.getCode(codeLenCodeTab);
  3592. if (code === 16) {
  3593. bitsLength = 2;
  3594. bitsOffset = 3;
  3595. what = len;
  3596. } else if (code === 17) {
  3597. bitsLength = 3;
  3598. bitsOffset = 3;
  3599. what = len = 0;
  3600. } else if (code === 18) {
  3601. bitsLength = 7;
  3602. bitsOffset = 11;
  3603. what = len = 0;
  3604. } else {
  3605. codeLengths[i++] = len = code;
  3606. continue;
  3607. }
  3608. var repeatLength = this.getBits(bitsLength) + bitsOffset;
  3609. while (repeatLength-- > 0) {
  3610. codeLengths[i++] = what;
  3611. }
  3612. }
  3613. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  3614. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  3615. } else {
  3616. error('Unknown block type in flate stream');
  3617. }
  3618. buffer = this.buffer;
  3619. var limit = buffer ? buffer.length : 0;
  3620. var pos = this.bufferLength;
  3621. while (true) {
  3622. var code1 = this.getCode(litCodeTable);
  3623. if (code1 < 256) {
  3624. if (pos + 1 >= limit) {
  3625. buffer = this.ensureBuffer(pos + 1);
  3626. limit = buffer.length;
  3627. }
  3628. buffer[pos++] = code1;
  3629. continue;
  3630. }
  3631. if (code1 === 256) {
  3632. this.bufferLength = pos;
  3633. return;
  3634. }
  3635. code1 -= 257;
  3636. code1 = lengthDecode[code1];
  3637. var code2 = code1 >> 16;
  3638. if (code2 > 0) {
  3639. code2 = this.getBits(code2);
  3640. }
  3641. len = (code1 & 0xffff) + code2;
  3642. code1 = this.getCode(distCodeTable);
  3643. code1 = distDecode[code1];
  3644. code2 = code1 >> 16;
  3645. if (code2 > 0) {
  3646. code2 = this.getBits(code2);
  3647. }
  3648. var dist = (code1 & 0xffff) + code2;
  3649. if (pos + len >= limit) {
  3650. buffer = this.ensureBuffer(pos + len);
  3651. limit = buffer.length;
  3652. }
  3653. for (var k = 0; k < len; ++k, ++pos) {
  3654. buffer[pos] = buffer[pos - dist];
  3655. }
  3656. }
  3657. };
  3658. return FlateStream;
  3659. }();
  3660. var PredictorStream = function PredictorStreamClosure() {
  3661. function PredictorStream(str, maybeLength, params) {
  3662. if (!isDict(params)) {
  3663. return str;
  3664. }
  3665. var predictor = this.predictor = params.get('Predictor') || 1;
  3666. if (predictor <= 1) {
  3667. return str;
  3668. }
  3669. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  3670. error('Unsupported predictor: ' + predictor);
  3671. }
  3672. if (predictor === 2) {
  3673. this.readBlock = this.readBlockTiff;
  3674. } else {
  3675. this.readBlock = this.readBlockPng;
  3676. }
  3677. this.str = str;
  3678. this.dict = str.dict;
  3679. var colors = this.colors = params.get('Colors') || 1;
  3680. var bits = this.bits = params.get('BitsPerComponent') || 8;
  3681. var columns = this.columns = params.get('Columns') || 1;
  3682. this.pixBytes = colors * bits + 7 >> 3;
  3683. this.rowBytes = columns * colors * bits + 7 >> 3;
  3684. DecodeStream.call(this, maybeLength);
  3685. return this;
  3686. }
  3687. PredictorStream.prototype = Object.create(DecodeStream.prototype);
  3688. PredictorStream.prototype.readBlockTiff = function predictorStreamReadBlockTiff() {
  3689. var rowBytes = this.rowBytes;
  3690. var bufferLength = this.bufferLength;
  3691. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  3692. var bits = this.bits;
  3693. var colors = this.colors;
  3694. var rawBytes = this.str.getBytes(rowBytes);
  3695. this.eof = !rawBytes.length;
  3696. if (this.eof) {
  3697. return;
  3698. }
  3699. var inbuf = 0, outbuf = 0;
  3700. var inbits = 0, outbits = 0;
  3701. var pos = bufferLength;
  3702. var i;
  3703. if (bits === 1 && colors === 1) {
  3704. for (i = 0; i < rowBytes; ++i) {
  3705. var c = rawBytes[i] ^ inbuf;
  3706. c ^= c >> 1;
  3707. c ^= c >> 2;
  3708. c ^= c >> 4;
  3709. inbuf = (c & 1) << 7;
  3710. buffer[pos++] = c;
  3711. }
  3712. } else if (bits === 8) {
  3713. for (i = 0; i < colors; ++i) {
  3714. buffer[pos++] = rawBytes[i];
  3715. }
  3716. for (; i < rowBytes; ++i) {
  3717. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  3718. pos++;
  3719. }
  3720. } else {
  3721. var compArray = new Uint8Array(colors + 1);
  3722. var bitMask = (1 << bits) - 1;
  3723. var j = 0, k = bufferLength;
  3724. var columns = this.columns;
  3725. for (i = 0; i < columns; ++i) {
  3726. for (var kk = 0; kk < colors; ++kk) {
  3727. if (inbits < bits) {
  3728. inbuf = inbuf << 8 | rawBytes[j++] & 0xFF;
  3729. inbits += 8;
  3730. }
  3731. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  3732. inbits -= bits;
  3733. outbuf = outbuf << bits | compArray[kk];
  3734. outbits += bits;
  3735. if (outbits >= 8) {
  3736. buffer[k++] = outbuf >> outbits - 8 & 0xFF;
  3737. outbits -= 8;
  3738. }
  3739. }
  3740. }
  3741. if (outbits > 0) {
  3742. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  3743. }
  3744. }
  3745. this.bufferLength += rowBytes;
  3746. };
  3747. PredictorStream.prototype.readBlockPng = function predictorStreamReadBlockPng() {
  3748. var rowBytes = this.rowBytes;
  3749. var pixBytes = this.pixBytes;
  3750. var predictor = this.str.getByte();
  3751. var rawBytes = this.str.getBytes(rowBytes);
  3752. this.eof = !rawBytes.length;
  3753. if (this.eof) {
  3754. return;
  3755. }
  3756. var bufferLength = this.bufferLength;
  3757. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  3758. var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  3759. if (prevRow.length === 0) {
  3760. prevRow = new Uint8Array(rowBytes);
  3761. }
  3762. var i, j = bufferLength, up, c;
  3763. switch (predictor) {
  3764. case 0:
  3765. for (i = 0; i < rowBytes; ++i) {
  3766. buffer[j++] = rawBytes[i];
  3767. }
  3768. break;
  3769. case 1:
  3770. for (i = 0; i < pixBytes; ++i) {
  3771. buffer[j++] = rawBytes[i];
  3772. }
  3773. for (; i < rowBytes; ++i) {
  3774. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xFF;
  3775. j++;
  3776. }
  3777. break;
  3778. case 2:
  3779. for (i = 0; i < rowBytes; ++i) {
  3780. buffer[j++] = prevRow[i] + rawBytes[i] & 0xFF;
  3781. }
  3782. break;
  3783. case 3:
  3784. for (i = 0; i < pixBytes; ++i) {
  3785. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  3786. }
  3787. for (; i < rowBytes; ++i) {
  3788. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xFF;
  3789. j++;
  3790. }
  3791. break;
  3792. case 4:
  3793. for (i = 0; i < pixBytes; ++i) {
  3794. up = prevRow[i];
  3795. c = rawBytes[i];
  3796. buffer[j++] = up + c;
  3797. }
  3798. for (; i < rowBytes; ++i) {
  3799. up = prevRow[i];
  3800. var upLeft = prevRow[i - pixBytes];
  3801. var left = buffer[j - pixBytes];
  3802. var p = left + up - upLeft;
  3803. var pa = p - left;
  3804. if (pa < 0) {
  3805. pa = -pa;
  3806. }
  3807. var pb = p - up;
  3808. if (pb < 0) {
  3809. pb = -pb;
  3810. }
  3811. var pc = p - upLeft;
  3812. if (pc < 0) {
  3813. pc = -pc;
  3814. }
  3815. c = rawBytes[i];
  3816. if (pa <= pb && pa <= pc) {
  3817. buffer[j++] = left + c;
  3818. } else if (pb <= pc) {
  3819. buffer[j++] = up + c;
  3820. } else {
  3821. buffer[j++] = upLeft + c;
  3822. }
  3823. }
  3824. break;
  3825. default:
  3826. error('Unsupported predictor: ' + predictor);
  3827. }
  3828. this.bufferLength += rowBytes;
  3829. };
  3830. return PredictorStream;
  3831. }();
  3832. var JpegStream = function JpegStreamClosure() {
  3833. function JpegStream(stream, maybeLength, dict, params) {
  3834. var ch;
  3835. while ((ch = stream.getByte()) !== -1) {
  3836. if (ch === 0xFF) {
  3837. stream.skip(-1);
  3838. break;
  3839. }
  3840. }
  3841. this.stream = stream;
  3842. this.maybeLength = maybeLength;
  3843. this.dict = dict;
  3844. this.params = params;
  3845. DecodeStream.call(this, maybeLength);
  3846. }
  3847. JpegStream.prototype = Object.create(DecodeStream.prototype);
  3848. Object.defineProperty(JpegStream.prototype, 'bytes', {
  3849. get: function JpegStream_bytes() {
  3850. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  3851. },
  3852. configurable: true
  3853. });
  3854. JpegStream.prototype.ensureBuffer = function JpegStream_ensureBuffer(req) {
  3855. if (this.bufferLength) {
  3856. return;
  3857. }
  3858. var jpegImage = new JpegImage();
  3859. var decodeArr = this.dict.getArray('Decode', 'D');
  3860. if (this.forceRGB && isArray(decodeArr)) {
  3861. var bitsPerComponent = this.dict.get('BitsPerComponent') || 8;
  3862. var decodeArrLength = decodeArr.length;
  3863. var transform = new Int32Array(decodeArrLength);
  3864. var transformNeeded = false;
  3865. var maxValue = (1 << bitsPerComponent) - 1;
  3866. for (var i = 0; i < decodeArrLength; i += 2) {
  3867. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  3868. transform[i + 1] = decodeArr[i] * maxValue | 0;
  3869. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  3870. transformNeeded = true;
  3871. }
  3872. }
  3873. if (transformNeeded) {
  3874. jpegImage.decodeTransform = transform;
  3875. }
  3876. }
  3877. if (isDict(this.params)) {
  3878. var colorTransform = this.params.get('ColorTransform');
  3879. if (isInt(colorTransform)) {
  3880. jpegImage.colorTransform = colorTransform;
  3881. }
  3882. }
  3883. jpegImage.parse(this.bytes);
  3884. var data = jpegImage.getData(this.drawWidth, this.drawHeight, this.forceRGB);
  3885. this.buffer = data;
  3886. this.bufferLength = data.length;
  3887. this.eof = true;
  3888. };
  3889. JpegStream.prototype.getBytes = function JpegStream_getBytes(length) {
  3890. this.ensureBuffer();
  3891. return this.buffer;
  3892. };
  3893. JpegStream.prototype.getIR = function JpegStream_getIR(forceDataSchema) {
  3894. return createObjectURL(this.bytes, 'image/jpeg', forceDataSchema);
  3895. };
  3896. return JpegStream;
  3897. }();
  3898. var JpxStream = function JpxStreamClosure() {
  3899. function JpxStream(stream, maybeLength, dict, params) {
  3900. this.stream = stream;
  3901. this.maybeLength = maybeLength;
  3902. this.dict = dict;
  3903. this.params = params;
  3904. DecodeStream.call(this, maybeLength);
  3905. }
  3906. JpxStream.prototype = Object.create(DecodeStream.prototype);
  3907. Object.defineProperty(JpxStream.prototype, 'bytes', {
  3908. get: function JpxStream_bytes() {
  3909. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  3910. },
  3911. configurable: true
  3912. });
  3913. JpxStream.prototype.ensureBuffer = function JpxStream_ensureBuffer(req) {
  3914. if (this.bufferLength) {
  3915. return;
  3916. }
  3917. var jpxImage = new JpxImage();
  3918. jpxImage.parse(this.bytes);
  3919. var width = jpxImage.width;
  3920. var height = jpxImage.height;
  3921. var componentsCount = jpxImage.componentsCount;
  3922. var tileCount = jpxImage.tiles.length;
  3923. if (tileCount === 1) {
  3924. this.buffer = jpxImage.tiles[0].items;
  3925. } else {
  3926. var data = new Uint8Array(width * height * componentsCount);
  3927. for (var k = 0; k < tileCount; k++) {
  3928. var tileComponents = jpxImage.tiles[k];
  3929. var tileWidth = tileComponents.width;
  3930. var tileHeight = tileComponents.height;
  3931. var tileLeft = tileComponents.left;
  3932. var tileTop = tileComponents.top;
  3933. var src = tileComponents.items;
  3934. var srcPosition = 0;
  3935. var dataPosition = (width * tileTop + tileLeft) * componentsCount;
  3936. var imgRowSize = width * componentsCount;
  3937. var tileRowSize = tileWidth * componentsCount;
  3938. for (var j = 0; j < tileHeight; j++) {
  3939. var rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  3940. data.set(rowBytes, dataPosition);
  3941. srcPosition += tileRowSize;
  3942. dataPosition += imgRowSize;
  3943. }
  3944. }
  3945. this.buffer = data;
  3946. }
  3947. this.bufferLength = this.buffer.length;
  3948. this.eof = true;
  3949. };
  3950. return JpxStream;
  3951. }();
  3952. var Jbig2Stream = function Jbig2StreamClosure() {
  3953. function Jbig2Stream(stream, maybeLength, dict, params) {
  3954. this.stream = stream;
  3955. this.maybeLength = maybeLength;
  3956. this.dict = dict;
  3957. this.params = params;
  3958. DecodeStream.call(this, maybeLength);
  3959. }
  3960. Jbig2Stream.prototype = Object.create(DecodeStream.prototype);
  3961. Object.defineProperty(Jbig2Stream.prototype, 'bytes', {
  3962. get: function Jbig2Stream_bytes() {
  3963. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  3964. },
  3965. configurable: true
  3966. });
  3967. Jbig2Stream.prototype.ensureBuffer = function Jbig2Stream_ensureBuffer(req) {
  3968. if (this.bufferLength) {
  3969. return;
  3970. }
  3971. var jbig2Image = new Jbig2Image();
  3972. var chunks = [];
  3973. if (isDict(this.params)) {
  3974. var globalsStream = this.params.get('JBIG2Globals');
  3975. if (isStream(globalsStream)) {
  3976. var globals = globalsStream.getBytes();
  3977. chunks.push({
  3978. data: globals,
  3979. start: 0,
  3980. end: globals.length
  3981. });
  3982. }
  3983. }
  3984. chunks.push({
  3985. data: this.bytes,
  3986. start: 0,
  3987. end: this.bytes.length
  3988. });
  3989. var data = jbig2Image.parseChunks(chunks);
  3990. var dataLength = data.length;
  3991. for (var i = 0; i < dataLength; i++) {
  3992. data[i] ^= 0xFF;
  3993. }
  3994. this.buffer = data;
  3995. this.bufferLength = dataLength;
  3996. this.eof = true;
  3997. };
  3998. return Jbig2Stream;
  3999. }();
  4000. var DecryptStream = function DecryptStreamClosure() {
  4001. function DecryptStream(str, maybeLength, decrypt) {
  4002. this.str = str;
  4003. this.dict = str.dict;
  4004. this.decrypt = decrypt;
  4005. this.nextChunk = null;
  4006. this.initialized = false;
  4007. DecodeStream.call(this, maybeLength);
  4008. }
  4009. var chunkSize = 512;
  4010. DecryptStream.prototype = Object.create(DecodeStream.prototype);
  4011. DecryptStream.prototype.readBlock = function DecryptStream_readBlock() {
  4012. var chunk;
  4013. if (this.initialized) {
  4014. chunk = this.nextChunk;
  4015. } else {
  4016. chunk = this.str.getBytes(chunkSize);
  4017. this.initialized = true;
  4018. }
  4019. if (!chunk || chunk.length === 0) {
  4020. this.eof = true;
  4021. return;
  4022. }
  4023. this.nextChunk = this.str.getBytes(chunkSize);
  4024. var hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  4025. var decrypt = this.decrypt;
  4026. chunk = decrypt(chunk, !hasMoreData);
  4027. var bufferLength = this.bufferLength;
  4028. var i, n = chunk.length;
  4029. var buffer = this.ensureBuffer(bufferLength + n);
  4030. for (i = 0; i < n; i++) {
  4031. buffer[bufferLength++] = chunk[i];
  4032. }
  4033. this.bufferLength = bufferLength;
  4034. };
  4035. return DecryptStream;
  4036. }();
  4037. var Ascii85Stream = function Ascii85StreamClosure() {
  4038. function Ascii85Stream(str, maybeLength) {
  4039. this.str = str;
  4040. this.dict = str.dict;
  4041. this.input = new Uint8Array(5);
  4042. if (maybeLength) {
  4043. maybeLength = 0.8 * maybeLength;
  4044. }
  4045. DecodeStream.call(this, maybeLength);
  4046. }
  4047. Ascii85Stream.prototype = Object.create(DecodeStream.prototype);
  4048. Ascii85Stream.prototype.readBlock = function Ascii85Stream_readBlock() {
  4049. var TILDA_CHAR = 0x7E;
  4050. var Z_LOWER_CHAR = 0x7A;
  4051. var EOF = -1;
  4052. var str = this.str;
  4053. var c = str.getByte();
  4054. while (isSpace(c)) {
  4055. c = str.getByte();
  4056. }
  4057. if (c === EOF || c === TILDA_CHAR) {
  4058. this.eof = true;
  4059. return;
  4060. }
  4061. var bufferLength = this.bufferLength, buffer;
  4062. var i;
  4063. if (c === Z_LOWER_CHAR) {
  4064. buffer = this.ensureBuffer(bufferLength + 4);
  4065. for (i = 0; i < 4; ++i) {
  4066. buffer[bufferLength + i] = 0;
  4067. }
  4068. this.bufferLength += 4;
  4069. } else {
  4070. var input = this.input;
  4071. input[0] = c;
  4072. for (i = 1; i < 5; ++i) {
  4073. c = str.getByte();
  4074. while (isSpace(c)) {
  4075. c = str.getByte();
  4076. }
  4077. input[i] = c;
  4078. if (c === EOF || c === TILDA_CHAR) {
  4079. break;
  4080. }
  4081. }
  4082. buffer = this.ensureBuffer(bufferLength + i - 1);
  4083. this.bufferLength += i - 1;
  4084. if (i < 5) {
  4085. for (; i < 5; ++i) {
  4086. input[i] = 0x21 + 84;
  4087. }
  4088. this.eof = true;
  4089. }
  4090. var t = 0;
  4091. for (i = 0; i < 5; ++i) {
  4092. t = t * 85 + (input[i] - 0x21);
  4093. }
  4094. for (i = 3; i >= 0; --i) {
  4095. buffer[bufferLength + i] = t & 0xFF;
  4096. t >>= 8;
  4097. }
  4098. }
  4099. };
  4100. return Ascii85Stream;
  4101. }();
  4102. var AsciiHexStream = function AsciiHexStreamClosure() {
  4103. function AsciiHexStream(str, maybeLength) {
  4104. this.str = str;
  4105. this.dict = str.dict;
  4106. this.firstDigit = -1;
  4107. if (maybeLength) {
  4108. maybeLength = 0.5 * maybeLength;
  4109. }
  4110. DecodeStream.call(this, maybeLength);
  4111. }
  4112. AsciiHexStream.prototype = Object.create(DecodeStream.prototype);
  4113. AsciiHexStream.prototype.readBlock = function AsciiHexStream_readBlock() {
  4114. var UPSTREAM_BLOCK_SIZE = 8000;
  4115. var bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  4116. if (!bytes.length) {
  4117. this.eof = true;
  4118. return;
  4119. }
  4120. var maxDecodeLength = bytes.length + 1 >> 1;
  4121. var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  4122. var bufferLength = this.bufferLength;
  4123. var firstDigit = this.firstDigit;
  4124. for (var i = 0, ii = bytes.length; i < ii; i++) {
  4125. var ch = bytes[i], digit;
  4126. if (ch >= 0x30 && ch <= 0x39) {
  4127. digit = ch & 0x0F;
  4128. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  4129. digit = (ch & 0x0F) + 9;
  4130. } else if (ch === 0x3E) {
  4131. this.eof = true;
  4132. break;
  4133. } else {
  4134. continue;
  4135. }
  4136. if (firstDigit < 0) {
  4137. firstDigit = digit;
  4138. } else {
  4139. buffer[bufferLength++] = firstDigit << 4 | digit;
  4140. firstDigit = -1;
  4141. }
  4142. }
  4143. if (firstDigit >= 0 && this.eof) {
  4144. buffer[bufferLength++] = firstDigit << 4;
  4145. firstDigit = -1;
  4146. }
  4147. this.firstDigit = firstDigit;
  4148. this.bufferLength = bufferLength;
  4149. };
  4150. return AsciiHexStream;
  4151. }();
  4152. var RunLengthStream = function RunLengthStreamClosure() {
  4153. function RunLengthStream(str, maybeLength) {
  4154. this.str = str;
  4155. this.dict = str.dict;
  4156. DecodeStream.call(this, maybeLength);
  4157. }
  4158. RunLengthStream.prototype = Object.create(DecodeStream.prototype);
  4159. RunLengthStream.prototype.readBlock = function RunLengthStream_readBlock() {
  4160. var repeatHeader = this.str.getBytes(2);
  4161. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  4162. this.eof = true;
  4163. return;
  4164. }
  4165. var buffer;
  4166. var bufferLength = this.bufferLength;
  4167. var n = repeatHeader[0];
  4168. if (n < 128) {
  4169. buffer = this.ensureBuffer(bufferLength + n + 1);
  4170. buffer[bufferLength++] = repeatHeader[1];
  4171. if (n > 0) {
  4172. var source = this.str.getBytes(n);
  4173. buffer.set(source, bufferLength);
  4174. bufferLength += n;
  4175. }
  4176. } else {
  4177. n = 257 - n;
  4178. var b = repeatHeader[1];
  4179. buffer = this.ensureBuffer(bufferLength + n + 1);
  4180. for (var i = 0; i < n; i++) {
  4181. buffer[bufferLength++] = b;
  4182. }
  4183. }
  4184. this.bufferLength = bufferLength;
  4185. };
  4186. return RunLengthStream;
  4187. }();
  4188. var CCITTFaxStream = function CCITTFaxStreamClosure() {
  4189. var ccittEOL = -2;
  4190. var ccittEOF = -1;
  4191. var twoDimPass = 0;
  4192. var twoDimHoriz = 1;
  4193. var twoDimVert0 = 2;
  4194. var twoDimVertR1 = 3;
  4195. var twoDimVertL1 = 4;
  4196. var twoDimVertR2 = 5;
  4197. var twoDimVertL2 = 6;
  4198. var twoDimVertR3 = 7;
  4199. var twoDimVertL3 = 8;
  4200. var twoDimTable = [
  4201. [
  4202. -1,
  4203. -1
  4204. ],
  4205. [
  4206. -1,
  4207. -1
  4208. ],
  4209. [
  4210. 7,
  4211. twoDimVertL3
  4212. ],
  4213. [
  4214. 7,
  4215. twoDimVertR3
  4216. ],
  4217. [
  4218. 6,
  4219. twoDimVertL2
  4220. ],
  4221. [
  4222. 6,
  4223. twoDimVertL2
  4224. ],
  4225. [
  4226. 6,
  4227. twoDimVertR2
  4228. ],
  4229. [
  4230. 6,
  4231. twoDimVertR2
  4232. ],
  4233. [
  4234. 4,
  4235. twoDimPass
  4236. ],
  4237. [
  4238. 4,
  4239. twoDimPass
  4240. ],
  4241. [
  4242. 4,
  4243. twoDimPass
  4244. ],
  4245. [
  4246. 4,
  4247. twoDimPass
  4248. ],
  4249. [
  4250. 4,
  4251. twoDimPass
  4252. ],
  4253. [
  4254. 4,
  4255. twoDimPass
  4256. ],
  4257. [
  4258. 4,
  4259. twoDimPass
  4260. ],
  4261. [
  4262. 4,
  4263. twoDimPass
  4264. ],
  4265. [
  4266. 3,
  4267. twoDimHoriz
  4268. ],
  4269. [
  4270. 3,
  4271. twoDimHoriz
  4272. ],
  4273. [
  4274. 3,
  4275. twoDimHoriz
  4276. ],
  4277. [
  4278. 3,
  4279. twoDimHoriz
  4280. ],
  4281. [
  4282. 3,
  4283. twoDimHoriz
  4284. ],
  4285. [
  4286. 3,
  4287. twoDimHoriz
  4288. ],
  4289. [
  4290. 3,
  4291. twoDimHoriz
  4292. ],
  4293. [
  4294. 3,
  4295. twoDimHoriz
  4296. ],
  4297. [
  4298. 3,
  4299. twoDimHoriz
  4300. ],
  4301. [
  4302. 3,
  4303. twoDimHoriz
  4304. ],
  4305. [
  4306. 3,
  4307. twoDimHoriz
  4308. ],
  4309. [
  4310. 3,
  4311. twoDimHoriz
  4312. ],
  4313. [
  4314. 3,
  4315. twoDimHoriz
  4316. ],
  4317. [
  4318. 3,
  4319. twoDimHoriz
  4320. ],
  4321. [
  4322. 3,
  4323. twoDimHoriz
  4324. ],
  4325. [
  4326. 3,
  4327. twoDimHoriz
  4328. ],
  4329. [
  4330. 3,
  4331. twoDimVertL1
  4332. ],
  4333. [
  4334. 3,
  4335. twoDimVertL1
  4336. ],
  4337. [
  4338. 3,
  4339. twoDimVertL1
  4340. ],
  4341. [
  4342. 3,
  4343. twoDimVertL1
  4344. ],
  4345. [
  4346. 3,
  4347. twoDimVertL1
  4348. ],
  4349. [
  4350. 3,
  4351. twoDimVertL1
  4352. ],
  4353. [
  4354. 3,
  4355. twoDimVertL1
  4356. ],
  4357. [
  4358. 3,
  4359. twoDimVertL1
  4360. ],
  4361. [
  4362. 3,
  4363. twoDimVertL1
  4364. ],
  4365. [
  4366. 3,
  4367. twoDimVertL1
  4368. ],
  4369. [
  4370. 3,
  4371. twoDimVertL1
  4372. ],
  4373. [
  4374. 3,
  4375. twoDimVertL1
  4376. ],
  4377. [
  4378. 3,
  4379. twoDimVertL1
  4380. ],
  4381. [
  4382. 3,
  4383. twoDimVertL1
  4384. ],
  4385. [
  4386. 3,
  4387. twoDimVertL1
  4388. ],
  4389. [
  4390. 3,
  4391. twoDimVertL1
  4392. ],
  4393. [
  4394. 3,
  4395. twoDimVertR1
  4396. ],
  4397. [
  4398. 3,
  4399. twoDimVertR1
  4400. ],
  4401. [
  4402. 3,
  4403. twoDimVertR1
  4404. ],
  4405. [
  4406. 3,
  4407. twoDimVertR1
  4408. ],
  4409. [
  4410. 3,
  4411. twoDimVertR1
  4412. ],
  4413. [
  4414. 3,
  4415. twoDimVertR1
  4416. ],
  4417. [
  4418. 3,
  4419. twoDimVertR1
  4420. ],
  4421. [
  4422. 3,
  4423. twoDimVertR1
  4424. ],
  4425. [
  4426. 3,
  4427. twoDimVertR1
  4428. ],
  4429. [
  4430. 3,
  4431. twoDimVertR1
  4432. ],
  4433. [
  4434. 3,
  4435. twoDimVertR1
  4436. ],
  4437. [
  4438. 3,
  4439. twoDimVertR1
  4440. ],
  4441. [
  4442. 3,
  4443. twoDimVertR1
  4444. ],
  4445. [
  4446. 3,
  4447. twoDimVertR1
  4448. ],
  4449. [
  4450. 3,
  4451. twoDimVertR1
  4452. ],
  4453. [
  4454. 3,
  4455. twoDimVertR1
  4456. ],
  4457. [
  4458. 1,
  4459. twoDimVert0
  4460. ],
  4461. [
  4462. 1,
  4463. twoDimVert0
  4464. ],
  4465. [
  4466. 1,
  4467. twoDimVert0
  4468. ],
  4469. [
  4470. 1,
  4471. twoDimVert0
  4472. ],
  4473. [
  4474. 1,
  4475. twoDimVert0
  4476. ],
  4477. [
  4478. 1,
  4479. twoDimVert0
  4480. ],
  4481. [
  4482. 1,
  4483. twoDimVert0
  4484. ],
  4485. [
  4486. 1,
  4487. twoDimVert0
  4488. ],
  4489. [
  4490. 1,
  4491. twoDimVert0
  4492. ],
  4493. [
  4494. 1,
  4495. twoDimVert0
  4496. ],
  4497. [
  4498. 1,
  4499. twoDimVert0
  4500. ],
  4501. [
  4502. 1,
  4503. twoDimVert0
  4504. ],
  4505. [
  4506. 1,
  4507. twoDimVert0
  4508. ],
  4509. [
  4510. 1,
  4511. twoDimVert0
  4512. ],
  4513. [
  4514. 1,
  4515. twoDimVert0
  4516. ],
  4517. [
  4518. 1,
  4519. twoDimVert0
  4520. ],
  4521. [
  4522. 1,
  4523. twoDimVert0
  4524. ],
  4525. [
  4526. 1,
  4527. twoDimVert0
  4528. ],
  4529. [
  4530. 1,
  4531. twoDimVert0
  4532. ],
  4533. [
  4534. 1,
  4535. twoDimVert0
  4536. ],
  4537. [
  4538. 1,
  4539. twoDimVert0
  4540. ],
  4541. [
  4542. 1,
  4543. twoDimVert0
  4544. ],
  4545. [
  4546. 1,
  4547. twoDimVert0
  4548. ],
  4549. [
  4550. 1,
  4551. twoDimVert0
  4552. ],
  4553. [
  4554. 1,
  4555. twoDimVert0
  4556. ],
  4557. [
  4558. 1,
  4559. twoDimVert0
  4560. ],
  4561. [
  4562. 1,
  4563. twoDimVert0
  4564. ],
  4565. [
  4566. 1,
  4567. twoDimVert0
  4568. ],
  4569. [
  4570. 1,
  4571. twoDimVert0
  4572. ],
  4573. [
  4574. 1,
  4575. twoDimVert0
  4576. ],
  4577. [
  4578. 1,
  4579. twoDimVert0
  4580. ],
  4581. [
  4582. 1,
  4583. twoDimVert0
  4584. ],
  4585. [
  4586. 1,
  4587. twoDimVert0
  4588. ],
  4589. [
  4590. 1,
  4591. twoDimVert0
  4592. ],
  4593. [
  4594. 1,
  4595. twoDimVert0
  4596. ],
  4597. [
  4598. 1,
  4599. twoDimVert0
  4600. ],
  4601. [
  4602. 1,
  4603. twoDimVert0
  4604. ],
  4605. [
  4606. 1,
  4607. twoDimVert0
  4608. ],
  4609. [
  4610. 1,
  4611. twoDimVert0
  4612. ],
  4613. [
  4614. 1,
  4615. twoDimVert0
  4616. ],
  4617. [
  4618. 1,
  4619. twoDimVert0
  4620. ],
  4621. [
  4622. 1,
  4623. twoDimVert0
  4624. ],
  4625. [
  4626. 1,
  4627. twoDimVert0
  4628. ],
  4629. [
  4630. 1,
  4631. twoDimVert0
  4632. ],
  4633. [
  4634. 1,
  4635. twoDimVert0
  4636. ],
  4637. [
  4638. 1,
  4639. twoDimVert0
  4640. ],
  4641. [
  4642. 1,
  4643. twoDimVert0
  4644. ],
  4645. [
  4646. 1,
  4647. twoDimVert0
  4648. ],
  4649. [
  4650. 1,
  4651. twoDimVert0
  4652. ],
  4653. [
  4654. 1,
  4655. twoDimVert0
  4656. ],
  4657. [
  4658. 1,
  4659. twoDimVert0
  4660. ],
  4661. [
  4662. 1,
  4663. twoDimVert0
  4664. ],
  4665. [
  4666. 1,
  4667. twoDimVert0
  4668. ],
  4669. [
  4670. 1,
  4671. twoDimVert0
  4672. ],
  4673. [
  4674. 1,
  4675. twoDimVert0
  4676. ],
  4677. [
  4678. 1,
  4679. twoDimVert0
  4680. ],
  4681. [
  4682. 1,
  4683. twoDimVert0
  4684. ],
  4685. [
  4686. 1,
  4687. twoDimVert0
  4688. ],
  4689. [
  4690. 1,
  4691. twoDimVert0
  4692. ],
  4693. [
  4694. 1,
  4695. twoDimVert0
  4696. ],
  4697. [
  4698. 1,
  4699. twoDimVert0
  4700. ],
  4701. [
  4702. 1,
  4703. twoDimVert0
  4704. ],
  4705. [
  4706. 1,
  4707. twoDimVert0
  4708. ],
  4709. [
  4710. 1,
  4711. twoDimVert0
  4712. ]
  4713. ];
  4714. var whiteTable1 = [
  4715. [
  4716. -1,
  4717. -1
  4718. ],
  4719. [
  4720. 12,
  4721. ccittEOL
  4722. ],
  4723. [
  4724. -1,
  4725. -1
  4726. ],
  4727. [
  4728. -1,
  4729. -1
  4730. ],
  4731. [
  4732. -1,
  4733. -1
  4734. ],
  4735. [
  4736. -1,
  4737. -1
  4738. ],
  4739. [
  4740. -1,
  4741. -1
  4742. ],
  4743. [
  4744. -1,
  4745. -1
  4746. ],
  4747. [
  4748. -1,
  4749. -1
  4750. ],
  4751. [
  4752. -1,
  4753. -1
  4754. ],
  4755. [
  4756. -1,
  4757. -1
  4758. ],
  4759. [
  4760. -1,
  4761. -1
  4762. ],
  4763. [
  4764. -1,
  4765. -1
  4766. ],
  4767. [
  4768. -1,
  4769. -1
  4770. ],
  4771. [
  4772. -1,
  4773. -1
  4774. ],
  4775. [
  4776. -1,
  4777. -1
  4778. ],
  4779. [
  4780. 11,
  4781. 1792
  4782. ],
  4783. [
  4784. 11,
  4785. 1792
  4786. ],
  4787. [
  4788. 12,
  4789. 1984
  4790. ],
  4791. [
  4792. 12,
  4793. 2048
  4794. ],
  4795. [
  4796. 12,
  4797. 2112
  4798. ],
  4799. [
  4800. 12,
  4801. 2176
  4802. ],
  4803. [
  4804. 12,
  4805. 2240
  4806. ],
  4807. [
  4808. 12,
  4809. 2304
  4810. ],
  4811. [
  4812. 11,
  4813. 1856
  4814. ],
  4815. [
  4816. 11,
  4817. 1856
  4818. ],
  4819. [
  4820. 11,
  4821. 1920
  4822. ],
  4823. [
  4824. 11,
  4825. 1920
  4826. ],
  4827. [
  4828. 12,
  4829. 2368
  4830. ],
  4831. [
  4832. 12,
  4833. 2432
  4834. ],
  4835. [
  4836. 12,
  4837. 2496
  4838. ],
  4839. [
  4840. 12,
  4841. 2560
  4842. ]
  4843. ];
  4844. var whiteTable2 = [
  4845. [
  4846. -1,
  4847. -1
  4848. ],
  4849. [
  4850. -1,
  4851. -1
  4852. ],
  4853. [
  4854. -1,
  4855. -1
  4856. ],
  4857. [
  4858. -1,
  4859. -1
  4860. ],
  4861. [
  4862. 8,
  4863. 29
  4864. ],
  4865. [
  4866. 8,
  4867. 29
  4868. ],
  4869. [
  4870. 8,
  4871. 30
  4872. ],
  4873. [
  4874. 8,
  4875. 30
  4876. ],
  4877. [
  4878. 8,
  4879. 45
  4880. ],
  4881. [
  4882. 8,
  4883. 45
  4884. ],
  4885. [
  4886. 8,
  4887. 46
  4888. ],
  4889. [
  4890. 8,
  4891. 46
  4892. ],
  4893. [
  4894. 7,
  4895. 22
  4896. ],
  4897. [
  4898. 7,
  4899. 22
  4900. ],
  4901. [
  4902. 7,
  4903. 22
  4904. ],
  4905. [
  4906. 7,
  4907. 22
  4908. ],
  4909. [
  4910. 7,
  4911. 23
  4912. ],
  4913. [
  4914. 7,
  4915. 23
  4916. ],
  4917. [
  4918. 7,
  4919. 23
  4920. ],
  4921. [
  4922. 7,
  4923. 23
  4924. ],
  4925. [
  4926. 8,
  4927. 47
  4928. ],
  4929. [
  4930. 8,
  4931. 47
  4932. ],
  4933. [
  4934. 8,
  4935. 48
  4936. ],
  4937. [
  4938. 8,
  4939. 48
  4940. ],
  4941. [
  4942. 6,
  4943. 13
  4944. ],
  4945. [
  4946. 6,
  4947. 13
  4948. ],
  4949. [
  4950. 6,
  4951. 13
  4952. ],
  4953. [
  4954. 6,
  4955. 13
  4956. ],
  4957. [
  4958. 6,
  4959. 13
  4960. ],
  4961. [
  4962. 6,
  4963. 13
  4964. ],
  4965. [
  4966. 6,
  4967. 13
  4968. ],
  4969. [
  4970. 6,
  4971. 13
  4972. ],
  4973. [
  4974. 7,
  4975. 20
  4976. ],
  4977. [
  4978. 7,
  4979. 20
  4980. ],
  4981. [
  4982. 7,
  4983. 20
  4984. ],
  4985. [
  4986. 7,
  4987. 20
  4988. ],
  4989. [
  4990. 8,
  4991. 33
  4992. ],
  4993. [
  4994. 8,
  4995. 33
  4996. ],
  4997. [
  4998. 8,
  4999. 34
  5000. ],
  5001. [
  5002. 8,
  5003. 34
  5004. ],
  5005. [
  5006. 8,
  5007. 35
  5008. ],
  5009. [
  5010. 8,
  5011. 35
  5012. ],
  5013. [
  5014. 8,
  5015. 36
  5016. ],
  5017. [
  5018. 8,
  5019. 36
  5020. ],
  5021. [
  5022. 8,
  5023. 37
  5024. ],
  5025. [
  5026. 8,
  5027. 37
  5028. ],
  5029. [
  5030. 8,
  5031. 38
  5032. ],
  5033. [
  5034. 8,
  5035. 38
  5036. ],
  5037. [
  5038. 7,
  5039. 19
  5040. ],
  5041. [
  5042. 7,
  5043. 19
  5044. ],
  5045. [
  5046. 7,
  5047. 19
  5048. ],
  5049. [
  5050. 7,
  5051. 19
  5052. ],
  5053. [
  5054. 8,
  5055. 31
  5056. ],
  5057. [
  5058. 8,
  5059. 31
  5060. ],
  5061. [
  5062. 8,
  5063. 32
  5064. ],
  5065. [
  5066. 8,
  5067. 32
  5068. ],
  5069. [
  5070. 6,
  5071. 1
  5072. ],
  5073. [
  5074. 6,
  5075. 1
  5076. ],
  5077. [
  5078. 6,
  5079. 1
  5080. ],
  5081. [
  5082. 6,
  5083. 1
  5084. ],
  5085. [
  5086. 6,
  5087. 1
  5088. ],
  5089. [
  5090. 6,
  5091. 1
  5092. ],
  5093. [
  5094. 6,
  5095. 1
  5096. ],
  5097. [
  5098. 6,
  5099. 1
  5100. ],
  5101. [
  5102. 6,
  5103. 12
  5104. ],
  5105. [
  5106. 6,
  5107. 12
  5108. ],
  5109. [
  5110. 6,
  5111. 12
  5112. ],
  5113. [
  5114. 6,
  5115. 12
  5116. ],
  5117. [
  5118. 6,
  5119. 12
  5120. ],
  5121. [
  5122. 6,
  5123. 12
  5124. ],
  5125. [
  5126. 6,
  5127. 12
  5128. ],
  5129. [
  5130. 6,
  5131. 12
  5132. ],
  5133. [
  5134. 8,
  5135. 53
  5136. ],
  5137. [
  5138. 8,
  5139. 53
  5140. ],
  5141. [
  5142. 8,
  5143. 54
  5144. ],
  5145. [
  5146. 8,
  5147. 54
  5148. ],
  5149. [
  5150. 7,
  5151. 26
  5152. ],
  5153. [
  5154. 7,
  5155. 26
  5156. ],
  5157. [
  5158. 7,
  5159. 26
  5160. ],
  5161. [
  5162. 7,
  5163. 26
  5164. ],
  5165. [
  5166. 8,
  5167. 39
  5168. ],
  5169. [
  5170. 8,
  5171. 39
  5172. ],
  5173. [
  5174. 8,
  5175. 40
  5176. ],
  5177. [
  5178. 8,
  5179. 40
  5180. ],
  5181. [
  5182. 8,
  5183. 41
  5184. ],
  5185. [
  5186. 8,
  5187. 41
  5188. ],
  5189. [
  5190. 8,
  5191. 42
  5192. ],
  5193. [
  5194. 8,
  5195. 42
  5196. ],
  5197. [
  5198. 8,
  5199. 43
  5200. ],
  5201. [
  5202. 8,
  5203. 43
  5204. ],
  5205. [
  5206. 8,
  5207. 44
  5208. ],
  5209. [
  5210. 8,
  5211. 44
  5212. ],
  5213. [
  5214. 7,
  5215. 21
  5216. ],
  5217. [
  5218. 7,
  5219. 21
  5220. ],
  5221. [
  5222. 7,
  5223. 21
  5224. ],
  5225. [
  5226. 7,
  5227. 21
  5228. ],
  5229. [
  5230. 7,
  5231. 28
  5232. ],
  5233. [
  5234. 7,
  5235. 28
  5236. ],
  5237. [
  5238. 7,
  5239. 28
  5240. ],
  5241. [
  5242. 7,
  5243. 28
  5244. ],
  5245. [
  5246. 8,
  5247. 61
  5248. ],
  5249. [
  5250. 8,
  5251. 61
  5252. ],
  5253. [
  5254. 8,
  5255. 62
  5256. ],
  5257. [
  5258. 8,
  5259. 62
  5260. ],
  5261. [
  5262. 8,
  5263. 63
  5264. ],
  5265. [
  5266. 8,
  5267. 63
  5268. ],
  5269. [
  5270. 8,
  5271. 0
  5272. ],
  5273. [
  5274. 8,
  5275. 0
  5276. ],
  5277. [
  5278. 8,
  5279. 320
  5280. ],
  5281. [
  5282. 8,
  5283. 320
  5284. ],
  5285. [
  5286. 8,
  5287. 384
  5288. ],
  5289. [
  5290. 8,
  5291. 384
  5292. ],
  5293. [
  5294. 5,
  5295. 10
  5296. ],
  5297. [
  5298. 5,
  5299. 10
  5300. ],
  5301. [
  5302. 5,
  5303. 10
  5304. ],
  5305. [
  5306. 5,
  5307. 10
  5308. ],
  5309. [
  5310. 5,
  5311. 10
  5312. ],
  5313. [
  5314. 5,
  5315. 10
  5316. ],
  5317. [
  5318. 5,
  5319. 10
  5320. ],
  5321. [
  5322. 5,
  5323. 10
  5324. ],
  5325. [
  5326. 5,
  5327. 10
  5328. ],
  5329. [
  5330. 5,
  5331. 10
  5332. ],
  5333. [
  5334. 5,
  5335. 10
  5336. ],
  5337. [
  5338. 5,
  5339. 10
  5340. ],
  5341. [
  5342. 5,
  5343. 10
  5344. ],
  5345. [
  5346. 5,
  5347. 10
  5348. ],
  5349. [
  5350. 5,
  5351. 10
  5352. ],
  5353. [
  5354. 5,
  5355. 10
  5356. ],
  5357. [
  5358. 5,
  5359. 11
  5360. ],
  5361. [
  5362. 5,
  5363. 11
  5364. ],
  5365. [
  5366. 5,
  5367. 11
  5368. ],
  5369. [
  5370. 5,
  5371. 11
  5372. ],
  5373. [
  5374. 5,
  5375. 11
  5376. ],
  5377. [
  5378. 5,
  5379. 11
  5380. ],
  5381. [
  5382. 5,
  5383. 11
  5384. ],
  5385. [
  5386. 5,
  5387. 11
  5388. ],
  5389. [
  5390. 5,
  5391. 11
  5392. ],
  5393. [
  5394. 5,
  5395. 11
  5396. ],
  5397. [
  5398. 5,
  5399. 11
  5400. ],
  5401. [
  5402. 5,
  5403. 11
  5404. ],
  5405. [
  5406. 5,
  5407. 11
  5408. ],
  5409. [
  5410. 5,
  5411. 11
  5412. ],
  5413. [
  5414. 5,
  5415. 11
  5416. ],
  5417. [
  5418. 5,
  5419. 11
  5420. ],
  5421. [
  5422. 7,
  5423. 27
  5424. ],
  5425. [
  5426. 7,
  5427. 27
  5428. ],
  5429. [
  5430. 7,
  5431. 27
  5432. ],
  5433. [
  5434. 7,
  5435. 27
  5436. ],
  5437. [
  5438. 8,
  5439. 59
  5440. ],
  5441. [
  5442. 8,
  5443. 59
  5444. ],
  5445. [
  5446. 8,
  5447. 60
  5448. ],
  5449. [
  5450. 8,
  5451. 60
  5452. ],
  5453. [
  5454. 9,
  5455. 1472
  5456. ],
  5457. [
  5458. 9,
  5459. 1536
  5460. ],
  5461. [
  5462. 9,
  5463. 1600
  5464. ],
  5465. [
  5466. 9,
  5467. 1728
  5468. ],
  5469. [
  5470. 7,
  5471. 18
  5472. ],
  5473. [
  5474. 7,
  5475. 18
  5476. ],
  5477. [
  5478. 7,
  5479. 18
  5480. ],
  5481. [
  5482. 7,
  5483. 18
  5484. ],
  5485. [
  5486. 7,
  5487. 24
  5488. ],
  5489. [
  5490. 7,
  5491. 24
  5492. ],
  5493. [
  5494. 7,
  5495. 24
  5496. ],
  5497. [
  5498. 7,
  5499. 24
  5500. ],
  5501. [
  5502. 8,
  5503. 49
  5504. ],
  5505. [
  5506. 8,
  5507. 49
  5508. ],
  5509. [
  5510. 8,
  5511. 50
  5512. ],
  5513. [
  5514. 8,
  5515. 50
  5516. ],
  5517. [
  5518. 8,
  5519. 51
  5520. ],
  5521. [
  5522. 8,
  5523. 51
  5524. ],
  5525. [
  5526. 8,
  5527. 52
  5528. ],
  5529. [
  5530. 8,
  5531. 52
  5532. ],
  5533. [
  5534. 7,
  5535. 25
  5536. ],
  5537. [
  5538. 7,
  5539. 25
  5540. ],
  5541. [
  5542. 7,
  5543. 25
  5544. ],
  5545. [
  5546. 7,
  5547. 25
  5548. ],
  5549. [
  5550. 8,
  5551. 55
  5552. ],
  5553. [
  5554. 8,
  5555. 55
  5556. ],
  5557. [
  5558. 8,
  5559. 56
  5560. ],
  5561. [
  5562. 8,
  5563. 56
  5564. ],
  5565. [
  5566. 8,
  5567. 57
  5568. ],
  5569. [
  5570. 8,
  5571. 57
  5572. ],
  5573. [
  5574. 8,
  5575. 58
  5576. ],
  5577. [
  5578. 8,
  5579. 58
  5580. ],
  5581. [
  5582. 6,
  5583. 192
  5584. ],
  5585. [
  5586. 6,
  5587. 192
  5588. ],
  5589. [
  5590. 6,
  5591. 192
  5592. ],
  5593. [
  5594. 6,
  5595. 192
  5596. ],
  5597. [
  5598. 6,
  5599. 192
  5600. ],
  5601. [
  5602. 6,
  5603. 192
  5604. ],
  5605. [
  5606. 6,
  5607. 192
  5608. ],
  5609. [
  5610. 6,
  5611. 192
  5612. ],
  5613. [
  5614. 6,
  5615. 1664
  5616. ],
  5617. [
  5618. 6,
  5619. 1664
  5620. ],
  5621. [
  5622. 6,
  5623. 1664
  5624. ],
  5625. [
  5626. 6,
  5627. 1664
  5628. ],
  5629. [
  5630. 6,
  5631. 1664
  5632. ],
  5633. [
  5634. 6,
  5635. 1664
  5636. ],
  5637. [
  5638. 6,
  5639. 1664
  5640. ],
  5641. [
  5642. 6,
  5643. 1664
  5644. ],
  5645. [
  5646. 8,
  5647. 448
  5648. ],
  5649. [
  5650. 8,
  5651. 448
  5652. ],
  5653. [
  5654. 8,
  5655. 512
  5656. ],
  5657. [
  5658. 8,
  5659. 512
  5660. ],
  5661. [
  5662. 9,
  5663. 704
  5664. ],
  5665. [
  5666. 9,
  5667. 768
  5668. ],
  5669. [
  5670. 8,
  5671. 640
  5672. ],
  5673. [
  5674. 8,
  5675. 640
  5676. ],
  5677. [
  5678. 8,
  5679. 576
  5680. ],
  5681. [
  5682. 8,
  5683. 576
  5684. ],
  5685. [
  5686. 9,
  5687. 832
  5688. ],
  5689. [
  5690. 9,
  5691. 896
  5692. ],
  5693. [
  5694. 9,
  5695. 960
  5696. ],
  5697. [
  5698. 9,
  5699. 1024
  5700. ],
  5701. [
  5702. 9,
  5703. 1088
  5704. ],
  5705. [
  5706. 9,
  5707. 1152
  5708. ],
  5709. [
  5710. 9,
  5711. 1216
  5712. ],
  5713. [
  5714. 9,
  5715. 1280
  5716. ],
  5717. [
  5718. 9,
  5719. 1344
  5720. ],
  5721. [
  5722. 9,
  5723. 1408
  5724. ],
  5725. [
  5726. 7,
  5727. 256
  5728. ],
  5729. [
  5730. 7,
  5731. 256
  5732. ],
  5733. [
  5734. 7,
  5735. 256
  5736. ],
  5737. [
  5738. 7,
  5739. 256
  5740. ],
  5741. [
  5742. 4,
  5743. 2
  5744. ],
  5745. [
  5746. 4,
  5747. 2
  5748. ],
  5749. [
  5750. 4,
  5751. 2
  5752. ],
  5753. [
  5754. 4,
  5755. 2
  5756. ],
  5757. [
  5758. 4,
  5759. 2
  5760. ],
  5761. [
  5762. 4,
  5763. 2
  5764. ],
  5765. [
  5766. 4,
  5767. 2
  5768. ],
  5769. [
  5770. 4,
  5771. 2
  5772. ],
  5773. [
  5774. 4,
  5775. 2
  5776. ],
  5777. [
  5778. 4,
  5779. 2
  5780. ],
  5781. [
  5782. 4,
  5783. 2
  5784. ],
  5785. [
  5786. 4,
  5787. 2
  5788. ],
  5789. [
  5790. 4,
  5791. 2
  5792. ],
  5793. [
  5794. 4,
  5795. 2
  5796. ],
  5797. [
  5798. 4,
  5799. 2
  5800. ],
  5801. [
  5802. 4,
  5803. 2
  5804. ],
  5805. [
  5806. 4,
  5807. 2
  5808. ],
  5809. [
  5810. 4,
  5811. 2
  5812. ],
  5813. [
  5814. 4,
  5815. 2
  5816. ],
  5817. [
  5818. 4,
  5819. 2
  5820. ],
  5821. [
  5822. 4,
  5823. 2
  5824. ],
  5825. [
  5826. 4,
  5827. 2
  5828. ],
  5829. [
  5830. 4,
  5831. 2
  5832. ],
  5833. [
  5834. 4,
  5835. 2
  5836. ],
  5837. [
  5838. 4,
  5839. 2
  5840. ],
  5841. [
  5842. 4,
  5843. 2
  5844. ],
  5845. [
  5846. 4,
  5847. 2
  5848. ],
  5849. [
  5850. 4,
  5851. 2
  5852. ],
  5853. [
  5854. 4,
  5855. 2
  5856. ],
  5857. [
  5858. 4,
  5859. 2
  5860. ],
  5861. [
  5862. 4,
  5863. 2
  5864. ],
  5865. [
  5866. 4,
  5867. 2
  5868. ],
  5869. [
  5870. 4,
  5871. 3
  5872. ],
  5873. [
  5874. 4,
  5875. 3
  5876. ],
  5877. [
  5878. 4,
  5879. 3
  5880. ],
  5881. [
  5882. 4,
  5883. 3
  5884. ],
  5885. [
  5886. 4,
  5887. 3
  5888. ],
  5889. [
  5890. 4,
  5891. 3
  5892. ],
  5893. [
  5894. 4,
  5895. 3
  5896. ],
  5897. [
  5898. 4,
  5899. 3
  5900. ],
  5901. [
  5902. 4,
  5903. 3
  5904. ],
  5905. [
  5906. 4,
  5907. 3
  5908. ],
  5909. [
  5910. 4,
  5911. 3
  5912. ],
  5913. [
  5914. 4,
  5915. 3
  5916. ],
  5917. [
  5918. 4,
  5919. 3
  5920. ],
  5921. [
  5922. 4,
  5923. 3
  5924. ],
  5925. [
  5926. 4,
  5927. 3
  5928. ],
  5929. [
  5930. 4,
  5931. 3
  5932. ],
  5933. [
  5934. 4,
  5935. 3
  5936. ],
  5937. [
  5938. 4,
  5939. 3
  5940. ],
  5941. [
  5942. 4,
  5943. 3
  5944. ],
  5945. [
  5946. 4,
  5947. 3
  5948. ],
  5949. [
  5950. 4,
  5951. 3
  5952. ],
  5953. [
  5954. 4,
  5955. 3
  5956. ],
  5957. [
  5958. 4,
  5959. 3
  5960. ],
  5961. [
  5962. 4,
  5963. 3
  5964. ],
  5965. [
  5966. 4,
  5967. 3
  5968. ],
  5969. [
  5970. 4,
  5971. 3
  5972. ],
  5973. [
  5974. 4,
  5975. 3
  5976. ],
  5977. [
  5978. 4,
  5979. 3
  5980. ],
  5981. [
  5982. 4,
  5983. 3
  5984. ],
  5985. [
  5986. 4,
  5987. 3
  5988. ],
  5989. [
  5990. 4,
  5991. 3
  5992. ],
  5993. [
  5994. 4,
  5995. 3
  5996. ],
  5997. [
  5998. 5,
  5999. 128
  6000. ],
  6001. [
  6002. 5,
  6003. 128
  6004. ],
  6005. [
  6006. 5,
  6007. 128
  6008. ],
  6009. [
  6010. 5,
  6011. 128
  6012. ],
  6013. [
  6014. 5,
  6015. 128
  6016. ],
  6017. [
  6018. 5,
  6019. 128
  6020. ],
  6021. [
  6022. 5,
  6023. 128
  6024. ],
  6025. [
  6026. 5,
  6027. 128
  6028. ],
  6029. [
  6030. 5,
  6031. 128
  6032. ],
  6033. [
  6034. 5,
  6035. 128
  6036. ],
  6037. [
  6038. 5,
  6039. 128
  6040. ],
  6041. [
  6042. 5,
  6043. 128
  6044. ],
  6045. [
  6046. 5,
  6047. 128
  6048. ],
  6049. [
  6050. 5,
  6051. 128
  6052. ],
  6053. [
  6054. 5,
  6055. 128
  6056. ],
  6057. [
  6058. 5,
  6059. 128
  6060. ],
  6061. [
  6062. 5,
  6063. 8
  6064. ],
  6065. [
  6066. 5,
  6067. 8
  6068. ],
  6069. [
  6070. 5,
  6071. 8
  6072. ],
  6073. [
  6074. 5,
  6075. 8
  6076. ],
  6077. [
  6078. 5,
  6079. 8
  6080. ],
  6081. [
  6082. 5,
  6083. 8
  6084. ],
  6085. [
  6086. 5,
  6087. 8
  6088. ],
  6089. [
  6090. 5,
  6091. 8
  6092. ],
  6093. [
  6094. 5,
  6095. 8
  6096. ],
  6097. [
  6098. 5,
  6099. 8
  6100. ],
  6101. [
  6102. 5,
  6103. 8
  6104. ],
  6105. [
  6106. 5,
  6107. 8
  6108. ],
  6109. [
  6110. 5,
  6111. 8
  6112. ],
  6113. [
  6114. 5,
  6115. 8
  6116. ],
  6117. [
  6118. 5,
  6119. 8
  6120. ],
  6121. [
  6122. 5,
  6123. 8
  6124. ],
  6125. [
  6126. 5,
  6127. 9
  6128. ],
  6129. [
  6130. 5,
  6131. 9
  6132. ],
  6133. [
  6134. 5,
  6135. 9
  6136. ],
  6137. [
  6138. 5,
  6139. 9
  6140. ],
  6141. [
  6142. 5,
  6143. 9
  6144. ],
  6145. [
  6146. 5,
  6147. 9
  6148. ],
  6149. [
  6150. 5,
  6151. 9
  6152. ],
  6153. [
  6154. 5,
  6155. 9
  6156. ],
  6157. [
  6158. 5,
  6159. 9
  6160. ],
  6161. [
  6162. 5,
  6163. 9
  6164. ],
  6165. [
  6166. 5,
  6167. 9
  6168. ],
  6169. [
  6170. 5,
  6171. 9
  6172. ],
  6173. [
  6174. 5,
  6175. 9
  6176. ],
  6177. [
  6178. 5,
  6179. 9
  6180. ],
  6181. [
  6182. 5,
  6183. 9
  6184. ],
  6185. [
  6186. 5,
  6187. 9
  6188. ],
  6189. [
  6190. 6,
  6191. 16
  6192. ],
  6193. [
  6194. 6,
  6195. 16
  6196. ],
  6197. [
  6198. 6,
  6199. 16
  6200. ],
  6201. [
  6202. 6,
  6203. 16
  6204. ],
  6205. [
  6206. 6,
  6207. 16
  6208. ],
  6209. [
  6210. 6,
  6211. 16
  6212. ],
  6213. [
  6214. 6,
  6215. 16
  6216. ],
  6217. [
  6218. 6,
  6219. 16
  6220. ],
  6221. [
  6222. 6,
  6223. 17
  6224. ],
  6225. [
  6226. 6,
  6227. 17
  6228. ],
  6229. [
  6230. 6,
  6231. 17
  6232. ],
  6233. [
  6234. 6,
  6235. 17
  6236. ],
  6237. [
  6238. 6,
  6239. 17
  6240. ],
  6241. [
  6242. 6,
  6243. 17
  6244. ],
  6245. [
  6246. 6,
  6247. 17
  6248. ],
  6249. [
  6250. 6,
  6251. 17
  6252. ],
  6253. [
  6254. 4,
  6255. 4
  6256. ],
  6257. [
  6258. 4,
  6259. 4
  6260. ],
  6261. [
  6262. 4,
  6263. 4
  6264. ],
  6265. [
  6266. 4,
  6267. 4
  6268. ],
  6269. [
  6270. 4,
  6271. 4
  6272. ],
  6273. [
  6274. 4,
  6275. 4
  6276. ],
  6277. [
  6278. 4,
  6279. 4
  6280. ],
  6281. [
  6282. 4,
  6283. 4
  6284. ],
  6285. [
  6286. 4,
  6287. 4
  6288. ],
  6289. [
  6290. 4,
  6291. 4
  6292. ],
  6293. [
  6294. 4,
  6295. 4
  6296. ],
  6297. [
  6298. 4,
  6299. 4
  6300. ],
  6301. [
  6302. 4,
  6303. 4
  6304. ],
  6305. [
  6306. 4,
  6307. 4
  6308. ],
  6309. [
  6310. 4,
  6311. 4
  6312. ],
  6313. [
  6314. 4,
  6315. 4
  6316. ],
  6317. [
  6318. 4,
  6319. 4
  6320. ],
  6321. [
  6322. 4,
  6323. 4
  6324. ],
  6325. [
  6326. 4,
  6327. 4
  6328. ],
  6329. [
  6330. 4,
  6331. 4
  6332. ],
  6333. [
  6334. 4,
  6335. 4
  6336. ],
  6337. [
  6338. 4,
  6339. 4
  6340. ],
  6341. [
  6342. 4,
  6343. 4
  6344. ],
  6345. [
  6346. 4,
  6347. 4
  6348. ],
  6349. [
  6350. 4,
  6351. 4
  6352. ],
  6353. [
  6354. 4,
  6355. 4
  6356. ],
  6357. [
  6358. 4,
  6359. 4
  6360. ],
  6361. [
  6362. 4,
  6363. 4
  6364. ],
  6365. [
  6366. 4,
  6367. 4
  6368. ],
  6369. [
  6370. 4,
  6371. 4
  6372. ],
  6373. [
  6374. 4,
  6375. 4
  6376. ],
  6377. [
  6378. 4,
  6379. 4
  6380. ],
  6381. [
  6382. 4,
  6383. 5
  6384. ],
  6385. [
  6386. 4,
  6387. 5
  6388. ],
  6389. [
  6390. 4,
  6391. 5
  6392. ],
  6393. [
  6394. 4,
  6395. 5
  6396. ],
  6397. [
  6398. 4,
  6399. 5
  6400. ],
  6401. [
  6402. 4,
  6403. 5
  6404. ],
  6405. [
  6406. 4,
  6407. 5
  6408. ],
  6409. [
  6410. 4,
  6411. 5
  6412. ],
  6413. [
  6414. 4,
  6415. 5
  6416. ],
  6417. [
  6418. 4,
  6419. 5
  6420. ],
  6421. [
  6422. 4,
  6423. 5
  6424. ],
  6425. [
  6426. 4,
  6427. 5
  6428. ],
  6429. [
  6430. 4,
  6431. 5
  6432. ],
  6433. [
  6434. 4,
  6435. 5
  6436. ],
  6437. [
  6438. 4,
  6439. 5
  6440. ],
  6441. [
  6442. 4,
  6443. 5
  6444. ],
  6445. [
  6446. 4,
  6447. 5
  6448. ],
  6449. [
  6450. 4,
  6451. 5
  6452. ],
  6453. [
  6454. 4,
  6455. 5
  6456. ],
  6457. [
  6458. 4,
  6459. 5
  6460. ],
  6461. [
  6462. 4,
  6463. 5
  6464. ],
  6465. [
  6466. 4,
  6467. 5
  6468. ],
  6469. [
  6470. 4,
  6471. 5
  6472. ],
  6473. [
  6474. 4,
  6475. 5
  6476. ],
  6477. [
  6478. 4,
  6479. 5
  6480. ],
  6481. [
  6482. 4,
  6483. 5
  6484. ],
  6485. [
  6486. 4,
  6487. 5
  6488. ],
  6489. [
  6490. 4,
  6491. 5
  6492. ],
  6493. [
  6494. 4,
  6495. 5
  6496. ],
  6497. [
  6498. 4,
  6499. 5
  6500. ],
  6501. [
  6502. 4,
  6503. 5
  6504. ],
  6505. [
  6506. 4,
  6507. 5
  6508. ],
  6509. [
  6510. 6,
  6511. 14
  6512. ],
  6513. [
  6514. 6,
  6515. 14
  6516. ],
  6517. [
  6518. 6,
  6519. 14
  6520. ],
  6521. [
  6522. 6,
  6523. 14
  6524. ],
  6525. [
  6526. 6,
  6527. 14
  6528. ],
  6529. [
  6530. 6,
  6531. 14
  6532. ],
  6533. [
  6534. 6,
  6535. 14
  6536. ],
  6537. [
  6538. 6,
  6539. 14
  6540. ],
  6541. [
  6542. 6,
  6543. 15
  6544. ],
  6545. [
  6546. 6,
  6547. 15
  6548. ],
  6549. [
  6550. 6,
  6551. 15
  6552. ],
  6553. [
  6554. 6,
  6555. 15
  6556. ],
  6557. [
  6558. 6,
  6559. 15
  6560. ],
  6561. [
  6562. 6,
  6563. 15
  6564. ],
  6565. [
  6566. 6,
  6567. 15
  6568. ],
  6569. [
  6570. 6,
  6571. 15
  6572. ],
  6573. [
  6574. 5,
  6575. 64
  6576. ],
  6577. [
  6578. 5,
  6579. 64
  6580. ],
  6581. [
  6582. 5,
  6583. 64
  6584. ],
  6585. [
  6586. 5,
  6587. 64
  6588. ],
  6589. [
  6590. 5,
  6591. 64
  6592. ],
  6593. [
  6594. 5,
  6595. 64
  6596. ],
  6597. [
  6598. 5,
  6599. 64
  6600. ],
  6601. [
  6602. 5,
  6603. 64
  6604. ],
  6605. [
  6606. 5,
  6607. 64
  6608. ],
  6609. [
  6610. 5,
  6611. 64
  6612. ],
  6613. [
  6614. 5,
  6615. 64
  6616. ],
  6617. [
  6618. 5,
  6619. 64
  6620. ],
  6621. [
  6622. 5,
  6623. 64
  6624. ],
  6625. [
  6626. 5,
  6627. 64
  6628. ],
  6629. [
  6630. 5,
  6631. 64
  6632. ],
  6633. [
  6634. 5,
  6635. 64
  6636. ],
  6637. [
  6638. 4,
  6639. 6
  6640. ],
  6641. [
  6642. 4,
  6643. 6
  6644. ],
  6645. [
  6646. 4,
  6647. 6
  6648. ],
  6649. [
  6650. 4,
  6651. 6
  6652. ],
  6653. [
  6654. 4,
  6655. 6
  6656. ],
  6657. [
  6658. 4,
  6659. 6
  6660. ],
  6661. [
  6662. 4,
  6663. 6
  6664. ],
  6665. [
  6666. 4,
  6667. 6
  6668. ],
  6669. [
  6670. 4,
  6671. 6
  6672. ],
  6673. [
  6674. 4,
  6675. 6
  6676. ],
  6677. [
  6678. 4,
  6679. 6
  6680. ],
  6681. [
  6682. 4,
  6683. 6
  6684. ],
  6685. [
  6686. 4,
  6687. 6
  6688. ],
  6689. [
  6690. 4,
  6691. 6
  6692. ],
  6693. [
  6694. 4,
  6695. 6
  6696. ],
  6697. [
  6698. 4,
  6699. 6
  6700. ],
  6701. [
  6702. 4,
  6703. 6
  6704. ],
  6705. [
  6706. 4,
  6707. 6
  6708. ],
  6709. [
  6710. 4,
  6711. 6
  6712. ],
  6713. [
  6714. 4,
  6715. 6
  6716. ],
  6717. [
  6718. 4,
  6719. 6
  6720. ],
  6721. [
  6722. 4,
  6723. 6
  6724. ],
  6725. [
  6726. 4,
  6727. 6
  6728. ],
  6729. [
  6730. 4,
  6731. 6
  6732. ],
  6733. [
  6734. 4,
  6735. 6
  6736. ],
  6737. [
  6738. 4,
  6739. 6
  6740. ],
  6741. [
  6742. 4,
  6743. 6
  6744. ],
  6745. [
  6746. 4,
  6747. 6
  6748. ],
  6749. [
  6750. 4,
  6751. 6
  6752. ],
  6753. [
  6754. 4,
  6755. 6
  6756. ],
  6757. [
  6758. 4,
  6759. 6
  6760. ],
  6761. [
  6762. 4,
  6763. 6
  6764. ],
  6765. [
  6766. 4,
  6767. 7
  6768. ],
  6769. [
  6770. 4,
  6771. 7
  6772. ],
  6773. [
  6774. 4,
  6775. 7
  6776. ],
  6777. [
  6778. 4,
  6779. 7
  6780. ],
  6781. [
  6782. 4,
  6783. 7
  6784. ],
  6785. [
  6786. 4,
  6787. 7
  6788. ],
  6789. [
  6790. 4,
  6791. 7
  6792. ],
  6793. [
  6794. 4,
  6795. 7
  6796. ],
  6797. [
  6798. 4,
  6799. 7
  6800. ],
  6801. [
  6802. 4,
  6803. 7
  6804. ],
  6805. [
  6806. 4,
  6807. 7
  6808. ],
  6809. [
  6810. 4,
  6811. 7
  6812. ],
  6813. [
  6814. 4,
  6815. 7
  6816. ],
  6817. [
  6818. 4,
  6819. 7
  6820. ],
  6821. [
  6822. 4,
  6823. 7
  6824. ],
  6825. [
  6826. 4,
  6827. 7
  6828. ],
  6829. [
  6830. 4,
  6831. 7
  6832. ],
  6833. [
  6834. 4,
  6835. 7
  6836. ],
  6837. [
  6838. 4,
  6839. 7
  6840. ],
  6841. [
  6842. 4,
  6843. 7
  6844. ],
  6845. [
  6846. 4,
  6847. 7
  6848. ],
  6849. [
  6850. 4,
  6851. 7
  6852. ],
  6853. [
  6854. 4,
  6855. 7
  6856. ],
  6857. [
  6858. 4,
  6859. 7
  6860. ],
  6861. [
  6862. 4,
  6863. 7
  6864. ],
  6865. [
  6866. 4,
  6867. 7
  6868. ],
  6869. [
  6870. 4,
  6871. 7
  6872. ],
  6873. [
  6874. 4,
  6875. 7
  6876. ],
  6877. [
  6878. 4,
  6879. 7
  6880. ],
  6881. [
  6882. 4,
  6883. 7
  6884. ],
  6885. [
  6886. 4,
  6887. 7
  6888. ],
  6889. [
  6890. 4,
  6891. 7
  6892. ]
  6893. ];
  6894. var blackTable1 = [
  6895. [
  6896. -1,
  6897. -1
  6898. ],
  6899. [
  6900. -1,
  6901. -1
  6902. ],
  6903. [
  6904. 12,
  6905. ccittEOL
  6906. ],
  6907. [
  6908. 12,
  6909. ccittEOL
  6910. ],
  6911. [
  6912. -1,
  6913. -1
  6914. ],
  6915. [
  6916. -1,
  6917. -1
  6918. ],
  6919. [
  6920. -1,
  6921. -1
  6922. ],
  6923. [
  6924. -1,
  6925. -1
  6926. ],
  6927. [
  6928. -1,
  6929. -1
  6930. ],
  6931. [
  6932. -1,
  6933. -1
  6934. ],
  6935. [
  6936. -1,
  6937. -1
  6938. ],
  6939. [
  6940. -1,
  6941. -1
  6942. ],
  6943. [
  6944. -1,
  6945. -1
  6946. ],
  6947. [
  6948. -1,
  6949. -1
  6950. ],
  6951. [
  6952. -1,
  6953. -1
  6954. ],
  6955. [
  6956. -1,
  6957. -1
  6958. ],
  6959. [
  6960. -1,
  6961. -1
  6962. ],
  6963. [
  6964. -1,
  6965. -1
  6966. ],
  6967. [
  6968. -1,
  6969. -1
  6970. ],
  6971. [
  6972. -1,
  6973. -1
  6974. ],
  6975. [
  6976. -1,
  6977. -1
  6978. ],
  6979. [
  6980. -1,
  6981. -1
  6982. ],
  6983. [
  6984. -1,
  6985. -1
  6986. ],
  6987. [
  6988. -1,
  6989. -1
  6990. ],
  6991. [
  6992. -1,
  6993. -1
  6994. ],
  6995. [
  6996. -1,
  6997. -1
  6998. ],
  6999. [
  7000. -1,
  7001. -1
  7002. ],
  7003. [
  7004. -1,
  7005. -1
  7006. ],
  7007. [
  7008. -1,
  7009. -1
  7010. ],
  7011. [
  7012. -1,
  7013. -1
  7014. ],
  7015. [
  7016. -1,
  7017. -1
  7018. ],
  7019. [
  7020. -1,
  7021. -1
  7022. ],
  7023. [
  7024. 11,
  7025. 1792
  7026. ],
  7027. [
  7028. 11,
  7029. 1792
  7030. ],
  7031. [
  7032. 11,
  7033. 1792
  7034. ],
  7035. [
  7036. 11,
  7037. 1792
  7038. ],
  7039. [
  7040. 12,
  7041. 1984
  7042. ],
  7043. [
  7044. 12,
  7045. 1984
  7046. ],
  7047. [
  7048. 12,
  7049. 2048
  7050. ],
  7051. [
  7052. 12,
  7053. 2048
  7054. ],
  7055. [
  7056. 12,
  7057. 2112
  7058. ],
  7059. [
  7060. 12,
  7061. 2112
  7062. ],
  7063. [
  7064. 12,
  7065. 2176
  7066. ],
  7067. [
  7068. 12,
  7069. 2176
  7070. ],
  7071. [
  7072. 12,
  7073. 2240
  7074. ],
  7075. [
  7076. 12,
  7077. 2240
  7078. ],
  7079. [
  7080. 12,
  7081. 2304
  7082. ],
  7083. [
  7084. 12,
  7085. 2304
  7086. ],
  7087. [
  7088. 11,
  7089. 1856
  7090. ],
  7091. [
  7092. 11,
  7093. 1856
  7094. ],
  7095. [
  7096. 11,
  7097. 1856
  7098. ],
  7099. [
  7100. 11,
  7101. 1856
  7102. ],
  7103. [
  7104. 11,
  7105. 1920
  7106. ],
  7107. [
  7108. 11,
  7109. 1920
  7110. ],
  7111. [
  7112. 11,
  7113. 1920
  7114. ],
  7115. [
  7116. 11,
  7117. 1920
  7118. ],
  7119. [
  7120. 12,
  7121. 2368
  7122. ],
  7123. [
  7124. 12,
  7125. 2368
  7126. ],
  7127. [
  7128. 12,
  7129. 2432
  7130. ],
  7131. [
  7132. 12,
  7133. 2432
  7134. ],
  7135. [
  7136. 12,
  7137. 2496
  7138. ],
  7139. [
  7140. 12,
  7141. 2496
  7142. ],
  7143. [
  7144. 12,
  7145. 2560
  7146. ],
  7147. [
  7148. 12,
  7149. 2560
  7150. ],
  7151. [
  7152. 10,
  7153. 18
  7154. ],
  7155. [
  7156. 10,
  7157. 18
  7158. ],
  7159. [
  7160. 10,
  7161. 18
  7162. ],
  7163. [
  7164. 10,
  7165. 18
  7166. ],
  7167. [
  7168. 10,
  7169. 18
  7170. ],
  7171. [
  7172. 10,
  7173. 18
  7174. ],
  7175. [
  7176. 10,
  7177. 18
  7178. ],
  7179. [
  7180. 10,
  7181. 18
  7182. ],
  7183. [
  7184. 12,
  7185. 52
  7186. ],
  7187. [
  7188. 12,
  7189. 52
  7190. ],
  7191. [
  7192. 13,
  7193. 640
  7194. ],
  7195. [
  7196. 13,
  7197. 704
  7198. ],
  7199. [
  7200. 13,
  7201. 768
  7202. ],
  7203. [
  7204. 13,
  7205. 832
  7206. ],
  7207. [
  7208. 12,
  7209. 55
  7210. ],
  7211. [
  7212. 12,
  7213. 55
  7214. ],
  7215. [
  7216. 12,
  7217. 56
  7218. ],
  7219. [
  7220. 12,
  7221. 56
  7222. ],
  7223. [
  7224. 13,
  7225. 1280
  7226. ],
  7227. [
  7228. 13,
  7229. 1344
  7230. ],
  7231. [
  7232. 13,
  7233. 1408
  7234. ],
  7235. [
  7236. 13,
  7237. 1472
  7238. ],
  7239. [
  7240. 12,
  7241. 59
  7242. ],
  7243. [
  7244. 12,
  7245. 59
  7246. ],
  7247. [
  7248. 12,
  7249. 60
  7250. ],
  7251. [
  7252. 12,
  7253. 60
  7254. ],
  7255. [
  7256. 13,
  7257. 1536
  7258. ],
  7259. [
  7260. 13,
  7261. 1600
  7262. ],
  7263. [
  7264. 11,
  7265. 24
  7266. ],
  7267. [
  7268. 11,
  7269. 24
  7270. ],
  7271. [
  7272. 11,
  7273. 24
  7274. ],
  7275. [
  7276. 11,
  7277. 24
  7278. ],
  7279. [
  7280. 11,
  7281. 25
  7282. ],
  7283. [
  7284. 11,
  7285. 25
  7286. ],
  7287. [
  7288. 11,
  7289. 25
  7290. ],
  7291. [
  7292. 11,
  7293. 25
  7294. ],
  7295. [
  7296. 13,
  7297. 1664
  7298. ],
  7299. [
  7300. 13,
  7301. 1728
  7302. ],
  7303. [
  7304. 12,
  7305. 320
  7306. ],
  7307. [
  7308. 12,
  7309. 320
  7310. ],
  7311. [
  7312. 12,
  7313. 384
  7314. ],
  7315. [
  7316. 12,
  7317. 384
  7318. ],
  7319. [
  7320. 12,
  7321. 448
  7322. ],
  7323. [
  7324. 12,
  7325. 448
  7326. ],
  7327. [
  7328. 13,
  7329. 512
  7330. ],
  7331. [
  7332. 13,
  7333. 576
  7334. ],
  7335. [
  7336. 12,
  7337. 53
  7338. ],
  7339. [
  7340. 12,
  7341. 53
  7342. ],
  7343. [
  7344. 12,
  7345. 54
  7346. ],
  7347. [
  7348. 12,
  7349. 54
  7350. ],
  7351. [
  7352. 13,
  7353. 896
  7354. ],
  7355. [
  7356. 13,
  7357. 960
  7358. ],
  7359. [
  7360. 13,
  7361. 1024
  7362. ],
  7363. [
  7364. 13,
  7365. 1088
  7366. ],
  7367. [
  7368. 13,
  7369. 1152
  7370. ],
  7371. [
  7372. 13,
  7373. 1216
  7374. ],
  7375. [
  7376. 10,
  7377. 64
  7378. ],
  7379. [
  7380. 10,
  7381. 64
  7382. ],
  7383. [
  7384. 10,
  7385. 64
  7386. ],
  7387. [
  7388. 10,
  7389. 64
  7390. ],
  7391. [
  7392. 10,
  7393. 64
  7394. ],
  7395. [
  7396. 10,
  7397. 64
  7398. ],
  7399. [
  7400. 10,
  7401. 64
  7402. ],
  7403. [
  7404. 10,
  7405. 64
  7406. ]
  7407. ];
  7408. var blackTable2 = [
  7409. [
  7410. 8,
  7411. 13
  7412. ],
  7413. [
  7414. 8,
  7415. 13
  7416. ],
  7417. [
  7418. 8,
  7419. 13
  7420. ],
  7421. [
  7422. 8,
  7423. 13
  7424. ],
  7425. [
  7426. 8,
  7427. 13
  7428. ],
  7429. [
  7430. 8,
  7431. 13
  7432. ],
  7433. [
  7434. 8,
  7435. 13
  7436. ],
  7437. [
  7438. 8,
  7439. 13
  7440. ],
  7441. [
  7442. 8,
  7443. 13
  7444. ],
  7445. [
  7446. 8,
  7447. 13
  7448. ],
  7449. [
  7450. 8,
  7451. 13
  7452. ],
  7453. [
  7454. 8,
  7455. 13
  7456. ],
  7457. [
  7458. 8,
  7459. 13
  7460. ],
  7461. [
  7462. 8,
  7463. 13
  7464. ],
  7465. [
  7466. 8,
  7467. 13
  7468. ],
  7469. [
  7470. 8,
  7471. 13
  7472. ],
  7473. [
  7474. 11,
  7475. 23
  7476. ],
  7477. [
  7478. 11,
  7479. 23
  7480. ],
  7481. [
  7482. 12,
  7483. 50
  7484. ],
  7485. [
  7486. 12,
  7487. 51
  7488. ],
  7489. [
  7490. 12,
  7491. 44
  7492. ],
  7493. [
  7494. 12,
  7495. 45
  7496. ],
  7497. [
  7498. 12,
  7499. 46
  7500. ],
  7501. [
  7502. 12,
  7503. 47
  7504. ],
  7505. [
  7506. 12,
  7507. 57
  7508. ],
  7509. [
  7510. 12,
  7511. 58
  7512. ],
  7513. [
  7514. 12,
  7515. 61
  7516. ],
  7517. [
  7518. 12,
  7519. 256
  7520. ],
  7521. [
  7522. 10,
  7523. 16
  7524. ],
  7525. [
  7526. 10,
  7527. 16
  7528. ],
  7529. [
  7530. 10,
  7531. 16
  7532. ],
  7533. [
  7534. 10,
  7535. 16
  7536. ],
  7537. [
  7538. 10,
  7539. 17
  7540. ],
  7541. [
  7542. 10,
  7543. 17
  7544. ],
  7545. [
  7546. 10,
  7547. 17
  7548. ],
  7549. [
  7550. 10,
  7551. 17
  7552. ],
  7553. [
  7554. 12,
  7555. 48
  7556. ],
  7557. [
  7558. 12,
  7559. 49
  7560. ],
  7561. [
  7562. 12,
  7563. 62
  7564. ],
  7565. [
  7566. 12,
  7567. 63
  7568. ],
  7569. [
  7570. 12,
  7571. 30
  7572. ],
  7573. [
  7574. 12,
  7575. 31
  7576. ],
  7577. [
  7578. 12,
  7579. 32
  7580. ],
  7581. [
  7582. 12,
  7583. 33
  7584. ],
  7585. [
  7586. 12,
  7587. 40
  7588. ],
  7589. [
  7590. 12,
  7591. 41
  7592. ],
  7593. [
  7594. 11,
  7595. 22
  7596. ],
  7597. [
  7598. 11,
  7599. 22
  7600. ],
  7601. [
  7602. 8,
  7603. 14
  7604. ],
  7605. [
  7606. 8,
  7607. 14
  7608. ],
  7609. [
  7610. 8,
  7611. 14
  7612. ],
  7613. [
  7614. 8,
  7615. 14
  7616. ],
  7617. [
  7618. 8,
  7619. 14
  7620. ],
  7621. [
  7622. 8,
  7623. 14
  7624. ],
  7625. [
  7626. 8,
  7627. 14
  7628. ],
  7629. [
  7630. 8,
  7631. 14
  7632. ],
  7633. [
  7634. 8,
  7635. 14
  7636. ],
  7637. [
  7638. 8,
  7639. 14
  7640. ],
  7641. [
  7642. 8,
  7643. 14
  7644. ],
  7645. [
  7646. 8,
  7647. 14
  7648. ],
  7649. [
  7650. 8,
  7651. 14
  7652. ],
  7653. [
  7654. 8,
  7655. 14
  7656. ],
  7657. [
  7658. 8,
  7659. 14
  7660. ],
  7661. [
  7662. 8,
  7663. 14
  7664. ],
  7665. [
  7666. 7,
  7667. 10
  7668. ],
  7669. [
  7670. 7,
  7671. 10
  7672. ],
  7673. [
  7674. 7,
  7675. 10
  7676. ],
  7677. [
  7678. 7,
  7679. 10
  7680. ],
  7681. [
  7682. 7,
  7683. 10
  7684. ],
  7685. [
  7686. 7,
  7687. 10
  7688. ],
  7689. [
  7690. 7,
  7691. 10
  7692. ],
  7693. [
  7694. 7,
  7695. 10
  7696. ],
  7697. [
  7698. 7,
  7699. 10
  7700. ],
  7701. [
  7702. 7,
  7703. 10
  7704. ],
  7705. [
  7706. 7,
  7707. 10
  7708. ],
  7709. [
  7710. 7,
  7711. 10
  7712. ],
  7713. [
  7714. 7,
  7715. 10
  7716. ],
  7717. [
  7718. 7,
  7719. 10
  7720. ],
  7721. [
  7722. 7,
  7723. 10
  7724. ],
  7725. [
  7726. 7,
  7727. 10
  7728. ],
  7729. [
  7730. 7,
  7731. 10
  7732. ],
  7733. [
  7734. 7,
  7735. 10
  7736. ],
  7737. [
  7738. 7,
  7739. 10
  7740. ],
  7741. [
  7742. 7,
  7743. 10
  7744. ],
  7745. [
  7746. 7,
  7747. 10
  7748. ],
  7749. [
  7750. 7,
  7751. 10
  7752. ],
  7753. [
  7754. 7,
  7755. 10
  7756. ],
  7757. [
  7758. 7,
  7759. 10
  7760. ],
  7761. [
  7762. 7,
  7763. 10
  7764. ],
  7765. [
  7766. 7,
  7767. 10
  7768. ],
  7769. [
  7770. 7,
  7771. 10
  7772. ],
  7773. [
  7774. 7,
  7775. 10
  7776. ],
  7777. [
  7778. 7,
  7779. 10
  7780. ],
  7781. [
  7782. 7,
  7783. 10
  7784. ],
  7785. [
  7786. 7,
  7787. 10
  7788. ],
  7789. [
  7790. 7,
  7791. 10
  7792. ],
  7793. [
  7794. 7,
  7795. 11
  7796. ],
  7797. [
  7798. 7,
  7799. 11
  7800. ],
  7801. [
  7802. 7,
  7803. 11
  7804. ],
  7805. [
  7806. 7,
  7807. 11
  7808. ],
  7809. [
  7810. 7,
  7811. 11
  7812. ],
  7813. [
  7814. 7,
  7815. 11
  7816. ],
  7817. [
  7818. 7,
  7819. 11
  7820. ],
  7821. [
  7822. 7,
  7823. 11
  7824. ],
  7825. [
  7826. 7,
  7827. 11
  7828. ],
  7829. [
  7830. 7,
  7831. 11
  7832. ],
  7833. [
  7834. 7,
  7835. 11
  7836. ],
  7837. [
  7838. 7,
  7839. 11
  7840. ],
  7841. [
  7842. 7,
  7843. 11
  7844. ],
  7845. [
  7846. 7,
  7847. 11
  7848. ],
  7849. [
  7850. 7,
  7851. 11
  7852. ],
  7853. [
  7854. 7,
  7855. 11
  7856. ],
  7857. [
  7858. 7,
  7859. 11
  7860. ],
  7861. [
  7862. 7,
  7863. 11
  7864. ],
  7865. [
  7866. 7,
  7867. 11
  7868. ],
  7869. [
  7870. 7,
  7871. 11
  7872. ],
  7873. [
  7874. 7,
  7875. 11
  7876. ],
  7877. [
  7878. 7,
  7879. 11
  7880. ],
  7881. [
  7882. 7,
  7883. 11
  7884. ],
  7885. [
  7886. 7,
  7887. 11
  7888. ],
  7889. [
  7890. 7,
  7891. 11
  7892. ],
  7893. [
  7894. 7,
  7895. 11
  7896. ],
  7897. [
  7898. 7,
  7899. 11
  7900. ],
  7901. [
  7902. 7,
  7903. 11
  7904. ],
  7905. [
  7906. 7,
  7907. 11
  7908. ],
  7909. [
  7910. 7,
  7911. 11
  7912. ],
  7913. [
  7914. 7,
  7915. 11
  7916. ],
  7917. [
  7918. 7,
  7919. 11
  7920. ],
  7921. [
  7922. 9,
  7923. 15
  7924. ],
  7925. [
  7926. 9,
  7927. 15
  7928. ],
  7929. [
  7930. 9,
  7931. 15
  7932. ],
  7933. [
  7934. 9,
  7935. 15
  7936. ],
  7937. [
  7938. 9,
  7939. 15
  7940. ],
  7941. [
  7942. 9,
  7943. 15
  7944. ],
  7945. [
  7946. 9,
  7947. 15
  7948. ],
  7949. [
  7950. 9,
  7951. 15
  7952. ],
  7953. [
  7954. 12,
  7955. 128
  7956. ],
  7957. [
  7958. 12,
  7959. 192
  7960. ],
  7961. [
  7962. 12,
  7963. 26
  7964. ],
  7965. [
  7966. 12,
  7967. 27
  7968. ],
  7969. [
  7970. 12,
  7971. 28
  7972. ],
  7973. [
  7974. 12,
  7975. 29
  7976. ],
  7977. [
  7978. 11,
  7979. 19
  7980. ],
  7981. [
  7982. 11,
  7983. 19
  7984. ],
  7985. [
  7986. 11,
  7987. 20
  7988. ],
  7989. [
  7990. 11,
  7991. 20
  7992. ],
  7993. [
  7994. 12,
  7995. 34
  7996. ],
  7997. [
  7998. 12,
  7999. 35
  8000. ],
  8001. [
  8002. 12,
  8003. 36
  8004. ],
  8005. [
  8006. 12,
  8007. 37
  8008. ],
  8009. [
  8010. 12,
  8011. 38
  8012. ],
  8013. [
  8014. 12,
  8015. 39
  8016. ],
  8017. [
  8018. 11,
  8019. 21
  8020. ],
  8021. [
  8022. 11,
  8023. 21
  8024. ],
  8025. [
  8026. 12,
  8027. 42
  8028. ],
  8029. [
  8030. 12,
  8031. 43
  8032. ],
  8033. [
  8034. 10,
  8035. 0
  8036. ],
  8037. [
  8038. 10,
  8039. 0
  8040. ],
  8041. [
  8042. 10,
  8043. 0
  8044. ],
  8045. [
  8046. 10,
  8047. 0
  8048. ],
  8049. [
  8050. 7,
  8051. 12
  8052. ],
  8053. [
  8054. 7,
  8055. 12
  8056. ],
  8057. [
  8058. 7,
  8059. 12
  8060. ],
  8061. [
  8062. 7,
  8063. 12
  8064. ],
  8065. [
  8066. 7,
  8067. 12
  8068. ],
  8069. [
  8070. 7,
  8071. 12
  8072. ],
  8073. [
  8074. 7,
  8075. 12
  8076. ],
  8077. [
  8078. 7,
  8079. 12
  8080. ],
  8081. [
  8082. 7,
  8083. 12
  8084. ],
  8085. [
  8086. 7,
  8087. 12
  8088. ],
  8089. [
  8090. 7,
  8091. 12
  8092. ],
  8093. [
  8094. 7,
  8095. 12
  8096. ],
  8097. [
  8098. 7,
  8099. 12
  8100. ],
  8101. [
  8102. 7,
  8103. 12
  8104. ],
  8105. [
  8106. 7,
  8107. 12
  8108. ],
  8109. [
  8110. 7,
  8111. 12
  8112. ],
  8113. [
  8114. 7,
  8115. 12
  8116. ],
  8117. [
  8118. 7,
  8119. 12
  8120. ],
  8121. [
  8122. 7,
  8123. 12
  8124. ],
  8125. [
  8126. 7,
  8127. 12
  8128. ],
  8129. [
  8130. 7,
  8131. 12
  8132. ],
  8133. [
  8134. 7,
  8135. 12
  8136. ],
  8137. [
  8138. 7,
  8139. 12
  8140. ],
  8141. [
  8142. 7,
  8143. 12
  8144. ],
  8145. [
  8146. 7,
  8147. 12
  8148. ],
  8149. [
  8150. 7,
  8151. 12
  8152. ],
  8153. [
  8154. 7,
  8155. 12
  8156. ],
  8157. [
  8158. 7,
  8159. 12
  8160. ],
  8161. [
  8162. 7,
  8163. 12
  8164. ],
  8165. [
  8166. 7,
  8167. 12
  8168. ],
  8169. [
  8170. 7,
  8171. 12
  8172. ],
  8173. [
  8174. 7,
  8175. 12
  8176. ]
  8177. ];
  8178. var blackTable3 = [
  8179. [
  8180. -1,
  8181. -1
  8182. ],
  8183. [
  8184. -1,
  8185. -1
  8186. ],
  8187. [
  8188. -1,
  8189. -1
  8190. ],
  8191. [
  8192. -1,
  8193. -1
  8194. ],
  8195. [
  8196. 6,
  8197. 9
  8198. ],
  8199. [
  8200. 6,
  8201. 8
  8202. ],
  8203. [
  8204. 5,
  8205. 7
  8206. ],
  8207. [
  8208. 5,
  8209. 7
  8210. ],
  8211. [
  8212. 4,
  8213. 6
  8214. ],
  8215. [
  8216. 4,
  8217. 6
  8218. ],
  8219. [
  8220. 4,
  8221. 6
  8222. ],
  8223. [
  8224. 4,
  8225. 6
  8226. ],
  8227. [
  8228. 4,
  8229. 5
  8230. ],
  8231. [
  8232. 4,
  8233. 5
  8234. ],
  8235. [
  8236. 4,
  8237. 5
  8238. ],
  8239. [
  8240. 4,
  8241. 5
  8242. ],
  8243. [
  8244. 3,
  8245. 1
  8246. ],
  8247. [
  8248. 3,
  8249. 1
  8250. ],
  8251. [
  8252. 3,
  8253. 1
  8254. ],
  8255. [
  8256. 3,
  8257. 1
  8258. ],
  8259. [
  8260. 3,
  8261. 1
  8262. ],
  8263. [
  8264. 3,
  8265. 1
  8266. ],
  8267. [
  8268. 3,
  8269. 1
  8270. ],
  8271. [
  8272. 3,
  8273. 1
  8274. ],
  8275. [
  8276. 3,
  8277. 4
  8278. ],
  8279. [
  8280. 3,
  8281. 4
  8282. ],
  8283. [
  8284. 3,
  8285. 4
  8286. ],
  8287. [
  8288. 3,
  8289. 4
  8290. ],
  8291. [
  8292. 3,
  8293. 4
  8294. ],
  8295. [
  8296. 3,
  8297. 4
  8298. ],
  8299. [
  8300. 3,
  8301. 4
  8302. ],
  8303. [
  8304. 3,
  8305. 4
  8306. ],
  8307. [
  8308. 2,
  8309. 3
  8310. ],
  8311. [
  8312. 2,
  8313. 3
  8314. ],
  8315. [
  8316. 2,
  8317. 3
  8318. ],
  8319. [
  8320. 2,
  8321. 3
  8322. ],
  8323. [
  8324. 2,
  8325. 3
  8326. ],
  8327. [
  8328. 2,
  8329. 3
  8330. ],
  8331. [
  8332. 2,
  8333. 3
  8334. ],
  8335. [
  8336. 2,
  8337. 3
  8338. ],
  8339. [
  8340. 2,
  8341. 3
  8342. ],
  8343. [
  8344. 2,
  8345. 3
  8346. ],
  8347. [
  8348. 2,
  8349. 3
  8350. ],
  8351. [
  8352. 2,
  8353. 3
  8354. ],
  8355. [
  8356. 2,
  8357. 3
  8358. ],
  8359. [
  8360. 2,
  8361. 3
  8362. ],
  8363. [
  8364. 2,
  8365. 3
  8366. ],
  8367. [
  8368. 2,
  8369. 3
  8370. ],
  8371. [
  8372. 2,
  8373. 2
  8374. ],
  8375. [
  8376. 2,
  8377. 2
  8378. ],
  8379. [
  8380. 2,
  8381. 2
  8382. ],
  8383. [
  8384. 2,
  8385. 2
  8386. ],
  8387. [
  8388. 2,
  8389. 2
  8390. ],
  8391. [
  8392. 2,
  8393. 2
  8394. ],
  8395. [
  8396. 2,
  8397. 2
  8398. ],
  8399. [
  8400. 2,
  8401. 2
  8402. ],
  8403. [
  8404. 2,
  8405. 2
  8406. ],
  8407. [
  8408. 2,
  8409. 2
  8410. ],
  8411. [
  8412. 2,
  8413. 2
  8414. ],
  8415. [
  8416. 2,
  8417. 2
  8418. ],
  8419. [
  8420. 2,
  8421. 2
  8422. ],
  8423. [
  8424. 2,
  8425. 2
  8426. ],
  8427. [
  8428. 2,
  8429. 2
  8430. ],
  8431. [
  8432. 2,
  8433. 2
  8434. ]
  8435. ];
  8436. function CCITTFaxStream(str, maybeLength, params) {
  8437. this.str = str;
  8438. this.dict = str.dict;
  8439. params = params || Dict.empty;
  8440. this.encoding = params.get('K') || 0;
  8441. this.eoline = params.get('EndOfLine') || false;
  8442. this.byteAlign = params.get('EncodedByteAlign') || false;
  8443. this.columns = params.get('Columns') || 1728;
  8444. this.rows = params.get('Rows') || 0;
  8445. var eoblock = params.get('EndOfBlock');
  8446. if (eoblock === null || eoblock === undefined) {
  8447. eoblock = true;
  8448. }
  8449. this.eoblock = eoblock;
  8450. this.black = params.get('BlackIs1') || false;
  8451. this.codingLine = new Uint32Array(this.columns + 1);
  8452. this.refLine = new Uint32Array(this.columns + 2);
  8453. this.codingLine[0] = this.columns;
  8454. this.codingPos = 0;
  8455. this.row = 0;
  8456. this.nextLine2D = this.encoding < 0;
  8457. this.inputBits = 0;
  8458. this.inputBuf = 0;
  8459. this.outputBits = 0;
  8460. var code1;
  8461. while ((code1 = this.lookBits(12)) === 0) {
  8462. this.eatBits(1);
  8463. }
  8464. if (code1 === 1) {
  8465. this.eatBits(12);
  8466. }
  8467. if (this.encoding > 0) {
  8468. this.nextLine2D = !this.lookBits(1);
  8469. this.eatBits(1);
  8470. }
  8471. DecodeStream.call(this, maybeLength);
  8472. }
  8473. CCITTFaxStream.prototype = Object.create(DecodeStream.prototype);
  8474. CCITTFaxStream.prototype.readBlock = function CCITTFaxStream_readBlock() {
  8475. while (!this.eof) {
  8476. var c = this.lookChar();
  8477. this.ensureBuffer(this.bufferLength + 1);
  8478. this.buffer[this.bufferLength++] = c;
  8479. }
  8480. };
  8481. CCITTFaxStream.prototype.addPixels = function ccittFaxStreamAddPixels(a1, blackPixels) {
  8482. var codingLine = this.codingLine;
  8483. var codingPos = this.codingPos;
  8484. if (a1 > codingLine[codingPos]) {
  8485. if (a1 > this.columns) {
  8486. info('row is wrong length');
  8487. this.err = true;
  8488. a1 = this.columns;
  8489. }
  8490. if (codingPos & 1 ^ blackPixels) {
  8491. ++codingPos;
  8492. }
  8493. codingLine[codingPos] = a1;
  8494. }
  8495. this.codingPos = codingPos;
  8496. };
  8497. CCITTFaxStream.prototype.addPixelsNeg = function ccittFaxStreamAddPixelsNeg(a1, blackPixels) {
  8498. var codingLine = this.codingLine;
  8499. var codingPos = this.codingPos;
  8500. if (a1 > codingLine[codingPos]) {
  8501. if (a1 > this.columns) {
  8502. info('row is wrong length');
  8503. this.err = true;
  8504. a1 = this.columns;
  8505. }
  8506. if (codingPos & 1 ^ blackPixels) {
  8507. ++codingPos;
  8508. }
  8509. codingLine[codingPos] = a1;
  8510. } else if (a1 < codingLine[codingPos]) {
  8511. if (a1 < 0) {
  8512. info('invalid code');
  8513. this.err = true;
  8514. a1 = 0;
  8515. }
  8516. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  8517. --codingPos;
  8518. }
  8519. codingLine[codingPos] = a1;
  8520. }
  8521. this.codingPos = codingPos;
  8522. };
  8523. CCITTFaxStream.prototype.lookChar = function CCITTFaxStream_lookChar() {
  8524. var refLine = this.refLine;
  8525. var codingLine = this.codingLine;
  8526. var columns = this.columns;
  8527. var refPos, blackPixels, bits, i;
  8528. if (this.outputBits === 0) {
  8529. if (this.eof) {
  8530. return null;
  8531. }
  8532. this.err = false;
  8533. var code1, code2, code3;
  8534. if (this.nextLine2D) {
  8535. for (i = 0; codingLine[i] < columns; ++i) {
  8536. refLine[i] = codingLine[i];
  8537. }
  8538. refLine[i++] = columns;
  8539. refLine[i] = columns;
  8540. codingLine[0] = 0;
  8541. this.codingPos = 0;
  8542. refPos = 0;
  8543. blackPixels = 0;
  8544. while (codingLine[this.codingPos] < columns) {
  8545. code1 = this.getTwoDimCode();
  8546. switch (code1) {
  8547. case twoDimPass:
  8548. this.addPixels(refLine[refPos + 1], blackPixels);
  8549. if (refLine[refPos + 1] < columns) {
  8550. refPos += 2;
  8551. }
  8552. break;
  8553. case twoDimHoriz:
  8554. code1 = code2 = 0;
  8555. if (blackPixels) {
  8556. do {
  8557. code1 += code3 = this.getBlackCode();
  8558. } while (code3 >= 64);
  8559. do {
  8560. code2 += code3 = this.getWhiteCode();
  8561. } while (code3 >= 64);
  8562. } else {
  8563. do {
  8564. code1 += code3 = this.getWhiteCode();
  8565. } while (code3 >= 64);
  8566. do {
  8567. code2 += code3 = this.getBlackCode();
  8568. } while (code3 >= 64);
  8569. }
  8570. this.addPixels(codingLine[this.codingPos] + code1, blackPixels);
  8571. if (codingLine[this.codingPos] < columns) {
  8572. this.addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  8573. }
  8574. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8575. refPos += 2;
  8576. }
  8577. break;
  8578. case twoDimVertR3:
  8579. this.addPixels(refLine[refPos] + 3, blackPixels);
  8580. blackPixels ^= 1;
  8581. if (codingLine[this.codingPos] < columns) {
  8582. ++refPos;
  8583. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8584. refPos += 2;
  8585. }
  8586. }
  8587. break;
  8588. case twoDimVertR2:
  8589. this.addPixels(refLine[refPos] + 2, blackPixels);
  8590. blackPixels ^= 1;
  8591. if (codingLine[this.codingPos] < columns) {
  8592. ++refPos;
  8593. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8594. refPos += 2;
  8595. }
  8596. }
  8597. break;
  8598. case twoDimVertR1:
  8599. this.addPixels(refLine[refPos] + 1, blackPixels);
  8600. blackPixels ^= 1;
  8601. if (codingLine[this.codingPos] < columns) {
  8602. ++refPos;
  8603. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8604. refPos += 2;
  8605. }
  8606. }
  8607. break;
  8608. case twoDimVert0:
  8609. this.addPixels(refLine[refPos], blackPixels);
  8610. blackPixels ^= 1;
  8611. if (codingLine[this.codingPos] < columns) {
  8612. ++refPos;
  8613. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8614. refPos += 2;
  8615. }
  8616. }
  8617. break;
  8618. case twoDimVertL3:
  8619. this.addPixelsNeg(refLine[refPos] - 3, blackPixels);
  8620. blackPixels ^= 1;
  8621. if (codingLine[this.codingPos] < columns) {
  8622. if (refPos > 0) {
  8623. --refPos;
  8624. } else {
  8625. ++refPos;
  8626. }
  8627. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8628. refPos += 2;
  8629. }
  8630. }
  8631. break;
  8632. case twoDimVertL2:
  8633. this.addPixelsNeg(refLine[refPos] - 2, blackPixels);
  8634. blackPixels ^= 1;
  8635. if (codingLine[this.codingPos] < columns) {
  8636. if (refPos > 0) {
  8637. --refPos;
  8638. } else {
  8639. ++refPos;
  8640. }
  8641. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8642. refPos += 2;
  8643. }
  8644. }
  8645. break;
  8646. case twoDimVertL1:
  8647. this.addPixelsNeg(refLine[refPos] - 1, blackPixels);
  8648. blackPixels ^= 1;
  8649. if (codingLine[this.codingPos] < columns) {
  8650. if (refPos > 0) {
  8651. --refPos;
  8652. } else {
  8653. ++refPos;
  8654. }
  8655. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  8656. refPos += 2;
  8657. }
  8658. }
  8659. break;
  8660. case ccittEOF:
  8661. this.addPixels(columns, 0);
  8662. this.eof = true;
  8663. break;
  8664. default:
  8665. info('bad 2d code');
  8666. this.addPixels(columns, 0);
  8667. this.err = true;
  8668. }
  8669. }
  8670. } else {
  8671. codingLine[0] = 0;
  8672. this.codingPos = 0;
  8673. blackPixels = 0;
  8674. while (codingLine[this.codingPos] < columns) {
  8675. code1 = 0;
  8676. if (blackPixels) {
  8677. do {
  8678. code1 += code3 = this.getBlackCode();
  8679. } while (code3 >= 64);
  8680. } else {
  8681. do {
  8682. code1 += code3 = this.getWhiteCode();
  8683. } while (code3 >= 64);
  8684. }
  8685. this.addPixels(codingLine[this.codingPos] + code1, blackPixels);
  8686. blackPixels ^= 1;
  8687. }
  8688. }
  8689. var gotEOL = false;
  8690. if (this.byteAlign) {
  8691. this.inputBits &= ~7;
  8692. }
  8693. if (!this.eoblock && this.row === this.rows - 1) {
  8694. this.eof = true;
  8695. } else {
  8696. code1 = this.lookBits(12);
  8697. if (this.eoline) {
  8698. while (code1 !== ccittEOF && code1 !== 1) {
  8699. this.eatBits(1);
  8700. code1 = this.lookBits(12);
  8701. }
  8702. } else {
  8703. while (code1 === 0) {
  8704. this.eatBits(1);
  8705. code1 = this.lookBits(12);
  8706. }
  8707. }
  8708. if (code1 === 1) {
  8709. this.eatBits(12);
  8710. gotEOL = true;
  8711. } else if (code1 === ccittEOF) {
  8712. this.eof = true;
  8713. }
  8714. }
  8715. if (!this.eof && this.encoding > 0) {
  8716. this.nextLine2D = !this.lookBits(1);
  8717. this.eatBits(1);
  8718. }
  8719. if (this.eoblock && gotEOL && this.byteAlign) {
  8720. code1 = this.lookBits(12);
  8721. if (code1 === 1) {
  8722. this.eatBits(12);
  8723. if (this.encoding > 0) {
  8724. this.lookBits(1);
  8725. this.eatBits(1);
  8726. }
  8727. if (this.encoding >= 0) {
  8728. for (i = 0; i < 4; ++i) {
  8729. code1 = this.lookBits(12);
  8730. if (code1 !== 1) {
  8731. info('bad rtc code: ' + code1);
  8732. }
  8733. this.eatBits(12);
  8734. if (this.encoding > 0) {
  8735. this.lookBits(1);
  8736. this.eatBits(1);
  8737. }
  8738. }
  8739. }
  8740. this.eof = true;
  8741. }
  8742. } else if (this.err && this.eoline) {
  8743. while (true) {
  8744. code1 = this.lookBits(13);
  8745. if (code1 === ccittEOF) {
  8746. this.eof = true;
  8747. return null;
  8748. }
  8749. if (code1 >> 1 === 1) {
  8750. break;
  8751. }
  8752. this.eatBits(1);
  8753. }
  8754. this.eatBits(12);
  8755. if (this.encoding > 0) {
  8756. this.eatBits(1);
  8757. this.nextLine2D = !(code1 & 1);
  8758. }
  8759. }
  8760. if (codingLine[0] > 0) {
  8761. this.outputBits = codingLine[this.codingPos = 0];
  8762. } else {
  8763. this.outputBits = codingLine[this.codingPos = 1];
  8764. }
  8765. this.row++;
  8766. }
  8767. var c;
  8768. if (this.outputBits >= 8) {
  8769. c = this.codingPos & 1 ? 0 : 0xFF;
  8770. this.outputBits -= 8;
  8771. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  8772. this.codingPos++;
  8773. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  8774. }
  8775. } else {
  8776. bits = 8;
  8777. c = 0;
  8778. do {
  8779. if (this.outputBits > bits) {
  8780. c <<= bits;
  8781. if (!(this.codingPos & 1)) {
  8782. c |= 0xFF >> 8 - bits;
  8783. }
  8784. this.outputBits -= bits;
  8785. bits = 0;
  8786. } else {
  8787. c <<= this.outputBits;
  8788. if (!(this.codingPos & 1)) {
  8789. c |= 0xFF >> 8 - this.outputBits;
  8790. }
  8791. bits -= this.outputBits;
  8792. this.outputBits = 0;
  8793. if (codingLine[this.codingPos] < columns) {
  8794. this.codingPos++;
  8795. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  8796. } else if (bits > 0) {
  8797. c <<= bits;
  8798. bits = 0;
  8799. }
  8800. }
  8801. } while (bits);
  8802. }
  8803. if (this.black) {
  8804. c ^= 0xFF;
  8805. }
  8806. return c;
  8807. };
  8808. CCITTFaxStream.prototype.findTableCode = function ccittFaxStreamFindTableCode(start, end, table, limit) {
  8809. var limitValue = limit || 0;
  8810. for (var i = start; i <= end; ++i) {
  8811. var code = this.lookBits(i);
  8812. if (code === ccittEOF) {
  8813. return [
  8814. true,
  8815. 1,
  8816. false
  8817. ];
  8818. }
  8819. if (i < end) {
  8820. code <<= end - i;
  8821. }
  8822. if (!limitValue || code >= limitValue) {
  8823. var p = table[code - limitValue];
  8824. if (p[0] === i) {
  8825. this.eatBits(i);
  8826. return [
  8827. true,
  8828. p[1],
  8829. true
  8830. ];
  8831. }
  8832. }
  8833. }
  8834. return [
  8835. false,
  8836. 0,
  8837. false
  8838. ];
  8839. };
  8840. CCITTFaxStream.prototype.getTwoDimCode = function ccittFaxStreamGetTwoDimCode() {
  8841. var code = 0;
  8842. var p;
  8843. if (this.eoblock) {
  8844. code = this.lookBits(7);
  8845. p = twoDimTable[code];
  8846. if (p && p[0] > 0) {
  8847. this.eatBits(p[0]);
  8848. return p[1];
  8849. }
  8850. } else {
  8851. var result = this.findTableCode(1, 7, twoDimTable);
  8852. if (result[0] && result[2]) {
  8853. return result[1];
  8854. }
  8855. }
  8856. info('Bad two dim code');
  8857. return ccittEOF;
  8858. };
  8859. CCITTFaxStream.prototype.getWhiteCode = function ccittFaxStreamGetWhiteCode() {
  8860. var code = 0;
  8861. var p;
  8862. if (this.eoblock) {
  8863. code = this.lookBits(12);
  8864. if (code === ccittEOF) {
  8865. return 1;
  8866. }
  8867. if (code >> 5 === 0) {
  8868. p = whiteTable1[code];
  8869. } else {
  8870. p = whiteTable2[code >> 3];
  8871. }
  8872. if (p[0] > 0) {
  8873. this.eatBits(p[0]);
  8874. return p[1];
  8875. }
  8876. } else {
  8877. var result = this.findTableCode(1, 9, whiteTable2);
  8878. if (result[0]) {
  8879. return result[1];
  8880. }
  8881. result = this.findTableCode(11, 12, whiteTable1);
  8882. if (result[0]) {
  8883. return result[1];
  8884. }
  8885. }
  8886. info('bad white code');
  8887. this.eatBits(1);
  8888. return 1;
  8889. };
  8890. CCITTFaxStream.prototype.getBlackCode = function ccittFaxStreamGetBlackCode() {
  8891. var code, p;
  8892. if (this.eoblock) {
  8893. code = this.lookBits(13);
  8894. if (code === ccittEOF) {
  8895. return 1;
  8896. }
  8897. if (code >> 7 === 0) {
  8898. p = blackTable1[code];
  8899. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  8900. p = blackTable2[(code >> 1) - 64];
  8901. } else {
  8902. p = blackTable3[code >> 7];
  8903. }
  8904. if (p[0] > 0) {
  8905. this.eatBits(p[0]);
  8906. return p[1];
  8907. }
  8908. } else {
  8909. var result = this.findTableCode(2, 6, blackTable3);
  8910. if (result[0]) {
  8911. return result[1];
  8912. }
  8913. result = this.findTableCode(7, 12, blackTable2, 64);
  8914. if (result[0]) {
  8915. return result[1];
  8916. }
  8917. result = this.findTableCode(10, 13, blackTable1);
  8918. if (result[0]) {
  8919. return result[1];
  8920. }
  8921. }
  8922. info('bad black code');
  8923. this.eatBits(1);
  8924. return 1;
  8925. };
  8926. CCITTFaxStream.prototype.lookBits = function CCITTFaxStream_lookBits(n) {
  8927. var c;
  8928. while (this.inputBits < n) {
  8929. if ((c = this.str.getByte()) === -1) {
  8930. if (this.inputBits === 0) {
  8931. return ccittEOF;
  8932. }
  8933. return this.inputBuf << n - this.inputBits & 0xFFFF >> 16 - n;
  8934. }
  8935. this.inputBuf = this.inputBuf << 8 | c;
  8936. this.inputBits += 8;
  8937. }
  8938. return this.inputBuf >> this.inputBits - n & 0xFFFF >> 16 - n;
  8939. };
  8940. CCITTFaxStream.prototype.eatBits = function CCITTFaxStream_eatBits(n) {
  8941. if ((this.inputBits -= n) < 0) {
  8942. this.inputBits = 0;
  8943. }
  8944. };
  8945. return CCITTFaxStream;
  8946. }();
  8947. var LZWStream = function LZWStreamClosure() {
  8948. function LZWStream(str, maybeLength, earlyChange) {
  8949. this.str = str;
  8950. this.dict = str.dict;
  8951. this.cachedData = 0;
  8952. this.bitsCached = 0;
  8953. var maxLzwDictionarySize = 4096;
  8954. var lzwState = {
  8955. earlyChange: earlyChange,
  8956. codeLength: 9,
  8957. nextCode: 258,
  8958. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  8959. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  8960. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  8961. currentSequence: new Uint8Array(maxLzwDictionarySize),
  8962. currentSequenceLength: 0
  8963. };
  8964. for (var i = 0; i < 256; ++i) {
  8965. lzwState.dictionaryValues[i] = i;
  8966. lzwState.dictionaryLengths[i] = 1;
  8967. }
  8968. this.lzwState = lzwState;
  8969. DecodeStream.call(this, maybeLength);
  8970. }
  8971. LZWStream.prototype = Object.create(DecodeStream.prototype);
  8972. LZWStream.prototype.readBits = function LZWStream_readBits(n) {
  8973. var bitsCached = this.bitsCached;
  8974. var cachedData = this.cachedData;
  8975. while (bitsCached < n) {
  8976. var c = this.str.getByte();
  8977. if (c === -1) {
  8978. this.eof = true;
  8979. return null;
  8980. }
  8981. cachedData = cachedData << 8 | c;
  8982. bitsCached += 8;
  8983. }
  8984. this.bitsCached = bitsCached -= n;
  8985. this.cachedData = cachedData;
  8986. this.lastCode = null;
  8987. return cachedData >>> bitsCached & (1 << n) - 1;
  8988. };
  8989. LZWStream.prototype.readBlock = function LZWStream_readBlock() {
  8990. var blockSize = 512;
  8991. var estimatedDecodedSize = blockSize * 2, decodedSizeDelta = blockSize;
  8992. var i, j, q;
  8993. var lzwState = this.lzwState;
  8994. if (!lzwState) {
  8995. return;
  8996. }
  8997. var earlyChange = lzwState.earlyChange;
  8998. var nextCode = lzwState.nextCode;
  8999. var dictionaryValues = lzwState.dictionaryValues;
  9000. var dictionaryLengths = lzwState.dictionaryLengths;
  9001. var dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  9002. var codeLength = lzwState.codeLength;
  9003. var prevCode = lzwState.prevCode;
  9004. var currentSequence = lzwState.currentSequence;
  9005. var currentSequenceLength = lzwState.currentSequenceLength;
  9006. var decodedLength = 0;
  9007. var currentBufferLength = this.bufferLength;
  9008. var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  9009. for (i = 0; i < blockSize; i++) {
  9010. var code = this.readBits(codeLength);
  9011. var hasPrev = currentSequenceLength > 0;
  9012. if (code < 256) {
  9013. currentSequence[0] = code;
  9014. currentSequenceLength = 1;
  9015. } else if (code >= 258) {
  9016. if (code < nextCode) {
  9017. currentSequenceLength = dictionaryLengths[code];
  9018. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  9019. currentSequence[j] = dictionaryValues[q];
  9020. q = dictionaryPrevCodes[q];
  9021. }
  9022. } else {
  9023. currentSequence[currentSequenceLength++] = currentSequence[0];
  9024. }
  9025. } else if (code === 256) {
  9026. codeLength = 9;
  9027. nextCode = 258;
  9028. currentSequenceLength = 0;
  9029. continue;
  9030. } else {
  9031. this.eof = true;
  9032. delete this.lzwState;
  9033. break;
  9034. }
  9035. if (hasPrev) {
  9036. dictionaryPrevCodes[nextCode] = prevCode;
  9037. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  9038. dictionaryValues[nextCode] = currentSequence[0];
  9039. nextCode++;
  9040. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  9041. }
  9042. prevCode = code;
  9043. decodedLength += currentSequenceLength;
  9044. if (estimatedDecodedSize < decodedLength) {
  9045. do {
  9046. estimatedDecodedSize += decodedSizeDelta;
  9047. } while (estimatedDecodedSize < decodedLength);
  9048. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  9049. }
  9050. for (j = 0; j < currentSequenceLength; j++) {
  9051. buffer[currentBufferLength++] = currentSequence[j];
  9052. }
  9053. }
  9054. lzwState.nextCode = nextCode;
  9055. lzwState.codeLength = codeLength;
  9056. lzwState.prevCode = prevCode;
  9057. lzwState.currentSequenceLength = currentSequenceLength;
  9058. this.bufferLength = currentBufferLength;
  9059. };
  9060. return LZWStream;
  9061. }();
  9062. var NullStream = function NullStreamClosure() {
  9063. function NullStream() {
  9064. Stream.call(this, new Uint8Array(0));
  9065. }
  9066. NullStream.prototype = Stream.prototype;
  9067. return NullStream;
  9068. }();
  9069. exports.Ascii85Stream = Ascii85Stream;
  9070. exports.AsciiHexStream = AsciiHexStream;
  9071. exports.CCITTFaxStream = CCITTFaxStream;
  9072. exports.DecryptStream = DecryptStream;
  9073. exports.DecodeStream = DecodeStream;
  9074. exports.FlateStream = FlateStream;
  9075. exports.Jbig2Stream = Jbig2Stream;
  9076. exports.JpegStream = JpegStream;
  9077. exports.JpxStream = JpxStream;
  9078. exports.NullStream = NullStream;
  9079. exports.PredictorStream = PredictorStream;
  9080. exports.RunLengthStream = RunLengthStream;
  9081. exports.Stream = Stream;
  9082. exports.StreamsSequenceStream = StreamsSequenceStream;
  9083. exports.StringStream = StringStream;
  9084. exports.LZWStream = LZWStream;
  9085. /***/ }),
  9086. /* 3 */
  9087. /***/ (function(module, exports, __w_pdfjs_require__) {
  9088. "use strict";
  9089. var sharedUtil = __w_pdfjs_require__(0);
  9090. var corePrimitives = __w_pdfjs_require__(1);
  9091. var coreFunction = __w_pdfjs_require__(6);
  9092. var error = sharedUtil.error;
  9093. var info = sharedUtil.info;
  9094. var isArray = sharedUtil.isArray;
  9095. var isString = sharedUtil.isString;
  9096. var shadow = sharedUtil.shadow;
  9097. var warn = sharedUtil.warn;
  9098. var isDict = corePrimitives.isDict;
  9099. var isName = corePrimitives.isName;
  9100. var isStream = corePrimitives.isStream;
  9101. var PDFFunction = coreFunction.PDFFunction;
  9102. var ColorSpace = function ColorSpaceClosure() {
  9103. function resizeRgbImage(src, bpc, w1, h1, w2, h2, alpha01, dest) {
  9104. var COMPONENTS = 3;
  9105. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  9106. var xRatio = w1 / w2;
  9107. var yRatio = h1 / h2;
  9108. var i, j, py, newIndex = 0, oldIndex;
  9109. var xScaled = new Uint16Array(w2);
  9110. var w1Scanline = w1 * COMPONENTS;
  9111. for (i = 0; i < w2; i++) {
  9112. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  9113. }
  9114. for (i = 0; i < h2; i++) {
  9115. py = Math.floor(i * yRatio) * w1Scanline;
  9116. for (j = 0; j < w2; j++) {
  9117. oldIndex = py + xScaled[j];
  9118. dest[newIndex++] = src[oldIndex++];
  9119. dest[newIndex++] = src[oldIndex++];
  9120. dest[newIndex++] = src[oldIndex++];
  9121. newIndex += alpha01;
  9122. }
  9123. }
  9124. }
  9125. function ColorSpace() {
  9126. error('should not call ColorSpace constructor');
  9127. }
  9128. ColorSpace.prototype = {
  9129. getRgb: function ColorSpace_getRgb(src, srcOffset) {
  9130. var rgb = new Uint8Array(3);
  9131. this.getRgbItem(src, srcOffset, rgb, 0);
  9132. return rgb;
  9133. },
  9134. getRgbItem: function ColorSpace_getRgbItem(src, srcOffset, dest, destOffset) {
  9135. error('Should not call ColorSpace.getRgbItem');
  9136. },
  9137. getRgbBuffer: function ColorSpace_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9138. error('Should not call ColorSpace.getRgbBuffer');
  9139. },
  9140. getOutputLength: function ColorSpace_getOutputLength(inputLength, alpha01) {
  9141. error('Should not call ColorSpace.getOutputLength');
  9142. },
  9143. isPassthrough: function ColorSpace_isPassthrough(bits) {
  9144. return false;
  9145. },
  9146. fillRgb: function ColorSpace_fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  9147. var count = originalWidth * originalHeight;
  9148. var rgbBuf = null;
  9149. var numComponentColors = 1 << bpc;
  9150. var needsResizing = originalHeight !== height || originalWidth !== width;
  9151. var i, ii;
  9152. if (this.isPassthrough(bpc)) {
  9153. rgbBuf = comps;
  9154. } else if (this.numComps === 1 && count > numComponentColors && this.name !== 'DeviceGray' && this.name !== 'DeviceRGB') {
  9155. var allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  9156. var key;
  9157. for (i = 0; i < numComponentColors; i++) {
  9158. allColors[i] = i;
  9159. }
  9160. var colorMap = new Uint8Array(numComponentColors * 3);
  9161. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  9162. var destPos, rgbPos;
  9163. if (!needsResizing) {
  9164. destPos = 0;
  9165. for (i = 0; i < count; ++i) {
  9166. key = comps[i] * 3;
  9167. dest[destPos++] = colorMap[key];
  9168. dest[destPos++] = colorMap[key + 1];
  9169. dest[destPos++] = colorMap[key + 2];
  9170. destPos += alpha01;
  9171. }
  9172. } else {
  9173. rgbBuf = new Uint8Array(count * 3);
  9174. rgbPos = 0;
  9175. for (i = 0; i < count; ++i) {
  9176. key = comps[i] * 3;
  9177. rgbBuf[rgbPos++] = colorMap[key];
  9178. rgbBuf[rgbPos++] = colorMap[key + 1];
  9179. rgbBuf[rgbPos++] = colorMap[key + 2];
  9180. }
  9181. }
  9182. } else {
  9183. if (!needsResizing) {
  9184. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  9185. } else {
  9186. rgbBuf = new Uint8Array(count * 3);
  9187. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  9188. }
  9189. }
  9190. if (rgbBuf) {
  9191. if (needsResizing) {
  9192. resizeRgbImage(rgbBuf, bpc, originalWidth, originalHeight, width, height, alpha01, dest);
  9193. } else {
  9194. rgbPos = 0;
  9195. destPos = 0;
  9196. for (i = 0, ii = width * actualHeight; i < ii; i++) {
  9197. dest[destPos++] = rgbBuf[rgbPos++];
  9198. dest[destPos++] = rgbBuf[rgbPos++];
  9199. dest[destPos++] = rgbBuf[rgbPos++];
  9200. destPos += alpha01;
  9201. }
  9202. }
  9203. }
  9204. },
  9205. usesZeroToOneRange: true
  9206. };
  9207. ColorSpace.parse = function ColorSpace_parse(cs, xref, res) {
  9208. var IR = ColorSpace.parseToIR(cs, xref, res);
  9209. if (IR instanceof AlternateCS) {
  9210. return IR;
  9211. }
  9212. return ColorSpace.fromIR(IR);
  9213. };
  9214. ColorSpace.fromIR = function ColorSpace_fromIR(IR) {
  9215. var name = isArray(IR) ? IR[0] : IR;
  9216. var whitePoint, blackPoint, gamma;
  9217. switch (name) {
  9218. case 'DeviceGrayCS':
  9219. return this.singletons.gray;
  9220. case 'DeviceRgbCS':
  9221. return this.singletons.rgb;
  9222. case 'DeviceCmykCS':
  9223. return this.singletons.cmyk;
  9224. case 'CalGrayCS':
  9225. whitePoint = IR[1];
  9226. blackPoint = IR[2];
  9227. gamma = IR[3];
  9228. return new CalGrayCS(whitePoint, blackPoint, gamma);
  9229. case 'CalRGBCS':
  9230. whitePoint = IR[1];
  9231. blackPoint = IR[2];
  9232. gamma = IR[3];
  9233. var matrix = IR[4];
  9234. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  9235. case 'PatternCS':
  9236. var basePatternCS = IR[1];
  9237. if (basePatternCS) {
  9238. basePatternCS = ColorSpace.fromIR(basePatternCS);
  9239. }
  9240. return new PatternCS(basePatternCS);
  9241. case 'IndexedCS':
  9242. var baseIndexedCS = IR[1];
  9243. var hiVal = IR[2];
  9244. var lookup = IR[3];
  9245. return new IndexedCS(ColorSpace.fromIR(baseIndexedCS), hiVal, lookup);
  9246. case 'AlternateCS':
  9247. var numComps = IR[1];
  9248. var alt = IR[2];
  9249. var tintFnIR = IR[3];
  9250. return new AlternateCS(numComps, ColorSpace.fromIR(alt), PDFFunction.fromIR(tintFnIR));
  9251. case 'LabCS':
  9252. whitePoint = IR[1];
  9253. blackPoint = IR[2];
  9254. var range = IR[3];
  9255. return new LabCS(whitePoint, blackPoint, range);
  9256. default:
  9257. error('Unknown name ' + name);
  9258. }
  9259. return null;
  9260. };
  9261. ColorSpace.parseToIR = function ColorSpace_parseToIR(cs, xref, res) {
  9262. if (isName(cs)) {
  9263. var colorSpaces = res.get('ColorSpace');
  9264. if (isDict(colorSpaces)) {
  9265. var refcs = colorSpaces.get(cs.name);
  9266. if (refcs) {
  9267. cs = refcs;
  9268. }
  9269. }
  9270. }
  9271. cs = xref.fetchIfRef(cs);
  9272. if (isName(cs)) {
  9273. switch (cs.name) {
  9274. case 'DeviceGray':
  9275. case 'G':
  9276. return 'DeviceGrayCS';
  9277. case 'DeviceRGB':
  9278. case 'RGB':
  9279. return 'DeviceRgbCS';
  9280. case 'DeviceCMYK':
  9281. case 'CMYK':
  9282. return 'DeviceCmykCS';
  9283. case 'Pattern':
  9284. return [
  9285. 'PatternCS',
  9286. null
  9287. ];
  9288. default:
  9289. error('unrecognized colorspace ' + cs.name);
  9290. }
  9291. } else if (isArray(cs)) {
  9292. var mode = xref.fetchIfRef(cs[0]).name;
  9293. var numComps, params, alt, whitePoint, blackPoint, gamma;
  9294. switch (mode) {
  9295. case 'DeviceGray':
  9296. case 'G':
  9297. return 'DeviceGrayCS';
  9298. case 'DeviceRGB':
  9299. case 'RGB':
  9300. return 'DeviceRgbCS';
  9301. case 'DeviceCMYK':
  9302. case 'CMYK':
  9303. return 'DeviceCmykCS';
  9304. case 'CalGray':
  9305. params = xref.fetchIfRef(cs[1]);
  9306. whitePoint = params.getArray('WhitePoint');
  9307. blackPoint = params.getArray('BlackPoint');
  9308. gamma = params.get('Gamma');
  9309. return [
  9310. 'CalGrayCS',
  9311. whitePoint,
  9312. blackPoint,
  9313. gamma
  9314. ];
  9315. case 'CalRGB':
  9316. params = xref.fetchIfRef(cs[1]);
  9317. whitePoint = params.getArray('WhitePoint');
  9318. blackPoint = params.getArray('BlackPoint');
  9319. gamma = params.getArray('Gamma');
  9320. var matrix = params.getArray('Matrix');
  9321. return [
  9322. 'CalRGBCS',
  9323. whitePoint,
  9324. blackPoint,
  9325. gamma,
  9326. matrix
  9327. ];
  9328. case 'ICCBased':
  9329. var stream = xref.fetchIfRef(cs[1]);
  9330. var dict = stream.dict;
  9331. numComps = dict.get('N');
  9332. alt = dict.get('Alternate');
  9333. if (alt) {
  9334. var altIR = ColorSpace.parseToIR(alt, xref, res);
  9335. var altCS = ColorSpace.fromIR(altIR);
  9336. if (altCS.numComps === numComps) {
  9337. return altIR;
  9338. }
  9339. warn('ICCBased color space: Ignoring incorrect /Alternate entry.');
  9340. }
  9341. if (numComps === 1) {
  9342. return 'DeviceGrayCS';
  9343. } else if (numComps === 3) {
  9344. return 'DeviceRgbCS';
  9345. } else if (numComps === 4) {
  9346. return 'DeviceCmykCS';
  9347. }
  9348. break;
  9349. case 'Pattern':
  9350. var basePatternCS = cs[1] || null;
  9351. if (basePatternCS) {
  9352. basePatternCS = ColorSpace.parseToIR(basePatternCS, xref, res);
  9353. }
  9354. return [
  9355. 'PatternCS',
  9356. basePatternCS
  9357. ];
  9358. case 'Indexed':
  9359. case 'I':
  9360. var baseIndexedCS = ColorSpace.parseToIR(cs[1], xref, res);
  9361. var hiVal = xref.fetchIfRef(cs[2]) + 1;
  9362. var lookup = xref.fetchIfRef(cs[3]);
  9363. if (isStream(lookup)) {
  9364. lookup = lookup.getBytes();
  9365. }
  9366. return [
  9367. 'IndexedCS',
  9368. baseIndexedCS,
  9369. hiVal,
  9370. lookup
  9371. ];
  9372. case 'Separation':
  9373. case 'DeviceN':
  9374. var name = xref.fetchIfRef(cs[1]);
  9375. numComps = isArray(name) ? name.length : 1;
  9376. alt = ColorSpace.parseToIR(cs[2], xref, res);
  9377. var tintFnIR = PDFFunction.getIR(xref, xref.fetchIfRef(cs[3]));
  9378. return [
  9379. 'AlternateCS',
  9380. numComps,
  9381. alt,
  9382. tintFnIR
  9383. ];
  9384. case 'Lab':
  9385. params = xref.fetchIfRef(cs[1]);
  9386. whitePoint = params.getArray('WhitePoint');
  9387. blackPoint = params.getArray('BlackPoint');
  9388. var range = params.getArray('Range');
  9389. return [
  9390. 'LabCS',
  9391. whitePoint,
  9392. blackPoint,
  9393. range
  9394. ];
  9395. default:
  9396. error('unimplemented color space object "' + mode + '"');
  9397. }
  9398. } else {
  9399. error('unrecognized color space object: "' + cs + '"');
  9400. }
  9401. return null;
  9402. };
  9403. ColorSpace.isDefaultDecode = function ColorSpace_isDefaultDecode(decode, n) {
  9404. if (!isArray(decode)) {
  9405. return true;
  9406. }
  9407. if (n * 2 !== decode.length) {
  9408. warn('The decode map is not the correct length');
  9409. return true;
  9410. }
  9411. for (var i = 0, ii = decode.length; i < ii; i += 2) {
  9412. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  9413. return false;
  9414. }
  9415. }
  9416. return true;
  9417. };
  9418. ColorSpace.singletons = {
  9419. get gray() {
  9420. return shadow(this, 'gray', new DeviceGrayCS());
  9421. },
  9422. get rgb() {
  9423. return shadow(this, 'rgb', new DeviceRgbCS());
  9424. },
  9425. get cmyk() {
  9426. return shadow(this, 'cmyk', new DeviceCmykCS());
  9427. }
  9428. };
  9429. return ColorSpace;
  9430. }();
  9431. var AlternateCS = function AlternateCSClosure() {
  9432. function AlternateCS(numComps, base, tintFn) {
  9433. this.name = 'Alternate';
  9434. this.numComps = numComps;
  9435. this.defaultColor = new Float32Array(numComps);
  9436. for (var i = 0; i < numComps; ++i) {
  9437. this.defaultColor[i] = 1;
  9438. }
  9439. this.base = base;
  9440. this.tintFn = tintFn;
  9441. this.tmpBuf = new Float32Array(base.numComps);
  9442. }
  9443. AlternateCS.prototype = {
  9444. getRgb: ColorSpace.prototype.getRgb,
  9445. getRgbItem: function AlternateCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9446. var tmpBuf = this.tmpBuf;
  9447. this.tintFn(src, srcOffset, tmpBuf, 0);
  9448. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  9449. },
  9450. getRgbBuffer: function AlternateCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9451. var tintFn = this.tintFn;
  9452. var base = this.base;
  9453. var scale = 1 / ((1 << bits) - 1);
  9454. var baseNumComps = base.numComps;
  9455. var usesZeroToOneRange = base.usesZeroToOneRange;
  9456. var isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  9457. var pos = isPassthrough ? destOffset : 0;
  9458. var baseBuf = isPassthrough ? dest : new Uint8Array(baseNumComps * count);
  9459. var numComps = this.numComps;
  9460. var scaled = new Float32Array(numComps);
  9461. var tinted = new Float32Array(baseNumComps);
  9462. var i, j;
  9463. for (i = 0; i < count; i++) {
  9464. for (j = 0; j < numComps; j++) {
  9465. scaled[j] = src[srcOffset++] * scale;
  9466. }
  9467. tintFn(scaled, 0, tinted, 0);
  9468. if (usesZeroToOneRange) {
  9469. for (j = 0; j < baseNumComps; j++) {
  9470. baseBuf[pos++] = tinted[j] * 255;
  9471. }
  9472. } else {
  9473. base.getRgbItem(tinted, 0, baseBuf, pos);
  9474. pos += baseNumComps;
  9475. }
  9476. }
  9477. if (!isPassthrough) {
  9478. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  9479. }
  9480. },
  9481. getOutputLength: function AlternateCS_getOutputLength(inputLength, alpha01) {
  9482. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  9483. },
  9484. isPassthrough: ColorSpace.prototype.isPassthrough,
  9485. fillRgb: ColorSpace.prototype.fillRgb,
  9486. isDefaultDecode: function AlternateCS_isDefaultDecode(decodeMap) {
  9487. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9488. },
  9489. usesZeroToOneRange: true
  9490. };
  9491. return AlternateCS;
  9492. }();
  9493. var PatternCS = function PatternCSClosure() {
  9494. function PatternCS(baseCS) {
  9495. this.name = 'Pattern';
  9496. this.base = baseCS;
  9497. }
  9498. PatternCS.prototype = {};
  9499. return PatternCS;
  9500. }();
  9501. var IndexedCS = function IndexedCSClosure() {
  9502. function IndexedCS(base, highVal, lookup) {
  9503. this.name = 'Indexed';
  9504. this.numComps = 1;
  9505. this.defaultColor = new Uint8Array(this.numComps);
  9506. this.base = base;
  9507. this.highVal = highVal;
  9508. var baseNumComps = base.numComps;
  9509. var length = baseNumComps * highVal;
  9510. if (isStream(lookup)) {
  9511. this.lookup = new Uint8Array(length);
  9512. var bytes = lookup.getBytes(length);
  9513. this.lookup.set(bytes);
  9514. } else if (isString(lookup)) {
  9515. this.lookup = new Uint8Array(length);
  9516. for (var i = 0; i < length; ++i) {
  9517. this.lookup[i] = lookup.charCodeAt(i);
  9518. }
  9519. } else if (lookup instanceof Uint8Array || lookup instanceof Array) {
  9520. this.lookup = lookup;
  9521. } else {
  9522. error('Unrecognized lookup table: ' + lookup);
  9523. }
  9524. }
  9525. IndexedCS.prototype = {
  9526. getRgb: ColorSpace.prototype.getRgb,
  9527. getRgbItem: function IndexedCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9528. var numComps = this.base.numComps;
  9529. var start = src[srcOffset] * numComps;
  9530. this.base.getRgbItem(this.lookup, start, dest, destOffset);
  9531. },
  9532. getRgbBuffer: function IndexedCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9533. var base = this.base;
  9534. var numComps = base.numComps;
  9535. var outputDelta = base.getOutputLength(numComps, alpha01);
  9536. var lookup = this.lookup;
  9537. for (var i = 0; i < count; ++i) {
  9538. var lookupPos = src[srcOffset++] * numComps;
  9539. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  9540. destOffset += outputDelta;
  9541. }
  9542. },
  9543. getOutputLength: function IndexedCS_getOutputLength(inputLength, alpha01) {
  9544. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  9545. },
  9546. isPassthrough: ColorSpace.prototype.isPassthrough,
  9547. fillRgb: ColorSpace.prototype.fillRgb,
  9548. isDefaultDecode: function IndexedCS_isDefaultDecode(decodeMap) {
  9549. return true;
  9550. },
  9551. usesZeroToOneRange: true
  9552. };
  9553. return IndexedCS;
  9554. }();
  9555. var DeviceGrayCS = function DeviceGrayCSClosure() {
  9556. function DeviceGrayCS() {
  9557. this.name = 'DeviceGray';
  9558. this.numComps = 1;
  9559. this.defaultColor = new Float32Array(this.numComps);
  9560. }
  9561. DeviceGrayCS.prototype = {
  9562. getRgb: ColorSpace.prototype.getRgb,
  9563. getRgbItem: function DeviceGrayCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9564. var c = src[srcOffset] * 255 | 0;
  9565. c = c < 0 ? 0 : c > 255 ? 255 : c;
  9566. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  9567. },
  9568. getRgbBuffer: function DeviceGrayCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9569. var scale = 255 / ((1 << bits) - 1);
  9570. var j = srcOffset, q = destOffset;
  9571. for (var i = 0; i < count; ++i) {
  9572. var c = scale * src[j++] | 0;
  9573. dest[q++] = c;
  9574. dest[q++] = c;
  9575. dest[q++] = c;
  9576. q += alpha01;
  9577. }
  9578. },
  9579. getOutputLength: function DeviceGrayCS_getOutputLength(inputLength, alpha01) {
  9580. return inputLength * (3 + alpha01);
  9581. },
  9582. isPassthrough: ColorSpace.prototype.isPassthrough,
  9583. fillRgb: ColorSpace.prototype.fillRgb,
  9584. isDefaultDecode: function DeviceGrayCS_isDefaultDecode(decodeMap) {
  9585. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9586. },
  9587. usesZeroToOneRange: true
  9588. };
  9589. return DeviceGrayCS;
  9590. }();
  9591. var DeviceRgbCS = function DeviceRgbCSClosure() {
  9592. function DeviceRgbCS() {
  9593. this.name = 'DeviceRGB';
  9594. this.numComps = 3;
  9595. this.defaultColor = new Float32Array(this.numComps);
  9596. }
  9597. DeviceRgbCS.prototype = {
  9598. getRgb: ColorSpace.prototype.getRgb,
  9599. getRgbItem: function DeviceRgbCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9600. var r = src[srcOffset] * 255 | 0;
  9601. var g = src[srcOffset + 1] * 255 | 0;
  9602. var b = src[srcOffset + 2] * 255 | 0;
  9603. dest[destOffset] = r < 0 ? 0 : r > 255 ? 255 : r;
  9604. dest[destOffset + 1] = g < 0 ? 0 : g > 255 ? 255 : g;
  9605. dest[destOffset + 2] = b < 0 ? 0 : b > 255 ? 255 : b;
  9606. },
  9607. getRgbBuffer: function DeviceRgbCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9608. if (bits === 8 && alpha01 === 0) {
  9609. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  9610. return;
  9611. }
  9612. var scale = 255 / ((1 << bits) - 1);
  9613. var j = srcOffset, q = destOffset;
  9614. for (var i = 0; i < count; ++i) {
  9615. dest[q++] = scale * src[j++] | 0;
  9616. dest[q++] = scale * src[j++] | 0;
  9617. dest[q++] = scale * src[j++] | 0;
  9618. q += alpha01;
  9619. }
  9620. },
  9621. getOutputLength: function DeviceRgbCS_getOutputLength(inputLength, alpha01) {
  9622. return inputLength * (3 + alpha01) / 3 | 0;
  9623. },
  9624. isPassthrough: function DeviceRgbCS_isPassthrough(bits) {
  9625. return bits === 8;
  9626. },
  9627. fillRgb: ColorSpace.prototype.fillRgb,
  9628. isDefaultDecode: function DeviceRgbCS_isDefaultDecode(decodeMap) {
  9629. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9630. },
  9631. usesZeroToOneRange: true
  9632. };
  9633. return DeviceRgbCS;
  9634. }();
  9635. var DeviceCmykCS = function DeviceCmykCSClosure() {
  9636. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  9637. var c = src[srcOffset + 0] * srcScale;
  9638. var m = src[srcOffset + 1] * srcScale;
  9639. var y = src[srcOffset + 2] * srcScale;
  9640. var k = src[srcOffset + 3] * srcScale;
  9641. var r = c * (-4.387332384609988 * c + 54.48615194189176 * m + 18.82290502165302 * y + 212.25662451639585 * k + -285.2331026137004) + m * (1.7149763477362134 * m - 5.6096736904047315 * y + -17.873870861415444 * k - 5.497006427196366) + y * (-2.5217340131683033 * y - 21.248923337353073 * k + 17.5119270841813) + k * (-21.86122147463605 * k - 189.48180835922747) + 255 | 0;
  9642. var g = c * (8.841041422036149 * c + 60.118027045597366 * m + 6.871425592049007 * y + 31.159100130055922 * k + -79.2970844816548) + m * (-15.310361306967817 * m + 17.575251261109482 * y + 131.35250912493976 * k - 190.9453302588951) + y * (4.444339102852739 * y + 9.8632861493405 * k - 24.86741582555878) + k * (-20.737325471181034 * k - 187.80453709719578) + 255 | 0;
  9643. var b = c * (0.8842522430003296 * c + 8.078677503112928 * m + 30.89978309703729 * y - 0.23883238689178934 * k + -14.183576799673286) + m * (10.49593273432072 * m + 63.02378494754052 * y + 50.606957656360734 * k - 112.23884253719248) + y * (0.03296041114873217 * y + 115.60384449646641 * k + -193.58209356861505) + k * (-22.33816807309886 * k - 180.12613974708367) + 255 | 0;
  9644. dest[destOffset] = r > 255 ? 255 : r < 0 ? 0 : r;
  9645. dest[destOffset + 1] = g > 255 ? 255 : g < 0 ? 0 : g;
  9646. dest[destOffset + 2] = b > 255 ? 255 : b < 0 ? 0 : b;
  9647. }
  9648. function DeviceCmykCS() {
  9649. this.name = 'DeviceCMYK';
  9650. this.numComps = 4;
  9651. this.defaultColor = new Float32Array(this.numComps);
  9652. this.defaultColor[3] = 1;
  9653. }
  9654. DeviceCmykCS.prototype = {
  9655. getRgb: ColorSpace.prototype.getRgb,
  9656. getRgbItem: function DeviceCmykCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9657. convertToRgb(src, srcOffset, 1, dest, destOffset);
  9658. },
  9659. getRgbBuffer: function DeviceCmykCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9660. var scale = 1 / ((1 << bits) - 1);
  9661. for (var i = 0; i < count; i++) {
  9662. convertToRgb(src, srcOffset, scale, dest, destOffset);
  9663. srcOffset += 4;
  9664. destOffset += 3 + alpha01;
  9665. }
  9666. },
  9667. getOutputLength: function DeviceCmykCS_getOutputLength(inputLength, alpha01) {
  9668. return inputLength / 4 * (3 + alpha01) | 0;
  9669. },
  9670. isPassthrough: ColorSpace.prototype.isPassthrough,
  9671. fillRgb: ColorSpace.prototype.fillRgb,
  9672. isDefaultDecode: function DeviceCmykCS_isDefaultDecode(decodeMap) {
  9673. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9674. },
  9675. usesZeroToOneRange: true
  9676. };
  9677. return DeviceCmykCS;
  9678. }();
  9679. var CalGrayCS = function CalGrayCSClosure() {
  9680. function CalGrayCS(whitePoint, blackPoint, gamma) {
  9681. this.name = 'CalGray';
  9682. this.numComps = 1;
  9683. this.defaultColor = new Float32Array(this.numComps);
  9684. if (!whitePoint) {
  9685. error('WhitePoint missing - required for color space CalGray');
  9686. }
  9687. blackPoint = blackPoint || [
  9688. 0,
  9689. 0,
  9690. 0
  9691. ];
  9692. gamma = gamma || 1;
  9693. this.XW = whitePoint[0];
  9694. this.YW = whitePoint[1];
  9695. this.ZW = whitePoint[2];
  9696. this.XB = blackPoint[0];
  9697. this.YB = blackPoint[1];
  9698. this.ZB = blackPoint[2];
  9699. this.G = gamma;
  9700. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  9701. error('Invalid WhitePoint components for ' + this.name + ', no fallback available');
  9702. }
  9703. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  9704. info('Invalid BlackPoint for ' + this.name + ', falling back to default');
  9705. this.XB = this.YB = this.ZB = 0;
  9706. }
  9707. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  9708. warn(this.name + ', BlackPoint: XB: ' + this.XB + ', YB: ' + this.YB + ', ZB: ' + this.ZB + ', only default values are supported.');
  9709. }
  9710. if (this.G < 1) {
  9711. info('Invalid Gamma: ' + this.G + ' for ' + this.name + ', falling back to default');
  9712. this.G = 1;
  9713. }
  9714. }
  9715. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  9716. var A = src[srcOffset] * scale;
  9717. var AG = Math.pow(A, cs.G);
  9718. var L = cs.YW * AG;
  9719. var val = Math.max(295.8 * Math.pow(L, 0.333333333333333333) - 40.8, 0) | 0;
  9720. dest[destOffset] = val;
  9721. dest[destOffset + 1] = val;
  9722. dest[destOffset + 2] = val;
  9723. }
  9724. CalGrayCS.prototype = {
  9725. getRgb: ColorSpace.prototype.getRgb,
  9726. getRgbItem: function CalGrayCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9727. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  9728. },
  9729. getRgbBuffer: function CalGrayCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9730. var scale = 1 / ((1 << bits) - 1);
  9731. for (var i = 0; i < count; ++i) {
  9732. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  9733. srcOffset += 1;
  9734. destOffset += 3 + alpha01;
  9735. }
  9736. },
  9737. getOutputLength: function CalGrayCS_getOutputLength(inputLength, alpha01) {
  9738. return inputLength * (3 + alpha01);
  9739. },
  9740. isPassthrough: ColorSpace.prototype.isPassthrough,
  9741. fillRgb: ColorSpace.prototype.fillRgb,
  9742. isDefaultDecode: function CalGrayCS_isDefaultDecode(decodeMap) {
  9743. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9744. },
  9745. usesZeroToOneRange: true
  9746. };
  9747. return CalGrayCS;
  9748. }();
  9749. var CalRGBCS = function CalRGBCSClosure() {
  9750. var BRADFORD_SCALE_MATRIX = new Float32Array([
  9751. 0.8951,
  9752. 0.2664,
  9753. -0.1614,
  9754. -0.7502,
  9755. 1.7135,
  9756. 0.0367,
  9757. 0.0389,
  9758. -0.0685,
  9759. 1.0296
  9760. ]);
  9761. var BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([
  9762. 0.9869929,
  9763. -0.1470543,
  9764. 0.1599627,
  9765. 0.4323053,
  9766. 0.5183603,
  9767. 0.0492912,
  9768. -0.0085287,
  9769. 0.0400428,
  9770. 0.9684867
  9771. ]);
  9772. var SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([
  9773. 3.2404542,
  9774. -1.5371385,
  9775. -0.4985314,
  9776. -0.9692660,
  9777. 1.8760108,
  9778. 0.0415560,
  9779. 0.0556434,
  9780. -0.2040259,
  9781. 1.0572252
  9782. ]);
  9783. var FLAT_WHITEPOINT_MATRIX = new Float32Array([
  9784. 1,
  9785. 1,
  9786. 1
  9787. ]);
  9788. var tempNormalizeMatrix = new Float32Array(3);
  9789. var tempConvertMatrix1 = new Float32Array(3);
  9790. var tempConvertMatrix2 = new Float32Array(3);
  9791. var DECODE_L_CONSTANT = Math.pow((8 + 16) / 116, 3) / 8.0;
  9792. function CalRGBCS(whitePoint, blackPoint, gamma, matrix) {
  9793. this.name = 'CalRGB';
  9794. this.numComps = 3;
  9795. this.defaultColor = new Float32Array(this.numComps);
  9796. if (!whitePoint) {
  9797. error('WhitePoint missing - required for color space CalRGB');
  9798. }
  9799. blackPoint = blackPoint || new Float32Array(3);
  9800. gamma = gamma || new Float32Array([
  9801. 1,
  9802. 1,
  9803. 1
  9804. ]);
  9805. matrix = matrix || new Float32Array([
  9806. 1,
  9807. 0,
  9808. 0,
  9809. 0,
  9810. 1,
  9811. 0,
  9812. 0,
  9813. 0,
  9814. 1
  9815. ]);
  9816. var XW = whitePoint[0];
  9817. var YW = whitePoint[1];
  9818. var ZW = whitePoint[2];
  9819. this.whitePoint = whitePoint;
  9820. var XB = blackPoint[0];
  9821. var YB = blackPoint[1];
  9822. var ZB = blackPoint[2];
  9823. this.blackPoint = blackPoint;
  9824. this.GR = gamma[0];
  9825. this.GG = gamma[1];
  9826. this.GB = gamma[2];
  9827. this.MXA = matrix[0];
  9828. this.MYA = matrix[1];
  9829. this.MZA = matrix[2];
  9830. this.MXB = matrix[3];
  9831. this.MYB = matrix[4];
  9832. this.MZB = matrix[5];
  9833. this.MXC = matrix[6];
  9834. this.MYC = matrix[7];
  9835. this.MZC = matrix[8];
  9836. if (XW < 0 || ZW < 0 || YW !== 1) {
  9837. error('Invalid WhitePoint components for ' + this.name + ', no fallback available');
  9838. }
  9839. if (XB < 0 || YB < 0 || ZB < 0) {
  9840. info('Invalid BlackPoint for ' + this.name + ' [' + XB + ', ' + YB + ', ' + ZB + '], falling back to default');
  9841. this.blackPoint = new Float32Array(3);
  9842. }
  9843. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  9844. info('Invalid Gamma [' + this.GR + ', ' + this.GG + ', ' + this.GB + '] for ' + this.name + ', falling back to default');
  9845. this.GR = this.GG = this.GB = 1;
  9846. }
  9847. if (this.MXA < 0 || this.MYA < 0 || this.MZA < 0 || this.MXB < 0 || this.MYB < 0 || this.MZB < 0 || this.MXC < 0 || this.MYC < 0 || this.MZC < 0) {
  9848. info('Invalid Matrix for ' + this.name + ' [' + this.MXA + ', ' + this.MYA + ', ' + this.MZA + this.MXB + ', ' + this.MYB + ', ' + this.MZB + this.MXC + ', ' + this.MYC + ', ' + this.MZC + '], falling back to default');
  9849. this.MXA = this.MYB = this.MZC = 1;
  9850. this.MXB = this.MYA = this.MZA = this.MXC = this.MYC = this.MZB = 0;
  9851. }
  9852. }
  9853. function matrixProduct(a, b, result) {
  9854. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  9855. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  9856. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  9857. }
  9858. function convertToFlat(sourceWhitePoint, LMS, result) {
  9859. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  9860. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  9861. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  9862. }
  9863. function convertToD65(sourceWhitePoint, LMS, result) {
  9864. var D65X = 0.95047;
  9865. var D65Y = 1;
  9866. var D65Z = 1.08883;
  9867. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  9868. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  9869. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  9870. }
  9871. function sRGBTransferFunction(color) {
  9872. if (color <= 0.0031308) {
  9873. return adjustToRange(0, 1, 12.92 * color);
  9874. }
  9875. return adjustToRange(0, 1, (1 + 0.055) * Math.pow(color, 1 / 2.4) - 0.055);
  9876. }
  9877. function adjustToRange(min, max, value) {
  9878. return Math.max(min, Math.min(max, value));
  9879. }
  9880. function decodeL(L) {
  9881. if (L < 0) {
  9882. return -decodeL(-L);
  9883. }
  9884. if (L > 8.0) {
  9885. return Math.pow((L + 16) / 116, 3);
  9886. }
  9887. return L * DECODE_L_CONSTANT;
  9888. }
  9889. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  9890. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  9891. result[0] = XYZ_Flat[0];
  9892. result[1] = XYZ_Flat[1];
  9893. result[2] = XYZ_Flat[2];
  9894. return;
  9895. }
  9896. var zeroDecodeL = decodeL(0);
  9897. var X_DST = zeroDecodeL;
  9898. var X_SRC = decodeL(sourceBlackPoint[0]);
  9899. var Y_DST = zeroDecodeL;
  9900. var Y_SRC = decodeL(sourceBlackPoint[1]);
  9901. var Z_DST = zeroDecodeL;
  9902. var Z_SRC = decodeL(sourceBlackPoint[2]);
  9903. var X_Scale = (1 - X_DST) / (1 - X_SRC);
  9904. var X_Offset = 1 - X_Scale;
  9905. var Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  9906. var Y_Offset = 1 - Y_Scale;
  9907. var Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  9908. var Z_Offset = 1 - Z_Scale;
  9909. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  9910. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  9911. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  9912. }
  9913. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  9914. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  9915. result[0] = XYZ_In[0];
  9916. result[1] = XYZ_In[1];
  9917. result[2] = XYZ_In[2];
  9918. return;
  9919. }
  9920. var LMS = result;
  9921. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  9922. var LMS_Flat = tempNormalizeMatrix;
  9923. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  9924. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  9925. }
  9926. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  9927. var LMS = result;
  9928. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  9929. var LMS_D65 = tempNormalizeMatrix;
  9930. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  9931. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  9932. }
  9933. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  9934. var A = adjustToRange(0, 1, src[srcOffset] * scale);
  9935. var B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  9936. var C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  9937. var AGR = Math.pow(A, cs.GR);
  9938. var BGG = Math.pow(B, cs.GG);
  9939. var CGB = Math.pow(C, cs.GB);
  9940. var X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  9941. var Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  9942. var Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  9943. var XYZ = tempConvertMatrix1;
  9944. XYZ[0] = X;
  9945. XYZ[1] = Y;
  9946. XYZ[2] = Z;
  9947. var XYZ_Flat = tempConvertMatrix2;
  9948. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  9949. var XYZ_Black = tempConvertMatrix1;
  9950. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  9951. var XYZ_D65 = tempConvertMatrix2;
  9952. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  9953. var SRGB = tempConvertMatrix1;
  9954. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  9955. var sR = sRGBTransferFunction(SRGB[0]);
  9956. var sG = sRGBTransferFunction(SRGB[1]);
  9957. var sB = sRGBTransferFunction(SRGB[2]);
  9958. dest[destOffset] = Math.round(sR * 255);
  9959. dest[destOffset + 1] = Math.round(sG * 255);
  9960. dest[destOffset + 2] = Math.round(sB * 255);
  9961. }
  9962. CalRGBCS.prototype = {
  9963. getRgb: function CalRGBCS_getRgb(src, srcOffset) {
  9964. var rgb = new Uint8Array(3);
  9965. this.getRgbItem(src, srcOffset, rgb, 0);
  9966. return rgb;
  9967. },
  9968. getRgbItem: function CalRGBCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9969. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  9970. },
  9971. getRgbBuffer: function CalRGBCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9972. var scale = 1 / ((1 << bits) - 1);
  9973. for (var i = 0; i < count; ++i) {
  9974. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  9975. srcOffset += 3;
  9976. destOffset += 3 + alpha01;
  9977. }
  9978. },
  9979. getOutputLength: function CalRGBCS_getOutputLength(inputLength, alpha01) {
  9980. return inputLength * (3 + alpha01) / 3 | 0;
  9981. },
  9982. isPassthrough: ColorSpace.prototype.isPassthrough,
  9983. fillRgb: ColorSpace.prototype.fillRgb,
  9984. isDefaultDecode: function CalRGBCS_isDefaultDecode(decodeMap) {
  9985. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9986. },
  9987. usesZeroToOneRange: true
  9988. };
  9989. return CalRGBCS;
  9990. }();
  9991. var LabCS = function LabCSClosure() {
  9992. function LabCS(whitePoint, blackPoint, range) {
  9993. this.name = 'Lab';
  9994. this.numComps = 3;
  9995. this.defaultColor = new Float32Array(this.numComps);
  9996. if (!whitePoint) {
  9997. error('WhitePoint missing - required for color space Lab');
  9998. }
  9999. blackPoint = blackPoint || [
  10000. 0,
  10001. 0,
  10002. 0
  10003. ];
  10004. range = range || [
  10005. -100,
  10006. 100,
  10007. -100,
  10008. 100
  10009. ];
  10010. this.XW = whitePoint[0];
  10011. this.YW = whitePoint[1];
  10012. this.ZW = whitePoint[2];
  10013. this.amin = range[0];
  10014. this.amax = range[1];
  10015. this.bmin = range[2];
  10016. this.bmax = range[3];
  10017. this.XB = blackPoint[0];
  10018. this.YB = blackPoint[1];
  10019. this.ZB = blackPoint[2];
  10020. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  10021. error('Invalid WhitePoint components, no fallback available');
  10022. }
  10023. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  10024. info('Invalid BlackPoint, falling back to default');
  10025. this.XB = this.YB = this.ZB = 0;
  10026. }
  10027. if (this.amin > this.amax || this.bmin > this.bmax) {
  10028. info('Invalid Range, falling back to defaults');
  10029. this.amin = -100;
  10030. this.amax = 100;
  10031. this.bmin = -100;
  10032. this.bmax = 100;
  10033. }
  10034. }
  10035. function fn_g(x) {
  10036. var result;
  10037. if (x >= 6 / 29) {
  10038. result = x * x * x;
  10039. } else {
  10040. result = 108 / 841 * (x - 4 / 29);
  10041. }
  10042. return result;
  10043. }
  10044. function decode(value, high1, low2, high2) {
  10045. return low2 + value * (high2 - low2) / high1;
  10046. }
  10047. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  10048. var Ls = src[srcOffset];
  10049. var as = src[srcOffset + 1];
  10050. var bs = src[srcOffset + 2];
  10051. if (maxVal !== false) {
  10052. Ls = decode(Ls, maxVal, 0, 100);
  10053. as = decode(as, maxVal, cs.amin, cs.amax);
  10054. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  10055. }
  10056. as = as > cs.amax ? cs.amax : as < cs.amin ? cs.amin : as;
  10057. bs = bs > cs.bmax ? cs.bmax : bs < cs.bmin ? cs.bmin : bs;
  10058. var M = (Ls + 16) / 116;
  10059. var L = M + as / 500;
  10060. var N = M - bs / 200;
  10061. var X = cs.XW * fn_g(L);
  10062. var Y = cs.YW * fn_g(M);
  10063. var Z = cs.ZW * fn_g(N);
  10064. var r, g, b;
  10065. if (cs.ZW < 1) {
  10066. r = X * 3.1339 + Y * -1.6170 + Z * -0.4906;
  10067. g = X * -0.9785 + Y * 1.9160 + Z * 0.0333;
  10068. b = X * 0.0720 + Y * -0.2290 + Z * 1.4057;
  10069. } else {
  10070. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  10071. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  10072. b = X * 0.0557 + Y * -0.2040 + Z * 1.0570;
  10073. }
  10074. dest[destOffset] = r <= 0 ? 0 : r >= 1 ? 255 : Math.sqrt(r) * 255 | 0;
  10075. dest[destOffset + 1] = g <= 0 ? 0 : g >= 1 ? 255 : Math.sqrt(g) * 255 | 0;
  10076. dest[destOffset + 2] = b <= 0 ? 0 : b >= 1 ? 255 : Math.sqrt(b) * 255 | 0;
  10077. }
  10078. LabCS.prototype = {
  10079. getRgb: ColorSpace.prototype.getRgb,
  10080. getRgbItem: function LabCS_getRgbItem(src, srcOffset, dest, destOffset) {
  10081. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  10082. },
  10083. getRgbBuffer: function LabCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  10084. var maxVal = (1 << bits) - 1;
  10085. for (var i = 0; i < count; i++) {
  10086. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  10087. srcOffset += 3;
  10088. destOffset += 3 + alpha01;
  10089. }
  10090. },
  10091. getOutputLength: function LabCS_getOutputLength(inputLength, alpha01) {
  10092. return inputLength * (3 + alpha01) / 3 | 0;
  10093. },
  10094. isPassthrough: ColorSpace.prototype.isPassthrough,
  10095. fillRgb: ColorSpace.prototype.fillRgb,
  10096. isDefaultDecode: function LabCS_isDefaultDecode(decodeMap) {
  10097. return true;
  10098. },
  10099. usesZeroToOneRange: false
  10100. };
  10101. return LabCS;
  10102. }();
  10103. exports.ColorSpace = ColorSpace;
  10104. /***/ }),
  10105. /* 4 */
  10106. /***/ (function(module, exports, __w_pdfjs_require__) {
  10107. "use strict";
  10108. var ExpertEncoding = [
  10109. '',
  10110. '',
  10111. '',
  10112. '',
  10113. '',
  10114. '',
  10115. '',
  10116. '',
  10117. '',
  10118. '',
  10119. '',
  10120. '',
  10121. '',
  10122. '',
  10123. '',
  10124. '',
  10125. '',
  10126. '',
  10127. '',
  10128. '',
  10129. '',
  10130. '',
  10131. '',
  10132. '',
  10133. '',
  10134. '',
  10135. '',
  10136. '',
  10137. '',
  10138. '',
  10139. '',
  10140. '',
  10141. 'space',
  10142. 'exclamsmall',
  10143. 'Hungarumlautsmall',
  10144. '',
  10145. 'dollaroldstyle',
  10146. 'dollarsuperior',
  10147. 'ampersandsmall',
  10148. 'Acutesmall',
  10149. 'parenleftsuperior',
  10150. 'parenrightsuperior',
  10151. 'twodotenleader',
  10152. 'onedotenleader',
  10153. 'comma',
  10154. 'hyphen',
  10155. 'period',
  10156. 'fraction',
  10157. 'zerooldstyle',
  10158. 'oneoldstyle',
  10159. 'twooldstyle',
  10160. 'threeoldstyle',
  10161. 'fouroldstyle',
  10162. 'fiveoldstyle',
  10163. 'sixoldstyle',
  10164. 'sevenoldstyle',
  10165. 'eightoldstyle',
  10166. 'nineoldstyle',
  10167. 'colon',
  10168. 'semicolon',
  10169. 'commasuperior',
  10170. 'threequartersemdash',
  10171. 'periodsuperior',
  10172. 'questionsmall',
  10173. '',
  10174. 'asuperior',
  10175. 'bsuperior',
  10176. 'centsuperior',
  10177. 'dsuperior',
  10178. 'esuperior',
  10179. '',
  10180. '',
  10181. 'isuperior',
  10182. '',
  10183. '',
  10184. 'lsuperior',
  10185. 'msuperior',
  10186. 'nsuperior',
  10187. 'osuperior',
  10188. '',
  10189. '',
  10190. 'rsuperior',
  10191. 'ssuperior',
  10192. 'tsuperior',
  10193. '',
  10194. 'ff',
  10195. 'fi',
  10196. 'fl',
  10197. 'ffi',
  10198. 'ffl',
  10199. 'parenleftinferior',
  10200. '',
  10201. 'parenrightinferior',
  10202. 'Circumflexsmall',
  10203. 'hyphensuperior',
  10204. 'Gravesmall',
  10205. 'Asmall',
  10206. 'Bsmall',
  10207. 'Csmall',
  10208. 'Dsmall',
  10209. 'Esmall',
  10210. 'Fsmall',
  10211. 'Gsmall',
  10212. 'Hsmall',
  10213. 'Ismall',
  10214. 'Jsmall',
  10215. 'Ksmall',
  10216. 'Lsmall',
  10217. 'Msmall',
  10218. 'Nsmall',
  10219. 'Osmall',
  10220. 'Psmall',
  10221. 'Qsmall',
  10222. 'Rsmall',
  10223. 'Ssmall',
  10224. 'Tsmall',
  10225. 'Usmall',
  10226. 'Vsmall',
  10227. 'Wsmall',
  10228. 'Xsmall',
  10229. 'Ysmall',
  10230. 'Zsmall',
  10231. 'colonmonetary',
  10232. 'onefitted',
  10233. 'rupiah',
  10234. 'Tildesmall',
  10235. '',
  10236. '',
  10237. '',
  10238. '',
  10239. '',
  10240. '',
  10241. '',
  10242. '',
  10243. '',
  10244. '',
  10245. '',
  10246. '',
  10247. '',
  10248. '',
  10249. '',
  10250. '',
  10251. '',
  10252. '',
  10253. '',
  10254. '',
  10255. '',
  10256. '',
  10257. '',
  10258. '',
  10259. '',
  10260. '',
  10261. '',
  10262. '',
  10263. '',
  10264. '',
  10265. '',
  10266. '',
  10267. '',
  10268. '',
  10269. 'exclamdownsmall',
  10270. 'centoldstyle',
  10271. 'Lslashsmall',
  10272. '',
  10273. '',
  10274. 'Scaronsmall',
  10275. 'Zcaronsmall',
  10276. 'Dieresissmall',
  10277. 'Brevesmall',
  10278. 'Caronsmall',
  10279. '',
  10280. 'Dotaccentsmall',
  10281. '',
  10282. '',
  10283. 'Macronsmall',
  10284. '',
  10285. '',
  10286. 'figuredash',
  10287. 'hypheninferior',
  10288. '',
  10289. '',
  10290. 'Ogoneksmall',
  10291. 'Ringsmall',
  10292. 'Cedillasmall',
  10293. '',
  10294. '',
  10295. '',
  10296. 'onequarter',
  10297. 'onehalf',
  10298. 'threequarters',
  10299. 'questiondownsmall',
  10300. 'oneeighth',
  10301. 'threeeighths',
  10302. 'fiveeighths',
  10303. 'seveneighths',
  10304. 'onethird',
  10305. 'twothirds',
  10306. '',
  10307. '',
  10308. 'zerosuperior',
  10309. 'onesuperior',
  10310. 'twosuperior',
  10311. 'threesuperior',
  10312. 'foursuperior',
  10313. 'fivesuperior',
  10314. 'sixsuperior',
  10315. 'sevensuperior',
  10316. 'eightsuperior',
  10317. 'ninesuperior',
  10318. 'zeroinferior',
  10319. 'oneinferior',
  10320. 'twoinferior',
  10321. 'threeinferior',
  10322. 'fourinferior',
  10323. 'fiveinferior',
  10324. 'sixinferior',
  10325. 'seveninferior',
  10326. 'eightinferior',
  10327. 'nineinferior',
  10328. 'centinferior',
  10329. 'dollarinferior',
  10330. 'periodinferior',
  10331. 'commainferior',
  10332. 'Agravesmall',
  10333. 'Aacutesmall',
  10334. 'Acircumflexsmall',
  10335. 'Atildesmall',
  10336. 'Adieresissmall',
  10337. 'Aringsmall',
  10338. 'AEsmall',
  10339. 'Ccedillasmall',
  10340. 'Egravesmall',
  10341. 'Eacutesmall',
  10342. 'Ecircumflexsmall',
  10343. 'Edieresissmall',
  10344. 'Igravesmall',
  10345. 'Iacutesmall',
  10346. 'Icircumflexsmall',
  10347. 'Idieresissmall',
  10348. 'Ethsmall',
  10349. 'Ntildesmall',
  10350. 'Ogravesmall',
  10351. 'Oacutesmall',
  10352. 'Ocircumflexsmall',
  10353. 'Otildesmall',
  10354. 'Odieresissmall',
  10355. 'OEsmall',
  10356. 'Oslashsmall',
  10357. 'Ugravesmall',
  10358. 'Uacutesmall',
  10359. 'Ucircumflexsmall',
  10360. 'Udieresissmall',
  10361. 'Yacutesmall',
  10362. 'Thornsmall',
  10363. 'Ydieresissmall'
  10364. ];
  10365. var MacExpertEncoding = [
  10366. '',
  10367. '',
  10368. '',
  10369. '',
  10370. '',
  10371. '',
  10372. '',
  10373. '',
  10374. '',
  10375. '',
  10376. '',
  10377. '',
  10378. '',
  10379. '',
  10380. '',
  10381. '',
  10382. '',
  10383. '',
  10384. '',
  10385. '',
  10386. '',
  10387. '',
  10388. '',
  10389. '',
  10390. '',
  10391. '',
  10392. '',
  10393. '',
  10394. '',
  10395. '',
  10396. '',
  10397. '',
  10398. 'space',
  10399. 'exclamsmall',
  10400. 'Hungarumlautsmall',
  10401. 'centoldstyle',
  10402. 'dollaroldstyle',
  10403. 'dollarsuperior',
  10404. 'ampersandsmall',
  10405. 'Acutesmall',
  10406. 'parenleftsuperior',
  10407. 'parenrightsuperior',
  10408. 'twodotenleader',
  10409. 'onedotenleader',
  10410. 'comma',
  10411. 'hyphen',
  10412. 'period',
  10413. 'fraction',
  10414. 'zerooldstyle',
  10415. 'oneoldstyle',
  10416. 'twooldstyle',
  10417. 'threeoldstyle',
  10418. 'fouroldstyle',
  10419. 'fiveoldstyle',
  10420. 'sixoldstyle',
  10421. 'sevenoldstyle',
  10422. 'eightoldstyle',
  10423. 'nineoldstyle',
  10424. 'colon',
  10425. 'semicolon',
  10426. '',
  10427. 'threequartersemdash',
  10428. '',
  10429. 'questionsmall',
  10430. '',
  10431. '',
  10432. '',
  10433. '',
  10434. 'Ethsmall',
  10435. '',
  10436. '',
  10437. 'onequarter',
  10438. 'onehalf',
  10439. 'threequarters',
  10440. 'oneeighth',
  10441. 'threeeighths',
  10442. 'fiveeighths',
  10443. 'seveneighths',
  10444. 'onethird',
  10445. 'twothirds',
  10446. '',
  10447. '',
  10448. '',
  10449. '',
  10450. '',
  10451. '',
  10452. 'ff',
  10453. 'fi',
  10454. 'fl',
  10455. 'ffi',
  10456. 'ffl',
  10457. 'parenleftinferior',
  10458. '',
  10459. 'parenrightinferior',
  10460. 'Circumflexsmall',
  10461. 'hypheninferior',
  10462. 'Gravesmall',
  10463. 'Asmall',
  10464. 'Bsmall',
  10465. 'Csmall',
  10466. 'Dsmall',
  10467. 'Esmall',
  10468. 'Fsmall',
  10469. 'Gsmall',
  10470. 'Hsmall',
  10471. 'Ismall',
  10472. 'Jsmall',
  10473. 'Ksmall',
  10474. 'Lsmall',
  10475. 'Msmall',
  10476. 'Nsmall',
  10477. 'Osmall',
  10478. 'Psmall',
  10479. 'Qsmall',
  10480. 'Rsmall',
  10481. 'Ssmall',
  10482. 'Tsmall',
  10483. 'Usmall',
  10484. 'Vsmall',
  10485. 'Wsmall',
  10486. 'Xsmall',
  10487. 'Ysmall',
  10488. 'Zsmall',
  10489. 'colonmonetary',
  10490. 'onefitted',
  10491. 'rupiah',
  10492. 'Tildesmall',
  10493. '',
  10494. '',
  10495. 'asuperior',
  10496. 'centsuperior',
  10497. '',
  10498. '',
  10499. '',
  10500. '',
  10501. 'Aacutesmall',
  10502. 'Agravesmall',
  10503. 'Acircumflexsmall',
  10504. 'Adieresissmall',
  10505. 'Atildesmall',
  10506. 'Aringsmall',
  10507. 'Ccedillasmall',
  10508. 'Eacutesmall',
  10509. 'Egravesmall',
  10510. 'Ecircumflexsmall',
  10511. 'Edieresissmall',
  10512. 'Iacutesmall',
  10513. 'Igravesmall',
  10514. 'Icircumflexsmall',
  10515. 'Idieresissmall',
  10516. 'Ntildesmall',
  10517. 'Oacutesmall',
  10518. 'Ogravesmall',
  10519. 'Ocircumflexsmall',
  10520. 'Odieresissmall',
  10521. 'Otildesmall',
  10522. 'Uacutesmall',
  10523. 'Ugravesmall',
  10524. 'Ucircumflexsmall',
  10525. 'Udieresissmall',
  10526. '',
  10527. 'eightsuperior',
  10528. 'fourinferior',
  10529. 'threeinferior',
  10530. 'sixinferior',
  10531. 'eightinferior',
  10532. 'seveninferior',
  10533. 'Scaronsmall',
  10534. '',
  10535. 'centinferior',
  10536. 'twoinferior',
  10537. '',
  10538. 'Dieresissmall',
  10539. '',
  10540. 'Caronsmall',
  10541. 'osuperior',
  10542. 'fiveinferior',
  10543. '',
  10544. 'commainferior',
  10545. 'periodinferior',
  10546. 'Yacutesmall',
  10547. '',
  10548. 'dollarinferior',
  10549. '',
  10550. 'Thornsmall',
  10551. '',
  10552. 'nineinferior',
  10553. 'zeroinferior',
  10554. 'Zcaronsmall',
  10555. 'AEsmall',
  10556. 'Oslashsmall',
  10557. 'questiondownsmall',
  10558. 'oneinferior',
  10559. 'Lslashsmall',
  10560. '',
  10561. '',
  10562. '',
  10563. '',
  10564. '',
  10565. '',
  10566. 'Cedillasmall',
  10567. '',
  10568. '',
  10569. '',
  10570. '',
  10571. '',
  10572. 'OEsmall',
  10573. 'figuredash',
  10574. 'hyphensuperior',
  10575. '',
  10576. '',
  10577. '',
  10578. '',
  10579. 'exclamdownsmall',
  10580. '',
  10581. 'Ydieresissmall',
  10582. '',
  10583. 'onesuperior',
  10584. 'twosuperior',
  10585. 'threesuperior',
  10586. 'foursuperior',
  10587. 'fivesuperior',
  10588. 'sixsuperior',
  10589. 'sevensuperior',
  10590. 'ninesuperior',
  10591. 'zerosuperior',
  10592. '',
  10593. 'esuperior',
  10594. 'rsuperior',
  10595. 'tsuperior',
  10596. '',
  10597. '',
  10598. 'isuperior',
  10599. 'ssuperior',
  10600. 'dsuperior',
  10601. '',
  10602. '',
  10603. '',
  10604. '',
  10605. '',
  10606. 'lsuperior',
  10607. 'Ogoneksmall',
  10608. 'Brevesmall',
  10609. 'Macronsmall',
  10610. 'bsuperior',
  10611. 'nsuperior',
  10612. 'msuperior',
  10613. 'commasuperior',
  10614. 'periodsuperior',
  10615. 'Dotaccentsmall',
  10616. 'Ringsmall'
  10617. ];
  10618. var MacRomanEncoding = [
  10619. '',
  10620. '',
  10621. '',
  10622. '',
  10623. '',
  10624. '',
  10625. '',
  10626. '',
  10627. '',
  10628. '',
  10629. '',
  10630. '',
  10631. '',
  10632. '',
  10633. '',
  10634. '',
  10635. '',
  10636. '',
  10637. '',
  10638. '',
  10639. '',
  10640. '',
  10641. '',
  10642. '',
  10643. '',
  10644. '',
  10645. '',
  10646. '',
  10647. '',
  10648. '',
  10649. '',
  10650. '',
  10651. 'space',
  10652. 'exclam',
  10653. 'quotedbl',
  10654. 'numbersign',
  10655. 'dollar',
  10656. 'percent',
  10657. 'ampersand',
  10658. 'quotesingle',
  10659. 'parenleft',
  10660. 'parenright',
  10661. 'asterisk',
  10662. 'plus',
  10663. 'comma',
  10664. 'hyphen',
  10665. 'period',
  10666. 'slash',
  10667. 'zero',
  10668. 'one',
  10669. 'two',
  10670. 'three',
  10671. 'four',
  10672. 'five',
  10673. 'six',
  10674. 'seven',
  10675. 'eight',
  10676. 'nine',
  10677. 'colon',
  10678. 'semicolon',
  10679. 'less',
  10680. 'equal',
  10681. 'greater',
  10682. 'question',
  10683. 'at',
  10684. 'A',
  10685. 'B',
  10686. 'C',
  10687. 'D',
  10688. 'E',
  10689. 'F',
  10690. 'G',
  10691. 'H',
  10692. 'I',
  10693. 'J',
  10694. 'K',
  10695. 'L',
  10696. 'M',
  10697. 'N',
  10698. 'O',
  10699. 'P',
  10700. 'Q',
  10701. 'R',
  10702. 'S',
  10703. 'T',
  10704. 'U',
  10705. 'V',
  10706. 'W',
  10707. 'X',
  10708. 'Y',
  10709. 'Z',
  10710. 'bracketleft',
  10711. 'backslash',
  10712. 'bracketright',
  10713. 'asciicircum',
  10714. 'underscore',
  10715. 'grave',
  10716. 'a',
  10717. 'b',
  10718. 'c',
  10719. 'd',
  10720. 'e',
  10721. 'f',
  10722. 'g',
  10723. 'h',
  10724. 'i',
  10725. 'j',
  10726. 'k',
  10727. 'l',
  10728. 'm',
  10729. 'n',
  10730. 'o',
  10731. 'p',
  10732. 'q',
  10733. 'r',
  10734. 's',
  10735. 't',
  10736. 'u',
  10737. 'v',
  10738. 'w',
  10739. 'x',
  10740. 'y',
  10741. 'z',
  10742. 'braceleft',
  10743. 'bar',
  10744. 'braceright',
  10745. 'asciitilde',
  10746. '',
  10747. 'Adieresis',
  10748. 'Aring',
  10749. 'Ccedilla',
  10750. 'Eacute',
  10751. 'Ntilde',
  10752. 'Odieresis',
  10753. 'Udieresis',
  10754. 'aacute',
  10755. 'agrave',
  10756. 'acircumflex',
  10757. 'adieresis',
  10758. 'atilde',
  10759. 'aring',
  10760. 'ccedilla',
  10761. 'eacute',
  10762. 'egrave',
  10763. 'ecircumflex',
  10764. 'edieresis',
  10765. 'iacute',
  10766. 'igrave',
  10767. 'icircumflex',
  10768. 'idieresis',
  10769. 'ntilde',
  10770. 'oacute',
  10771. 'ograve',
  10772. 'ocircumflex',
  10773. 'odieresis',
  10774. 'otilde',
  10775. 'uacute',
  10776. 'ugrave',
  10777. 'ucircumflex',
  10778. 'udieresis',
  10779. 'dagger',
  10780. 'degree',
  10781. 'cent',
  10782. 'sterling',
  10783. 'section',
  10784. 'bullet',
  10785. 'paragraph',
  10786. 'germandbls',
  10787. 'registered',
  10788. 'copyright',
  10789. 'trademark',
  10790. 'acute',
  10791. 'dieresis',
  10792. 'notequal',
  10793. 'AE',
  10794. 'Oslash',
  10795. 'infinity',
  10796. 'plusminus',
  10797. 'lessequal',
  10798. 'greaterequal',
  10799. 'yen',
  10800. 'mu',
  10801. 'partialdiff',
  10802. 'summation',
  10803. 'product',
  10804. 'pi',
  10805. 'integral',
  10806. 'ordfeminine',
  10807. 'ordmasculine',
  10808. 'Omega',
  10809. 'ae',
  10810. 'oslash',
  10811. 'questiondown',
  10812. 'exclamdown',
  10813. 'logicalnot',
  10814. 'radical',
  10815. 'florin',
  10816. 'approxequal',
  10817. 'Delta',
  10818. 'guillemotleft',
  10819. 'guillemotright',
  10820. 'ellipsis',
  10821. 'space',
  10822. 'Agrave',
  10823. 'Atilde',
  10824. 'Otilde',
  10825. 'OE',
  10826. 'oe',
  10827. 'endash',
  10828. 'emdash',
  10829. 'quotedblleft',
  10830. 'quotedblright',
  10831. 'quoteleft',
  10832. 'quoteright',
  10833. 'divide',
  10834. 'lozenge',
  10835. 'ydieresis',
  10836. 'Ydieresis',
  10837. 'fraction',
  10838. 'currency',
  10839. 'guilsinglleft',
  10840. 'guilsinglright',
  10841. 'fi',
  10842. 'fl',
  10843. 'daggerdbl',
  10844. 'periodcentered',
  10845. 'quotesinglbase',
  10846. 'quotedblbase',
  10847. 'perthousand',
  10848. 'Acircumflex',
  10849. 'Ecircumflex',
  10850. 'Aacute',
  10851. 'Edieresis',
  10852. 'Egrave',
  10853. 'Iacute',
  10854. 'Icircumflex',
  10855. 'Idieresis',
  10856. 'Igrave',
  10857. 'Oacute',
  10858. 'Ocircumflex',
  10859. 'apple',
  10860. 'Ograve',
  10861. 'Uacute',
  10862. 'Ucircumflex',
  10863. 'Ugrave',
  10864. 'dotlessi',
  10865. 'circumflex',
  10866. 'tilde',
  10867. 'macron',
  10868. 'breve',
  10869. 'dotaccent',
  10870. 'ring',
  10871. 'cedilla',
  10872. 'hungarumlaut',
  10873. 'ogonek',
  10874. 'caron'
  10875. ];
  10876. var StandardEncoding = [
  10877. '',
  10878. '',
  10879. '',
  10880. '',
  10881. '',
  10882. '',
  10883. '',
  10884. '',
  10885. '',
  10886. '',
  10887. '',
  10888. '',
  10889. '',
  10890. '',
  10891. '',
  10892. '',
  10893. '',
  10894. '',
  10895. '',
  10896. '',
  10897. '',
  10898. '',
  10899. '',
  10900. '',
  10901. '',
  10902. '',
  10903. '',
  10904. '',
  10905. '',
  10906. '',
  10907. '',
  10908. '',
  10909. 'space',
  10910. 'exclam',
  10911. 'quotedbl',
  10912. 'numbersign',
  10913. 'dollar',
  10914. 'percent',
  10915. 'ampersand',
  10916. 'quoteright',
  10917. 'parenleft',
  10918. 'parenright',
  10919. 'asterisk',
  10920. 'plus',
  10921. 'comma',
  10922. 'hyphen',
  10923. 'period',
  10924. 'slash',
  10925. 'zero',
  10926. 'one',
  10927. 'two',
  10928. 'three',
  10929. 'four',
  10930. 'five',
  10931. 'six',
  10932. 'seven',
  10933. 'eight',
  10934. 'nine',
  10935. 'colon',
  10936. 'semicolon',
  10937. 'less',
  10938. 'equal',
  10939. 'greater',
  10940. 'question',
  10941. 'at',
  10942. 'A',
  10943. 'B',
  10944. 'C',
  10945. 'D',
  10946. 'E',
  10947. 'F',
  10948. 'G',
  10949. 'H',
  10950. 'I',
  10951. 'J',
  10952. 'K',
  10953. 'L',
  10954. 'M',
  10955. 'N',
  10956. 'O',
  10957. 'P',
  10958. 'Q',
  10959. 'R',
  10960. 'S',
  10961. 'T',
  10962. 'U',
  10963. 'V',
  10964. 'W',
  10965. 'X',
  10966. 'Y',
  10967. 'Z',
  10968. 'bracketleft',
  10969. 'backslash',
  10970. 'bracketright',
  10971. 'asciicircum',
  10972. 'underscore',
  10973. 'quoteleft',
  10974. 'a',
  10975. 'b',
  10976. 'c',
  10977. 'd',
  10978. 'e',
  10979. 'f',
  10980. 'g',
  10981. 'h',
  10982. 'i',
  10983. 'j',
  10984. 'k',
  10985. 'l',
  10986. 'm',
  10987. 'n',
  10988. 'o',
  10989. 'p',
  10990. 'q',
  10991. 'r',
  10992. 's',
  10993. 't',
  10994. 'u',
  10995. 'v',
  10996. 'w',
  10997. 'x',
  10998. 'y',
  10999. 'z',
  11000. 'braceleft',
  11001. 'bar',
  11002. 'braceright',
  11003. 'asciitilde',
  11004. '',
  11005. '',
  11006. '',
  11007. '',
  11008. '',
  11009. '',
  11010. '',
  11011. '',
  11012. '',
  11013. '',
  11014. '',
  11015. '',
  11016. '',
  11017. '',
  11018. '',
  11019. '',
  11020. '',
  11021. '',
  11022. '',
  11023. '',
  11024. '',
  11025. '',
  11026. '',
  11027. '',
  11028. '',
  11029. '',
  11030. '',
  11031. '',
  11032. '',
  11033. '',
  11034. '',
  11035. '',
  11036. '',
  11037. '',
  11038. 'exclamdown',
  11039. 'cent',
  11040. 'sterling',
  11041. 'fraction',
  11042. 'yen',
  11043. 'florin',
  11044. 'section',
  11045. 'currency',
  11046. 'quotesingle',
  11047. 'quotedblleft',
  11048. 'guillemotleft',
  11049. 'guilsinglleft',
  11050. 'guilsinglright',
  11051. 'fi',
  11052. 'fl',
  11053. '',
  11054. 'endash',
  11055. 'dagger',
  11056. 'daggerdbl',
  11057. 'periodcentered',
  11058. '',
  11059. 'paragraph',
  11060. 'bullet',
  11061. 'quotesinglbase',
  11062. 'quotedblbase',
  11063. 'quotedblright',
  11064. 'guillemotright',
  11065. 'ellipsis',
  11066. 'perthousand',
  11067. '',
  11068. 'questiondown',
  11069. '',
  11070. 'grave',
  11071. 'acute',
  11072. 'circumflex',
  11073. 'tilde',
  11074. 'macron',
  11075. 'breve',
  11076. 'dotaccent',
  11077. 'dieresis',
  11078. '',
  11079. 'ring',
  11080. 'cedilla',
  11081. '',
  11082. 'hungarumlaut',
  11083. 'ogonek',
  11084. 'caron',
  11085. 'emdash',
  11086. '',
  11087. '',
  11088. '',
  11089. '',
  11090. '',
  11091. '',
  11092. '',
  11093. '',
  11094. '',
  11095. '',
  11096. '',
  11097. '',
  11098. '',
  11099. '',
  11100. '',
  11101. '',
  11102. 'AE',
  11103. '',
  11104. 'ordfeminine',
  11105. '',
  11106. '',
  11107. '',
  11108. '',
  11109. 'Lslash',
  11110. 'Oslash',
  11111. 'OE',
  11112. 'ordmasculine',
  11113. '',
  11114. '',
  11115. '',
  11116. '',
  11117. '',
  11118. 'ae',
  11119. '',
  11120. '',
  11121. '',
  11122. 'dotlessi',
  11123. '',
  11124. '',
  11125. 'lslash',
  11126. 'oslash',
  11127. 'oe',
  11128. 'germandbls'
  11129. ];
  11130. var WinAnsiEncoding = [
  11131. '',
  11132. '',
  11133. '',
  11134. '',
  11135. '',
  11136. '',
  11137. '',
  11138. '',
  11139. '',
  11140. '',
  11141. '',
  11142. '',
  11143. '',
  11144. '',
  11145. '',
  11146. '',
  11147. '',
  11148. '',
  11149. '',
  11150. '',
  11151. '',
  11152. '',
  11153. '',
  11154. '',
  11155. '',
  11156. '',
  11157. '',
  11158. '',
  11159. '',
  11160. '',
  11161. '',
  11162. '',
  11163. 'space',
  11164. 'exclam',
  11165. 'quotedbl',
  11166. 'numbersign',
  11167. 'dollar',
  11168. 'percent',
  11169. 'ampersand',
  11170. 'quotesingle',
  11171. 'parenleft',
  11172. 'parenright',
  11173. 'asterisk',
  11174. 'plus',
  11175. 'comma',
  11176. 'hyphen',
  11177. 'period',
  11178. 'slash',
  11179. 'zero',
  11180. 'one',
  11181. 'two',
  11182. 'three',
  11183. 'four',
  11184. 'five',
  11185. 'six',
  11186. 'seven',
  11187. 'eight',
  11188. 'nine',
  11189. 'colon',
  11190. 'semicolon',
  11191. 'less',
  11192. 'equal',
  11193. 'greater',
  11194. 'question',
  11195. 'at',
  11196. 'A',
  11197. 'B',
  11198. 'C',
  11199. 'D',
  11200. 'E',
  11201. 'F',
  11202. 'G',
  11203. 'H',
  11204. 'I',
  11205. 'J',
  11206. 'K',
  11207. 'L',
  11208. 'M',
  11209. 'N',
  11210. 'O',
  11211. 'P',
  11212. 'Q',
  11213. 'R',
  11214. 'S',
  11215. 'T',
  11216. 'U',
  11217. 'V',
  11218. 'W',
  11219. 'X',
  11220. 'Y',
  11221. 'Z',
  11222. 'bracketleft',
  11223. 'backslash',
  11224. 'bracketright',
  11225. 'asciicircum',
  11226. 'underscore',
  11227. 'grave',
  11228. 'a',
  11229. 'b',
  11230. 'c',
  11231. 'd',
  11232. 'e',
  11233. 'f',
  11234. 'g',
  11235. 'h',
  11236. 'i',
  11237. 'j',
  11238. 'k',
  11239. 'l',
  11240. 'm',
  11241. 'n',
  11242. 'o',
  11243. 'p',
  11244. 'q',
  11245. 'r',
  11246. 's',
  11247. 't',
  11248. 'u',
  11249. 'v',
  11250. 'w',
  11251. 'x',
  11252. 'y',
  11253. 'z',
  11254. 'braceleft',
  11255. 'bar',
  11256. 'braceright',
  11257. 'asciitilde',
  11258. 'bullet',
  11259. 'Euro',
  11260. 'bullet',
  11261. 'quotesinglbase',
  11262. 'florin',
  11263. 'quotedblbase',
  11264. 'ellipsis',
  11265. 'dagger',
  11266. 'daggerdbl',
  11267. 'circumflex',
  11268. 'perthousand',
  11269. 'Scaron',
  11270. 'guilsinglleft',
  11271. 'OE',
  11272. 'bullet',
  11273. 'Zcaron',
  11274. 'bullet',
  11275. 'bullet',
  11276. 'quoteleft',
  11277. 'quoteright',
  11278. 'quotedblleft',
  11279. 'quotedblright',
  11280. 'bullet',
  11281. 'endash',
  11282. 'emdash',
  11283. 'tilde',
  11284. 'trademark',
  11285. 'scaron',
  11286. 'guilsinglright',
  11287. 'oe',
  11288. 'bullet',
  11289. 'zcaron',
  11290. 'Ydieresis',
  11291. 'space',
  11292. 'exclamdown',
  11293. 'cent',
  11294. 'sterling',
  11295. 'currency',
  11296. 'yen',
  11297. 'brokenbar',
  11298. 'section',
  11299. 'dieresis',
  11300. 'copyright',
  11301. 'ordfeminine',
  11302. 'guillemotleft',
  11303. 'logicalnot',
  11304. 'hyphen',
  11305. 'registered',
  11306. 'macron',
  11307. 'degree',
  11308. 'plusminus',
  11309. 'twosuperior',
  11310. 'threesuperior',
  11311. 'acute',
  11312. 'mu',
  11313. 'paragraph',
  11314. 'periodcentered',
  11315. 'cedilla',
  11316. 'onesuperior',
  11317. 'ordmasculine',
  11318. 'guillemotright',
  11319. 'onequarter',
  11320. 'onehalf',
  11321. 'threequarters',
  11322. 'questiondown',
  11323. 'Agrave',
  11324. 'Aacute',
  11325. 'Acircumflex',
  11326. 'Atilde',
  11327. 'Adieresis',
  11328. 'Aring',
  11329. 'AE',
  11330. 'Ccedilla',
  11331. 'Egrave',
  11332. 'Eacute',
  11333. 'Ecircumflex',
  11334. 'Edieresis',
  11335. 'Igrave',
  11336. 'Iacute',
  11337. 'Icircumflex',
  11338. 'Idieresis',
  11339. 'Eth',
  11340. 'Ntilde',
  11341. 'Ograve',
  11342. 'Oacute',
  11343. 'Ocircumflex',
  11344. 'Otilde',
  11345. 'Odieresis',
  11346. 'multiply',
  11347. 'Oslash',
  11348. 'Ugrave',
  11349. 'Uacute',
  11350. 'Ucircumflex',
  11351. 'Udieresis',
  11352. 'Yacute',
  11353. 'Thorn',
  11354. 'germandbls',
  11355. 'agrave',
  11356. 'aacute',
  11357. 'acircumflex',
  11358. 'atilde',
  11359. 'adieresis',
  11360. 'aring',
  11361. 'ae',
  11362. 'ccedilla',
  11363. 'egrave',
  11364. 'eacute',
  11365. 'ecircumflex',
  11366. 'edieresis',
  11367. 'igrave',
  11368. 'iacute',
  11369. 'icircumflex',
  11370. 'idieresis',
  11371. 'eth',
  11372. 'ntilde',
  11373. 'ograve',
  11374. 'oacute',
  11375. 'ocircumflex',
  11376. 'otilde',
  11377. 'odieresis',
  11378. 'divide',
  11379. 'oslash',
  11380. 'ugrave',
  11381. 'uacute',
  11382. 'ucircumflex',
  11383. 'udieresis',
  11384. 'yacute',
  11385. 'thorn',
  11386. 'ydieresis'
  11387. ];
  11388. var SymbolSetEncoding = [
  11389. '',
  11390. '',
  11391. '',
  11392. '',
  11393. '',
  11394. '',
  11395. '',
  11396. '',
  11397. '',
  11398. '',
  11399. '',
  11400. '',
  11401. '',
  11402. '',
  11403. '',
  11404. '',
  11405. '',
  11406. '',
  11407. '',
  11408. '',
  11409. '',
  11410. '',
  11411. '',
  11412. '',
  11413. '',
  11414. '',
  11415. '',
  11416. '',
  11417. '',
  11418. '',
  11419. '',
  11420. '',
  11421. 'space',
  11422. 'exclam',
  11423. 'universal',
  11424. 'numbersign',
  11425. 'existential',
  11426. 'percent',
  11427. 'ampersand',
  11428. 'suchthat',
  11429. 'parenleft',
  11430. 'parenright',
  11431. 'asteriskmath',
  11432. 'plus',
  11433. 'comma',
  11434. 'minus',
  11435. 'period',
  11436. 'slash',
  11437. 'zero',
  11438. 'one',
  11439. 'two',
  11440. 'three',
  11441. 'four',
  11442. 'five',
  11443. 'six',
  11444. 'seven',
  11445. 'eight',
  11446. 'nine',
  11447. 'colon',
  11448. 'semicolon',
  11449. 'less',
  11450. 'equal',
  11451. 'greater',
  11452. 'question',
  11453. 'congruent',
  11454. 'Alpha',
  11455. 'Beta',
  11456. 'Chi',
  11457. 'Delta',
  11458. 'Epsilon',
  11459. 'Phi',
  11460. 'Gamma',
  11461. 'Eta',
  11462. 'Iota',
  11463. 'theta1',
  11464. 'Kappa',
  11465. 'Lambda',
  11466. 'Mu',
  11467. 'Nu',
  11468. 'Omicron',
  11469. 'Pi',
  11470. 'Theta',
  11471. 'Rho',
  11472. 'Sigma',
  11473. 'Tau',
  11474. 'Upsilon',
  11475. 'sigma1',
  11476. 'Omega',
  11477. 'Xi',
  11478. 'Psi',
  11479. 'Zeta',
  11480. 'bracketleft',
  11481. 'therefore',
  11482. 'bracketright',
  11483. 'perpendicular',
  11484. 'underscore',
  11485. 'radicalex',
  11486. 'alpha',
  11487. 'beta',
  11488. 'chi',
  11489. 'delta',
  11490. 'epsilon',
  11491. 'phi',
  11492. 'gamma',
  11493. 'eta',
  11494. 'iota',
  11495. 'phi1',
  11496. 'kappa',
  11497. 'lambda',
  11498. 'mu',
  11499. 'nu',
  11500. 'omicron',
  11501. 'pi',
  11502. 'theta',
  11503. 'rho',
  11504. 'sigma',
  11505. 'tau',
  11506. 'upsilon',
  11507. 'omega1',
  11508. 'omega',
  11509. 'xi',
  11510. 'psi',
  11511. 'zeta',
  11512. 'braceleft',
  11513. 'bar',
  11514. 'braceright',
  11515. 'similar',
  11516. '',
  11517. '',
  11518. '',
  11519. '',
  11520. '',
  11521. '',
  11522. '',
  11523. '',
  11524. '',
  11525. '',
  11526. '',
  11527. '',
  11528. '',
  11529. '',
  11530. '',
  11531. '',
  11532. '',
  11533. '',
  11534. '',
  11535. '',
  11536. '',
  11537. '',
  11538. '',
  11539. '',
  11540. '',
  11541. '',
  11542. '',
  11543. '',
  11544. '',
  11545. '',
  11546. '',
  11547. '',
  11548. '',
  11549. 'Euro',
  11550. 'Upsilon1',
  11551. 'minute',
  11552. 'lessequal',
  11553. 'fraction',
  11554. 'infinity',
  11555. 'florin',
  11556. 'club',
  11557. 'diamond',
  11558. 'heart',
  11559. 'spade',
  11560. 'arrowboth',
  11561. 'arrowleft',
  11562. 'arrowup',
  11563. 'arrowright',
  11564. 'arrowdown',
  11565. 'degree',
  11566. 'plusminus',
  11567. 'second',
  11568. 'greaterequal',
  11569. 'multiply',
  11570. 'proportional',
  11571. 'partialdiff',
  11572. 'bullet',
  11573. 'divide',
  11574. 'notequal',
  11575. 'equivalence',
  11576. 'approxequal',
  11577. 'ellipsis',
  11578. 'arrowvertex',
  11579. 'arrowhorizex',
  11580. 'carriagereturn',
  11581. 'aleph',
  11582. 'Ifraktur',
  11583. 'Rfraktur',
  11584. 'weierstrass',
  11585. 'circlemultiply',
  11586. 'circleplus',
  11587. 'emptyset',
  11588. 'intersection',
  11589. 'union',
  11590. 'propersuperset',
  11591. 'reflexsuperset',
  11592. 'notsubset',
  11593. 'propersubset',
  11594. 'reflexsubset',
  11595. 'element',
  11596. 'notelement',
  11597. 'angle',
  11598. 'gradient',
  11599. 'registerserif',
  11600. 'copyrightserif',
  11601. 'trademarkserif',
  11602. 'product',
  11603. 'radical',
  11604. 'dotmath',
  11605. 'logicalnot',
  11606. 'logicaland',
  11607. 'logicalor',
  11608. 'arrowdblboth',
  11609. 'arrowdblleft',
  11610. 'arrowdblup',
  11611. 'arrowdblright',
  11612. 'arrowdbldown',
  11613. 'lozenge',
  11614. 'angleleft',
  11615. 'registersans',
  11616. 'copyrightsans',
  11617. 'trademarksans',
  11618. 'summation',
  11619. 'parenlefttp',
  11620. 'parenleftex',
  11621. 'parenleftbt',
  11622. 'bracketlefttp',
  11623. 'bracketleftex',
  11624. 'bracketleftbt',
  11625. 'bracelefttp',
  11626. 'braceleftmid',
  11627. 'braceleftbt',
  11628. 'braceex',
  11629. '',
  11630. 'angleright',
  11631. 'integral',
  11632. 'integraltp',
  11633. 'integralex',
  11634. 'integralbt',
  11635. 'parenrighttp',
  11636. 'parenrightex',
  11637. 'parenrightbt',
  11638. 'bracketrighttp',
  11639. 'bracketrightex',
  11640. 'bracketrightbt',
  11641. 'bracerighttp',
  11642. 'bracerightmid',
  11643. 'bracerightbt'
  11644. ];
  11645. var ZapfDingbatsEncoding = [
  11646. '',
  11647. '',
  11648. '',
  11649. '',
  11650. '',
  11651. '',
  11652. '',
  11653. '',
  11654. '',
  11655. '',
  11656. '',
  11657. '',
  11658. '',
  11659. '',
  11660. '',
  11661. '',
  11662. '',
  11663. '',
  11664. '',
  11665. '',
  11666. '',
  11667. '',
  11668. '',
  11669. '',
  11670. '',
  11671. '',
  11672. '',
  11673. '',
  11674. '',
  11675. '',
  11676. '',
  11677. '',
  11678. 'space',
  11679. 'a1',
  11680. 'a2',
  11681. 'a202',
  11682. 'a3',
  11683. 'a4',
  11684. 'a5',
  11685. 'a119',
  11686. 'a118',
  11687. 'a117',
  11688. 'a11',
  11689. 'a12',
  11690. 'a13',
  11691. 'a14',
  11692. 'a15',
  11693. 'a16',
  11694. 'a105',
  11695. 'a17',
  11696. 'a18',
  11697. 'a19',
  11698. 'a20',
  11699. 'a21',
  11700. 'a22',
  11701. 'a23',
  11702. 'a24',
  11703. 'a25',
  11704. 'a26',
  11705. 'a27',
  11706. 'a28',
  11707. 'a6',
  11708. 'a7',
  11709. 'a8',
  11710. 'a9',
  11711. 'a10',
  11712. 'a29',
  11713. 'a30',
  11714. 'a31',
  11715. 'a32',
  11716. 'a33',
  11717. 'a34',
  11718. 'a35',
  11719. 'a36',
  11720. 'a37',
  11721. 'a38',
  11722. 'a39',
  11723. 'a40',
  11724. 'a41',
  11725. 'a42',
  11726. 'a43',
  11727. 'a44',
  11728. 'a45',
  11729. 'a46',
  11730. 'a47',
  11731. 'a48',
  11732. 'a49',
  11733. 'a50',
  11734. 'a51',
  11735. 'a52',
  11736. 'a53',
  11737. 'a54',
  11738. 'a55',
  11739. 'a56',
  11740. 'a57',
  11741. 'a58',
  11742. 'a59',
  11743. 'a60',
  11744. 'a61',
  11745. 'a62',
  11746. 'a63',
  11747. 'a64',
  11748. 'a65',
  11749. 'a66',
  11750. 'a67',
  11751. 'a68',
  11752. 'a69',
  11753. 'a70',
  11754. 'a71',
  11755. 'a72',
  11756. 'a73',
  11757. 'a74',
  11758. 'a203',
  11759. 'a75',
  11760. 'a204',
  11761. 'a76',
  11762. 'a77',
  11763. 'a78',
  11764. 'a79',
  11765. 'a81',
  11766. 'a82',
  11767. 'a83',
  11768. 'a84',
  11769. 'a97',
  11770. 'a98',
  11771. 'a99',
  11772. 'a100',
  11773. '',
  11774. 'a89',
  11775. 'a90',
  11776. 'a93',
  11777. 'a94',
  11778. 'a91',
  11779. 'a92',
  11780. 'a205',
  11781. 'a85',
  11782. 'a206',
  11783. 'a86',
  11784. 'a87',
  11785. 'a88',
  11786. 'a95',
  11787. 'a96',
  11788. '',
  11789. '',
  11790. '',
  11791. '',
  11792. '',
  11793. '',
  11794. '',
  11795. '',
  11796. '',
  11797. '',
  11798. '',
  11799. '',
  11800. '',
  11801. '',
  11802. '',
  11803. '',
  11804. '',
  11805. '',
  11806. '',
  11807. 'a101',
  11808. 'a102',
  11809. 'a103',
  11810. 'a104',
  11811. 'a106',
  11812. 'a107',
  11813. 'a108',
  11814. 'a112',
  11815. 'a111',
  11816. 'a110',
  11817. 'a109',
  11818. 'a120',
  11819. 'a121',
  11820. 'a122',
  11821. 'a123',
  11822. 'a124',
  11823. 'a125',
  11824. 'a126',
  11825. 'a127',
  11826. 'a128',
  11827. 'a129',
  11828. 'a130',
  11829. 'a131',
  11830. 'a132',
  11831. 'a133',
  11832. 'a134',
  11833. 'a135',
  11834. 'a136',
  11835. 'a137',
  11836. 'a138',
  11837. 'a139',
  11838. 'a140',
  11839. 'a141',
  11840. 'a142',
  11841. 'a143',
  11842. 'a144',
  11843. 'a145',
  11844. 'a146',
  11845. 'a147',
  11846. 'a148',
  11847. 'a149',
  11848. 'a150',
  11849. 'a151',
  11850. 'a152',
  11851. 'a153',
  11852. 'a154',
  11853. 'a155',
  11854. 'a156',
  11855. 'a157',
  11856. 'a158',
  11857. 'a159',
  11858. 'a160',
  11859. 'a161',
  11860. 'a163',
  11861. 'a164',
  11862. 'a196',
  11863. 'a165',
  11864. 'a192',
  11865. 'a166',
  11866. 'a167',
  11867. 'a168',
  11868. 'a169',
  11869. 'a170',
  11870. 'a171',
  11871. 'a172',
  11872. 'a173',
  11873. 'a162',
  11874. 'a174',
  11875. 'a175',
  11876. 'a176',
  11877. 'a177',
  11878. 'a178',
  11879. 'a179',
  11880. 'a193',
  11881. 'a180',
  11882. 'a199',
  11883. 'a181',
  11884. 'a200',
  11885. 'a182',
  11886. '',
  11887. 'a201',
  11888. 'a183',
  11889. 'a184',
  11890. 'a197',
  11891. 'a185',
  11892. 'a194',
  11893. 'a198',
  11894. 'a186',
  11895. 'a195',
  11896. 'a187',
  11897. 'a188',
  11898. 'a189',
  11899. 'a190',
  11900. 'a191'
  11901. ];
  11902. function getEncoding(encodingName) {
  11903. switch (encodingName) {
  11904. case 'WinAnsiEncoding':
  11905. return WinAnsiEncoding;
  11906. case 'StandardEncoding':
  11907. return StandardEncoding;
  11908. case 'MacRomanEncoding':
  11909. return MacRomanEncoding;
  11910. case 'SymbolSetEncoding':
  11911. return SymbolSetEncoding;
  11912. case 'ZapfDingbatsEncoding':
  11913. return ZapfDingbatsEncoding;
  11914. case 'ExpertEncoding':
  11915. return ExpertEncoding;
  11916. case 'MacExpertEncoding':
  11917. return MacExpertEncoding;
  11918. default:
  11919. return null;
  11920. }
  11921. }
  11922. exports.WinAnsiEncoding = WinAnsiEncoding;
  11923. exports.StandardEncoding = StandardEncoding;
  11924. exports.MacRomanEncoding = MacRomanEncoding;
  11925. exports.SymbolSetEncoding = SymbolSetEncoding;
  11926. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  11927. exports.ExpertEncoding = ExpertEncoding;
  11928. exports.getEncoding = getEncoding;
  11929. /***/ }),
  11930. /* 5 */
  11931. /***/ (function(module, exports, __w_pdfjs_require__) {
  11932. "use strict";
  11933. var sharedUtil = __w_pdfjs_require__(0);
  11934. var corePrimitives = __w_pdfjs_require__(1);
  11935. var coreStream = __w_pdfjs_require__(2);
  11936. var MissingDataException = sharedUtil.MissingDataException;
  11937. var StreamType = sharedUtil.StreamType;
  11938. var assert = sharedUtil.assert;
  11939. var error = sharedUtil.error;
  11940. var info = sharedUtil.info;
  11941. var isArray = sharedUtil.isArray;
  11942. var isInt = sharedUtil.isInt;
  11943. var isNum = sharedUtil.isNum;
  11944. var isString = sharedUtil.isString;
  11945. var warn = sharedUtil.warn;
  11946. var EOF = corePrimitives.EOF;
  11947. var Cmd = corePrimitives.Cmd;
  11948. var Dict = corePrimitives.Dict;
  11949. var Name = corePrimitives.Name;
  11950. var Ref = corePrimitives.Ref;
  11951. var isEOF = corePrimitives.isEOF;
  11952. var isCmd = corePrimitives.isCmd;
  11953. var isDict = corePrimitives.isDict;
  11954. var isName = corePrimitives.isName;
  11955. var Ascii85Stream = coreStream.Ascii85Stream;
  11956. var AsciiHexStream = coreStream.AsciiHexStream;
  11957. var CCITTFaxStream = coreStream.CCITTFaxStream;
  11958. var FlateStream = coreStream.FlateStream;
  11959. var Jbig2Stream = coreStream.Jbig2Stream;
  11960. var JpegStream = coreStream.JpegStream;
  11961. var JpxStream = coreStream.JpxStream;
  11962. var LZWStream = coreStream.LZWStream;
  11963. var NullStream = coreStream.NullStream;
  11964. var PredictorStream = coreStream.PredictorStream;
  11965. var RunLengthStream = coreStream.RunLengthStream;
  11966. var MAX_LENGTH_TO_CACHE = 1000;
  11967. var Parser = function ParserClosure() {
  11968. function Parser(lexer, allowStreams, xref, recoveryMode) {
  11969. this.lexer = lexer;
  11970. this.allowStreams = allowStreams;
  11971. this.xref = xref;
  11972. this.recoveryMode = recoveryMode || false;
  11973. this.imageCache = Object.create(null);
  11974. this.refill();
  11975. }
  11976. Parser.prototype = {
  11977. refill: function Parser_refill() {
  11978. this.buf1 = this.lexer.getObj();
  11979. this.buf2 = this.lexer.getObj();
  11980. },
  11981. shift: function Parser_shift() {
  11982. if (isCmd(this.buf2, 'ID')) {
  11983. this.buf1 = this.buf2;
  11984. this.buf2 = null;
  11985. } else {
  11986. this.buf1 = this.buf2;
  11987. this.buf2 = this.lexer.getObj();
  11988. }
  11989. },
  11990. tryShift: function Parser_tryShift() {
  11991. try {
  11992. this.shift();
  11993. return true;
  11994. } catch (e) {
  11995. if (e instanceof MissingDataException) {
  11996. throw e;
  11997. }
  11998. return false;
  11999. }
  12000. },
  12001. getObj: function Parser_getObj(cipherTransform) {
  12002. var buf1 = this.buf1;
  12003. this.shift();
  12004. if (buf1 instanceof Cmd) {
  12005. switch (buf1.cmd) {
  12006. case 'BI':
  12007. return this.makeInlineImage(cipherTransform);
  12008. case '[':
  12009. var array = [];
  12010. while (!isCmd(this.buf1, ']') && !isEOF(this.buf1)) {
  12011. array.push(this.getObj(cipherTransform));
  12012. }
  12013. if (isEOF(this.buf1)) {
  12014. if (!this.recoveryMode) {
  12015. error('End of file inside array');
  12016. }
  12017. return array;
  12018. }
  12019. this.shift();
  12020. return array;
  12021. case '<<':
  12022. var dict = new Dict(this.xref);
  12023. while (!isCmd(this.buf1, '>>') && !isEOF(this.buf1)) {
  12024. if (!isName(this.buf1)) {
  12025. info('Malformed dictionary: key must be a name object');
  12026. this.shift();
  12027. continue;
  12028. }
  12029. var key = this.buf1.name;
  12030. this.shift();
  12031. if (isEOF(this.buf1)) {
  12032. break;
  12033. }
  12034. dict.set(key, this.getObj(cipherTransform));
  12035. }
  12036. if (isEOF(this.buf1)) {
  12037. if (!this.recoveryMode) {
  12038. error('End of file inside dictionary');
  12039. }
  12040. return dict;
  12041. }
  12042. if (isCmd(this.buf2, 'stream')) {
  12043. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  12044. }
  12045. this.shift();
  12046. return dict;
  12047. default:
  12048. return buf1;
  12049. }
  12050. }
  12051. if (isInt(buf1)) {
  12052. var num = buf1;
  12053. if (isInt(this.buf1) && isCmd(this.buf2, 'R')) {
  12054. var ref = new Ref(num, this.buf1);
  12055. this.shift();
  12056. this.shift();
  12057. return ref;
  12058. }
  12059. return num;
  12060. }
  12061. if (isString(buf1)) {
  12062. var str = buf1;
  12063. if (cipherTransform) {
  12064. str = cipherTransform.decryptString(str);
  12065. }
  12066. return str;
  12067. }
  12068. return buf1;
  12069. },
  12070. findDefaultInlineStreamEnd: function Parser_findDefaultInlineStreamEnd(stream) {
  12071. var E = 0x45, I = 0x49, SPACE = 0x20, LF = 0xA, CR = 0xD;
  12072. var startPos = stream.pos, state = 0, ch, i, n, followingBytes;
  12073. while ((ch = stream.getByte()) !== -1) {
  12074. if (state === 0) {
  12075. state = ch === E ? 1 : 0;
  12076. } else if (state === 1) {
  12077. state = ch === I ? 2 : 0;
  12078. } else {
  12079. assert(state === 2);
  12080. if (ch === SPACE || ch === LF || ch === CR) {
  12081. n = 5;
  12082. followingBytes = stream.peekBytes(n);
  12083. for (i = 0; i < n; i++) {
  12084. ch = followingBytes[i];
  12085. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7F)) {
  12086. state = 0;
  12087. break;
  12088. }
  12089. }
  12090. if (state === 2) {
  12091. break;
  12092. }
  12093. } else {
  12094. state = 0;
  12095. }
  12096. }
  12097. }
  12098. return stream.pos - 4 - startPos;
  12099. },
  12100. findDCTDecodeInlineStreamEnd: function Parser_findDCTDecodeInlineStreamEnd(stream) {
  12101. var startPos = stream.pos, foundEOI = false, b, markerLength, length;
  12102. while ((b = stream.getByte()) !== -1) {
  12103. if (b !== 0xFF) {
  12104. continue;
  12105. }
  12106. switch (stream.getByte()) {
  12107. case 0x00:
  12108. break;
  12109. case 0xFF:
  12110. stream.skip(-1);
  12111. break;
  12112. case 0xD9:
  12113. foundEOI = true;
  12114. break;
  12115. case 0xC0:
  12116. case 0xC1:
  12117. case 0xC2:
  12118. case 0xC3:
  12119. case 0xC5:
  12120. case 0xC6:
  12121. case 0xC7:
  12122. case 0xC9:
  12123. case 0xCA:
  12124. case 0xCB:
  12125. case 0xCD:
  12126. case 0xCE:
  12127. case 0xCF:
  12128. case 0xC4:
  12129. case 0xCC:
  12130. case 0xDA:
  12131. case 0xDB:
  12132. case 0xDC:
  12133. case 0xDD:
  12134. case 0xDE:
  12135. case 0xDF:
  12136. case 0xE0:
  12137. case 0xE1:
  12138. case 0xE2:
  12139. case 0xE3:
  12140. case 0xE4:
  12141. case 0xE5:
  12142. case 0xE6:
  12143. case 0xE7:
  12144. case 0xE8:
  12145. case 0xE9:
  12146. case 0xEA:
  12147. case 0xEB:
  12148. case 0xEC:
  12149. case 0xED:
  12150. case 0xEE:
  12151. case 0xEF:
  12152. case 0xFE:
  12153. markerLength = stream.getUint16();
  12154. if (markerLength > 2) {
  12155. stream.skip(markerLength - 2);
  12156. } else {
  12157. stream.skip(-2);
  12158. }
  12159. break;
  12160. }
  12161. if (foundEOI) {
  12162. break;
  12163. }
  12164. }
  12165. length = stream.pos - startPos;
  12166. if (b === -1) {
  12167. warn('Inline DCTDecode image stream: ' + 'EOI marker not found, searching for /EI/ instead.');
  12168. stream.skip(-length);
  12169. return this.findDefaultInlineStreamEnd(stream);
  12170. }
  12171. this.inlineStreamSkipEI(stream);
  12172. return length;
  12173. },
  12174. findASCII85DecodeInlineStreamEnd: function Parser_findASCII85DecodeInlineStreamEnd(stream) {
  12175. var TILDE = 0x7E, GT = 0x3E;
  12176. var startPos = stream.pos, ch, length;
  12177. while ((ch = stream.getByte()) !== -1) {
  12178. if (ch === TILDE && stream.peekByte() === GT) {
  12179. stream.skip();
  12180. break;
  12181. }
  12182. }
  12183. length = stream.pos - startPos;
  12184. if (ch === -1) {
  12185. warn('Inline ASCII85Decode image stream: ' + 'EOD marker not found, searching for /EI/ instead.');
  12186. stream.skip(-length);
  12187. return this.findDefaultInlineStreamEnd(stream);
  12188. }
  12189. this.inlineStreamSkipEI(stream);
  12190. return length;
  12191. },
  12192. findASCIIHexDecodeInlineStreamEnd: function Parser_findASCIIHexDecodeInlineStreamEnd(stream) {
  12193. var GT = 0x3E;
  12194. var startPos = stream.pos, ch, length;
  12195. while ((ch = stream.getByte()) !== -1) {
  12196. if (ch === GT) {
  12197. break;
  12198. }
  12199. }
  12200. length = stream.pos - startPos;
  12201. if (ch === -1) {
  12202. warn('Inline ASCIIHexDecode image stream: ' + 'EOD marker not found, searching for /EI/ instead.');
  12203. stream.skip(-length);
  12204. return this.findDefaultInlineStreamEnd(stream);
  12205. }
  12206. this.inlineStreamSkipEI(stream);
  12207. return length;
  12208. },
  12209. inlineStreamSkipEI: function Parser_inlineStreamSkipEI(stream) {
  12210. var E = 0x45, I = 0x49;
  12211. var state = 0, ch;
  12212. while ((ch = stream.getByte()) !== -1) {
  12213. if (state === 0) {
  12214. state = ch === E ? 1 : 0;
  12215. } else if (state === 1) {
  12216. state = ch === I ? 2 : 0;
  12217. } else if (state === 2) {
  12218. break;
  12219. }
  12220. }
  12221. },
  12222. makeInlineImage: function Parser_makeInlineImage(cipherTransform) {
  12223. var lexer = this.lexer;
  12224. var stream = lexer.stream;
  12225. var dict = new Dict(this.xref);
  12226. while (!isCmd(this.buf1, 'ID') && !isEOF(this.buf1)) {
  12227. if (!isName(this.buf1)) {
  12228. error('Dictionary key must be a name object');
  12229. }
  12230. var key = this.buf1.name;
  12231. this.shift();
  12232. if (isEOF(this.buf1)) {
  12233. break;
  12234. }
  12235. dict.set(key, this.getObj(cipherTransform));
  12236. }
  12237. var filter = dict.get('Filter', 'F'), filterName;
  12238. if (isName(filter)) {
  12239. filterName = filter.name;
  12240. } else if (isArray(filter)) {
  12241. var filterZero = this.xref.fetchIfRef(filter[0]);
  12242. if (isName(filterZero)) {
  12243. filterName = filterZero.name;
  12244. }
  12245. }
  12246. var startPos = stream.pos, length, i, ii;
  12247. if (filterName === 'DCTDecode' || filterName === 'DCT') {
  12248. length = this.findDCTDecodeInlineStreamEnd(stream);
  12249. } else if (filterName === 'ASCII85Decide' || filterName === 'A85') {
  12250. length = this.findASCII85DecodeInlineStreamEnd(stream);
  12251. } else if (filterName === 'ASCIIHexDecode' || filterName === 'AHx') {
  12252. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  12253. } else {
  12254. length = this.findDefaultInlineStreamEnd(stream);
  12255. }
  12256. var imageStream = stream.makeSubStream(startPos, length, dict);
  12257. var adler32;
  12258. if (length < MAX_LENGTH_TO_CACHE) {
  12259. var imageBytes = imageStream.getBytes();
  12260. imageStream.reset();
  12261. var a = 1;
  12262. var b = 0;
  12263. for (i = 0, ii = imageBytes.length; i < ii; ++i) {
  12264. a += imageBytes[i] & 0xff;
  12265. b += a;
  12266. }
  12267. adler32 = b % 65521 << 16 | a % 65521;
  12268. if (this.imageCache.adler32 === adler32) {
  12269. this.buf2 = Cmd.get('EI');
  12270. this.shift();
  12271. this.imageCache[adler32].reset();
  12272. return this.imageCache[adler32];
  12273. }
  12274. }
  12275. if (cipherTransform) {
  12276. imageStream = cipherTransform.createStream(imageStream, length);
  12277. }
  12278. imageStream = this.filter(imageStream, dict, length);
  12279. imageStream.dict = dict;
  12280. if (adler32 !== undefined) {
  12281. imageStream.cacheKey = 'inline_' + length + '_' + adler32;
  12282. this.imageCache[adler32] = imageStream;
  12283. }
  12284. this.buf2 = Cmd.get('EI');
  12285. this.shift();
  12286. return imageStream;
  12287. },
  12288. makeStream: function Parser_makeStream(dict, cipherTransform) {
  12289. var lexer = this.lexer;
  12290. var stream = lexer.stream;
  12291. lexer.skipToNextLine();
  12292. var pos = stream.pos - 1;
  12293. var length = dict.get('Length');
  12294. if (!isInt(length)) {
  12295. info('Bad ' + length + ' attribute in stream');
  12296. length = 0;
  12297. }
  12298. stream.pos = pos + length;
  12299. lexer.nextChar();
  12300. if (this.tryShift() && isCmd(this.buf2, 'endstream')) {
  12301. this.shift();
  12302. } else {
  12303. stream.pos = pos;
  12304. var SCAN_BLOCK_SIZE = 2048;
  12305. var ENDSTREAM_SIGNATURE_LENGTH = 9;
  12306. var ENDSTREAM_SIGNATURE = [
  12307. 0x65,
  12308. 0x6E,
  12309. 0x64,
  12310. 0x73,
  12311. 0x74,
  12312. 0x72,
  12313. 0x65,
  12314. 0x61,
  12315. 0x6D
  12316. ];
  12317. var skipped = 0, found = false, i, j;
  12318. while (stream.pos < stream.end) {
  12319. var scanBytes = stream.peekBytes(SCAN_BLOCK_SIZE);
  12320. var scanLength = scanBytes.length - ENDSTREAM_SIGNATURE_LENGTH;
  12321. if (scanLength <= 0) {
  12322. break;
  12323. }
  12324. found = false;
  12325. i = 0;
  12326. while (i < scanLength) {
  12327. j = 0;
  12328. while (j < ENDSTREAM_SIGNATURE_LENGTH && scanBytes[i + j] === ENDSTREAM_SIGNATURE[j]) {
  12329. j++;
  12330. }
  12331. if (j >= ENDSTREAM_SIGNATURE_LENGTH) {
  12332. found = true;
  12333. break;
  12334. }
  12335. i++;
  12336. }
  12337. if (found) {
  12338. skipped += i;
  12339. stream.pos += i;
  12340. break;
  12341. }
  12342. skipped += scanLength;
  12343. stream.pos += scanLength;
  12344. }
  12345. if (!found) {
  12346. error('Missing endstream');
  12347. }
  12348. length = skipped;
  12349. lexer.nextChar();
  12350. this.shift();
  12351. this.shift();
  12352. }
  12353. this.shift();
  12354. stream = stream.makeSubStream(pos, length, dict);
  12355. if (cipherTransform) {
  12356. stream = cipherTransform.createStream(stream, length);
  12357. }
  12358. stream = this.filter(stream, dict, length);
  12359. stream.dict = dict;
  12360. return stream;
  12361. },
  12362. filter: function Parser_filter(stream, dict, length) {
  12363. var filter = dict.get('Filter', 'F');
  12364. var params = dict.get('DecodeParms', 'DP');
  12365. if (isName(filter)) {
  12366. if (isArray(params)) {
  12367. params = this.xref.fetchIfRef(params[0]);
  12368. }
  12369. return this.makeFilter(stream, filter.name, length, params);
  12370. }
  12371. var maybeLength = length;
  12372. if (isArray(filter)) {
  12373. var filterArray = filter;
  12374. var paramsArray = params;
  12375. for (var i = 0, ii = filterArray.length; i < ii; ++i) {
  12376. filter = this.xref.fetchIfRef(filterArray[i]);
  12377. if (!isName(filter)) {
  12378. error('Bad filter name: ' + filter);
  12379. }
  12380. params = null;
  12381. if (isArray(paramsArray) && i in paramsArray) {
  12382. params = this.xref.fetchIfRef(paramsArray[i]);
  12383. }
  12384. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  12385. maybeLength = null;
  12386. }
  12387. }
  12388. return stream;
  12389. },
  12390. makeFilter: function Parser_makeFilter(stream, name, maybeLength, params) {
  12391. if (maybeLength === 0) {
  12392. warn('Empty "' + name + '" stream.');
  12393. return new NullStream(stream);
  12394. }
  12395. try {
  12396. var xrefStreamStats = this.xref.stats.streamTypes;
  12397. if (name === 'FlateDecode' || name === 'Fl') {
  12398. xrefStreamStats[StreamType.FLATE] = true;
  12399. if (params) {
  12400. return new PredictorStream(new FlateStream(stream, maybeLength), maybeLength, params);
  12401. }
  12402. return new FlateStream(stream, maybeLength);
  12403. }
  12404. if (name === 'LZWDecode' || name === 'LZW') {
  12405. xrefStreamStats[StreamType.LZW] = true;
  12406. var earlyChange = 1;
  12407. if (params) {
  12408. if (params.has('EarlyChange')) {
  12409. earlyChange = params.get('EarlyChange');
  12410. }
  12411. return new PredictorStream(new LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  12412. }
  12413. return new LZWStream(stream, maybeLength, earlyChange);
  12414. }
  12415. if (name === 'DCTDecode' || name === 'DCT') {
  12416. xrefStreamStats[StreamType.DCT] = true;
  12417. return new JpegStream(stream, maybeLength, stream.dict, params);
  12418. }
  12419. if (name === 'JPXDecode' || name === 'JPX') {
  12420. xrefStreamStats[StreamType.JPX] = true;
  12421. return new JpxStream(stream, maybeLength, stream.dict, params);
  12422. }
  12423. if (name === 'ASCII85Decode' || name === 'A85') {
  12424. xrefStreamStats[StreamType.A85] = true;
  12425. return new Ascii85Stream(stream, maybeLength);
  12426. }
  12427. if (name === 'ASCIIHexDecode' || name === 'AHx') {
  12428. xrefStreamStats[StreamType.AHX] = true;
  12429. return new AsciiHexStream(stream, maybeLength);
  12430. }
  12431. if (name === 'CCITTFaxDecode' || name === 'CCF') {
  12432. xrefStreamStats[StreamType.CCF] = true;
  12433. return new CCITTFaxStream(stream, maybeLength, params);
  12434. }
  12435. if (name === 'RunLengthDecode' || name === 'RL') {
  12436. xrefStreamStats[StreamType.RL] = true;
  12437. return new RunLengthStream(stream, maybeLength);
  12438. }
  12439. if (name === 'JBIG2Decode') {
  12440. xrefStreamStats[StreamType.JBIG] = true;
  12441. return new Jbig2Stream(stream, maybeLength, stream.dict, params);
  12442. }
  12443. warn('filter "' + name + '" not supported yet');
  12444. return stream;
  12445. } catch (ex) {
  12446. if (ex instanceof MissingDataException) {
  12447. throw ex;
  12448. }
  12449. warn('Invalid stream: \"' + ex + '\"');
  12450. return new NullStream(stream);
  12451. }
  12452. }
  12453. };
  12454. return Parser;
  12455. }();
  12456. var Lexer = function LexerClosure() {
  12457. function Lexer(stream, knownCommands) {
  12458. this.stream = stream;
  12459. this.nextChar();
  12460. this.strBuf = [];
  12461. this.knownCommands = knownCommands;
  12462. }
  12463. var specialChars = [
  12464. 1,
  12465. 0,
  12466. 0,
  12467. 0,
  12468. 0,
  12469. 0,
  12470. 0,
  12471. 0,
  12472. 0,
  12473. 1,
  12474. 1,
  12475. 0,
  12476. 1,
  12477. 1,
  12478. 0,
  12479. 0,
  12480. 0,
  12481. 0,
  12482. 0,
  12483. 0,
  12484. 0,
  12485. 0,
  12486. 0,
  12487. 0,
  12488. 0,
  12489. 0,
  12490. 0,
  12491. 0,
  12492. 0,
  12493. 0,
  12494. 0,
  12495. 0,
  12496. 1,
  12497. 0,
  12498. 0,
  12499. 0,
  12500. 0,
  12501. 2,
  12502. 0,
  12503. 0,
  12504. 2,
  12505. 2,
  12506. 0,
  12507. 0,
  12508. 0,
  12509. 0,
  12510. 0,
  12511. 2,
  12512. 0,
  12513. 0,
  12514. 0,
  12515. 0,
  12516. 0,
  12517. 0,
  12518. 0,
  12519. 0,
  12520. 0,
  12521. 0,
  12522. 0,
  12523. 0,
  12524. 2,
  12525. 0,
  12526. 2,
  12527. 0,
  12528. 0,
  12529. 0,
  12530. 0,
  12531. 0,
  12532. 0,
  12533. 0,
  12534. 0,
  12535. 0,
  12536. 0,
  12537. 0,
  12538. 0,
  12539. 0,
  12540. 0,
  12541. 0,
  12542. 0,
  12543. 0,
  12544. 0,
  12545. 0,
  12546. 0,
  12547. 0,
  12548. 0,
  12549. 0,
  12550. 0,
  12551. 0,
  12552. 0,
  12553. 0,
  12554. 0,
  12555. 2,
  12556. 0,
  12557. 2,
  12558. 0,
  12559. 0,
  12560. 0,
  12561. 0,
  12562. 0,
  12563. 0,
  12564. 0,
  12565. 0,
  12566. 0,
  12567. 0,
  12568. 0,
  12569. 0,
  12570. 0,
  12571. 0,
  12572. 0,
  12573. 0,
  12574. 0,
  12575. 0,
  12576. 0,
  12577. 0,
  12578. 0,
  12579. 0,
  12580. 0,
  12581. 0,
  12582. 0,
  12583. 0,
  12584. 0,
  12585. 0,
  12586. 0,
  12587. 2,
  12588. 0,
  12589. 2,
  12590. 0,
  12591. 0,
  12592. 0,
  12593. 0,
  12594. 0,
  12595. 0,
  12596. 0,
  12597. 0,
  12598. 0,
  12599. 0,
  12600. 0,
  12601. 0,
  12602. 0,
  12603. 0,
  12604. 0,
  12605. 0,
  12606. 0,
  12607. 0,
  12608. 0,
  12609. 0,
  12610. 0,
  12611. 0,
  12612. 0,
  12613. 0,
  12614. 0,
  12615. 0,
  12616. 0,
  12617. 0,
  12618. 0,
  12619. 0,
  12620. 0,
  12621. 0,
  12622. 0,
  12623. 0,
  12624. 0,
  12625. 0,
  12626. 0,
  12627. 0,
  12628. 0,
  12629. 0,
  12630. 0,
  12631. 0,
  12632. 0,
  12633. 0,
  12634. 0,
  12635. 0,
  12636. 0,
  12637. 0,
  12638. 0,
  12639. 0,
  12640. 0,
  12641. 0,
  12642. 0,
  12643. 0,
  12644. 0,
  12645. 0,
  12646. 0,
  12647. 0,
  12648. 0,
  12649. 0,
  12650. 0,
  12651. 0,
  12652. 0,
  12653. 0,
  12654. 0,
  12655. 0,
  12656. 0,
  12657. 0,
  12658. 0,
  12659. 0,
  12660. 0,
  12661. 0,
  12662. 0,
  12663. 0,
  12664. 0,
  12665. 0,
  12666. 0,
  12667. 0,
  12668. 0,
  12669. 0,
  12670. 0,
  12671. 0,
  12672. 0,
  12673. 0,
  12674. 0,
  12675. 0,
  12676. 0,
  12677. 0,
  12678. 0,
  12679. 0,
  12680. 0,
  12681. 0,
  12682. 0,
  12683. 0,
  12684. 0,
  12685. 0,
  12686. 0,
  12687. 0,
  12688. 0,
  12689. 0,
  12690. 0,
  12691. 0,
  12692. 0,
  12693. 0,
  12694. 0,
  12695. 0,
  12696. 0,
  12697. 0,
  12698. 0,
  12699. 0,
  12700. 0,
  12701. 0,
  12702. 0,
  12703. 0,
  12704. 0,
  12705. 0,
  12706. 0,
  12707. 0,
  12708. 0,
  12709. 0,
  12710. 0,
  12711. 0,
  12712. 0,
  12713. 0,
  12714. 0,
  12715. 0,
  12716. 0,
  12717. 0,
  12718. 0,
  12719. 0
  12720. ];
  12721. function toHexDigit(ch) {
  12722. if (ch >= 0x30 && ch <= 0x39) {
  12723. return ch & 0x0F;
  12724. }
  12725. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  12726. return (ch & 0x0F) + 9;
  12727. }
  12728. return -1;
  12729. }
  12730. Lexer.prototype = {
  12731. nextChar: function Lexer_nextChar() {
  12732. return this.currentChar = this.stream.getByte();
  12733. },
  12734. peekChar: function Lexer_peekChar() {
  12735. return this.stream.peekByte();
  12736. },
  12737. getNumber: function Lexer_getNumber() {
  12738. var ch = this.currentChar;
  12739. var eNotation = false;
  12740. var divideBy = 0;
  12741. var sign = 1;
  12742. if (ch === 0x2D) {
  12743. sign = -1;
  12744. ch = this.nextChar();
  12745. if (ch === 0x2D) {
  12746. ch = this.nextChar();
  12747. }
  12748. } else if (ch === 0x2B) {
  12749. ch = this.nextChar();
  12750. }
  12751. if (ch === 0x2E) {
  12752. divideBy = 10;
  12753. ch = this.nextChar();
  12754. }
  12755. if (ch < 0x30 || ch > 0x39) {
  12756. error('Invalid number: ' + String.fromCharCode(ch));
  12757. return 0;
  12758. }
  12759. var baseValue = ch - 0x30;
  12760. var powerValue = 0;
  12761. var powerValueSign = 1;
  12762. while ((ch = this.nextChar()) >= 0) {
  12763. if (0x30 <= ch && ch <= 0x39) {
  12764. var currentDigit = ch - 0x30;
  12765. if (eNotation) {
  12766. powerValue = powerValue * 10 + currentDigit;
  12767. } else {
  12768. if (divideBy !== 0) {
  12769. divideBy *= 10;
  12770. }
  12771. baseValue = baseValue * 10 + currentDigit;
  12772. }
  12773. } else if (ch === 0x2E) {
  12774. if (divideBy === 0) {
  12775. divideBy = 1;
  12776. } else {
  12777. break;
  12778. }
  12779. } else if (ch === 0x2D) {
  12780. warn('Badly formatted number');
  12781. } else if (ch === 0x45 || ch === 0x65) {
  12782. ch = this.peekChar();
  12783. if (ch === 0x2B || ch === 0x2D) {
  12784. powerValueSign = ch === 0x2D ? -1 : 1;
  12785. this.nextChar();
  12786. } else if (ch < 0x30 || ch > 0x39) {
  12787. break;
  12788. }
  12789. eNotation = true;
  12790. } else {
  12791. break;
  12792. }
  12793. }
  12794. if (divideBy !== 0) {
  12795. baseValue /= divideBy;
  12796. }
  12797. if (eNotation) {
  12798. baseValue *= Math.pow(10, powerValueSign * powerValue);
  12799. }
  12800. return sign * baseValue;
  12801. },
  12802. getString: function Lexer_getString() {
  12803. var numParen = 1;
  12804. var done = false;
  12805. var strBuf = this.strBuf;
  12806. strBuf.length = 0;
  12807. var ch = this.nextChar();
  12808. while (true) {
  12809. var charBuffered = false;
  12810. switch (ch | 0) {
  12811. case -1:
  12812. warn('Unterminated string');
  12813. done = true;
  12814. break;
  12815. case 0x28:
  12816. ++numParen;
  12817. strBuf.push('(');
  12818. break;
  12819. case 0x29:
  12820. if (--numParen === 0) {
  12821. this.nextChar();
  12822. done = true;
  12823. } else {
  12824. strBuf.push(')');
  12825. }
  12826. break;
  12827. case 0x5C:
  12828. ch = this.nextChar();
  12829. switch (ch) {
  12830. case -1:
  12831. warn('Unterminated string');
  12832. done = true;
  12833. break;
  12834. case 0x6E:
  12835. strBuf.push('\n');
  12836. break;
  12837. case 0x72:
  12838. strBuf.push('\r');
  12839. break;
  12840. case 0x74:
  12841. strBuf.push('\t');
  12842. break;
  12843. case 0x62:
  12844. strBuf.push('\b');
  12845. break;
  12846. case 0x66:
  12847. strBuf.push('\f');
  12848. break;
  12849. case 0x5C:
  12850. case 0x28:
  12851. case 0x29:
  12852. strBuf.push(String.fromCharCode(ch));
  12853. break;
  12854. case 0x30:
  12855. case 0x31:
  12856. case 0x32:
  12857. case 0x33:
  12858. case 0x34:
  12859. case 0x35:
  12860. case 0x36:
  12861. case 0x37:
  12862. var x = ch & 0x0F;
  12863. ch = this.nextChar();
  12864. charBuffered = true;
  12865. if (ch >= 0x30 && ch <= 0x37) {
  12866. x = (x << 3) + (ch & 0x0F);
  12867. ch = this.nextChar();
  12868. if (ch >= 0x30 && ch <= 0x37) {
  12869. charBuffered = false;
  12870. x = (x << 3) + (ch & 0x0F);
  12871. }
  12872. }
  12873. strBuf.push(String.fromCharCode(x));
  12874. break;
  12875. case 0x0D:
  12876. if (this.peekChar() === 0x0A) {
  12877. this.nextChar();
  12878. }
  12879. break;
  12880. case 0x0A:
  12881. break;
  12882. default:
  12883. strBuf.push(String.fromCharCode(ch));
  12884. break;
  12885. }
  12886. break;
  12887. default:
  12888. strBuf.push(String.fromCharCode(ch));
  12889. break;
  12890. }
  12891. if (done) {
  12892. break;
  12893. }
  12894. if (!charBuffered) {
  12895. ch = this.nextChar();
  12896. }
  12897. }
  12898. return strBuf.join('');
  12899. },
  12900. getName: function Lexer_getName() {
  12901. var ch, previousCh;
  12902. var strBuf = this.strBuf;
  12903. strBuf.length = 0;
  12904. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  12905. if (ch === 0x23) {
  12906. ch = this.nextChar();
  12907. if (specialChars[ch]) {
  12908. warn('Lexer_getName: ' + 'NUMBER SIGN (#) should be followed by a hexadecimal number.');
  12909. strBuf.push('#');
  12910. break;
  12911. }
  12912. var x = toHexDigit(ch);
  12913. if (x !== -1) {
  12914. previousCh = ch;
  12915. ch = this.nextChar();
  12916. var x2 = toHexDigit(ch);
  12917. if (x2 === -1) {
  12918. warn('Lexer_getName: Illegal digit (' + String.fromCharCode(ch) + ') in hexadecimal number.');
  12919. strBuf.push('#', String.fromCharCode(previousCh));
  12920. if (specialChars[ch]) {
  12921. break;
  12922. }
  12923. strBuf.push(String.fromCharCode(ch));
  12924. continue;
  12925. }
  12926. strBuf.push(String.fromCharCode(x << 4 | x2));
  12927. } else {
  12928. strBuf.push('#', String.fromCharCode(ch));
  12929. }
  12930. } else {
  12931. strBuf.push(String.fromCharCode(ch));
  12932. }
  12933. }
  12934. if (strBuf.length > 127) {
  12935. warn('name token is longer than allowed by the spec: ' + strBuf.length);
  12936. }
  12937. return Name.get(strBuf.join(''));
  12938. },
  12939. getHexString: function Lexer_getHexString() {
  12940. var strBuf = this.strBuf;
  12941. strBuf.length = 0;
  12942. var ch = this.currentChar;
  12943. var isFirstHex = true;
  12944. var firstDigit;
  12945. var secondDigit;
  12946. while (true) {
  12947. if (ch < 0) {
  12948. warn('Unterminated hex string');
  12949. break;
  12950. } else if (ch === 0x3E) {
  12951. this.nextChar();
  12952. break;
  12953. } else if (specialChars[ch] === 1) {
  12954. ch = this.nextChar();
  12955. continue;
  12956. } else {
  12957. if (isFirstHex) {
  12958. firstDigit = toHexDigit(ch);
  12959. if (firstDigit === -1) {
  12960. warn('Ignoring invalid character "' + ch + '" in hex string');
  12961. ch = this.nextChar();
  12962. continue;
  12963. }
  12964. } else {
  12965. secondDigit = toHexDigit(ch);
  12966. if (secondDigit === -1) {
  12967. warn('Ignoring invalid character "' + ch + '" in hex string');
  12968. ch = this.nextChar();
  12969. continue;
  12970. }
  12971. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  12972. }
  12973. isFirstHex = !isFirstHex;
  12974. ch = this.nextChar();
  12975. }
  12976. }
  12977. return strBuf.join('');
  12978. },
  12979. getObj: function Lexer_getObj() {
  12980. var comment = false;
  12981. var ch = this.currentChar;
  12982. while (true) {
  12983. if (ch < 0) {
  12984. return EOF;
  12985. }
  12986. if (comment) {
  12987. if (ch === 0x0A || ch === 0x0D) {
  12988. comment = false;
  12989. }
  12990. } else if (ch === 0x25) {
  12991. comment = true;
  12992. } else if (specialChars[ch] !== 1) {
  12993. break;
  12994. }
  12995. ch = this.nextChar();
  12996. }
  12997. switch (ch | 0) {
  12998. case 0x30:
  12999. case 0x31:
  13000. case 0x32:
  13001. case 0x33:
  13002. case 0x34:
  13003. case 0x35:
  13004. case 0x36:
  13005. case 0x37:
  13006. case 0x38:
  13007. case 0x39:
  13008. case 0x2B:
  13009. case 0x2D:
  13010. case 0x2E:
  13011. return this.getNumber();
  13012. case 0x28:
  13013. return this.getString();
  13014. case 0x2F:
  13015. return this.getName();
  13016. case 0x5B:
  13017. this.nextChar();
  13018. return Cmd.get('[');
  13019. case 0x5D:
  13020. this.nextChar();
  13021. return Cmd.get(']');
  13022. case 0x3C:
  13023. ch = this.nextChar();
  13024. if (ch === 0x3C) {
  13025. this.nextChar();
  13026. return Cmd.get('<<');
  13027. }
  13028. return this.getHexString();
  13029. case 0x3E:
  13030. ch = this.nextChar();
  13031. if (ch === 0x3E) {
  13032. this.nextChar();
  13033. return Cmd.get('>>');
  13034. }
  13035. return Cmd.get('>');
  13036. case 0x7B:
  13037. this.nextChar();
  13038. return Cmd.get('{');
  13039. case 0x7D:
  13040. this.nextChar();
  13041. return Cmd.get('}');
  13042. case 0x29:
  13043. error('Illegal character: ' + ch);
  13044. break;
  13045. }
  13046. var str = String.fromCharCode(ch);
  13047. var knownCommands = this.knownCommands;
  13048. var knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  13049. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  13050. var possibleCommand = str + String.fromCharCode(ch);
  13051. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  13052. break;
  13053. }
  13054. if (str.length === 128) {
  13055. error('Command token too long: ' + str.length);
  13056. }
  13057. str = possibleCommand;
  13058. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  13059. }
  13060. if (str === 'true') {
  13061. return true;
  13062. }
  13063. if (str === 'false') {
  13064. return false;
  13065. }
  13066. if (str === 'null') {
  13067. return null;
  13068. }
  13069. return Cmd.get(str);
  13070. },
  13071. skipToNextLine: function Lexer_skipToNextLine() {
  13072. var ch = this.currentChar;
  13073. while (ch >= 0) {
  13074. if (ch === 0x0D) {
  13075. ch = this.nextChar();
  13076. if (ch === 0x0A) {
  13077. this.nextChar();
  13078. }
  13079. break;
  13080. } else if (ch === 0x0A) {
  13081. this.nextChar();
  13082. break;
  13083. }
  13084. ch = this.nextChar();
  13085. }
  13086. }
  13087. };
  13088. return Lexer;
  13089. }();
  13090. var Linearization = {
  13091. create: function LinearizationCreate(stream) {
  13092. function getInt(name, allowZeroValue) {
  13093. var obj = linDict.get(name);
  13094. if (isInt(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  13095. return obj;
  13096. }
  13097. throw new Error('The "' + name + '" parameter in the linearization ' + 'dictionary is invalid.');
  13098. }
  13099. function getHints() {
  13100. var hints = linDict.get('H'), hintsLength, item;
  13101. if (isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  13102. for (var index = 0; index < hintsLength; index++) {
  13103. if (!(isInt(item = hints[index]) && item > 0)) {
  13104. throw new Error('Hint (' + index + ') in the linearization dictionary is invalid.');
  13105. }
  13106. }
  13107. return hints;
  13108. }
  13109. throw new Error('Hint array in the linearization dictionary is invalid.');
  13110. }
  13111. var parser = new Parser(new Lexer(stream), false, null);
  13112. var obj1 = parser.getObj();
  13113. var obj2 = parser.getObj();
  13114. var obj3 = parser.getObj();
  13115. var linDict = parser.getObj();
  13116. var obj, length;
  13117. if (!(isInt(obj1) && isInt(obj2) && isCmd(obj3, 'obj') && isDict(linDict) && isNum(obj = linDict.get('Linearized')) && obj > 0)) {
  13118. return null;
  13119. } else if ((length = getInt('L')) !== stream.length) {
  13120. throw new Error('The "L" parameter in the linearization dictionary ' + 'does not equal the stream length.');
  13121. }
  13122. return {
  13123. length: length,
  13124. hints: getHints(),
  13125. objectNumberFirst: getInt('O'),
  13126. endFirst: getInt('E'),
  13127. numPages: getInt('N'),
  13128. mainXRefEntriesOffset: getInt('T'),
  13129. pageFirst: linDict.has('P') ? getInt('P', true) : 0
  13130. };
  13131. }
  13132. };
  13133. exports.Lexer = Lexer;
  13134. exports.Linearization = Linearization;
  13135. exports.Parser = Parser;
  13136. /***/ }),
  13137. /* 6 */
  13138. /***/ (function(module, exports, __w_pdfjs_require__) {
  13139. "use strict";
  13140. var sharedUtil = __w_pdfjs_require__(0);
  13141. var corePrimitives = __w_pdfjs_require__(1);
  13142. var corePsParser = __w_pdfjs_require__(35);
  13143. var error = sharedUtil.error;
  13144. var info = sharedUtil.info;
  13145. var isArray = sharedUtil.isArray;
  13146. var isBool = sharedUtil.isBool;
  13147. var isDict = corePrimitives.isDict;
  13148. var isStream = corePrimitives.isStream;
  13149. var PostScriptLexer = corePsParser.PostScriptLexer;
  13150. var PostScriptParser = corePsParser.PostScriptParser;
  13151. var PDFFunction = function PDFFunctionClosure() {
  13152. var CONSTRUCT_SAMPLED = 0;
  13153. var CONSTRUCT_INTERPOLATED = 2;
  13154. var CONSTRUCT_STICHED = 3;
  13155. var CONSTRUCT_POSTSCRIPT = 4;
  13156. return {
  13157. getSampleArray: function PDFFunction_getSampleArray(size, outputSize, bps, str) {
  13158. var i, ii;
  13159. var length = 1;
  13160. for (i = 0, ii = size.length; i < ii; i++) {
  13161. length *= size[i];
  13162. }
  13163. length *= outputSize;
  13164. var array = new Array(length);
  13165. var codeSize = 0;
  13166. var codeBuf = 0;
  13167. var sampleMul = 1.0 / (Math.pow(2.0, bps) - 1);
  13168. var strBytes = str.getBytes((length * bps + 7) / 8);
  13169. var strIdx = 0;
  13170. for (i = 0; i < length; i++) {
  13171. while (codeSize < bps) {
  13172. codeBuf <<= 8;
  13173. codeBuf |= strBytes[strIdx++];
  13174. codeSize += 8;
  13175. }
  13176. codeSize -= bps;
  13177. array[i] = (codeBuf >> codeSize) * sampleMul;
  13178. codeBuf &= (1 << codeSize) - 1;
  13179. }
  13180. return array;
  13181. },
  13182. getIR: function PDFFunction_getIR(xref, fn) {
  13183. var dict = fn.dict;
  13184. if (!dict) {
  13185. dict = fn;
  13186. }
  13187. var types = [
  13188. this.constructSampled,
  13189. null,
  13190. this.constructInterpolated,
  13191. this.constructStiched,
  13192. this.constructPostScript
  13193. ];
  13194. var typeNum = dict.get('FunctionType');
  13195. var typeFn = types[typeNum];
  13196. if (!typeFn) {
  13197. error('Unknown type of function');
  13198. }
  13199. return typeFn.call(this, fn, dict, xref);
  13200. },
  13201. fromIR: function PDFFunction_fromIR(IR) {
  13202. var type = IR[0];
  13203. switch (type) {
  13204. case CONSTRUCT_SAMPLED:
  13205. return this.constructSampledFromIR(IR);
  13206. case CONSTRUCT_INTERPOLATED:
  13207. return this.constructInterpolatedFromIR(IR);
  13208. case CONSTRUCT_STICHED:
  13209. return this.constructStichedFromIR(IR);
  13210. default:
  13211. return this.constructPostScriptFromIR(IR);
  13212. }
  13213. },
  13214. parse: function PDFFunction_parse(xref, fn) {
  13215. var IR = this.getIR(xref, fn);
  13216. return this.fromIR(IR);
  13217. },
  13218. parseArray: function PDFFunction_parseArray(xref, fnObj) {
  13219. if (!isArray(fnObj)) {
  13220. return this.parse(xref, fnObj);
  13221. }
  13222. var fnArray = [];
  13223. for (var j = 0, jj = fnObj.length; j < jj; j++) {
  13224. var obj = xref.fetchIfRef(fnObj[j]);
  13225. fnArray.push(PDFFunction.parse(xref, obj));
  13226. }
  13227. return function (src, srcOffset, dest, destOffset) {
  13228. for (var i = 0, ii = fnArray.length; i < ii; i++) {
  13229. fnArray[i](src, srcOffset, dest, destOffset + i);
  13230. }
  13231. };
  13232. },
  13233. constructSampled: function PDFFunction_constructSampled(str, dict) {
  13234. function toMultiArray(arr) {
  13235. var inputLength = arr.length;
  13236. var out = [];
  13237. var index = 0;
  13238. for (var i = 0; i < inputLength; i += 2) {
  13239. out[index] = [
  13240. arr[i],
  13241. arr[i + 1]
  13242. ];
  13243. ++index;
  13244. }
  13245. return out;
  13246. }
  13247. var domain = dict.getArray('Domain');
  13248. var range = dict.getArray('Range');
  13249. if (!domain || !range) {
  13250. error('No domain or range');
  13251. }
  13252. var inputSize = domain.length / 2;
  13253. var outputSize = range.length / 2;
  13254. domain = toMultiArray(domain);
  13255. range = toMultiArray(range);
  13256. var size = dict.get('Size');
  13257. var bps = dict.get('BitsPerSample');
  13258. var order = dict.get('Order') || 1;
  13259. if (order !== 1) {
  13260. info('No support for cubic spline interpolation: ' + order);
  13261. }
  13262. var encode = dict.getArray('Encode');
  13263. if (!encode) {
  13264. encode = [];
  13265. for (var i = 0; i < inputSize; ++i) {
  13266. encode.push(0);
  13267. encode.push(size[i] - 1);
  13268. }
  13269. }
  13270. encode = toMultiArray(encode);
  13271. var decode = dict.getArray('Decode');
  13272. if (!decode) {
  13273. decode = range;
  13274. } else {
  13275. decode = toMultiArray(decode);
  13276. }
  13277. var samples = this.getSampleArray(size, outputSize, bps, str);
  13278. return [
  13279. CONSTRUCT_SAMPLED,
  13280. inputSize,
  13281. domain,
  13282. encode,
  13283. decode,
  13284. samples,
  13285. size,
  13286. outputSize,
  13287. Math.pow(2, bps) - 1,
  13288. range
  13289. ];
  13290. },
  13291. constructSampledFromIR: function PDFFunction_constructSampledFromIR(IR) {
  13292. function interpolate(x, xmin, xmax, ymin, ymax) {
  13293. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  13294. }
  13295. return function constructSampledFromIRResult(src, srcOffset, dest, destOffset) {
  13296. var m = IR[1];
  13297. var domain = IR[2];
  13298. var encode = IR[3];
  13299. var decode = IR[4];
  13300. var samples = IR[5];
  13301. var size = IR[6];
  13302. var n = IR[7];
  13303. var range = IR[9];
  13304. var cubeVertices = 1 << m;
  13305. var cubeN = new Float64Array(cubeVertices);
  13306. var cubeVertex = new Uint32Array(cubeVertices);
  13307. var i, j;
  13308. for (j = 0; j < cubeVertices; j++) {
  13309. cubeN[j] = 1;
  13310. }
  13311. var k = n, pos = 1;
  13312. for (i = 0; i < m; ++i) {
  13313. var domain_2i = domain[i][0];
  13314. var domain_2i_1 = domain[i][1];
  13315. var xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  13316. var e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  13317. var size_i = size[i];
  13318. e = Math.min(Math.max(e, 0), size_i - 1);
  13319. var e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  13320. var n0 = e0 + 1 - e;
  13321. var n1 = e - e0;
  13322. var offset0 = e0 * k;
  13323. var offset1 = offset0 + k;
  13324. for (j = 0; j < cubeVertices; j++) {
  13325. if (j & pos) {
  13326. cubeN[j] *= n1;
  13327. cubeVertex[j] += offset1;
  13328. } else {
  13329. cubeN[j] *= n0;
  13330. cubeVertex[j] += offset0;
  13331. }
  13332. }
  13333. k *= size_i;
  13334. pos <<= 1;
  13335. }
  13336. for (j = 0; j < n; ++j) {
  13337. var rj = 0;
  13338. for (i = 0; i < cubeVertices; i++) {
  13339. rj += samples[cubeVertex[i] + j] * cubeN[i];
  13340. }
  13341. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  13342. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  13343. }
  13344. };
  13345. },
  13346. constructInterpolated: function PDFFunction_constructInterpolated(str, dict) {
  13347. var c0 = dict.getArray('C0') || [0];
  13348. var c1 = dict.getArray('C1') || [1];
  13349. var n = dict.get('N');
  13350. if (!isArray(c0) || !isArray(c1)) {
  13351. error('Illegal dictionary for interpolated function');
  13352. }
  13353. var length = c0.length;
  13354. var diff = [];
  13355. for (var i = 0; i < length; ++i) {
  13356. diff.push(c1[i] - c0[i]);
  13357. }
  13358. return [
  13359. CONSTRUCT_INTERPOLATED,
  13360. c0,
  13361. diff,
  13362. n
  13363. ];
  13364. },
  13365. constructInterpolatedFromIR: function PDFFunction_constructInterpolatedFromIR(IR) {
  13366. var c0 = IR[1];
  13367. var diff = IR[2];
  13368. var n = IR[3];
  13369. var length = diff.length;
  13370. return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOffset) {
  13371. var x = n === 1 ? src[srcOffset] : Math.pow(src[srcOffset], n);
  13372. for (var j = 0; j < length; ++j) {
  13373. dest[destOffset + j] = c0[j] + x * diff[j];
  13374. }
  13375. };
  13376. },
  13377. constructStiched: function PDFFunction_constructStiched(fn, dict, xref) {
  13378. var domain = dict.getArray('Domain');
  13379. if (!domain) {
  13380. error('No domain');
  13381. }
  13382. var inputSize = domain.length / 2;
  13383. if (inputSize !== 1) {
  13384. error('Bad domain for stiched function');
  13385. }
  13386. var fnRefs = dict.get('Functions');
  13387. var fns = [];
  13388. for (var i = 0, ii = fnRefs.length; i < ii; ++i) {
  13389. fns.push(PDFFunction.getIR(xref, xref.fetchIfRef(fnRefs[i])));
  13390. }
  13391. var bounds = dict.getArray('Bounds');
  13392. var encode = dict.getArray('Encode');
  13393. return [
  13394. CONSTRUCT_STICHED,
  13395. domain,
  13396. bounds,
  13397. encode,
  13398. fns
  13399. ];
  13400. },
  13401. constructStichedFromIR: function PDFFunction_constructStichedFromIR(IR) {
  13402. var domain = IR[1];
  13403. var bounds = IR[2];
  13404. var encode = IR[3];
  13405. var fnsIR = IR[4];
  13406. var fns = [];
  13407. var tmpBuf = new Float32Array(1);
  13408. for (var i = 0, ii = fnsIR.length; i < ii; i++) {
  13409. fns.push(PDFFunction.fromIR(fnsIR[i]));
  13410. }
  13411. return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) {
  13412. var clip = function constructStichedFromIRClip(v, min, max) {
  13413. if (v > max) {
  13414. v = max;
  13415. } else if (v < min) {
  13416. v = min;
  13417. }
  13418. return v;
  13419. };
  13420. var v = clip(src[srcOffset], domain[0], domain[1]);
  13421. for (var i = 0, ii = bounds.length; i < ii; ++i) {
  13422. if (v < bounds[i]) {
  13423. break;
  13424. }
  13425. }
  13426. var dmin = domain[0];
  13427. if (i > 0) {
  13428. dmin = bounds[i - 1];
  13429. }
  13430. var dmax = domain[1];
  13431. if (i < bounds.length) {
  13432. dmax = bounds[i];
  13433. }
  13434. var rmin = encode[2 * i];
  13435. var rmax = encode[2 * i + 1];
  13436. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  13437. fns[i](tmpBuf, 0, dest, destOffset);
  13438. };
  13439. },
  13440. constructPostScript: function PDFFunction_constructPostScript(fn, dict, xref) {
  13441. var domain = dict.getArray('Domain');
  13442. var range = dict.getArray('Range');
  13443. if (!domain) {
  13444. error('No domain.');
  13445. }
  13446. if (!range) {
  13447. error('No range.');
  13448. }
  13449. var lexer = new PostScriptLexer(fn);
  13450. var parser = new PostScriptParser(lexer);
  13451. var code = parser.parse();
  13452. return [
  13453. CONSTRUCT_POSTSCRIPT,
  13454. domain,
  13455. range,
  13456. code
  13457. ];
  13458. },
  13459. constructPostScriptFromIR: function PDFFunction_constructPostScriptFromIR(IR) {
  13460. var domain = IR[1];
  13461. var range = IR[2];
  13462. var code = IR[3];
  13463. var compiled = new PostScriptCompiler().compile(code, domain, range);
  13464. if (compiled) {
  13465. return new Function('src', 'srcOffset', 'dest', 'destOffset', compiled);
  13466. }
  13467. info('Unable to compile PS function');
  13468. var numOutputs = range.length >> 1;
  13469. var numInputs = domain.length >> 1;
  13470. var evaluator = new PostScriptEvaluator(code);
  13471. var cache = Object.create(null);
  13472. var MAX_CACHE_SIZE = 2048 * 4;
  13473. var cache_available = MAX_CACHE_SIZE;
  13474. var tmpBuf = new Float32Array(numInputs);
  13475. return function constructPostScriptFromIRResult(src, srcOffset, dest, destOffset) {
  13476. var i, value;
  13477. var key = '';
  13478. var input = tmpBuf;
  13479. for (i = 0; i < numInputs; i++) {
  13480. value = src[srcOffset + i];
  13481. input[i] = value;
  13482. key += value + '_';
  13483. }
  13484. var cachedValue = cache[key];
  13485. if (cachedValue !== undefined) {
  13486. dest.set(cachedValue, destOffset);
  13487. return;
  13488. }
  13489. var output = new Float32Array(numOutputs);
  13490. var stack = evaluator.execute(input);
  13491. var stackIndex = stack.length - numOutputs;
  13492. for (i = 0; i < numOutputs; i++) {
  13493. value = stack[stackIndex + i];
  13494. var bound = range[i * 2];
  13495. if (value < bound) {
  13496. value = bound;
  13497. } else {
  13498. bound = range[i * 2 + 1];
  13499. if (value > bound) {
  13500. value = bound;
  13501. }
  13502. }
  13503. output[i] = value;
  13504. }
  13505. if (cache_available > 0) {
  13506. cache_available--;
  13507. cache[key] = output;
  13508. }
  13509. dest.set(output, destOffset);
  13510. };
  13511. }
  13512. };
  13513. }();
  13514. function isPDFFunction(v) {
  13515. var fnDict;
  13516. if (typeof v !== 'object') {
  13517. return false;
  13518. } else if (isDict(v)) {
  13519. fnDict = v;
  13520. } else if (isStream(v)) {
  13521. fnDict = v.dict;
  13522. } else {
  13523. return false;
  13524. }
  13525. return fnDict.has('FunctionType');
  13526. }
  13527. var PostScriptStack = function PostScriptStackClosure() {
  13528. var MAX_STACK_SIZE = 100;
  13529. function PostScriptStack(initialStack) {
  13530. this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
  13531. }
  13532. PostScriptStack.prototype = {
  13533. push: function PostScriptStack_push(value) {
  13534. if (this.stack.length >= MAX_STACK_SIZE) {
  13535. error('PostScript function stack overflow.');
  13536. }
  13537. this.stack.push(value);
  13538. },
  13539. pop: function PostScriptStack_pop() {
  13540. if (this.stack.length <= 0) {
  13541. error('PostScript function stack underflow.');
  13542. }
  13543. return this.stack.pop();
  13544. },
  13545. copy: function PostScriptStack_copy(n) {
  13546. if (this.stack.length + n >= MAX_STACK_SIZE) {
  13547. error('PostScript function stack overflow.');
  13548. }
  13549. var stack = this.stack;
  13550. for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  13551. stack.push(stack[i]);
  13552. }
  13553. },
  13554. index: function PostScriptStack_index(n) {
  13555. this.push(this.stack[this.stack.length - n - 1]);
  13556. },
  13557. roll: function PostScriptStack_roll(n, p) {
  13558. var stack = this.stack;
  13559. var l = stack.length - n;
  13560. var r = stack.length - 1, c = l + (p - Math.floor(p / n) * n), i, j, t;
  13561. for (i = l, j = r; i < j; i++, j--) {
  13562. t = stack[i];
  13563. stack[i] = stack[j];
  13564. stack[j] = t;
  13565. }
  13566. for (i = l, j = c - 1; i < j; i++, j--) {
  13567. t = stack[i];
  13568. stack[i] = stack[j];
  13569. stack[j] = t;
  13570. }
  13571. for (i = c, j = r; i < j; i++, j--) {
  13572. t = stack[i];
  13573. stack[i] = stack[j];
  13574. stack[j] = t;
  13575. }
  13576. }
  13577. };
  13578. return PostScriptStack;
  13579. }();
  13580. var PostScriptEvaluator = function PostScriptEvaluatorClosure() {
  13581. function PostScriptEvaluator(operators) {
  13582. this.operators = operators;
  13583. }
  13584. PostScriptEvaluator.prototype = {
  13585. execute: function PostScriptEvaluator_execute(initialStack) {
  13586. var stack = new PostScriptStack(initialStack);
  13587. var counter = 0;
  13588. var operators = this.operators;
  13589. var length = operators.length;
  13590. var operator, a, b;
  13591. while (counter < length) {
  13592. operator = operators[counter++];
  13593. if (typeof operator === 'number') {
  13594. stack.push(operator);
  13595. continue;
  13596. }
  13597. switch (operator) {
  13598. case 'jz':
  13599. b = stack.pop();
  13600. a = stack.pop();
  13601. if (!a) {
  13602. counter = b;
  13603. }
  13604. break;
  13605. case 'j':
  13606. a = stack.pop();
  13607. counter = a;
  13608. break;
  13609. case 'abs':
  13610. a = stack.pop();
  13611. stack.push(Math.abs(a));
  13612. break;
  13613. case 'add':
  13614. b = stack.pop();
  13615. a = stack.pop();
  13616. stack.push(a + b);
  13617. break;
  13618. case 'and':
  13619. b = stack.pop();
  13620. a = stack.pop();
  13621. if (isBool(a) && isBool(b)) {
  13622. stack.push(a && b);
  13623. } else {
  13624. stack.push(a & b);
  13625. }
  13626. break;
  13627. case 'atan':
  13628. a = stack.pop();
  13629. stack.push(Math.atan(a));
  13630. break;
  13631. case 'bitshift':
  13632. b = stack.pop();
  13633. a = stack.pop();
  13634. if (a > 0) {
  13635. stack.push(a << b);
  13636. } else {
  13637. stack.push(a >> b);
  13638. }
  13639. break;
  13640. case 'ceiling':
  13641. a = stack.pop();
  13642. stack.push(Math.ceil(a));
  13643. break;
  13644. case 'copy':
  13645. a = stack.pop();
  13646. stack.copy(a);
  13647. break;
  13648. case 'cos':
  13649. a = stack.pop();
  13650. stack.push(Math.cos(a));
  13651. break;
  13652. case 'cvi':
  13653. a = stack.pop() | 0;
  13654. stack.push(a);
  13655. break;
  13656. case 'cvr':
  13657. break;
  13658. case 'div':
  13659. b = stack.pop();
  13660. a = stack.pop();
  13661. stack.push(a / b);
  13662. break;
  13663. case 'dup':
  13664. stack.copy(1);
  13665. break;
  13666. case 'eq':
  13667. b = stack.pop();
  13668. a = stack.pop();
  13669. stack.push(a === b);
  13670. break;
  13671. case 'exch':
  13672. stack.roll(2, 1);
  13673. break;
  13674. case 'exp':
  13675. b = stack.pop();
  13676. a = stack.pop();
  13677. stack.push(Math.pow(a, b));
  13678. break;
  13679. case 'false':
  13680. stack.push(false);
  13681. break;
  13682. case 'floor':
  13683. a = stack.pop();
  13684. stack.push(Math.floor(a));
  13685. break;
  13686. case 'ge':
  13687. b = stack.pop();
  13688. a = stack.pop();
  13689. stack.push(a >= b);
  13690. break;
  13691. case 'gt':
  13692. b = stack.pop();
  13693. a = stack.pop();
  13694. stack.push(a > b);
  13695. break;
  13696. case 'idiv':
  13697. b = stack.pop();
  13698. a = stack.pop();
  13699. stack.push(a / b | 0);
  13700. break;
  13701. case 'index':
  13702. a = stack.pop();
  13703. stack.index(a);
  13704. break;
  13705. case 'le':
  13706. b = stack.pop();
  13707. a = stack.pop();
  13708. stack.push(a <= b);
  13709. break;
  13710. case 'ln':
  13711. a = stack.pop();
  13712. stack.push(Math.log(a));
  13713. break;
  13714. case 'log':
  13715. a = stack.pop();
  13716. stack.push(Math.log(a) / Math.LN10);
  13717. break;
  13718. case 'lt':
  13719. b = stack.pop();
  13720. a = stack.pop();
  13721. stack.push(a < b);
  13722. break;
  13723. case 'mod':
  13724. b = stack.pop();
  13725. a = stack.pop();
  13726. stack.push(a % b);
  13727. break;
  13728. case 'mul':
  13729. b = stack.pop();
  13730. a = stack.pop();
  13731. stack.push(a * b);
  13732. break;
  13733. case 'ne':
  13734. b = stack.pop();
  13735. a = stack.pop();
  13736. stack.push(a !== b);
  13737. break;
  13738. case 'neg':
  13739. a = stack.pop();
  13740. stack.push(-a);
  13741. break;
  13742. case 'not':
  13743. a = stack.pop();
  13744. if (isBool(a)) {
  13745. stack.push(!a);
  13746. } else {
  13747. stack.push(~a);
  13748. }
  13749. break;
  13750. case 'or':
  13751. b = stack.pop();
  13752. a = stack.pop();
  13753. if (isBool(a) && isBool(b)) {
  13754. stack.push(a || b);
  13755. } else {
  13756. stack.push(a | b);
  13757. }
  13758. break;
  13759. case 'pop':
  13760. stack.pop();
  13761. break;
  13762. case 'roll':
  13763. b = stack.pop();
  13764. a = stack.pop();
  13765. stack.roll(a, b);
  13766. break;
  13767. case 'round':
  13768. a = stack.pop();
  13769. stack.push(Math.round(a));
  13770. break;
  13771. case 'sin':
  13772. a = stack.pop();
  13773. stack.push(Math.sin(a));
  13774. break;
  13775. case 'sqrt':
  13776. a = stack.pop();
  13777. stack.push(Math.sqrt(a));
  13778. break;
  13779. case 'sub':
  13780. b = stack.pop();
  13781. a = stack.pop();
  13782. stack.push(a - b);
  13783. break;
  13784. case 'true':
  13785. stack.push(true);
  13786. break;
  13787. case 'truncate':
  13788. a = stack.pop();
  13789. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  13790. stack.push(a);
  13791. break;
  13792. case 'xor':
  13793. b = stack.pop();
  13794. a = stack.pop();
  13795. if (isBool(a) && isBool(b)) {
  13796. stack.push(a !== b);
  13797. } else {
  13798. stack.push(a ^ b);
  13799. }
  13800. break;
  13801. default:
  13802. error('Unknown operator ' + operator);
  13803. break;
  13804. }
  13805. }
  13806. return stack.stack;
  13807. }
  13808. };
  13809. return PostScriptEvaluator;
  13810. }();
  13811. var PostScriptCompiler = function PostScriptCompilerClosure() {
  13812. function AstNode(type) {
  13813. this.type = type;
  13814. }
  13815. AstNode.prototype.visit = function (visitor) {
  13816. throw new Error('abstract method');
  13817. };
  13818. function AstArgument(index, min, max) {
  13819. AstNode.call(this, 'args');
  13820. this.index = index;
  13821. this.min = min;
  13822. this.max = max;
  13823. }
  13824. AstArgument.prototype = Object.create(AstNode.prototype);
  13825. AstArgument.prototype.visit = function (visitor) {
  13826. visitor.visitArgument(this);
  13827. };
  13828. function AstLiteral(number) {
  13829. AstNode.call(this, 'literal');
  13830. this.number = number;
  13831. this.min = number;
  13832. this.max = number;
  13833. }
  13834. AstLiteral.prototype = Object.create(AstNode.prototype);
  13835. AstLiteral.prototype.visit = function (visitor) {
  13836. visitor.visitLiteral(this);
  13837. };
  13838. function AstBinaryOperation(op, arg1, arg2, min, max) {
  13839. AstNode.call(this, 'binary');
  13840. this.op = op;
  13841. this.arg1 = arg1;
  13842. this.arg2 = arg2;
  13843. this.min = min;
  13844. this.max = max;
  13845. }
  13846. AstBinaryOperation.prototype = Object.create(AstNode.prototype);
  13847. AstBinaryOperation.prototype.visit = function (visitor) {
  13848. visitor.visitBinaryOperation(this);
  13849. };
  13850. function AstMin(arg, max) {
  13851. AstNode.call(this, 'max');
  13852. this.arg = arg;
  13853. this.min = arg.min;
  13854. this.max = max;
  13855. }
  13856. AstMin.prototype = Object.create(AstNode.prototype);
  13857. AstMin.prototype.visit = function (visitor) {
  13858. visitor.visitMin(this);
  13859. };
  13860. function AstVariable(index, min, max) {
  13861. AstNode.call(this, 'var');
  13862. this.index = index;
  13863. this.min = min;
  13864. this.max = max;
  13865. }
  13866. AstVariable.prototype = Object.create(AstNode.prototype);
  13867. AstVariable.prototype.visit = function (visitor) {
  13868. visitor.visitVariable(this);
  13869. };
  13870. function AstVariableDefinition(variable, arg) {
  13871. AstNode.call(this, 'definition');
  13872. this.variable = variable;
  13873. this.arg = arg;
  13874. }
  13875. AstVariableDefinition.prototype = Object.create(AstNode.prototype);
  13876. AstVariableDefinition.prototype.visit = function (visitor) {
  13877. visitor.visitVariableDefinition(this);
  13878. };
  13879. function ExpressionBuilderVisitor() {
  13880. this.parts = [];
  13881. }
  13882. ExpressionBuilderVisitor.prototype = {
  13883. visitArgument: function (arg) {
  13884. this.parts.push('Math.max(', arg.min, ', Math.min(', arg.max, ', src[srcOffset + ', arg.index, ']))');
  13885. },
  13886. visitVariable: function (variable) {
  13887. this.parts.push('v', variable.index);
  13888. },
  13889. visitLiteral: function (literal) {
  13890. this.parts.push(literal.number);
  13891. },
  13892. visitBinaryOperation: function (operation) {
  13893. this.parts.push('(');
  13894. operation.arg1.visit(this);
  13895. this.parts.push(' ', operation.op, ' ');
  13896. operation.arg2.visit(this);
  13897. this.parts.push(')');
  13898. },
  13899. visitVariableDefinition: function (definition) {
  13900. this.parts.push('var ');
  13901. definition.variable.visit(this);
  13902. this.parts.push(' = ');
  13903. definition.arg.visit(this);
  13904. this.parts.push(';');
  13905. },
  13906. visitMin: function (max) {
  13907. this.parts.push('Math.min(');
  13908. max.arg.visit(this);
  13909. this.parts.push(', ', max.max, ')');
  13910. },
  13911. toString: function () {
  13912. return this.parts.join('');
  13913. }
  13914. };
  13915. function buildAddOperation(num1, num2) {
  13916. if (num2.type === 'literal' && num2.number === 0) {
  13917. return num1;
  13918. }
  13919. if (num1.type === 'literal' && num1.number === 0) {
  13920. return num2;
  13921. }
  13922. if (num2.type === 'literal' && num1.type === 'literal') {
  13923. return new AstLiteral(num1.number + num2.number);
  13924. }
  13925. return new AstBinaryOperation('+', num1, num2, num1.min + num2.min, num1.max + num2.max);
  13926. }
  13927. function buildMulOperation(num1, num2) {
  13928. if (num2.type === 'literal') {
  13929. if (num2.number === 0) {
  13930. return new AstLiteral(0);
  13931. } else if (num2.number === 1) {
  13932. return num1;
  13933. } else if (num1.type === 'literal') {
  13934. return new AstLiteral(num1.number * num2.number);
  13935. }
  13936. }
  13937. if (num1.type === 'literal') {
  13938. if (num1.number === 0) {
  13939. return new AstLiteral(0);
  13940. } else if (num1.number === 1) {
  13941. return num2;
  13942. }
  13943. }
  13944. var min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  13945. var max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  13946. return new AstBinaryOperation('*', num1, num2, min, max);
  13947. }
  13948. function buildSubOperation(num1, num2) {
  13949. if (num2.type === 'literal') {
  13950. if (num2.number === 0) {
  13951. return num1;
  13952. } else if (num1.type === 'literal') {
  13953. return new AstLiteral(num1.number - num2.number);
  13954. }
  13955. }
  13956. if (num2.type === 'binary' && num2.op === '-' && num1.type === 'literal' && num1.number === 1 && num2.arg1.type === 'literal' && num2.arg1.number === 1) {
  13957. return num2.arg2;
  13958. }
  13959. return new AstBinaryOperation('-', num1, num2, num1.min - num2.max, num1.max - num2.min);
  13960. }
  13961. function buildMinOperation(num1, max) {
  13962. if (num1.min >= max) {
  13963. return new AstLiteral(max);
  13964. } else if (num1.max <= max) {
  13965. return num1;
  13966. }
  13967. return new AstMin(num1, max);
  13968. }
  13969. function PostScriptCompiler() {
  13970. }
  13971. PostScriptCompiler.prototype = {
  13972. compile: function PostScriptCompiler_compile(code, domain, range) {
  13973. var stack = [];
  13974. var i, ii;
  13975. var instructions = [];
  13976. var inputSize = domain.length >> 1, outputSize = range.length >> 1;
  13977. var lastRegister = 0;
  13978. var n, j;
  13979. var num1, num2, ast1, ast2, tmpVar, item;
  13980. for (i = 0; i < inputSize; i++) {
  13981. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  13982. }
  13983. for (i = 0, ii = code.length; i < ii; i++) {
  13984. item = code[i];
  13985. if (typeof item === 'number') {
  13986. stack.push(new AstLiteral(item));
  13987. continue;
  13988. }
  13989. switch (item) {
  13990. case 'add':
  13991. if (stack.length < 2) {
  13992. return null;
  13993. }
  13994. num2 = stack.pop();
  13995. num1 = stack.pop();
  13996. stack.push(buildAddOperation(num1, num2));
  13997. break;
  13998. case 'cvr':
  13999. if (stack.length < 1) {
  14000. return null;
  14001. }
  14002. break;
  14003. case 'mul':
  14004. if (stack.length < 2) {
  14005. return null;
  14006. }
  14007. num2 = stack.pop();
  14008. num1 = stack.pop();
  14009. stack.push(buildMulOperation(num1, num2));
  14010. break;
  14011. case 'sub':
  14012. if (stack.length < 2) {
  14013. return null;
  14014. }
  14015. num2 = stack.pop();
  14016. num1 = stack.pop();
  14017. stack.push(buildSubOperation(num1, num2));
  14018. break;
  14019. case 'exch':
  14020. if (stack.length < 2) {
  14021. return null;
  14022. }
  14023. ast1 = stack.pop();
  14024. ast2 = stack.pop();
  14025. stack.push(ast1, ast2);
  14026. break;
  14027. case 'pop':
  14028. if (stack.length < 1) {
  14029. return null;
  14030. }
  14031. stack.pop();
  14032. break;
  14033. case 'index':
  14034. if (stack.length < 1) {
  14035. return null;
  14036. }
  14037. num1 = stack.pop();
  14038. if (num1.type !== 'literal') {
  14039. return null;
  14040. }
  14041. n = num1.number;
  14042. if (n < 0 || (n | 0) !== n || stack.length < n) {
  14043. return null;
  14044. }
  14045. ast1 = stack[stack.length - n - 1];
  14046. if (ast1.type === 'literal' || ast1.type === 'var') {
  14047. stack.push(ast1);
  14048. break;
  14049. }
  14050. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  14051. stack[stack.length - n - 1] = tmpVar;
  14052. stack.push(tmpVar);
  14053. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  14054. break;
  14055. case 'dup':
  14056. if (stack.length < 1) {
  14057. return null;
  14058. }
  14059. 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]) {
  14060. num1 = stack.pop();
  14061. stack.push(buildMinOperation(num1, code[i + 1]));
  14062. i += 6;
  14063. break;
  14064. }
  14065. ast1 = stack[stack.length - 1];
  14066. if (ast1.type === 'literal' || ast1.type === 'var') {
  14067. stack.push(ast1);
  14068. break;
  14069. }
  14070. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  14071. stack[stack.length - 1] = tmpVar;
  14072. stack.push(tmpVar);
  14073. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  14074. break;
  14075. case 'roll':
  14076. if (stack.length < 2) {
  14077. return null;
  14078. }
  14079. num2 = stack.pop();
  14080. num1 = stack.pop();
  14081. if (num2.type !== 'literal' || num1.type !== 'literal') {
  14082. return null;
  14083. }
  14084. j = num2.number;
  14085. n = num1.number;
  14086. if (n <= 0 || (n | 0) !== n || (j | 0) !== j || stack.length < n) {
  14087. return null;
  14088. }
  14089. j = (j % n + n) % n;
  14090. if (j === 0) {
  14091. break;
  14092. }
  14093. Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
  14094. break;
  14095. default:
  14096. return null;
  14097. }
  14098. }
  14099. if (stack.length !== outputSize) {
  14100. return null;
  14101. }
  14102. var result = [];
  14103. instructions.forEach(function (instruction) {
  14104. var statementBuilder = new ExpressionBuilderVisitor();
  14105. instruction.visit(statementBuilder);
  14106. result.push(statementBuilder.toString());
  14107. });
  14108. stack.forEach(function (expr, i) {
  14109. var statementBuilder = new ExpressionBuilderVisitor();
  14110. expr.visit(statementBuilder);
  14111. var min = range[i * 2], max = range[i * 2 + 1];
  14112. var out = [statementBuilder.toString()];
  14113. if (min > expr.min) {
  14114. out.unshift('Math.max(', min, ', ');
  14115. out.push(')');
  14116. }
  14117. if (max < expr.max) {
  14118. out.unshift('Math.min(', max, ', ');
  14119. out.push(')');
  14120. }
  14121. out.unshift('dest[destOffset + ', i, '] = ');
  14122. out.push(';');
  14123. result.push(out.join(''));
  14124. });
  14125. return result.join('\n');
  14126. }
  14127. };
  14128. return PostScriptCompiler;
  14129. }();
  14130. exports.isPDFFunction = isPDFFunction;
  14131. exports.PDFFunction = PDFFunction;
  14132. exports.PostScriptEvaluator = PostScriptEvaluator;
  14133. exports.PostScriptCompiler = PostScriptCompiler;
  14134. /***/ }),
  14135. /* 7 */
  14136. /***/ (function(module, exports, __w_pdfjs_require__) {
  14137. "use strict";
  14138. var sharedUtil = __w_pdfjs_require__(0);
  14139. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  14140. var getGlyphsUnicode = getLookupTableFactory(function (t) {
  14141. t['A'] = 0x0041;
  14142. t['AE'] = 0x00C6;
  14143. t['AEacute'] = 0x01FC;
  14144. t['AEmacron'] = 0x01E2;
  14145. t['AEsmall'] = 0xF7E6;
  14146. t['Aacute'] = 0x00C1;
  14147. t['Aacutesmall'] = 0xF7E1;
  14148. t['Abreve'] = 0x0102;
  14149. t['Abreveacute'] = 0x1EAE;
  14150. t['Abrevecyrillic'] = 0x04D0;
  14151. t['Abrevedotbelow'] = 0x1EB6;
  14152. t['Abrevegrave'] = 0x1EB0;
  14153. t['Abrevehookabove'] = 0x1EB2;
  14154. t['Abrevetilde'] = 0x1EB4;
  14155. t['Acaron'] = 0x01CD;
  14156. t['Acircle'] = 0x24B6;
  14157. t['Acircumflex'] = 0x00C2;
  14158. t['Acircumflexacute'] = 0x1EA4;
  14159. t['Acircumflexdotbelow'] = 0x1EAC;
  14160. t['Acircumflexgrave'] = 0x1EA6;
  14161. t['Acircumflexhookabove'] = 0x1EA8;
  14162. t['Acircumflexsmall'] = 0xF7E2;
  14163. t['Acircumflextilde'] = 0x1EAA;
  14164. t['Acute'] = 0xF6C9;
  14165. t['Acutesmall'] = 0xF7B4;
  14166. t['Acyrillic'] = 0x0410;
  14167. t['Adblgrave'] = 0x0200;
  14168. t['Adieresis'] = 0x00C4;
  14169. t['Adieresiscyrillic'] = 0x04D2;
  14170. t['Adieresismacron'] = 0x01DE;
  14171. t['Adieresissmall'] = 0xF7E4;
  14172. t['Adotbelow'] = 0x1EA0;
  14173. t['Adotmacron'] = 0x01E0;
  14174. t['Agrave'] = 0x00C0;
  14175. t['Agravesmall'] = 0xF7E0;
  14176. t['Ahookabove'] = 0x1EA2;
  14177. t['Aiecyrillic'] = 0x04D4;
  14178. t['Ainvertedbreve'] = 0x0202;
  14179. t['Alpha'] = 0x0391;
  14180. t['Alphatonos'] = 0x0386;
  14181. t['Amacron'] = 0x0100;
  14182. t['Amonospace'] = 0xFF21;
  14183. t['Aogonek'] = 0x0104;
  14184. t['Aring'] = 0x00C5;
  14185. t['Aringacute'] = 0x01FA;
  14186. t['Aringbelow'] = 0x1E00;
  14187. t['Aringsmall'] = 0xF7E5;
  14188. t['Asmall'] = 0xF761;
  14189. t['Atilde'] = 0x00C3;
  14190. t['Atildesmall'] = 0xF7E3;
  14191. t['Aybarmenian'] = 0x0531;
  14192. t['B'] = 0x0042;
  14193. t['Bcircle'] = 0x24B7;
  14194. t['Bdotaccent'] = 0x1E02;
  14195. t['Bdotbelow'] = 0x1E04;
  14196. t['Becyrillic'] = 0x0411;
  14197. t['Benarmenian'] = 0x0532;
  14198. t['Beta'] = 0x0392;
  14199. t['Bhook'] = 0x0181;
  14200. t['Blinebelow'] = 0x1E06;
  14201. t['Bmonospace'] = 0xFF22;
  14202. t['Brevesmall'] = 0xF6F4;
  14203. t['Bsmall'] = 0xF762;
  14204. t['Btopbar'] = 0x0182;
  14205. t['C'] = 0x0043;
  14206. t['Caarmenian'] = 0x053E;
  14207. t['Cacute'] = 0x0106;
  14208. t['Caron'] = 0xF6CA;
  14209. t['Caronsmall'] = 0xF6F5;
  14210. t['Ccaron'] = 0x010C;
  14211. t['Ccedilla'] = 0x00C7;
  14212. t['Ccedillaacute'] = 0x1E08;
  14213. t['Ccedillasmall'] = 0xF7E7;
  14214. t['Ccircle'] = 0x24B8;
  14215. t['Ccircumflex'] = 0x0108;
  14216. t['Cdot'] = 0x010A;
  14217. t['Cdotaccent'] = 0x010A;
  14218. t['Cedillasmall'] = 0xF7B8;
  14219. t['Chaarmenian'] = 0x0549;
  14220. t['Cheabkhasiancyrillic'] = 0x04BC;
  14221. t['Checyrillic'] = 0x0427;
  14222. t['Chedescenderabkhasiancyrillic'] = 0x04BE;
  14223. t['Chedescendercyrillic'] = 0x04B6;
  14224. t['Chedieresiscyrillic'] = 0x04F4;
  14225. t['Cheharmenian'] = 0x0543;
  14226. t['Chekhakassiancyrillic'] = 0x04CB;
  14227. t['Cheverticalstrokecyrillic'] = 0x04B8;
  14228. t['Chi'] = 0x03A7;
  14229. t['Chook'] = 0x0187;
  14230. t['Circumflexsmall'] = 0xF6F6;
  14231. t['Cmonospace'] = 0xFF23;
  14232. t['Coarmenian'] = 0x0551;
  14233. t['Csmall'] = 0xF763;
  14234. t['D'] = 0x0044;
  14235. t['DZ'] = 0x01F1;
  14236. t['DZcaron'] = 0x01C4;
  14237. t['Daarmenian'] = 0x0534;
  14238. t['Dafrican'] = 0x0189;
  14239. t['Dcaron'] = 0x010E;
  14240. t['Dcedilla'] = 0x1E10;
  14241. t['Dcircle'] = 0x24B9;
  14242. t['Dcircumflexbelow'] = 0x1E12;
  14243. t['Dcroat'] = 0x0110;
  14244. t['Ddotaccent'] = 0x1E0A;
  14245. t['Ddotbelow'] = 0x1E0C;
  14246. t['Decyrillic'] = 0x0414;
  14247. t['Deicoptic'] = 0x03EE;
  14248. t['Delta'] = 0x2206;
  14249. t['Deltagreek'] = 0x0394;
  14250. t['Dhook'] = 0x018A;
  14251. t['Dieresis'] = 0xF6CB;
  14252. t['DieresisAcute'] = 0xF6CC;
  14253. t['DieresisGrave'] = 0xF6CD;
  14254. t['Dieresissmall'] = 0xF7A8;
  14255. t['Digammagreek'] = 0x03DC;
  14256. t['Djecyrillic'] = 0x0402;
  14257. t['Dlinebelow'] = 0x1E0E;
  14258. t['Dmonospace'] = 0xFF24;
  14259. t['Dotaccentsmall'] = 0xF6F7;
  14260. t['Dslash'] = 0x0110;
  14261. t['Dsmall'] = 0xF764;
  14262. t['Dtopbar'] = 0x018B;
  14263. t['Dz'] = 0x01F2;
  14264. t['Dzcaron'] = 0x01C5;
  14265. t['Dzeabkhasiancyrillic'] = 0x04E0;
  14266. t['Dzecyrillic'] = 0x0405;
  14267. t['Dzhecyrillic'] = 0x040F;
  14268. t['E'] = 0x0045;
  14269. t['Eacute'] = 0x00C9;
  14270. t['Eacutesmall'] = 0xF7E9;
  14271. t['Ebreve'] = 0x0114;
  14272. t['Ecaron'] = 0x011A;
  14273. t['Ecedillabreve'] = 0x1E1C;
  14274. t['Echarmenian'] = 0x0535;
  14275. t['Ecircle'] = 0x24BA;
  14276. t['Ecircumflex'] = 0x00CA;
  14277. t['Ecircumflexacute'] = 0x1EBE;
  14278. t['Ecircumflexbelow'] = 0x1E18;
  14279. t['Ecircumflexdotbelow'] = 0x1EC6;
  14280. t['Ecircumflexgrave'] = 0x1EC0;
  14281. t['Ecircumflexhookabove'] = 0x1EC2;
  14282. t['Ecircumflexsmall'] = 0xF7EA;
  14283. t['Ecircumflextilde'] = 0x1EC4;
  14284. t['Ecyrillic'] = 0x0404;
  14285. t['Edblgrave'] = 0x0204;
  14286. t['Edieresis'] = 0x00CB;
  14287. t['Edieresissmall'] = 0xF7EB;
  14288. t['Edot'] = 0x0116;
  14289. t['Edotaccent'] = 0x0116;
  14290. t['Edotbelow'] = 0x1EB8;
  14291. t['Efcyrillic'] = 0x0424;
  14292. t['Egrave'] = 0x00C8;
  14293. t['Egravesmall'] = 0xF7E8;
  14294. t['Eharmenian'] = 0x0537;
  14295. t['Ehookabove'] = 0x1EBA;
  14296. t['Eightroman'] = 0x2167;
  14297. t['Einvertedbreve'] = 0x0206;
  14298. t['Eiotifiedcyrillic'] = 0x0464;
  14299. t['Elcyrillic'] = 0x041B;
  14300. t['Elevenroman'] = 0x216A;
  14301. t['Emacron'] = 0x0112;
  14302. t['Emacronacute'] = 0x1E16;
  14303. t['Emacrongrave'] = 0x1E14;
  14304. t['Emcyrillic'] = 0x041C;
  14305. t['Emonospace'] = 0xFF25;
  14306. t['Encyrillic'] = 0x041D;
  14307. t['Endescendercyrillic'] = 0x04A2;
  14308. t['Eng'] = 0x014A;
  14309. t['Enghecyrillic'] = 0x04A4;
  14310. t['Enhookcyrillic'] = 0x04C7;
  14311. t['Eogonek'] = 0x0118;
  14312. t['Eopen'] = 0x0190;
  14313. t['Epsilon'] = 0x0395;
  14314. t['Epsilontonos'] = 0x0388;
  14315. t['Ercyrillic'] = 0x0420;
  14316. t['Ereversed'] = 0x018E;
  14317. t['Ereversedcyrillic'] = 0x042D;
  14318. t['Escyrillic'] = 0x0421;
  14319. t['Esdescendercyrillic'] = 0x04AA;
  14320. t['Esh'] = 0x01A9;
  14321. t['Esmall'] = 0xF765;
  14322. t['Eta'] = 0x0397;
  14323. t['Etarmenian'] = 0x0538;
  14324. t['Etatonos'] = 0x0389;
  14325. t['Eth'] = 0x00D0;
  14326. t['Ethsmall'] = 0xF7F0;
  14327. t['Etilde'] = 0x1EBC;
  14328. t['Etildebelow'] = 0x1E1A;
  14329. t['Euro'] = 0x20AC;
  14330. t['Ezh'] = 0x01B7;
  14331. t['Ezhcaron'] = 0x01EE;
  14332. t['Ezhreversed'] = 0x01B8;
  14333. t['F'] = 0x0046;
  14334. t['Fcircle'] = 0x24BB;
  14335. t['Fdotaccent'] = 0x1E1E;
  14336. t['Feharmenian'] = 0x0556;
  14337. t['Feicoptic'] = 0x03E4;
  14338. t['Fhook'] = 0x0191;
  14339. t['Fitacyrillic'] = 0x0472;
  14340. t['Fiveroman'] = 0x2164;
  14341. t['Fmonospace'] = 0xFF26;
  14342. t['Fourroman'] = 0x2163;
  14343. t['Fsmall'] = 0xF766;
  14344. t['G'] = 0x0047;
  14345. t['GBsquare'] = 0x3387;
  14346. t['Gacute'] = 0x01F4;
  14347. t['Gamma'] = 0x0393;
  14348. t['Gammaafrican'] = 0x0194;
  14349. t['Gangiacoptic'] = 0x03EA;
  14350. t['Gbreve'] = 0x011E;
  14351. t['Gcaron'] = 0x01E6;
  14352. t['Gcedilla'] = 0x0122;
  14353. t['Gcircle'] = 0x24BC;
  14354. t['Gcircumflex'] = 0x011C;
  14355. t['Gcommaaccent'] = 0x0122;
  14356. t['Gdot'] = 0x0120;
  14357. t['Gdotaccent'] = 0x0120;
  14358. t['Gecyrillic'] = 0x0413;
  14359. t['Ghadarmenian'] = 0x0542;
  14360. t['Ghemiddlehookcyrillic'] = 0x0494;
  14361. t['Ghestrokecyrillic'] = 0x0492;
  14362. t['Gheupturncyrillic'] = 0x0490;
  14363. t['Ghook'] = 0x0193;
  14364. t['Gimarmenian'] = 0x0533;
  14365. t['Gjecyrillic'] = 0x0403;
  14366. t['Gmacron'] = 0x1E20;
  14367. t['Gmonospace'] = 0xFF27;
  14368. t['Grave'] = 0xF6CE;
  14369. t['Gravesmall'] = 0xF760;
  14370. t['Gsmall'] = 0xF767;
  14371. t['Gsmallhook'] = 0x029B;
  14372. t['Gstroke'] = 0x01E4;
  14373. t['H'] = 0x0048;
  14374. t['H18533'] = 0x25CF;
  14375. t['H18543'] = 0x25AA;
  14376. t['H18551'] = 0x25AB;
  14377. t['H22073'] = 0x25A1;
  14378. t['HPsquare'] = 0x33CB;
  14379. t['Haabkhasiancyrillic'] = 0x04A8;
  14380. t['Hadescendercyrillic'] = 0x04B2;
  14381. t['Hardsigncyrillic'] = 0x042A;
  14382. t['Hbar'] = 0x0126;
  14383. t['Hbrevebelow'] = 0x1E2A;
  14384. t['Hcedilla'] = 0x1E28;
  14385. t['Hcircle'] = 0x24BD;
  14386. t['Hcircumflex'] = 0x0124;
  14387. t['Hdieresis'] = 0x1E26;
  14388. t['Hdotaccent'] = 0x1E22;
  14389. t['Hdotbelow'] = 0x1E24;
  14390. t['Hmonospace'] = 0xFF28;
  14391. t['Hoarmenian'] = 0x0540;
  14392. t['Horicoptic'] = 0x03E8;
  14393. t['Hsmall'] = 0xF768;
  14394. t['Hungarumlaut'] = 0xF6CF;
  14395. t['Hungarumlautsmall'] = 0xF6F8;
  14396. t['Hzsquare'] = 0x3390;
  14397. t['I'] = 0x0049;
  14398. t['IAcyrillic'] = 0x042F;
  14399. t['IJ'] = 0x0132;
  14400. t['IUcyrillic'] = 0x042E;
  14401. t['Iacute'] = 0x00CD;
  14402. t['Iacutesmall'] = 0xF7ED;
  14403. t['Ibreve'] = 0x012C;
  14404. t['Icaron'] = 0x01CF;
  14405. t['Icircle'] = 0x24BE;
  14406. t['Icircumflex'] = 0x00CE;
  14407. t['Icircumflexsmall'] = 0xF7EE;
  14408. t['Icyrillic'] = 0x0406;
  14409. t['Idblgrave'] = 0x0208;
  14410. t['Idieresis'] = 0x00CF;
  14411. t['Idieresisacute'] = 0x1E2E;
  14412. t['Idieresiscyrillic'] = 0x04E4;
  14413. t['Idieresissmall'] = 0xF7EF;
  14414. t['Idot'] = 0x0130;
  14415. t['Idotaccent'] = 0x0130;
  14416. t['Idotbelow'] = 0x1ECA;
  14417. t['Iebrevecyrillic'] = 0x04D6;
  14418. t['Iecyrillic'] = 0x0415;
  14419. t['Ifraktur'] = 0x2111;
  14420. t['Igrave'] = 0x00CC;
  14421. t['Igravesmall'] = 0xF7EC;
  14422. t['Ihookabove'] = 0x1EC8;
  14423. t['Iicyrillic'] = 0x0418;
  14424. t['Iinvertedbreve'] = 0x020A;
  14425. t['Iishortcyrillic'] = 0x0419;
  14426. t['Imacron'] = 0x012A;
  14427. t['Imacroncyrillic'] = 0x04E2;
  14428. t['Imonospace'] = 0xFF29;
  14429. t['Iniarmenian'] = 0x053B;
  14430. t['Iocyrillic'] = 0x0401;
  14431. t['Iogonek'] = 0x012E;
  14432. t['Iota'] = 0x0399;
  14433. t['Iotaafrican'] = 0x0196;
  14434. t['Iotadieresis'] = 0x03AA;
  14435. t['Iotatonos'] = 0x038A;
  14436. t['Ismall'] = 0xF769;
  14437. t['Istroke'] = 0x0197;
  14438. t['Itilde'] = 0x0128;
  14439. t['Itildebelow'] = 0x1E2C;
  14440. t['Izhitsacyrillic'] = 0x0474;
  14441. t['Izhitsadblgravecyrillic'] = 0x0476;
  14442. t['J'] = 0x004A;
  14443. t['Jaarmenian'] = 0x0541;
  14444. t['Jcircle'] = 0x24BF;
  14445. t['Jcircumflex'] = 0x0134;
  14446. t['Jecyrillic'] = 0x0408;
  14447. t['Jheharmenian'] = 0x054B;
  14448. t['Jmonospace'] = 0xFF2A;
  14449. t['Jsmall'] = 0xF76A;
  14450. t['K'] = 0x004B;
  14451. t['KBsquare'] = 0x3385;
  14452. t['KKsquare'] = 0x33CD;
  14453. t['Kabashkircyrillic'] = 0x04A0;
  14454. t['Kacute'] = 0x1E30;
  14455. t['Kacyrillic'] = 0x041A;
  14456. t['Kadescendercyrillic'] = 0x049A;
  14457. t['Kahookcyrillic'] = 0x04C3;
  14458. t['Kappa'] = 0x039A;
  14459. t['Kastrokecyrillic'] = 0x049E;
  14460. t['Kaverticalstrokecyrillic'] = 0x049C;
  14461. t['Kcaron'] = 0x01E8;
  14462. t['Kcedilla'] = 0x0136;
  14463. t['Kcircle'] = 0x24C0;
  14464. t['Kcommaaccent'] = 0x0136;
  14465. t['Kdotbelow'] = 0x1E32;
  14466. t['Keharmenian'] = 0x0554;
  14467. t['Kenarmenian'] = 0x053F;
  14468. t['Khacyrillic'] = 0x0425;
  14469. t['Kheicoptic'] = 0x03E6;
  14470. t['Khook'] = 0x0198;
  14471. t['Kjecyrillic'] = 0x040C;
  14472. t['Klinebelow'] = 0x1E34;
  14473. t['Kmonospace'] = 0xFF2B;
  14474. t['Koppacyrillic'] = 0x0480;
  14475. t['Koppagreek'] = 0x03DE;
  14476. t['Ksicyrillic'] = 0x046E;
  14477. t['Ksmall'] = 0xF76B;
  14478. t['L'] = 0x004C;
  14479. t['LJ'] = 0x01C7;
  14480. t['LL'] = 0xF6BF;
  14481. t['Lacute'] = 0x0139;
  14482. t['Lambda'] = 0x039B;
  14483. t['Lcaron'] = 0x013D;
  14484. t['Lcedilla'] = 0x013B;
  14485. t['Lcircle'] = 0x24C1;
  14486. t['Lcircumflexbelow'] = 0x1E3C;
  14487. t['Lcommaaccent'] = 0x013B;
  14488. t['Ldot'] = 0x013F;
  14489. t['Ldotaccent'] = 0x013F;
  14490. t['Ldotbelow'] = 0x1E36;
  14491. t['Ldotbelowmacron'] = 0x1E38;
  14492. t['Liwnarmenian'] = 0x053C;
  14493. t['Lj'] = 0x01C8;
  14494. t['Ljecyrillic'] = 0x0409;
  14495. t['Llinebelow'] = 0x1E3A;
  14496. t['Lmonospace'] = 0xFF2C;
  14497. t['Lslash'] = 0x0141;
  14498. t['Lslashsmall'] = 0xF6F9;
  14499. t['Lsmall'] = 0xF76C;
  14500. t['M'] = 0x004D;
  14501. t['MBsquare'] = 0x3386;
  14502. t['Macron'] = 0xF6D0;
  14503. t['Macronsmall'] = 0xF7AF;
  14504. t['Macute'] = 0x1E3E;
  14505. t['Mcircle'] = 0x24C2;
  14506. t['Mdotaccent'] = 0x1E40;
  14507. t['Mdotbelow'] = 0x1E42;
  14508. t['Menarmenian'] = 0x0544;
  14509. t['Mmonospace'] = 0xFF2D;
  14510. t['Msmall'] = 0xF76D;
  14511. t['Mturned'] = 0x019C;
  14512. t['Mu'] = 0x039C;
  14513. t['N'] = 0x004E;
  14514. t['NJ'] = 0x01CA;
  14515. t['Nacute'] = 0x0143;
  14516. t['Ncaron'] = 0x0147;
  14517. t['Ncedilla'] = 0x0145;
  14518. t['Ncircle'] = 0x24C3;
  14519. t['Ncircumflexbelow'] = 0x1E4A;
  14520. t['Ncommaaccent'] = 0x0145;
  14521. t['Ndotaccent'] = 0x1E44;
  14522. t['Ndotbelow'] = 0x1E46;
  14523. t['Nhookleft'] = 0x019D;
  14524. t['Nineroman'] = 0x2168;
  14525. t['Nj'] = 0x01CB;
  14526. t['Njecyrillic'] = 0x040A;
  14527. t['Nlinebelow'] = 0x1E48;
  14528. t['Nmonospace'] = 0xFF2E;
  14529. t['Nowarmenian'] = 0x0546;
  14530. t['Nsmall'] = 0xF76E;
  14531. t['Ntilde'] = 0x00D1;
  14532. t['Ntildesmall'] = 0xF7F1;
  14533. t['Nu'] = 0x039D;
  14534. t['O'] = 0x004F;
  14535. t['OE'] = 0x0152;
  14536. t['OEsmall'] = 0xF6FA;
  14537. t['Oacute'] = 0x00D3;
  14538. t['Oacutesmall'] = 0xF7F3;
  14539. t['Obarredcyrillic'] = 0x04E8;
  14540. t['Obarreddieresiscyrillic'] = 0x04EA;
  14541. t['Obreve'] = 0x014E;
  14542. t['Ocaron'] = 0x01D1;
  14543. t['Ocenteredtilde'] = 0x019F;
  14544. t['Ocircle'] = 0x24C4;
  14545. t['Ocircumflex'] = 0x00D4;
  14546. t['Ocircumflexacute'] = 0x1ED0;
  14547. t['Ocircumflexdotbelow'] = 0x1ED8;
  14548. t['Ocircumflexgrave'] = 0x1ED2;
  14549. t['Ocircumflexhookabove'] = 0x1ED4;
  14550. t['Ocircumflexsmall'] = 0xF7F4;
  14551. t['Ocircumflextilde'] = 0x1ED6;
  14552. t['Ocyrillic'] = 0x041E;
  14553. t['Odblacute'] = 0x0150;
  14554. t['Odblgrave'] = 0x020C;
  14555. t['Odieresis'] = 0x00D6;
  14556. t['Odieresiscyrillic'] = 0x04E6;
  14557. t['Odieresissmall'] = 0xF7F6;
  14558. t['Odotbelow'] = 0x1ECC;
  14559. t['Ogoneksmall'] = 0xF6FB;
  14560. t['Ograve'] = 0x00D2;
  14561. t['Ogravesmall'] = 0xF7F2;
  14562. t['Oharmenian'] = 0x0555;
  14563. t['Ohm'] = 0x2126;
  14564. t['Ohookabove'] = 0x1ECE;
  14565. t['Ohorn'] = 0x01A0;
  14566. t['Ohornacute'] = 0x1EDA;
  14567. t['Ohorndotbelow'] = 0x1EE2;
  14568. t['Ohorngrave'] = 0x1EDC;
  14569. t['Ohornhookabove'] = 0x1EDE;
  14570. t['Ohorntilde'] = 0x1EE0;
  14571. t['Ohungarumlaut'] = 0x0150;
  14572. t['Oi'] = 0x01A2;
  14573. t['Oinvertedbreve'] = 0x020E;
  14574. t['Omacron'] = 0x014C;
  14575. t['Omacronacute'] = 0x1E52;
  14576. t['Omacrongrave'] = 0x1E50;
  14577. t['Omega'] = 0x2126;
  14578. t['Omegacyrillic'] = 0x0460;
  14579. t['Omegagreek'] = 0x03A9;
  14580. t['Omegaroundcyrillic'] = 0x047A;
  14581. t['Omegatitlocyrillic'] = 0x047C;
  14582. t['Omegatonos'] = 0x038F;
  14583. t['Omicron'] = 0x039F;
  14584. t['Omicrontonos'] = 0x038C;
  14585. t['Omonospace'] = 0xFF2F;
  14586. t['Oneroman'] = 0x2160;
  14587. t['Oogonek'] = 0x01EA;
  14588. t['Oogonekmacron'] = 0x01EC;
  14589. t['Oopen'] = 0x0186;
  14590. t['Oslash'] = 0x00D8;
  14591. t['Oslashacute'] = 0x01FE;
  14592. t['Oslashsmall'] = 0xF7F8;
  14593. t['Osmall'] = 0xF76F;
  14594. t['Ostrokeacute'] = 0x01FE;
  14595. t['Otcyrillic'] = 0x047E;
  14596. t['Otilde'] = 0x00D5;
  14597. t['Otildeacute'] = 0x1E4C;
  14598. t['Otildedieresis'] = 0x1E4E;
  14599. t['Otildesmall'] = 0xF7F5;
  14600. t['P'] = 0x0050;
  14601. t['Pacute'] = 0x1E54;
  14602. t['Pcircle'] = 0x24C5;
  14603. t['Pdotaccent'] = 0x1E56;
  14604. t['Pecyrillic'] = 0x041F;
  14605. t['Peharmenian'] = 0x054A;
  14606. t['Pemiddlehookcyrillic'] = 0x04A6;
  14607. t['Phi'] = 0x03A6;
  14608. t['Phook'] = 0x01A4;
  14609. t['Pi'] = 0x03A0;
  14610. t['Piwrarmenian'] = 0x0553;
  14611. t['Pmonospace'] = 0xFF30;
  14612. t['Psi'] = 0x03A8;
  14613. t['Psicyrillic'] = 0x0470;
  14614. t['Psmall'] = 0xF770;
  14615. t['Q'] = 0x0051;
  14616. t['Qcircle'] = 0x24C6;
  14617. t['Qmonospace'] = 0xFF31;
  14618. t['Qsmall'] = 0xF771;
  14619. t['R'] = 0x0052;
  14620. t['Raarmenian'] = 0x054C;
  14621. t['Racute'] = 0x0154;
  14622. t['Rcaron'] = 0x0158;
  14623. t['Rcedilla'] = 0x0156;
  14624. t['Rcircle'] = 0x24C7;
  14625. t['Rcommaaccent'] = 0x0156;
  14626. t['Rdblgrave'] = 0x0210;
  14627. t['Rdotaccent'] = 0x1E58;
  14628. t['Rdotbelow'] = 0x1E5A;
  14629. t['Rdotbelowmacron'] = 0x1E5C;
  14630. t['Reharmenian'] = 0x0550;
  14631. t['Rfraktur'] = 0x211C;
  14632. t['Rho'] = 0x03A1;
  14633. t['Ringsmall'] = 0xF6FC;
  14634. t['Rinvertedbreve'] = 0x0212;
  14635. t['Rlinebelow'] = 0x1E5E;
  14636. t['Rmonospace'] = 0xFF32;
  14637. t['Rsmall'] = 0xF772;
  14638. t['Rsmallinverted'] = 0x0281;
  14639. t['Rsmallinvertedsuperior'] = 0x02B6;
  14640. t['S'] = 0x0053;
  14641. t['SF010000'] = 0x250C;
  14642. t['SF020000'] = 0x2514;
  14643. t['SF030000'] = 0x2510;
  14644. t['SF040000'] = 0x2518;
  14645. t['SF050000'] = 0x253C;
  14646. t['SF060000'] = 0x252C;
  14647. t['SF070000'] = 0x2534;
  14648. t['SF080000'] = 0x251C;
  14649. t['SF090000'] = 0x2524;
  14650. t['SF100000'] = 0x2500;
  14651. t['SF110000'] = 0x2502;
  14652. t['SF190000'] = 0x2561;
  14653. t['SF200000'] = 0x2562;
  14654. t['SF210000'] = 0x2556;
  14655. t['SF220000'] = 0x2555;
  14656. t['SF230000'] = 0x2563;
  14657. t['SF240000'] = 0x2551;
  14658. t['SF250000'] = 0x2557;
  14659. t['SF260000'] = 0x255D;
  14660. t['SF270000'] = 0x255C;
  14661. t['SF280000'] = 0x255B;
  14662. t['SF360000'] = 0x255E;
  14663. t['SF370000'] = 0x255F;
  14664. t['SF380000'] = 0x255A;
  14665. t['SF390000'] = 0x2554;
  14666. t['SF400000'] = 0x2569;
  14667. t['SF410000'] = 0x2566;
  14668. t['SF420000'] = 0x2560;
  14669. t['SF430000'] = 0x2550;
  14670. t['SF440000'] = 0x256C;
  14671. t['SF450000'] = 0x2567;
  14672. t['SF460000'] = 0x2568;
  14673. t['SF470000'] = 0x2564;
  14674. t['SF480000'] = 0x2565;
  14675. t['SF490000'] = 0x2559;
  14676. t['SF500000'] = 0x2558;
  14677. t['SF510000'] = 0x2552;
  14678. t['SF520000'] = 0x2553;
  14679. t['SF530000'] = 0x256B;
  14680. t['SF540000'] = 0x256A;
  14681. t['Sacute'] = 0x015A;
  14682. t['Sacutedotaccent'] = 0x1E64;
  14683. t['Sampigreek'] = 0x03E0;
  14684. t['Scaron'] = 0x0160;
  14685. t['Scarondotaccent'] = 0x1E66;
  14686. t['Scaronsmall'] = 0xF6FD;
  14687. t['Scedilla'] = 0x015E;
  14688. t['Schwa'] = 0x018F;
  14689. t['Schwacyrillic'] = 0x04D8;
  14690. t['Schwadieresiscyrillic'] = 0x04DA;
  14691. t['Scircle'] = 0x24C8;
  14692. t['Scircumflex'] = 0x015C;
  14693. t['Scommaaccent'] = 0x0218;
  14694. t['Sdotaccent'] = 0x1E60;
  14695. t['Sdotbelow'] = 0x1E62;
  14696. t['Sdotbelowdotaccent'] = 0x1E68;
  14697. t['Seharmenian'] = 0x054D;
  14698. t['Sevenroman'] = 0x2166;
  14699. t['Shaarmenian'] = 0x0547;
  14700. t['Shacyrillic'] = 0x0428;
  14701. t['Shchacyrillic'] = 0x0429;
  14702. t['Sheicoptic'] = 0x03E2;
  14703. t['Shhacyrillic'] = 0x04BA;
  14704. t['Shimacoptic'] = 0x03EC;
  14705. t['Sigma'] = 0x03A3;
  14706. t['Sixroman'] = 0x2165;
  14707. t['Smonospace'] = 0xFF33;
  14708. t['Softsigncyrillic'] = 0x042C;
  14709. t['Ssmall'] = 0xF773;
  14710. t['Stigmagreek'] = 0x03DA;
  14711. t['T'] = 0x0054;
  14712. t['Tau'] = 0x03A4;
  14713. t['Tbar'] = 0x0166;
  14714. t['Tcaron'] = 0x0164;
  14715. t['Tcedilla'] = 0x0162;
  14716. t['Tcircle'] = 0x24C9;
  14717. t['Tcircumflexbelow'] = 0x1E70;
  14718. t['Tcommaaccent'] = 0x0162;
  14719. t['Tdotaccent'] = 0x1E6A;
  14720. t['Tdotbelow'] = 0x1E6C;
  14721. t['Tecyrillic'] = 0x0422;
  14722. t['Tedescendercyrillic'] = 0x04AC;
  14723. t['Tenroman'] = 0x2169;
  14724. t['Tetsecyrillic'] = 0x04B4;
  14725. t['Theta'] = 0x0398;
  14726. t['Thook'] = 0x01AC;
  14727. t['Thorn'] = 0x00DE;
  14728. t['Thornsmall'] = 0xF7FE;
  14729. t['Threeroman'] = 0x2162;
  14730. t['Tildesmall'] = 0xF6FE;
  14731. t['Tiwnarmenian'] = 0x054F;
  14732. t['Tlinebelow'] = 0x1E6E;
  14733. t['Tmonospace'] = 0xFF34;
  14734. t['Toarmenian'] = 0x0539;
  14735. t['Tonefive'] = 0x01BC;
  14736. t['Tonesix'] = 0x0184;
  14737. t['Tonetwo'] = 0x01A7;
  14738. t['Tretroflexhook'] = 0x01AE;
  14739. t['Tsecyrillic'] = 0x0426;
  14740. t['Tshecyrillic'] = 0x040B;
  14741. t['Tsmall'] = 0xF774;
  14742. t['Twelveroman'] = 0x216B;
  14743. t['Tworoman'] = 0x2161;
  14744. t['U'] = 0x0055;
  14745. t['Uacute'] = 0x00DA;
  14746. t['Uacutesmall'] = 0xF7FA;
  14747. t['Ubreve'] = 0x016C;
  14748. t['Ucaron'] = 0x01D3;
  14749. t['Ucircle'] = 0x24CA;
  14750. t['Ucircumflex'] = 0x00DB;
  14751. t['Ucircumflexbelow'] = 0x1E76;
  14752. t['Ucircumflexsmall'] = 0xF7FB;
  14753. t['Ucyrillic'] = 0x0423;
  14754. t['Udblacute'] = 0x0170;
  14755. t['Udblgrave'] = 0x0214;
  14756. t['Udieresis'] = 0x00DC;
  14757. t['Udieresisacute'] = 0x01D7;
  14758. t['Udieresisbelow'] = 0x1E72;
  14759. t['Udieresiscaron'] = 0x01D9;
  14760. t['Udieresiscyrillic'] = 0x04F0;
  14761. t['Udieresisgrave'] = 0x01DB;
  14762. t['Udieresismacron'] = 0x01D5;
  14763. t['Udieresissmall'] = 0xF7FC;
  14764. t['Udotbelow'] = 0x1EE4;
  14765. t['Ugrave'] = 0x00D9;
  14766. t['Ugravesmall'] = 0xF7F9;
  14767. t['Uhookabove'] = 0x1EE6;
  14768. t['Uhorn'] = 0x01AF;
  14769. t['Uhornacute'] = 0x1EE8;
  14770. t['Uhorndotbelow'] = 0x1EF0;
  14771. t['Uhorngrave'] = 0x1EEA;
  14772. t['Uhornhookabove'] = 0x1EEC;
  14773. t['Uhorntilde'] = 0x1EEE;
  14774. t['Uhungarumlaut'] = 0x0170;
  14775. t['Uhungarumlautcyrillic'] = 0x04F2;
  14776. t['Uinvertedbreve'] = 0x0216;
  14777. t['Ukcyrillic'] = 0x0478;
  14778. t['Umacron'] = 0x016A;
  14779. t['Umacroncyrillic'] = 0x04EE;
  14780. t['Umacrondieresis'] = 0x1E7A;
  14781. t['Umonospace'] = 0xFF35;
  14782. t['Uogonek'] = 0x0172;
  14783. t['Upsilon'] = 0x03A5;
  14784. t['Upsilon1'] = 0x03D2;
  14785. t['Upsilonacutehooksymbolgreek'] = 0x03D3;
  14786. t['Upsilonafrican'] = 0x01B1;
  14787. t['Upsilondieresis'] = 0x03AB;
  14788. t['Upsilondieresishooksymbolgreek'] = 0x03D4;
  14789. t['Upsilonhooksymbol'] = 0x03D2;
  14790. t['Upsilontonos'] = 0x038E;
  14791. t['Uring'] = 0x016E;
  14792. t['Ushortcyrillic'] = 0x040E;
  14793. t['Usmall'] = 0xF775;
  14794. t['Ustraightcyrillic'] = 0x04AE;
  14795. t['Ustraightstrokecyrillic'] = 0x04B0;
  14796. t['Utilde'] = 0x0168;
  14797. t['Utildeacute'] = 0x1E78;
  14798. t['Utildebelow'] = 0x1E74;
  14799. t['V'] = 0x0056;
  14800. t['Vcircle'] = 0x24CB;
  14801. t['Vdotbelow'] = 0x1E7E;
  14802. t['Vecyrillic'] = 0x0412;
  14803. t['Vewarmenian'] = 0x054E;
  14804. t['Vhook'] = 0x01B2;
  14805. t['Vmonospace'] = 0xFF36;
  14806. t['Voarmenian'] = 0x0548;
  14807. t['Vsmall'] = 0xF776;
  14808. t['Vtilde'] = 0x1E7C;
  14809. t['W'] = 0x0057;
  14810. t['Wacute'] = 0x1E82;
  14811. t['Wcircle'] = 0x24CC;
  14812. t['Wcircumflex'] = 0x0174;
  14813. t['Wdieresis'] = 0x1E84;
  14814. t['Wdotaccent'] = 0x1E86;
  14815. t['Wdotbelow'] = 0x1E88;
  14816. t['Wgrave'] = 0x1E80;
  14817. t['Wmonospace'] = 0xFF37;
  14818. t['Wsmall'] = 0xF777;
  14819. t['X'] = 0x0058;
  14820. t['Xcircle'] = 0x24CD;
  14821. t['Xdieresis'] = 0x1E8C;
  14822. t['Xdotaccent'] = 0x1E8A;
  14823. t['Xeharmenian'] = 0x053D;
  14824. t['Xi'] = 0x039E;
  14825. t['Xmonospace'] = 0xFF38;
  14826. t['Xsmall'] = 0xF778;
  14827. t['Y'] = 0x0059;
  14828. t['Yacute'] = 0x00DD;
  14829. t['Yacutesmall'] = 0xF7FD;
  14830. t['Yatcyrillic'] = 0x0462;
  14831. t['Ycircle'] = 0x24CE;
  14832. t['Ycircumflex'] = 0x0176;
  14833. t['Ydieresis'] = 0x0178;
  14834. t['Ydieresissmall'] = 0xF7FF;
  14835. t['Ydotaccent'] = 0x1E8E;
  14836. t['Ydotbelow'] = 0x1EF4;
  14837. t['Yericyrillic'] = 0x042B;
  14838. t['Yerudieresiscyrillic'] = 0x04F8;
  14839. t['Ygrave'] = 0x1EF2;
  14840. t['Yhook'] = 0x01B3;
  14841. t['Yhookabove'] = 0x1EF6;
  14842. t['Yiarmenian'] = 0x0545;
  14843. t['Yicyrillic'] = 0x0407;
  14844. t['Yiwnarmenian'] = 0x0552;
  14845. t['Ymonospace'] = 0xFF39;
  14846. t['Ysmall'] = 0xF779;
  14847. t['Ytilde'] = 0x1EF8;
  14848. t['Yusbigcyrillic'] = 0x046A;
  14849. t['Yusbigiotifiedcyrillic'] = 0x046C;
  14850. t['Yuslittlecyrillic'] = 0x0466;
  14851. t['Yuslittleiotifiedcyrillic'] = 0x0468;
  14852. t['Z'] = 0x005A;
  14853. t['Zaarmenian'] = 0x0536;
  14854. t['Zacute'] = 0x0179;
  14855. t['Zcaron'] = 0x017D;
  14856. t['Zcaronsmall'] = 0xF6FF;
  14857. t['Zcircle'] = 0x24CF;
  14858. t['Zcircumflex'] = 0x1E90;
  14859. t['Zdot'] = 0x017B;
  14860. t['Zdotaccent'] = 0x017B;
  14861. t['Zdotbelow'] = 0x1E92;
  14862. t['Zecyrillic'] = 0x0417;
  14863. t['Zedescendercyrillic'] = 0x0498;
  14864. t['Zedieresiscyrillic'] = 0x04DE;
  14865. t['Zeta'] = 0x0396;
  14866. t['Zhearmenian'] = 0x053A;
  14867. t['Zhebrevecyrillic'] = 0x04C1;
  14868. t['Zhecyrillic'] = 0x0416;
  14869. t['Zhedescendercyrillic'] = 0x0496;
  14870. t['Zhedieresiscyrillic'] = 0x04DC;
  14871. t['Zlinebelow'] = 0x1E94;
  14872. t['Zmonospace'] = 0xFF3A;
  14873. t['Zsmall'] = 0xF77A;
  14874. t['Zstroke'] = 0x01B5;
  14875. t['a'] = 0x0061;
  14876. t['aabengali'] = 0x0986;
  14877. t['aacute'] = 0x00E1;
  14878. t['aadeva'] = 0x0906;
  14879. t['aagujarati'] = 0x0A86;
  14880. t['aagurmukhi'] = 0x0A06;
  14881. t['aamatragurmukhi'] = 0x0A3E;
  14882. t['aarusquare'] = 0x3303;
  14883. t['aavowelsignbengali'] = 0x09BE;
  14884. t['aavowelsigndeva'] = 0x093E;
  14885. t['aavowelsigngujarati'] = 0x0ABE;
  14886. t['abbreviationmarkarmenian'] = 0x055F;
  14887. t['abbreviationsigndeva'] = 0x0970;
  14888. t['abengali'] = 0x0985;
  14889. t['abopomofo'] = 0x311A;
  14890. t['abreve'] = 0x0103;
  14891. t['abreveacute'] = 0x1EAF;
  14892. t['abrevecyrillic'] = 0x04D1;
  14893. t['abrevedotbelow'] = 0x1EB7;
  14894. t['abrevegrave'] = 0x1EB1;
  14895. t['abrevehookabove'] = 0x1EB3;
  14896. t['abrevetilde'] = 0x1EB5;
  14897. t['acaron'] = 0x01CE;
  14898. t['acircle'] = 0x24D0;
  14899. t['acircumflex'] = 0x00E2;
  14900. t['acircumflexacute'] = 0x1EA5;
  14901. t['acircumflexdotbelow'] = 0x1EAD;
  14902. t['acircumflexgrave'] = 0x1EA7;
  14903. t['acircumflexhookabove'] = 0x1EA9;
  14904. t['acircumflextilde'] = 0x1EAB;
  14905. t['acute'] = 0x00B4;
  14906. t['acutebelowcmb'] = 0x0317;
  14907. t['acutecmb'] = 0x0301;
  14908. t['acutecomb'] = 0x0301;
  14909. t['acutedeva'] = 0x0954;
  14910. t['acutelowmod'] = 0x02CF;
  14911. t['acutetonecmb'] = 0x0341;
  14912. t['acyrillic'] = 0x0430;
  14913. t['adblgrave'] = 0x0201;
  14914. t['addakgurmukhi'] = 0x0A71;
  14915. t['adeva'] = 0x0905;
  14916. t['adieresis'] = 0x00E4;
  14917. t['adieresiscyrillic'] = 0x04D3;
  14918. t['adieresismacron'] = 0x01DF;
  14919. t['adotbelow'] = 0x1EA1;
  14920. t['adotmacron'] = 0x01E1;
  14921. t['ae'] = 0x00E6;
  14922. t['aeacute'] = 0x01FD;
  14923. t['aekorean'] = 0x3150;
  14924. t['aemacron'] = 0x01E3;
  14925. t['afii00208'] = 0x2015;
  14926. t['afii08941'] = 0x20A4;
  14927. t['afii10017'] = 0x0410;
  14928. t['afii10018'] = 0x0411;
  14929. t['afii10019'] = 0x0412;
  14930. t['afii10020'] = 0x0413;
  14931. t['afii10021'] = 0x0414;
  14932. t['afii10022'] = 0x0415;
  14933. t['afii10023'] = 0x0401;
  14934. t['afii10024'] = 0x0416;
  14935. t['afii10025'] = 0x0417;
  14936. t['afii10026'] = 0x0418;
  14937. t['afii10027'] = 0x0419;
  14938. t['afii10028'] = 0x041A;
  14939. t['afii10029'] = 0x041B;
  14940. t['afii10030'] = 0x041C;
  14941. t['afii10031'] = 0x041D;
  14942. t['afii10032'] = 0x041E;
  14943. t['afii10033'] = 0x041F;
  14944. t['afii10034'] = 0x0420;
  14945. t['afii10035'] = 0x0421;
  14946. t['afii10036'] = 0x0422;
  14947. t['afii10037'] = 0x0423;
  14948. t['afii10038'] = 0x0424;
  14949. t['afii10039'] = 0x0425;
  14950. t['afii10040'] = 0x0426;
  14951. t['afii10041'] = 0x0427;
  14952. t['afii10042'] = 0x0428;
  14953. t['afii10043'] = 0x0429;
  14954. t['afii10044'] = 0x042A;
  14955. t['afii10045'] = 0x042B;
  14956. t['afii10046'] = 0x042C;
  14957. t['afii10047'] = 0x042D;
  14958. t['afii10048'] = 0x042E;
  14959. t['afii10049'] = 0x042F;
  14960. t['afii10050'] = 0x0490;
  14961. t['afii10051'] = 0x0402;
  14962. t['afii10052'] = 0x0403;
  14963. t['afii10053'] = 0x0404;
  14964. t['afii10054'] = 0x0405;
  14965. t['afii10055'] = 0x0406;
  14966. t['afii10056'] = 0x0407;
  14967. t['afii10057'] = 0x0408;
  14968. t['afii10058'] = 0x0409;
  14969. t['afii10059'] = 0x040A;
  14970. t['afii10060'] = 0x040B;
  14971. t['afii10061'] = 0x040C;
  14972. t['afii10062'] = 0x040E;
  14973. t['afii10063'] = 0xF6C4;
  14974. t['afii10064'] = 0xF6C5;
  14975. t['afii10065'] = 0x0430;
  14976. t['afii10066'] = 0x0431;
  14977. t['afii10067'] = 0x0432;
  14978. t['afii10068'] = 0x0433;
  14979. t['afii10069'] = 0x0434;
  14980. t['afii10070'] = 0x0435;
  14981. t['afii10071'] = 0x0451;
  14982. t['afii10072'] = 0x0436;
  14983. t['afii10073'] = 0x0437;
  14984. t['afii10074'] = 0x0438;
  14985. t['afii10075'] = 0x0439;
  14986. t['afii10076'] = 0x043A;
  14987. t['afii10077'] = 0x043B;
  14988. t['afii10078'] = 0x043C;
  14989. t['afii10079'] = 0x043D;
  14990. t['afii10080'] = 0x043E;
  14991. t['afii10081'] = 0x043F;
  14992. t['afii10082'] = 0x0440;
  14993. t['afii10083'] = 0x0441;
  14994. t['afii10084'] = 0x0442;
  14995. t['afii10085'] = 0x0443;
  14996. t['afii10086'] = 0x0444;
  14997. t['afii10087'] = 0x0445;
  14998. t['afii10088'] = 0x0446;
  14999. t['afii10089'] = 0x0447;
  15000. t['afii10090'] = 0x0448;
  15001. t['afii10091'] = 0x0449;
  15002. t['afii10092'] = 0x044A;
  15003. t['afii10093'] = 0x044B;
  15004. t['afii10094'] = 0x044C;
  15005. t['afii10095'] = 0x044D;
  15006. t['afii10096'] = 0x044E;
  15007. t['afii10097'] = 0x044F;
  15008. t['afii10098'] = 0x0491;
  15009. t['afii10099'] = 0x0452;
  15010. t['afii10100'] = 0x0453;
  15011. t['afii10101'] = 0x0454;
  15012. t['afii10102'] = 0x0455;
  15013. t['afii10103'] = 0x0456;
  15014. t['afii10104'] = 0x0457;
  15015. t['afii10105'] = 0x0458;
  15016. t['afii10106'] = 0x0459;
  15017. t['afii10107'] = 0x045A;
  15018. t['afii10108'] = 0x045B;
  15019. t['afii10109'] = 0x045C;
  15020. t['afii10110'] = 0x045E;
  15021. t['afii10145'] = 0x040F;
  15022. t['afii10146'] = 0x0462;
  15023. t['afii10147'] = 0x0472;
  15024. t['afii10148'] = 0x0474;
  15025. t['afii10192'] = 0xF6C6;
  15026. t['afii10193'] = 0x045F;
  15027. t['afii10194'] = 0x0463;
  15028. t['afii10195'] = 0x0473;
  15029. t['afii10196'] = 0x0475;
  15030. t['afii10831'] = 0xF6C7;
  15031. t['afii10832'] = 0xF6C8;
  15032. t['afii10846'] = 0x04D9;
  15033. t['afii299'] = 0x200E;
  15034. t['afii300'] = 0x200F;
  15035. t['afii301'] = 0x200D;
  15036. t['afii57381'] = 0x066A;
  15037. t['afii57388'] = 0x060C;
  15038. t['afii57392'] = 0x0660;
  15039. t['afii57393'] = 0x0661;
  15040. t['afii57394'] = 0x0662;
  15041. t['afii57395'] = 0x0663;
  15042. t['afii57396'] = 0x0664;
  15043. t['afii57397'] = 0x0665;
  15044. t['afii57398'] = 0x0666;
  15045. t['afii57399'] = 0x0667;
  15046. t['afii57400'] = 0x0668;
  15047. t['afii57401'] = 0x0669;
  15048. t['afii57403'] = 0x061B;
  15049. t['afii57407'] = 0x061F;
  15050. t['afii57409'] = 0x0621;
  15051. t['afii57410'] = 0x0622;
  15052. t['afii57411'] = 0x0623;
  15053. t['afii57412'] = 0x0624;
  15054. t['afii57413'] = 0x0625;
  15055. t['afii57414'] = 0x0626;
  15056. t['afii57415'] = 0x0627;
  15057. t['afii57416'] = 0x0628;
  15058. t['afii57417'] = 0x0629;
  15059. t['afii57418'] = 0x062A;
  15060. t['afii57419'] = 0x062B;
  15061. t['afii57420'] = 0x062C;
  15062. t['afii57421'] = 0x062D;
  15063. t['afii57422'] = 0x062E;
  15064. t['afii57423'] = 0x062F;
  15065. t['afii57424'] = 0x0630;
  15066. t['afii57425'] = 0x0631;
  15067. t['afii57426'] = 0x0632;
  15068. t['afii57427'] = 0x0633;
  15069. t['afii57428'] = 0x0634;
  15070. t['afii57429'] = 0x0635;
  15071. t['afii57430'] = 0x0636;
  15072. t['afii57431'] = 0x0637;
  15073. t['afii57432'] = 0x0638;
  15074. t['afii57433'] = 0x0639;
  15075. t['afii57434'] = 0x063A;
  15076. t['afii57440'] = 0x0640;
  15077. t['afii57441'] = 0x0641;
  15078. t['afii57442'] = 0x0642;
  15079. t['afii57443'] = 0x0643;
  15080. t['afii57444'] = 0x0644;
  15081. t['afii57445'] = 0x0645;
  15082. t['afii57446'] = 0x0646;
  15083. t['afii57448'] = 0x0648;
  15084. t['afii57449'] = 0x0649;
  15085. t['afii57450'] = 0x064A;
  15086. t['afii57451'] = 0x064B;
  15087. t['afii57452'] = 0x064C;
  15088. t['afii57453'] = 0x064D;
  15089. t['afii57454'] = 0x064E;
  15090. t['afii57455'] = 0x064F;
  15091. t['afii57456'] = 0x0650;
  15092. t['afii57457'] = 0x0651;
  15093. t['afii57458'] = 0x0652;
  15094. t['afii57470'] = 0x0647;
  15095. t['afii57505'] = 0x06A4;
  15096. t['afii57506'] = 0x067E;
  15097. t['afii57507'] = 0x0686;
  15098. t['afii57508'] = 0x0698;
  15099. t['afii57509'] = 0x06AF;
  15100. t['afii57511'] = 0x0679;
  15101. t['afii57512'] = 0x0688;
  15102. t['afii57513'] = 0x0691;
  15103. t['afii57514'] = 0x06BA;
  15104. t['afii57519'] = 0x06D2;
  15105. t['afii57534'] = 0x06D5;
  15106. t['afii57636'] = 0x20AA;
  15107. t['afii57645'] = 0x05BE;
  15108. t['afii57658'] = 0x05C3;
  15109. t['afii57664'] = 0x05D0;
  15110. t['afii57665'] = 0x05D1;
  15111. t['afii57666'] = 0x05D2;
  15112. t['afii57667'] = 0x05D3;
  15113. t['afii57668'] = 0x05D4;
  15114. t['afii57669'] = 0x05D5;
  15115. t['afii57670'] = 0x05D6;
  15116. t['afii57671'] = 0x05D7;
  15117. t['afii57672'] = 0x05D8;
  15118. t['afii57673'] = 0x05D9;
  15119. t['afii57674'] = 0x05DA;
  15120. t['afii57675'] = 0x05DB;
  15121. t['afii57676'] = 0x05DC;
  15122. t['afii57677'] = 0x05DD;
  15123. t['afii57678'] = 0x05DE;
  15124. t['afii57679'] = 0x05DF;
  15125. t['afii57680'] = 0x05E0;
  15126. t['afii57681'] = 0x05E1;
  15127. t['afii57682'] = 0x05E2;
  15128. t['afii57683'] = 0x05E3;
  15129. t['afii57684'] = 0x05E4;
  15130. t['afii57685'] = 0x05E5;
  15131. t['afii57686'] = 0x05E6;
  15132. t['afii57687'] = 0x05E7;
  15133. t['afii57688'] = 0x05E8;
  15134. t['afii57689'] = 0x05E9;
  15135. t['afii57690'] = 0x05EA;
  15136. t['afii57694'] = 0xFB2A;
  15137. t['afii57695'] = 0xFB2B;
  15138. t['afii57700'] = 0xFB4B;
  15139. t['afii57705'] = 0xFB1F;
  15140. t['afii57716'] = 0x05F0;
  15141. t['afii57717'] = 0x05F1;
  15142. t['afii57718'] = 0x05F2;
  15143. t['afii57723'] = 0xFB35;
  15144. t['afii57793'] = 0x05B4;
  15145. t['afii57794'] = 0x05B5;
  15146. t['afii57795'] = 0x05B6;
  15147. t['afii57796'] = 0x05BB;
  15148. t['afii57797'] = 0x05B8;
  15149. t['afii57798'] = 0x05B7;
  15150. t['afii57799'] = 0x05B0;
  15151. t['afii57800'] = 0x05B2;
  15152. t['afii57801'] = 0x05B1;
  15153. t['afii57802'] = 0x05B3;
  15154. t['afii57803'] = 0x05C2;
  15155. t['afii57804'] = 0x05C1;
  15156. t['afii57806'] = 0x05B9;
  15157. t['afii57807'] = 0x05BC;
  15158. t['afii57839'] = 0x05BD;
  15159. t['afii57841'] = 0x05BF;
  15160. t['afii57842'] = 0x05C0;
  15161. t['afii57929'] = 0x02BC;
  15162. t['afii61248'] = 0x2105;
  15163. t['afii61289'] = 0x2113;
  15164. t['afii61352'] = 0x2116;
  15165. t['afii61573'] = 0x202C;
  15166. t['afii61574'] = 0x202D;
  15167. t['afii61575'] = 0x202E;
  15168. t['afii61664'] = 0x200C;
  15169. t['afii63167'] = 0x066D;
  15170. t['afii64937'] = 0x02BD;
  15171. t['agrave'] = 0x00E0;
  15172. t['agujarati'] = 0x0A85;
  15173. t['agurmukhi'] = 0x0A05;
  15174. t['ahiragana'] = 0x3042;
  15175. t['ahookabove'] = 0x1EA3;
  15176. t['aibengali'] = 0x0990;
  15177. t['aibopomofo'] = 0x311E;
  15178. t['aideva'] = 0x0910;
  15179. t['aiecyrillic'] = 0x04D5;
  15180. t['aigujarati'] = 0x0A90;
  15181. t['aigurmukhi'] = 0x0A10;
  15182. t['aimatragurmukhi'] = 0x0A48;
  15183. t['ainarabic'] = 0x0639;
  15184. t['ainfinalarabic'] = 0xFECA;
  15185. t['aininitialarabic'] = 0xFECB;
  15186. t['ainmedialarabic'] = 0xFECC;
  15187. t['ainvertedbreve'] = 0x0203;
  15188. t['aivowelsignbengali'] = 0x09C8;
  15189. t['aivowelsigndeva'] = 0x0948;
  15190. t['aivowelsigngujarati'] = 0x0AC8;
  15191. t['akatakana'] = 0x30A2;
  15192. t['akatakanahalfwidth'] = 0xFF71;
  15193. t['akorean'] = 0x314F;
  15194. t['alef'] = 0x05D0;
  15195. t['alefarabic'] = 0x0627;
  15196. t['alefdageshhebrew'] = 0xFB30;
  15197. t['aleffinalarabic'] = 0xFE8E;
  15198. t['alefhamzaabovearabic'] = 0x0623;
  15199. t['alefhamzaabovefinalarabic'] = 0xFE84;
  15200. t['alefhamzabelowarabic'] = 0x0625;
  15201. t['alefhamzabelowfinalarabic'] = 0xFE88;
  15202. t['alefhebrew'] = 0x05D0;
  15203. t['aleflamedhebrew'] = 0xFB4F;
  15204. t['alefmaddaabovearabic'] = 0x0622;
  15205. t['alefmaddaabovefinalarabic'] = 0xFE82;
  15206. t['alefmaksuraarabic'] = 0x0649;
  15207. t['alefmaksurafinalarabic'] = 0xFEF0;
  15208. t['alefmaksurainitialarabic'] = 0xFEF3;
  15209. t['alefmaksuramedialarabic'] = 0xFEF4;
  15210. t['alefpatahhebrew'] = 0xFB2E;
  15211. t['alefqamatshebrew'] = 0xFB2F;
  15212. t['aleph'] = 0x2135;
  15213. t['allequal'] = 0x224C;
  15214. t['alpha'] = 0x03B1;
  15215. t['alphatonos'] = 0x03AC;
  15216. t['amacron'] = 0x0101;
  15217. t['amonospace'] = 0xFF41;
  15218. t['ampersand'] = 0x0026;
  15219. t['ampersandmonospace'] = 0xFF06;
  15220. t['ampersandsmall'] = 0xF726;
  15221. t['amsquare'] = 0x33C2;
  15222. t['anbopomofo'] = 0x3122;
  15223. t['angbopomofo'] = 0x3124;
  15224. t['angbracketleft'] = 0x3008;
  15225. t['angbracketright'] = 0x3009;
  15226. t['angkhankhuthai'] = 0x0E5A;
  15227. t['angle'] = 0x2220;
  15228. t['anglebracketleft'] = 0x3008;
  15229. t['anglebracketleftvertical'] = 0xFE3F;
  15230. t['anglebracketright'] = 0x3009;
  15231. t['anglebracketrightvertical'] = 0xFE40;
  15232. t['angleleft'] = 0x2329;
  15233. t['angleright'] = 0x232A;
  15234. t['angstrom'] = 0x212B;
  15235. t['anoteleia'] = 0x0387;
  15236. t['anudattadeva'] = 0x0952;
  15237. t['anusvarabengali'] = 0x0982;
  15238. t['anusvaradeva'] = 0x0902;
  15239. t['anusvaragujarati'] = 0x0A82;
  15240. t['aogonek'] = 0x0105;
  15241. t['apaatosquare'] = 0x3300;
  15242. t['aparen'] = 0x249C;
  15243. t['apostrophearmenian'] = 0x055A;
  15244. t['apostrophemod'] = 0x02BC;
  15245. t['apple'] = 0xF8FF;
  15246. t['approaches'] = 0x2250;
  15247. t['approxequal'] = 0x2248;
  15248. t['approxequalorimage'] = 0x2252;
  15249. t['approximatelyequal'] = 0x2245;
  15250. t['araeaekorean'] = 0x318E;
  15251. t['araeakorean'] = 0x318D;
  15252. t['arc'] = 0x2312;
  15253. t['arighthalfring'] = 0x1E9A;
  15254. t['aring'] = 0x00E5;
  15255. t['aringacute'] = 0x01FB;
  15256. t['aringbelow'] = 0x1E01;
  15257. t['arrowboth'] = 0x2194;
  15258. t['arrowdashdown'] = 0x21E3;
  15259. t['arrowdashleft'] = 0x21E0;
  15260. t['arrowdashright'] = 0x21E2;
  15261. t['arrowdashup'] = 0x21E1;
  15262. t['arrowdblboth'] = 0x21D4;
  15263. t['arrowdbldown'] = 0x21D3;
  15264. t['arrowdblleft'] = 0x21D0;
  15265. t['arrowdblright'] = 0x21D2;
  15266. t['arrowdblup'] = 0x21D1;
  15267. t['arrowdown'] = 0x2193;
  15268. t['arrowdownleft'] = 0x2199;
  15269. t['arrowdownright'] = 0x2198;
  15270. t['arrowdownwhite'] = 0x21E9;
  15271. t['arrowheaddownmod'] = 0x02C5;
  15272. t['arrowheadleftmod'] = 0x02C2;
  15273. t['arrowheadrightmod'] = 0x02C3;
  15274. t['arrowheadupmod'] = 0x02C4;
  15275. t['arrowhorizex'] = 0xF8E7;
  15276. t['arrowleft'] = 0x2190;
  15277. t['arrowleftdbl'] = 0x21D0;
  15278. t['arrowleftdblstroke'] = 0x21CD;
  15279. t['arrowleftoverright'] = 0x21C6;
  15280. t['arrowleftwhite'] = 0x21E6;
  15281. t['arrowright'] = 0x2192;
  15282. t['arrowrightdblstroke'] = 0x21CF;
  15283. t['arrowrightheavy'] = 0x279E;
  15284. t['arrowrightoverleft'] = 0x21C4;
  15285. t['arrowrightwhite'] = 0x21E8;
  15286. t['arrowtableft'] = 0x21E4;
  15287. t['arrowtabright'] = 0x21E5;
  15288. t['arrowup'] = 0x2191;
  15289. t['arrowupdn'] = 0x2195;
  15290. t['arrowupdnbse'] = 0x21A8;
  15291. t['arrowupdownbase'] = 0x21A8;
  15292. t['arrowupleft'] = 0x2196;
  15293. t['arrowupleftofdown'] = 0x21C5;
  15294. t['arrowupright'] = 0x2197;
  15295. t['arrowupwhite'] = 0x21E7;
  15296. t['arrowvertex'] = 0xF8E6;
  15297. t['asciicircum'] = 0x005E;
  15298. t['asciicircummonospace'] = 0xFF3E;
  15299. t['asciitilde'] = 0x007E;
  15300. t['asciitildemonospace'] = 0xFF5E;
  15301. t['ascript'] = 0x0251;
  15302. t['ascriptturned'] = 0x0252;
  15303. t['asmallhiragana'] = 0x3041;
  15304. t['asmallkatakana'] = 0x30A1;
  15305. t['asmallkatakanahalfwidth'] = 0xFF67;
  15306. t['asterisk'] = 0x002A;
  15307. t['asteriskaltonearabic'] = 0x066D;
  15308. t['asteriskarabic'] = 0x066D;
  15309. t['asteriskmath'] = 0x2217;
  15310. t['asteriskmonospace'] = 0xFF0A;
  15311. t['asterisksmall'] = 0xFE61;
  15312. t['asterism'] = 0x2042;
  15313. t['asuperior'] = 0xF6E9;
  15314. t['asymptoticallyequal'] = 0x2243;
  15315. t['at'] = 0x0040;
  15316. t['atilde'] = 0x00E3;
  15317. t['atmonospace'] = 0xFF20;
  15318. t['atsmall'] = 0xFE6B;
  15319. t['aturned'] = 0x0250;
  15320. t['aubengali'] = 0x0994;
  15321. t['aubopomofo'] = 0x3120;
  15322. t['audeva'] = 0x0914;
  15323. t['augujarati'] = 0x0A94;
  15324. t['augurmukhi'] = 0x0A14;
  15325. t['aulengthmarkbengali'] = 0x09D7;
  15326. t['aumatragurmukhi'] = 0x0A4C;
  15327. t['auvowelsignbengali'] = 0x09CC;
  15328. t['auvowelsigndeva'] = 0x094C;
  15329. t['auvowelsigngujarati'] = 0x0ACC;
  15330. t['avagrahadeva'] = 0x093D;
  15331. t['aybarmenian'] = 0x0561;
  15332. t['ayin'] = 0x05E2;
  15333. t['ayinaltonehebrew'] = 0xFB20;
  15334. t['ayinhebrew'] = 0x05E2;
  15335. t['b'] = 0x0062;
  15336. t['babengali'] = 0x09AC;
  15337. t['backslash'] = 0x005C;
  15338. t['backslashmonospace'] = 0xFF3C;
  15339. t['badeva'] = 0x092C;
  15340. t['bagujarati'] = 0x0AAC;
  15341. t['bagurmukhi'] = 0x0A2C;
  15342. t['bahiragana'] = 0x3070;
  15343. t['bahtthai'] = 0x0E3F;
  15344. t['bakatakana'] = 0x30D0;
  15345. t['bar'] = 0x007C;
  15346. t['barmonospace'] = 0xFF5C;
  15347. t['bbopomofo'] = 0x3105;
  15348. t['bcircle'] = 0x24D1;
  15349. t['bdotaccent'] = 0x1E03;
  15350. t['bdotbelow'] = 0x1E05;
  15351. t['beamedsixteenthnotes'] = 0x266C;
  15352. t['because'] = 0x2235;
  15353. t['becyrillic'] = 0x0431;
  15354. t['beharabic'] = 0x0628;
  15355. t['behfinalarabic'] = 0xFE90;
  15356. t['behinitialarabic'] = 0xFE91;
  15357. t['behiragana'] = 0x3079;
  15358. t['behmedialarabic'] = 0xFE92;
  15359. t['behmeeminitialarabic'] = 0xFC9F;
  15360. t['behmeemisolatedarabic'] = 0xFC08;
  15361. t['behnoonfinalarabic'] = 0xFC6D;
  15362. t['bekatakana'] = 0x30D9;
  15363. t['benarmenian'] = 0x0562;
  15364. t['bet'] = 0x05D1;
  15365. t['beta'] = 0x03B2;
  15366. t['betasymbolgreek'] = 0x03D0;
  15367. t['betdagesh'] = 0xFB31;
  15368. t['betdageshhebrew'] = 0xFB31;
  15369. t['bethebrew'] = 0x05D1;
  15370. t['betrafehebrew'] = 0xFB4C;
  15371. t['bhabengali'] = 0x09AD;
  15372. t['bhadeva'] = 0x092D;
  15373. t['bhagujarati'] = 0x0AAD;
  15374. t['bhagurmukhi'] = 0x0A2D;
  15375. t['bhook'] = 0x0253;
  15376. t['bihiragana'] = 0x3073;
  15377. t['bikatakana'] = 0x30D3;
  15378. t['bilabialclick'] = 0x0298;
  15379. t['bindigurmukhi'] = 0x0A02;
  15380. t['birusquare'] = 0x3331;
  15381. t['blackcircle'] = 0x25CF;
  15382. t['blackdiamond'] = 0x25C6;
  15383. t['blackdownpointingtriangle'] = 0x25BC;
  15384. t['blackleftpointingpointer'] = 0x25C4;
  15385. t['blackleftpointingtriangle'] = 0x25C0;
  15386. t['blacklenticularbracketleft'] = 0x3010;
  15387. t['blacklenticularbracketleftvertical'] = 0xFE3B;
  15388. t['blacklenticularbracketright'] = 0x3011;
  15389. t['blacklenticularbracketrightvertical'] = 0xFE3C;
  15390. t['blacklowerlefttriangle'] = 0x25E3;
  15391. t['blacklowerrighttriangle'] = 0x25E2;
  15392. t['blackrectangle'] = 0x25AC;
  15393. t['blackrightpointingpointer'] = 0x25BA;
  15394. t['blackrightpointingtriangle'] = 0x25B6;
  15395. t['blacksmallsquare'] = 0x25AA;
  15396. t['blacksmilingface'] = 0x263B;
  15397. t['blacksquare'] = 0x25A0;
  15398. t['blackstar'] = 0x2605;
  15399. t['blackupperlefttriangle'] = 0x25E4;
  15400. t['blackupperrighttriangle'] = 0x25E5;
  15401. t['blackuppointingsmalltriangle'] = 0x25B4;
  15402. t['blackuppointingtriangle'] = 0x25B2;
  15403. t['blank'] = 0x2423;
  15404. t['blinebelow'] = 0x1E07;
  15405. t['block'] = 0x2588;
  15406. t['bmonospace'] = 0xFF42;
  15407. t['bobaimaithai'] = 0x0E1A;
  15408. t['bohiragana'] = 0x307C;
  15409. t['bokatakana'] = 0x30DC;
  15410. t['bparen'] = 0x249D;
  15411. t['bqsquare'] = 0x33C3;
  15412. t['braceex'] = 0xF8F4;
  15413. t['braceleft'] = 0x007B;
  15414. t['braceleftbt'] = 0xF8F3;
  15415. t['braceleftmid'] = 0xF8F2;
  15416. t['braceleftmonospace'] = 0xFF5B;
  15417. t['braceleftsmall'] = 0xFE5B;
  15418. t['bracelefttp'] = 0xF8F1;
  15419. t['braceleftvertical'] = 0xFE37;
  15420. t['braceright'] = 0x007D;
  15421. t['bracerightbt'] = 0xF8FE;
  15422. t['bracerightmid'] = 0xF8FD;
  15423. t['bracerightmonospace'] = 0xFF5D;
  15424. t['bracerightsmall'] = 0xFE5C;
  15425. t['bracerighttp'] = 0xF8FC;
  15426. t['bracerightvertical'] = 0xFE38;
  15427. t['bracketleft'] = 0x005B;
  15428. t['bracketleftbt'] = 0xF8F0;
  15429. t['bracketleftex'] = 0xF8EF;
  15430. t['bracketleftmonospace'] = 0xFF3B;
  15431. t['bracketlefttp'] = 0xF8EE;
  15432. t['bracketright'] = 0x005D;
  15433. t['bracketrightbt'] = 0xF8FB;
  15434. t['bracketrightex'] = 0xF8FA;
  15435. t['bracketrightmonospace'] = 0xFF3D;
  15436. t['bracketrighttp'] = 0xF8F9;
  15437. t['breve'] = 0x02D8;
  15438. t['brevebelowcmb'] = 0x032E;
  15439. t['brevecmb'] = 0x0306;
  15440. t['breveinvertedbelowcmb'] = 0x032F;
  15441. t['breveinvertedcmb'] = 0x0311;
  15442. t['breveinverteddoublecmb'] = 0x0361;
  15443. t['bridgebelowcmb'] = 0x032A;
  15444. t['bridgeinvertedbelowcmb'] = 0x033A;
  15445. t['brokenbar'] = 0x00A6;
  15446. t['bstroke'] = 0x0180;
  15447. t['bsuperior'] = 0xF6EA;
  15448. t['btopbar'] = 0x0183;
  15449. t['buhiragana'] = 0x3076;
  15450. t['bukatakana'] = 0x30D6;
  15451. t['bullet'] = 0x2022;
  15452. t['bulletinverse'] = 0x25D8;
  15453. t['bulletoperator'] = 0x2219;
  15454. t['bullseye'] = 0x25CE;
  15455. t['c'] = 0x0063;
  15456. t['caarmenian'] = 0x056E;
  15457. t['cabengali'] = 0x099A;
  15458. t['cacute'] = 0x0107;
  15459. t['cadeva'] = 0x091A;
  15460. t['cagujarati'] = 0x0A9A;
  15461. t['cagurmukhi'] = 0x0A1A;
  15462. t['calsquare'] = 0x3388;
  15463. t['candrabindubengali'] = 0x0981;
  15464. t['candrabinducmb'] = 0x0310;
  15465. t['candrabindudeva'] = 0x0901;
  15466. t['candrabindugujarati'] = 0x0A81;
  15467. t['capslock'] = 0x21EA;
  15468. t['careof'] = 0x2105;
  15469. t['caron'] = 0x02C7;
  15470. t['caronbelowcmb'] = 0x032C;
  15471. t['caroncmb'] = 0x030C;
  15472. t['carriagereturn'] = 0x21B5;
  15473. t['cbopomofo'] = 0x3118;
  15474. t['ccaron'] = 0x010D;
  15475. t['ccedilla'] = 0x00E7;
  15476. t['ccedillaacute'] = 0x1E09;
  15477. t['ccircle'] = 0x24D2;
  15478. t['ccircumflex'] = 0x0109;
  15479. t['ccurl'] = 0x0255;
  15480. t['cdot'] = 0x010B;
  15481. t['cdotaccent'] = 0x010B;
  15482. t['cdsquare'] = 0x33C5;
  15483. t['cedilla'] = 0x00B8;
  15484. t['cedillacmb'] = 0x0327;
  15485. t['cent'] = 0x00A2;
  15486. t['centigrade'] = 0x2103;
  15487. t['centinferior'] = 0xF6DF;
  15488. t['centmonospace'] = 0xFFE0;
  15489. t['centoldstyle'] = 0xF7A2;
  15490. t['centsuperior'] = 0xF6E0;
  15491. t['chaarmenian'] = 0x0579;
  15492. t['chabengali'] = 0x099B;
  15493. t['chadeva'] = 0x091B;
  15494. t['chagujarati'] = 0x0A9B;
  15495. t['chagurmukhi'] = 0x0A1B;
  15496. t['chbopomofo'] = 0x3114;
  15497. t['cheabkhasiancyrillic'] = 0x04BD;
  15498. t['checkmark'] = 0x2713;
  15499. t['checyrillic'] = 0x0447;
  15500. t['chedescenderabkhasiancyrillic'] = 0x04BF;
  15501. t['chedescendercyrillic'] = 0x04B7;
  15502. t['chedieresiscyrillic'] = 0x04F5;
  15503. t['cheharmenian'] = 0x0573;
  15504. t['chekhakassiancyrillic'] = 0x04CC;
  15505. t['cheverticalstrokecyrillic'] = 0x04B9;
  15506. t['chi'] = 0x03C7;
  15507. t['chieuchacirclekorean'] = 0x3277;
  15508. t['chieuchaparenkorean'] = 0x3217;
  15509. t['chieuchcirclekorean'] = 0x3269;
  15510. t['chieuchkorean'] = 0x314A;
  15511. t['chieuchparenkorean'] = 0x3209;
  15512. t['chochangthai'] = 0x0E0A;
  15513. t['chochanthai'] = 0x0E08;
  15514. t['chochingthai'] = 0x0E09;
  15515. t['chochoethai'] = 0x0E0C;
  15516. t['chook'] = 0x0188;
  15517. t['cieucacirclekorean'] = 0x3276;
  15518. t['cieucaparenkorean'] = 0x3216;
  15519. t['cieuccirclekorean'] = 0x3268;
  15520. t['cieuckorean'] = 0x3148;
  15521. t['cieucparenkorean'] = 0x3208;
  15522. t['cieucuparenkorean'] = 0x321C;
  15523. t['circle'] = 0x25CB;
  15524. t['circlecopyrt'] = 0x00A9;
  15525. t['circlemultiply'] = 0x2297;
  15526. t['circleot'] = 0x2299;
  15527. t['circleplus'] = 0x2295;
  15528. t['circlepostalmark'] = 0x3036;
  15529. t['circlewithlefthalfblack'] = 0x25D0;
  15530. t['circlewithrighthalfblack'] = 0x25D1;
  15531. t['circumflex'] = 0x02C6;
  15532. t['circumflexbelowcmb'] = 0x032D;
  15533. t['circumflexcmb'] = 0x0302;
  15534. t['clear'] = 0x2327;
  15535. t['clickalveolar'] = 0x01C2;
  15536. t['clickdental'] = 0x01C0;
  15537. t['clicklateral'] = 0x01C1;
  15538. t['clickretroflex'] = 0x01C3;
  15539. t['club'] = 0x2663;
  15540. t['clubsuitblack'] = 0x2663;
  15541. t['clubsuitwhite'] = 0x2667;
  15542. t['cmcubedsquare'] = 0x33A4;
  15543. t['cmonospace'] = 0xFF43;
  15544. t['cmsquaredsquare'] = 0x33A0;
  15545. t['coarmenian'] = 0x0581;
  15546. t['colon'] = 0x003A;
  15547. t['colonmonetary'] = 0x20A1;
  15548. t['colonmonospace'] = 0xFF1A;
  15549. t['colonsign'] = 0x20A1;
  15550. t['colonsmall'] = 0xFE55;
  15551. t['colontriangularhalfmod'] = 0x02D1;
  15552. t['colontriangularmod'] = 0x02D0;
  15553. t['comma'] = 0x002C;
  15554. t['commaabovecmb'] = 0x0313;
  15555. t['commaaboverightcmb'] = 0x0315;
  15556. t['commaaccent'] = 0xF6C3;
  15557. t['commaarabic'] = 0x060C;
  15558. t['commaarmenian'] = 0x055D;
  15559. t['commainferior'] = 0xF6E1;
  15560. t['commamonospace'] = 0xFF0C;
  15561. t['commareversedabovecmb'] = 0x0314;
  15562. t['commareversedmod'] = 0x02BD;
  15563. t['commasmall'] = 0xFE50;
  15564. t['commasuperior'] = 0xF6E2;
  15565. t['commaturnedabovecmb'] = 0x0312;
  15566. t['commaturnedmod'] = 0x02BB;
  15567. t['compass'] = 0x263C;
  15568. t['congruent'] = 0x2245;
  15569. t['contourintegral'] = 0x222E;
  15570. t['control'] = 0x2303;
  15571. t['controlACK'] = 0x0006;
  15572. t['controlBEL'] = 0x0007;
  15573. t['controlBS'] = 0x0008;
  15574. t['controlCAN'] = 0x0018;
  15575. t['controlCR'] = 0x000D;
  15576. t['controlDC1'] = 0x0011;
  15577. t['controlDC2'] = 0x0012;
  15578. t['controlDC3'] = 0x0013;
  15579. t['controlDC4'] = 0x0014;
  15580. t['controlDEL'] = 0x007F;
  15581. t['controlDLE'] = 0x0010;
  15582. t['controlEM'] = 0x0019;
  15583. t['controlENQ'] = 0x0005;
  15584. t['controlEOT'] = 0x0004;
  15585. t['controlESC'] = 0x001B;
  15586. t['controlETB'] = 0x0017;
  15587. t['controlETX'] = 0x0003;
  15588. t['controlFF'] = 0x000C;
  15589. t['controlFS'] = 0x001C;
  15590. t['controlGS'] = 0x001D;
  15591. t['controlHT'] = 0x0009;
  15592. t['controlLF'] = 0x000A;
  15593. t['controlNAK'] = 0x0015;
  15594. t['controlNULL'] = 0x0000;
  15595. t['controlRS'] = 0x001E;
  15596. t['controlSI'] = 0x000F;
  15597. t['controlSO'] = 0x000E;
  15598. t['controlSOT'] = 0x0002;
  15599. t['controlSTX'] = 0x0001;
  15600. t['controlSUB'] = 0x001A;
  15601. t['controlSYN'] = 0x0016;
  15602. t['controlUS'] = 0x001F;
  15603. t['controlVT'] = 0x000B;
  15604. t['copyright'] = 0x00A9;
  15605. t['copyrightsans'] = 0xF8E9;
  15606. t['copyrightserif'] = 0xF6D9;
  15607. t['cornerbracketleft'] = 0x300C;
  15608. t['cornerbracketlefthalfwidth'] = 0xFF62;
  15609. t['cornerbracketleftvertical'] = 0xFE41;
  15610. t['cornerbracketright'] = 0x300D;
  15611. t['cornerbracketrighthalfwidth'] = 0xFF63;
  15612. t['cornerbracketrightvertical'] = 0xFE42;
  15613. t['corporationsquare'] = 0x337F;
  15614. t['cosquare'] = 0x33C7;
  15615. t['coverkgsquare'] = 0x33C6;
  15616. t['cparen'] = 0x249E;
  15617. t['cruzeiro'] = 0x20A2;
  15618. t['cstretched'] = 0x0297;
  15619. t['curlyand'] = 0x22CF;
  15620. t['curlyor'] = 0x22CE;
  15621. t['currency'] = 0x00A4;
  15622. t['cyrBreve'] = 0xF6D1;
  15623. t['cyrFlex'] = 0xF6D2;
  15624. t['cyrbreve'] = 0xF6D4;
  15625. t['cyrflex'] = 0xF6D5;
  15626. t['d'] = 0x0064;
  15627. t['daarmenian'] = 0x0564;
  15628. t['dabengali'] = 0x09A6;
  15629. t['dadarabic'] = 0x0636;
  15630. t['dadeva'] = 0x0926;
  15631. t['dadfinalarabic'] = 0xFEBE;
  15632. t['dadinitialarabic'] = 0xFEBF;
  15633. t['dadmedialarabic'] = 0xFEC0;
  15634. t['dagesh'] = 0x05BC;
  15635. t['dageshhebrew'] = 0x05BC;
  15636. t['dagger'] = 0x2020;
  15637. t['daggerdbl'] = 0x2021;
  15638. t['dagujarati'] = 0x0AA6;
  15639. t['dagurmukhi'] = 0x0A26;
  15640. t['dahiragana'] = 0x3060;
  15641. t['dakatakana'] = 0x30C0;
  15642. t['dalarabic'] = 0x062F;
  15643. t['dalet'] = 0x05D3;
  15644. t['daletdagesh'] = 0xFB33;
  15645. t['daletdageshhebrew'] = 0xFB33;
  15646. t['dalethebrew'] = 0x05D3;
  15647. t['dalfinalarabic'] = 0xFEAA;
  15648. t['dammaarabic'] = 0x064F;
  15649. t['dammalowarabic'] = 0x064F;
  15650. t['dammatanaltonearabic'] = 0x064C;
  15651. t['dammatanarabic'] = 0x064C;
  15652. t['danda'] = 0x0964;
  15653. t['dargahebrew'] = 0x05A7;
  15654. t['dargalefthebrew'] = 0x05A7;
  15655. t['dasiapneumatacyrilliccmb'] = 0x0485;
  15656. t['dblGrave'] = 0xF6D3;
  15657. t['dblanglebracketleft'] = 0x300A;
  15658. t['dblanglebracketleftvertical'] = 0xFE3D;
  15659. t['dblanglebracketright'] = 0x300B;
  15660. t['dblanglebracketrightvertical'] = 0xFE3E;
  15661. t['dblarchinvertedbelowcmb'] = 0x032B;
  15662. t['dblarrowleft'] = 0x21D4;
  15663. t['dblarrowright'] = 0x21D2;
  15664. t['dbldanda'] = 0x0965;
  15665. t['dblgrave'] = 0xF6D6;
  15666. t['dblgravecmb'] = 0x030F;
  15667. t['dblintegral'] = 0x222C;
  15668. t['dbllowline'] = 0x2017;
  15669. t['dbllowlinecmb'] = 0x0333;
  15670. t['dbloverlinecmb'] = 0x033F;
  15671. t['dblprimemod'] = 0x02BA;
  15672. t['dblverticalbar'] = 0x2016;
  15673. t['dblverticallineabovecmb'] = 0x030E;
  15674. t['dbopomofo'] = 0x3109;
  15675. t['dbsquare'] = 0x33C8;
  15676. t['dcaron'] = 0x010F;
  15677. t['dcedilla'] = 0x1E11;
  15678. t['dcircle'] = 0x24D3;
  15679. t['dcircumflexbelow'] = 0x1E13;
  15680. t['dcroat'] = 0x0111;
  15681. t['ddabengali'] = 0x09A1;
  15682. t['ddadeva'] = 0x0921;
  15683. t['ddagujarati'] = 0x0AA1;
  15684. t['ddagurmukhi'] = 0x0A21;
  15685. t['ddalarabic'] = 0x0688;
  15686. t['ddalfinalarabic'] = 0xFB89;
  15687. t['dddhadeva'] = 0x095C;
  15688. t['ddhabengali'] = 0x09A2;
  15689. t['ddhadeva'] = 0x0922;
  15690. t['ddhagujarati'] = 0x0AA2;
  15691. t['ddhagurmukhi'] = 0x0A22;
  15692. t['ddotaccent'] = 0x1E0B;
  15693. t['ddotbelow'] = 0x1E0D;
  15694. t['decimalseparatorarabic'] = 0x066B;
  15695. t['decimalseparatorpersian'] = 0x066B;
  15696. t['decyrillic'] = 0x0434;
  15697. t['degree'] = 0x00B0;
  15698. t['dehihebrew'] = 0x05AD;
  15699. t['dehiragana'] = 0x3067;
  15700. t['deicoptic'] = 0x03EF;
  15701. t['dekatakana'] = 0x30C7;
  15702. t['deleteleft'] = 0x232B;
  15703. t['deleteright'] = 0x2326;
  15704. t['delta'] = 0x03B4;
  15705. t['deltaturned'] = 0x018D;
  15706. t['denominatorminusonenumeratorbengali'] = 0x09F8;
  15707. t['dezh'] = 0x02A4;
  15708. t['dhabengali'] = 0x09A7;
  15709. t['dhadeva'] = 0x0927;
  15710. t['dhagujarati'] = 0x0AA7;
  15711. t['dhagurmukhi'] = 0x0A27;
  15712. t['dhook'] = 0x0257;
  15713. t['dialytikatonos'] = 0x0385;
  15714. t['dialytikatonoscmb'] = 0x0344;
  15715. t['diamond'] = 0x2666;
  15716. t['diamondsuitwhite'] = 0x2662;
  15717. t['dieresis'] = 0x00A8;
  15718. t['dieresisacute'] = 0xF6D7;
  15719. t['dieresisbelowcmb'] = 0x0324;
  15720. t['dieresiscmb'] = 0x0308;
  15721. t['dieresisgrave'] = 0xF6D8;
  15722. t['dieresistonos'] = 0x0385;
  15723. t['dihiragana'] = 0x3062;
  15724. t['dikatakana'] = 0x30C2;
  15725. t['dittomark'] = 0x3003;
  15726. t['divide'] = 0x00F7;
  15727. t['divides'] = 0x2223;
  15728. t['divisionslash'] = 0x2215;
  15729. t['djecyrillic'] = 0x0452;
  15730. t['dkshade'] = 0x2593;
  15731. t['dlinebelow'] = 0x1E0F;
  15732. t['dlsquare'] = 0x3397;
  15733. t['dmacron'] = 0x0111;
  15734. t['dmonospace'] = 0xFF44;
  15735. t['dnblock'] = 0x2584;
  15736. t['dochadathai'] = 0x0E0E;
  15737. t['dodekthai'] = 0x0E14;
  15738. t['dohiragana'] = 0x3069;
  15739. t['dokatakana'] = 0x30C9;
  15740. t['dollar'] = 0x0024;
  15741. t['dollarinferior'] = 0xF6E3;
  15742. t['dollarmonospace'] = 0xFF04;
  15743. t['dollaroldstyle'] = 0xF724;
  15744. t['dollarsmall'] = 0xFE69;
  15745. t['dollarsuperior'] = 0xF6E4;
  15746. t['dong'] = 0x20AB;
  15747. t['dorusquare'] = 0x3326;
  15748. t['dotaccent'] = 0x02D9;
  15749. t['dotaccentcmb'] = 0x0307;
  15750. t['dotbelowcmb'] = 0x0323;
  15751. t['dotbelowcomb'] = 0x0323;
  15752. t['dotkatakana'] = 0x30FB;
  15753. t['dotlessi'] = 0x0131;
  15754. t['dotlessj'] = 0xF6BE;
  15755. t['dotlessjstrokehook'] = 0x0284;
  15756. t['dotmath'] = 0x22C5;
  15757. t['dottedcircle'] = 0x25CC;
  15758. t['doubleyodpatah'] = 0xFB1F;
  15759. t['doubleyodpatahhebrew'] = 0xFB1F;
  15760. t['downtackbelowcmb'] = 0x031E;
  15761. t['downtackmod'] = 0x02D5;
  15762. t['dparen'] = 0x249F;
  15763. t['dsuperior'] = 0xF6EB;
  15764. t['dtail'] = 0x0256;
  15765. t['dtopbar'] = 0x018C;
  15766. t['duhiragana'] = 0x3065;
  15767. t['dukatakana'] = 0x30C5;
  15768. t['dz'] = 0x01F3;
  15769. t['dzaltone'] = 0x02A3;
  15770. t['dzcaron'] = 0x01C6;
  15771. t['dzcurl'] = 0x02A5;
  15772. t['dzeabkhasiancyrillic'] = 0x04E1;
  15773. t['dzecyrillic'] = 0x0455;
  15774. t['dzhecyrillic'] = 0x045F;
  15775. t['e'] = 0x0065;
  15776. t['eacute'] = 0x00E9;
  15777. t['earth'] = 0x2641;
  15778. t['ebengali'] = 0x098F;
  15779. t['ebopomofo'] = 0x311C;
  15780. t['ebreve'] = 0x0115;
  15781. t['ecandradeva'] = 0x090D;
  15782. t['ecandragujarati'] = 0x0A8D;
  15783. t['ecandravowelsigndeva'] = 0x0945;
  15784. t['ecandravowelsigngujarati'] = 0x0AC5;
  15785. t['ecaron'] = 0x011B;
  15786. t['ecedillabreve'] = 0x1E1D;
  15787. t['echarmenian'] = 0x0565;
  15788. t['echyiwnarmenian'] = 0x0587;
  15789. t['ecircle'] = 0x24D4;
  15790. t['ecircumflex'] = 0x00EA;
  15791. t['ecircumflexacute'] = 0x1EBF;
  15792. t['ecircumflexbelow'] = 0x1E19;
  15793. t['ecircumflexdotbelow'] = 0x1EC7;
  15794. t['ecircumflexgrave'] = 0x1EC1;
  15795. t['ecircumflexhookabove'] = 0x1EC3;
  15796. t['ecircumflextilde'] = 0x1EC5;
  15797. t['ecyrillic'] = 0x0454;
  15798. t['edblgrave'] = 0x0205;
  15799. t['edeva'] = 0x090F;
  15800. t['edieresis'] = 0x00EB;
  15801. t['edot'] = 0x0117;
  15802. t['edotaccent'] = 0x0117;
  15803. t['edotbelow'] = 0x1EB9;
  15804. t['eegurmukhi'] = 0x0A0F;
  15805. t['eematragurmukhi'] = 0x0A47;
  15806. t['efcyrillic'] = 0x0444;
  15807. t['egrave'] = 0x00E8;
  15808. t['egujarati'] = 0x0A8F;
  15809. t['eharmenian'] = 0x0567;
  15810. t['ehbopomofo'] = 0x311D;
  15811. t['ehiragana'] = 0x3048;
  15812. t['ehookabove'] = 0x1EBB;
  15813. t['eibopomofo'] = 0x311F;
  15814. t['eight'] = 0x0038;
  15815. t['eightarabic'] = 0x0668;
  15816. t['eightbengali'] = 0x09EE;
  15817. t['eightcircle'] = 0x2467;
  15818. t['eightcircleinversesansserif'] = 0x2791;
  15819. t['eightdeva'] = 0x096E;
  15820. t['eighteencircle'] = 0x2471;
  15821. t['eighteenparen'] = 0x2485;
  15822. t['eighteenperiod'] = 0x2499;
  15823. t['eightgujarati'] = 0x0AEE;
  15824. t['eightgurmukhi'] = 0x0A6E;
  15825. t['eighthackarabic'] = 0x0668;
  15826. t['eighthangzhou'] = 0x3028;
  15827. t['eighthnotebeamed'] = 0x266B;
  15828. t['eightideographicparen'] = 0x3227;
  15829. t['eightinferior'] = 0x2088;
  15830. t['eightmonospace'] = 0xFF18;
  15831. t['eightoldstyle'] = 0xF738;
  15832. t['eightparen'] = 0x247B;
  15833. t['eightperiod'] = 0x248F;
  15834. t['eightpersian'] = 0x06F8;
  15835. t['eightroman'] = 0x2177;
  15836. t['eightsuperior'] = 0x2078;
  15837. t['eightthai'] = 0x0E58;
  15838. t['einvertedbreve'] = 0x0207;
  15839. t['eiotifiedcyrillic'] = 0x0465;
  15840. t['ekatakana'] = 0x30A8;
  15841. t['ekatakanahalfwidth'] = 0xFF74;
  15842. t['ekonkargurmukhi'] = 0x0A74;
  15843. t['ekorean'] = 0x3154;
  15844. t['elcyrillic'] = 0x043B;
  15845. t['element'] = 0x2208;
  15846. t['elevencircle'] = 0x246A;
  15847. t['elevenparen'] = 0x247E;
  15848. t['elevenperiod'] = 0x2492;
  15849. t['elevenroman'] = 0x217A;
  15850. t['ellipsis'] = 0x2026;
  15851. t['ellipsisvertical'] = 0x22EE;
  15852. t['emacron'] = 0x0113;
  15853. t['emacronacute'] = 0x1E17;
  15854. t['emacrongrave'] = 0x1E15;
  15855. t['emcyrillic'] = 0x043C;
  15856. t['emdash'] = 0x2014;
  15857. t['emdashvertical'] = 0xFE31;
  15858. t['emonospace'] = 0xFF45;
  15859. t['emphasismarkarmenian'] = 0x055B;
  15860. t['emptyset'] = 0x2205;
  15861. t['enbopomofo'] = 0x3123;
  15862. t['encyrillic'] = 0x043D;
  15863. t['endash'] = 0x2013;
  15864. t['endashvertical'] = 0xFE32;
  15865. t['endescendercyrillic'] = 0x04A3;
  15866. t['eng'] = 0x014B;
  15867. t['engbopomofo'] = 0x3125;
  15868. t['enghecyrillic'] = 0x04A5;
  15869. t['enhookcyrillic'] = 0x04C8;
  15870. t['enspace'] = 0x2002;
  15871. t['eogonek'] = 0x0119;
  15872. t['eokorean'] = 0x3153;
  15873. t['eopen'] = 0x025B;
  15874. t['eopenclosed'] = 0x029A;
  15875. t['eopenreversed'] = 0x025C;
  15876. t['eopenreversedclosed'] = 0x025E;
  15877. t['eopenreversedhook'] = 0x025D;
  15878. t['eparen'] = 0x24A0;
  15879. t['epsilon'] = 0x03B5;
  15880. t['epsilontonos'] = 0x03AD;
  15881. t['equal'] = 0x003D;
  15882. t['equalmonospace'] = 0xFF1D;
  15883. t['equalsmall'] = 0xFE66;
  15884. t['equalsuperior'] = 0x207C;
  15885. t['equivalence'] = 0x2261;
  15886. t['erbopomofo'] = 0x3126;
  15887. t['ercyrillic'] = 0x0440;
  15888. t['ereversed'] = 0x0258;
  15889. t['ereversedcyrillic'] = 0x044D;
  15890. t['escyrillic'] = 0x0441;
  15891. t['esdescendercyrillic'] = 0x04AB;
  15892. t['esh'] = 0x0283;
  15893. t['eshcurl'] = 0x0286;
  15894. t['eshortdeva'] = 0x090E;
  15895. t['eshortvowelsigndeva'] = 0x0946;
  15896. t['eshreversedloop'] = 0x01AA;
  15897. t['eshsquatreversed'] = 0x0285;
  15898. t['esmallhiragana'] = 0x3047;
  15899. t['esmallkatakana'] = 0x30A7;
  15900. t['esmallkatakanahalfwidth'] = 0xFF6A;
  15901. t['estimated'] = 0x212E;
  15902. t['esuperior'] = 0xF6EC;
  15903. t['eta'] = 0x03B7;
  15904. t['etarmenian'] = 0x0568;
  15905. t['etatonos'] = 0x03AE;
  15906. t['eth'] = 0x00F0;
  15907. t['etilde'] = 0x1EBD;
  15908. t['etildebelow'] = 0x1E1B;
  15909. t['etnahtafoukhhebrew'] = 0x0591;
  15910. t['etnahtafoukhlefthebrew'] = 0x0591;
  15911. t['etnahtahebrew'] = 0x0591;
  15912. t['etnahtalefthebrew'] = 0x0591;
  15913. t['eturned'] = 0x01DD;
  15914. t['eukorean'] = 0x3161;
  15915. t['euro'] = 0x20AC;
  15916. t['evowelsignbengali'] = 0x09C7;
  15917. t['evowelsigndeva'] = 0x0947;
  15918. t['evowelsigngujarati'] = 0x0AC7;
  15919. t['exclam'] = 0x0021;
  15920. t['exclamarmenian'] = 0x055C;
  15921. t['exclamdbl'] = 0x203C;
  15922. t['exclamdown'] = 0x00A1;
  15923. t['exclamdownsmall'] = 0xF7A1;
  15924. t['exclammonospace'] = 0xFF01;
  15925. t['exclamsmall'] = 0xF721;
  15926. t['existential'] = 0x2203;
  15927. t['ezh'] = 0x0292;
  15928. t['ezhcaron'] = 0x01EF;
  15929. t['ezhcurl'] = 0x0293;
  15930. t['ezhreversed'] = 0x01B9;
  15931. t['ezhtail'] = 0x01BA;
  15932. t['f'] = 0x0066;
  15933. t['fadeva'] = 0x095E;
  15934. t['fagurmukhi'] = 0x0A5E;
  15935. t['fahrenheit'] = 0x2109;
  15936. t['fathaarabic'] = 0x064E;
  15937. t['fathalowarabic'] = 0x064E;
  15938. t['fathatanarabic'] = 0x064B;
  15939. t['fbopomofo'] = 0x3108;
  15940. t['fcircle'] = 0x24D5;
  15941. t['fdotaccent'] = 0x1E1F;
  15942. t['feharabic'] = 0x0641;
  15943. t['feharmenian'] = 0x0586;
  15944. t['fehfinalarabic'] = 0xFED2;
  15945. t['fehinitialarabic'] = 0xFED3;
  15946. t['fehmedialarabic'] = 0xFED4;
  15947. t['feicoptic'] = 0x03E5;
  15948. t['female'] = 0x2640;
  15949. t['ff'] = 0xFB00;
  15950. t['ffi'] = 0xFB03;
  15951. t['ffl'] = 0xFB04;
  15952. t['fi'] = 0xFB01;
  15953. t['fifteencircle'] = 0x246E;
  15954. t['fifteenparen'] = 0x2482;
  15955. t['fifteenperiod'] = 0x2496;
  15956. t['figuredash'] = 0x2012;
  15957. t['filledbox'] = 0x25A0;
  15958. t['filledrect'] = 0x25AC;
  15959. t['finalkaf'] = 0x05DA;
  15960. t['finalkafdagesh'] = 0xFB3A;
  15961. t['finalkafdageshhebrew'] = 0xFB3A;
  15962. t['finalkafhebrew'] = 0x05DA;
  15963. t['finalmem'] = 0x05DD;
  15964. t['finalmemhebrew'] = 0x05DD;
  15965. t['finalnun'] = 0x05DF;
  15966. t['finalnunhebrew'] = 0x05DF;
  15967. t['finalpe'] = 0x05E3;
  15968. t['finalpehebrew'] = 0x05E3;
  15969. t['finaltsadi'] = 0x05E5;
  15970. t['finaltsadihebrew'] = 0x05E5;
  15971. t['firsttonechinese'] = 0x02C9;
  15972. t['fisheye'] = 0x25C9;
  15973. t['fitacyrillic'] = 0x0473;
  15974. t['five'] = 0x0035;
  15975. t['fivearabic'] = 0x0665;
  15976. t['fivebengali'] = 0x09EB;
  15977. t['fivecircle'] = 0x2464;
  15978. t['fivecircleinversesansserif'] = 0x278E;
  15979. t['fivedeva'] = 0x096B;
  15980. t['fiveeighths'] = 0x215D;
  15981. t['fivegujarati'] = 0x0AEB;
  15982. t['fivegurmukhi'] = 0x0A6B;
  15983. t['fivehackarabic'] = 0x0665;
  15984. t['fivehangzhou'] = 0x3025;
  15985. t['fiveideographicparen'] = 0x3224;
  15986. t['fiveinferior'] = 0x2085;
  15987. t['fivemonospace'] = 0xFF15;
  15988. t['fiveoldstyle'] = 0xF735;
  15989. t['fiveparen'] = 0x2478;
  15990. t['fiveperiod'] = 0x248C;
  15991. t['fivepersian'] = 0x06F5;
  15992. t['fiveroman'] = 0x2174;
  15993. t['fivesuperior'] = 0x2075;
  15994. t['fivethai'] = 0x0E55;
  15995. t['fl'] = 0xFB02;
  15996. t['florin'] = 0x0192;
  15997. t['fmonospace'] = 0xFF46;
  15998. t['fmsquare'] = 0x3399;
  15999. t['fofanthai'] = 0x0E1F;
  16000. t['fofathai'] = 0x0E1D;
  16001. t['fongmanthai'] = 0x0E4F;
  16002. t['forall'] = 0x2200;
  16003. t['four'] = 0x0034;
  16004. t['fourarabic'] = 0x0664;
  16005. t['fourbengali'] = 0x09EA;
  16006. t['fourcircle'] = 0x2463;
  16007. t['fourcircleinversesansserif'] = 0x278D;
  16008. t['fourdeva'] = 0x096A;
  16009. t['fourgujarati'] = 0x0AEA;
  16010. t['fourgurmukhi'] = 0x0A6A;
  16011. t['fourhackarabic'] = 0x0664;
  16012. t['fourhangzhou'] = 0x3024;
  16013. t['fourideographicparen'] = 0x3223;
  16014. t['fourinferior'] = 0x2084;
  16015. t['fourmonospace'] = 0xFF14;
  16016. t['fournumeratorbengali'] = 0x09F7;
  16017. t['fouroldstyle'] = 0xF734;
  16018. t['fourparen'] = 0x2477;
  16019. t['fourperiod'] = 0x248B;
  16020. t['fourpersian'] = 0x06F4;
  16021. t['fourroman'] = 0x2173;
  16022. t['foursuperior'] = 0x2074;
  16023. t['fourteencircle'] = 0x246D;
  16024. t['fourteenparen'] = 0x2481;
  16025. t['fourteenperiod'] = 0x2495;
  16026. t['fourthai'] = 0x0E54;
  16027. t['fourthtonechinese'] = 0x02CB;
  16028. t['fparen'] = 0x24A1;
  16029. t['fraction'] = 0x2044;
  16030. t['franc'] = 0x20A3;
  16031. t['g'] = 0x0067;
  16032. t['gabengali'] = 0x0997;
  16033. t['gacute'] = 0x01F5;
  16034. t['gadeva'] = 0x0917;
  16035. t['gafarabic'] = 0x06AF;
  16036. t['gaffinalarabic'] = 0xFB93;
  16037. t['gafinitialarabic'] = 0xFB94;
  16038. t['gafmedialarabic'] = 0xFB95;
  16039. t['gagujarati'] = 0x0A97;
  16040. t['gagurmukhi'] = 0x0A17;
  16041. t['gahiragana'] = 0x304C;
  16042. t['gakatakana'] = 0x30AC;
  16043. t['gamma'] = 0x03B3;
  16044. t['gammalatinsmall'] = 0x0263;
  16045. t['gammasuperior'] = 0x02E0;
  16046. t['gangiacoptic'] = 0x03EB;
  16047. t['gbopomofo'] = 0x310D;
  16048. t['gbreve'] = 0x011F;
  16049. t['gcaron'] = 0x01E7;
  16050. t['gcedilla'] = 0x0123;
  16051. t['gcircle'] = 0x24D6;
  16052. t['gcircumflex'] = 0x011D;
  16053. t['gcommaaccent'] = 0x0123;
  16054. t['gdot'] = 0x0121;
  16055. t['gdotaccent'] = 0x0121;
  16056. t['gecyrillic'] = 0x0433;
  16057. t['gehiragana'] = 0x3052;
  16058. t['gekatakana'] = 0x30B2;
  16059. t['geometricallyequal'] = 0x2251;
  16060. t['gereshaccenthebrew'] = 0x059C;
  16061. t['gereshhebrew'] = 0x05F3;
  16062. t['gereshmuqdamhebrew'] = 0x059D;
  16063. t['germandbls'] = 0x00DF;
  16064. t['gershayimaccenthebrew'] = 0x059E;
  16065. t['gershayimhebrew'] = 0x05F4;
  16066. t['getamark'] = 0x3013;
  16067. t['ghabengali'] = 0x0998;
  16068. t['ghadarmenian'] = 0x0572;
  16069. t['ghadeva'] = 0x0918;
  16070. t['ghagujarati'] = 0x0A98;
  16071. t['ghagurmukhi'] = 0x0A18;
  16072. t['ghainarabic'] = 0x063A;
  16073. t['ghainfinalarabic'] = 0xFECE;
  16074. t['ghaininitialarabic'] = 0xFECF;
  16075. t['ghainmedialarabic'] = 0xFED0;
  16076. t['ghemiddlehookcyrillic'] = 0x0495;
  16077. t['ghestrokecyrillic'] = 0x0493;
  16078. t['gheupturncyrillic'] = 0x0491;
  16079. t['ghhadeva'] = 0x095A;
  16080. t['ghhagurmukhi'] = 0x0A5A;
  16081. t['ghook'] = 0x0260;
  16082. t['ghzsquare'] = 0x3393;
  16083. t['gihiragana'] = 0x304E;
  16084. t['gikatakana'] = 0x30AE;
  16085. t['gimarmenian'] = 0x0563;
  16086. t['gimel'] = 0x05D2;
  16087. t['gimeldagesh'] = 0xFB32;
  16088. t['gimeldageshhebrew'] = 0xFB32;
  16089. t['gimelhebrew'] = 0x05D2;
  16090. t['gjecyrillic'] = 0x0453;
  16091. t['glottalinvertedstroke'] = 0x01BE;
  16092. t['glottalstop'] = 0x0294;
  16093. t['glottalstopinverted'] = 0x0296;
  16094. t['glottalstopmod'] = 0x02C0;
  16095. t['glottalstopreversed'] = 0x0295;
  16096. t['glottalstopreversedmod'] = 0x02C1;
  16097. t['glottalstopreversedsuperior'] = 0x02E4;
  16098. t['glottalstopstroke'] = 0x02A1;
  16099. t['glottalstopstrokereversed'] = 0x02A2;
  16100. t['gmacron'] = 0x1E21;
  16101. t['gmonospace'] = 0xFF47;
  16102. t['gohiragana'] = 0x3054;
  16103. t['gokatakana'] = 0x30B4;
  16104. t['gparen'] = 0x24A2;
  16105. t['gpasquare'] = 0x33AC;
  16106. t['gradient'] = 0x2207;
  16107. t['grave'] = 0x0060;
  16108. t['gravebelowcmb'] = 0x0316;
  16109. t['gravecmb'] = 0x0300;
  16110. t['gravecomb'] = 0x0300;
  16111. t['gravedeva'] = 0x0953;
  16112. t['gravelowmod'] = 0x02CE;
  16113. t['gravemonospace'] = 0xFF40;
  16114. t['gravetonecmb'] = 0x0340;
  16115. t['greater'] = 0x003E;
  16116. t['greaterequal'] = 0x2265;
  16117. t['greaterequalorless'] = 0x22DB;
  16118. t['greatermonospace'] = 0xFF1E;
  16119. t['greaterorequivalent'] = 0x2273;
  16120. t['greaterorless'] = 0x2277;
  16121. t['greateroverequal'] = 0x2267;
  16122. t['greatersmall'] = 0xFE65;
  16123. t['gscript'] = 0x0261;
  16124. t['gstroke'] = 0x01E5;
  16125. t['guhiragana'] = 0x3050;
  16126. t['guillemotleft'] = 0x00AB;
  16127. t['guillemotright'] = 0x00BB;
  16128. t['guilsinglleft'] = 0x2039;
  16129. t['guilsinglright'] = 0x203A;
  16130. t['gukatakana'] = 0x30B0;
  16131. t['guramusquare'] = 0x3318;
  16132. t['gysquare'] = 0x33C9;
  16133. t['h'] = 0x0068;
  16134. t['haabkhasiancyrillic'] = 0x04A9;
  16135. t['haaltonearabic'] = 0x06C1;
  16136. t['habengali'] = 0x09B9;
  16137. t['hadescendercyrillic'] = 0x04B3;
  16138. t['hadeva'] = 0x0939;
  16139. t['hagujarati'] = 0x0AB9;
  16140. t['hagurmukhi'] = 0x0A39;
  16141. t['haharabic'] = 0x062D;
  16142. t['hahfinalarabic'] = 0xFEA2;
  16143. t['hahinitialarabic'] = 0xFEA3;
  16144. t['hahiragana'] = 0x306F;
  16145. t['hahmedialarabic'] = 0xFEA4;
  16146. t['haitusquare'] = 0x332A;
  16147. t['hakatakana'] = 0x30CF;
  16148. t['hakatakanahalfwidth'] = 0xFF8A;
  16149. t['halantgurmukhi'] = 0x0A4D;
  16150. t['hamzaarabic'] = 0x0621;
  16151. t['hamzalowarabic'] = 0x0621;
  16152. t['hangulfiller'] = 0x3164;
  16153. t['hardsigncyrillic'] = 0x044A;
  16154. t['harpoonleftbarbup'] = 0x21BC;
  16155. t['harpoonrightbarbup'] = 0x21C0;
  16156. t['hasquare'] = 0x33CA;
  16157. t['hatafpatah'] = 0x05B2;
  16158. t['hatafpatah16'] = 0x05B2;
  16159. t['hatafpatah23'] = 0x05B2;
  16160. t['hatafpatah2f'] = 0x05B2;
  16161. t['hatafpatahhebrew'] = 0x05B2;
  16162. t['hatafpatahnarrowhebrew'] = 0x05B2;
  16163. t['hatafpatahquarterhebrew'] = 0x05B2;
  16164. t['hatafpatahwidehebrew'] = 0x05B2;
  16165. t['hatafqamats'] = 0x05B3;
  16166. t['hatafqamats1b'] = 0x05B3;
  16167. t['hatafqamats28'] = 0x05B3;
  16168. t['hatafqamats34'] = 0x05B3;
  16169. t['hatafqamatshebrew'] = 0x05B3;
  16170. t['hatafqamatsnarrowhebrew'] = 0x05B3;
  16171. t['hatafqamatsquarterhebrew'] = 0x05B3;
  16172. t['hatafqamatswidehebrew'] = 0x05B3;
  16173. t['hatafsegol'] = 0x05B1;
  16174. t['hatafsegol17'] = 0x05B1;
  16175. t['hatafsegol24'] = 0x05B1;
  16176. t['hatafsegol30'] = 0x05B1;
  16177. t['hatafsegolhebrew'] = 0x05B1;
  16178. t['hatafsegolnarrowhebrew'] = 0x05B1;
  16179. t['hatafsegolquarterhebrew'] = 0x05B1;
  16180. t['hatafsegolwidehebrew'] = 0x05B1;
  16181. t['hbar'] = 0x0127;
  16182. t['hbopomofo'] = 0x310F;
  16183. t['hbrevebelow'] = 0x1E2B;
  16184. t['hcedilla'] = 0x1E29;
  16185. t['hcircle'] = 0x24D7;
  16186. t['hcircumflex'] = 0x0125;
  16187. t['hdieresis'] = 0x1E27;
  16188. t['hdotaccent'] = 0x1E23;
  16189. t['hdotbelow'] = 0x1E25;
  16190. t['he'] = 0x05D4;
  16191. t['heart'] = 0x2665;
  16192. t['heartsuitblack'] = 0x2665;
  16193. t['heartsuitwhite'] = 0x2661;
  16194. t['hedagesh'] = 0xFB34;
  16195. t['hedageshhebrew'] = 0xFB34;
  16196. t['hehaltonearabic'] = 0x06C1;
  16197. t['heharabic'] = 0x0647;
  16198. t['hehebrew'] = 0x05D4;
  16199. t['hehfinalaltonearabic'] = 0xFBA7;
  16200. t['hehfinalalttwoarabic'] = 0xFEEA;
  16201. t['hehfinalarabic'] = 0xFEEA;
  16202. t['hehhamzaabovefinalarabic'] = 0xFBA5;
  16203. t['hehhamzaaboveisolatedarabic'] = 0xFBA4;
  16204. t['hehinitialaltonearabic'] = 0xFBA8;
  16205. t['hehinitialarabic'] = 0xFEEB;
  16206. t['hehiragana'] = 0x3078;
  16207. t['hehmedialaltonearabic'] = 0xFBA9;
  16208. t['hehmedialarabic'] = 0xFEEC;
  16209. t['heiseierasquare'] = 0x337B;
  16210. t['hekatakana'] = 0x30D8;
  16211. t['hekatakanahalfwidth'] = 0xFF8D;
  16212. t['hekutaarusquare'] = 0x3336;
  16213. t['henghook'] = 0x0267;
  16214. t['herutusquare'] = 0x3339;
  16215. t['het'] = 0x05D7;
  16216. t['hethebrew'] = 0x05D7;
  16217. t['hhook'] = 0x0266;
  16218. t['hhooksuperior'] = 0x02B1;
  16219. t['hieuhacirclekorean'] = 0x327B;
  16220. t['hieuhaparenkorean'] = 0x321B;
  16221. t['hieuhcirclekorean'] = 0x326D;
  16222. t['hieuhkorean'] = 0x314E;
  16223. t['hieuhparenkorean'] = 0x320D;
  16224. t['hihiragana'] = 0x3072;
  16225. t['hikatakana'] = 0x30D2;
  16226. t['hikatakanahalfwidth'] = 0xFF8B;
  16227. t['hiriq'] = 0x05B4;
  16228. t['hiriq14'] = 0x05B4;
  16229. t['hiriq21'] = 0x05B4;
  16230. t['hiriq2d'] = 0x05B4;
  16231. t['hiriqhebrew'] = 0x05B4;
  16232. t['hiriqnarrowhebrew'] = 0x05B4;
  16233. t['hiriqquarterhebrew'] = 0x05B4;
  16234. t['hiriqwidehebrew'] = 0x05B4;
  16235. t['hlinebelow'] = 0x1E96;
  16236. t['hmonospace'] = 0xFF48;
  16237. t['hoarmenian'] = 0x0570;
  16238. t['hohipthai'] = 0x0E2B;
  16239. t['hohiragana'] = 0x307B;
  16240. t['hokatakana'] = 0x30DB;
  16241. t['hokatakanahalfwidth'] = 0xFF8E;
  16242. t['holam'] = 0x05B9;
  16243. t['holam19'] = 0x05B9;
  16244. t['holam26'] = 0x05B9;
  16245. t['holam32'] = 0x05B9;
  16246. t['holamhebrew'] = 0x05B9;
  16247. t['holamnarrowhebrew'] = 0x05B9;
  16248. t['holamquarterhebrew'] = 0x05B9;
  16249. t['holamwidehebrew'] = 0x05B9;
  16250. t['honokhukthai'] = 0x0E2E;
  16251. t['hookabovecomb'] = 0x0309;
  16252. t['hookcmb'] = 0x0309;
  16253. t['hookpalatalizedbelowcmb'] = 0x0321;
  16254. t['hookretroflexbelowcmb'] = 0x0322;
  16255. t['hoonsquare'] = 0x3342;
  16256. t['horicoptic'] = 0x03E9;
  16257. t['horizontalbar'] = 0x2015;
  16258. t['horncmb'] = 0x031B;
  16259. t['hotsprings'] = 0x2668;
  16260. t['house'] = 0x2302;
  16261. t['hparen'] = 0x24A3;
  16262. t['hsuperior'] = 0x02B0;
  16263. t['hturned'] = 0x0265;
  16264. t['huhiragana'] = 0x3075;
  16265. t['huiitosquare'] = 0x3333;
  16266. t['hukatakana'] = 0x30D5;
  16267. t['hukatakanahalfwidth'] = 0xFF8C;
  16268. t['hungarumlaut'] = 0x02DD;
  16269. t['hungarumlautcmb'] = 0x030B;
  16270. t['hv'] = 0x0195;
  16271. t['hyphen'] = 0x002D;
  16272. t['hypheninferior'] = 0xF6E5;
  16273. t['hyphenmonospace'] = 0xFF0D;
  16274. t['hyphensmall'] = 0xFE63;
  16275. t['hyphensuperior'] = 0xF6E6;
  16276. t['hyphentwo'] = 0x2010;
  16277. t['i'] = 0x0069;
  16278. t['iacute'] = 0x00ED;
  16279. t['iacyrillic'] = 0x044F;
  16280. t['ibengali'] = 0x0987;
  16281. t['ibopomofo'] = 0x3127;
  16282. t['ibreve'] = 0x012D;
  16283. t['icaron'] = 0x01D0;
  16284. t['icircle'] = 0x24D8;
  16285. t['icircumflex'] = 0x00EE;
  16286. t['icyrillic'] = 0x0456;
  16287. t['idblgrave'] = 0x0209;
  16288. t['ideographearthcircle'] = 0x328F;
  16289. t['ideographfirecircle'] = 0x328B;
  16290. t['ideographicallianceparen'] = 0x323F;
  16291. t['ideographiccallparen'] = 0x323A;
  16292. t['ideographiccentrecircle'] = 0x32A5;
  16293. t['ideographicclose'] = 0x3006;
  16294. t['ideographiccomma'] = 0x3001;
  16295. t['ideographiccommaleft'] = 0xFF64;
  16296. t['ideographiccongratulationparen'] = 0x3237;
  16297. t['ideographiccorrectcircle'] = 0x32A3;
  16298. t['ideographicearthparen'] = 0x322F;
  16299. t['ideographicenterpriseparen'] = 0x323D;
  16300. t['ideographicexcellentcircle'] = 0x329D;
  16301. t['ideographicfestivalparen'] = 0x3240;
  16302. t['ideographicfinancialcircle'] = 0x3296;
  16303. t['ideographicfinancialparen'] = 0x3236;
  16304. t['ideographicfireparen'] = 0x322B;
  16305. t['ideographichaveparen'] = 0x3232;
  16306. t['ideographichighcircle'] = 0x32A4;
  16307. t['ideographiciterationmark'] = 0x3005;
  16308. t['ideographiclaborcircle'] = 0x3298;
  16309. t['ideographiclaborparen'] = 0x3238;
  16310. t['ideographicleftcircle'] = 0x32A7;
  16311. t['ideographiclowcircle'] = 0x32A6;
  16312. t['ideographicmedicinecircle'] = 0x32A9;
  16313. t['ideographicmetalparen'] = 0x322E;
  16314. t['ideographicmoonparen'] = 0x322A;
  16315. t['ideographicnameparen'] = 0x3234;
  16316. t['ideographicperiod'] = 0x3002;
  16317. t['ideographicprintcircle'] = 0x329E;
  16318. t['ideographicreachparen'] = 0x3243;
  16319. t['ideographicrepresentparen'] = 0x3239;
  16320. t['ideographicresourceparen'] = 0x323E;
  16321. t['ideographicrightcircle'] = 0x32A8;
  16322. t['ideographicsecretcircle'] = 0x3299;
  16323. t['ideographicselfparen'] = 0x3242;
  16324. t['ideographicsocietyparen'] = 0x3233;
  16325. t['ideographicspace'] = 0x3000;
  16326. t['ideographicspecialparen'] = 0x3235;
  16327. t['ideographicstockparen'] = 0x3231;
  16328. t['ideographicstudyparen'] = 0x323B;
  16329. t['ideographicsunparen'] = 0x3230;
  16330. t['ideographicsuperviseparen'] = 0x323C;
  16331. t['ideographicwaterparen'] = 0x322C;
  16332. t['ideographicwoodparen'] = 0x322D;
  16333. t['ideographiczero'] = 0x3007;
  16334. t['ideographmetalcircle'] = 0x328E;
  16335. t['ideographmooncircle'] = 0x328A;
  16336. t['ideographnamecircle'] = 0x3294;
  16337. t['ideographsuncircle'] = 0x3290;
  16338. t['ideographwatercircle'] = 0x328C;
  16339. t['ideographwoodcircle'] = 0x328D;
  16340. t['ideva'] = 0x0907;
  16341. t['idieresis'] = 0x00EF;
  16342. t['idieresisacute'] = 0x1E2F;
  16343. t['idieresiscyrillic'] = 0x04E5;
  16344. t['idotbelow'] = 0x1ECB;
  16345. t['iebrevecyrillic'] = 0x04D7;
  16346. t['iecyrillic'] = 0x0435;
  16347. t['ieungacirclekorean'] = 0x3275;
  16348. t['ieungaparenkorean'] = 0x3215;
  16349. t['ieungcirclekorean'] = 0x3267;
  16350. t['ieungkorean'] = 0x3147;
  16351. t['ieungparenkorean'] = 0x3207;
  16352. t['igrave'] = 0x00EC;
  16353. t['igujarati'] = 0x0A87;
  16354. t['igurmukhi'] = 0x0A07;
  16355. t['ihiragana'] = 0x3044;
  16356. t['ihookabove'] = 0x1EC9;
  16357. t['iibengali'] = 0x0988;
  16358. t['iicyrillic'] = 0x0438;
  16359. t['iideva'] = 0x0908;
  16360. t['iigujarati'] = 0x0A88;
  16361. t['iigurmukhi'] = 0x0A08;
  16362. t['iimatragurmukhi'] = 0x0A40;
  16363. t['iinvertedbreve'] = 0x020B;
  16364. t['iishortcyrillic'] = 0x0439;
  16365. t['iivowelsignbengali'] = 0x09C0;
  16366. t['iivowelsigndeva'] = 0x0940;
  16367. t['iivowelsigngujarati'] = 0x0AC0;
  16368. t['ij'] = 0x0133;
  16369. t['ikatakana'] = 0x30A4;
  16370. t['ikatakanahalfwidth'] = 0xFF72;
  16371. t['ikorean'] = 0x3163;
  16372. t['ilde'] = 0x02DC;
  16373. t['iluyhebrew'] = 0x05AC;
  16374. t['imacron'] = 0x012B;
  16375. t['imacroncyrillic'] = 0x04E3;
  16376. t['imageorapproximatelyequal'] = 0x2253;
  16377. t['imatragurmukhi'] = 0x0A3F;
  16378. t['imonospace'] = 0xFF49;
  16379. t['increment'] = 0x2206;
  16380. t['infinity'] = 0x221E;
  16381. t['iniarmenian'] = 0x056B;
  16382. t['integral'] = 0x222B;
  16383. t['integralbottom'] = 0x2321;
  16384. t['integralbt'] = 0x2321;
  16385. t['integralex'] = 0xF8F5;
  16386. t['integraltop'] = 0x2320;
  16387. t['integraltp'] = 0x2320;
  16388. t['intersection'] = 0x2229;
  16389. t['intisquare'] = 0x3305;
  16390. t['invbullet'] = 0x25D8;
  16391. t['invcircle'] = 0x25D9;
  16392. t['invsmileface'] = 0x263B;
  16393. t['iocyrillic'] = 0x0451;
  16394. t['iogonek'] = 0x012F;
  16395. t['iota'] = 0x03B9;
  16396. t['iotadieresis'] = 0x03CA;
  16397. t['iotadieresistonos'] = 0x0390;
  16398. t['iotalatin'] = 0x0269;
  16399. t['iotatonos'] = 0x03AF;
  16400. t['iparen'] = 0x24A4;
  16401. t['irigurmukhi'] = 0x0A72;
  16402. t['ismallhiragana'] = 0x3043;
  16403. t['ismallkatakana'] = 0x30A3;
  16404. t['ismallkatakanahalfwidth'] = 0xFF68;
  16405. t['issharbengali'] = 0x09FA;
  16406. t['istroke'] = 0x0268;
  16407. t['isuperior'] = 0xF6ED;
  16408. t['iterationhiragana'] = 0x309D;
  16409. t['iterationkatakana'] = 0x30FD;
  16410. t['itilde'] = 0x0129;
  16411. t['itildebelow'] = 0x1E2D;
  16412. t['iubopomofo'] = 0x3129;
  16413. t['iucyrillic'] = 0x044E;
  16414. t['ivowelsignbengali'] = 0x09BF;
  16415. t['ivowelsigndeva'] = 0x093F;
  16416. t['ivowelsigngujarati'] = 0x0ABF;
  16417. t['izhitsacyrillic'] = 0x0475;
  16418. t['izhitsadblgravecyrillic'] = 0x0477;
  16419. t['j'] = 0x006A;
  16420. t['jaarmenian'] = 0x0571;
  16421. t['jabengali'] = 0x099C;
  16422. t['jadeva'] = 0x091C;
  16423. t['jagujarati'] = 0x0A9C;
  16424. t['jagurmukhi'] = 0x0A1C;
  16425. t['jbopomofo'] = 0x3110;
  16426. t['jcaron'] = 0x01F0;
  16427. t['jcircle'] = 0x24D9;
  16428. t['jcircumflex'] = 0x0135;
  16429. t['jcrossedtail'] = 0x029D;
  16430. t['jdotlessstroke'] = 0x025F;
  16431. t['jecyrillic'] = 0x0458;
  16432. t['jeemarabic'] = 0x062C;
  16433. t['jeemfinalarabic'] = 0xFE9E;
  16434. t['jeeminitialarabic'] = 0xFE9F;
  16435. t['jeemmedialarabic'] = 0xFEA0;
  16436. t['jeharabic'] = 0x0698;
  16437. t['jehfinalarabic'] = 0xFB8B;
  16438. t['jhabengali'] = 0x099D;
  16439. t['jhadeva'] = 0x091D;
  16440. t['jhagujarati'] = 0x0A9D;
  16441. t['jhagurmukhi'] = 0x0A1D;
  16442. t['jheharmenian'] = 0x057B;
  16443. t['jis'] = 0x3004;
  16444. t['jmonospace'] = 0xFF4A;
  16445. t['jparen'] = 0x24A5;
  16446. t['jsuperior'] = 0x02B2;
  16447. t['k'] = 0x006B;
  16448. t['kabashkircyrillic'] = 0x04A1;
  16449. t['kabengali'] = 0x0995;
  16450. t['kacute'] = 0x1E31;
  16451. t['kacyrillic'] = 0x043A;
  16452. t['kadescendercyrillic'] = 0x049B;
  16453. t['kadeva'] = 0x0915;
  16454. t['kaf'] = 0x05DB;
  16455. t['kafarabic'] = 0x0643;
  16456. t['kafdagesh'] = 0xFB3B;
  16457. t['kafdageshhebrew'] = 0xFB3B;
  16458. t['kaffinalarabic'] = 0xFEDA;
  16459. t['kafhebrew'] = 0x05DB;
  16460. t['kafinitialarabic'] = 0xFEDB;
  16461. t['kafmedialarabic'] = 0xFEDC;
  16462. t['kafrafehebrew'] = 0xFB4D;
  16463. t['kagujarati'] = 0x0A95;
  16464. t['kagurmukhi'] = 0x0A15;
  16465. t['kahiragana'] = 0x304B;
  16466. t['kahookcyrillic'] = 0x04C4;
  16467. t['kakatakana'] = 0x30AB;
  16468. t['kakatakanahalfwidth'] = 0xFF76;
  16469. t['kappa'] = 0x03BA;
  16470. t['kappasymbolgreek'] = 0x03F0;
  16471. t['kapyeounmieumkorean'] = 0x3171;
  16472. t['kapyeounphieuphkorean'] = 0x3184;
  16473. t['kapyeounpieupkorean'] = 0x3178;
  16474. t['kapyeounssangpieupkorean'] = 0x3179;
  16475. t['karoriisquare'] = 0x330D;
  16476. t['kashidaautoarabic'] = 0x0640;
  16477. t['kashidaautonosidebearingarabic'] = 0x0640;
  16478. t['kasmallkatakana'] = 0x30F5;
  16479. t['kasquare'] = 0x3384;
  16480. t['kasraarabic'] = 0x0650;
  16481. t['kasratanarabic'] = 0x064D;
  16482. t['kastrokecyrillic'] = 0x049F;
  16483. t['katahiraprolongmarkhalfwidth'] = 0xFF70;
  16484. t['kaverticalstrokecyrillic'] = 0x049D;
  16485. t['kbopomofo'] = 0x310E;
  16486. t['kcalsquare'] = 0x3389;
  16487. t['kcaron'] = 0x01E9;
  16488. t['kcedilla'] = 0x0137;
  16489. t['kcircle'] = 0x24DA;
  16490. t['kcommaaccent'] = 0x0137;
  16491. t['kdotbelow'] = 0x1E33;
  16492. t['keharmenian'] = 0x0584;
  16493. t['kehiragana'] = 0x3051;
  16494. t['kekatakana'] = 0x30B1;
  16495. t['kekatakanahalfwidth'] = 0xFF79;
  16496. t['kenarmenian'] = 0x056F;
  16497. t['kesmallkatakana'] = 0x30F6;
  16498. t['kgreenlandic'] = 0x0138;
  16499. t['khabengali'] = 0x0996;
  16500. t['khacyrillic'] = 0x0445;
  16501. t['khadeva'] = 0x0916;
  16502. t['khagujarati'] = 0x0A96;
  16503. t['khagurmukhi'] = 0x0A16;
  16504. t['khaharabic'] = 0x062E;
  16505. t['khahfinalarabic'] = 0xFEA6;
  16506. t['khahinitialarabic'] = 0xFEA7;
  16507. t['khahmedialarabic'] = 0xFEA8;
  16508. t['kheicoptic'] = 0x03E7;
  16509. t['khhadeva'] = 0x0959;
  16510. t['khhagurmukhi'] = 0x0A59;
  16511. t['khieukhacirclekorean'] = 0x3278;
  16512. t['khieukhaparenkorean'] = 0x3218;
  16513. t['khieukhcirclekorean'] = 0x326A;
  16514. t['khieukhkorean'] = 0x314B;
  16515. t['khieukhparenkorean'] = 0x320A;
  16516. t['khokhaithai'] = 0x0E02;
  16517. t['khokhonthai'] = 0x0E05;
  16518. t['khokhuatthai'] = 0x0E03;
  16519. t['khokhwaithai'] = 0x0E04;
  16520. t['khomutthai'] = 0x0E5B;
  16521. t['khook'] = 0x0199;
  16522. t['khorakhangthai'] = 0x0E06;
  16523. t['khzsquare'] = 0x3391;
  16524. t['kihiragana'] = 0x304D;
  16525. t['kikatakana'] = 0x30AD;
  16526. t['kikatakanahalfwidth'] = 0xFF77;
  16527. t['kiroguramusquare'] = 0x3315;
  16528. t['kiromeetorusquare'] = 0x3316;
  16529. t['kirosquare'] = 0x3314;
  16530. t['kiyeokacirclekorean'] = 0x326E;
  16531. t['kiyeokaparenkorean'] = 0x320E;
  16532. t['kiyeokcirclekorean'] = 0x3260;
  16533. t['kiyeokkorean'] = 0x3131;
  16534. t['kiyeokparenkorean'] = 0x3200;
  16535. t['kiyeoksioskorean'] = 0x3133;
  16536. t['kjecyrillic'] = 0x045C;
  16537. t['klinebelow'] = 0x1E35;
  16538. t['klsquare'] = 0x3398;
  16539. t['kmcubedsquare'] = 0x33A6;
  16540. t['kmonospace'] = 0xFF4B;
  16541. t['kmsquaredsquare'] = 0x33A2;
  16542. t['kohiragana'] = 0x3053;
  16543. t['kohmsquare'] = 0x33C0;
  16544. t['kokaithai'] = 0x0E01;
  16545. t['kokatakana'] = 0x30B3;
  16546. t['kokatakanahalfwidth'] = 0xFF7A;
  16547. t['kooposquare'] = 0x331E;
  16548. t['koppacyrillic'] = 0x0481;
  16549. t['koreanstandardsymbol'] = 0x327F;
  16550. t['koroniscmb'] = 0x0343;
  16551. t['kparen'] = 0x24A6;
  16552. t['kpasquare'] = 0x33AA;
  16553. t['ksicyrillic'] = 0x046F;
  16554. t['ktsquare'] = 0x33CF;
  16555. t['kturned'] = 0x029E;
  16556. t['kuhiragana'] = 0x304F;
  16557. t['kukatakana'] = 0x30AF;
  16558. t['kukatakanahalfwidth'] = 0xFF78;
  16559. t['kvsquare'] = 0x33B8;
  16560. t['kwsquare'] = 0x33BE;
  16561. t['l'] = 0x006C;
  16562. t['labengali'] = 0x09B2;
  16563. t['lacute'] = 0x013A;
  16564. t['ladeva'] = 0x0932;
  16565. t['lagujarati'] = 0x0AB2;
  16566. t['lagurmukhi'] = 0x0A32;
  16567. t['lakkhangyaothai'] = 0x0E45;
  16568. t['lamaleffinalarabic'] = 0xFEFC;
  16569. t['lamalefhamzaabovefinalarabic'] = 0xFEF8;
  16570. t['lamalefhamzaaboveisolatedarabic'] = 0xFEF7;
  16571. t['lamalefhamzabelowfinalarabic'] = 0xFEFA;
  16572. t['lamalefhamzabelowisolatedarabic'] = 0xFEF9;
  16573. t['lamalefisolatedarabic'] = 0xFEFB;
  16574. t['lamalefmaddaabovefinalarabic'] = 0xFEF6;
  16575. t['lamalefmaddaaboveisolatedarabic'] = 0xFEF5;
  16576. t['lamarabic'] = 0x0644;
  16577. t['lambda'] = 0x03BB;
  16578. t['lambdastroke'] = 0x019B;
  16579. t['lamed'] = 0x05DC;
  16580. t['lameddagesh'] = 0xFB3C;
  16581. t['lameddageshhebrew'] = 0xFB3C;
  16582. t['lamedhebrew'] = 0x05DC;
  16583. t['lamfinalarabic'] = 0xFEDE;
  16584. t['lamhahinitialarabic'] = 0xFCCA;
  16585. t['laminitialarabic'] = 0xFEDF;
  16586. t['lamjeeminitialarabic'] = 0xFCC9;
  16587. t['lamkhahinitialarabic'] = 0xFCCB;
  16588. t['lamlamhehisolatedarabic'] = 0xFDF2;
  16589. t['lammedialarabic'] = 0xFEE0;
  16590. t['lammeemhahinitialarabic'] = 0xFD88;
  16591. t['lammeeminitialarabic'] = 0xFCCC;
  16592. t['largecircle'] = 0x25EF;
  16593. t['lbar'] = 0x019A;
  16594. t['lbelt'] = 0x026C;
  16595. t['lbopomofo'] = 0x310C;
  16596. t['lcaron'] = 0x013E;
  16597. t['lcedilla'] = 0x013C;
  16598. t['lcircle'] = 0x24DB;
  16599. t['lcircumflexbelow'] = 0x1E3D;
  16600. t['lcommaaccent'] = 0x013C;
  16601. t['ldot'] = 0x0140;
  16602. t['ldotaccent'] = 0x0140;
  16603. t['ldotbelow'] = 0x1E37;
  16604. t['ldotbelowmacron'] = 0x1E39;
  16605. t['leftangleabovecmb'] = 0x031A;
  16606. t['lefttackbelowcmb'] = 0x0318;
  16607. t['less'] = 0x003C;
  16608. t['lessequal'] = 0x2264;
  16609. t['lessequalorgreater'] = 0x22DA;
  16610. t['lessmonospace'] = 0xFF1C;
  16611. t['lessorequivalent'] = 0x2272;
  16612. t['lessorgreater'] = 0x2276;
  16613. t['lessoverequal'] = 0x2266;
  16614. t['lesssmall'] = 0xFE64;
  16615. t['lezh'] = 0x026E;
  16616. t['lfblock'] = 0x258C;
  16617. t['lhookretroflex'] = 0x026D;
  16618. t['lira'] = 0x20A4;
  16619. t['liwnarmenian'] = 0x056C;
  16620. t['lj'] = 0x01C9;
  16621. t['ljecyrillic'] = 0x0459;
  16622. t['ll'] = 0xF6C0;
  16623. t['lladeva'] = 0x0933;
  16624. t['llagujarati'] = 0x0AB3;
  16625. t['llinebelow'] = 0x1E3B;
  16626. t['llladeva'] = 0x0934;
  16627. t['llvocalicbengali'] = 0x09E1;
  16628. t['llvocalicdeva'] = 0x0961;
  16629. t['llvocalicvowelsignbengali'] = 0x09E3;
  16630. t['llvocalicvowelsigndeva'] = 0x0963;
  16631. t['lmiddletilde'] = 0x026B;
  16632. t['lmonospace'] = 0xFF4C;
  16633. t['lmsquare'] = 0x33D0;
  16634. t['lochulathai'] = 0x0E2C;
  16635. t['logicaland'] = 0x2227;
  16636. t['logicalnot'] = 0x00AC;
  16637. t['logicalnotreversed'] = 0x2310;
  16638. t['logicalor'] = 0x2228;
  16639. t['lolingthai'] = 0x0E25;
  16640. t['longs'] = 0x017F;
  16641. t['lowlinecenterline'] = 0xFE4E;
  16642. t['lowlinecmb'] = 0x0332;
  16643. t['lowlinedashed'] = 0xFE4D;
  16644. t['lozenge'] = 0x25CA;
  16645. t['lparen'] = 0x24A7;
  16646. t['lslash'] = 0x0142;
  16647. t['lsquare'] = 0x2113;
  16648. t['lsuperior'] = 0xF6EE;
  16649. t['ltshade'] = 0x2591;
  16650. t['luthai'] = 0x0E26;
  16651. t['lvocalicbengali'] = 0x098C;
  16652. t['lvocalicdeva'] = 0x090C;
  16653. t['lvocalicvowelsignbengali'] = 0x09E2;
  16654. t['lvocalicvowelsigndeva'] = 0x0962;
  16655. t['lxsquare'] = 0x33D3;
  16656. t['m'] = 0x006D;
  16657. t['mabengali'] = 0x09AE;
  16658. t['macron'] = 0x00AF;
  16659. t['macronbelowcmb'] = 0x0331;
  16660. t['macroncmb'] = 0x0304;
  16661. t['macronlowmod'] = 0x02CD;
  16662. t['macronmonospace'] = 0xFFE3;
  16663. t['macute'] = 0x1E3F;
  16664. t['madeva'] = 0x092E;
  16665. t['magujarati'] = 0x0AAE;
  16666. t['magurmukhi'] = 0x0A2E;
  16667. t['mahapakhhebrew'] = 0x05A4;
  16668. t['mahapakhlefthebrew'] = 0x05A4;
  16669. t['mahiragana'] = 0x307E;
  16670. t['maichattawalowleftthai'] = 0xF895;
  16671. t['maichattawalowrightthai'] = 0xF894;
  16672. t['maichattawathai'] = 0x0E4B;
  16673. t['maichattawaupperleftthai'] = 0xF893;
  16674. t['maieklowleftthai'] = 0xF88C;
  16675. t['maieklowrightthai'] = 0xF88B;
  16676. t['maiekthai'] = 0x0E48;
  16677. t['maiekupperleftthai'] = 0xF88A;
  16678. t['maihanakatleftthai'] = 0xF884;
  16679. t['maihanakatthai'] = 0x0E31;
  16680. t['maitaikhuleftthai'] = 0xF889;
  16681. t['maitaikhuthai'] = 0x0E47;
  16682. t['maitholowleftthai'] = 0xF88F;
  16683. t['maitholowrightthai'] = 0xF88E;
  16684. t['maithothai'] = 0x0E49;
  16685. t['maithoupperleftthai'] = 0xF88D;
  16686. t['maitrilowleftthai'] = 0xF892;
  16687. t['maitrilowrightthai'] = 0xF891;
  16688. t['maitrithai'] = 0x0E4A;
  16689. t['maitriupperleftthai'] = 0xF890;
  16690. t['maiyamokthai'] = 0x0E46;
  16691. t['makatakana'] = 0x30DE;
  16692. t['makatakanahalfwidth'] = 0xFF8F;
  16693. t['male'] = 0x2642;
  16694. t['mansyonsquare'] = 0x3347;
  16695. t['maqafhebrew'] = 0x05BE;
  16696. t['mars'] = 0x2642;
  16697. t['masoracirclehebrew'] = 0x05AF;
  16698. t['masquare'] = 0x3383;
  16699. t['mbopomofo'] = 0x3107;
  16700. t['mbsquare'] = 0x33D4;
  16701. t['mcircle'] = 0x24DC;
  16702. t['mcubedsquare'] = 0x33A5;
  16703. t['mdotaccent'] = 0x1E41;
  16704. t['mdotbelow'] = 0x1E43;
  16705. t['meemarabic'] = 0x0645;
  16706. t['meemfinalarabic'] = 0xFEE2;
  16707. t['meeminitialarabic'] = 0xFEE3;
  16708. t['meemmedialarabic'] = 0xFEE4;
  16709. t['meemmeeminitialarabic'] = 0xFCD1;
  16710. t['meemmeemisolatedarabic'] = 0xFC48;
  16711. t['meetorusquare'] = 0x334D;
  16712. t['mehiragana'] = 0x3081;
  16713. t['meizierasquare'] = 0x337E;
  16714. t['mekatakana'] = 0x30E1;
  16715. t['mekatakanahalfwidth'] = 0xFF92;
  16716. t['mem'] = 0x05DE;
  16717. t['memdagesh'] = 0xFB3E;
  16718. t['memdageshhebrew'] = 0xFB3E;
  16719. t['memhebrew'] = 0x05DE;
  16720. t['menarmenian'] = 0x0574;
  16721. t['merkhahebrew'] = 0x05A5;
  16722. t['merkhakefulahebrew'] = 0x05A6;
  16723. t['merkhakefulalefthebrew'] = 0x05A6;
  16724. t['merkhalefthebrew'] = 0x05A5;
  16725. t['mhook'] = 0x0271;
  16726. t['mhzsquare'] = 0x3392;
  16727. t['middledotkatakanahalfwidth'] = 0xFF65;
  16728. t['middot'] = 0x00B7;
  16729. t['mieumacirclekorean'] = 0x3272;
  16730. t['mieumaparenkorean'] = 0x3212;
  16731. t['mieumcirclekorean'] = 0x3264;
  16732. t['mieumkorean'] = 0x3141;
  16733. t['mieumpansioskorean'] = 0x3170;
  16734. t['mieumparenkorean'] = 0x3204;
  16735. t['mieumpieupkorean'] = 0x316E;
  16736. t['mieumsioskorean'] = 0x316F;
  16737. t['mihiragana'] = 0x307F;
  16738. t['mikatakana'] = 0x30DF;
  16739. t['mikatakanahalfwidth'] = 0xFF90;
  16740. t['minus'] = 0x2212;
  16741. t['minusbelowcmb'] = 0x0320;
  16742. t['minuscircle'] = 0x2296;
  16743. t['minusmod'] = 0x02D7;
  16744. t['minusplus'] = 0x2213;
  16745. t['minute'] = 0x2032;
  16746. t['miribaarusquare'] = 0x334A;
  16747. t['mirisquare'] = 0x3349;
  16748. t['mlonglegturned'] = 0x0270;
  16749. t['mlsquare'] = 0x3396;
  16750. t['mmcubedsquare'] = 0x33A3;
  16751. t['mmonospace'] = 0xFF4D;
  16752. t['mmsquaredsquare'] = 0x339F;
  16753. t['mohiragana'] = 0x3082;
  16754. t['mohmsquare'] = 0x33C1;
  16755. t['mokatakana'] = 0x30E2;
  16756. t['mokatakanahalfwidth'] = 0xFF93;
  16757. t['molsquare'] = 0x33D6;
  16758. t['momathai'] = 0x0E21;
  16759. t['moverssquare'] = 0x33A7;
  16760. t['moverssquaredsquare'] = 0x33A8;
  16761. t['mparen'] = 0x24A8;
  16762. t['mpasquare'] = 0x33AB;
  16763. t['mssquare'] = 0x33B3;
  16764. t['msuperior'] = 0xF6EF;
  16765. t['mturned'] = 0x026F;
  16766. t['mu'] = 0x00B5;
  16767. t['mu1'] = 0x00B5;
  16768. t['muasquare'] = 0x3382;
  16769. t['muchgreater'] = 0x226B;
  16770. t['muchless'] = 0x226A;
  16771. t['mufsquare'] = 0x338C;
  16772. t['mugreek'] = 0x03BC;
  16773. t['mugsquare'] = 0x338D;
  16774. t['muhiragana'] = 0x3080;
  16775. t['mukatakana'] = 0x30E0;
  16776. t['mukatakanahalfwidth'] = 0xFF91;
  16777. t['mulsquare'] = 0x3395;
  16778. t['multiply'] = 0x00D7;
  16779. t['mumsquare'] = 0x339B;
  16780. t['munahhebrew'] = 0x05A3;
  16781. t['munahlefthebrew'] = 0x05A3;
  16782. t['musicalnote'] = 0x266A;
  16783. t['musicalnotedbl'] = 0x266B;
  16784. t['musicflatsign'] = 0x266D;
  16785. t['musicsharpsign'] = 0x266F;
  16786. t['mussquare'] = 0x33B2;
  16787. t['muvsquare'] = 0x33B6;
  16788. t['muwsquare'] = 0x33BC;
  16789. t['mvmegasquare'] = 0x33B9;
  16790. t['mvsquare'] = 0x33B7;
  16791. t['mwmegasquare'] = 0x33BF;
  16792. t['mwsquare'] = 0x33BD;
  16793. t['n'] = 0x006E;
  16794. t['nabengali'] = 0x09A8;
  16795. t['nabla'] = 0x2207;
  16796. t['nacute'] = 0x0144;
  16797. t['nadeva'] = 0x0928;
  16798. t['nagujarati'] = 0x0AA8;
  16799. t['nagurmukhi'] = 0x0A28;
  16800. t['nahiragana'] = 0x306A;
  16801. t['nakatakana'] = 0x30CA;
  16802. t['nakatakanahalfwidth'] = 0xFF85;
  16803. t['napostrophe'] = 0x0149;
  16804. t['nasquare'] = 0x3381;
  16805. t['nbopomofo'] = 0x310B;
  16806. t['nbspace'] = 0x00A0;
  16807. t['ncaron'] = 0x0148;
  16808. t['ncedilla'] = 0x0146;
  16809. t['ncircle'] = 0x24DD;
  16810. t['ncircumflexbelow'] = 0x1E4B;
  16811. t['ncommaaccent'] = 0x0146;
  16812. t['ndotaccent'] = 0x1E45;
  16813. t['ndotbelow'] = 0x1E47;
  16814. t['nehiragana'] = 0x306D;
  16815. t['nekatakana'] = 0x30CD;
  16816. t['nekatakanahalfwidth'] = 0xFF88;
  16817. t['newsheqelsign'] = 0x20AA;
  16818. t['nfsquare'] = 0x338B;
  16819. t['ngabengali'] = 0x0999;
  16820. t['ngadeva'] = 0x0919;
  16821. t['ngagujarati'] = 0x0A99;
  16822. t['ngagurmukhi'] = 0x0A19;
  16823. t['ngonguthai'] = 0x0E07;
  16824. t['nhiragana'] = 0x3093;
  16825. t['nhookleft'] = 0x0272;
  16826. t['nhookretroflex'] = 0x0273;
  16827. t['nieunacirclekorean'] = 0x326F;
  16828. t['nieunaparenkorean'] = 0x320F;
  16829. t['nieuncieuckorean'] = 0x3135;
  16830. t['nieuncirclekorean'] = 0x3261;
  16831. t['nieunhieuhkorean'] = 0x3136;
  16832. t['nieunkorean'] = 0x3134;
  16833. t['nieunpansioskorean'] = 0x3168;
  16834. t['nieunparenkorean'] = 0x3201;
  16835. t['nieunsioskorean'] = 0x3167;
  16836. t['nieuntikeutkorean'] = 0x3166;
  16837. t['nihiragana'] = 0x306B;
  16838. t['nikatakana'] = 0x30CB;
  16839. t['nikatakanahalfwidth'] = 0xFF86;
  16840. t['nikhahitleftthai'] = 0xF899;
  16841. t['nikhahitthai'] = 0x0E4D;
  16842. t['nine'] = 0x0039;
  16843. t['ninearabic'] = 0x0669;
  16844. t['ninebengali'] = 0x09EF;
  16845. t['ninecircle'] = 0x2468;
  16846. t['ninecircleinversesansserif'] = 0x2792;
  16847. t['ninedeva'] = 0x096F;
  16848. t['ninegujarati'] = 0x0AEF;
  16849. t['ninegurmukhi'] = 0x0A6F;
  16850. t['ninehackarabic'] = 0x0669;
  16851. t['ninehangzhou'] = 0x3029;
  16852. t['nineideographicparen'] = 0x3228;
  16853. t['nineinferior'] = 0x2089;
  16854. t['ninemonospace'] = 0xFF19;
  16855. t['nineoldstyle'] = 0xF739;
  16856. t['nineparen'] = 0x247C;
  16857. t['nineperiod'] = 0x2490;
  16858. t['ninepersian'] = 0x06F9;
  16859. t['nineroman'] = 0x2178;
  16860. t['ninesuperior'] = 0x2079;
  16861. t['nineteencircle'] = 0x2472;
  16862. t['nineteenparen'] = 0x2486;
  16863. t['nineteenperiod'] = 0x249A;
  16864. t['ninethai'] = 0x0E59;
  16865. t['nj'] = 0x01CC;
  16866. t['njecyrillic'] = 0x045A;
  16867. t['nkatakana'] = 0x30F3;
  16868. t['nkatakanahalfwidth'] = 0xFF9D;
  16869. t['nlegrightlong'] = 0x019E;
  16870. t['nlinebelow'] = 0x1E49;
  16871. t['nmonospace'] = 0xFF4E;
  16872. t['nmsquare'] = 0x339A;
  16873. t['nnabengali'] = 0x09A3;
  16874. t['nnadeva'] = 0x0923;
  16875. t['nnagujarati'] = 0x0AA3;
  16876. t['nnagurmukhi'] = 0x0A23;
  16877. t['nnnadeva'] = 0x0929;
  16878. t['nohiragana'] = 0x306E;
  16879. t['nokatakana'] = 0x30CE;
  16880. t['nokatakanahalfwidth'] = 0xFF89;
  16881. t['nonbreakingspace'] = 0x00A0;
  16882. t['nonenthai'] = 0x0E13;
  16883. t['nonuthai'] = 0x0E19;
  16884. t['noonarabic'] = 0x0646;
  16885. t['noonfinalarabic'] = 0xFEE6;
  16886. t['noonghunnaarabic'] = 0x06BA;
  16887. t['noonghunnafinalarabic'] = 0xFB9F;
  16888. t['nooninitialarabic'] = 0xFEE7;
  16889. t['noonjeeminitialarabic'] = 0xFCD2;
  16890. t['noonjeemisolatedarabic'] = 0xFC4B;
  16891. t['noonmedialarabic'] = 0xFEE8;
  16892. t['noonmeeminitialarabic'] = 0xFCD5;
  16893. t['noonmeemisolatedarabic'] = 0xFC4E;
  16894. t['noonnoonfinalarabic'] = 0xFC8D;
  16895. t['notcontains'] = 0x220C;
  16896. t['notelement'] = 0x2209;
  16897. t['notelementof'] = 0x2209;
  16898. t['notequal'] = 0x2260;
  16899. t['notgreater'] = 0x226F;
  16900. t['notgreaternorequal'] = 0x2271;
  16901. t['notgreaternorless'] = 0x2279;
  16902. t['notidentical'] = 0x2262;
  16903. t['notless'] = 0x226E;
  16904. t['notlessnorequal'] = 0x2270;
  16905. t['notparallel'] = 0x2226;
  16906. t['notprecedes'] = 0x2280;
  16907. t['notsubset'] = 0x2284;
  16908. t['notsucceeds'] = 0x2281;
  16909. t['notsuperset'] = 0x2285;
  16910. t['nowarmenian'] = 0x0576;
  16911. t['nparen'] = 0x24A9;
  16912. t['nssquare'] = 0x33B1;
  16913. t['nsuperior'] = 0x207F;
  16914. t['ntilde'] = 0x00F1;
  16915. t['nu'] = 0x03BD;
  16916. t['nuhiragana'] = 0x306C;
  16917. t['nukatakana'] = 0x30CC;
  16918. t['nukatakanahalfwidth'] = 0xFF87;
  16919. t['nuktabengali'] = 0x09BC;
  16920. t['nuktadeva'] = 0x093C;
  16921. t['nuktagujarati'] = 0x0ABC;
  16922. t['nuktagurmukhi'] = 0x0A3C;
  16923. t['numbersign'] = 0x0023;
  16924. t['numbersignmonospace'] = 0xFF03;
  16925. t['numbersignsmall'] = 0xFE5F;
  16926. t['numeralsigngreek'] = 0x0374;
  16927. t['numeralsignlowergreek'] = 0x0375;
  16928. t['numero'] = 0x2116;
  16929. t['nun'] = 0x05E0;
  16930. t['nundagesh'] = 0xFB40;
  16931. t['nundageshhebrew'] = 0xFB40;
  16932. t['nunhebrew'] = 0x05E0;
  16933. t['nvsquare'] = 0x33B5;
  16934. t['nwsquare'] = 0x33BB;
  16935. t['nyabengali'] = 0x099E;
  16936. t['nyadeva'] = 0x091E;
  16937. t['nyagujarati'] = 0x0A9E;
  16938. t['nyagurmukhi'] = 0x0A1E;
  16939. t['o'] = 0x006F;
  16940. t['oacute'] = 0x00F3;
  16941. t['oangthai'] = 0x0E2D;
  16942. t['obarred'] = 0x0275;
  16943. t['obarredcyrillic'] = 0x04E9;
  16944. t['obarreddieresiscyrillic'] = 0x04EB;
  16945. t['obengali'] = 0x0993;
  16946. t['obopomofo'] = 0x311B;
  16947. t['obreve'] = 0x014F;
  16948. t['ocandradeva'] = 0x0911;
  16949. t['ocandragujarati'] = 0x0A91;
  16950. t['ocandravowelsigndeva'] = 0x0949;
  16951. t['ocandravowelsigngujarati'] = 0x0AC9;
  16952. t['ocaron'] = 0x01D2;
  16953. t['ocircle'] = 0x24DE;
  16954. t['ocircumflex'] = 0x00F4;
  16955. t['ocircumflexacute'] = 0x1ED1;
  16956. t['ocircumflexdotbelow'] = 0x1ED9;
  16957. t['ocircumflexgrave'] = 0x1ED3;
  16958. t['ocircumflexhookabove'] = 0x1ED5;
  16959. t['ocircumflextilde'] = 0x1ED7;
  16960. t['ocyrillic'] = 0x043E;
  16961. t['odblacute'] = 0x0151;
  16962. t['odblgrave'] = 0x020D;
  16963. t['odeva'] = 0x0913;
  16964. t['odieresis'] = 0x00F6;
  16965. t['odieresiscyrillic'] = 0x04E7;
  16966. t['odotbelow'] = 0x1ECD;
  16967. t['oe'] = 0x0153;
  16968. t['oekorean'] = 0x315A;
  16969. t['ogonek'] = 0x02DB;
  16970. t['ogonekcmb'] = 0x0328;
  16971. t['ograve'] = 0x00F2;
  16972. t['ogujarati'] = 0x0A93;
  16973. t['oharmenian'] = 0x0585;
  16974. t['ohiragana'] = 0x304A;
  16975. t['ohookabove'] = 0x1ECF;
  16976. t['ohorn'] = 0x01A1;
  16977. t['ohornacute'] = 0x1EDB;
  16978. t['ohorndotbelow'] = 0x1EE3;
  16979. t['ohorngrave'] = 0x1EDD;
  16980. t['ohornhookabove'] = 0x1EDF;
  16981. t['ohorntilde'] = 0x1EE1;
  16982. t['ohungarumlaut'] = 0x0151;
  16983. t['oi'] = 0x01A3;
  16984. t['oinvertedbreve'] = 0x020F;
  16985. t['okatakana'] = 0x30AA;
  16986. t['okatakanahalfwidth'] = 0xFF75;
  16987. t['okorean'] = 0x3157;
  16988. t['olehebrew'] = 0x05AB;
  16989. t['omacron'] = 0x014D;
  16990. t['omacronacute'] = 0x1E53;
  16991. t['omacrongrave'] = 0x1E51;
  16992. t['omdeva'] = 0x0950;
  16993. t['omega'] = 0x03C9;
  16994. t['omega1'] = 0x03D6;
  16995. t['omegacyrillic'] = 0x0461;
  16996. t['omegalatinclosed'] = 0x0277;
  16997. t['omegaroundcyrillic'] = 0x047B;
  16998. t['omegatitlocyrillic'] = 0x047D;
  16999. t['omegatonos'] = 0x03CE;
  17000. t['omgujarati'] = 0x0AD0;
  17001. t['omicron'] = 0x03BF;
  17002. t['omicrontonos'] = 0x03CC;
  17003. t['omonospace'] = 0xFF4F;
  17004. t['one'] = 0x0031;
  17005. t['onearabic'] = 0x0661;
  17006. t['onebengali'] = 0x09E7;
  17007. t['onecircle'] = 0x2460;
  17008. t['onecircleinversesansserif'] = 0x278A;
  17009. t['onedeva'] = 0x0967;
  17010. t['onedotenleader'] = 0x2024;
  17011. t['oneeighth'] = 0x215B;
  17012. t['onefitted'] = 0xF6DC;
  17013. t['onegujarati'] = 0x0AE7;
  17014. t['onegurmukhi'] = 0x0A67;
  17015. t['onehackarabic'] = 0x0661;
  17016. t['onehalf'] = 0x00BD;
  17017. t['onehangzhou'] = 0x3021;
  17018. t['oneideographicparen'] = 0x3220;
  17019. t['oneinferior'] = 0x2081;
  17020. t['onemonospace'] = 0xFF11;
  17021. t['onenumeratorbengali'] = 0x09F4;
  17022. t['oneoldstyle'] = 0xF731;
  17023. t['oneparen'] = 0x2474;
  17024. t['oneperiod'] = 0x2488;
  17025. t['onepersian'] = 0x06F1;
  17026. t['onequarter'] = 0x00BC;
  17027. t['oneroman'] = 0x2170;
  17028. t['onesuperior'] = 0x00B9;
  17029. t['onethai'] = 0x0E51;
  17030. t['onethird'] = 0x2153;
  17031. t['oogonek'] = 0x01EB;
  17032. t['oogonekmacron'] = 0x01ED;
  17033. t['oogurmukhi'] = 0x0A13;
  17034. t['oomatragurmukhi'] = 0x0A4B;
  17035. t['oopen'] = 0x0254;
  17036. t['oparen'] = 0x24AA;
  17037. t['openbullet'] = 0x25E6;
  17038. t['option'] = 0x2325;
  17039. t['ordfeminine'] = 0x00AA;
  17040. t['ordmasculine'] = 0x00BA;
  17041. t['orthogonal'] = 0x221F;
  17042. t['oshortdeva'] = 0x0912;
  17043. t['oshortvowelsigndeva'] = 0x094A;
  17044. t['oslash'] = 0x00F8;
  17045. t['oslashacute'] = 0x01FF;
  17046. t['osmallhiragana'] = 0x3049;
  17047. t['osmallkatakana'] = 0x30A9;
  17048. t['osmallkatakanahalfwidth'] = 0xFF6B;
  17049. t['ostrokeacute'] = 0x01FF;
  17050. t['osuperior'] = 0xF6F0;
  17051. t['otcyrillic'] = 0x047F;
  17052. t['otilde'] = 0x00F5;
  17053. t['otildeacute'] = 0x1E4D;
  17054. t['otildedieresis'] = 0x1E4F;
  17055. t['oubopomofo'] = 0x3121;
  17056. t['overline'] = 0x203E;
  17057. t['overlinecenterline'] = 0xFE4A;
  17058. t['overlinecmb'] = 0x0305;
  17059. t['overlinedashed'] = 0xFE49;
  17060. t['overlinedblwavy'] = 0xFE4C;
  17061. t['overlinewavy'] = 0xFE4B;
  17062. t['overscore'] = 0x00AF;
  17063. t['ovowelsignbengali'] = 0x09CB;
  17064. t['ovowelsigndeva'] = 0x094B;
  17065. t['ovowelsigngujarati'] = 0x0ACB;
  17066. t['p'] = 0x0070;
  17067. t['paampssquare'] = 0x3380;
  17068. t['paasentosquare'] = 0x332B;
  17069. t['pabengali'] = 0x09AA;
  17070. t['pacute'] = 0x1E55;
  17071. t['padeva'] = 0x092A;
  17072. t['pagedown'] = 0x21DF;
  17073. t['pageup'] = 0x21DE;
  17074. t['pagujarati'] = 0x0AAA;
  17075. t['pagurmukhi'] = 0x0A2A;
  17076. t['pahiragana'] = 0x3071;
  17077. t['paiyannoithai'] = 0x0E2F;
  17078. t['pakatakana'] = 0x30D1;
  17079. t['palatalizationcyrilliccmb'] = 0x0484;
  17080. t['palochkacyrillic'] = 0x04C0;
  17081. t['pansioskorean'] = 0x317F;
  17082. t['paragraph'] = 0x00B6;
  17083. t['parallel'] = 0x2225;
  17084. t['parenleft'] = 0x0028;
  17085. t['parenleftaltonearabic'] = 0xFD3E;
  17086. t['parenleftbt'] = 0xF8ED;
  17087. t['parenleftex'] = 0xF8EC;
  17088. t['parenleftinferior'] = 0x208D;
  17089. t['parenleftmonospace'] = 0xFF08;
  17090. t['parenleftsmall'] = 0xFE59;
  17091. t['parenleftsuperior'] = 0x207D;
  17092. t['parenlefttp'] = 0xF8EB;
  17093. t['parenleftvertical'] = 0xFE35;
  17094. t['parenright'] = 0x0029;
  17095. t['parenrightaltonearabic'] = 0xFD3F;
  17096. t['parenrightbt'] = 0xF8F8;
  17097. t['parenrightex'] = 0xF8F7;
  17098. t['parenrightinferior'] = 0x208E;
  17099. t['parenrightmonospace'] = 0xFF09;
  17100. t['parenrightsmall'] = 0xFE5A;
  17101. t['parenrightsuperior'] = 0x207E;
  17102. t['parenrighttp'] = 0xF8F6;
  17103. t['parenrightvertical'] = 0xFE36;
  17104. t['partialdiff'] = 0x2202;
  17105. t['paseqhebrew'] = 0x05C0;
  17106. t['pashtahebrew'] = 0x0599;
  17107. t['pasquare'] = 0x33A9;
  17108. t['patah'] = 0x05B7;
  17109. t['patah11'] = 0x05B7;
  17110. t['patah1d'] = 0x05B7;
  17111. t['patah2a'] = 0x05B7;
  17112. t['patahhebrew'] = 0x05B7;
  17113. t['patahnarrowhebrew'] = 0x05B7;
  17114. t['patahquarterhebrew'] = 0x05B7;
  17115. t['patahwidehebrew'] = 0x05B7;
  17116. t['pazerhebrew'] = 0x05A1;
  17117. t['pbopomofo'] = 0x3106;
  17118. t['pcircle'] = 0x24DF;
  17119. t['pdotaccent'] = 0x1E57;
  17120. t['pe'] = 0x05E4;
  17121. t['pecyrillic'] = 0x043F;
  17122. t['pedagesh'] = 0xFB44;
  17123. t['pedageshhebrew'] = 0xFB44;
  17124. t['peezisquare'] = 0x333B;
  17125. t['pefinaldageshhebrew'] = 0xFB43;
  17126. t['peharabic'] = 0x067E;
  17127. t['peharmenian'] = 0x057A;
  17128. t['pehebrew'] = 0x05E4;
  17129. t['pehfinalarabic'] = 0xFB57;
  17130. t['pehinitialarabic'] = 0xFB58;
  17131. t['pehiragana'] = 0x307A;
  17132. t['pehmedialarabic'] = 0xFB59;
  17133. t['pekatakana'] = 0x30DA;
  17134. t['pemiddlehookcyrillic'] = 0x04A7;
  17135. t['perafehebrew'] = 0xFB4E;
  17136. t['percent'] = 0x0025;
  17137. t['percentarabic'] = 0x066A;
  17138. t['percentmonospace'] = 0xFF05;
  17139. t['percentsmall'] = 0xFE6A;
  17140. t['period'] = 0x002E;
  17141. t['periodarmenian'] = 0x0589;
  17142. t['periodcentered'] = 0x00B7;
  17143. t['periodhalfwidth'] = 0xFF61;
  17144. t['periodinferior'] = 0xF6E7;
  17145. t['periodmonospace'] = 0xFF0E;
  17146. t['periodsmall'] = 0xFE52;
  17147. t['periodsuperior'] = 0xF6E8;
  17148. t['perispomenigreekcmb'] = 0x0342;
  17149. t['perpendicular'] = 0x22A5;
  17150. t['perthousand'] = 0x2030;
  17151. t['peseta'] = 0x20A7;
  17152. t['pfsquare'] = 0x338A;
  17153. t['phabengali'] = 0x09AB;
  17154. t['phadeva'] = 0x092B;
  17155. t['phagujarati'] = 0x0AAB;
  17156. t['phagurmukhi'] = 0x0A2B;
  17157. t['phi'] = 0x03C6;
  17158. t['phi1'] = 0x03D5;
  17159. t['phieuphacirclekorean'] = 0x327A;
  17160. t['phieuphaparenkorean'] = 0x321A;
  17161. t['phieuphcirclekorean'] = 0x326C;
  17162. t['phieuphkorean'] = 0x314D;
  17163. t['phieuphparenkorean'] = 0x320C;
  17164. t['philatin'] = 0x0278;
  17165. t['phinthuthai'] = 0x0E3A;
  17166. t['phisymbolgreek'] = 0x03D5;
  17167. t['phook'] = 0x01A5;
  17168. t['phophanthai'] = 0x0E1E;
  17169. t['phophungthai'] = 0x0E1C;
  17170. t['phosamphaothai'] = 0x0E20;
  17171. t['pi'] = 0x03C0;
  17172. t['pieupacirclekorean'] = 0x3273;
  17173. t['pieupaparenkorean'] = 0x3213;
  17174. t['pieupcieuckorean'] = 0x3176;
  17175. t['pieupcirclekorean'] = 0x3265;
  17176. t['pieupkiyeokkorean'] = 0x3172;
  17177. t['pieupkorean'] = 0x3142;
  17178. t['pieupparenkorean'] = 0x3205;
  17179. t['pieupsioskiyeokkorean'] = 0x3174;
  17180. t['pieupsioskorean'] = 0x3144;
  17181. t['pieupsiostikeutkorean'] = 0x3175;
  17182. t['pieupthieuthkorean'] = 0x3177;
  17183. t['pieuptikeutkorean'] = 0x3173;
  17184. t['pihiragana'] = 0x3074;
  17185. t['pikatakana'] = 0x30D4;
  17186. t['pisymbolgreek'] = 0x03D6;
  17187. t['piwrarmenian'] = 0x0583;
  17188. t['plus'] = 0x002B;
  17189. t['plusbelowcmb'] = 0x031F;
  17190. t['pluscircle'] = 0x2295;
  17191. t['plusminus'] = 0x00B1;
  17192. t['plusmod'] = 0x02D6;
  17193. t['plusmonospace'] = 0xFF0B;
  17194. t['plussmall'] = 0xFE62;
  17195. t['plussuperior'] = 0x207A;
  17196. t['pmonospace'] = 0xFF50;
  17197. t['pmsquare'] = 0x33D8;
  17198. t['pohiragana'] = 0x307D;
  17199. t['pointingindexdownwhite'] = 0x261F;
  17200. t['pointingindexleftwhite'] = 0x261C;
  17201. t['pointingindexrightwhite'] = 0x261E;
  17202. t['pointingindexupwhite'] = 0x261D;
  17203. t['pokatakana'] = 0x30DD;
  17204. t['poplathai'] = 0x0E1B;
  17205. t['postalmark'] = 0x3012;
  17206. t['postalmarkface'] = 0x3020;
  17207. t['pparen'] = 0x24AB;
  17208. t['precedes'] = 0x227A;
  17209. t['prescription'] = 0x211E;
  17210. t['primemod'] = 0x02B9;
  17211. t['primereversed'] = 0x2035;
  17212. t['product'] = 0x220F;
  17213. t['projective'] = 0x2305;
  17214. t['prolongedkana'] = 0x30FC;
  17215. t['propellor'] = 0x2318;
  17216. t['propersubset'] = 0x2282;
  17217. t['propersuperset'] = 0x2283;
  17218. t['proportion'] = 0x2237;
  17219. t['proportional'] = 0x221D;
  17220. t['psi'] = 0x03C8;
  17221. t['psicyrillic'] = 0x0471;
  17222. t['psilipneumatacyrilliccmb'] = 0x0486;
  17223. t['pssquare'] = 0x33B0;
  17224. t['puhiragana'] = 0x3077;
  17225. t['pukatakana'] = 0x30D7;
  17226. t['pvsquare'] = 0x33B4;
  17227. t['pwsquare'] = 0x33BA;
  17228. t['q'] = 0x0071;
  17229. t['qadeva'] = 0x0958;
  17230. t['qadmahebrew'] = 0x05A8;
  17231. t['qafarabic'] = 0x0642;
  17232. t['qaffinalarabic'] = 0xFED6;
  17233. t['qafinitialarabic'] = 0xFED7;
  17234. t['qafmedialarabic'] = 0xFED8;
  17235. t['qamats'] = 0x05B8;
  17236. t['qamats10'] = 0x05B8;
  17237. t['qamats1a'] = 0x05B8;
  17238. t['qamats1c'] = 0x05B8;
  17239. t['qamats27'] = 0x05B8;
  17240. t['qamats29'] = 0x05B8;
  17241. t['qamats33'] = 0x05B8;
  17242. t['qamatsde'] = 0x05B8;
  17243. t['qamatshebrew'] = 0x05B8;
  17244. t['qamatsnarrowhebrew'] = 0x05B8;
  17245. t['qamatsqatanhebrew'] = 0x05B8;
  17246. t['qamatsqatannarrowhebrew'] = 0x05B8;
  17247. t['qamatsqatanquarterhebrew'] = 0x05B8;
  17248. t['qamatsqatanwidehebrew'] = 0x05B8;
  17249. t['qamatsquarterhebrew'] = 0x05B8;
  17250. t['qamatswidehebrew'] = 0x05B8;
  17251. t['qarneyparahebrew'] = 0x059F;
  17252. t['qbopomofo'] = 0x3111;
  17253. t['qcircle'] = 0x24E0;
  17254. t['qhook'] = 0x02A0;
  17255. t['qmonospace'] = 0xFF51;
  17256. t['qof'] = 0x05E7;
  17257. t['qofdagesh'] = 0xFB47;
  17258. t['qofdageshhebrew'] = 0xFB47;
  17259. t['qofhebrew'] = 0x05E7;
  17260. t['qparen'] = 0x24AC;
  17261. t['quarternote'] = 0x2669;
  17262. t['qubuts'] = 0x05BB;
  17263. t['qubuts18'] = 0x05BB;
  17264. t['qubuts25'] = 0x05BB;
  17265. t['qubuts31'] = 0x05BB;
  17266. t['qubutshebrew'] = 0x05BB;
  17267. t['qubutsnarrowhebrew'] = 0x05BB;
  17268. t['qubutsquarterhebrew'] = 0x05BB;
  17269. t['qubutswidehebrew'] = 0x05BB;
  17270. t['question'] = 0x003F;
  17271. t['questionarabic'] = 0x061F;
  17272. t['questionarmenian'] = 0x055E;
  17273. t['questiondown'] = 0x00BF;
  17274. t['questiondownsmall'] = 0xF7BF;
  17275. t['questiongreek'] = 0x037E;
  17276. t['questionmonospace'] = 0xFF1F;
  17277. t['questionsmall'] = 0xF73F;
  17278. t['quotedbl'] = 0x0022;
  17279. t['quotedblbase'] = 0x201E;
  17280. t['quotedblleft'] = 0x201C;
  17281. t['quotedblmonospace'] = 0xFF02;
  17282. t['quotedblprime'] = 0x301E;
  17283. t['quotedblprimereversed'] = 0x301D;
  17284. t['quotedblright'] = 0x201D;
  17285. t['quoteleft'] = 0x2018;
  17286. t['quoteleftreversed'] = 0x201B;
  17287. t['quotereversed'] = 0x201B;
  17288. t['quoteright'] = 0x2019;
  17289. t['quoterightn'] = 0x0149;
  17290. t['quotesinglbase'] = 0x201A;
  17291. t['quotesingle'] = 0x0027;
  17292. t['quotesinglemonospace'] = 0xFF07;
  17293. t['r'] = 0x0072;
  17294. t['raarmenian'] = 0x057C;
  17295. t['rabengali'] = 0x09B0;
  17296. t['racute'] = 0x0155;
  17297. t['radeva'] = 0x0930;
  17298. t['radical'] = 0x221A;
  17299. t['radicalex'] = 0xF8E5;
  17300. t['radoverssquare'] = 0x33AE;
  17301. t['radoverssquaredsquare'] = 0x33AF;
  17302. t['radsquare'] = 0x33AD;
  17303. t['rafe'] = 0x05BF;
  17304. t['rafehebrew'] = 0x05BF;
  17305. t['ragujarati'] = 0x0AB0;
  17306. t['ragurmukhi'] = 0x0A30;
  17307. t['rahiragana'] = 0x3089;
  17308. t['rakatakana'] = 0x30E9;
  17309. t['rakatakanahalfwidth'] = 0xFF97;
  17310. t['ralowerdiagonalbengali'] = 0x09F1;
  17311. t['ramiddlediagonalbengali'] = 0x09F0;
  17312. t['ramshorn'] = 0x0264;
  17313. t['ratio'] = 0x2236;
  17314. t['rbopomofo'] = 0x3116;
  17315. t['rcaron'] = 0x0159;
  17316. t['rcedilla'] = 0x0157;
  17317. t['rcircle'] = 0x24E1;
  17318. t['rcommaaccent'] = 0x0157;
  17319. t['rdblgrave'] = 0x0211;
  17320. t['rdotaccent'] = 0x1E59;
  17321. t['rdotbelow'] = 0x1E5B;
  17322. t['rdotbelowmacron'] = 0x1E5D;
  17323. t['referencemark'] = 0x203B;
  17324. t['reflexsubset'] = 0x2286;
  17325. t['reflexsuperset'] = 0x2287;
  17326. t['registered'] = 0x00AE;
  17327. t['registersans'] = 0xF8E8;
  17328. t['registerserif'] = 0xF6DA;
  17329. t['reharabic'] = 0x0631;
  17330. t['reharmenian'] = 0x0580;
  17331. t['rehfinalarabic'] = 0xFEAE;
  17332. t['rehiragana'] = 0x308C;
  17333. t['rekatakana'] = 0x30EC;
  17334. t['rekatakanahalfwidth'] = 0xFF9A;
  17335. t['resh'] = 0x05E8;
  17336. t['reshdageshhebrew'] = 0xFB48;
  17337. t['reshhebrew'] = 0x05E8;
  17338. t['reversedtilde'] = 0x223D;
  17339. t['reviahebrew'] = 0x0597;
  17340. t['reviamugrashhebrew'] = 0x0597;
  17341. t['revlogicalnot'] = 0x2310;
  17342. t['rfishhook'] = 0x027E;
  17343. t['rfishhookreversed'] = 0x027F;
  17344. t['rhabengali'] = 0x09DD;
  17345. t['rhadeva'] = 0x095D;
  17346. t['rho'] = 0x03C1;
  17347. t['rhook'] = 0x027D;
  17348. t['rhookturned'] = 0x027B;
  17349. t['rhookturnedsuperior'] = 0x02B5;
  17350. t['rhosymbolgreek'] = 0x03F1;
  17351. t['rhotichookmod'] = 0x02DE;
  17352. t['rieulacirclekorean'] = 0x3271;
  17353. t['rieulaparenkorean'] = 0x3211;
  17354. t['rieulcirclekorean'] = 0x3263;
  17355. t['rieulhieuhkorean'] = 0x3140;
  17356. t['rieulkiyeokkorean'] = 0x313A;
  17357. t['rieulkiyeoksioskorean'] = 0x3169;
  17358. t['rieulkorean'] = 0x3139;
  17359. t['rieulmieumkorean'] = 0x313B;
  17360. t['rieulpansioskorean'] = 0x316C;
  17361. t['rieulparenkorean'] = 0x3203;
  17362. t['rieulphieuphkorean'] = 0x313F;
  17363. t['rieulpieupkorean'] = 0x313C;
  17364. t['rieulpieupsioskorean'] = 0x316B;
  17365. t['rieulsioskorean'] = 0x313D;
  17366. t['rieulthieuthkorean'] = 0x313E;
  17367. t['rieultikeutkorean'] = 0x316A;
  17368. t['rieulyeorinhieuhkorean'] = 0x316D;
  17369. t['rightangle'] = 0x221F;
  17370. t['righttackbelowcmb'] = 0x0319;
  17371. t['righttriangle'] = 0x22BF;
  17372. t['rihiragana'] = 0x308A;
  17373. t['rikatakana'] = 0x30EA;
  17374. t['rikatakanahalfwidth'] = 0xFF98;
  17375. t['ring'] = 0x02DA;
  17376. t['ringbelowcmb'] = 0x0325;
  17377. t['ringcmb'] = 0x030A;
  17378. t['ringhalfleft'] = 0x02BF;
  17379. t['ringhalfleftarmenian'] = 0x0559;
  17380. t['ringhalfleftbelowcmb'] = 0x031C;
  17381. t['ringhalfleftcentered'] = 0x02D3;
  17382. t['ringhalfright'] = 0x02BE;
  17383. t['ringhalfrightbelowcmb'] = 0x0339;
  17384. t['ringhalfrightcentered'] = 0x02D2;
  17385. t['rinvertedbreve'] = 0x0213;
  17386. t['rittorusquare'] = 0x3351;
  17387. t['rlinebelow'] = 0x1E5F;
  17388. t['rlongleg'] = 0x027C;
  17389. t['rlonglegturned'] = 0x027A;
  17390. t['rmonospace'] = 0xFF52;
  17391. t['rohiragana'] = 0x308D;
  17392. t['rokatakana'] = 0x30ED;
  17393. t['rokatakanahalfwidth'] = 0xFF9B;
  17394. t['roruathai'] = 0x0E23;
  17395. t['rparen'] = 0x24AD;
  17396. t['rrabengali'] = 0x09DC;
  17397. t['rradeva'] = 0x0931;
  17398. t['rragurmukhi'] = 0x0A5C;
  17399. t['rreharabic'] = 0x0691;
  17400. t['rrehfinalarabic'] = 0xFB8D;
  17401. t['rrvocalicbengali'] = 0x09E0;
  17402. t['rrvocalicdeva'] = 0x0960;
  17403. t['rrvocalicgujarati'] = 0x0AE0;
  17404. t['rrvocalicvowelsignbengali'] = 0x09C4;
  17405. t['rrvocalicvowelsigndeva'] = 0x0944;
  17406. t['rrvocalicvowelsigngujarati'] = 0x0AC4;
  17407. t['rsuperior'] = 0xF6F1;
  17408. t['rtblock'] = 0x2590;
  17409. t['rturned'] = 0x0279;
  17410. t['rturnedsuperior'] = 0x02B4;
  17411. t['ruhiragana'] = 0x308B;
  17412. t['rukatakana'] = 0x30EB;
  17413. t['rukatakanahalfwidth'] = 0xFF99;
  17414. t['rupeemarkbengali'] = 0x09F2;
  17415. t['rupeesignbengali'] = 0x09F3;
  17416. t['rupiah'] = 0xF6DD;
  17417. t['ruthai'] = 0x0E24;
  17418. t['rvocalicbengali'] = 0x098B;
  17419. t['rvocalicdeva'] = 0x090B;
  17420. t['rvocalicgujarati'] = 0x0A8B;
  17421. t['rvocalicvowelsignbengali'] = 0x09C3;
  17422. t['rvocalicvowelsigndeva'] = 0x0943;
  17423. t['rvocalicvowelsigngujarati'] = 0x0AC3;
  17424. t['s'] = 0x0073;
  17425. t['sabengali'] = 0x09B8;
  17426. t['sacute'] = 0x015B;
  17427. t['sacutedotaccent'] = 0x1E65;
  17428. t['sadarabic'] = 0x0635;
  17429. t['sadeva'] = 0x0938;
  17430. t['sadfinalarabic'] = 0xFEBA;
  17431. t['sadinitialarabic'] = 0xFEBB;
  17432. t['sadmedialarabic'] = 0xFEBC;
  17433. t['sagujarati'] = 0x0AB8;
  17434. t['sagurmukhi'] = 0x0A38;
  17435. t['sahiragana'] = 0x3055;
  17436. t['sakatakana'] = 0x30B5;
  17437. t['sakatakanahalfwidth'] = 0xFF7B;
  17438. t['sallallahoualayhewasallamarabic'] = 0xFDFA;
  17439. t['samekh'] = 0x05E1;
  17440. t['samekhdagesh'] = 0xFB41;
  17441. t['samekhdageshhebrew'] = 0xFB41;
  17442. t['samekhhebrew'] = 0x05E1;
  17443. t['saraaathai'] = 0x0E32;
  17444. t['saraaethai'] = 0x0E41;
  17445. t['saraaimaimalaithai'] = 0x0E44;
  17446. t['saraaimaimuanthai'] = 0x0E43;
  17447. t['saraamthai'] = 0x0E33;
  17448. t['saraathai'] = 0x0E30;
  17449. t['saraethai'] = 0x0E40;
  17450. t['saraiileftthai'] = 0xF886;
  17451. t['saraiithai'] = 0x0E35;
  17452. t['saraileftthai'] = 0xF885;
  17453. t['saraithai'] = 0x0E34;
  17454. t['saraothai'] = 0x0E42;
  17455. t['saraueeleftthai'] = 0xF888;
  17456. t['saraueethai'] = 0x0E37;
  17457. t['saraueleftthai'] = 0xF887;
  17458. t['sarauethai'] = 0x0E36;
  17459. t['sarauthai'] = 0x0E38;
  17460. t['sarauuthai'] = 0x0E39;
  17461. t['sbopomofo'] = 0x3119;
  17462. t['scaron'] = 0x0161;
  17463. t['scarondotaccent'] = 0x1E67;
  17464. t['scedilla'] = 0x015F;
  17465. t['schwa'] = 0x0259;
  17466. t['schwacyrillic'] = 0x04D9;
  17467. t['schwadieresiscyrillic'] = 0x04DB;
  17468. t['schwahook'] = 0x025A;
  17469. t['scircle'] = 0x24E2;
  17470. t['scircumflex'] = 0x015D;
  17471. t['scommaaccent'] = 0x0219;
  17472. t['sdotaccent'] = 0x1E61;
  17473. t['sdotbelow'] = 0x1E63;
  17474. t['sdotbelowdotaccent'] = 0x1E69;
  17475. t['seagullbelowcmb'] = 0x033C;
  17476. t['second'] = 0x2033;
  17477. t['secondtonechinese'] = 0x02CA;
  17478. t['section'] = 0x00A7;
  17479. t['seenarabic'] = 0x0633;
  17480. t['seenfinalarabic'] = 0xFEB2;
  17481. t['seeninitialarabic'] = 0xFEB3;
  17482. t['seenmedialarabic'] = 0xFEB4;
  17483. t['segol'] = 0x05B6;
  17484. t['segol13'] = 0x05B6;
  17485. t['segol1f'] = 0x05B6;
  17486. t['segol2c'] = 0x05B6;
  17487. t['segolhebrew'] = 0x05B6;
  17488. t['segolnarrowhebrew'] = 0x05B6;
  17489. t['segolquarterhebrew'] = 0x05B6;
  17490. t['segoltahebrew'] = 0x0592;
  17491. t['segolwidehebrew'] = 0x05B6;
  17492. t['seharmenian'] = 0x057D;
  17493. t['sehiragana'] = 0x305B;
  17494. t['sekatakana'] = 0x30BB;
  17495. t['sekatakanahalfwidth'] = 0xFF7E;
  17496. t['semicolon'] = 0x003B;
  17497. t['semicolonarabic'] = 0x061B;
  17498. t['semicolonmonospace'] = 0xFF1B;
  17499. t['semicolonsmall'] = 0xFE54;
  17500. t['semivoicedmarkkana'] = 0x309C;
  17501. t['semivoicedmarkkanahalfwidth'] = 0xFF9F;
  17502. t['sentisquare'] = 0x3322;
  17503. t['sentosquare'] = 0x3323;
  17504. t['seven'] = 0x0037;
  17505. t['sevenarabic'] = 0x0667;
  17506. t['sevenbengali'] = 0x09ED;
  17507. t['sevencircle'] = 0x2466;
  17508. t['sevencircleinversesansserif'] = 0x2790;
  17509. t['sevendeva'] = 0x096D;
  17510. t['seveneighths'] = 0x215E;
  17511. t['sevengujarati'] = 0x0AED;
  17512. t['sevengurmukhi'] = 0x0A6D;
  17513. t['sevenhackarabic'] = 0x0667;
  17514. t['sevenhangzhou'] = 0x3027;
  17515. t['sevenideographicparen'] = 0x3226;
  17516. t['seveninferior'] = 0x2087;
  17517. t['sevenmonospace'] = 0xFF17;
  17518. t['sevenoldstyle'] = 0xF737;
  17519. t['sevenparen'] = 0x247A;
  17520. t['sevenperiod'] = 0x248E;
  17521. t['sevenpersian'] = 0x06F7;
  17522. t['sevenroman'] = 0x2176;
  17523. t['sevensuperior'] = 0x2077;
  17524. t['seventeencircle'] = 0x2470;
  17525. t['seventeenparen'] = 0x2484;
  17526. t['seventeenperiod'] = 0x2498;
  17527. t['seventhai'] = 0x0E57;
  17528. t['sfthyphen'] = 0x00AD;
  17529. t['shaarmenian'] = 0x0577;
  17530. t['shabengali'] = 0x09B6;
  17531. t['shacyrillic'] = 0x0448;
  17532. t['shaddaarabic'] = 0x0651;
  17533. t['shaddadammaarabic'] = 0xFC61;
  17534. t['shaddadammatanarabic'] = 0xFC5E;
  17535. t['shaddafathaarabic'] = 0xFC60;
  17536. t['shaddakasraarabic'] = 0xFC62;
  17537. t['shaddakasratanarabic'] = 0xFC5F;
  17538. t['shade'] = 0x2592;
  17539. t['shadedark'] = 0x2593;
  17540. t['shadelight'] = 0x2591;
  17541. t['shademedium'] = 0x2592;
  17542. t['shadeva'] = 0x0936;
  17543. t['shagujarati'] = 0x0AB6;
  17544. t['shagurmukhi'] = 0x0A36;
  17545. t['shalshelethebrew'] = 0x0593;
  17546. t['shbopomofo'] = 0x3115;
  17547. t['shchacyrillic'] = 0x0449;
  17548. t['sheenarabic'] = 0x0634;
  17549. t['sheenfinalarabic'] = 0xFEB6;
  17550. t['sheeninitialarabic'] = 0xFEB7;
  17551. t['sheenmedialarabic'] = 0xFEB8;
  17552. t['sheicoptic'] = 0x03E3;
  17553. t['sheqel'] = 0x20AA;
  17554. t['sheqelhebrew'] = 0x20AA;
  17555. t['sheva'] = 0x05B0;
  17556. t['sheva115'] = 0x05B0;
  17557. t['sheva15'] = 0x05B0;
  17558. t['sheva22'] = 0x05B0;
  17559. t['sheva2e'] = 0x05B0;
  17560. t['shevahebrew'] = 0x05B0;
  17561. t['shevanarrowhebrew'] = 0x05B0;
  17562. t['shevaquarterhebrew'] = 0x05B0;
  17563. t['shevawidehebrew'] = 0x05B0;
  17564. t['shhacyrillic'] = 0x04BB;
  17565. t['shimacoptic'] = 0x03ED;
  17566. t['shin'] = 0x05E9;
  17567. t['shindagesh'] = 0xFB49;
  17568. t['shindageshhebrew'] = 0xFB49;
  17569. t['shindageshshindot'] = 0xFB2C;
  17570. t['shindageshshindothebrew'] = 0xFB2C;
  17571. t['shindageshsindot'] = 0xFB2D;
  17572. t['shindageshsindothebrew'] = 0xFB2D;
  17573. t['shindothebrew'] = 0x05C1;
  17574. t['shinhebrew'] = 0x05E9;
  17575. t['shinshindot'] = 0xFB2A;
  17576. t['shinshindothebrew'] = 0xFB2A;
  17577. t['shinsindot'] = 0xFB2B;
  17578. t['shinsindothebrew'] = 0xFB2B;
  17579. t['shook'] = 0x0282;
  17580. t['sigma'] = 0x03C3;
  17581. t['sigma1'] = 0x03C2;
  17582. t['sigmafinal'] = 0x03C2;
  17583. t['sigmalunatesymbolgreek'] = 0x03F2;
  17584. t['sihiragana'] = 0x3057;
  17585. t['sikatakana'] = 0x30B7;
  17586. t['sikatakanahalfwidth'] = 0xFF7C;
  17587. t['siluqhebrew'] = 0x05BD;
  17588. t['siluqlefthebrew'] = 0x05BD;
  17589. t['similar'] = 0x223C;
  17590. t['sindothebrew'] = 0x05C2;
  17591. t['siosacirclekorean'] = 0x3274;
  17592. t['siosaparenkorean'] = 0x3214;
  17593. t['sioscieuckorean'] = 0x317E;
  17594. t['sioscirclekorean'] = 0x3266;
  17595. t['sioskiyeokkorean'] = 0x317A;
  17596. t['sioskorean'] = 0x3145;
  17597. t['siosnieunkorean'] = 0x317B;
  17598. t['siosparenkorean'] = 0x3206;
  17599. t['siospieupkorean'] = 0x317D;
  17600. t['siostikeutkorean'] = 0x317C;
  17601. t['six'] = 0x0036;
  17602. t['sixarabic'] = 0x0666;
  17603. t['sixbengali'] = 0x09EC;
  17604. t['sixcircle'] = 0x2465;
  17605. t['sixcircleinversesansserif'] = 0x278F;
  17606. t['sixdeva'] = 0x096C;
  17607. t['sixgujarati'] = 0x0AEC;
  17608. t['sixgurmukhi'] = 0x0A6C;
  17609. t['sixhackarabic'] = 0x0666;
  17610. t['sixhangzhou'] = 0x3026;
  17611. t['sixideographicparen'] = 0x3225;
  17612. t['sixinferior'] = 0x2086;
  17613. t['sixmonospace'] = 0xFF16;
  17614. t['sixoldstyle'] = 0xF736;
  17615. t['sixparen'] = 0x2479;
  17616. t['sixperiod'] = 0x248D;
  17617. t['sixpersian'] = 0x06F6;
  17618. t['sixroman'] = 0x2175;
  17619. t['sixsuperior'] = 0x2076;
  17620. t['sixteencircle'] = 0x246F;
  17621. t['sixteencurrencydenominatorbengali'] = 0x09F9;
  17622. t['sixteenparen'] = 0x2483;
  17623. t['sixteenperiod'] = 0x2497;
  17624. t['sixthai'] = 0x0E56;
  17625. t['slash'] = 0x002F;
  17626. t['slashmonospace'] = 0xFF0F;
  17627. t['slong'] = 0x017F;
  17628. t['slongdotaccent'] = 0x1E9B;
  17629. t['smileface'] = 0x263A;
  17630. t['smonospace'] = 0xFF53;
  17631. t['sofpasuqhebrew'] = 0x05C3;
  17632. t['softhyphen'] = 0x00AD;
  17633. t['softsigncyrillic'] = 0x044C;
  17634. t['sohiragana'] = 0x305D;
  17635. t['sokatakana'] = 0x30BD;
  17636. t['sokatakanahalfwidth'] = 0xFF7F;
  17637. t['soliduslongoverlaycmb'] = 0x0338;
  17638. t['solidusshortoverlaycmb'] = 0x0337;
  17639. t['sorusithai'] = 0x0E29;
  17640. t['sosalathai'] = 0x0E28;
  17641. t['sosothai'] = 0x0E0B;
  17642. t['sosuathai'] = 0x0E2A;
  17643. t['space'] = 0x0020;
  17644. t['spacehackarabic'] = 0x0020;
  17645. t['spade'] = 0x2660;
  17646. t['spadesuitblack'] = 0x2660;
  17647. t['spadesuitwhite'] = 0x2664;
  17648. t['sparen'] = 0x24AE;
  17649. t['squarebelowcmb'] = 0x033B;
  17650. t['squarecc'] = 0x33C4;
  17651. t['squarecm'] = 0x339D;
  17652. t['squarediagonalcrosshatchfill'] = 0x25A9;
  17653. t['squarehorizontalfill'] = 0x25A4;
  17654. t['squarekg'] = 0x338F;
  17655. t['squarekm'] = 0x339E;
  17656. t['squarekmcapital'] = 0x33CE;
  17657. t['squareln'] = 0x33D1;
  17658. t['squarelog'] = 0x33D2;
  17659. t['squaremg'] = 0x338E;
  17660. t['squaremil'] = 0x33D5;
  17661. t['squaremm'] = 0x339C;
  17662. t['squaremsquared'] = 0x33A1;
  17663. t['squareorthogonalcrosshatchfill'] = 0x25A6;
  17664. t['squareupperlefttolowerrightfill'] = 0x25A7;
  17665. t['squareupperrighttolowerleftfill'] = 0x25A8;
  17666. t['squareverticalfill'] = 0x25A5;
  17667. t['squarewhitewithsmallblack'] = 0x25A3;
  17668. t['srsquare'] = 0x33DB;
  17669. t['ssabengali'] = 0x09B7;
  17670. t['ssadeva'] = 0x0937;
  17671. t['ssagujarati'] = 0x0AB7;
  17672. t['ssangcieuckorean'] = 0x3149;
  17673. t['ssanghieuhkorean'] = 0x3185;
  17674. t['ssangieungkorean'] = 0x3180;
  17675. t['ssangkiyeokkorean'] = 0x3132;
  17676. t['ssangnieunkorean'] = 0x3165;
  17677. t['ssangpieupkorean'] = 0x3143;
  17678. t['ssangsioskorean'] = 0x3146;
  17679. t['ssangtikeutkorean'] = 0x3138;
  17680. t['ssuperior'] = 0xF6F2;
  17681. t['sterling'] = 0x00A3;
  17682. t['sterlingmonospace'] = 0xFFE1;
  17683. t['strokelongoverlaycmb'] = 0x0336;
  17684. t['strokeshortoverlaycmb'] = 0x0335;
  17685. t['subset'] = 0x2282;
  17686. t['subsetnotequal'] = 0x228A;
  17687. t['subsetorequal'] = 0x2286;
  17688. t['succeeds'] = 0x227B;
  17689. t['suchthat'] = 0x220B;
  17690. t['suhiragana'] = 0x3059;
  17691. t['sukatakana'] = 0x30B9;
  17692. t['sukatakanahalfwidth'] = 0xFF7D;
  17693. t['sukunarabic'] = 0x0652;
  17694. t['summation'] = 0x2211;
  17695. t['sun'] = 0x263C;
  17696. t['superset'] = 0x2283;
  17697. t['supersetnotequal'] = 0x228B;
  17698. t['supersetorequal'] = 0x2287;
  17699. t['svsquare'] = 0x33DC;
  17700. t['syouwaerasquare'] = 0x337C;
  17701. t['t'] = 0x0074;
  17702. t['tabengali'] = 0x09A4;
  17703. t['tackdown'] = 0x22A4;
  17704. t['tackleft'] = 0x22A3;
  17705. t['tadeva'] = 0x0924;
  17706. t['tagujarati'] = 0x0AA4;
  17707. t['tagurmukhi'] = 0x0A24;
  17708. t['taharabic'] = 0x0637;
  17709. t['tahfinalarabic'] = 0xFEC2;
  17710. t['tahinitialarabic'] = 0xFEC3;
  17711. t['tahiragana'] = 0x305F;
  17712. t['tahmedialarabic'] = 0xFEC4;
  17713. t['taisyouerasquare'] = 0x337D;
  17714. t['takatakana'] = 0x30BF;
  17715. t['takatakanahalfwidth'] = 0xFF80;
  17716. t['tatweelarabic'] = 0x0640;
  17717. t['tau'] = 0x03C4;
  17718. t['tav'] = 0x05EA;
  17719. t['tavdages'] = 0xFB4A;
  17720. t['tavdagesh'] = 0xFB4A;
  17721. t['tavdageshhebrew'] = 0xFB4A;
  17722. t['tavhebrew'] = 0x05EA;
  17723. t['tbar'] = 0x0167;
  17724. t['tbopomofo'] = 0x310A;
  17725. t['tcaron'] = 0x0165;
  17726. t['tccurl'] = 0x02A8;
  17727. t['tcedilla'] = 0x0163;
  17728. t['tcheharabic'] = 0x0686;
  17729. t['tchehfinalarabic'] = 0xFB7B;
  17730. t['tchehinitialarabic'] = 0xFB7C;
  17731. t['tchehmedialarabic'] = 0xFB7D;
  17732. t['tcircle'] = 0x24E3;
  17733. t['tcircumflexbelow'] = 0x1E71;
  17734. t['tcommaaccent'] = 0x0163;
  17735. t['tdieresis'] = 0x1E97;
  17736. t['tdotaccent'] = 0x1E6B;
  17737. t['tdotbelow'] = 0x1E6D;
  17738. t['tecyrillic'] = 0x0442;
  17739. t['tedescendercyrillic'] = 0x04AD;
  17740. t['teharabic'] = 0x062A;
  17741. t['tehfinalarabic'] = 0xFE96;
  17742. t['tehhahinitialarabic'] = 0xFCA2;
  17743. t['tehhahisolatedarabic'] = 0xFC0C;
  17744. t['tehinitialarabic'] = 0xFE97;
  17745. t['tehiragana'] = 0x3066;
  17746. t['tehjeeminitialarabic'] = 0xFCA1;
  17747. t['tehjeemisolatedarabic'] = 0xFC0B;
  17748. t['tehmarbutaarabic'] = 0x0629;
  17749. t['tehmarbutafinalarabic'] = 0xFE94;
  17750. t['tehmedialarabic'] = 0xFE98;
  17751. t['tehmeeminitialarabic'] = 0xFCA4;
  17752. t['tehmeemisolatedarabic'] = 0xFC0E;
  17753. t['tehnoonfinalarabic'] = 0xFC73;
  17754. t['tekatakana'] = 0x30C6;
  17755. t['tekatakanahalfwidth'] = 0xFF83;
  17756. t['telephone'] = 0x2121;
  17757. t['telephoneblack'] = 0x260E;
  17758. t['telishagedolahebrew'] = 0x05A0;
  17759. t['telishaqetanahebrew'] = 0x05A9;
  17760. t['tencircle'] = 0x2469;
  17761. t['tenideographicparen'] = 0x3229;
  17762. t['tenparen'] = 0x247D;
  17763. t['tenperiod'] = 0x2491;
  17764. t['tenroman'] = 0x2179;
  17765. t['tesh'] = 0x02A7;
  17766. t['tet'] = 0x05D8;
  17767. t['tetdagesh'] = 0xFB38;
  17768. t['tetdageshhebrew'] = 0xFB38;
  17769. t['tethebrew'] = 0x05D8;
  17770. t['tetsecyrillic'] = 0x04B5;
  17771. t['tevirhebrew'] = 0x059B;
  17772. t['tevirlefthebrew'] = 0x059B;
  17773. t['thabengali'] = 0x09A5;
  17774. t['thadeva'] = 0x0925;
  17775. t['thagujarati'] = 0x0AA5;
  17776. t['thagurmukhi'] = 0x0A25;
  17777. t['thalarabic'] = 0x0630;
  17778. t['thalfinalarabic'] = 0xFEAC;
  17779. t['thanthakhatlowleftthai'] = 0xF898;
  17780. t['thanthakhatlowrightthai'] = 0xF897;
  17781. t['thanthakhatthai'] = 0x0E4C;
  17782. t['thanthakhatupperleftthai'] = 0xF896;
  17783. t['theharabic'] = 0x062B;
  17784. t['thehfinalarabic'] = 0xFE9A;
  17785. t['thehinitialarabic'] = 0xFE9B;
  17786. t['thehmedialarabic'] = 0xFE9C;
  17787. t['thereexists'] = 0x2203;
  17788. t['therefore'] = 0x2234;
  17789. t['theta'] = 0x03B8;
  17790. t['theta1'] = 0x03D1;
  17791. t['thetasymbolgreek'] = 0x03D1;
  17792. t['thieuthacirclekorean'] = 0x3279;
  17793. t['thieuthaparenkorean'] = 0x3219;
  17794. t['thieuthcirclekorean'] = 0x326B;
  17795. t['thieuthkorean'] = 0x314C;
  17796. t['thieuthparenkorean'] = 0x320B;
  17797. t['thirteencircle'] = 0x246C;
  17798. t['thirteenparen'] = 0x2480;
  17799. t['thirteenperiod'] = 0x2494;
  17800. t['thonangmonthothai'] = 0x0E11;
  17801. t['thook'] = 0x01AD;
  17802. t['thophuthaothai'] = 0x0E12;
  17803. t['thorn'] = 0x00FE;
  17804. t['thothahanthai'] = 0x0E17;
  17805. t['thothanthai'] = 0x0E10;
  17806. t['thothongthai'] = 0x0E18;
  17807. t['thothungthai'] = 0x0E16;
  17808. t['thousandcyrillic'] = 0x0482;
  17809. t['thousandsseparatorarabic'] = 0x066C;
  17810. t['thousandsseparatorpersian'] = 0x066C;
  17811. t['three'] = 0x0033;
  17812. t['threearabic'] = 0x0663;
  17813. t['threebengali'] = 0x09E9;
  17814. t['threecircle'] = 0x2462;
  17815. t['threecircleinversesansserif'] = 0x278C;
  17816. t['threedeva'] = 0x0969;
  17817. t['threeeighths'] = 0x215C;
  17818. t['threegujarati'] = 0x0AE9;
  17819. t['threegurmukhi'] = 0x0A69;
  17820. t['threehackarabic'] = 0x0663;
  17821. t['threehangzhou'] = 0x3023;
  17822. t['threeideographicparen'] = 0x3222;
  17823. t['threeinferior'] = 0x2083;
  17824. t['threemonospace'] = 0xFF13;
  17825. t['threenumeratorbengali'] = 0x09F6;
  17826. t['threeoldstyle'] = 0xF733;
  17827. t['threeparen'] = 0x2476;
  17828. t['threeperiod'] = 0x248A;
  17829. t['threepersian'] = 0x06F3;
  17830. t['threequarters'] = 0x00BE;
  17831. t['threequartersemdash'] = 0xF6DE;
  17832. t['threeroman'] = 0x2172;
  17833. t['threesuperior'] = 0x00B3;
  17834. t['threethai'] = 0x0E53;
  17835. t['thzsquare'] = 0x3394;
  17836. t['tihiragana'] = 0x3061;
  17837. t['tikatakana'] = 0x30C1;
  17838. t['tikatakanahalfwidth'] = 0xFF81;
  17839. t['tikeutacirclekorean'] = 0x3270;
  17840. t['tikeutaparenkorean'] = 0x3210;
  17841. t['tikeutcirclekorean'] = 0x3262;
  17842. t['tikeutkorean'] = 0x3137;
  17843. t['tikeutparenkorean'] = 0x3202;
  17844. t['tilde'] = 0x02DC;
  17845. t['tildebelowcmb'] = 0x0330;
  17846. t['tildecmb'] = 0x0303;
  17847. t['tildecomb'] = 0x0303;
  17848. t['tildedoublecmb'] = 0x0360;
  17849. t['tildeoperator'] = 0x223C;
  17850. t['tildeoverlaycmb'] = 0x0334;
  17851. t['tildeverticalcmb'] = 0x033E;
  17852. t['timescircle'] = 0x2297;
  17853. t['tipehahebrew'] = 0x0596;
  17854. t['tipehalefthebrew'] = 0x0596;
  17855. t['tippigurmukhi'] = 0x0A70;
  17856. t['titlocyrilliccmb'] = 0x0483;
  17857. t['tiwnarmenian'] = 0x057F;
  17858. t['tlinebelow'] = 0x1E6F;
  17859. t['tmonospace'] = 0xFF54;
  17860. t['toarmenian'] = 0x0569;
  17861. t['tohiragana'] = 0x3068;
  17862. t['tokatakana'] = 0x30C8;
  17863. t['tokatakanahalfwidth'] = 0xFF84;
  17864. t['tonebarextrahighmod'] = 0x02E5;
  17865. t['tonebarextralowmod'] = 0x02E9;
  17866. t['tonebarhighmod'] = 0x02E6;
  17867. t['tonebarlowmod'] = 0x02E8;
  17868. t['tonebarmidmod'] = 0x02E7;
  17869. t['tonefive'] = 0x01BD;
  17870. t['tonesix'] = 0x0185;
  17871. t['tonetwo'] = 0x01A8;
  17872. t['tonos'] = 0x0384;
  17873. t['tonsquare'] = 0x3327;
  17874. t['topatakthai'] = 0x0E0F;
  17875. t['tortoiseshellbracketleft'] = 0x3014;
  17876. t['tortoiseshellbracketleftsmall'] = 0xFE5D;
  17877. t['tortoiseshellbracketleftvertical'] = 0xFE39;
  17878. t['tortoiseshellbracketright'] = 0x3015;
  17879. t['tortoiseshellbracketrightsmall'] = 0xFE5E;
  17880. t['tortoiseshellbracketrightvertical'] = 0xFE3A;
  17881. t['totaothai'] = 0x0E15;
  17882. t['tpalatalhook'] = 0x01AB;
  17883. t['tparen'] = 0x24AF;
  17884. t['trademark'] = 0x2122;
  17885. t['trademarksans'] = 0xF8EA;
  17886. t['trademarkserif'] = 0xF6DB;
  17887. t['tretroflexhook'] = 0x0288;
  17888. t['triagdn'] = 0x25BC;
  17889. t['triaglf'] = 0x25C4;
  17890. t['triagrt'] = 0x25BA;
  17891. t['triagup'] = 0x25B2;
  17892. t['ts'] = 0x02A6;
  17893. t['tsadi'] = 0x05E6;
  17894. t['tsadidagesh'] = 0xFB46;
  17895. t['tsadidageshhebrew'] = 0xFB46;
  17896. t['tsadihebrew'] = 0x05E6;
  17897. t['tsecyrillic'] = 0x0446;
  17898. t['tsere'] = 0x05B5;
  17899. t['tsere12'] = 0x05B5;
  17900. t['tsere1e'] = 0x05B5;
  17901. t['tsere2b'] = 0x05B5;
  17902. t['tserehebrew'] = 0x05B5;
  17903. t['tserenarrowhebrew'] = 0x05B5;
  17904. t['tserequarterhebrew'] = 0x05B5;
  17905. t['tserewidehebrew'] = 0x05B5;
  17906. t['tshecyrillic'] = 0x045B;
  17907. t['tsuperior'] = 0xF6F3;
  17908. t['ttabengali'] = 0x099F;
  17909. t['ttadeva'] = 0x091F;
  17910. t['ttagujarati'] = 0x0A9F;
  17911. t['ttagurmukhi'] = 0x0A1F;
  17912. t['tteharabic'] = 0x0679;
  17913. t['ttehfinalarabic'] = 0xFB67;
  17914. t['ttehinitialarabic'] = 0xFB68;
  17915. t['ttehmedialarabic'] = 0xFB69;
  17916. t['tthabengali'] = 0x09A0;
  17917. t['tthadeva'] = 0x0920;
  17918. t['tthagujarati'] = 0x0AA0;
  17919. t['tthagurmukhi'] = 0x0A20;
  17920. t['tturned'] = 0x0287;
  17921. t['tuhiragana'] = 0x3064;
  17922. t['tukatakana'] = 0x30C4;
  17923. t['tukatakanahalfwidth'] = 0xFF82;
  17924. t['tusmallhiragana'] = 0x3063;
  17925. t['tusmallkatakana'] = 0x30C3;
  17926. t['tusmallkatakanahalfwidth'] = 0xFF6F;
  17927. t['twelvecircle'] = 0x246B;
  17928. t['twelveparen'] = 0x247F;
  17929. t['twelveperiod'] = 0x2493;
  17930. t['twelveroman'] = 0x217B;
  17931. t['twentycircle'] = 0x2473;
  17932. t['twentyhangzhou'] = 0x5344;
  17933. t['twentyparen'] = 0x2487;
  17934. t['twentyperiod'] = 0x249B;
  17935. t['two'] = 0x0032;
  17936. t['twoarabic'] = 0x0662;
  17937. t['twobengali'] = 0x09E8;
  17938. t['twocircle'] = 0x2461;
  17939. t['twocircleinversesansserif'] = 0x278B;
  17940. t['twodeva'] = 0x0968;
  17941. t['twodotenleader'] = 0x2025;
  17942. t['twodotleader'] = 0x2025;
  17943. t['twodotleadervertical'] = 0xFE30;
  17944. t['twogujarati'] = 0x0AE8;
  17945. t['twogurmukhi'] = 0x0A68;
  17946. t['twohackarabic'] = 0x0662;
  17947. t['twohangzhou'] = 0x3022;
  17948. t['twoideographicparen'] = 0x3221;
  17949. t['twoinferior'] = 0x2082;
  17950. t['twomonospace'] = 0xFF12;
  17951. t['twonumeratorbengali'] = 0x09F5;
  17952. t['twooldstyle'] = 0xF732;
  17953. t['twoparen'] = 0x2475;
  17954. t['twoperiod'] = 0x2489;
  17955. t['twopersian'] = 0x06F2;
  17956. t['tworoman'] = 0x2171;
  17957. t['twostroke'] = 0x01BB;
  17958. t['twosuperior'] = 0x00B2;
  17959. t['twothai'] = 0x0E52;
  17960. t['twothirds'] = 0x2154;
  17961. t['u'] = 0x0075;
  17962. t['uacute'] = 0x00FA;
  17963. t['ubar'] = 0x0289;
  17964. t['ubengali'] = 0x0989;
  17965. t['ubopomofo'] = 0x3128;
  17966. t['ubreve'] = 0x016D;
  17967. t['ucaron'] = 0x01D4;
  17968. t['ucircle'] = 0x24E4;
  17969. t['ucircumflex'] = 0x00FB;
  17970. t['ucircumflexbelow'] = 0x1E77;
  17971. t['ucyrillic'] = 0x0443;
  17972. t['udattadeva'] = 0x0951;
  17973. t['udblacute'] = 0x0171;
  17974. t['udblgrave'] = 0x0215;
  17975. t['udeva'] = 0x0909;
  17976. t['udieresis'] = 0x00FC;
  17977. t['udieresisacute'] = 0x01D8;
  17978. t['udieresisbelow'] = 0x1E73;
  17979. t['udieresiscaron'] = 0x01DA;
  17980. t['udieresiscyrillic'] = 0x04F1;
  17981. t['udieresisgrave'] = 0x01DC;
  17982. t['udieresismacron'] = 0x01D6;
  17983. t['udotbelow'] = 0x1EE5;
  17984. t['ugrave'] = 0x00F9;
  17985. t['ugujarati'] = 0x0A89;
  17986. t['ugurmukhi'] = 0x0A09;
  17987. t['uhiragana'] = 0x3046;
  17988. t['uhookabove'] = 0x1EE7;
  17989. t['uhorn'] = 0x01B0;
  17990. t['uhornacute'] = 0x1EE9;
  17991. t['uhorndotbelow'] = 0x1EF1;
  17992. t['uhorngrave'] = 0x1EEB;
  17993. t['uhornhookabove'] = 0x1EED;
  17994. t['uhorntilde'] = 0x1EEF;
  17995. t['uhungarumlaut'] = 0x0171;
  17996. t['uhungarumlautcyrillic'] = 0x04F3;
  17997. t['uinvertedbreve'] = 0x0217;
  17998. t['ukatakana'] = 0x30A6;
  17999. t['ukatakanahalfwidth'] = 0xFF73;
  18000. t['ukcyrillic'] = 0x0479;
  18001. t['ukorean'] = 0x315C;
  18002. t['umacron'] = 0x016B;
  18003. t['umacroncyrillic'] = 0x04EF;
  18004. t['umacrondieresis'] = 0x1E7B;
  18005. t['umatragurmukhi'] = 0x0A41;
  18006. t['umonospace'] = 0xFF55;
  18007. t['underscore'] = 0x005F;
  18008. t['underscoredbl'] = 0x2017;
  18009. t['underscoremonospace'] = 0xFF3F;
  18010. t['underscorevertical'] = 0xFE33;
  18011. t['underscorewavy'] = 0xFE4F;
  18012. t['union'] = 0x222A;
  18013. t['universal'] = 0x2200;
  18014. t['uogonek'] = 0x0173;
  18015. t['uparen'] = 0x24B0;
  18016. t['upblock'] = 0x2580;
  18017. t['upperdothebrew'] = 0x05C4;
  18018. t['upsilon'] = 0x03C5;
  18019. t['upsilondieresis'] = 0x03CB;
  18020. t['upsilondieresistonos'] = 0x03B0;
  18021. t['upsilonlatin'] = 0x028A;
  18022. t['upsilontonos'] = 0x03CD;
  18023. t['uptackbelowcmb'] = 0x031D;
  18024. t['uptackmod'] = 0x02D4;
  18025. t['uragurmukhi'] = 0x0A73;
  18026. t['uring'] = 0x016F;
  18027. t['ushortcyrillic'] = 0x045E;
  18028. t['usmallhiragana'] = 0x3045;
  18029. t['usmallkatakana'] = 0x30A5;
  18030. t['usmallkatakanahalfwidth'] = 0xFF69;
  18031. t['ustraightcyrillic'] = 0x04AF;
  18032. t['ustraightstrokecyrillic'] = 0x04B1;
  18033. t['utilde'] = 0x0169;
  18034. t['utildeacute'] = 0x1E79;
  18035. t['utildebelow'] = 0x1E75;
  18036. t['uubengali'] = 0x098A;
  18037. t['uudeva'] = 0x090A;
  18038. t['uugujarati'] = 0x0A8A;
  18039. t['uugurmukhi'] = 0x0A0A;
  18040. t['uumatragurmukhi'] = 0x0A42;
  18041. t['uuvowelsignbengali'] = 0x09C2;
  18042. t['uuvowelsigndeva'] = 0x0942;
  18043. t['uuvowelsigngujarati'] = 0x0AC2;
  18044. t['uvowelsignbengali'] = 0x09C1;
  18045. t['uvowelsigndeva'] = 0x0941;
  18046. t['uvowelsigngujarati'] = 0x0AC1;
  18047. t['v'] = 0x0076;
  18048. t['vadeva'] = 0x0935;
  18049. t['vagujarati'] = 0x0AB5;
  18050. t['vagurmukhi'] = 0x0A35;
  18051. t['vakatakana'] = 0x30F7;
  18052. t['vav'] = 0x05D5;
  18053. t['vavdagesh'] = 0xFB35;
  18054. t['vavdagesh65'] = 0xFB35;
  18055. t['vavdageshhebrew'] = 0xFB35;
  18056. t['vavhebrew'] = 0x05D5;
  18057. t['vavholam'] = 0xFB4B;
  18058. t['vavholamhebrew'] = 0xFB4B;
  18059. t['vavvavhebrew'] = 0x05F0;
  18060. t['vavyodhebrew'] = 0x05F1;
  18061. t['vcircle'] = 0x24E5;
  18062. t['vdotbelow'] = 0x1E7F;
  18063. t['vecyrillic'] = 0x0432;
  18064. t['veharabic'] = 0x06A4;
  18065. t['vehfinalarabic'] = 0xFB6B;
  18066. t['vehinitialarabic'] = 0xFB6C;
  18067. t['vehmedialarabic'] = 0xFB6D;
  18068. t['vekatakana'] = 0x30F9;
  18069. t['venus'] = 0x2640;
  18070. t['verticalbar'] = 0x007C;
  18071. t['verticallineabovecmb'] = 0x030D;
  18072. t['verticallinebelowcmb'] = 0x0329;
  18073. t['verticallinelowmod'] = 0x02CC;
  18074. t['verticallinemod'] = 0x02C8;
  18075. t['vewarmenian'] = 0x057E;
  18076. t['vhook'] = 0x028B;
  18077. t['vikatakana'] = 0x30F8;
  18078. t['viramabengali'] = 0x09CD;
  18079. t['viramadeva'] = 0x094D;
  18080. t['viramagujarati'] = 0x0ACD;
  18081. t['visargabengali'] = 0x0983;
  18082. t['visargadeva'] = 0x0903;
  18083. t['visargagujarati'] = 0x0A83;
  18084. t['vmonospace'] = 0xFF56;
  18085. t['voarmenian'] = 0x0578;
  18086. t['voicediterationhiragana'] = 0x309E;
  18087. t['voicediterationkatakana'] = 0x30FE;
  18088. t['voicedmarkkana'] = 0x309B;
  18089. t['voicedmarkkanahalfwidth'] = 0xFF9E;
  18090. t['vokatakana'] = 0x30FA;
  18091. t['vparen'] = 0x24B1;
  18092. t['vtilde'] = 0x1E7D;
  18093. t['vturned'] = 0x028C;
  18094. t['vuhiragana'] = 0x3094;
  18095. t['vukatakana'] = 0x30F4;
  18096. t['w'] = 0x0077;
  18097. t['wacute'] = 0x1E83;
  18098. t['waekorean'] = 0x3159;
  18099. t['wahiragana'] = 0x308F;
  18100. t['wakatakana'] = 0x30EF;
  18101. t['wakatakanahalfwidth'] = 0xFF9C;
  18102. t['wakorean'] = 0x3158;
  18103. t['wasmallhiragana'] = 0x308E;
  18104. t['wasmallkatakana'] = 0x30EE;
  18105. t['wattosquare'] = 0x3357;
  18106. t['wavedash'] = 0x301C;
  18107. t['wavyunderscorevertical'] = 0xFE34;
  18108. t['wawarabic'] = 0x0648;
  18109. t['wawfinalarabic'] = 0xFEEE;
  18110. t['wawhamzaabovearabic'] = 0x0624;
  18111. t['wawhamzaabovefinalarabic'] = 0xFE86;
  18112. t['wbsquare'] = 0x33DD;
  18113. t['wcircle'] = 0x24E6;
  18114. t['wcircumflex'] = 0x0175;
  18115. t['wdieresis'] = 0x1E85;
  18116. t['wdotaccent'] = 0x1E87;
  18117. t['wdotbelow'] = 0x1E89;
  18118. t['wehiragana'] = 0x3091;
  18119. t['weierstrass'] = 0x2118;
  18120. t['wekatakana'] = 0x30F1;
  18121. t['wekorean'] = 0x315E;
  18122. t['weokorean'] = 0x315D;
  18123. t['wgrave'] = 0x1E81;
  18124. t['whitebullet'] = 0x25E6;
  18125. t['whitecircle'] = 0x25CB;
  18126. t['whitecircleinverse'] = 0x25D9;
  18127. t['whitecornerbracketleft'] = 0x300E;
  18128. t['whitecornerbracketleftvertical'] = 0xFE43;
  18129. t['whitecornerbracketright'] = 0x300F;
  18130. t['whitecornerbracketrightvertical'] = 0xFE44;
  18131. t['whitediamond'] = 0x25C7;
  18132. t['whitediamondcontainingblacksmalldiamond'] = 0x25C8;
  18133. t['whitedownpointingsmalltriangle'] = 0x25BF;
  18134. t['whitedownpointingtriangle'] = 0x25BD;
  18135. t['whiteleftpointingsmalltriangle'] = 0x25C3;
  18136. t['whiteleftpointingtriangle'] = 0x25C1;
  18137. t['whitelenticularbracketleft'] = 0x3016;
  18138. t['whitelenticularbracketright'] = 0x3017;
  18139. t['whiterightpointingsmalltriangle'] = 0x25B9;
  18140. t['whiterightpointingtriangle'] = 0x25B7;
  18141. t['whitesmallsquare'] = 0x25AB;
  18142. t['whitesmilingface'] = 0x263A;
  18143. t['whitesquare'] = 0x25A1;
  18144. t['whitestar'] = 0x2606;
  18145. t['whitetelephone'] = 0x260F;
  18146. t['whitetortoiseshellbracketleft'] = 0x3018;
  18147. t['whitetortoiseshellbracketright'] = 0x3019;
  18148. t['whiteuppointingsmalltriangle'] = 0x25B5;
  18149. t['whiteuppointingtriangle'] = 0x25B3;
  18150. t['wihiragana'] = 0x3090;
  18151. t['wikatakana'] = 0x30F0;
  18152. t['wikorean'] = 0x315F;
  18153. t['wmonospace'] = 0xFF57;
  18154. t['wohiragana'] = 0x3092;
  18155. t['wokatakana'] = 0x30F2;
  18156. t['wokatakanahalfwidth'] = 0xFF66;
  18157. t['won'] = 0x20A9;
  18158. t['wonmonospace'] = 0xFFE6;
  18159. t['wowaenthai'] = 0x0E27;
  18160. t['wparen'] = 0x24B2;
  18161. t['wring'] = 0x1E98;
  18162. t['wsuperior'] = 0x02B7;
  18163. t['wturned'] = 0x028D;
  18164. t['wynn'] = 0x01BF;
  18165. t['x'] = 0x0078;
  18166. t['xabovecmb'] = 0x033D;
  18167. t['xbopomofo'] = 0x3112;
  18168. t['xcircle'] = 0x24E7;
  18169. t['xdieresis'] = 0x1E8D;
  18170. t['xdotaccent'] = 0x1E8B;
  18171. t['xeharmenian'] = 0x056D;
  18172. t['xi'] = 0x03BE;
  18173. t['xmonospace'] = 0xFF58;
  18174. t['xparen'] = 0x24B3;
  18175. t['xsuperior'] = 0x02E3;
  18176. t['y'] = 0x0079;
  18177. t['yaadosquare'] = 0x334E;
  18178. t['yabengali'] = 0x09AF;
  18179. t['yacute'] = 0x00FD;
  18180. t['yadeva'] = 0x092F;
  18181. t['yaekorean'] = 0x3152;
  18182. t['yagujarati'] = 0x0AAF;
  18183. t['yagurmukhi'] = 0x0A2F;
  18184. t['yahiragana'] = 0x3084;
  18185. t['yakatakana'] = 0x30E4;
  18186. t['yakatakanahalfwidth'] = 0xFF94;
  18187. t['yakorean'] = 0x3151;
  18188. t['yamakkanthai'] = 0x0E4E;
  18189. t['yasmallhiragana'] = 0x3083;
  18190. t['yasmallkatakana'] = 0x30E3;
  18191. t['yasmallkatakanahalfwidth'] = 0xFF6C;
  18192. t['yatcyrillic'] = 0x0463;
  18193. t['ycircle'] = 0x24E8;
  18194. t['ycircumflex'] = 0x0177;
  18195. t['ydieresis'] = 0x00FF;
  18196. t['ydotaccent'] = 0x1E8F;
  18197. t['ydotbelow'] = 0x1EF5;
  18198. t['yeharabic'] = 0x064A;
  18199. t['yehbarreearabic'] = 0x06D2;
  18200. t['yehbarreefinalarabic'] = 0xFBAF;
  18201. t['yehfinalarabic'] = 0xFEF2;
  18202. t['yehhamzaabovearabic'] = 0x0626;
  18203. t['yehhamzaabovefinalarabic'] = 0xFE8A;
  18204. t['yehhamzaaboveinitialarabic'] = 0xFE8B;
  18205. t['yehhamzaabovemedialarabic'] = 0xFE8C;
  18206. t['yehinitialarabic'] = 0xFEF3;
  18207. t['yehmedialarabic'] = 0xFEF4;
  18208. t['yehmeeminitialarabic'] = 0xFCDD;
  18209. t['yehmeemisolatedarabic'] = 0xFC58;
  18210. t['yehnoonfinalarabic'] = 0xFC94;
  18211. t['yehthreedotsbelowarabic'] = 0x06D1;
  18212. t['yekorean'] = 0x3156;
  18213. t['yen'] = 0x00A5;
  18214. t['yenmonospace'] = 0xFFE5;
  18215. t['yeokorean'] = 0x3155;
  18216. t['yeorinhieuhkorean'] = 0x3186;
  18217. t['yerahbenyomohebrew'] = 0x05AA;
  18218. t['yerahbenyomolefthebrew'] = 0x05AA;
  18219. t['yericyrillic'] = 0x044B;
  18220. t['yerudieresiscyrillic'] = 0x04F9;
  18221. t['yesieungkorean'] = 0x3181;
  18222. t['yesieungpansioskorean'] = 0x3183;
  18223. t['yesieungsioskorean'] = 0x3182;
  18224. t['yetivhebrew'] = 0x059A;
  18225. t['ygrave'] = 0x1EF3;
  18226. t['yhook'] = 0x01B4;
  18227. t['yhookabove'] = 0x1EF7;
  18228. t['yiarmenian'] = 0x0575;
  18229. t['yicyrillic'] = 0x0457;
  18230. t['yikorean'] = 0x3162;
  18231. t['yinyang'] = 0x262F;
  18232. t['yiwnarmenian'] = 0x0582;
  18233. t['ymonospace'] = 0xFF59;
  18234. t['yod'] = 0x05D9;
  18235. t['yoddagesh'] = 0xFB39;
  18236. t['yoddageshhebrew'] = 0xFB39;
  18237. t['yodhebrew'] = 0x05D9;
  18238. t['yodyodhebrew'] = 0x05F2;
  18239. t['yodyodpatahhebrew'] = 0xFB1F;
  18240. t['yohiragana'] = 0x3088;
  18241. t['yoikorean'] = 0x3189;
  18242. t['yokatakana'] = 0x30E8;
  18243. t['yokatakanahalfwidth'] = 0xFF96;
  18244. t['yokorean'] = 0x315B;
  18245. t['yosmallhiragana'] = 0x3087;
  18246. t['yosmallkatakana'] = 0x30E7;
  18247. t['yosmallkatakanahalfwidth'] = 0xFF6E;
  18248. t['yotgreek'] = 0x03F3;
  18249. t['yoyaekorean'] = 0x3188;
  18250. t['yoyakorean'] = 0x3187;
  18251. t['yoyakthai'] = 0x0E22;
  18252. t['yoyingthai'] = 0x0E0D;
  18253. t['yparen'] = 0x24B4;
  18254. t['ypogegrammeni'] = 0x037A;
  18255. t['ypogegrammenigreekcmb'] = 0x0345;
  18256. t['yr'] = 0x01A6;
  18257. t['yring'] = 0x1E99;
  18258. t['ysuperior'] = 0x02B8;
  18259. t['ytilde'] = 0x1EF9;
  18260. t['yturned'] = 0x028E;
  18261. t['yuhiragana'] = 0x3086;
  18262. t['yuikorean'] = 0x318C;
  18263. t['yukatakana'] = 0x30E6;
  18264. t['yukatakanahalfwidth'] = 0xFF95;
  18265. t['yukorean'] = 0x3160;
  18266. t['yusbigcyrillic'] = 0x046B;
  18267. t['yusbigiotifiedcyrillic'] = 0x046D;
  18268. t['yuslittlecyrillic'] = 0x0467;
  18269. t['yuslittleiotifiedcyrillic'] = 0x0469;
  18270. t['yusmallhiragana'] = 0x3085;
  18271. t['yusmallkatakana'] = 0x30E5;
  18272. t['yusmallkatakanahalfwidth'] = 0xFF6D;
  18273. t['yuyekorean'] = 0x318B;
  18274. t['yuyeokorean'] = 0x318A;
  18275. t['yyabengali'] = 0x09DF;
  18276. t['yyadeva'] = 0x095F;
  18277. t['z'] = 0x007A;
  18278. t['zaarmenian'] = 0x0566;
  18279. t['zacute'] = 0x017A;
  18280. t['zadeva'] = 0x095B;
  18281. t['zagurmukhi'] = 0x0A5B;
  18282. t['zaharabic'] = 0x0638;
  18283. t['zahfinalarabic'] = 0xFEC6;
  18284. t['zahinitialarabic'] = 0xFEC7;
  18285. t['zahiragana'] = 0x3056;
  18286. t['zahmedialarabic'] = 0xFEC8;
  18287. t['zainarabic'] = 0x0632;
  18288. t['zainfinalarabic'] = 0xFEB0;
  18289. t['zakatakana'] = 0x30B6;
  18290. t['zaqefgadolhebrew'] = 0x0595;
  18291. t['zaqefqatanhebrew'] = 0x0594;
  18292. t['zarqahebrew'] = 0x0598;
  18293. t['zayin'] = 0x05D6;
  18294. t['zayindagesh'] = 0xFB36;
  18295. t['zayindageshhebrew'] = 0xFB36;
  18296. t['zayinhebrew'] = 0x05D6;
  18297. t['zbopomofo'] = 0x3117;
  18298. t['zcaron'] = 0x017E;
  18299. t['zcircle'] = 0x24E9;
  18300. t['zcircumflex'] = 0x1E91;
  18301. t['zcurl'] = 0x0291;
  18302. t['zdot'] = 0x017C;
  18303. t['zdotaccent'] = 0x017C;
  18304. t['zdotbelow'] = 0x1E93;
  18305. t['zecyrillic'] = 0x0437;
  18306. t['zedescendercyrillic'] = 0x0499;
  18307. t['zedieresiscyrillic'] = 0x04DF;
  18308. t['zehiragana'] = 0x305C;
  18309. t['zekatakana'] = 0x30BC;
  18310. t['zero'] = 0x0030;
  18311. t['zeroarabic'] = 0x0660;
  18312. t['zerobengali'] = 0x09E6;
  18313. t['zerodeva'] = 0x0966;
  18314. t['zerogujarati'] = 0x0AE6;
  18315. t['zerogurmukhi'] = 0x0A66;
  18316. t['zerohackarabic'] = 0x0660;
  18317. t['zeroinferior'] = 0x2080;
  18318. t['zeromonospace'] = 0xFF10;
  18319. t['zerooldstyle'] = 0xF730;
  18320. t['zeropersian'] = 0x06F0;
  18321. t['zerosuperior'] = 0x2070;
  18322. t['zerothai'] = 0x0E50;
  18323. t['zerowidthjoiner'] = 0xFEFF;
  18324. t['zerowidthnonjoiner'] = 0x200C;
  18325. t['zerowidthspace'] = 0x200B;
  18326. t['zeta'] = 0x03B6;
  18327. t['zhbopomofo'] = 0x3113;
  18328. t['zhearmenian'] = 0x056A;
  18329. t['zhebrevecyrillic'] = 0x04C2;
  18330. t['zhecyrillic'] = 0x0436;
  18331. t['zhedescendercyrillic'] = 0x0497;
  18332. t['zhedieresiscyrillic'] = 0x04DD;
  18333. t['zihiragana'] = 0x3058;
  18334. t['zikatakana'] = 0x30B8;
  18335. t['zinorhebrew'] = 0x05AE;
  18336. t['zlinebelow'] = 0x1E95;
  18337. t['zmonospace'] = 0xFF5A;
  18338. t['zohiragana'] = 0x305E;
  18339. t['zokatakana'] = 0x30BE;
  18340. t['zparen'] = 0x24B5;
  18341. t['zretroflexhook'] = 0x0290;
  18342. t['zstroke'] = 0x01B6;
  18343. t['zuhiragana'] = 0x305A;
  18344. t['zukatakana'] = 0x30BA;
  18345. t['.notdef'] = 0x0000;
  18346. t['angbracketleftbig'] = 0x2329;
  18347. t['angbracketleftBig'] = 0x2329;
  18348. t['angbracketleftbigg'] = 0x2329;
  18349. t['angbracketleftBigg'] = 0x2329;
  18350. t['angbracketrightBig'] = 0x232A;
  18351. t['angbracketrightbig'] = 0x232A;
  18352. t['angbracketrightBigg'] = 0x232A;
  18353. t['angbracketrightbigg'] = 0x232A;
  18354. t['arrowhookleft'] = 0x21AA;
  18355. t['arrowhookright'] = 0x21A9;
  18356. t['arrowlefttophalf'] = 0x21BC;
  18357. t['arrowleftbothalf'] = 0x21BD;
  18358. t['arrownortheast'] = 0x2197;
  18359. t['arrownorthwest'] = 0x2196;
  18360. t['arrowrighttophalf'] = 0x21C0;
  18361. t['arrowrightbothalf'] = 0x21C1;
  18362. t['arrowsoutheast'] = 0x2198;
  18363. t['arrowsouthwest'] = 0x2199;
  18364. t['backslashbig'] = 0x2216;
  18365. t['backslashBig'] = 0x2216;
  18366. t['backslashBigg'] = 0x2216;
  18367. t['backslashbigg'] = 0x2216;
  18368. t['bardbl'] = 0x2016;
  18369. t['bracehtipdownleft'] = 0xFE37;
  18370. t['bracehtipdownright'] = 0xFE37;
  18371. t['bracehtipupleft'] = 0xFE38;
  18372. t['bracehtipupright'] = 0xFE38;
  18373. t['braceleftBig'] = 0x007B;
  18374. t['braceleftbig'] = 0x007B;
  18375. t['braceleftbigg'] = 0x007B;
  18376. t['braceleftBigg'] = 0x007B;
  18377. t['bracerightBig'] = 0x007D;
  18378. t['bracerightbig'] = 0x007D;
  18379. t['bracerightbigg'] = 0x007D;
  18380. t['bracerightBigg'] = 0x007D;
  18381. t['bracketleftbig'] = 0x005B;
  18382. t['bracketleftBig'] = 0x005B;
  18383. t['bracketleftbigg'] = 0x005B;
  18384. t['bracketleftBigg'] = 0x005B;
  18385. t['bracketrightBig'] = 0x005D;
  18386. t['bracketrightbig'] = 0x005D;
  18387. t['bracketrightbigg'] = 0x005D;
  18388. t['bracketrightBigg'] = 0x005D;
  18389. t['ceilingleftbig'] = 0x2308;
  18390. t['ceilingleftBig'] = 0x2308;
  18391. t['ceilingleftBigg'] = 0x2308;
  18392. t['ceilingleftbigg'] = 0x2308;
  18393. t['ceilingrightbig'] = 0x2309;
  18394. t['ceilingrightBig'] = 0x2309;
  18395. t['ceilingrightbigg'] = 0x2309;
  18396. t['ceilingrightBigg'] = 0x2309;
  18397. t['circledotdisplay'] = 0x2299;
  18398. t['circledottext'] = 0x2299;
  18399. t['circlemultiplydisplay'] = 0x2297;
  18400. t['circlemultiplytext'] = 0x2297;
  18401. t['circleplusdisplay'] = 0x2295;
  18402. t['circleplustext'] = 0x2295;
  18403. t['contintegraldisplay'] = 0x222E;
  18404. t['contintegraltext'] = 0x222E;
  18405. t['coproductdisplay'] = 0x2210;
  18406. t['coproducttext'] = 0x2210;
  18407. t['floorleftBig'] = 0x230A;
  18408. t['floorleftbig'] = 0x230A;
  18409. t['floorleftbigg'] = 0x230A;
  18410. t['floorleftBigg'] = 0x230A;
  18411. t['floorrightbig'] = 0x230B;
  18412. t['floorrightBig'] = 0x230B;
  18413. t['floorrightBigg'] = 0x230B;
  18414. t['floorrightbigg'] = 0x230B;
  18415. t['hatwide'] = 0x0302;
  18416. t['hatwider'] = 0x0302;
  18417. t['hatwidest'] = 0x0302;
  18418. t['intercal'] = 0x1D40;
  18419. t['integraldisplay'] = 0x222B;
  18420. t['integraltext'] = 0x222B;
  18421. t['intersectiondisplay'] = 0x22C2;
  18422. t['intersectiontext'] = 0x22C2;
  18423. t['logicalanddisplay'] = 0x2227;
  18424. t['logicalandtext'] = 0x2227;
  18425. t['logicalordisplay'] = 0x2228;
  18426. t['logicalortext'] = 0x2228;
  18427. t['parenleftBig'] = 0x0028;
  18428. t['parenleftbig'] = 0x0028;
  18429. t['parenleftBigg'] = 0x0028;
  18430. t['parenleftbigg'] = 0x0028;
  18431. t['parenrightBig'] = 0x0029;
  18432. t['parenrightbig'] = 0x0029;
  18433. t['parenrightBigg'] = 0x0029;
  18434. t['parenrightbigg'] = 0x0029;
  18435. t['prime'] = 0x2032;
  18436. t['productdisplay'] = 0x220F;
  18437. t['producttext'] = 0x220F;
  18438. t['radicalbig'] = 0x221A;
  18439. t['radicalBig'] = 0x221A;
  18440. t['radicalBigg'] = 0x221A;
  18441. t['radicalbigg'] = 0x221A;
  18442. t['radicalbt'] = 0x221A;
  18443. t['radicaltp'] = 0x221A;
  18444. t['radicalvertex'] = 0x221A;
  18445. t['slashbig'] = 0x002F;
  18446. t['slashBig'] = 0x002F;
  18447. t['slashBigg'] = 0x002F;
  18448. t['slashbigg'] = 0x002F;
  18449. t['summationdisplay'] = 0x2211;
  18450. t['summationtext'] = 0x2211;
  18451. t['tildewide'] = 0x02DC;
  18452. t['tildewider'] = 0x02DC;
  18453. t['tildewidest'] = 0x02DC;
  18454. t['uniondisplay'] = 0x22C3;
  18455. t['unionmultidisplay'] = 0x228E;
  18456. t['unionmultitext'] = 0x228E;
  18457. t['unionsqdisplay'] = 0x2294;
  18458. t['unionsqtext'] = 0x2294;
  18459. t['uniontext'] = 0x22C3;
  18460. t['vextenddouble'] = 0x2225;
  18461. t['vextendsingle'] = 0x2223;
  18462. });
  18463. var getDingbatsGlyphsUnicode = getLookupTableFactory(function (t) {
  18464. t['space'] = 0x0020;
  18465. t['a1'] = 0x2701;
  18466. t['a2'] = 0x2702;
  18467. t['a202'] = 0x2703;
  18468. t['a3'] = 0x2704;
  18469. t['a4'] = 0x260E;
  18470. t['a5'] = 0x2706;
  18471. t['a119'] = 0x2707;
  18472. t['a118'] = 0x2708;
  18473. t['a117'] = 0x2709;
  18474. t['a11'] = 0x261B;
  18475. t['a12'] = 0x261E;
  18476. t['a13'] = 0x270C;
  18477. t['a14'] = 0x270D;
  18478. t['a15'] = 0x270E;
  18479. t['a16'] = 0x270F;
  18480. t['a105'] = 0x2710;
  18481. t['a17'] = 0x2711;
  18482. t['a18'] = 0x2712;
  18483. t['a19'] = 0x2713;
  18484. t['a20'] = 0x2714;
  18485. t['a21'] = 0x2715;
  18486. t['a22'] = 0x2716;
  18487. t['a23'] = 0x2717;
  18488. t['a24'] = 0x2718;
  18489. t['a25'] = 0x2719;
  18490. t['a26'] = 0x271A;
  18491. t['a27'] = 0x271B;
  18492. t['a28'] = 0x271C;
  18493. t['a6'] = 0x271D;
  18494. t['a7'] = 0x271E;
  18495. t['a8'] = 0x271F;
  18496. t['a9'] = 0x2720;
  18497. t['a10'] = 0x2721;
  18498. t['a29'] = 0x2722;
  18499. t['a30'] = 0x2723;
  18500. t['a31'] = 0x2724;
  18501. t['a32'] = 0x2725;
  18502. t['a33'] = 0x2726;
  18503. t['a34'] = 0x2727;
  18504. t['a35'] = 0x2605;
  18505. t['a36'] = 0x2729;
  18506. t['a37'] = 0x272A;
  18507. t['a38'] = 0x272B;
  18508. t['a39'] = 0x272C;
  18509. t['a40'] = 0x272D;
  18510. t['a41'] = 0x272E;
  18511. t['a42'] = 0x272F;
  18512. t['a43'] = 0x2730;
  18513. t['a44'] = 0x2731;
  18514. t['a45'] = 0x2732;
  18515. t['a46'] = 0x2733;
  18516. t['a47'] = 0x2734;
  18517. t['a48'] = 0x2735;
  18518. t['a49'] = 0x2736;
  18519. t['a50'] = 0x2737;
  18520. t['a51'] = 0x2738;
  18521. t['a52'] = 0x2739;
  18522. t['a53'] = 0x273A;
  18523. t['a54'] = 0x273B;
  18524. t['a55'] = 0x273C;
  18525. t['a56'] = 0x273D;
  18526. t['a57'] = 0x273E;
  18527. t['a58'] = 0x273F;
  18528. t['a59'] = 0x2740;
  18529. t['a60'] = 0x2741;
  18530. t['a61'] = 0x2742;
  18531. t['a62'] = 0x2743;
  18532. t['a63'] = 0x2744;
  18533. t['a64'] = 0x2745;
  18534. t['a65'] = 0x2746;
  18535. t['a66'] = 0x2747;
  18536. t['a67'] = 0x2748;
  18537. t['a68'] = 0x2749;
  18538. t['a69'] = 0x274A;
  18539. t['a70'] = 0x274B;
  18540. t['a71'] = 0x25CF;
  18541. t['a72'] = 0x274D;
  18542. t['a73'] = 0x25A0;
  18543. t['a74'] = 0x274F;
  18544. t['a203'] = 0x2750;
  18545. t['a75'] = 0x2751;
  18546. t['a204'] = 0x2752;
  18547. t['a76'] = 0x25B2;
  18548. t['a77'] = 0x25BC;
  18549. t['a78'] = 0x25C6;
  18550. t['a79'] = 0x2756;
  18551. t['a81'] = 0x25D7;
  18552. t['a82'] = 0x2758;
  18553. t['a83'] = 0x2759;
  18554. t['a84'] = 0x275A;
  18555. t['a97'] = 0x275B;
  18556. t['a98'] = 0x275C;
  18557. t['a99'] = 0x275D;
  18558. t['a100'] = 0x275E;
  18559. t['a101'] = 0x2761;
  18560. t['a102'] = 0x2762;
  18561. t['a103'] = 0x2763;
  18562. t['a104'] = 0x2764;
  18563. t['a106'] = 0x2765;
  18564. t['a107'] = 0x2766;
  18565. t['a108'] = 0x2767;
  18566. t['a112'] = 0x2663;
  18567. t['a111'] = 0x2666;
  18568. t['a110'] = 0x2665;
  18569. t['a109'] = 0x2660;
  18570. t['a120'] = 0x2460;
  18571. t['a121'] = 0x2461;
  18572. t['a122'] = 0x2462;
  18573. t['a123'] = 0x2463;
  18574. t['a124'] = 0x2464;
  18575. t['a125'] = 0x2465;
  18576. t['a126'] = 0x2466;
  18577. t['a127'] = 0x2467;
  18578. t['a128'] = 0x2468;
  18579. t['a129'] = 0x2469;
  18580. t['a130'] = 0x2776;
  18581. t['a131'] = 0x2777;
  18582. t['a132'] = 0x2778;
  18583. t['a133'] = 0x2779;
  18584. t['a134'] = 0x277A;
  18585. t['a135'] = 0x277B;
  18586. t['a136'] = 0x277C;
  18587. t['a137'] = 0x277D;
  18588. t['a138'] = 0x277E;
  18589. t['a139'] = 0x277F;
  18590. t['a140'] = 0x2780;
  18591. t['a141'] = 0x2781;
  18592. t['a142'] = 0x2782;
  18593. t['a143'] = 0x2783;
  18594. t['a144'] = 0x2784;
  18595. t['a145'] = 0x2785;
  18596. t['a146'] = 0x2786;
  18597. t['a147'] = 0x2787;
  18598. t['a148'] = 0x2788;
  18599. t['a149'] = 0x2789;
  18600. t['a150'] = 0x278A;
  18601. t['a151'] = 0x278B;
  18602. t['a152'] = 0x278C;
  18603. t['a153'] = 0x278D;
  18604. t['a154'] = 0x278E;
  18605. t['a155'] = 0x278F;
  18606. t['a156'] = 0x2790;
  18607. t['a157'] = 0x2791;
  18608. t['a158'] = 0x2792;
  18609. t['a159'] = 0x2793;
  18610. t['a160'] = 0x2794;
  18611. t['a161'] = 0x2192;
  18612. t['a163'] = 0x2194;
  18613. t['a164'] = 0x2195;
  18614. t['a196'] = 0x2798;
  18615. t['a165'] = 0x2799;
  18616. t['a192'] = 0x279A;
  18617. t['a166'] = 0x279B;
  18618. t['a167'] = 0x279C;
  18619. t['a168'] = 0x279D;
  18620. t['a169'] = 0x279E;
  18621. t['a170'] = 0x279F;
  18622. t['a171'] = 0x27A0;
  18623. t['a172'] = 0x27A1;
  18624. t['a173'] = 0x27A2;
  18625. t['a162'] = 0x27A3;
  18626. t['a174'] = 0x27A4;
  18627. t['a175'] = 0x27A5;
  18628. t['a176'] = 0x27A6;
  18629. t['a177'] = 0x27A7;
  18630. t['a178'] = 0x27A8;
  18631. t['a179'] = 0x27A9;
  18632. t['a193'] = 0x27AA;
  18633. t['a180'] = 0x27AB;
  18634. t['a199'] = 0x27AC;
  18635. t['a181'] = 0x27AD;
  18636. t['a200'] = 0x27AE;
  18637. t['a182'] = 0x27AF;
  18638. t['a201'] = 0x27B1;
  18639. t['a183'] = 0x27B2;
  18640. t['a184'] = 0x27B3;
  18641. t['a197'] = 0x27B4;
  18642. t['a185'] = 0x27B5;
  18643. t['a194'] = 0x27B6;
  18644. t['a198'] = 0x27B7;
  18645. t['a186'] = 0x27B8;
  18646. t['a195'] = 0x27B9;
  18647. t['a187'] = 0x27BA;
  18648. t['a188'] = 0x27BB;
  18649. t['a189'] = 0x27BC;
  18650. t['a190'] = 0x27BD;
  18651. t['a191'] = 0x27BE;
  18652. t['a89'] = 0x2768;
  18653. t['a90'] = 0x2769;
  18654. t['a93'] = 0x276A;
  18655. t['a94'] = 0x276B;
  18656. t['a91'] = 0x276C;
  18657. t['a92'] = 0x276D;
  18658. t['a205'] = 0x276E;
  18659. t['a85'] = 0x276F;
  18660. t['a206'] = 0x2770;
  18661. t['a86'] = 0x2771;
  18662. t['a87'] = 0x2772;
  18663. t['a88'] = 0x2773;
  18664. t['a95'] = 0x2774;
  18665. t['a96'] = 0x2775;
  18666. t['.notdef'] = 0x0000;
  18667. });
  18668. exports.getGlyphsUnicode = getGlyphsUnicode;
  18669. exports.getDingbatsGlyphsUnicode = getDingbatsGlyphsUnicode;
  18670. /***/ }),
  18671. /* 8 */
  18672. /***/ (function(module, exports, __w_pdfjs_require__) {
  18673. "use strict";
  18674. /* WEBPACK VAR INJECTION */(function(module) {
  18675. var sharedUtil = __w_pdfjs_require__(0);
  18676. var corePrimitives = __w_pdfjs_require__(1);
  18677. var corePdfManager = __w_pdfjs_require__(34);
  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. if (typeof window === 'undefined' && !(typeof module !== 'undefined' && module.require)) {
  19390. initializeWorker();
  19391. }
  19392. exports.setPDFNetworkStreamClass = setPDFNetworkStreamClass;
  19393. exports.WorkerTask = WorkerTask;
  19394. exports.WorkerMessageHandler = WorkerMessageHandler;
  19395. /* WEBPACK VAR INJECTION */}.call(exports, __w_pdfjs_require__(20)(module)))
  19396. /***/ }),
  19397. /* 9 */
  19398. /***/ (function(module, exports, __w_pdfjs_require__) {
  19399. "use strict";
  19400. var ArithmeticDecoder = function ArithmeticDecoderClosure() {
  19401. var QeTable = [
  19402. {
  19403. qe: 0x5601,
  19404. nmps: 1,
  19405. nlps: 1,
  19406. switchFlag: 1
  19407. },
  19408. {
  19409. qe: 0x3401,
  19410. nmps: 2,
  19411. nlps: 6,
  19412. switchFlag: 0
  19413. },
  19414. {
  19415. qe: 0x1801,
  19416. nmps: 3,
  19417. nlps: 9,
  19418. switchFlag: 0
  19419. },
  19420. {
  19421. qe: 0x0AC1,
  19422. nmps: 4,
  19423. nlps: 12,
  19424. switchFlag: 0
  19425. },
  19426. {
  19427. qe: 0x0521,
  19428. nmps: 5,
  19429. nlps: 29,
  19430. switchFlag: 0
  19431. },
  19432. {
  19433. qe: 0x0221,
  19434. nmps: 38,
  19435. nlps: 33,
  19436. switchFlag: 0
  19437. },
  19438. {
  19439. qe: 0x5601,
  19440. nmps: 7,
  19441. nlps: 6,
  19442. switchFlag: 1
  19443. },
  19444. {
  19445. qe: 0x5401,
  19446. nmps: 8,
  19447. nlps: 14,
  19448. switchFlag: 0
  19449. },
  19450. {
  19451. qe: 0x4801,
  19452. nmps: 9,
  19453. nlps: 14,
  19454. switchFlag: 0
  19455. },
  19456. {
  19457. qe: 0x3801,
  19458. nmps: 10,
  19459. nlps: 14,
  19460. switchFlag: 0
  19461. },
  19462. {
  19463. qe: 0x3001,
  19464. nmps: 11,
  19465. nlps: 17,
  19466. switchFlag: 0
  19467. },
  19468. {
  19469. qe: 0x2401,
  19470. nmps: 12,
  19471. nlps: 18,
  19472. switchFlag: 0
  19473. },
  19474. {
  19475. qe: 0x1C01,
  19476. nmps: 13,
  19477. nlps: 20,
  19478. switchFlag: 0
  19479. },
  19480. {
  19481. qe: 0x1601,
  19482. nmps: 29,
  19483. nlps: 21,
  19484. switchFlag: 0
  19485. },
  19486. {
  19487. qe: 0x5601,
  19488. nmps: 15,
  19489. nlps: 14,
  19490. switchFlag: 1
  19491. },
  19492. {
  19493. qe: 0x5401,
  19494. nmps: 16,
  19495. nlps: 14,
  19496. switchFlag: 0
  19497. },
  19498. {
  19499. qe: 0x5101,
  19500. nmps: 17,
  19501. nlps: 15,
  19502. switchFlag: 0
  19503. },
  19504. {
  19505. qe: 0x4801,
  19506. nmps: 18,
  19507. nlps: 16,
  19508. switchFlag: 0
  19509. },
  19510. {
  19511. qe: 0x3801,
  19512. nmps: 19,
  19513. nlps: 17,
  19514. switchFlag: 0
  19515. },
  19516. {
  19517. qe: 0x3401,
  19518. nmps: 20,
  19519. nlps: 18,
  19520. switchFlag: 0
  19521. },
  19522. {
  19523. qe: 0x3001,
  19524. nmps: 21,
  19525. nlps: 19,
  19526. switchFlag: 0
  19527. },
  19528. {
  19529. qe: 0x2801,
  19530. nmps: 22,
  19531. nlps: 19,
  19532. switchFlag: 0
  19533. },
  19534. {
  19535. qe: 0x2401,
  19536. nmps: 23,
  19537. nlps: 20,
  19538. switchFlag: 0
  19539. },
  19540. {
  19541. qe: 0x2201,
  19542. nmps: 24,
  19543. nlps: 21,
  19544. switchFlag: 0
  19545. },
  19546. {
  19547. qe: 0x1C01,
  19548. nmps: 25,
  19549. nlps: 22,
  19550. switchFlag: 0
  19551. },
  19552. {
  19553. qe: 0x1801,
  19554. nmps: 26,
  19555. nlps: 23,
  19556. switchFlag: 0
  19557. },
  19558. {
  19559. qe: 0x1601,
  19560. nmps: 27,
  19561. nlps: 24,
  19562. switchFlag: 0
  19563. },
  19564. {
  19565. qe: 0x1401,
  19566. nmps: 28,
  19567. nlps: 25,
  19568. switchFlag: 0
  19569. },
  19570. {
  19571. qe: 0x1201,
  19572. nmps: 29,
  19573. nlps: 26,
  19574. switchFlag: 0
  19575. },
  19576. {
  19577. qe: 0x1101,
  19578. nmps: 30,
  19579. nlps: 27,
  19580. switchFlag: 0
  19581. },
  19582. {
  19583. qe: 0x0AC1,
  19584. nmps: 31,
  19585. nlps: 28,
  19586. switchFlag: 0
  19587. },
  19588. {
  19589. qe: 0x09C1,
  19590. nmps: 32,
  19591. nlps: 29,
  19592. switchFlag: 0
  19593. },
  19594. {
  19595. qe: 0x08A1,
  19596. nmps: 33,
  19597. nlps: 30,
  19598. switchFlag: 0
  19599. },
  19600. {
  19601. qe: 0x0521,
  19602. nmps: 34,
  19603. nlps: 31,
  19604. switchFlag: 0
  19605. },
  19606. {
  19607. qe: 0x0441,
  19608. nmps: 35,
  19609. nlps: 32,
  19610. switchFlag: 0
  19611. },
  19612. {
  19613. qe: 0x02A1,
  19614. nmps: 36,
  19615. nlps: 33,
  19616. switchFlag: 0
  19617. },
  19618. {
  19619. qe: 0x0221,
  19620. nmps: 37,
  19621. nlps: 34,
  19622. switchFlag: 0
  19623. },
  19624. {
  19625. qe: 0x0141,
  19626. nmps: 38,
  19627. nlps: 35,
  19628. switchFlag: 0
  19629. },
  19630. {
  19631. qe: 0x0111,
  19632. nmps: 39,
  19633. nlps: 36,
  19634. switchFlag: 0
  19635. },
  19636. {
  19637. qe: 0x0085,
  19638. nmps: 40,
  19639. nlps: 37,
  19640. switchFlag: 0
  19641. },
  19642. {
  19643. qe: 0x0049,
  19644. nmps: 41,
  19645. nlps: 38,
  19646. switchFlag: 0
  19647. },
  19648. {
  19649. qe: 0x0025,
  19650. nmps: 42,
  19651. nlps: 39,
  19652. switchFlag: 0
  19653. },
  19654. {
  19655. qe: 0x0015,
  19656. nmps: 43,
  19657. nlps: 40,
  19658. switchFlag: 0
  19659. },
  19660. {
  19661. qe: 0x0009,
  19662. nmps: 44,
  19663. nlps: 41,
  19664. switchFlag: 0
  19665. },
  19666. {
  19667. qe: 0x0005,
  19668. nmps: 45,
  19669. nlps: 42,
  19670. switchFlag: 0
  19671. },
  19672. {
  19673. qe: 0x0001,
  19674. nmps: 45,
  19675. nlps: 43,
  19676. switchFlag: 0
  19677. },
  19678. {
  19679. qe: 0x5601,
  19680. nmps: 46,
  19681. nlps: 46,
  19682. switchFlag: 0
  19683. }
  19684. ];
  19685. function ArithmeticDecoder(data, start, end) {
  19686. this.data = data;
  19687. this.bp = start;
  19688. this.dataEnd = end;
  19689. this.chigh = data[start];
  19690. this.clow = 0;
  19691. this.byteIn();
  19692. this.chigh = this.chigh << 7 & 0xFFFF | this.clow >> 9 & 0x7F;
  19693. this.clow = this.clow << 7 & 0xFFFF;
  19694. this.ct -= 7;
  19695. this.a = 0x8000;
  19696. }
  19697. ArithmeticDecoder.prototype = {
  19698. byteIn: function ArithmeticDecoder_byteIn() {
  19699. var data = this.data;
  19700. var bp = this.bp;
  19701. if (data[bp] === 0xFF) {
  19702. var b1 = data[bp + 1];
  19703. if (b1 > 0x8F) {
  19704. this.clow += 0xFF00;
  19705. this.ct = 8;
  19706. } else {
  19707. bp++;
  19708. this.clow += data[bp] << 9;
  19709. this.ct = 7;
  19710. this.bp = bp;
  19711. }
  19712. } else {
  19713. bp++;
  19714. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xFF00;
  19715. this.ct = 8;
  19716. this.bp = bp;
  19717. }
  19718. if (this.clow > 0xFFFF) {
  19719. this.chigh += this.clow >> 16;
  19720. this.clow &= 0xFFFF;
  19721. }
  19722. },
  19723. readBit: function ArithmeticDecoder_readBit(contexts, pos) {
  19724. var cx_index = contexts[pos] >> 1, cx_mps = contexts[pos] & 1;
  19725. var qeTableIcx = QeTable[cx_index];
  19726. var qeIcx = qeTableIcx.qe;
  19727. var d;
  19728. var a = this.a - qeIcx;
  19729. if (this.chigh < qeIcx) {
  19730. if (a < qeIcx) {
  19731. a = qeIcx;
  19732. d = cx_mps;
  19733. cx_index = qeTableIcx.nmps;
  19734. } else {
  19735. a = qeIcx;
  19736. d = 1 ^ cx_mps;
  19737. if (qeTableIcx.switchFlag === 1) {
  19738. cx_mps = d;
  19739. }
  19740. cx_index = qeTableIcx.nlps;
  19741. }
  19742. } else {
  19743. this.chigh -= qeIcx;
  19744. if ((a & 0x8000) !== 0) {
  19745. this.a = a;
  19746. return cx_mps;
  19747. }
  19748. if (a < qeIcx) {
  19749. d = 1 ^ cx_mps;
  19750. if (qeTableIcx.switchFlag === 1) {
  19751. cx_mps = d;
  19752. }
  19753. cx_index = qeTableIcx.nlps;
  19754. } else {
  19755. d = cx_mps;
  19756. cx_index = qeTableIcx.nmps;
  19757. }
  19758. }
  19759. do {
  19760. if (this.ct === 0) {
  19761. this.byteIn();
  19762. }
  19763. a <<= 1;
  19764. this.chigh = this.chigh << 1 & 0xFFFF | this.clow >> 15 & 1;
  19765. this.clow = this.clow << 1 & 0xFFFF;
  19766. this.ct--;
  19767. } while ((a & 0x8000) === 0);
  19768. this.a = a;
  19769. contexts[pos] = cx_index << 1 | cx_mps;
  19770. return d;
  19771. }
  19772. };
  19773. return ArithmeticDecoder;
  19774. }();
  19775. exports.ArithmeticDecoder = ArithmeticDecoder;
  19776. /***/ }),
  19777. /* 10 */
  19778. /***/ (function(module, exports, __w_pdfjs_require__) {
  19779. "use strict";
  19780. var sharedUtil = __w_pdfjs_require__(0);
  19781. var coreCharsets = __w_pdfjs_require__(23);
  19782. var coreEncodings = __w_pdfjs_require__(4);
  19783. var error = sharedUtil.error;
  19784. var info = sharedUtil.info;
  19785. var bytesToString = sharedUtil.bytesToString;
  19786. var warn = sharedUtil.warn;
  19787. var isArray = sharedUtil.isArray;
  19788. var Util = sharedUtil.Util;
  19789. var stringToBytes = sharedUtil.stringToBytes;
  19790. var assert = sharedUtil.assert;
  19791. var ISOAdobeCharset = coreCharsets.ISOAdobeCharset;
  19792. var ExpertCharset = coreCharsets.ExpertCharset;
  19793. var ExpertSubsetCharset = coreCharsets.ExpertSubsetCharset;
  19794. var StandardEncoding = coreEncodings.StandardEncoding;
  19795. var ExpertEncoding = coreEncodings.ExpertEncoding;
  19796. var MAX_SUBR_NESTING = 10;
  19797. var CFFStandardStrings = [
  19798. '.notdef',
  19799. 'space',
  19800. 'exclam',
  19801. 'quotedbl',
  19802. 'numbersign',
  19803. 'dollar',
  19804. 'percent',
  19805. 'ampersand',
  19806. 'quoteright',
  19807. 'parenleft',
  19808. 'parenright',
  19809. 'asterisk',
  19810. 'plus',
  19811. 'comma',
  19812. 'hyphen',
  19813. 'period',
  19814. 'slash',
  19815. 'zero',
  19816. 'one',
  19817. 'two',
  19818. 'three',
  19819. 'four',
  19820. 'five',
  19821. 'six',
  19822. 'seven',
  19823. 'eight',
  19824. 'nine',
  19825. 'colon',
  19826. 'semicolon',
  19827. 'less',
  19828. 'equal',
  19829. 'greater',
  19830. 'question',
  19831. 'at',
  19832. 'A',
  19833. 'B',
  19834. 'C',
  19835. 'D',
  19836. 'E',
  19837. 'F',
  19838. 'G',
  19839. 'H',
  19840. 'I',
  19841. 'J',
  19842. 'K',
  19843. 'L',
  19844. 'M',
  19845. 'N',
  19846. 'O',
  19847. 'P',
  19848. 'Q',
  19849. 'R',
  19850. 'S',
  19851. 'T',
  19852. 'U',
  19853. 'V',
  19854. 'W',
  19855. 'X',
  19856. 'Y',
  19857. 'Z',
  19858. 'bracketleft',
  19859. 'backslash',
  19860. 'bracketright',
  19861. 'asciicircum',
  19862. 'underscore',
  19863. 'quoteleft',
  19864. 'a',
  19865. 'b',
  19866. 'c',
  19867. 'd',
  19868. 'e',
  19869. 'f',
  19870. 'g',
  19871. 'h',
  19872. 'i',
  19873. 'j',
  19874. 'k',
  19875. 'l',
  19876. 'm',
  19877. 'n',
  19878. 'o',
  19879. 'p',
  19880. 'q',
  19881. 'r',
  19882. 's',
  19883. 't',
  19884. 'u',
  19885. 'v',
  19886. 'w',
  19887. 'x',
  19888. 'y',
  19889. 'z',
  19890. 'braceleft',
  19891. 'bar',
  19892. 'braceright',
  19893. 'asciitilde',
  19894. 'exclamdown',
  19895. 'cent',
  19896. 'sterling',
  19897. 'fraction',
  19898. 'yen',
  19899. 'florin',
  19900. 'section',
  19901. 'currency',
  19902. 'quotesingle',
  19903. 'quotedblleft',
  19904. 'guillemotleft',
  19905. 'guilsinglleft',
  19906. 'guilsinglright',
  19907. 'fi',
  19908. 'fl',
  19909. 'endash',
  19910. 'dagger',
  19911. 'daggerdbl',
  19912. 'periodcentered',
  19913. 'paragraph',
  19914. 'bullet',
  19915. 'quotesinglbase',
  19916. 'quotedblbase',
  19917. 'quotedblright',
  19918. 'guillemotright',
  19919. 'ellipsis',
  19920. 'perthousand',
  19921. 'questiondown',
  19922. 'grave',
  19923. 'acute',
  19924. 'circumflex',
  19925. 'tilde',
  19926. 'macron',
  19927. 'breve',
  19928. 'dotaccent',
  19929. 'dieresis',
  19930. 'ring',
  19931. 'cedilla',
  19932. 'hungarumlaut',
  19933. 'ogonek',
  19934. 'caron',
  19935. 'emdash',
  19936. 'AE',
  19937. 'ordfeminine',
  19938. 'Lslash',
  19939. 'Oslash',
  19940. 'OE',
  19941. 'ordmasculine',
  19942. 'ae',
  19943. 'dotlessi',
  19944. 'lslash',
  19945. 'oslash',
  19946. 'oe',
  19947. 'germandbls',
  19948. 'onesuperior',
  19949. 'logicalnot',
  19950. 'mu',
  19951. 'trademark',
  19952. 'Eth',
  19953. 'onehalf',
  19954. 'plusminus',
  19955. 'Thorn',
  19956. 'onequarter',
  19957. 'divide',
  19958. 'brokenbar',
  19959. 'degree',
  19960. 'thorn',
  19961. 'threequarters',
  19962. 'twosuperior',
  19963. 'registered',
  19964. 'minus',
  19965. 'eth',
  19966. 'multiply',
  19967. 'threesuperior',
  19968. 'copyright',
  19969. 'Aacute',
  19970. 'Acircumflex',
  19971. 'Adieresis',
  19972. 'Agrave',
  19973. 'Aring',
  19974. 'Atilde',
  19975. 'Ccedilla',
  19976. 'Eacute',
  19977. 'Ecircumflex',
  19978. 'Edieresis',
  19979. 'Egrave',
  19980. 'Iacute',
  19981. 'Icircumflex',
  19982. 'Idieresis',
  19983. 'Igrave',
  19984. 'Ntilde',
  19985. 'Oacute',
  19986. 'Ocircumflex',
  19987. 'Odieresis',
  19988. 'Ograve',
  19989. 'Otilde',
  19990. 'Scaron',
  19991. 'Uacute',
  19992. 'Ucircumflex',
  19993. 'Udieresis',
  19994. 'Ugrave',
  19995. 'Yacute',
  19996. 'Ydieresis',
  19997. 'Zcaron',
  19998. 'aacute',
  19999. 'acircumflex',
  20000. 'adieresis',
  20001. 'agrave',
  20002. 'aring',
  20003. 'atilde',
  20004. 'ccedilla',
  20005. 'eacute',
  20006. 'ecircumflex',
  20007. 'edieresis',
  20008. 'egrave',
  20009. 'iacute',
  20010. 'icircumflex',
  20011. 'idieresis',
  20012. 'igrave',
  20013. 'ntilde',
  20014. 'oacute',
  20015. 'ocircumflex',
  20016. 'odieresis',
  20017. 'ograve',
  20018. 'otilde',
  20019. 'scaron',
  20020. 'uacute',
  20021. 'ucircumflex',
  20022. 'udieresis',
  20023. 'ugrave',
  20024. 'yacute',
  20025. 'ydieresis',
  20026. 'zcaron',
  20027. 'exclamsmall',
  20028. 'Hungarumlautsmall',
  20029. 'dollaroldstyle',
  20030. 'dollarsuperior',
  20031. 'ampersandsmall',
  20032. 'Acutesmall',
  20033. 'parenleftsuperior',
  20034. 'parenrightsuperior',
  20035. 'twodotenleader',
  20036. 'onedotenleader',
  20037. 'zerooldstyle',
  20038. 'oneoldstyle',
  20039. 'twooldstyle',
  20040. 'threeoldstyle',
  20041. 'fouroldstyle',
  20042. 'fiveoldstyle',
  20043. 'sixoldstyle',
  20044. 'sevenoldstyle',
  20045. 'eightoldstyle',
  20046. 'nineoldstyle',
  20047. 'commasuperior',
  20048. 'threequartersemdash',
  20049. 'periodsuperior',
  20050. 'questionsmall',
  20051. 'asuperior',
  20052. 'bsuperior',
  20053. 'centsuperior',
  20054. 'dsuperior',
  20055. 'esuperior',
  20056. 'isuperior',
  20057. 'lsuperior',
  20058. 'msuperior',
  20059. 'nsuperior',
  20060. 'osuperior',
  20061. 'rsuperior',
  20062. 'ssuperior',
  20063. 'tsuperior',
  20064. 'ff',
  20065. 'ffi',
  20066. 'ffl',
  20067. 'parenleftinferior',
  20068. 'parenrightinferior',
  20069. 'Circumflexsmall',
  20070. 'hyphensuperior',
  20071. 'Gravesmall',
  20072. 'Asmall',
  20073. 'Bsmall',
  20074. 'Csmall',
  20075. 'Dsmall',
  20076. 'Esmall',
  20077. 'Fsmall',
  20078. 'Gsmall',
  20079. 'Hsmall',
  20080. 'Ismall',
  20081. 'Jsmall',
  20082. 'Ksmall',
  20083. 'Lsmall',
  20084. 'Msmall',
  20085. 'Nsmall',
  20086. 'Osmall',
  20087. 'Psmall',
  20088. 'Qsmall',
  20089. 'Rsmall',
  20090. 'Ssmall',
  20091. 'Tsmall',
  20092. 'Usmall',
  20093. 'Vsmall',
  20094. 'Wsmall',
  20095. 'Xsmall',
  20096. 'Ysmall',
  20097. 'Zsmall',
  20098. 'colonmonetary',
  20099. 'onefitted',
  20100. 'rupiah',
  20101. 'Tildesmall',
  20102. 'exclamdownsmall',
  20103. 'centoldstyle',
  20104. 'Lslashsmall',
  20105. 'Scaronsmall',
  20106. 'Zcaronsmall',
  20107. 'Dieresissmall',
  20108. 'Brevesmall',
  20109. 'Caronsmall',
  20110. 'Dotaccentsmall',
  20111. 'Macronsmall',
  20112. 'figuredash',
  20113. 'hypheninferior',
  20114. 'Ogoneksmall',
  20115. 'Ringsmall',
  20116. 'Cedillasmall',
  20117. 'questiondownsmall',
  20118. 'oneeighth',
  20119. 'threeeighths',
  20120. 'fiveeighths',
  20121. 'seveneighths',
  20122. 'onethird',
  20123. 'twothirds',
  20124. 'zerosuperior',
  20125. 'foursuperior',
  20126. 'fivesuperior',
  20127. 'sixsuperior',
  20128. 'sevensuperior',
  20129. 'eightsuperior',
  20130. 'ninesuperior',
  20131. 'zeroinferior',
  20132. 'oneinferior',
  20133. 'twoinferior',
  20134. 'threeinferior',
  20135. 'fourinferior',
  20136. 'fiveinferior',
  20137. 'sixinferior',
  20138. 'seveninferior',
  20139. 'eightinferior',
  20140. 'nineinferior',
  20141. 'centinferior',
  20142. 'dollarinferior',
  20143. 'periodinferior',
  20144. 'commainferior',
  20145. 'Agravesmall',
  20146. 'Aacutesmall',
  20147. 'Acircumflexsmall',
  20148. 'Atildesmall',
  20149. 'Adieresissmall',
  20150. 'Aringsmall',
  20151. 'AEsmall',
  20152. 'Ccedillasmall',
  20153. 'Egravesmall',
  20154. 'Eacutesmall',
  20155. 'Ecircumflexsmall',
  20156. 'Edieresissmall',
  20157. 'Igravesmall',
  20158. 'Iacutesmall',
  20159. 'Icircumflexsmall',
  20160. 'Idieresissmall',
  20161. 'Ethsmall',
  20162. 'Ntildesmall',
  20163. 'Ogravesmall',
  20164. 'Oacutesmall',
  20165. 'Ocircumflexsmall',
  20166. 'Otildesmall',
  20167. 'Odieresissmall',
  20168. 'OEsmall',
  20169. 'Oslashsmall',
  20170. 'Ugravesmall',
  20171. 'Uacutesmall',
  20172. 'Ucircumflexsmall',
  20173. 'Udieresissmall',
  20174. 'Yacutesmall',
  20175. 'Thornsmall',
  20176. 'Ydieresissmall',
  20177. '001.000',
  20178. '001.001',
  20179. '001.002',
  20180. '001.003',
  20181. 'Black',
  20182. 'Bold',
  20183. 'Book',
  20184. 'Light',
  20185. 'Medium',
  20186. 'Regular',
  20187. 'Roman',
  20188. 'Semibold'
  20189. ];
  20190. var CFFParser = function CFFParserClosure() {
  20191. var CharstringValidationData = [
  20192. null,
  20193. {
  20194. id: 'hstem',
  20195. min: 2,
  20196. stackClearing: true,
  20197. stem: true
  20198. },
  20199. null,
  20200. {
  20201. id: 'vstem',
  20202. min: 2,
  20203. stackClearing: true,
  20204. stem: true
  20205. },
  20206. {
  20207. id: 'vmoveto',
  20208. min: 1,
  20209. stackClearing: true
  20210. },
  20211. {
  20212. id: 'rlineto',
  20213. min: 2,
  20214. resetStack: true
  20215. },
  20216. {
  20217. id: 'hlineto',
  20218. min: 1,
  20219. resetStack: true
  20220. },
  20221. {
  20222. id: 'vlineto',
  20223. min: 1,
  20224. resetStack: true
  20225. },
  20226. {
  20227. id: 'rrcurveto',
  20228. min: 6,
  20229. resetStack: true
  20230. },
  20231. null,
  20232. {
  20233. id: 'callsubr',
  20234. min: 1,
  20235. undefStack: true
  20236. },
  20237. {
  20238. id: 'return',
  20239. min: 0,
  20240. undefStack: true
  20241. },
  20242. null,
  20243. null,
  20244. {
  20245. id: 'endchar',
  20246. min: 0,
  20247. stackClearing: true
  20248. },
  20249. null,
  20250. null,
  20251. null,
  20252. {
  20253. id: 'hstemhm',
  20254. min: 2,
  20255. stackClearing: true,
  20256. stem: true
  20257. },
  20258. {
  20259. id: 'hintmask',
  20260. min: 0,
  20261. stackClearing: true
  20262. },
  20263. {
  20264. id: 'cntrmask',
  20265. min: 0,
  20266. stackClearing: true
  20267. },
  20268. {
  20269. id: 'rmoveto',
  20270. min: 2,
  20271. stackClearing: true
  20272. },
  20273. {
  20274. id: 'hmoveto',
  20275. min: 1,
  20276. stackClearing: true
  20277. },
  20278. {
  20279. id: 'vstemhm',
  20280. min: 2,
  20281. stackClearing: true,
  20282. stem: true
  20283. },
  20284. {
  20285. id: 'rcurveline',
  20286. min: 8,
  20287. resetStack: true
  20288. },
  20289. {
  20290. id: 'rlinecurve',
  20291. min: 8,
  20292. resetStack: true
  20293. },
  20294. {
  20295. id: 'vvcurveto',
  20296. min: 4,
  20297. resetStack: true
  20298. },
  20299. {
  20300. id: 'hhcurveto',
  20301. min: 4,
  20302. resetStack: true
  20303. },
  20304. null,
  20305. {
  20306. id: 'callgsubr',
  20307. min: 1,
  20308. undefStack: true
  20309. },
  20310. {
  20311. id: 'vhcurveto',
  20312. min: 4,
  20313. resetStack: true
  20314. },
  20315. {
  20316. id: 'hvcurveto',
  20317. min: 4,
  20318. resetStack: true
  20319. }
  20320. ];
  20321. var CharstringValidationData12 = [
  20322. null,
  20323. null,
  20324. null,
  20325. {
  20326. id: 'and',
  20327. min: 2,
  20328. stackDelta: -1
  20329. },
  20330. {
  20331. id: 'or',
  20332. min: 2,
  20333. stackDelta: -1
  20334. },
  20335. {
  20336. id: 'not',
  20337. min: 1,
  20338. stackDelta: 0
  20339. },
  20340. null,
  20341. null,
  20342. null,
  20343. {
  20344. id: 'abs',
  20345. min: 1,
  20346. stackDelta: 0
  20347. },
  20348. {
  20349. id: 'add',
  20350. min: 2,
  20351. stackDelta: -1,
  20352. stackFn: function stack_div(stack, index) {
  20353. stack[index - 2] = stack[index - 2] + stack[index - 1];
  20354. }
  20355. },
  20356. {
  20357. id: 'sub',
  20358. min: 2,
  20359. stackDelta: -1,
  20360. stackFn: function stack_div(stack, index) {
  20361. stack[index - 2] = stack[index - 2] - stack[index - 1];
  20362. }
  20363. },
  20364. {
  20365. id: 'div',
  20366. min: 2,
  20367. stackDelta: -1,
  20368. stackFn: function stack_div(stack, index) {
  20369. stack[index - 2] = stack[index - 2] / stack[index - 1];
  20370. }
  20371. },
  20372. null,
  20373. {
  20374. id: 'neg',
  20375. min: 1,
  20376. stackDelta: 0,
  20377. stackFn: function stack_div(stack, index) {
  20378. stack[index - 1] = -stack[index - 1];
  20379. }
  20380. },
  20381. {
  20382. id: 'eq',
  20383. min: 2,
  20384. stackDelta: -1
  20385. },
  20386. null,
  20387. null,
  20388. {
  20389. id: 'drop',
  20390. min: 1,
  20391. stackDelta: -1
  20392. },
  20393. null,
  20394. {
  20395. id: 'put',
  20396. min: 2,
  20397. stackDelta: -2
  20398. },
  20399. {
  20400. id: 'get',
  20401. min: 1,
  20402. stackDelta: 0
  20403. },
  20404. {
  20405. id: 'ifelse',
  20406. min: 4,
  20407. stackDelta: -3
  20408. },
  20409. {
  20410. id: 'random',
  20411. min: 0,
  20412. stackDelta: 1
  20413. },
  20414. {
  20415. id: 'mul',
  20416. min: 2,
  20417. stackDelta: -1,
  20418. stackFn: function stack_div(stack, index) {
  20419. stack[index - 2] = stack[index - 2] * stack[index - 1];
  20420. }
  20421. },
  20422. null,
  20423. {
  20424. id: 'sqrt',
  20425. min: 1,
  20426. stackDelta: 0
  20427. },
  20428. {
  20429. id: 'dup',
  20430. min: 1,
  20431. stackDelta: 1
  20432. },
  20433. {
  20434. id: 'exch',
  20435. min: 2,
  20436. stackDelta: 0
  20437. },
  20438. {
  20439. id: 'index',
  20440. min: 2,
  20441. stackDelta: 0
  20442. },
  20443. {
  20444. id: 'roll',
  20445. min: 3,
  20446. stackDelta: -2
  20447. },
  20448. null,
  20449. null,
  20450. null,
  20451. {
  20452. id: 'hflex',
  20453. min: 7,
  20454. resetStack: true
  20455. },
  20456. {
  20457. id: 'flex',
  20458. min: 13,
  20459. resetStack: true
  20460. },
  20461. {
  20462. id: 'hflex1',
  20463. min: 9,
  20464. resetStack: true
  20465. },
  20466. {
  20467. id: 'flex1',
  20468. min: 11,
  20469. resetStack: true
  20470. }
  20471. ];
  20472. function CFFParser(file, properties, seacAnalysisEnabled) {
  20473. this.bytes = file.getBytes();
  20474. this.properties = properties;
  20475. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  20476. }
  20477. CFFParser.prototype = {
  20478. parse: function CFFParser_parse() {
  20479. var properties = this.properties;
  20480. var cff = new CFF();
  20481. this.cff = cff;
  20482. var header = this.parseHeader();
  20483. var nameIndex = this.parseIndex(header.endPos);
  20484. var topDictIndex = this.parseIndex(nameIndex.endPos);
  20485. var stringIndex = this.parseIndex(topDictIndex.endPos);
  20486. var globalSubrIndex = this.parseIndex(stringIndex.endPos);
  20487. var topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  20488. var topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  20489. cff.header = header.obj;
  20490. cff.names = this.parseNameIndex(nameIndex.obj);
  20491. cff.strings = this.parseStringIndex(stringIndex.obj);
  20492. cff.topDict = topDict;
  20493. cff.globalSubrIndex = globalSubrIndex.obj;
  20494. this.parsePrivateDict(cff.topDict);
  20495. cff.isCIDFont = topDict.hasName('ROS');
  20496. var charStringOffset = topDict.getByName('CharStrings');
  20497. var charStringIndex = this.parseIndex(charStringOffset).obj;
  20498. var fontMatrix = topDict.getByName('FontMatrix');
  20499. if (fontMatrix) {
  20500. properties.fontMatrix = fontMatrix;
  20501. }
  20502. var fontBBox = topDict.getByName('FontBBox');
  20503. if (fontBBox) {
  20504. properties.ascent = fontBBox[3];
  20505. properties.descent = fontBBox[1];
  20506. properties.ascentScaled = true;
  20507. }
  20508. var charset, encoding;
  20509. if (cff.isCIDFont) {
  20510. var fdArrayIndex = this.parseIndex(topDict.getByName('FDArray')).obj;
  20511. for (var i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  20512. var dictRaw = fdArrayIndex.get(i);
  20513. var fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  20514. this.parsePrivateDict(fontDict);
  20515. cff.fdArray.push(fontDict);
  20516. }
  20517. encoding = null;
  20518. charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, true);
  20519. cff.fdSelect = this.parseFDSelect(topDict.getByName('FDSelect'), charStringIndex.count);
  20520. } else {
  20521. charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, false);
  20522. encoding = this.parseEncoding(topDict.getByName('Encoding'), properties, cff.strings, charset.charset);
  20523. }
  20524. cff.charset = charset;
  20525. cff.encoding = encoding;
  20526. var charStringsAndSeacs = this.parseCharStrings(charStringIndex, topDict.privateDict.subrsIndex, globalSubrIndex.obj, cff.fdSelect, cff.fdArray);
  20527. cff.charStrings = charStringsAndSeacs.charStrings;
  20528. cff.seacs = charStringsAndSeacs.seacs;
  20529. cff.widths = charStringsAndSeacs.widths;
  20530. return cff;
  20531. },
  20532. parseHeader: function CFFParser_parseHeader() {
  20533. var bytes = this.bytes;
  20534. var bytesLength = bytes.length;
  20535. var offset = 0;
  20536. while (offset < bytesLength && bytes[offset] !== 1) {
  20537. ++offset;
  20538. }
  20539. if (offset >= bytesLength) {
  20540. error('Invalid CFF header');
  20541. } else if (offset !== 0) {
  20542. info('cff data is shifted');
  20543. bytes = bytes.subarray(offset);
  20544. this.bytes = bytes;
  20545. }
  20546. var major = bytes[0];
  20547. var minor = bytes[1];
  20548. var hdrSize = bytes[2];
  20549. var offSize = bytes[3];
  20550. var header = new CFFHeader(major, minor, hdrSize, offSize);
  20551. return {
  20552. obj: header,
  20553. endPos: hdrSize
  20554. };
  20555. },
  20556. parseDict: function CFFParser_parseDict(dict) {
  20557. var pos = 0;
  20558. function parseOperand() {
  20559. var value = dict[pos++];
  20560. if (value === 30) {
  20561. return parseFloatOperand();
  20562. } else if (value === 28) {
  20563. value = dict[pos++];
  20564. value = (value << 24 | dict[pos++] << 16) >> 16;
  20565. return value;
  20566. } else if (value === 29) {
  20567. value = dict[pos++];
  20568. value = value << 8 | dict[pos++];
  20569. value = value << 8 | dict[pos++];
  20570. value = value << 8 | dict[pos++];
  20571. return value;
  20572. } else if (value >= 32 && value <= 246) {
  20573. return value - 139;
  20574. } else if (value >= 247 && value <= 250) {
  20575. return (value - 247) * 256 + dict[pos++] + 108;
  20576. } else if (value >= 251 && value <= 254) {
  20577. return -((value - 251) * 256) - dict[pos++] - 108;
  20578. }
  20579. warn('CFFParser_parseDict: "' + value + '" is a reserved command.');
  20580. return NaN;
  20581. }
  20582. function parseFloatOperand() {
  20583. var str = '';
  20584. var eof = 15;
  20585. var lookup = [
  20586. '0',
  20587. '1',
  20588. '2',
  20589. '3',
  20590. '4',
  20591. '5',
  20592. '6',
  20593. '7',
  20594. '8',
  20595. '9',
  20596. '.',
  20597. 'E',
  20598. 'E-',
  20599. null,
  20600. '-'
  20601. ];
  20602. var length = dict.length;
  20603. while (pos < length) {
  20604. var b = dict[pos++];
  20605. var b1 = b >> 4;
  20606. var b2 = b & 15;
  20607. if (b1 === eof) {
  20608. break;
  20609. }
  20610. str += lookup[b1];
  20611. if (b2 === eof) {
  20612. break;
  20613. }
  20614. str += lookup[b2];
  20615. }
  20616. return parseFloat(str);
  20617. }
  20618. var operands = [];
  20619. var entries = [];
  20620. pos = 0;
  20621. var end = dict.length;
  20622. while (pos < end) {
  20623. var b = dict[pos];
  20624. if (b <= 21) {
  20625. if (b === 12) {
  20626. b = b << 8 | dict[++pos];
  20627. }
  20628. entries.push([
  20629. b,
  20630. operands
  20631. ]);
  20632. operands = [];
  20633. ++pos;
  20634. } else {
  20635. operands.push(parseOperand());
  20636. }
  20637. }
  20638. return entries;
  20639. },
  20640. parseIndex: function CFFParser_parseIndex(pos) {
  20641. var cffIndex = new CFFIndex();
  20642. var bytes = this.bytes;
  20643. var count = bytes[pos++] << 8 | bytes[pos++];
  20644. var offsets = [];
  20645. var end = pos;
  20646. var i, ii;
  20647. if (count !== 0) {
  20648. var offsetSize = bytes[pos++];
  20649. var startPos = pos + (count + 1) * offsetSize - 1;
  20650. for (i = 0, ii = count + 1; i < ii; ++i) {
  20651. var offset = 0;
  20652. for (var j = 0; j < offsetSize; ++j) {
  20653. offset <<= 8;
  20654. offset += bytes[pos++];
  20655. }
  20656. offsets.push(startPos + offset);
  20657. }
  20658. end = offsets[count];
  20659. }
  20660. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  20661. var offsetStart = offsets[i];
  20662. var offsetEnd = offsets[i + 1];
  20663. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  20664. }
  20665. return {
  20666. obj: cffIndex,
  20667. endPos: end
  20668. };
  20669. },
  20670. parseNameIndex: function CFFParser_parseNameIndex(index) {
  20671. var names = [];
  20672. for (var i = 0, ii = index.count; i < ii; ++i) {
  20673. var name = index.get(i);
  20674. var length = Math.min(name.length, 127);
  20675. var data = [];
  20676. for (var j = 0; j < length; ++j) {
  20677. var c = name[j];
  20678. if (j === 0 && c === 0) {
  20679. data[j] = c;
  20680. continue;
  20681. }
  20682. 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) {
  20683. data[j] = 95;
  20684. continue;
  20685. }
  20686. data[j] = c;
  20687. }
  20688. names.push(bytesToString(data));
  20689. }
  20690. return names;
  20691. },
  20692. parseStringIndex: function CFFParser_parseStringIndex(index) {
  20693. var strings = new CFFStrings();
  20694. for (var i = 0, ii = index.count; i < ii; ++i) {
  20695. var data = index.get(i);
  20696. strings.add(bytesToString(data));
  20697. }
  20698. return strings;
  20699. },
  20700. createDict: function CFFParser_createDict(Type, dict, strings) {
  20701. var cffDict = new Type(strings);
  20702. for (var i = 0, ii = dict.length; i < ii; ++i) {
  20703. var pair = dict[i];
  20704. var key = pair[0];
  20705. var value = pair[1];
  20706. cffDict.setByKey(key, value);
  20707. }
  20708. return cffDict;
  20709. },
  20710. parseCharString: function CFFParser_parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  20711. if (state.callDepth > MAX_SUBR_NESTING) {
  20712. return false;
  20713. }
  20714. var stackSize = state.stackSize;
  20715. var stack = state.stack;
  20716. var length = data.length;
  20717. for (var j = 0; j < length;) {
  20718. var value = data[j++];
  20719. var validationCommand = null;
  20720. if (value === 12) {
  20721. var q = data[j++];
  20722. if (q === 0) {
  20723. data[j - 2] = 139;
  20724. data[j - 1] = 22;
  20725. stackSize = 0;
  20726. } else {
  20727. validationCommand = CharstringValidationData12[q];
  20728. }
  20729. } else if (value === 28) {
  20730. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  20731. j += 2;
  20732. stackSize++;
  20733. } else if (value === 14) {
  20734. if (stackSize >= 4) {
  20735. stackSize -= 4;
  20736. if (this.seacAnalysisEnabled) {
  20737. state.seac = stack.slice(stackSize, stackSize + 4);
  20738. return false;
  20739. }
  20740. }
  20741. validationCommand = CharstringValidationData[value];
  20742. } else if (value >= 32 && value <= 246) {
  20743. stack[stackSize] = value - 139;
  20744. stackSize++;
  20745. } else if (value >= 247 && value <= 254) {
  20746. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  20747. j++;
  20748. stackSize++;
  20749. } else if (value === 255) {
  20750. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  20751. j += 4;
  20752. stackSize++;
  20753. } else if (value === 19 || value === 20) {
  20754. state.hints += stackSize >> 1;
  20755. j += state.hints + 7 >> 3;
  20756. stackSize %= 2;
  20757. validationCommand = CharstringValidationData[value];
  20758. } else if (value === 10 || value === 29) {
  20759. var subrsIndex;
  20760. if (value === 10) {
  20761. subrsIndex = localSubrIndex;
  20762. } else {
  20763. subrsIndex = globalSubrIndex;
  20764. }
  20765. if (!subrsIndex) {
  20766. validationCommand = CharstringValidationData[value];
  20767. warn('Missing subrsIndex for ' + validationCommand.id);
  20768. return false;
  20769. }
  20770. var bias = 32768;
  20771. if (subrsIndex.count < 1240) {
  20772. bias = 107;
  20773. } else if (subrsIndex.count < 33900) {
  20774. bias = 1131;
  20775. }
  20776. var subrNumber = stack[--stackSize] + bias;
  20777. if (subrNumber < 0 || subrNumber >= subrsIndex.count) {
  20778. validationCommand = CharstringValidationData[value];
  20779. warn('Out of bounds subrIndex for ' + validationCommand.id);
  20780. return false;
  20781. }
  20782. state.stackSize = stackSize;
  20783. state.callDepth++;
  20784. var valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  20785. if (!valid) {
  20786. return false;
  20787. }
  20788. state.callDepth--;
  20789. stackSize = state.stackSize;
  20790. continue;
  20791. } else if (value === 11) {
  20792. state.stackSize = stackSize;
  20793. return true;
  20794. } else {
  20795. validationCommand = CharstringValidationData[value];
  20796. }
  20797. if (validationCommand) {
  20798. if (validationCommand.stem) {
  20799. state.hints += stackSize >> 1;
  20800. }
  20801. if ('min' in validationCommand) {
  20802. if (!state.undefStack && stackSize < validationCommand.min) {
  20803. warn('Not enough parameters for ' + validationCommand.id + '; actual: ' + stackSize + ', expected: ' + validationCommand.min);
  20804. return false;
  20805. }
  20806. }
  20807. if (state.firstStackClearing && validationCommand.stackClearing) {
  20808. state.firstStackClearing = false;
  20809. stackSize -= validationCommand.min;
  20810. if (stackSize >= 2 && validationCommand.stem) {
  20811. stackSize %= 2;
  20812. } else if (stackSize > 1) {
  20813. warn('Found too many parameters for stack-clearing command');
  20814. }
  20815. if (stackSize > 0 && stack[stackSize - 1] >= 0) {
  20816. state.width = stack[stackSize - 1];
  20817. }
  20818. }
  20819. if ('stackDelta' in validationCommand) {
  20820. if ('stackFn' in validationCommand) {
  20821. validationCommand.stackFn(stack, stackSize);
  20822. }
  20823. stackSize += validationCommand.stackDelta;
  20824. } else if (validationCommand.stackClearing) {
  20825. stackSize = 0;
  20826. } else if (validationCommand.resetStack) {
  20827. stackSize = 0;
  20828. state.undefStack = false;
  20829. } else if (validationCommand.undefStack) {
  20830. stackSize = 0;
  20831. state.undefStack = true;
  20832. state.firstStackClearing = false;
  20833. }
  20834. }
  20835. }
  20836. state.stackSize = stackSize;
  20837. return true;
  20838. },
  20839. parseCharStrings: function CFFParser_parseCharStrings(charStrings, localSubrIndex, globalSubrIndex, fdSelect, fdArray) {
  20840. var seacs = [];
  20841. var widths = [];
  20842. var count = charStrings.count;
  20843. for (var i = 0; i < count; i++) {
  20844. var charstring = charStrings.get(i);
  20845. var state = {
  20846. callDepth: 0,
  20847. stackSize: 0,
  20848. stack: [],
  20849. undefStack: true,
  20850. hints: 0,
  20851. firstStackClearing: true,
  20852. seac: null,
  20853. width: null
  20854. };
  20855. var valid = true;
  20856. var localSubrToUse = null;
  20857. if (fdSelect && fdArray.length) {
  20858. var fdIndex = fdSelect.getFDIndex(i);
  20859. if (fdIndex === -1) {
  20860. warn('Glyph index is not in fd select.');
  20861. valid = false;
  20862. }
  20863. if (fdIndex >= fdArray.length) {
  20864. warn('Invalid fd index for glyph index.');
  20865. valid = false;
  20866. }
  20867. if (valid) {
  20868. localSubrToUse = fdArray[fdIndex].privateDict.subrsIndex;
  20869. }
  20870. } else if (localSubrIndex) {
  20871. localSubrToUse = localSubrIndex;
  20872. }
  20873. if (valid) {
  20874. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  20875. }
  20876. if (state.width !== null) {
  20877. widths[i] = state.width;
  20878. }
  20879. if (state.seac !== null) {
  20880. seacs[i] = state.seac;
  20881. }
  20882. if (!valid) {
  20883. charStrings.set(i, new Uint8Array([14]));
  20884. }
  20885. }
  20886. return {
  20887. charStrings: charStrings,
  20888. seacs: seacs,
  20889. widths: widths
  20890. };
  20891. },
  20892. emptyPrivateDictionary: function CFFParser_emptyPrivateDictionary(parentDict) {
  20893. var privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  20894. parentDict.setByKey(18, [
  20895. 0,
  20896. 0
  20897. ]);
  20898. parentDict.privateDict = privateDict;
  20899. },
  20900. parsePrivateDict: function CFFParser_parsePrivateDict(parentDict) {
  20901. if (!parentDict.hasName('Private')) {
  20902. this.emptyPrivateDictionary(parentDict);
  20903. return;
  20904. }
  20905. var privateOffset = parentDict.getByName('Private');
  20906. if (!isArray(privateOffset) || privateOffset.length !== 2) {
  20907. parentDict.removeByName('Private');
  20908. return;
  20909. }
  20910. var size = privateOffset[0];
  20911. var offset = privateOffset[1];
  20912. if (size === 0 || offset >= this.bytes.length) {
  20913. this.emptyPrivateDictionary(parentDict);
  20914. return;
  20915. }
  20916. var privateDictEnd = offset + size;
  20917. var dictData = this.bytes.subarray(offset, privateDictEnd);
  20918. var dict = this.parseDict(dictData);
  20919. var privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  20920. parentDict.privateDict = privateDict;
  20921. if (!privateDict.getByName('Subrs')) {
  20922. return;
  20923. }
  20924. var subrsOffset = privateDict.getByName('Subrs');
  20925. var relativeOffset = offset + subrsOffset;
  20926. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  20927. this.emptyPrivateDictionary(parentDict);
  20928. return;
  20929. }
  20930. var subrsIndex = this.parseIndex(relativeOffset);
  20931. privateDict.subrsIndex = subrsIndex.obj;
  20932. },
  20933. parseCharsets: function CFFParser_parseCharsets(pos, length, strings, cid) {
  20934. if (pos === 0) {
  20935. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, ISOAdobeCharset);
  20936. } else if (pos === 1) {
  20937. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, ExpertCharset);
  20938. } else if (pos === 2) {
  20939. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, ExpertSubsetCharset);
  20940. }
  20941. var bytes = this.bytes;
  20942. var start = pos;
  20943. var format = bytes[pos++];
  20944. var charset = ['.notdef'];
  20945. var id, count, i;
  20946. length -= 1;
  20947. switch (format) {
  20948. case 0:
  20949. for (i = 0; i < length; i++) {
  20950. id = bytes[pos++] << 8 | bytes[pos++];
  20951. charset.push(cid ? id : strings.get(id));
  20952. }
  20953. break;
  20954. case 1:
  20955. while (charset.length <= length) {
  20956. id = bytes[pos++] << 8 | bytes[pos++];
  20957. count = bytes[pos++];
  20958. for (i = 0; i <= count; i++) {
  20959. charset.push(cid ? id++ : strings.get(id++));
  20960. }
  20961. }
  20962. break;
  20963. case 2:
  20964. while (charset.length <= length) {
  20965. id = bytes[pos++] << 8 | bytes[pos++];
  20966. count = bytes[pos++] << 8 | bytes[pos++];
  20967. for (i = 0; i <= count; i++) {
  20968. charset.push(cid ? id++ : strings.get(id++));
  20969. }
  20970. }
  20971. break;
  20972. default:
  20973. error('Unknown charset format');
  20974. }
  20975. var end = pos;
  20976. var raw = bytes.subarray(start, end);
  20977. return new CFFCharset(false, format, charset, raw);
  20978. },
  20979. parseEncoding: function CFFParser_parseEncoding(pos, properties, strings, charset) {
  20980. var encoding = Object.create(null);
  20981. var bytes = this.bytes;
  20982. var predefined = false;
  20983. var format, i, ii;
  20984. var raw = null;
  20985. function readSupplement() {
  20986. var supplementsCount = bytes[pos++];
  20987. for (i = 0; i < supplementsCount; i++) {
  20988. var code = bytes[pos++];
  20989. var sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  20990. encoding[code] = charset.indexOf(strings.get(sid));
  20991. }
  20992. }
  20993. if (pos === 0 || pos === 1) {
  20994. predefined = true;
  20995. format = pos;
  20996. var baseEncoding = pos ? ExpertEncoding : StandardEncoding;
  20997. for (i = 0, ii = charset.length; i < ii; i++) {
  20998. var index = baseEncoding.indexOf(charset[i]);
  20999. if (index !== -1) {
  21000. encoding[index] = i;
  21001. }
  21002. }
  21003. } else {
  21004. var dataStart = pos;
  21005. format = bytes[pos++];
  21006. switch (format & 0x7f) {
  21007. case 0:
  21008. var glyphsCount = bytes[pos++];
  21009. for (i = 1; i <= glyphsCount; i++) {
  21010. encoding[bytes[pos++]] = i;
  21011. }
  21012. break;
  21013. case 1:
  21014. var rangesCount = bytes[pos++];
  21015. var gid = 1;
  21016. for (i = 0; i < rangesCount; i++) {
  21017. var start = bytes[pos++];
  21018. var left = bytes[pos++];
  21019. for (var j = start; j <= start + left; j++) {
  21020. encoding[j] = gid++;
  21021. }
  21022. }
  21023. break;
  21024. default:
  21025. error('Unknown encoding format: ' + format + ' in CFF');
  21026. break;
  21027. }
  21028. var dataEnd = pos;
  21029. if (format & 0x80) {
  21030. bytes[dataStart] &= 0x7f;
  21031. readSupplement();
  21032. }
  21033. raw = bytes.subarray(dataStart, dataEnd);
  21034. }
  21035. format = format & 0x7f;
  21036. return new CFFEncoding(predefined, format, encoding, raw);
  21037. },
  21038. parseFDSelect: function CFFParser_parseFDSelect(pos, length) {
  21039. var start = pos;
  21040. var bytes = this.bytes;
  21041. var format = bytes[pos++];
  21042. var fdSelect = [], rawBytes;
  21043. var i, invalidFirstGID = false;
  21044. switch (format) {
  21045. case 0:
  21046. for (i = 0; i < length; ++i) {
  21047. var id = bytes[pos++];
  21048. fdSelect.push(id);
  21049. }
  21050. rawBytes = bytes.subarray(start, pos);
  21051. break;
  21052. case 3:
  21053. var rangesCount = bytes[pos++] << 8 | bytes[pos++];
  21054. for (i = 0; i < rangesCount; ++i) {
  21055. var first = bytes[pos++] << 8 | bytes[pos++];
  21056. if (i === 0 && first !== 0) {
  21057. warn('parseFDSelect: The first range must have a first GID of 0' + ' -- trying to recover.');
  21058. invalidFirstGID = true;
  21059. first = 0;
  21060. }
  21061. var fdIndex = bytes[pos++];
  21062. var next = bytes[pos] << 8 | bytes[pos + 1];
  21063. for (var j = first; j < next; ++j) {
  21064. fdSelect.push(fdIndex);
  21065. }
  21066. }
  21067. pos += 2;
  21068. rawBytes = bytes.subarray(start, pos);
  21069. if (invalidFirstGID) {
  21070. rawBytes[3] = rawBytes[4] = 0;
  21071. }
  21072. break;
  21073. default:
  21074. error('parseFDSelect: Unknown format "' + format + '".');
  21075. break;
  21076. }
  21077. assert(fdSelect.length === length, 'parseFDSelect: Invalid font data.');
  21078. return new CFFFDSelect(fdSelect, rawBytes);
  21079. }
  21080. };
  21081. return CFFParser;
  21082. }();
  21083. var CFF = function CFFClosure() {
  21084. function CFF() {
  21085. this.header = null;
  21086. this.names = [];
  21087. this.topDict = null;
  21088. this.strings = new CFFStrings();
  21089. this.globalSubrIndex = null;
  21090. this.encoding = null;
  21091. this.charset = null;
  21092. this.charStrings = null;
  21093. this.fdArray = [];
  21094. this.fdSelect = null;
  21095. this.isCIDFont = false;
  21096. }
  21097. return CFF;
  21098. }();
  21099. var CFFHeader = function CFFHeaderClosure() {
  21100. function CFFHeader(major, minor, hdrSize, offSize) {
  21101. this.major = major;
  21102. this.minor = minor;
  21103. this.hdrSize = hdrSize;
  21104. this.offSize = offSize;
  21105. }
  21106. return CFFHeader;
  21107. }();
  21108. var CFFStrings = function CFFStringsClosure() {
  21109. function CFFStrings() {
  21110. this.strings = [];
  21111. }
  21112. CFFStrings.prototype = {
  21113. get: function CFFStrings_get(index) {
  21114. if (index >= 0 && index <= 390) {
  21115. return CFFStandardStrings[index];
  21116. }
  21117. if (index - 391 <= this.strings.length) {
  21118. return this.strings[index - 391];
  21119. }
  21120. return CFFStandardStrings[0];
  21121. },
  21122. add: function CFFStrings_add(value) {
  21123. this.strings.push(value);
  21124. },
  21125. get count() {
  21126. return this.strings.length;
  21127. }
  21128. };
  21129. return CFFStrings;
  21130. }();
  21131. var CFFIndex = function CFFIndexClosure() {
  21132. function CFFIndex() {
  21133. this.objects = [];
  21134. this.length = 0;
  21135. }
  21136. CFFIndex.prototype = {
  21137. add: function CFFIndex_add(data) {
  21138. this.length += data.length;
  21139. this.objects.push(data);
  21140. },
  21141. set: function CFFIndex_set(index, data) {
  21142. this.length += data.length - this.objects[index].length;
  21143. this.objects[index] = data;
  21144. },
  21145. get: function CFFIndex_get(index) {
  21146. return this.objects[index];
  21147. },
  21148. get count() {
  21149. return this.objects.length;
  21150. }
  21151. };
  21152. return CFFIndex;
  21153. }();
  21154. var CFFDict = function CFFDictClosure() {
  21155. function CFFDict(tables, strings) {
  21156. this.keyToNameMap = tables.keyToNameMap;
  21157. this.nameToKeyMap = tables.nameToKeyMap;
  21158. this.defaults = tables.defaults;
  21159. this.types = tables.types;
  21160. this.opcodes = tables.opcodes;
  21161. this.order = tables.order;
  21162. this.strings = strings;
  21163. this.values = Object.create(null);
  21164. }
  21165. CFFDict.prototype = {
  21166. setByKey: function CFFDict_setByKey(key, value) {
  21167. if (!(key in this.keyToNameMap)) {
  21168. return false;
  21169. }
  21170. var valueLength = value.length;
  21171. if (valueLength === 0) {
  21172. return true;
  21173. }
  21174. for (var i = 0; i < valueLength; i++) {
  21175. if (isNaN(value[i])) {
  21176. warn('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
  21177. return true;
  21178. }
  21179. }
  21180. var type = this.types[key];
  21181. if (type === 'num' || type === 'sid' || type === 'offset') {
  21182. value = value[0];
  21183. }
  21184. this.values[key] = value;
  21185. return true;
  21186. },
  21187. setByName: function CFFDict_setByName(name, value) {
  21188. if (!(name in this.nameToKeyMap)) {
  21189. error('Invalid dictionary name "' + name + '"');
  21190. }
  21191. this.values[this.nameToKeyMap[name]] = value;
  21192. },
  21193. hasName: function CFFDict_hasName(name) {
  21194. return this.nameToKeyMap[name] in this.values;
  21195. },
  21196. getByName: function CFFDict_getByName(name) {
  21197. if (!(name in this.nameToKeyMap)) {
  21198. error('Invalid dictionary name "' + name + '"');
  21199. }
  21200. var key = this.nameToKeyMap[name];
  21201. if (!(key in this.values)) {
  21202. return this.defaults[key];
  21203. }
  21204. return this.values[key];
  21205. },
  21206. removeByName: function CFFDict_removeByName(name) {
  21207. delete this.values[this.nameToKeyMap[name]];
  21208. }
  21209. };
  21210. CFFDict.createTables = function CFFDict_createTables(layout) {
  21211. var tables = {
  21212. keyToNameMap: {},
  21213. nameToKeyMap: {},
  21214. defaults: {},
  21215. types: {},
  21216. opcodes: {},
  21217. order: []
  21218. };
  21219. for (var i = 0, ii = layout.length; i < ii; ++i) {
  21220. var entry = layout[i];
  21221. var key = isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  21222. tables.keyToNameMap[key] = entry[1];
  21223. tables.nameToKeyMap[entry[1]] = key;
  21224. tables.types[key] = entry[2];
  21225. tables.defaults[key] = entry[3];
  21226. tables.opcodes[key] = isArray(entry[0]) ? entry[0] : [entry[0]];
  21227. tables.order.push(key);
  21228. }
  21229. return tables;
  21230. };
  21231. return CFFDict;
  21232. }();
  21233. var CFFTopDict = function CFFTopDictClosure() {
  21234. var layout = [
  21235. [
  21236. [
  21237. 12,
  21238. 30
  21239. ],
  21240. 'ROS',
  21241. [
  21242. 'sid',
  21243. 'sid',
  21244. 'num'
  21245. ],
  21246. null
  21247. ],
  21248. [
  21249. [
  21250. 12,
  21251. 20
  21252. ],
  21253. 'SyntheticBase',
  21254. 'num',
  21255. null
  21256. ],
  21257. [
  21258. 0,
  21259. 'version',
  21260. 'sid',
  21261. null
  21262. ],
  21263. [
  21264. 1,
  21265. 'Notice',
  21266. 'sid',
  21267. null
  21268. ],
  21269. [
  21270. [
  21271. 12,
  21272. 0
  21273. ],
  21274. 'Copyright',
  21275. 'sid',
  21276. null
  21277. ],
  21278. [
  21279. 2,
  21280. 'FullName',
  21281. 'sid',
  21282. null
  21283. ],
  21284. [
  21285. 3,
  21286. 'FamilyName',
  21287. 'sid',
  21288. null
  21289. ],
  21290. [
  21291. 4,
  21292. 'Weight',
  21293. 'sid',
  21294. null
  21295. ],
  21296. [
  21297. [
  21298. 12,
  21299. 1
  21300. ],
  21301. 'isFixedPitch',
  21302. 'num',
  21303. 0
  21304. ],
  21305. [
  21306. [
  21307. 12,
  21308. 2
  21309. ],
  21310. 'ItalicAngle',
  21311. 'num',
  21312. 0
  21313. ],
  21314. [
  21315. [
  21316. 12,
  21317. 3
  21318. ],
  21319. 'UnderlinePosition',
  21320. 'num',
  21321. -100
  21322. ],
  21323. [
  21324. [
  21325. 12,
  21326. 4
  21327. ],
  21328. 'UnderlineThickness',
  21329. 'num',
  21330. 50
  21331. ],
  21332. [
  21333. [
  21334. 12,
  21335. 5
  21336. ],
  21337. 'PaintType',
  21338. 'num',
  21339. 0
  21340. ],
  21341. [
  21342. [
  21343. 12,
  21344. 6
  21345. ],
  21346. 'CharstringType',
  21347. 'num',
  21348. 2
  21349. ],
  21350. [
  21351. [
  21352. 12,
  21353. 7
  21354. ],
  21355. 'FontMatrix',
  21356. [
  21357. 'num',
  21358. 'num',
  21359. 'num',
  21360. 'num',
  21361. 'num',
  21362. 'num'
  21363. ],
  21364. [
  21365. 0.001,
  21366. 0,
  21367. 0,
  21368. 0.001,
  21369. 0,
  21370. 0
  21371. ]
  21372. ],
  21373. [
  21374. 13,
  21375. 'UniqueID',
  21376. 'num',
  21377. null
  21378. ],
  21379. [
  21380. 5,
  21381. 'FontBBox',
  21382. [
  21383. 'num',
  21384. 'num',
  21385. 'num',
  21386. 'num'
  21387. ],
  21388. [
  21389. 0,
  21390. 0,
  21391. 0,
  21392. 0
  21393. ]
  21394. ],
  21395. [
  21396. [
  21397. 12,
  21398. 8
  21399. ],
  21400. 'StrokeWidth',
  21401. 'num',
  21402. 0
  21403. ],
  21404. [
  21405. 14,
  21406. 'XUID',
  21407. 'array',
  21408. null
  21409. ],
  21410. [
  21411. 15,
  21412. 'charset',
  21413. 'offset',
  21414. 0
  21415. ],
  21416. [
  21417. 16,
  21418. 'Encoding',
  21419. 'offset',
  21420. 0
  21421. ],
  21422. [
  21423. 17,
  21424. 'CharStrings',
  21425. 'offset',
  21426. 0
  21427. ],
  21428. [
  21429. 18,
  21430. 'Private',
  21431. [
  21432. 'offset',
  21433. 'offset'
  21434. ],
  21435. null
  21436. ],
  21437. [
  21438. [
  21439. 12,
  21440. 21
  21441. ],
  21442. 'PostScript',
  21443. 'sid',
  21444. null
  21445. ],
  21446. [
  21447. [
  21448. 12,
  21449. 22
  21450. ],
  21451. 'BaseFontName',
  21452. 'sid',
  21453. null
  21454. ],
  21455. [
  21456. [
  21457. 12,
  21458. 23
  21459. ],
  21460. 'BaseFontBlend',
  21461. 'delta',
  21462. null
  21463. ],
  21464. [
  21465. [
  21466. 12,
  21467. 31
  21468. ],
  21469. 'CIDFontVersion',
  21470. 'num',
  21471. 0
  21472. ],
  21473. [
  21474. [
  21475. 12,
  21476. 32
  21477. ],
  21478. 'CIDFontRevision',
  21479. 'num',
  21480. 0
  21481. ],
  21482. [
  21483. [
  21484. 12,
  21485. 33
  21486. ],
  21487. 'CIDFontType',
  21488. 'num',
  21489. 0
  21490. ],
  21491. [
  21492. [
  21493. 12,
  21494. 34
  21495. ],
  21496. 'CIDCount',
  21497. 'num',
  21498. 8720
  21499. ],
  21500. [
  21501. [
  21502. 12,
  21503. 35
  21504. ],
  21505. 'UIDBase',
  21506. 'num',
  21507. null
  21508. ],
  21509. [
  21510. [
  21511. 12,
  21512. 37
  21513. ],
  21514. 'FDSelect',
  21515. 'offset',
  21516. null
  21517. ],
  21518. [
  21519. [
  21520. 12,
  21521. 36
  21522. ],
  21523. 'FDArray',
  21524. 'offset',
  21525. null
  21526. ],
  21527. [
  21528. [
  21529. 12,
  21530. 38
  21531. ],
  21532. 'FontName',
  21533. 'sid',
  21534. null
  21535. ]
  21536. ];
  21537. var tables = null;
  21538. function CFFTopDict(strings) {
  21539. if (tables === null) {
  21540. tables = CFFDict.createTables(layout);
  21541. }
  21542. CFFDict.call(this, tables, strings);
  21543. this.privateDict = null;
  21544. }
  21545. CFFTopDict.prototype = Object.create(CFFDict.prototype);
  21546. return CFFTopDict;
  21547. }();
  21548. var CFFPrivateDict = function CFFPrivateDictClosure() {
  21549. var layout = [
  21550. [
  21551. 6,
  21552. 'BlueValues',
  21553. 'delta',
  21554. null
  21555. ],
  21556. [
  21557. 7,
  21558. 'OtherBlues',
  21559. 'delta',
  21560. null
  21561. ],
  21562. [
  21563. 8,
  21564. 'FamilyBlues',
  21565. 'delta',
  21566. null
  21567. ],
  21568. [
  21569. 9,
  21570. 'FamilyOtherBlues',
  21571. 'delta',
  21572. null
  21573. ],
  21574. [
  21575. [
  21576. 12,
  21577. 9
  21578. ],
  21579. 'BlueScale',
  21580. 'num',
  21581. 0.039625
  21582. ],
  21583. [
  21584. [
  21585. 12,
  21586. 10
  21587. ],
  21588. 'BlueShift',
  21589. 'num',
  21590. 7
  21591. ],
  21592. [
  21593. [
  21594. 12,
  21595. 11
  21596. ],
  21597. 'BlueFuzz',
  21598. 'num',
  21599. 1
  21600. ],
  21601. [
  21602. 10,
  21603. 'StdHW',
  21604. 'num',
  21605. null
  21606. ],
  21607. [
  21608. 11,
  21609. 'StdVW',
  21610. 'num',
  21611. null
  21612. ],
  21613. [
  21614. [
  21615. 12,
  21616. 12
  21617. ],
  21618. 'StemSnapH',
  21619. 'delta',
  21620. null
  21621. ],
  21622. [
  21623. [
  21624. 12,
  21625. 13
  21626. ],
  21627. 'StemSnapV',
  21628. 'delta',
  21629. null
  21630. ],
  21631. [
  21632. [
  21633. 12,
  21634. 14
  21635. ],
  21636. 'ForceBold',
  21637. 'num',
  21638. 0
  21639. ],
  21640. [
  21641. [
  21642. 12,
  21643. 17
  21644. ],
  21645. 'LanguageGroup',
  21646. 'num',
  21647. 0
  21648. ],
  21649. [
  21650. [
  21651. 12,
  21652. 18
  21653. ],
  21654. 'ExpansionFactor',
  21655. 'num',
  21656. 0.06
  21657. ],
  21658. [
  21659. [
  21660. 12,
  21661. 19
  21662. ],
  21663. 'initialRandomSeed',
  21664. 'num',
  21665. 0
  21666. ],
  21667. [
  21668. 20,
  21669. 'defaultWidthX',
  21670. 'num',
  21671. 0
  21672. ],
  21673. [
  21674. 21,
  21675. 'nominalWidthX',
  21676. 'num',
  21677. 0
  21678. ],
  21679. [
  21680. 19,
  21681. 'Subrs',
  21682. 'offset',
  21683. null
  21684. ]
  21685. ];
  21686. var tables = null;
  21687. function CFFPrivateDict(strings) {
  21688. if (tables === null) {
  21689. tables = CFFDict.createTables(layout);
  21690. }
  21691. CFFDict.call(this, tables, strings);
  21692. this.subrsIndex = null;
  21693. }
  21694. CFFPrivateDict.prototype = Object.create(CFFDict.prototype);
  21695. return CFFPrivateDict;
  21696. }();
  21697. var CFFCharsetPredefinedTypes = {
  21698. ISO_ADOBE: 0,
  21699. EXPERT: 1,
  21700. EXPERT_SUBSET: 2
  21701. };
  21702. var CFFCharset = function CFFCharsetClosure() {
  21703. function CFFCharset(predefined, format, charset, raw) {
  21704. this.predefined = predefined;
  21705. this.format = format;
  21706. this.charset = charset;
  21707. this.raw = raw;
  21708. }
  21709. return CFFCharset;
  21710. }();
  21711. var CFFEncoding = function CFFEncodingClosure() {
  21712. function CFFEncoding(predefined, format, encoding, raw) {
  21713. this.predefined = predefined;
  21714. this.format = format;
  21715. this.encoding = encoding;
  21716. this.raw = raw;
  21717. }
  21718. return CFFEncoding;
  21719. }();
  21720. var CFFFDSelect = function CFFFDSelectClosure() {
  21721. function CFFFDSelect(fdSelect, raw) {
  21722. this.fdSelect = fdSelect;
  21723. this.raw = raw;
  21724. }
  21725. CFFFDSelect.prototype = {
  21726. getFDIndex: function CFFFDSelect_get(glyphIndex) {
  21727. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  21728. return -1;
  21729. }
  21730. return this.fdSelect[glyphIndex];
  21731. }
  21732. };
  21733. return CFFFDSelect;
  21734. }();
  21735. var CFFOffsetTracker = function CFFOffsetTrackerClosure() {
  21736. function CFFOffsetTracker() {
  21737. this.offsets = Object.create(null);
  21738. }
  21739. CFFOffsetTracker.prototype = {
  21740. isTracking: function CFFOffsetTracker_isTracking(key) {
  21741. return key in this.offsets;
  21742. },
  21743. track: function CFFOffsetTracker_track(key, location) {
  21744. if (key in this.offsets) {
  21745. error('Already tracking location of ' + key);
  21746. }
  21747. this.offsets[key] = location;
  21748. },
  21749. offset: function CFFOffsetTracker_offset(value) {
  21750. for (var key in this.offsets) {
  21751. this.offsets[key] += value;
  21752. }
  21753. },
  21754. setEntryLocation: function CFFOffsetTracker_setEntryLocation(key, values, output) {
  21755. if (!(key in this.offsets)) {
  21756. error('Not tracking location of ' + key);
  21757. }
  21758. var data = output.data;
  21759. var dataOffset = this.offsets[key];
  21760. var size = 5;
  21761. for (var i = 0, ii = values.length; i < ii; ++i) {
  21762. var offset0 = i * size + dataOffset;
  21763. var offset1 = offset0 + 1;
  21764. var offset2 = offset0 + 2;
  21765. var offset3 = offset0 + 3;
  21766. var offset4 = offset0 + 4;
  21767. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  21768. error('writing to an offset that is not empty');
  21769. }
  21770. var value = values[i];
  21771. data[offset0] = 0x1d;
  21772. data[offset1] = value >> 24 & 0xFF;
  21773. data[offset2] = value >> 16 & 0xFF;
  21774. data[offset3] = value >> 8 & 0xFF;
  21775. data[offset4] = value & 0xFF;
  21776. }
  21777. }
  21778. };
  21779. return CFFOffsetTracker;
  21780. }();
  21781. var CFFCompiler = function CFFCompilerClosure() {
  21782. function CFFCompiler(cff) {
  21783. this.cff = cff;
  21784. }
  21785. CFFCompiler.prototype = {
  21786. compile: function CFFCompiler_compile() {
  21787. var cff = this.cff;
  21788. var output = {
  21789. data: [],
  21790. length: 0,
  21791. add: function CFFCompiler_add(data) {
  21792. this.data = this.data.concat(data);
  21793. this.length = this.data.length;
  21794. }
  21795. };
  21796. var header = this.compileHeader(cff.header);
  21797. output.add(header);
  21798. var nameIndex = this.compileNameIndex(cff.names);
  21799. output.add(nameIndex);
  21800. if (cff.isCIDFont) {
  21801. if (cff.topDict.hasName('FontMatrix')) {
  21802. var base = cff.topDict.getByName('FontMatrix');
  21803. cff.topDict.removeByName('FontMatrix');
  21804. for (var i = 0, ii = cff.fdArray.length; i < ii; i++) {
  21805. var subDict = cff.fdArray[i];
  21806. var matrix = base.slice(0);
  21807. if (subDict.hasName('FontMatrix')) {
  21808. matrix = Util.transform(matrix, subDict.getByName('FontMatrix'));
  21809. }
  21810. subDict.setByName('FontMatrix', matrix);
  21811. }
  21812. }
  21813. }
  21814. var compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  21815. output.add(compiled.output);
  21816. var topDictTracker = compiled.trackers[0];
  21817. var stringIndex = this.compileStringIndex(cff.strings.strings);
  21818. output.add(stringIndex);
  21819. var globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  21820. output.add(globalSubrIndex);
  21821. if (cff.encoding && cff.topDict.hasName('Encoding')) {
  21822. if (cff.encoding.predefined) {
  21823. topDictTracker.setEntryLocation('Encoding', [cff.encoding.format], output);
  21824. } else {
  21825. var encoding = this.compileEncoding(cff.encoding);
  21826. topDictTracker.setEntryLocation('Encoding', [output.length], output);
  21827. output.add(encoding);
  21828. }
  21829. }
  21830. if (cff.charset && cff.topDict.hasName('charset')) {
  21831. if (cff.charset.predefined) {
  21832. topDictTracker.setEntryLocation('charset', [cff.charset.format], output);
  21833. } else {
  21834. var charset = this.compileCharset(cff.charset);
  21835. topDictTracker.setEntryLocation('charset', [output.length], output);
  21836. output.add(charset);
  21837. }
  21838. }
  21839. var charStrings = this.compileCharStrings(cff.charStrings);
  21840. topDictTracker.setEntryLocation('CharStrings', [output.length], output);
  21841. output.add(charStrings);
  21842. if (cff.isCIDFont) {
  21843. topDictTracker.setEntryLocation('FDSelect', [output.length], output);
  21844. var fdSelect = this.compileFDSelect(cff.fdSelect.raw);
  21845. output.add(fdSelect);
  21846. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  21847. topDictTracker.setEntryLocation('FDArray', [output.length], output);
  21848. output.add(compiled.output);
  21849. var fontDictTrackers = compiled.trackers;
  21850. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  21851. }
  21852. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  21853. output.add([0]);
  21854. return output.data;
  21855. },
  21856. encodeNumber: function CFFCompiler_encodeNumber(value) {
  21857. if (parseFloat(value) === parseInt(value, 10) && !isNaN(value)) {
  21858. return this.encodeInteger(value);
  21859. }
  21860. return this.encodeFloat(value);
  21861. },
  21862. encodeFloat: function CFFCompiler_encodeFloat(num) {
  21863. var value = num.toString();
  21864. var m = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value);
  21865. if (m) {
  21866. var epsilon = parseFloat('1e' + ((m[2] ? +m[2] : 0) + m[1].length));
  21867. value = (Math.round(num * epsilon) / epsilon).toString();
  21868. }
  21869. var nibbles = '';
  21870. var i, ii;
  21871. for (i = 0, ii = value.length; i < ii; ++i) {
  21872. var a = value[i];
  21873. if (a === 'e') {
  21874. nibbles += value[++i] === '-' ? 'c' : 'b';
  21875. } else if (a === '.') {
  21876. nibbles += 'a';
  21877. } else if (a === '-') {
  21878. nibbles += 'e';
  21879. } else {
  21880. nibbles += a;
  21881. }
  21882. }
  21883. nibbles += nibbles.length & 1 ? 'f' : 'ff';
  21884. var out = [30];
  21885. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  21886. out.push(parseInt(nibbles.substr(i, 2), 16));
  21887. }
  21888. return out;
  21889. },
  21890. encodeInteger: function CFFCompiler_encodeInteger(value) {
  21891. var code;
  21892. if (value >= -107 && value <= 107) {
  21893. code = [value + 139];
  21894. } else if (value >= 108 && value <= 1131) {
  21895. value = value - 108;
  21896. code = [
  21897. (value >> 8) + 247,
  21898. value & 0xFF
  21899. ];
  21900. } else if (value >= -1131 && value <= -108) {
  21901. value = -value - 108;
  21902. code = [
  21903. (value >> 8) + 251,
  21904. value & 0xFF
  21905. ];
  21906. } else if (value >= -32768 && value <= 32767) {
  21907. code = [
  21908. 0x1c,
  21909. value >> 8 & 0xFF,
  21910. value & 0xFF
  21911. ];
  21912. } else {
  21913. code = [
  21914. 0x1d,
  21915. value >> 24 & 0xFF,
  21916. value >> 16 & 0xFF,
  21917. value >> 8 & 0xFF,
  21918. value & 0xFF
  21919. ];
  21920. }
  21921. return code;
  21922. },
  21923. compileHeader: function CFFCompiler_compileHeader(header) {
  21924. return [
  21925. header.major,
  21926. header.minor,
  21927. header.hdrSize,
  21928. header.offSize
  21929. ];
  21930. },
  21931. compileNameIndex: function CFFCompiler_compileNameIndex(names) {
  21932. var nameIndex = new CFFIndex();
  21933. for (var i = 0, ii = names.length; i < ii; ++i) {
  21934. nameIndex.add(stringToBytes(names[i]));
  21935. }
  21936. return this.compileIndex(nameIndex);
  21937. },
  21938. compileTopDicts: function CFFCompiler_compileTopDicts(dicts, length, removeCidKeys) {
  21939. var fontDictTrackers = [];
  21940. var fdArrayIndex = new CFFIndex();
  21941. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  21942. var fontDict = dicts[i];
  21943. if (removeCidKeys) {
  21944. fontDict.removeByName('CIDFontVersion');
  21945. fontDict.removeByName('CIDFontRevision');
  21946. fontDict.removeByName('CIDFontType');
  21947. fontDict.removeByName('CIDCount');
  21948. fontDict.removeByName('UIDBase');
  21949. }
  21950. var fontDictTracker = new CFFOffsetTracker();
  21951. var fontDictData = this.compileDict(fontDict, fontDictTracker);
  21952. fontDictTrackers.push(fontDictTracker);
  21953. fdArrayIndex.add(fontDictData);
  21954. fontDictTracker.offset(length);
  21955. }
  21956. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  21957. return {
  21958. trackers: fontDictTrackers,
  21959. output: fdArrayIndex
  21960. };
  21961. },
  21962. compilePrivateDicts: function CFFCompiler_compilePrivateDicts(dicts, trackers, output) {
  21963. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  21964. var fontDict = dicts[i];
  21965. assert(fontDict.privateDict && fontDict.hasName('Private'), 'There must be an private dictionary.');
  21966. var privateDict = fontDict.privateDict;
  21967. var privateDictTracker = new CFFOffsetTracker();
  21968. var privateDictData = this.compileDict(privateDict, privateDictTracker);
  21969. var outputLength = output.length;
  21970. privateDictTracker.offset(outputLength);
  21971. if (!privateDictData.length) {
  21972. outputLength = 0;
  21973. }
  21974. trackers[i].setEntryLocation('Private', [
  21975. privateDictData.length,
  21976. outputLength
  21977. ], output);
  21978. output.add(privateDictData);
  21979. if (privateDict.subrsIndex && privateDict.hasName('Subrs')) {
  21980. var subrs = this.compileIndex(privateDict.subrsIndex);
  21981. privateDictTracker.setEntryLocation('Subrs', [privateDictData.length], output);
  21982. output.add(subrs);
  21983. }
  21984. }
  21985. },
  21986. compileDict: function CFFCompiler_compileDict(dict, offsetTracker) {
  21987. var out = [];
  21988. var order = dict.order;
  21989. for (var i = 0; i < order.length; ++i) {
  21990. var key = order[i];
  21991. if (!(key in dict.values)) {
  21992. continue;
  21993. }
  21994. var values = dict.values[key];
  21995. var types = dict.types[key];
  21996. if (!isArray(types)) {
  21997. types = [types];
  21998. }
  21999. if (!isArray(values)) {
  22000. values = [values];
  22001. }
  22002. if (values.length === 0) {
  22003. continue;
  22004. }
  22005. for (var j = 0, jj = types.length; j < jj; ++j) {
  22006. var type = types[j];
  22007. var value = values[j];
  22008. switch (type) {
  22009. case 'num':
  22010. case 'sid':
  22011. out = out.concat(this.encodeNumber(value));
  22012. break;
  22013. case 'offset':
  22014. var name = dict.keyToNameMap[key];
  22015. if (!offsetTracker.isTracking(name)) {
  22016. offsetTracker.track(name, out.length);
  22017. }
  22018. out = out.concat([
  22019. 0x1d,
  22020. 0,
  22021. 0,
  22022. 0,
  22023. 0
  22024. ]);
  22025. break;
  22026. case 'array':
  22027. case 'delta':
  22028. out = out.concat(this.encodeNumber(value));
  22029. for (var k = 1, kk = values.length; k < kk; ++k) {
  22030. out = out.concat(this.encodeNumber(values[k]));
  22031. }
  22032. break;
  22033. default:
  22034. error('Unknown data type of ' + type);
  22035. break;
  22036. }
  22037. }
  22038. out = out.concat(dict.opcodes[key]);
  22039. }
  22040. return out;
  22041. },
  22042. compileStringIndex: function CFFCompiler_compileStringIndex(strings) {
  22043. var stringIndex = new CFFIndex();
  22044. for (var i = 0, ii = strings.length; i < ii; ++i) {
  22045. stringIndex.add(stringToBytes(strings[i]));
  22046. }
  22047. return this.compileIndex(stringIndex);
  22048. },
  22049. compileGlobalSubrIndex: function CFFCompiler_compileGlobalSubrIndex() {
  22050. var globalSubrIndex = this.cff.globalSubrIndex;
  22051. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  22052. },
  22053. compileCharStrings: function CFFCompiler_compileCharStrings(charStrings) {
  22054. return this.compileIndex(charStrings);
  22055. },
  22056. compileCharset: function CFFCompiler_compileCharset(charset) {
  22057. return this.compileTypedArray(charset.raw);
  22058. },
  22059. compileEncoding: function CFFCompiler_compileEncoding(encoding) {
  22060. return this.compileTypedArray(encoding.raw);
  22061. },
  22062. compileFDSelect: function CFFCompiler_compileFDSelect(fdSelect) {
  22063. return this.compileTypedArray(fdSelect);
  22064. },
  22065. compileTypedArray: function CFFCompiler_compileTypedArray(data) {
  22066. var out = [];
  22067. for (var i = 0, ii = data.length; i < ii; ++i) {
  22068. out[i] = data[i];
  22069. }
  22070. return out;
  22071. },
  22072. compileIndex: function CFFCompiler_compileIndex(index, trackers) {
  22073. trackers = trackers || [];
  22074. var objects = index.objects;
  22075. var count = objects.length;
  22076. if (count === 0) {
  22077. return [
  22078. 0,
  22079. 0,
  22080. 0
  22081. ];
  22082. }
  22083. var data = [
  22084. count >> 8 & 0xFF,
  22085. count & 0xff
  22086. ];
  22087. var lastOffset = 1, i;
  22088. for (i = 0; i < count; ++i) {
  22089. lastOffset += objects[i].length;
  22090. }
  22091. var offsetSize;
  22092. if (lastOffset < 0x100) {
  22093. offsetSize = 1;
  22094. } else if (lastOffset < 0x10000) {
  22095. offsetSize = 2;
  22096. } else if (lastOffset < 0x1000000) {
  22097. offsetSize = 3;
  22098. } else {
  22099. offsetSize = 4;
  22100. }
  22101. data.push(offsetSize);
  22102. var relativeOffset = 1;
  22103. for (i = 0; i < count + 1; i++) {
  22104. if (offsetSize === 1) {
  22105. data.push(relativeOffset & 0xFF);
  22106. } else if (offsetSize === 2) {
  22107. data.push(relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  22108. } else if (offsetSize === 3) {
  22109. data.push(relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  22110. } else {
  22111. data.push(relativeOffset >>> 24 & 0xFF, relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  22112. }
  22113. if (objects[i]) {
  22114. relativeOffset += objects[i].length;
  22115. }
  22116. }
  22117. for (i = 0; i < count; i++) {
  22118. if (trackers[i]) {
  22119. trackers[i].offset(data.length);
  22120. }
  22121. for (var j = 0, jj = objects[i].length; j < jj; j++) {
  22122. data.push(objects[i][j]);
  22123. }
  22124. }
  22125. return data;
  22126. }
  22127. };
  22128. return CFFCompiler;
  22129. }();
  22130. exports.CFFStandardStrings = CFFStandardStrings;
  22131. exports.CFFParser = CFFParser;
  22132. exports.CFF = CFF;
  22133. exports.CFFHeader = CFFHeader;
  22134. exports.CFFStrings = CFFStrings;
  22135. exports.CFFIndex = CFFIndex;
  22136. exports.CFFCharset = CFFCharset;
  22137. exports.CFFTopDict = CFFTopDict;
  22138. exports.CFFPrivateDict = CFFPrivateDict;
  22139. exports.CFFCompiler = CFFCompiler;
  22140. /***/ }),
  22141. /* 11 */
  22142. /***/ (function(module, exports, __w_pdfjs_require__) {
  22143. "use strict";
  22144. var sharedUtil = __w_pdfjs_require__(0);
  22145. var MissingDataException = sharedUtil.MissingDataException;
  22146. var arrayByteLength = sharedUtil.arrayByteLength;
  22147. var arraysToBytes = sharedUtil.arraysToBytes;
  22148. var assert = sharedUtil.assert;
  22149. var createPromiseCapability = sharedUtil.createPromiseCapability;
  22150. var isInt = sharedUtil.isInt;
  22151. var isEmptyObj = sharedUtil.isEmptyObj;
  22152. var ChunkedStream = function ChunkedStreamClosure() {
  22153. function ChunkedStream(length, chunkSize, manager) {
  22154. this.bytes = new Uint8Array(length);
  22155. this.start = 0;
  22156. this.pos = 0;
  22157. this.end = length;
  22158. this.chunkSize = chunkSize;
  22159. this.loadedChunks = [];
  22160. this.numChunksLoaded = 0;
  22161. this.numChunks = Math.ceil(length / chunkSize);
  22162. this.manager = manager;
  22163. this.progressiveDataLength = 0;
  22164. this.lastSuccessfulEnsureByteChunk = -1;
  22165. }
  22166. ChunkedStream.prototype = {
  22167. getMissingChunks: function ChunkedStream_getMissingChunks() {
  22168. var chunks = [];
  22169. for (var chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  22170. if (!this.loadedChunks[chunk]) {
  22171. chunks.push(chunk);
  22172. }
  22173. }
  22174. return chunks;
  22175. },
  22176. getBaseStreams: function ChunkedStream_getBaseStreams() {
  22177. return [this];
  22178. },
  22179. allChunksLoaded: function ChunkedStream_allChunksLoaded() {
  22180. return this.numChunksLoaded === this.numChunks;
  22181. },
  22182. onReceiveData: function ChunkedStream_onReceiveData(begin, chunk) {
  22183. var end = begin + chunk.byteLength;
  22184. assert(begin % this.chunkSize === 0, 'Bad begin offset: ' + begin);
  22185. var length = this.bytes.length;
  22186. assert(end % this.chunkSize === 0 || end === length, 'Bad end offset: ' + end);
  22187. this.bytes.set(new Uint8Array(chunk), begin);
  22188. var chunkSize = this.chunkSize;
  22189. var beginChunk = Math.floor(begin / chunkSize);
  22190. var endChunk = Math.floor((end - 1) / chunkSize) + 1;
  22191. var curChunk;
  22192. for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  22193. if (!this.loadedChunks[curChunk]) {
  22194. this.loadedChunks[curChunk] = true;
  22195. ++this.numChunksLoaded;
  22196. }
  22197. }
  22198. },
  22199. onReceiveProgressiveData: function ChunkedStream_onReceiveProgressiveData(data) {
  22200. var position = this.progressiveDataLength;
  22201. var beginChunk = Math.floor(position / this.chunkSize);
  22202. this.bytes.set(new Uint8Array(data), position);
  22203. position += data.byteLength;
  22204. this.progressiveDataLength = position;
  22205. var endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  22206. var curChunk;
  22207. for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  22208. if (!this.loadedChunks[curChunk]) {
  22209. this.loadedChunks[curChunk] = true;
  22210. ++this.numChunksLoaded;
  22211. }
  22212. }
  22213. },
  22214. ensureByte: function ChunkedStream_ensureByte(pos) {
  22215. var chunk = Math.floor(pos / this.chunkSize);
  22216. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  22217. return;
  22218. }
  22219. if (!this.loadedChunks[chunk]) {
  22220. throw new MissingDataException(pos, pos + 1);
  22221. }
  22222. this.lastSuccessfulEnsureByteChunk = chunk;
  22223. },
  22224. ensureRange: function ChunkedStream_ensureRange(begin, end) {
  22225. if (begin >= end) {
  22226. return;
  22227. }
  22228. if (end <= this.progressiveDataLength) {
  22229. return;
  22230. }
  22231. var chunkSize = this.chunkSize;
  22232. var beginChunk = Math.floor(begin / chunkSize);
  22233. var endChunk = Math.floor((end - 1) / chunkSize) + 1;
  22234. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  22235. if (!this.loadedChunks[chunk]) {
  22236. throw new MissingDataException(begin, end);
  22237. }
  22238. }
  22239. },
  22240. nextEmptyChunk: function ChunkedStream_nextEmptyChunk(beginChunk) {
  22241. var chunk, numChunks = this.numChunks;
  22242. for (var i = 0; i < numChunks; ++i) {
  22243. chunk = (beginChunk + i) % numChunks;
  22244. if (!this.loadedChunks[chunk]) {
  22245. return chunk;
  22246. }
  22247. }
  22248. return null;
  22249. },
  22250. hasChunk: function ChunkedStream_hasChunk(chunk) {
  22251. return !!this.loadedChunks[chunk];
  22252. },
  22253. get length() {
  22254. return this.end - this.start;
  22255. },
  22256. get isEmpty() {
  22257. return this.length === 0;
  22258. },
  22259. getByte: function ChunkedStream_getByte() {
  22260. var pos = this.pos;
  22261. if (pos >= this.end) {
  22262. return -1;
  22263. }
  22264. this.ensureByte(pos);
  22265. return this.bytes[this.pos++];
  22266. },
  22267. getUint16: function ChunkedStream_getUint16() {
  22268. var b0 = this.getByte();
  22269. var b1 = this.getByte();
  22270. if (b0 === -1 || b1 === -1) {
  22271. return -1;
  22272. }
  22273. return (b0 << 8) + b1;
  22274. },
  22275. getInt32: function ChunkedStream_getInt32() {
  22276. var b0 = this.getByte();
  22277. var b1 = this.getByte();
  22278. var b2 = this.getByte();
  22279. var b3 = this.getByte();
  22280. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  22281. },
  22282. getBytes: function ChunkedStream_getBytes(length) {
  22283. var bytes = this.bytes;
  22284. var pos = this.pos;
  22285. var strEnd = this.end;
  22286. if (!length) {
  22287. this.ensureRange(pos, strEnd);
  22288. return bytes.subarray(pos, strEnd);
  22289. }
  22290. var end = pos + length;
  22291. if (end > strEnd) {
  22292. end = strEnd;
  22293. }
  22294. this.ensureRange(pos, end);
  22295. this.pos = end;
  22296. return bytes.subarray(pos, end);
  22297. },
  22298. peekByte: function ChunkedStream_peekByte() {
  22299. var peekedByte = this.getByte();
  22300. this.pos--;
  22301. return peekedByte;
  22302. },
  22303. peekBytes: function ChunkedStream_peekBytes(length) {
  22304. var bytes = this.getBytes(length);
  22305. this.pos -= bytes.length;
  22306. return bytes;
  22307. },
  22308. getByteRange: function ChunkedStream_getBytes(begin, end) {
  22309. this.ensureRange(begin, end);
  22310. return this.bytes.subarray(begin, end);
  22311. },
  22312. skip: function ChunkedStream_skip(n) {
  22313. if (!n) {
  22314. n = 1;
  22315. }
  22316. this.pos += n;
  22317. },
  22318. reset: function ChunkedStream_reset() {
  22319. this.pos = this.start;
  22320. },
  22321. moveStart: function ChunkedStream_moveStart() {
  22322. this.start = this.pos;
  22323. },
  22324. makeSubStream: function ChunkedStream_makeSubStream(start, length, dict) {
  22325. this.ensureRange(start, start + length);
  22326. function ChunkedStreamSubstream() {
  22327. }
  22328. ChunkedStreamSubstream.prototype = Object.create(this);
  22329. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  22330. var chunkSize = this.chunkSize;
  22331. var beginChunk = Math.floor(this.start / chunkSize);
  22332. var endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  22333. var missingChunks = [];
  22334. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  22335. if (!this.loadedChunks[chunk]) {
  22336. missingChunks.push(chunk);
  22337. }
  22338. }
  22339. return missingChunks;
  22340. };
  22341. var subStream = new ChunkedStreamSubstream();
  22342. subStream.pos = subStream.start = start;
  22343. subStream.end = start + length || this.end;
  22344. subStream.dict = dict;
  22345. return subStream;
  22346. }
  22347. };
  22348. return ChunkedStream;
  22349. }();
  22350. var ChunkedStreamManager = function ChunkedStreamManagerClosure() {
  22351. function ChunkedStreamManager(pdfNetworkStream, args) {
  22352. var chunkSize = args.rangeChunkSize;
  22353. var length = args.length;
  22354. this.stream = new ChunkedStream(length, chunkSize, this);
  22355. this.length = length;
  22356. this.chunkSize = chunkSize;
  22357. this.pdfNetworkStream = pdfNetworkStream;
  22358. this.url = args.url;
  22359. this.disableAutoFetch = args.disableAutoFetch;
  22360. this.msgHandler = args.msgHandler;
  22361. this.currRequestId = 0;
  22362. this.chunksNeededByRequest = Object.create(null);
  22363. this.requestsByChunk = Object.create(null);
  22364. this.promisesByRequest = Object.create(null);
  22365. this.progressiveDataLength = 0;
  22366. this.aborted = false;
  22367. this._loadedStreamCapability = createPromiseCapability();
  22368. }
  22369. ChunkedStreamManager.prototype = {
  22370. onLoadedStream: function ChunkedStreamManager_getLoadedStream() {
  22371. return this._loadedStreamCapability.promise;
  22372. },
  22373. sendRequest: function ChunkedStreamManager_sendRequest(begin, end) {
  22374. var rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  22375. if (!rangeReader.isStreamingSupported) {
  22376. rangeReader.onProgress = this.onProgress.bind(this);
  22377. }
  22378. var chunks = [], loaded = 0;
  22379. var manager = this;
  22380. var promise = new Promise(function (resolve, reject) {
  22381. var readChunk = function (chunk) {
  22382. try {
  22383. if (!chunk.done) {
  22384. var data = chunk.value;
  22385. chunks.push(data);
  22386. loaded += arrayByteLength(data);
  22387. if (rangeReader.isStreamingSupported) {
  22388. manager.onProgress({ loaded: loaded });
  22389. }
  22390. rangeReader.read().then(readChunk, reject);
  22391. return;
  22392. }
  22393. var chunkData = arraysToBytes(chunks);
  22394. chunks = null;
  22395. resolve(chunkData);
  22396. } catch (e) {
  22397. reject(e);
  22398. }
  22399. };
  22400. rangeReader.read().then(readChunk, reject);
  22401. });
  22402. promise.then(function (data) {
  22403. if (this.aborted) {
  22404. return;
  22405. }
  22406. this.onReceiveData({
  22407. chunk: data,
  22408. begin: begin
  22409. });
  22410. }.bind(this));
  22411. },
  22412. requestAllChunks: function ChunkedStreamManager_requestAllChunks() {
  22413. var missingChunks = this.stream.getMissingChunks();
  22414. this._requestChunks(missingChunks);
  22415. return this._loadedStreamCapability.promise;
  22416. },
  22417. _requestChunks: function ChunkedStreamManager_requestChunks(chunks) {
  22418. var requestId = this.currRequestId++;
  22419. var i, ii;
  22420. var chunksNeeded = Object.create(null);
  22421. this.chunksNeededByRequest[requestId] = chunksNeeded;
  22422. for (i = 0, ii = chunks.length; i < ii; i++) {
  22423. if (!this.stream.hasChunk(chunks[i])) {
  22424. chunksNeeded[chunks[i]] = true;
  22425. }
  22426. }
  22427. if (isEmptyObj(chunksNeeded)) {
  22428. return Promise.resolve();
  22429. }
  22430. var capability = createPromiseCapability();
  22431. this.promisesByRequest[requestId] = capability;
  22432. var chunksToRequest = [];
  22433. for (var chunk in chunksNeeded) {
  22434. chunk = chunk | 0;
  22435. if (!(chunk in this.requestsByChunk)) {
  22436. this.requestsByChunk[chunk] = [];
  22437. chunksToRequest.push(chunk);
  22438. }
  22439. this.requestsByChunk[chunk].push(requestId);
  22440. }
  22441. if (!chunksToRequest.length) {
  22442. return capability.promise;
  22443. }
  22444. var groupedChunksToRequest = this.groupChunks(chunksToRequest);
  22445. for (i = 0; i < groupedChunksToRequest.length; ++i) {
  22446. var groupedChunk = groupedChunksToRequest[i];
  22447. var begin = groupedChunk.beginChunk * this.chunkSize;
  22448. var end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  22449. this.sendRequest(begin, end);
  22450. }
  22451. return capability.promise;
  22452. },
  22453. getStream: function ChunkedStreamManager_getStream() {
  22454. return this.stream;
  22455. },
  22456. requestRange: function ChunkedStreamManager_requestRange(begin, end) {
  22457. end = Math.min(end, this.length);
  22458. var beginChunk = this.getBeginChunk(begin);
  22459. var endChunk = this.getEndChunk(end);
  22460. var chunks = [];
  22461. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  22462. chunks.push(chunk);
  22463. }
  22464. return this._requestChunks(chunks);
  22465. },
  22466. requestRanges: function ChunkedStreamManager_requestRanges(ranges) {
  22467. ranges = ranges || [];
  22468. var chunksToRequest = [];
  22469. for (var i = 0; i < ranges.length; i++) {
  22470. var beginChunk = this.getBeginChunk(ranges[i].begin);
  22471. var endChunk = this.getEndChunk(ranges[i].end);
  22472. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  22473. if (chunksToRequest.indexOf(chunk) < 0) {
  22474. chunksToRequest.push(chunk);
  22475. }
  22476. }
  22477. }
  22478. chunksToRequest.sort(function (a, b) {
  22479. return a - b;
  22480. });
  22481. return this._requestChunks(chunksToRequest);
  22482. },
  22483. groupChunks: function ChunkedStreamManager_groupChunks(chunks) {
  22484. var groupedChunks = [];
  22485. var beginChunk = -1;
  22486. var prevChunk = -1;
  22487. for (var i = 0; i < chunks.length; ++i) {
  22488. var chunk = chunks[i];
  22489. if (beginChunk < 0) {
  22490. beginChunk = chunk;
  22491. }
  22492. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  22493. groupedChunks.push({
  22494. beginChunk: beginChunk,
  22495. endChunk: prevChunk + 1
  22496. });
  22497. beginChunk = chunk;
  22498. }
  22499. if (i + 1 === chunks.length) {
  22500. groupedChunks.push({
  22501. beginChunk: beginChunk,
  22502. endChunk: chunk + 1
  22503. });
  22504. }
  22505. prevChunk = chunk;
  22506. }
  22507. return groupedChunks;
  22508. },
  22509. onProgress: function ChunkedStreamManager_onProgress(args) {
  22510. var bytesLoaded = this.stream.numChunksLoaded * this.chunkSize + args.loaded;
  22511. this.msgHandler.send('DocProgress', {
  22512. loaded: bytesLoaded,
  22513. total: this.length
  22514. });
  22515. },
  22516. onReceiveData: function ChunkedStreamManager_onReceiveData(args) {
  22517. var chunk = args.chunk;
  22518. var isProgressive = args.begin === undefined;
  22519. var begin = isProgressive ? this.progressiveDataLength : args.begin;
  22520. var end = begin + chunk.byteLength;
  22521. var beginChunk = Math.floor(begin / this.chunkSize);
  22522. var endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  22523. if (isProgressive) {
  22524. this.stream.onReceiveProgressiveData(chunk);
  22525. this.progressiveDataLength = end;
  22526. } else {
  22527. this.stream.onReceiveData(begin, chunk);
  22528. }
  22529. if (this.stream.allChunksLoaded()) {
  22530. this._loadedStreamCapability.resolve(this.stream);
  22531. }
  22532. var loadedRequests = [];
  22533. var i, requestId;
  22534. for (chunk = beginChunk; chunk < endChunk; ++chunk) {
  22535. var requestIds = this.requestsByChunk[chunk] || [];
  22536. delete this.requestsByChunk[chunk];
  22537. for (i = 0; i < requestIds.length; ++i) {
  22538. requestId = requestIds[i];
  22539. var chunksNeeded = this.chunksNeededByRequest[requestId];
  22540. if (chunk in chunksNeeded) {
  22541. delete chunksNeeded[chunk];
  22542. }
  22543. if (!isEmptyObj(chunksNeeded)) {
  22544. continue;
  22545. }
  22546. loadedRequests.push(requestId);
  22547. }
  22548. }
  22549. if (!this.disableAutoFetch && isEmptyObj(this.requestsByChunk)) {
  22550. var nextEmptyChunk;
  22551. if (this.stream.numChunksLoaded === 1) {
  22552. var lastChunk = this.stream.numChunks - 1;
  22553. if (!this.stream.hasChunk(lastChunk)) {
  22554. nextEmptyChunk = lastChunk;
  22555. }
  22556. } else {
  22557. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  22558. }
  22559. if (isInt(nextEmptyChunk)) {
  22560. this._requestChunks([nextEmptyChunk]);
  22561. }
  22562. }
  22563. for (i = 0; i < loadedRequests.length; ++i) {
  22564. requestId = loadedRequests[i];
  22565. var capability = this.promisesByRequest[requestId];
  22566. delete this.promisesByRequest[requestId];
  22567. capability.resolve();
  22568. }
  22569. this.msgHandler.send('DocProgress', {
  22570. loaded: this.stream.numChunksLoaded * this.chunkSize,
  22571. total: this.length
  22572. });
  22573. },
  22574. onError: function ChunkedStreamManager_onError(err) {
  22575. this._loadedStreamCapability.reject(err);
  22576. },
  22577. getBeginChunk: function ChunkedStreamManager_getBeginChunk(begin) {
  22578. var chunk = Math.floor(begin / this.chunkSize);
  22579. return chunk;
  22580. },
  22581. getEndChunk: function ChunkedStreamManager_getEndChunk(end) {
  22582. var chunk = Math.floor((end - 1) / this.chunkSize) + 1;
  22583. return chunk;
  22584. },
  22585. abort: function ChunkedStreamManager_abort() {
  22586. this.aborted = true;
  22587. if (this.pdfNetworkStream) {
  22588. this.pdfNetworkStream.cancelAllRequests('abort');
  22589. }
  22590. for (var requestId in this.promisesByRequest) {
  22591. var capability = this.promisesByRequest[requestId];
  22592. capability.reject(new Error('Request was aborted'));
  22593. }
  22594. }
  22595. };
  22596. return ChunkedStreamManager;
  22597. }();
  22598. exports.ChunkedStream = ChunkedStream;
  22599. exports.ChunkedStreamManager = ChunkedStreamManager;
  22600. /***/ }),
  22601. /* 12 */
  22602. /***/ (function(module, exports, __w_pdfjs_require__) {
  22603. "use strict";
  22604. var sharedUtil = __w_pdfjs_require__(0);
  22605. var corePrimitives = __w_pdfjs_require__(1);
  22606. var coreStream = __w_pdfjs_require__(2);
  22607. var PasswordException = sharedUtil.PasswordException;
  22608. var PasswordResponses = sharedUtil.PasswordResponses;
  22609. var bytesToString = sharedUtil.bytesToString;
  22610. var warn = sharedUtil.warn;
  22611. var error = sharedUtil.error;
  22612. var assert = sharedUtil.assert;
  22613. var isInt = sharedUtil.isInt;
  22614. var stringToBytes = sharedUtil.stringToBytes;
  22615. var utf8StringToString = sharedUtil.utf8StringToString;
  22616. var Name = corePrimitives.Name;
  22617. var isName = corePrimitives.isName;
  22618. var isDict = corePrimitives.isDict;
  22619. var DecryptStream = coreStream.DecryptStream;
  22620. var ARCFourCipher = function ARCFourCipherClosure() {
  22621. function ARCFourCipher(key) {
  22622. this.a = 0;
  22623. this.b = 0;
  22624. var s = new Uint8Array(256);
  22625. var i, j = 0, tmp, keyLength = key.length;
  22626. for (i = 0; i < 256; ++i) {
  22627. s[i] = i;
  22628. }
  22629. for (i = 0; i < 256; ++i) {
  22630. tmp = s[i];
  22631. j = j + tmp + key[i % keyLength] & 0xFF;
  22632. s[i] = s[j];
  22633. s[j] = tmp;
  22634. }
  22635. this.s = s;
  22636. }
  22637. ARCFourCipher.prototype = {
  22638. encryptBlock: function ARCFourCipher_encryptBlock(data) {
  22639. var i, n = data.length, tmp, tmp2;
  22640. var a = this.a, b = this.b, s = this.s;
  22641. var output = new Uint8Array(n);
  22642. for (i = 0; i < n; ++i) {
  22643. a = a + 1 & 0xFF;
  22644. tmp = s[a];
  22645. b = b + tmp & 0xFF;
  22646. tmp2 = s[b];
  22647. s[a] = tmp2;
  22648. s[b] = tmp;
  22649. output[i] = data[i] ^ s[tmp + tmp2 & 0xFF];
  22650. }
  22651. this.a = a;
  22652. this.b = b;
  22653. return output;
  22654. }
  22655. };
  22656. ARCFourCipher.prototype.decryptBlock = ARCFourCipher.prototype.encryptBlock;
  22657. return ARCFourCipher;
  22658. }();
  22659. var calculateMD5 = function calculateMD5Closure() {
  22660. var r = new Uint8Array([
  22661. 7,
  22662. 12,
  22663. 17,
  22664. 22,
  22665. 7,
  22666. 12,
  22667. 17,
  22668. 22,
  22669. 7,
  22670. 12,
  22671. 17,
  22672. 22,
  22673. 7,
  22674. 12,
  22675. 17,
  22676. 22,
  22677. 5,
  22678. 9,
  22679. 14,
  22680. 20,
  22681. 5,
  22682. 9,
  22683. 14,
  22684. 20,
  22685. 5,
  22686. 9,
  22687. 14,
  22688. 20,
  22689. 5,
  22690. 9,
  22691. 14,
  22692. 20,
  22693. 4,
  22694. 11,
  22695. 16,
  22696. 23,
  22697. 4,
  22698. 11,
  22699. 16,
  22700. 23,
  22701. 4,
  22702. 11,
  22703. 16,
  22704. 23,
  22705. 4,
  22706. 11,
  22707. 16,
  22708. 23,
  22709. 6,
  22710. 10,
  22711. 15,
  22712. 21,
  22713. 6,
  22714. 10,
  22715. 15,
  22716. 21,
  22717. 6,
  22718. 10,
  22719. 15,
  22720. 21,
  22721. 6,
  22722. 10,
  22723. 15,
  22724. 21
  22725. ]);
  22726. var k = new Int32Array([
  22727. -680876936,
  22728. -389564586,
  22729. 606105819,
  22730. -1044525330,
  22731. -176418897,
  22732. 1200080426,
  22733. -1473231341,
  22734. -45705983,
  22735. 1770035416,
  22736. -1958414417,
  22737. -42063,
  22738. -1990404162,
  22739. 1804603682,
  22740. -40341101,
  22741. -1502002290,
  22742. 1236535329,
  22743. -165796510,
  22744. -1069501632,
  22745. 643717713,
  22746. -373897302,
  22747. -701558691,
  22748. 38016083,
  22749. -660478335,
  22750. -405537848,
  22751. 568446438,
  22752. -1019803690,
  22753. -187363961,
  22754. 1163531501,
  22755. -1444681467,
  22756. -51403784,
  22757. 1735328473,
  22758. -1926607734,
  22759. -378558,
  22760. -2022574463,
  22761. 1839030562,
  22762. -35309556,
  22763. -1530992060,
  22764. 1272893353,
  22765. -155497632,
  22766. -1094730640,
  22767. 681279174,
  22768. -358537222,
  22769. -722521979,
  22770. 76029189,
  22771. -640364487,
  22772. -421815835,
  22773. 530742520,
  22774. -995338651,
  22775. -198630844,
  22776. 1126891415,
  22777. -1416354905,
  22778. -57434055,
  22779. 1700485571,
  22780. -1894986606,
  22781. -1051523,
  22782. -2054922799,
  22783. 1873313359,
  22784. -30611744,
  22785. -1560198380,
  22786. 1309151649,
  22787. -145523070,
  22788. -1120210379,
  22789. 718787259,
  22790. -343485551
  22791. ]);
  22792. function hash(data, offset, length) {
  22793. var h0 = 1732584193, h1 = -271733879, h2 = -1732584194, h3 = 271733878;
  22794. var paddedLength = length + 72 & ~63;
  22795. var padded = new Uint8Array(paddedLength);
  22796. var i, j, n;
  22797. for (i = 0; i < length; ++i) {
  22798. padded[i] = data[offset++];
  22799. }
  22800. padded[i++] = 0x80;
  22801. n = paddedLength - 8;
  22802. while (i < n) {
  22803. padded[i++] = 0;
  22804. }
  22805. padded[i++] = length << 3 & 0xFF;
  22806. padded[i++] = length >> 5 & 0xFF;
  22807. padded[i++] = length >> 13 & 0xFF;
  22808. padded[i++] = length >> 21 & 0xFF;
  22809. padded[i++] = length >>> 29 & 0xFF;
  22810. padded[i++] = 0;
  22811. padded[i++] = 0;
  22812. padded[i++] = 0;
  22813. var w = new Int32Array(16);
  22814. for (i = 0; i < paddedLength;) {
  22815. for (j = 0; j < 16; ++j, i += 4) {
  22816. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  22817. }
  22818. var a = h0, b = h1, c = h2, d = h3, f, g;
  22819. for (j = 0; j < 64; ++j) {
  22820. if (j < 16) {
  22821. f = b & c | ~b & d;
  22822. g = j;
  22823. } else if (j < 32) {
  22824. f = d & b | ~d & c;
  22825. g = 5 * j + 1 & 15;
  22826. } else if (j < 48) {
  22827. f = b ^ c ^ d;
  22828. g = 3 * j + 5 & 15;
  22829. } else {
  22830. f = c ^ (b | ~d);
  22831. g = 7 * j & 15;
  22832. }
  22833. var tmp = d, rotateArg = a + f + k[j] + w[g] | 0, rotate = r[j];
  22834. d = c;
  22835. c = b;
  22836. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  22837. a = tmp;
  22838. }
  22839. h0 = h0 + a | 0;
  22840. h1 = h1 + b | 0;
  22841. h2 = h2 + c | 0;
  22842. h3 = h3 + d | 0;
  22843. }
  22844. return new Uint8Array([
  22845. h0 & 0xFF,
  22846. h0 >> 8 & 0xFF,
  22847. h0 >> 16 & 0xFF,
  22848. h0 >>> 24 & 0xFF,
  22849. h1 & 0xFF,
  22850. h1 >> 8 & 0xFF,
  22851. h1 >> 16 & 0xFF,
  22852. h1 >>> 24 & 0xFF,
  22853. h2 & 0xFF,
  22854. h2 >> 8 & 0xFF,
  22855. h2 >> 16 & 0xFF,
  22856. h2 >>> 24 & 0xFF,
  22857. h3 & 0xFF,
  22858. h3 >> 8 & 0xFF,
  22859. h3 >> 16 & 0xFF,
  22860. h3 >>> 24 & 0xFF
  22861. ]);
  22862. }
  22863. return hash;
  22864. }();
  22865. var Word64 = function Word64Closure() {
  22866. function Word64(highInteger, lowInteger) {
  22867. this.high = highInteger | 0;
  22868. this.low = lowInteger | 0;
  22869. }
  22870. Word64.prototype = {
  22871. and: function Word64_and(word) {
  22872. this.high &= word.high;
  22873. this.low &= word.low;
  22874. },
  22875. xor: function Word64_xor(word) {
  22876. this.high ^= word.high;
  22877. this.low ^= word.low;
  22878. },
  22879. or: function Word64_or(word) {
  22880. this.high |= word.high;
  22881. this.low |= word.low;
  22882. },
  22883. shiftRight: function Word64_shiftRight(places) {
  22884. if (places >= 32) {
  22885. this.low = this.high >>> places - 32 | 0;
  22886. this.high = 0;
  22887. } else {
  22888. this.low = this.low >>> places | this.high << 32 - places;
  22889. this.high = this.high >>> places | 0;
  22890. }
  22891. },
  22892. shiftLeft: function Word64_shiftLeft(places) {
  22893. if (places >= 32) {
  22894. this.high = this.low << places - 32;
  22895. this.low = 0;
  22896. } else {
  22897. this.high = this.high << places | this.low >>> 32 - places;
  22898. this.low = this.low << places;
  22899. }
  22900. },
  22901. rotateRight: function Word64_rotateRight(places) {
  22902. var low, high;
  22903. if (places & 32) {
  22904. high = this.low;
  22905. low = this.high;
  22906. } else {
  22907. low = this.low;
  22908. high = this.high;
  22909. }
  22910. places &= 31;
  22911. this.low = low >>> places | high << 32 - places;
  22912. this.high = high >>> places | low << 32 - places;
  22913. },
  22914. not: function Word64_not() {
  22915. this.high = ~this.high;
  22916. this.low = ~this.low;
  22917. },
  22918. add: function Word64_add(word) {
  22919. var lowAdd = (this.low >>> 0) + (word.low >>> 0);
  22920. var highAdd = (this.high >>> 0) + (word.high >>> 0);
  22921. if (lowAdd > 0xFFFFFFFF) {
  22922. highAdd += 1;
  22923. }
  22924. this.low = lowAdd | 0;
  22925. this.high = highAdd | 0;
  22926. },
  22927. copyTo: function Word64_copyTo(bytes, offset) {
  22928. bytes[offset] = this.high >>> 24 & 0xFF;
  22929. bytes[offset + 1] = this.high >> 16 & 0xFF;
  22930. bytes[offset + 2] = this.high >> 8 & 0xFF;
  22931. bytes[offset + 3] = this.high & 0xFF;
  22932. bytes[offset + 4] = this.low >>> 24 & 0xFF;
  22933. bytes[offset + 5] = this.low >> 16 & 0xFF;
  22934. bytes[offset + 6] = this.low >> 8 & 0xFF;
  22935. bytes[offset + 7] = this.low & 0xFF;
  22936. },
  22937. assign: function Word64_assign(word) {
  22938. this.high = word.high;
  22939. this.low = word.low;
  22940. }
  22941. };
  22942. return Word64;
  22943. }();
  22944. var calculateSHA256 = function calculateSHA256Closure() {
  22945. function rotr(x, n) {
  22946. return x >>> n | x << 32 - n;
  22947. }
  22948. function ch(x, y, z) {
  22949. return x & y ^ ~x & z;
  22950. }
  22951. function maj(x, y, z) {
  22952. return x & y ^ x & z ^ y & z;
  22953. }
  22954. function sigma(x) {
  22955. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  22956. }
  22957. function sigmaPrime(x) {
  22958. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  22959. }
  22960. function littleSigma(x) {
  22961. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  22962. }
  22963. function littleSigmaPrime(x) {
  22964. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  22965. }
  22966. var k = [
  22967. 0x428a2f98,
  22968. 0x71374491,
  22969. 0xb5c0fbcf,
  22970. 0xe9b5dba5,
  22971. 0x3956c25b,
  22972. 0x59f111f1,
  22973. 0x923f82a4,
  22974. 0xab1c5ed5,
  22975. 0xd807aa98,
  22976. 0x12835b01,
  22977. 0x243185be,
  22978. 0x550c7dc3,
  22979. 0x72be5d74,
  22980. 0x80deb1fe,
  22981. 0x9bdc06a7,
  22982. 0xc19bf174,
  22983. 0xe49b69c1,
  22984. 0xefbe4786,
  22985. 0x0fc19dc6,
  22986. 0x240ca1cc,
  22987. 0x2de92c6f,
  22988. 0x4a7484aa,
  22989. 0x5cb0a9dc,
  22990. 0x76f988da,
  22991. 0x983e5152,
  22992. 0xa831c66d,
  22993. 0xb00327c8,
  22994. 0xbf597fc7,
  22995. 0xc6e00bf3,
  22996. 0xd5a79147,
  22997. 0x06ca6351,
  22998. 0x14292967,
  22999. 0x27b70a85,
  23000. 0x2e1b2138,
  23001. 0x4d2c6dfc,
  23002. 0x53380d13,
  23003. 0x650a7354,
  23004. 0x766a0abb,
  23005. 0x81c2c92e,
  23006. 0x92722c85,
  23007. 0xa2bfe8a1,
  23008. 0xa81a664b,
  23009. 0xc24b8b70,
  23010. 0xc76c51a3,
  23011. 0xd192e819,
  23012. 0xd6990624,
  23013. 0xf40e3585,
  23014. 0x106aa070,
  23015. 0x19a4c116,
  23016. 0x1e376c08,
  23017. 0x2748774c,
  23018. 0x34b0bcb5,
  23019. 0x391c0cb3,
  23020. 0x4ed8aa4a,
  23021. 0x5b9cca4f,
  23022. 0x682e6ff3,
  23023. 0x748f82ee,
  23024. 0x78a5636f,
  23025. 0x84c87814,
  23026. 0x8cc70208,
  23027. 0x90befffa,
  23028. 0xa4506ceb,
  23029. 0xbef9a3f7,
  23030. 0xc67178f2
  23031. ];
  23032. function hash(data, offset, length) {
  23033. var h0 = 0x6a09e667, h1 = 0xbb67ae85, h2 = 0x3c6ef372, h3 = 0xa54ff53a, h4 = 0x510e527f, h5 = 0x9b05688c, h6 = 0x1f83d9ab, h7 = 0x5be0cd19;
  23034. var paddedLength = Math.ceil((length + 9) / 64) * 64;
  23035. var padded = new Uint8Array(paddedLength);
  23036. var i, j, n;
  23037. for (i = 0; i < length; ++i) {
  23038. padded[i] = data[offset++];
  23039. }
  23040. padded[i++] = 0x80;
  23041. n = paddedLength - 8;
  23042. while (i < n) {
  23043. padded[i++] = 0;
  23044. }
  23045. padded[i++] = 0;
  23046. padded[i++] = 0;
  23047. padded[i++] = 0;
  23048. padded[i++] = length >>> 29 & 0xFF;
  23049. padded[i++] = length >> 21 & 0xFF;
  23050. padded[i++] = length >> 13 & 0xFF;
  23051. padded[i++] = length >> 5 & 0xFF;
  23052. padded[i++] = length << 3 & 0xFF;
  23053. var w = new Uint32Array(64);
  23054. for (i = 0; i < paddedLength;) {
  23055. for (j = 0; j < 16; ++j) {
  23056. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  23057. i += 4;
  23058. }
  23059. for (j = 16; j < 64; ++j) {
  23060. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  23061. }
  23062. var a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7, t1, t2;
  23063. for (j = 0; j < 64; ++j) {
  23064. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  23065. t2 = sigma(a) + maj(a, b, c);
  23066. h = g;
  23067. g = f;
  23068. f = e;
  23069. e = d + t1 | 0;
  23070. d = c;
  23071. c = b;
  23072. b = a;
  23073. a = t1 + t2 | 0;
  23074. }
  23075. h0 = h0 + a | 0;
  23076. h1 = h1 + b | 0;
  23077. h2 = h2 + c | 0;
  23078. h3 = h3 + d | 0;
  23079. h4 = h4 + e | 0;
  23080. h5 = h5 + f | 0;
  23081. h6 = h6 + g | 0;
  23082. h7 = h7 + h | 0;
  23083. }
  23084. return new Uint8Array([
  23085. h0 >> 24 & 0xFF,
  23086. h0 >> 16 & 0xFF,
  23087. h0 >> 8 & 0xFF,
  23088. h0 & 0xFF,
  23089. h1 >> 24 & 0xFF,
  23090. h1 >> 16 & 0xFF,
  23091. h1 >> 8 & 0xFF,
  23092. h1 & 0xFF,
  23093. h2 >> 24 & 0xFF,
  23094. h2 >> 16 & 0xFF,
  23095. h2 >> 8 & 0xFF,
  23096. h2 & 0xFF,
  23097. h3 >> 24 & 0xFF,
  23098. h3 >> 16 & 0xFF,
  23099. h3 >> 8 & 0xFF,
  23100. h3 & 0xFF,
  23101. h4 >> 24 & 0xFF,
  23102. h4 >> 16 & 0xFF,
  23103. h4 >> 8 & 0xFF,
  23104. h4 & 0xFF,
  23105. h5 >> 24 & 0xFF,
  23106. h5 >> 16 & 0xFF,
  23107. h5 >> 8 & 0xFF,
  23108. h5 & 0xFF,
  23109. h6 >> 24 & 0xFF,
  23110. h6 >> 16 & 0xFF,
  23111. h6 >> 8 & 0xFF,
  23112. h6 & 0xFF,
  23113. h7 >> 24 & 0xFF,
  23114. h7 >> 16 & 0xFF,
  23115. h7 >> 8 & 0xFF,
  23116. h7 & 0xFF
  23117. ]);
  23118. }
  23119. return hash;
  23120. }();
  23121. var calculateSHA512 = function calculateSHA512Closure() {
  23122. function ch(result, x, y, z, tmp) {
  23123. result.assign(x);
  23124. result.and(y);
  23125. tmp.assign(x);
  23126. tmp.not();
  23127. tmp.and(z);
  23128. result.xor(tmp);
  23129. }
  23130. function maj(result, x, y, z, tmp) {
  23131. result.assign(x);
  23132. result.and(y);
  23133. tmp.assign(x);
  23134. tmp.and(z);
  23135. result.xor(tmp);
  23136. tmp.assign(y);
  23137. tmp.and(z);
  23138. result.xor(tmp);
  23139. }
  23140. function sigma(result, x, tmp) {
  23141. result.assign(x);
  23142. result.rotateRight(28);
  23143. tmp.assign(x);
  23144. tmp.rotateRight(34);
  23145. result.xor(tmp);
  23146. tmp.assign(x);
  23147. tmp.rotateRight(39);
  23148. result.xor(tmp);
  23149. }
  23150. function sigmaPrime(result, x, tmp) {
  23151. result.assign(x);
  23152. result.rotateRight(14);
  23153. tmp.assign(x);
  23154. tmp.rotateRight(18);
  23155. result.xor(tmp);
  23156. tmp.assign(x);
  23157. tmp.rotateRight(41);
  23158. result.xor(tmp);
  23159. }
  23160. function littleSigma(result, x, tmp) {
  23161. result.assign(x);
  23162. result.rotateRight(1);
  23163. tmp.assign(x);
  23164. tmp.rotateRight(8);
  23165. result.xor(tmp);
  23166. tmp.assign(x);
  23167. tmp.shiftRight(7);
  23168. result.xor(tmp);
  23169. }
  23170. function littleSigmaPrime(result, x, tmp) {
  23171. result.assign(x);
  23172. result.rotateRight(19);
  23173. tmp.assign(x);
  23174. tmp.rotateRight(61);
  23175. result.xor(tmp);
  23176. tmp.assign(x);
  23177. tmp.shiftRight(6);
  23178. result.xor(tmp);
  23179. }
  23180. var k = [
  23181. new Word64(0x428a2f98, 0xd728ae22),
  23182. new Word64(0x71374491, 0x23ef65cd),
  23183. new Word64(0xb5c0fbcf, 0xec4d3b2f),
  23184. new Word64(0xe9b5dba5, 0x8189dbbc),
  23185. new Word64(0x3956c25b, 0xf348b538),
  23186. new Word64(0x59f111f1, 0xb605d019),
  23187. new Word64(0x923f82a4, 0xaf194f9b),
  23188. new Word64(0xab1c5ed5, 0xda6d8118),
  23189. new Word64(0xd807aa98, 0xa3030242),
  23190. new Word64(0x12835b01, 0x45706fbe),
  23191. new Word64(0x243185be, 0x4ee4b28c),
  23192. new Word64(0x550c7dc3, 0xd5ffb4e2),
  23193. new Word64(0x72be5d74, 0xf27b896f),
  23194. new Word64(0x80deb1fe, 0x3b1696b1),
  23195. new Word64(0x9bdc06a7, 0x25c71235),
  23196. new Word64(0xc19bf174, 0xcf692694),
  23197. new Word64(0xe49b69c1, 0x9ef14ad2),
  23198. new Word64(0xefbe4786, 0x384f25e3),
  23199. new Word64(0x0fc19dc6, 0x8b8cd5b5),
  23200. new Word64(0x240ca1cc, 0x77ac9c65),
  23201. new Word64(0x2de92c6f, 0x592b0275),
  23202. new Word64(0x4a7484aa, 0x6ea6e483),
  23203. new Word64(0x5cb0a9dc, 0xbd41fbd4),
  23204. new Word64(0x76f988da, 0x831153b5),
  23205. new Word64(0x983e5152, 0xee66dfab),
  23206. new Word64(0xa831c66d, 0x2db43210),
  23207. new Word64(0xb00327c8, 0x98fb213f),
  23208. new Word64(0xbf597fc7, 0xbeef0ee4),
  23209. new Word64(0xc6e00bf3, 0x3da88fc2),
  23210. new Word64(0xd5a79147, 0x930aa725),
  23211. new Word64(0x06ca6351, 0xe003826f),
  23212. new Word64(0x14292967, 0x0a0e6e70),
  23213. new Word64(0x27b70a85, 0x46d22ffc),
  23214. new Word64(0x2e1b2138, 0x5c26c926),
  23215. new Word64(0x4d2c6dfc, 0x5ac42aed),
  23216. new Word64(0x53380d13, 0x9d95b3df),
  23217. new Word64(0x650a7354, 0x8baf63de),
  23218. new Word64(0x766a0abb, 0x3c77b2a8),
  23219. new Word64(0x81c2c92e, 0x47edaee6),
  23220. new Word64(0x92722c85, 0x1482353b),
  23221. new Word64(0xa2bfe8a1, 0x4cf10364),
  23222. new Word64(0xa81a664b, 0xbc423001),
  23223. new Word64(0xc24b8b70, 0xd0f89791),
  23224. new Word64(0xc76c51a3, 0x0654be30),
  23225. new Word64(0xd192e819, 0xd6ef5218),
  23226. new Word64(0xd6990624, 0x5565a910),
  23227. new Word64(0xf40e3585, 0x5771202a),
  23228. new Word64(0x106aa070, 0x32bbd1b8),
  23229. new Word64(0x19a4c116, 0xb8d2d0c8),
  23230. new Word64(0x1e376c08, 0x5141ab53),
  23231. new Word64(0x2748774c, 0xdf8eeb99),
  23232. new Word64(0x34b0bcb5, 0xe19b48a8),
  23233. new Word64(0x391c0cb3, 0xc5c95a63),
  23234. new Word64(0x4ed8aa4a, 0xe3418acb),
  23235. new Word64(0x5b9cca4f, 0x7763e373),
  23236. new Word64(0x682e6ff3, 0xd6b2b8a3),
  23237. new Word64(0x748f82ee, 0x5defb2fc),
  23238. new Word64(0x78a5636f, 0x43172f60),
  23239. new Word64(0x84c87814, 0xa1f0ab72),
  23240. new Word64(0x8cc70208, 0x1a6439ec),
  23241. new Word64(0x90befffa, 0x23631e28),
  23242. new Word64(0xa4506ceb, 0xde82bde9),
  23243. new Word64(0xbef9a3f7, 0xb2c67915),
  23244. new Word64(0xc67178f2, 0xe372532b),
  23245. new Word64(0xca273ece, 0xea26619c),
  23246. new Word64(0xd186b8c7, 0x21c0c207),
  23247. new Word64(0xeada7dd6, 0xcde0eb1e),
  23248. new Word64(0xf57d4f7f, 0xee6ed178),
  23249. new Word64(0x06f067aa, 0x72176fba),
  23250. new Word64(0x0a637dc5, 0xa2c898a6),
  23251. new Word64(0x113f9804, 0xbef90dae),
  23252. new Word64(0x1b710b35, 0x131c471b),
  23253. new Word64(0x28db77f5, 0x23047d84),
  23254. new Word64(0x32caab7b, 0x40c72493),
  23255. new Word64(0x3c9ebe0a, 0x15c9bebc),
  23256. new Word64(0x431d67c4, 0x9c100d4c),
  23257. new Word64(0x4cc5d4be, 0xcb3e42b6),
  23258. new Word64(0x597f299c, 0xfc657e2a),
  23259. new Word64(0x5fcb6fab, 0x3ad6faec),
  23260. new Word64(0x6c44198c, 0x4a475817)
  23261. ];
  23262. function hash(data, offset, length, mode384) {
  23263. mode384 = !!mode384;
  23264. var h0, h1, h2, h3, h4, h5, h6, h7;
  23265. if (!mode384) {
  23266. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  23267. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  23268. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  23269. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  23270. h4 = new Word64(0x510e527f, 0xade682d1);
  23271. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  23272. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  23273. h7 = new Word64(0x5be0cd19, 0x137e2179);
  23274. } else {
  23275. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  23276. h1 = new Word64(0x629a292a, 0x367cd507);
  23277. h2 = new Word64(0x9159015a, 0x3070dd17);
  23278. h3 = new Word64(0x152fecd8, 0xf70e5939);
  23279. h4 = new Word64(0x67332667, 0xffc00b31);
  23280. h5 = new Word64(0x8eb44a87, 0x68581511);
  23281. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  23282. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  23283. }
  23284. var paddedLength = Math.ceil((length + 17) / 128) * 128;
  23285. var padded = new Uint8Array(paddedLength);
  23286. var i, j, n;
  23287. for (i = 0; i < length; ++i) {
  23288. padded[i] = data[offset++];
  23289. }
  23290. padded[i++] = 0x80;
  23291. n = paddedLength - 16;
  23292. while (i < n) {
  23293. padded[i++] = 0;
  23294. }
  23295. padded[i++] = 0;
  23296. padded[i++] = 0;
  23297. padded[i++] = 0;
  23298. padded[i++] = 0;
  23299. padded[i++] = 0;
  23300. padded[i++] = 0;
  23301. padded[i++] = 0;
  23302. padded[i++] = 0;
  23303. padded[i++] = 0;
  23304. padded[i++] = 0;
  23305. padded[i++] = 0;
  23306. padded[i++] = length >>> 29 & 0xFF;
  23307. padded[i++] = length >> 21 & 0xFF;
  23308. padded[i++] = length >> 13 & 0xFF;
  23309. padded[i++] = length >> 5 & 0xFF;
  23310. padded[i++] = length << 3 & 0xFF;
  23311. var w = new Array(80);
  23312. for (i = 0; i < 80; i++) {
  23313. w[i] = new Word64(0, 0);
  23314. }
  23315. var a = new Word64(0, 0), b = new Word64(0, 0), c = new Word64(0, 0);
  23316. var d = new Word64(0, 0), e = new Word64(0, 0), f = new Word64(0, 0);
  23317. var g = new Word64(0, 0), h = new Word64(0, 0);
  23318. var t1 = new Word64(0, 0), t2 = new Word64(0, 0);
  23319. var tmp1 = new Word64(0, 0), tmp2 = new Word64(0, 0), tmp3;
  23320. for (i = 0; i < paddedLength;) {
  23321. for (j = 0; j < 16; ++j) {
  23322. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  23323. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  23324. i += 8;
  23325. }
  23326. for (j = 16; j < 80; ++j) {
  23327. tmp3 = w[j];
  23328. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  23329. tmp3.add(w[j - 7]);
  23330. littleSigma(tmp1, w[j - 15], tmp2);
  23331. tmp3.add(tmp1);
  23332. tmp3.add(w[j - 16]);
  23333. }
  23334. a.assign(h0);
  23335. b.assign(h1);
  23336. c.assign(h2);
  23337. d.assign(h3);
  23338. e.assign(h4);
  23339. f.assign(h5);
  23340. g.assign(h6);
  23341. h.assign(h7);
  23342. for (j = 0; j < 80; ++j) {
  23343. t1.assign(h);
  23344. sigmaPrime(tmp1, e, tmp2);
  23345. t1.add(tmp1);
  23346. ch(tmp1, e, f, g, tmp2);
  23347. t1.add(tmp1);
  23348. t1.add(k[j]);
  23349. t1.add(w[j]);
  23350. sigma(t2, a, tmp2);
  23351. maj(tmp1, a, b, c, tmp2);
  23352. t2.add(tmp1);
  23353. tmp3 = h;
  23354. h = g;
  23355. g = f;
  23356. f = e;
  23357. d.add(t1);
  23358. e = d;
  23359. d = c;
  23360. c = b;
  23361. b = a;
  23362. tmp3.assign(t1);
  23363. tmp3.add(t2);
  23364. a = tmp3;
  23365. }
  23366. h0.add(a);
  23367. h1.add(b);
  23368. h2.add(c);
  23369. h3.add(d);
  23370. h4.add(e);
  23371. h5.add(f);
  23372. h6.add(g);
  23373. h7.add(h);
  23374. }
  23375. var result;
  23376. if (!mode384) {
  23377. result = new Uint8Array(64);
  23378. h0.copyTo(result, 0);
  23379. h1.copyTo(result, 8);
  23380. h2.copyTo(result, 16);
  23381. h3.copyTo(result, 24);
  23382. h4.copyTo(result, 32);
  23383. h5.copyTo(result, 40);
  23384. h6.copyTo(result, 48);
  23385. h7.copyTo(result, 56);
  23386. } else {
  23387. result = new Uint8Array(48);
  23388. h0.copyTo(result, 0);
  23389. h1.copyTo(result, 8);
  23390. h2.copyTo(result, 16);
  23391. h3.copyTo(result, 24);
  23392. h4.copyTo(result, 32);
  23393. h5.copyTo(result, 40);
  23394. }
  23395. return result;
  23396. }
  23397. return hash;
  23398. }();
  23399. var calculateSHA384 = function calculateSHA384Closure() {
  23400. function hash(data, offset, length) {
  23401. return calculateSHA512(data, offset, length, true);
  23402. }
  23403. return hash;
  23404. }();
  23405. var NullCipher = function NullCipherClosure() {
  23406. function NullCipher() {
  23407. }
  23408. NullCipher.prototype = {
  23409. decryptBlock: function NullCipher_decryptBlock(data) {
  23410. return data;
  23411. }
  23412. };
  23413. return NullCipher;
  23414. }();
  23415. var AES128Cipher = function AES128CipherClosure() {
  23416. var rcon = new Uint8Array([
  23417. 0x8d,
  23418. 0x01,
  23419. 0x02,
  23420. 0x04,
  23421. 0x08,
  23422. 0x10,
  23423. 0x20,
  23424. 0x40,
  23425. 0x80,
  23426. 0x1b,
  23427. 0x36,
  23428. 0x6c,
  23429. 0xd8,
  23430. 0xab,
  23431. 0x4d,
  23432. 0x9a,
  23433. 0x2f,
  23434. 0x5e,
  23435. 0xbc,
  23436. 0x63,
  23437. 0xc6,
  23438. 0x97,
  23439. 0x35,
  23440. 0x6a,
  23441. 0xd4,
  23442. 0xb3,
  23443. 0x7d,
  23444. 0xfa,
  23445. 0xef,
  23446. 0xc5,
  23447. 0x91,
  23448. 0x39,
  23449. 0x72,
  23450. 0xe4,
  23451. 0xd3,
  23452. 0xbd,
  23453. 0x61,
  23454. 0xc2,
  23455. 0x9f,
  23456. 0x25,
  23457. 0x4a,
  23458. 0x94,
  23459. 0x33,
  23460. 0x66,
  23461. 0xcc,
  23462. 0x83,
  23463. 0x1d,
  23464. 0x3a,
  23465. 0x74,
  23466. 0xe8,
  23467. 0xcb,
  23468. 0x8d,
  23469. 0x01,
  23470. 0x02,
  23471. 0x04,
  23472. 0x08,
  23473. 0x10,
  23474. 0x20,
  23475. 0x40,
  23476. 0x80,
  23477. 0x1b,
  23478. 0x36,
  23479. 0x6c,
  23480. 0xd8,
  23481. 0xab,
  23482. 0x4d,
  23483. 0x9a,
  23484. 0x2f,
  23485. 0x5e,
  23486. 0xbc,
  23487. 0x63,
  23488. 0xc6,
  23489. 0x97,
  23490. 0x35,
  23491. 0x6a,
  23492. 0xd4,
  23493. 0xb3,
  23494. 0x7d,
  23495. 0xfa,
  23496. 0xef,
  23497. 0xc5,
  23498. 0x91,
  23499. 0x39,
  23500. 0x72,
  23501. 0xe4,
  23502. 0xd3,
  23503. 0xbd,
  23504. 0x61,
  23505. 0xc2,
  23506. 0x9f,
  23507. 0x25,
  23508. 0x4a,
  23509. 0x94,
  23510. 0x33,
  23511. 0x66,
  23512. 0xcc,
  23513. 0x83,
  23514. 0x1d,
  23515. 0x3a,
  23516. 0x74,
  23517. 0xe8,
  23518. 0xcb,
  23519. 0x8d,
  23520. 0x01,
  23521. 0x02,
  23522. 0x04,
  23523. 0x08,
  23524. 0x10,
  23525. 0x20,
  23526. 0x40,
  23527. 0x80,
  23528. 0x1b,
  23529. 0x36,
  23530. 0x6c,
  23531. 0xd8,
  23532. 0xab,
  23533. 0x4d,
  23534. 0x9a,
  23535. 0x2f,
  23536. 0x5e,
  23537. 0xbc,
  23538. 0x63,
  23539. 0xc6,
  23540. 0x97,
  23541. 0x35,
  23542. 0x6a,
  23543. 0xd4,
  23544. 0xb3,
  23545. 0x7d,
  23546. 0xfa,
  23547. 0xef,
  23548. 0xc5,
  23549. 0x91,
  23550. 0x39,
  23551. 0x72,
  23552. 0xe4,
  23553. 0xd3,
  23554. 0xbd,
  23555. 0x61,
  23556. 0xc2,
  23557. 0x9f,
  23558. 0x25,
  23559. 0x4a,
  23560. 0x94,
  23561. 0x33,
  23562. 0x66,
  23563. 0xcc,
  23564. 0x83,
  23565. 0x1d,
  23566. 0x3a,
  23567. 0x74,
  23568. 0xe8,
  23569. 0xcb,
  23570. 0x8d,
  23571. 0x01,
  23572. 0x02,
  23573. 0x04,
  23574. 0x08,
  23575. 0x10,
  23576. 0x20,
  23577. 0x40,
  23578. 0x80,
  23579. 0x1b,
  23580. 0x36,
  23581. 0x6c,
  23582. 0xd8,
  23583. 0xab,
  23584. 0x4d,
  23585. 0x9a,
  23586. 0x2f,
  23587. 0x5e,
  23588. 0xbc,
  23589. 0x63,
  23590. 0xc6,
  23591. 0x97,
  23592. 0x35,
  23593. 0x6a,
  23594. 0xd4,
  23595. 0xb3,
  23596. 0x7d,
  23597. 0xfa,
  23598. 0xef,
  23599. 0xc5,
  23600. 0x91,
  23601. 0x39,
  23602. 0x72,
  23603. 0xe4,
  23604. 0xd3,
  23605. 0xbd,
  23606. 0x61,
  23607. 0xc2,
  23608. 0x9f,
  23609. 0x25,
  23610. 0x4a,
  23611. 0x94,
  23612. 0x33,
  23613. 0x66,
  23614. 0xcc,
  23615. 0x83,
  23616. 0x1d,
  23617. 0x3a,
  23618. 0x74,
  23619. 0xe8,
  23620. 0xcb,
  23621. 0x8d,
  23622. 0x01,
  23623. 0x02,
  23624. 0x04,
  23625. 0x08,
  23626. 0x10,
  23627. 0x20,
  23628. 0x40,
  23629. 0x80,
  23630. 0x1b,
  23631. 0x36,
  23632. 0x6c,
  23633. 0xd8,
  23634. 0xab,
  23635. 0x4d,
  23636. 0x9a,
  23637. 0x2f,
  23638. 0x5e,
  23639. 0xbc,
  23640. 0x63,
  23641. 0xc6,
  23642. 0x97,
  23643. 0x35,
  23644. 0x6a,
  23645. 0xd4,
  23646. 0xb3,
  23647. 0x7d,
  23648. 0xfa,
  23649. 0xef,
  23650. 0xc5,
  23651. 0x91,
  23652. 0x39,
  23653. 0x72,
  23654. 0xe4,
  23655. 0xd3,
  23656. 0xbd,
  23657. 0x61,
  23658. 0xc2,
  23659. 0x9f,
  23660. 0x25,
  23661. 0x4a,
  23662. 0x94,
  23663. 0x33,
  23664. 0x66,
  23665. 0xcc,
  23666. 0x83,
  23667. 0x1d,
  23668. 0x3a,
  23669. 0x74,
  23670. 0xe8,
  23671. 0xcb,
  23672. 0x8d
  23673. ]);
  23674. var s = new Uint8Array([
  23675. 0x63,
  23676. 0x7c,
  23677. 0x77,
  23678. 0x7b,
  23679. 0xf2,
  23680. 0x6b,
  23681. 0x6f,
  23682. 0xc5,
  23683. 0x30,
  23684. 0x01,
  23685. 0x67,
  23686. 0x2b,
  23687. 0xfe,
  23688. 0xd7,
  23689. 0xab,
  23690. 0x76,
  23691. 0xca,
  23692. 0x82,
  23693. 0xc9,
  23694. 0x7d,
  23695. 0xfa,
  23696. 0x59,
  23697. 0x47,
  23698. 0xf0,
  23699. 0xad,
  23700. 0xd4,
  23701. 0xa2,
  23702. 0xaf,
  23703. 0x9c,
  23704. 0xa4,
  23705. 0x72,
  23706. 0xc0,
  23707. 0xb7,
  23708. 0xfd,
  23709. 0x93,
  23710. 0x26,
  23711. 0x36,
  23712. 0x3f,
  23713. 0xf7,
  23714. 0xcc,
  23715. 0x34,
  23716. 0xa5,
  23717. 0xe5,
  23718. 0xf1,
  23719. 0x71,
  23720. 0xd8,
  23721. 0x31,
  23722. 0x15,
  23723. 0x04,
  23724. 0xc7,
  23725. 0x23,
  23726. 0xc3,
  23727. 0x18,
  23728. 0x96,
  23729. 0x05,
  23730. 0x9a,
  23731. 0x07,
  23732. 0x12,
  23733. 0x80,
  23734. 0xe2,
  23735. 0xeb,
  23736. 0x27,
  23737. 0xb2,
  23738. 0x75,
  23739. 0x09,
  23740. 0x83,
  23741. 0x2c,
  23742. 0x1a,
  23743. 0x1b,
  23744. 0x6e,
  23745. 0x5a,
  23746. 0xa0,
  23747. 0x52,
  23748. 0x3b,
  23749. 0xd6,
  23750. 0xb3,
  23751. 0x29,
  23752. 0xe3,
  23753. 0x2f,
  23754. 0x84,
  23755. 0x53,
  23756. 0xd1,
  23757. 0x00,
  23758. 0xed,
  23759. 0x20,
  23760. 0xfc,
  23761. 0xb1,
  23762. 0x5b,
  23763. 0x6a,
  23764. 0xcb,
  23765. 0xbe,
  23766. 0x39,
  23767. 0x4a,
  23768. 0x4c,
  23769. 0x58,
  23770. 0xcf,
  23771. 0xd0,
  23772. 0xef,
  23773. 0xaa,
  23774. 0xfb,
  23775. 0x43,
  23776. 0x4d,
  23777. 0x33,
  23778. 0x85,
  23779. 0x45,
  23780. 0xf9,
  23781. 0x02,
  23782. 0x7f,
  23783. 0x50,
  23784. 0x3c,
  23785. 0x9f,
  23786. 0xa8,
  23787. 0x51,
  23788. 0xa3,
  23789. 0x40,
  23790. 0x8f,
  23791. 0x92,
  23792. 0x9d,
  23793. 0x38,
  23794. 0xf5,
  23795. 0xbc,
  23796. 0xb6,
  23797. 0xda,
  23798. 0x21,
  23799. 0x10,
  23800. 0xff,
  23801. 0xf3,
  23802. 0xd2,
  23803. 0xcd,
  23804. 0x0c,
  23805. 0x13,
  23806. 0xec,
  23807. 0x5f,
  23808. 0x97,
  23809. 0x44,
  23810. 0x17,
  23811. 0xc4,
  23812. 0xa7,
  23813. 0x7e,
  23814. 0x3d,
  23815. 0x64,
  23816. 0x5d,
  23817. 0x19,
  23818. 0x73,
  23819. 0x60,
  23820. 0x81,
  23821. 0x4f,
  23822. 0xdc,
  23823. 0x22,
  23824. 0x2a,
  23825. 0x90,
  23826. 0x88,
  23827. 0x46,
  23828. 0xee,
  23829. 0xb8,
  23830. 0x14,
  23831. 0xde,
  23832. 0x5e,
  23833. 0x0b,
  23834. 0xdb,
  23835. 0xe0,
  23836. 0x32,
  23837. 0x3a,
  23838. 0x0a,
  23839. 0x49,
  23840. 0x06,
  23841. 0x24,
  23842. 0x5c,
  23843. 0xc2,
  23844. 0xd3,
  23845. 0xac,
  23846. 0x62,
  23847. 0x91,
  23848. 0x95,
  23849. 0xe4,
  23850. 0x79,
  23851. 0xe7,
  23852. 0xc8,
  23853. 0x37,
  23854. 0x6d,
  23855. 0x8d,
  23856. 0xd5,
  23857. 0x4e,
  23858. 0xa9,
  23859. 0x6c,
  23860. 0x56,
  23861. 0xf4,
  23862. 0xea,
  23863. 0x65,
  23864. 0x7a,
  23865. 0xae,
  23866. 0x08,
  23867. 0xba,
  23868. 0x78,
  23869. 0x25,
  23870. 0x2e,
  23871. 0x1c,
  23872. 0xa6,
  23873. 0xb4,
  23874. 0xc6,
  23875. 0xe8,
  23876. 0xdd,
  23877. 0x74,
  23878. 0x1f,
  23879. 0x4b,
  23880. 0xbd,
  23881. 0x8b,
  23882. 0x8a,
  23883. 0x70,
  23884. 0x3e,
  23885. 0xb5,
  23886. 0x66,
  23887. 0x48,
  23888. 0x03,
  23889. 0xf6,
  23890. 0x0e,
  23891. 0x61,
  23892. 0x35,
  23893. 0x57,
  23894. 0xb9,
  23895. 0x86,
  23896. 0xc1,
  23897. 0x1d,
  23898. 0x9e,
  23899. 0xe1,
  23900. 0xf8,
  23901. 0x98,
  23902. 0x11,
  23903. 0x69,
  23904. 0xd9,
  23905. 0x8e,
  23906. 0x94,
  23907. 0x9b,
  23908. 0x1e,
  23909. 0x87,
  23910. 0xe9,
  23911. 0xce,
  23912. 0x55,
  23913. 0x28,
  23914. 0xdf,
  23915. 0x8c,
  23916. 0xa1,
  23917. 0x89,
  23918. 0x0d,
  23919. 0xbf,
  23920. 0xe6,
  23921. 0x42,
  23922. 0x68,
  23923. 0x41,
  23924. 0x99,
  23925. 0x2d,
  23926. 0x0f,
  23927. 0xb0,
  23928. 0x54,
  23929. 0xbb,
  23930. 0x16
  23931. ]);
  23932. var inv_s = new Uint8Array([
  23933. 0x52,
  23934. 0x09,
  23935. 0x6a,
  23936. 0xd5,
  23937. 0x30,
  23938. 0x36,
  23939. 0xa5,
  23940. 0x38,
  23941. 0xbf,
  23942. 0x40,
  23943. 0xa3,
  23944. 0x9e,
  23945. 0x81,
  23946. 0xf3,
  23947. 0xd7,
  23948. 0xfb,
  23949. 0x7c,
  23950. 0xe3,
  23951. 0x39,
  23952. 0x82,
  23953. 0x9b,
  23954. 0x2f,
  23955. 0xff,
  23956. 0x87,
  23957. 0x34,
  23958. 0x8e,
  23959. 0x43,
  23960. 0x44,
  23961. 0xc4,
  23962. 0xde,
  23963. 0xe9,
  23964. 0xcb,
  23965. 0x54,
  23966. 0x7b,
  23967. 0x94,
  23968. 0x32,
  23969. 0xa6,
  23970. 0xc2,
  23971. 0x23,
  23972. 0x3d,
  23973. 0xee,
  23974. 0x4c,
  23975. 0x95,
  23976. 0x0b,
  23977. 0x42,
  23978. 0xfa,
  23979. 0xc3,
  23980. 0x4e,
  23981. 0x08,
  23982. 0x2e,
  23983. 0xa1,
  23984. 0x66,
  23985. 0x28,
  23986. 0xd9,
  23987. 0x24,
  23988. 0xb2,
  23989. 0x76,
  23990. 0x5b,
  23991. 0xa2,
  23992. 0x49,
  23993. 0x6d,
  23994. 0x8b,
  23995. 0xd1,
  23996. 0x25,
  23997. 0x72,
  23998. 0xf8,
  23999. 0xf6,
  24000. 0x64,
  24001. 0x86,
  24002. 0x68,
  24003. 0x98,
  24004. 0x16,
  24005. 0xd4,
  24006. 0xa4,
  24007. 0x5c,
  24008. 0xcc,
  24009. 0x5d,
  24010. 0x65,
  24011. 0xb6,
  24012. 0x92,
  24013. 0x6c,
  24014. 0x70,
  24015. 0x48,
  24016. 0x50,
  24017. 0xfd,
  24018. 0xed,
  24019. 0xb9,
  24020. 0xda,
  24021. 0x5e,
  24022. 0x15,
  24023. 0x46,
  24024. 0x57,
  24025. 0xa7,
  24026. 0x8d,
  24027. 0x9d,
  24028. 0x84,
  24029. 0x90,
  24030. 0xd8,
  24031. 0xab,
  24032. 0x00,
  24033. 0x8c,
  24034. 0xbc,
  24035. 0xd3,
  24036. 0x0a,
  24037. 0xf7,
  24038. 0xe4,
  24039. 0x58,
  24040. 0x05,
  24041. 0xb8,
  24042. 0xb3,
  24043. 0x45,
  24044. 0x06,
  24045. 0xd0,
  24046. 0x2c,
  24047. 0x1e,
  24048. 0x8f,
  24049. 0xca,
  24050. 0x3f,
  24051. 0x0f,
  24052. 0x02,
  24053. 0xc1,
  24054. 0xaf,
  24055. 0xbd,
  24056. 0x03,
  24057. 0x01,
  24058. 0x13,
  24059. 0x8a,
  24060. 0x6b,
  24061. 0x3a,
  24062. 0x91,
  24063. 0x11,
  24064. 0x41,
  24065. 0x4f,
  24066. 0x67,
  24067. 0xdc,
  24068. 0xea,
  24069. 0x97,
  24070. 0xf2,
  24071. 0xcf,
  24072. 0xce,
  24073. 0xf0,
  24074. 0xb4,
  24075. 0xe6,
  24076. 0x73,
  24077. 0x96,
  24078. 0xac,
  24079. 0x74,
  24080. 0x22,
  24081. 0xe7,
  24082. 0xad,
  24083. 0x35,
  24084. 0x85,
  24085. 0xe2,
  24086. 0xf9,
  24087. 0x37,
  24088. 0xe8,
  24089. 0x1c,
  24090. 0x75,
  24091. 0xdf,
  24092. 0x6e,
  24093. 0x47,
  24094. 0xf1,
  24095. 0x1a,
  24096. 0x71,
  24097. 0x1d,
  24098. 0x29,
  24099. 0xc5,
  24100. 0x89,
  24101. 0x6f,
  24102. 0xb7,
  24103. 0x62,
  24104. 0x0e,
  24105. 0xaa,
  24106. 0x18,
  24107. 0xbe,
  24108. 0x1b,
  24109. 0xfc,
  24110. 0x56,
  24111. 0x3e,
  24112. 0x4b,
  24113. 0xc6,
  24114. 0xd2,
  24115. 0x79,
  24116. 0x20,
  24117. 0x9a,
  24118. 0xdb,
  24119. 0xc0,
  24120. 0xfe,
  24121. 0x78,
  24122. 0xcd,
  24123. 0x5a,
  24124. 0xf4,
  24125. 0x1f,
  24126. 0xdd,
  24127. 0xa8,
  24128. 0x33,
  24129. 0x88,
  24130. 0x07,
  24131. 0xc7,
  24132. 0x31,
  24133. 0xb1,
  24134. 0x12,
  24135. 0x10,
  24136. 0x59,
  24137. 0x27,
  24138. 0x80,
  24139. 0xec,
  24140. 0x5f,
  24141. 0x60,
  24142. 0x51,
  24143. 0x7f,
  24144. 0xa9,
  24145. 0x19,
  24146. 0xb5,
  24147. 0x4a,
  24148. 0x0d,
  24149. 0x2d,
  24150. 0xe5,
  24151. 0x7a,
  24152. 0x9f,
  24153. 0x93,
  24154. 0xc9,
  24155. 0x9c,
  24156. 0xef,
  24157. 0xa0,
  24158. 0xe0,
  24159. 0x3b,
  24160. 0x4d,
  24161. 0xae,
  24162. 0x2a,
  24163. 0xf5,
  24164. 0xb0,
  24165. 0xc8,
  24166. 0xeb,
  24167. 0xbb,
  24168. 0x3c,
  24169. 0x83,
  24170. 0x53,
  24171. 0x99,
  24172. 0x61,
  24173. 0x17,
  24174. 0x2b,
  24175. 0x04,
  24176. 0x7e,
  24177. 0xba,
  24178. 0x77,
  24179. 0xd6,
  24180. 0x26,
  24181. 0xe1,
  24182. 0x69,
  24183. 0x14,
  24184. 0x63,
  24185. 0x55,
  24186. 0x21,
  24187. 0x0c,
  24188. 0x7d
  24189. ]);
  24190. var mixCol = new Uint8Array(256);
  24191. for (var i = 0; i < 256; i++) {
  24192. if (i < 128) {
  24193. mixCol[i] = i << 1;
  24194. } else {
  24195. mixCol[i] = i << 1 ^ 0x1b;
  24196. }
  24197. }
  24198. var mix = new Uint32Array([
  24199. 0x00000000,
  24200. 0x0e090d0b,
  24201. 0x1c121a16,
  24202. 0x121b171d,
  24203. 0x3824342c,
  24204. 0x362d3927,
  24205. 0x24362e3a,
  24206. 0x2a3f2331,
  24207. 0x70486858,
  24208. 0x7e416553,
  24209. 0x6c5a724e,
  24210. 0x62537f45,
  24211. 0x486c5c74,
  24212. 0x4665517f,
  24213. 0x547e4662,
  24214. 0x5a774b69,
  24215. 0xe090d0b0,
  24216. 0xee99ddbb,
  24217. 0xfc82caa6,
  24218. 0xf28bc7ad,
  24219. 0xd8b4e49c,
  24220. 0xd6bde997,
  24221. 0xc4a6fe8a,
  24222. 0xcaaff381,
  24223. 0x90d8b8e8,
  24224. 0x9ed1b5e3,
  24225. 0x8ccaa2fe,
  24226. 0x82c3aff5,
  24227. 0xa8fc8cc4,
  24228. 0xa6f581cf,
  24229. 0xb4ee96d2,
  24230. 0xbae79bd9,
  24231. 0xdb3bbb7b,
  24232. 0xd532b670,
  24233. 0xc729a16d,
  24234. 0xc920ac66,
  24235. 0xe31f8f57,
  24236. 0xed16825c,
  24237. 0xff0d9541,
  24238. 0xf104984a,
  24239. 0xab73d323,
  24240. 0xa57ade28,
  24241. 0xb761c935,
  24242. 0xb968c43e,
  24243. 0x9357e70f,
  24244. 0x9d5eea04,
  24245. 0x8f45fd19,
  24246. 0x814cf012,
  24247. 0x3bab6bcb,
  24248. 0x35a266c0,
  24249. 0x27b971dd,
  24250. 0x29b07cd6,
  24251. 0x038f5fe7,
  24252. 0x0d8652ec,
  24253. 0x1f9d45f1,
  24254. 0x119448fa,
  24255. 0x4be30393,
  24256. 0x45ea0e98,
  24257. 0x57f11985,
  24258. 0x59f8148e,
  24259. 0x73c737bf,
  24260. 0x7dce3ab4,
  24261. 0x6fd52da9,
  24262. 0x61dc20a2,
  24263. 0xad766df6,
  24264. 0xa37f60fd,
  24265. 0xb16477e0,
  24266. 0xbf6d7aeb,
  24267. 0x955259da,
  24268. 0x9b5b54d1,
  24269. 0x894043cc,
  24270. 0x87494ec7,
  24271. 0xdd3e05ae,
  24272. 0xd33708a5,
  24273. 0xc12c1fb8,
  24274. 0xcf2512b3,
  24275. 0xe51a3182,
  24276. 0xeb133c89,
  24277. 0xf9082b94,
  24278. 0xf701269f,
  24279. 0x4de6bd46,
  24280. 0x43efb04d,
  24281. 0x51f4a750,
  24282. 0x5ffdaa5b,
  24283. 0x75c2896a,
  24284. 0x7bcb8461,
  24285. 0x69d0937c,
  24286. 0x67d99e77,
  24287. 0x3daed51e,
  24288. 0x33a7d815,
  24289. 0x21bccf08,
  24290. 0x2fb5c203,
  24291. 0x058ae132,
  24292. 0x0b83ec39,
  24293. 0x1998fb24,
  24294. 0x1791f62f,
  24295. 0x764dd68d,
  24296. 0x7844db86,
  24297. 0x6a5fcc9b,
  24298. 0x6456c190,
  24299. 0x4e69e2a1,
  24300. 0x4060efaa,
  24301. 0x527bf8b7,
  24302. 0x5c72f5bc,
  24303. 0x0605bed5,
  24304. 0x080cb3de,
  24305. 0x1a17a4c3,
  24306. 0x141ea9c8,
  24307. 0x3e218af9,
  24308. 0x302887f2,
  24309. 0x223390ef,
  24310. 0x2c3a9de4,
  24311. 0x96dd063d,
  24312. 0x98d40b36,
  24313. 0x8acf1c2b,
  24314. 0x84c61120,
  24315. 0xaef93211,
  24316. 0xa0f03f1a,
  24317. 0xb2eb2807,
  24318. 0xbce2250c,
  24319. 0xe6956e65,
  24320. 0xe89c636e,
  24321. 0xfa877473,
  24322. 0xf48e7978,
  24323. 0xdeb15a49,
  24324. 0xd0b85742,
  24325. 0xc2a3405f,
  24326. 0xccaa4d54,
  24327. 0x41ecdaf7,
  24328. 0x4fe5d7fc,
  24329. 0x5dfec0e1,
  24330. 0x53f7cdea,
  24331. 0x79c8eedb,
  24332. 0x77c1e3d0,
  24333. 0x65daf4cd,
  24334. 0x6bd3f9c6,
  24335. 0x31a4b2af,
  24336. 0x3fadbfa4,
  24337. 0x2db6a8b9,
  24338. 0x23bfa5b2,
  24339. 0x09808683,
  24340. 0x07898b88,
  24341. 0x15929c95,
  24342. 0x1b9b919e,
  24343. 0xa17c0a47,
  24344. 0xaf75074c,
  24345. 0xbd6e1051,
  24346. 0xb3671d5a,
  24347. 0x99583e6b,
  24348. 0x97513360,
  24349. 0x854a247d,
  24350. 0x8b432976,
  24351. 0xd134621f,
  24352. 0xdf3d6f14,
  24353. 0xcd267809,
  24354. 0xc32f7502,
  24355. 0xe9105633,
  24356. 0xe7195b38,
  24357. 0xf5024c25,
  24358. 0xfb0b412e,
  24359. 0x9ad7618c,
  24360. 0x94de6c87,
  24361. 0x86c57b9a,
  24362. 0x88cc7691,
  24363. 0xa2f355a0,
  24364. 0xacfa58ab,
  24365. 0xbee14fb6,
  24366. 0xb0e842bd,
  24367. 0xea9f09d4,
  24368. 0xe49604df,
  24369. 0xf68d13c2,
  24370. 0xf8841ec9,
  24371. 0xd2bb3df8,
  24372. 0xdcb230f3,
  24373. 0xcea927ee,
  24374. 0xc0a02ae5,
  24375. 0x7a47b13c,
  24376. 0x744ebc37,
  24377. 0x6655ab2a,
  24378. 0x685ca621,
  24379. 0x42638510,
  24380. 0x4c6a881b,
  24381. 0x5e719f06,
  24382. 0x5078920d,
  24383. 0x0a0fd964,
  24384. 0x0406d46f,
  24385. 0x161dc372,
  24386. 0x1814ce79,
  24387. 0x322bed48,
  24388. 0x3c22e043,
  24389. 0x2e39f75e,
  24390. 0x2030fa55,
  24391. 0xec9ab701,
  24392. 0xe293ba0a,
  24393. 0xf088ad17,
  24394. 0xfe81a01c,
  24395. 0xd4be832d,
  24396. 0xdab78e26,
  24397. 0xc8ac993b,
  24398. 0xc6a59430,
  24399. 0x9cd2df59,
  24400. 0x92dbd252,
  24401. 0x80c0c54f,
  24402. 0x8ec9c844,
  24403. 0xa4f6eb75,
  24404. 0xaaffe67e,
  24405. 0xb8e4f163,
  24406. 0xb6edfc68,
  24407. 0x0c0a67b1,
  24408. 0x02036aba,
  24409. 0x10187da7,
  24410. 0x1e1170ac,
  24411. 0x342e539d,
  24412. 0x3a275e96,
  24413. 0x283c498b,
  24414. 0x26354480,
  24415. 0x7c420fe9,
  24416. 0x724b02e2,
  24417. 0x605015ff,
  24418. 0x6e5918f4,
  24419. 0x44663bc5,
  24420. 0x4a6f36ce,
  24421. 0x587421d3,
  24422. 0x567d2cd8,
  24423. 0x37a10c7a,
  24424. 0x39a80171,
  24425. 0x2bb3166c,
  24426. 0x25ba1b67,
  24427. 0x0f853856,
  24428. 0x018c355d,
  24429. 0x13972240,
  24430. 0x1d9e2f4b,
  24431. 0x47e96422,
  24432. 0x49e06929,
  24433. 0x5bfb7e34,
  24434. 0x55f2733f,
  24435. 0x7fcd500e,
  24436. 0x71c45d05,
  24437. 0x63df4a18,
  24438. 0x6dd64713,
  24439. 0xd731dcca,
  24440. 0xd938d1c1,
  24441. 0xcb23c6dc,
  24442. 0xc52acbd7,
  24443. 0xef15e8e6,
  24444. 0xe11ce5ed,
  24445. 0xf307f2f0,
  24446. 0xfd0efffb,
  24447. 0xa779b492,
  24448. 0xa970b999,
  24449. 0xbb6bae84,
  24450. 0xb562a38f,
  24451. 0x9f5d80be,
  24452. 0x91548db5,
  24453. 0x834f9aa8,
  24454. 0x8d4697a3
  24455. ]);
  24456. function expandKey128(cipherKey) {
  24457. var b = 176, result = new Uint8Array(b);
  24458. result.set(cipherKey);
  24459. for (var j = 16, i = 1; j < b; ++i) {
  24460. var t1 = result[j - 3], t2 = result[j - 2], t3 = result[j - 1], t4 = result[j - 4];
  24461. t1 = s[t1];
  24462. t2 = s[t2];
  24463. t3 = s[t3];
  24464. t4 = s[t4];
  24465. t1 = t1 ^ rcon[i];
  24466. for (var n = 0; n < 4; ++n) {
  24467. result[j] = t1 ^= result[j - 16];
  24468. j++;
  24469. result[j] = t2 ^= result[j - 16];
  24470. j++;
  24471. result[j] = t3 ^= result[j - 16];
  24472. j++;
  24473. result[j] = t4 ^= result[j - 16];
  24474. j++;
  24475. }
  24476. }
  24477. return result;
  24478. }
  24479. function decrypt128(input, key) {
  24480. var state = new Uint8Array(16);
  24481. state.set(input);
  24482. var i, j, k;
  24483. var t, u, v;
  24484. for (j = 0, k = 160; j < 16; ++j, ++k) {
  24485. state[j] ^= key[k];
  24486. }
  24487. for (i = 9; i >= 1; --i) {
  24488. t = state[13];
  24489. state[13] = state[9];
  24490. state[9] = state[5];
  24491. state[5] = state[1];
  24492. state[1] = t;
  24493. t = state[14];
  24494. u = state[10];
  24495. state[14] = state[6];
  24496. state[10] = state[2];
  24497. state[6] = t;
  24498. state[2] = u;
  24499. t = state[15];
  24500. u = state[11];
  24501. v = state[7];
  24502. state[15] = state[3];
  24503. state[11] = t;
  24504. state[7] = u;
  24505. state[3] = v;
  24506. for (j = 0; j < 16; ++j) {
  24507. state[j] = inv_s[state[j]];
  24508. }
  24509. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  24510. state[j] ^= key[k];
  24511. }
  24512. for (j = 0; j < 16; j += 4) {
  24513. var s0 = mix[state[j]], s1 = mix[state[j + 1]], s2 = mix[state[j + 2]], s3 = mix[state[j + 3]];
  24514. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  24515. state[j] = t >>> 24 & 0xFF;
  24516. state[j + 1] = t >> 16 & 0xFF;
  24517. state[j + 2] = t >> 8 & 0xFF;
  24518. state[j + 3] = t & 0xFF;
  24519. }
  24520. }
  24521. t = state[13];
  24522. state[13] = state[9];
  24523. state[9] = state[5];
  24524. state[5] = state[1];
  24525. state[1] = t;
  24526. t = state[14];
  24527. u = state[10];
  24528. state[14] = state[6];
  24529. state[10] = state[2];
  24530. state[6] = t;
  24531. state[2] = u;
  24532. t = state[15];
  24533. u = state[11];
  24534. v = state[7];
  24535. state[15] = state[3];
  24536. state[11] = t;
  24537. state[7] = u;
  24538. state[3] = v;
  24539. for (j = 0; j < 16; ++j) {
  24540. state[j] = inv_s[state[j]];
  24541. state[j] ^= key[j];
  24542. }
  24543. return state;
  24544. }
  24545. function encrypt128(input, key) {
  24546. var t, u, v, k;
  24547. var state = new Uint8Array(16);
  24548. state.set(input);
  24549. for (j = 0; j < 16; ++j) {
  24550. state[j] ^= key[j];
  24551. }
  24552. for (i = 1; i < 10; i++) {
  24553. for (j = 0; j < 16; ++j) {
  24554. state[j] = s[state[j]];
  24555. }
  24556. v = state[1];
  24557. state[1] = state[5];
  24558. state[5] = state[9];
  24559. state[9] = state[13];
  24560. state[13] = v;
  24561. v = state[2];
  24562. u = state[6];
  24563. state[2] = state[10];
  24564. state[6] = state[14];
  24565. state[10] = v;
  24566. state[14] = u;
  24567. v = state[3];
  24568. u = state[7];
  24569. t = state[11];
  24570. state[3] = state[15];
  24571. state[7] = v;
  24572. state[11] = u;
  24573. state[15] = t;
  24574. for (var j = 0; j < 16; j += 4) {
  24575. var s0 = state[j + 0], s1 = state[j + 1];
  24576. var s2 = state[j + 2], s3 = state[j + 3];
  24577. t = s0 ^ s1 ^ s2 ^ s3;
  24578. state[j + 0] ^= t ^ mixCol[s0 ^ s1];
  24579. state[j + 1] ^= t ^ mixCol[s1 ^ s2];
  24580. state[j + 2] ^= t ^ mixCol[s2 ^ s3];
  24581. state[j + 3] ^= t ^ mixCol[s3 ^ s0];
  24582. }
  24583. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  24584. state[j] ^= key[k];
  24585. }
  24586. }
  24587. for (j = 0; j < 16; ++j) {
  24588. state[j] = s[state[j]];
  24589. }
  24590. v = state[1];
  24591. state[1] = state[5];
  24592. state[5] = state[9];
  24593. state[9] = state[13];
  24594. state[13] = v;
  24595. v = state[2];
  24596. u = state[6];
  24597. state[2] = state[10];
  24598. state[6] = state[14];
  24599. state[10] = v;
  24600. state[14] = u;
  24601. v = state[3];
  24602. u = state[7];
  24603. t = state[11];
  24604. state[3] = state[15];
  24605. state[7] = v;
  24606. state[11] = u;
  24607. state[15] = t;
  24608. for (j = 0, k = 160; j < 16; ++j, ++k) {
  24609. state[j] ^= key[k];
  24610. }
  24611. return state;
  24612. }
  24613. function AES128Cipher(key) {
  24614. this.key = expandKey128(key);
  24615. this.buffer = new Uint8Array(16);
  24616. this.bufferPosition = 0;
  24617. }
  24618. function decryptBlock2(data, finalize) {
  24619. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [], iv = this.iv;
  24620. for (i = 0; i < sourceLength; ++i) {
  24621. buffer[bufferLength] = data[i];
  24622. ++bufferLength;
  24623. if (bufferLength < 16) {
  24624. continue;
  24625. }
  24626. var plain = decrypt128(buffer, this.key);
  24627. for (j = 0; j < 16; ++j) {
  24628. plain[j] ^= iv[j];
  24629. }
  24630. iv = buffer;
  24631. result.push(plain);
  24632. buffer = new Uint8Array(16);
  24633. bufferLength = 0;
  24634. }
  24635. this.buffer = buffer;
  24636. this.bufferLength = bufferLength;
  24637. this.iv = iv;
  24638. if (result.length === 0) {
  24639. return new Uint8Array([]);
  24640. }
  24641. var outputLength = 16 * result.length;
  24642. if (finalize) {
  24643. var lastBlock = result[result.length - 1];
  24644. var psLen = lastBlock[15];
  24645. if (psLen <= 16) {
  24646. for (i = 15, ii = 16 - psLen; i >= ii; --i) {
  24647. if (lastBlock[i] !== psLen) {
  24648. psLen = 0;
  24649. break;
  24650. }
  24651. }
  24652. outputLength -= psLen;
  24653. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  24654. }
  24655. }
  24656. var output = new Uint8Array(outputLength);
  24657. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  24658. output.set(result[i], j);
  24659. }
  24660. return output;
  24661. }
  24662. AES128Cipher.prototype = {
  24663. decryptBlock: function AES128Cipher_decryptBlock(data, finalize) {
  24664. var i, sourceLength = data.length;
  24665. var buffer = this.buffer, bufferLength = this.bufferPosition;
  24666. for (i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  24667. buffer[bufferLength] = data[i];
  24668. }
  24669. if (bufferLength < 16) {
  24670. this.bufferLength = bufferLength;
  24671. return new Uint8Array([]);
  24672. }
  24673. this.iv = buffer;
  24674. this.buffer = new Uint8Array(16);
  24675. this.bufferLength = 0;
  24676. this.decryptBlock = decryptBlock2;
  24677. return this.decryptBlock(data.subarray(16), finalize);
  24678. },
  24679. encrypt: function AES128Cipher_encrypt(data, iv) {
  24680. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [];
  24681. if (!iv) {
  24682. iv = new Uint8Array(16);
  24683. }
  24684. for (i = 0; i < sourceLength; ++i) {
  24685. buffer[bufferLength] = data[i];
  24686. ++bufferLength;
  24687. if (bufferLength < 16) {
  24688. continue;
  24689. }
  24690. for (j = 0; j < 16; ++j) {
  24691. buffer[j] ^= iv[j];
  24692. }
  24693. var cipher = encrypt128(buffer, this.key);
  24694. iv = cipher;
  24695. result.push(cipher);
  24696. buffer = new Uint8Array(16);
  24697. bufferLength = 0;
  24698. }
  24699. this.buffer = buffer;
  24700. this.bufferLength = bufferLength;
  24701. this.iv = iv;
  24702. if (result.length === 0) {
  24703. return new Uint8Array([]);
  24704. }
  24705. var outputLength = 16 * result.length;
  24706. var output = new Uint8Array(outputLength);
  24707. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  24708. output.set(result[i], j);
  24709. }
  24710. return output;
  24711. }
  24712. };
  24713. return AES128Cipher;
  24714. }();
  24715. var AES256Cipher = function AES256CipherClosure() {
  24716. var s = new Uint8Array([
  24717. 0x63,
  24718. 0x7c,
  24719. 0x77,
  24720. 0x7b,
  24721. 0xf2,
  24722. 0x6b,
  24723. 0x6f,
  24724. 0xc5,
  24725. 0x30,
  24726. 0x01,
  24727. 0x67,
  24728. 0x2b,
  24729. 0xfe,
  24730. 0xd7,
  24731. 0xab,
  24732. 0x76,
  24733. 0xca,
  24734. 0x82,
  24735. 0xc9,
  24736. 0x7d,
  24737. 0xfa,
  24738. 0x59,
  24739. 0x47,
  24740. 0xf0,
  24741. 0xad,
  24742. 0xd4,
  24743. 0xa2,
  24744. 0xaf,
  24745. 0x9c,
  24746. 0xa4,
  24747. 0x72,
  24748. 0xc0,
  24749. 0xb7,
  24750. 0xfd,
  24751. 0x93,
  24752. 0x26,
  24753. 0x36,
  24754. 0x3f,
  24755. 0xf7,
  24756. 0xcc,
  24757. 0x34,
  24758. 0xa5,
  24759. 0xe5,
  24760. 0xf1,
  24761. 0x71,
  24762. 0xd8,
  24763. 0x31,
  24764. 0x15,
  24765. 0x04,
  24766. 0xc7,
  24767. 0x23,
  24768. 0xc3,
  24769. 0x18,
  24770. 0x96,
  24771. 0x05,
  24772. 0x9a,
  24773. 0x07,
  24774. 0x12,
  24775. 0x80,
  24776. 0xe2,
  24777. 0xeb,
  24778. 0x27,
  24779. 0xb2,
  24780. 0x75,
  24781. 0x09,
  24782. 0x83,
  24783. 0x2c,
  24784. 0x1a,
  24785. 0x1b,
  24786. 0x6e,
  24787. 0x5a,
  24788. 0xa0,
  24789. 0x52,
  24790. 0x3b,
  24791. 0xd6,
  24792. 0xb3,
  24793. 0x29,
  24794. 0xe3,
  24795. 0x2f,
  24796. 0x84,
  24797. 0x53,
  24798. 0xd1,
  24799. 0x00,
  24800. 0xed,
  24801. 0x20,
  24802. 0xfc,
  24803. 0xb1,
  24804. 0x5b,
  24805. 0x6a,
  24806. 0xcb,
  24807. 0xbe,
  24808. 0x39,
  24809. 0x4a,
  24810. 0x4c,
  24811. 0x58,
  24812. 0xcf,
  24813. 0xd0,
  24814. 0xef,
  24815. 0xaa,
  24816. 0xfb,
  24817. 0x43,
  24818. 0x4d,
  24819. 0x33,
  24820. 0x85,
  24821. 0x45,
  24822. 0xf9,
  24823. 0x02,
  24824. 0x7f,
  24825. 0x50,
  24826. 0x3c,
  24827. 0x9f,
  24828. 0xa8,
  24829. 0x51,
  24830. 0xa3,
  24831. 0x40,
  24832. 0x8f,
  24833. 0x92,
  24834. 0x9d,
  24835. 0x38,
  24836. 0xf5,
  24837. 0xbc,
  24838. 0xb6,
  24839. 0xda,
  24840. 0x21,
  24841. 0x10,
  24842. 0xff,
  24843. 0xf3,
  24844. 0xd2,
  24845. 0xcd,
  24846. 0x0c,
  24847. 0x13,
  24848. 0xec,
  24849. 0x5f,
  24850. 0x97,
  24851. 0x44,
  24852. 0x17,
  24853. 0xc4,
  24854. 0xa7,
  24855. 0x7e,
  24856. 0x3d,
  24857. 0x64,
  24858. 0x5d,
  24859. 0x19,
  24860. 0x73,
  24861. 0x60,
  24862. 0x81,
  24863. 0x4f,
  24864. 0xdc,
  24865. 0x22,
  24866. 0x2a,
  24867. 0x90,
  24868. 0x88,
  24869. 0x46,
  24870. 0xee,
  24871. 0xb8,
  24872. 0x14,
  24873. 0xde,
  24874. 0x5e,
  24875. 0x0b,
  24876. 0xdb,
  24877. 0xe0,
  24878. 0x32,
  24879. 0x3a,
  24880. 0x0a,
  24881. 0x49,
  24882. 0x06,
  24883. 0x24,
  24884. 0x5c,
  24885. 0xc2,
  24886. 0xd3,
  24887. 0xac,
  24888. 0x62,
  24889. 0x91,
  24890. 0x95,
  24891. 0xe4,
  24892. 0x79,
  24893. 0xe7,
  24894. 0xc8,
  24895. 0x37,
  24896. 0x6d,
  24897. 0x8d,
  24898. 0xd5,
  24899. 0x4e,
  24900. 0xa9,
  24901. 0x6c,
  24902. 0x56,
  24903. 0xf4,
  24904. 0xea,
  24905. 0x65,
  24906. 0x7a,
  24907. 0xae,
  24908. 0x08,
  24909. 0xba,
  24910. 0x78,
  24911. 0x25,
  24912. 0x2e,
  24913. 0x1c,
  24914. 0xa6,
  24915. 0xb4,
  24916. 0xc6,
  24917. 0xe8,
  24918. 0xdd,
  24919. 0x74,
  24920. 0x1f,
  24921. 0x4b,
  24922. 0xbd,
  24923. 0x8b,
  24924. 0x8a,
  24925. 0x70,
  24926. 0x3e,
  24927. 0xb5,
  24928. 0x66,
  24929. 0x48,
  24930. 0x03,
  24931. 0xf6,
  24932. 0x0e,
  24933. 0x61,
  24934. 0x35,
  24935. 0x57,
  24936. 0xb9,
  24937. 0x86,
  24938. 0xc1,
  24939. 0x1d,
  24940. 0x9e,
  24941. 0xe1,
  24942. 0xf8,
  24943. 0x98,
  24944. 0x11,
  24945. 0x69,
  24946. 0xd9,
  24947. 0x8e,
  24948. 0x94,
  24949. 0x9b,
  24950. 0x1e,
  24951. 0x87,
  24952. 0xe9,
  24953. 0xce,
  24954. 0x55,
  24955. 0x28,
  24956. 0xdf,
  24957. 0x8c,
  24958. 0xa1,
  24959. 0x89,
  24960. 0x0d,
  24961. 0xbf,
  24962. 0xe6,
  24963. 0x42,
  24964. 0x68,
  24965. 0x41,
  24966. 0x99,
  24967. 0x2d,
  24968. 0x0f,
  24969. 0xb0,
  24970. 0x54,
  24971. 0xbb,
  24972. 0x16
  24973. ]);
  24974. var inv_s = new Uint8Array([
  24975. 0x52,
  24976. 0x09,
  24977. 0x6a,
  24978. 0xd5,
  24979. 0x30,
  24980. 0x36,
  24981. 0xa5,
  24982. 0x38,
  24983. 0xbf,
  24984. 0x40,
  24985. 0xa3,
  24986. 0x9e,
  24987. 0x81,
  24988. 0xf3,
  24989. 0xd7,
  24990. 0xfb,
  24991. 0x7c,
  24992. 0xe3,
  24993. 0x39,
  24994. 0x82,
  24995. 0x9b,
  24996. 0x2f,
  24997. 0xff,
  24998. 0x87,
  24999. 0x34,
  25000. 0x8e,
  25001. 0x43,
  25002. 0x44,
  25003. 0xc4,
  25004. 0xde,
  25005. 0xe9,
  25006. 0xcb,
  25007. 0x54,
  25008. 0x7b,
  25009. 0x94,
  25010. 0x32,
  25011. 0xa6,
  25012. 0xc2,
  25013. 0x23,
  25014. 0x3d,
  25015. 0xee,
  25016. 0x4c,
  25017. 0x95,
  25018. 0x0b,
  25019. 0x42,
  25020. 0xfa,
  25021. 0xc3,
  25022. 0x4e,
  25023. 0x08,
  25024. 0x2e,
  25025. 0xa1,
  25026. 0x66,
  25027. 0x28,
  25028. 0xd9,
  25029. 0x24,
  25030. 0xb2,
  25031. 0x76,
  25032. 0x5b,
  25033. 0xa2,
  25034. 0x49,
  25035. 0x6d,
  25036. 0x8b,
  25037. 0xd1,
  25038. 0x25,
  25039. 0x72,
  25040. 0xf8,
  25041. 0xf6,
  25042. 0x64,
  25043. 0x86,
  25044. 0x68,
  25045. 0x98,
  25046. 0x16,
  25047. 0xd4,
  25048. 0xa4,
  25049. 0x5c,
  25050. 0xcc,
  25051. 0x5d,
  25052. 0x65,
  25053. 0xb6,
  25054. 0x92,
  25055. 0x6c,
  25056. 0x70,
  25057. 0x48,
  25058. 0x50,
  25059. 0xfd,
  25060. 0xed,
  25061. 0xb9,
  25062. 0xda,
  25063. 0x5e,
  25064. 0x15,
  25065. 0x46,
  25066. 0x57,
  25067. 0xa7,
  25068. 0x8d,
  25069. 0x9d,
  25070. 0x84,
  25071. 0x90,
  25072. 0xd8,
  25073. 0xab,
  25074. 0x00,
  25075. 0x8c,
  25076. 0xbc,
  25077. 0xd3,
  25078. 0x0a,
  25079. 0xf7,
  25080. 0xe4,
  25081. 0x58,
  25082. 0x05,
  25083. 0xb8,
  25084. 0xb3,
  25085. 0x45,
  25086. 0x06,
  25087. 0xd0,
  25088. 0x2c,
  25089. 0x1e,
  25090. 0x8f,
  25091. 0xca,
  25092. 0x3f,
  25093. 0x0f,
  25094. 0x02,
  25095. 0xc1,
  25096. 0xaf,
  25097. 0xbd,
  25098. 0x03,
  25099. 0x01,
  25100. 0x13,
  25101. 0x8a,
  25102. 0x6b,
  25103. 0x3a,
  25104. 0x91,
  25105. 0x11,
  25106. 0x41,
  25107. 0x4f,
  25108. 0x67,
  25109. 0xdc,
  25110. 0xea,
  25111. 0x97,
  25112. 0xf2,
  25113. 0xcf,
  25114. 0xce,
  25115. 0xf0,
  25116. 0xb4,
  25117. 0xe6,
  25118. 0x73,
  25119. 0x96,
  25120. 0xac,
  25121. 0x74,
  25122. 0x22,
  25123. 0xe7,
  25124. 0xad,
  25125. 0x35,
  25126. 0x85,
  25127. 0xe2,
  25128. 0xf9,
  25129. 0x37,
  25130. 0xe8,
  25131. 0x1c,
  25132. 0x75,
  25133. 0xdf,
  25134. 0x6e,
  25135. 0x47,
  25136. 0xf1,
  25137. 0x1a,
  25138. 0x71,
  25139. 0x1d,
  25140. 0x29,
  25141. 0xc5,
  25142. 0x89,
  25143. 0x6f,
  25144. 0xb7,
  25145. 0x62,
  25146. 0x0e,
  25147. 0xaa,
  25148. 0x18,
  25149. 0xbe,
  25150. 0x1b,
  25151. 0xfc,
  25152. 0x56,
  25153. 0x3e,
  25154. 0x4b,
  25155. 0xc6,
  25156. 0xd2,
  25157. 0x79,
  25158. 0x20,
  25159. 0x9a,
  25160. 0xdb,
  25161. 0xc0,
  25162. 0xfe,
  25163. 0x78,
  25164. 0xcd,
  25165. 0x5a,
  25166. 0xf4,
  25167. 0x1f,
  25168. 0xdd,
  25169. 0xa8,
  25170. 0x33,
  25171. 0x88,
  25172. 0x07,
  25173. 0xc7,
  25174. 0x31,
  25175. 0xb1,
  25176. 0x12,
  25177. 0x10,
  25178. 0x59,
  25179. 0x27,
  25180. 0x80,
  25181. 0xec,
  25182. 0x5f,
  25183. 0x60,
  25184. 0x51,
  25185. 0x7f,
  25186. 0xa9,
  25187. 0x19,
  25188. 0xb5,
  25189. 0x4a,
  25190. 0x0d,
  25191. 0x2d,
  25192. 0xe5,
  25193. 0x7a,
  25194. 0x9f,
  25195. 0x93,
  25196. 0xc9,
  25197. 0x9c,
  25198. 0xef,
  25199. 0xa0,
  25200. 0xe0,
  25201. 0x3b,
  25202. 0x4d,
  25203. 0xae,
  25204. 0x2a,
  25205. 0xf5,
  25206. 0xb0,
  25207. 0xc8,
  25208. 0xeb,
  25209. 0xbb,
  25210. 0x3c,
  25211. 0x83,
  25212. 0x53,
  25213. 0x99,
  25214. 0x61,
  25215. 0x17,
  25216. 0x2b,
  25217. 0x04,
  25218. 0x7e,
  25219. 0xba,
  25220. 0x77,
  25221. 0xd6,
  25222. 0x26,
  25223. 0xe1,
  25224. 0x69,
  25225. 0x14,
  25226. 0x63,
  25227. 0x55,
  25228. 0x21,
  25229. 0x0c,
  25230. 0x7d
  25231. ]);
  25232. var mixCol = new Uint8Array(256);
  25233. for (var i = 0; i < 256; i++) {
  25234. if (i < 128) {
  25235. mixCol[i] = i << 1;
  25236. } else {
  25237. mixCol[i] = i << 1 ^ 0x1b;
  25238. }
  25239. }
  25240. var mix = new Uint32Array([
  25241. 0x00000000,
  25242. 0x0e090d0b,
  25243. 0x1c121a16,
  25244. 0x121b171d,
  25245. 0x3824342c,
  25246. 0x362d3927,
  25247. 0x24362e3a,
  25248. 0x2a3f2331,
  25249. 0x70486858,
  25250. 0x7e416553,
  25251. 0x6c5a724e,
  25252. 0x62537f45,
  25253. 0x486c5c74,
  25254. 0x4665517f,
  25255. 0x547e4662,
  25256. 0x5a774b69,
  25257. 0xe090d0b0,
  25258. 0xee99ddbb,
  25259. 0xfc82caa6,
  25260. 0xf28bc7ad,
  25261. 0xd8b4e49c,
  25262. 0xd6bde997,
  25263. 0xc4a6fe8a,
  25264. 0xcaaff381,
  25265. 0x90d8b8e8,
  25266. 0x9ed1b5e3,
  25267. 0x8ccaa2fe,
  25268. 0x82c3aff5,
  25269. 0xa8fc8cc4,
  25270. 0xa6f581cf,
  25271. 0xb4ee96d2,
  25272. 0xbae79bd9,
  25273. 0xdb3bbb7b,
  25274. 0xd532b670,
  25275. 0xc729a16d,
  25276. 0xc920ac66,
  25277. 0xe31f8f57,
  25278. 0xed16825c,
  25279. 0xff0d9541,
  25280. 0xf104984a,
  25281. 0xab73d323,
  25282. 0xa57ade28,
  25283. 0xb761c935,
  25284. 0xb968c43e,
  25285. 0x9357e70f,
  25286. 0x9d5eea04,
  25287. 0x8f45fd19,
  25288. 0x814cf012,
  25289. 0x3bab6bcb,
  25290. 0x35a266c0,
  25291. 0x27b971dd,
  25292. 0x29b07cd6,
  25293. 0x038f5fe7,
  25294. 0x0d8652ec,
  25295. 0x1f9d45f1,
  25296. 0x119448fa,
  25297. 0x4be30393,
  25298. 0x45ea0e98,
  25299. 0x57f11985,
  25300. 0x59f8148e,
  25301. 0x73c737bf,
  25302. 0x7dce3ab4,
  25303. 0x6fd52da9,
  25304. 0x61dc20a2,
  25305. 0xad766df6,
  25306. 0xa37f60fd,
  25307. 0xb16477e0,
  25308. 0xbf6d7aeb,
  25309. 0x955259da,
  25310. 0x9b5b54d1,
  25311. 0x894043cc,
  25312. 0x87494ec7,
  25313. 0xdd3e05ae,
  25314. 0xd33708a5,
  25315. 0xc12c1fb8,
  25316. 0xcf2512b3,
  25317. 0xe51a3182,
  25318. 0xeb133c89,
  25319. 0xf9082b94,
  25320. 0xf701269f,
  25321. 0x4de6bd46,
  25322. 0x43efb04d,
  25323. 0x51f4a750,
  25324. 0x5ffdaa5b,
  25325. 0x75c2896a,
  25326. 0x7bcb8461,
  25327. 0x69d0937c,
  25328. 0x67d99e77,
  25329. 0x3daed51e,
  25330. 0x33a7d815,
  25331. 0x21bccf08,
  25332. 0x2fb5c203,
  25333. 0x058ae132,
  25334. 0x0b83ec39,
  25335. 0x1998fb24,
  25336. 0x1791f62f,
  25337. 0x764dd68d,
  25338. 0x7844db86,
  25339. 0x6a5fcc9b,
  25340. 0x6456c190,
  25341. 0x4e69e2a1,
  25342. 0x4060efaa,
  25343. 0x527bf8b7,
  25344. 0x5c72f5bc,
  25345. 0x0605bed5,
  25346. 0x080cb3de,
  25347. 0x1a17a4c3,
  25348. 0x141ea9c8,
  25349. 0x3e218af9,
  25350. 0x302887f2,
  25351. 0x223390ef,
  25352. 0x2c3a9de4,
  25353. 0x96dd063d,
  25354. 0x98d40b36,
  25355. 0x8acf1c2b,
  25356. 0x84c61120,
  25357. 0xaef93211,
  25358. 0xa0f03f1a,
  25359. 0xb2eb2807,
  25360. 0xbce2250c,
  25361. 0xe6956e65,
  25362. 0xe89c636e,
  25363. 0xfa877473,
  25364. 0xf48e7978,
  25365. 0xdeb15a49,
  25366. 0xd0b85742,
  25367. 0xc2a3405f,
  25368. 0xccaa4d54,
  25369. 0x41ecdaf7,
  25370. 0x4fe5d7fc,
  25371. 0x5dfec0e1,
  25372. 0x53f7cdea,
  25373. 0x79c8eedb,
  25374. 0x77c1e3d0,
  25375. 0x65daf4cd,
  25376. 0x6bd3f9c6,
  25377. 0x31a4b2af,
  25378. 0x3fadbfa4,
  25379. 0x2db6a8b9,
  25380. 0x23bfa5b2,
  25381. 0x09808683,
  25382. 0x07898b88,
  25383. 0x15929c95,
  25384. 0x1b9b919e,
  25385. 0xa17c0a47,
  25386. 0xaf75074c,
  25387. 0xbd6e1051,
  25388. 0xb3671d5a,
  25389. 0x99583e6b,
  25390. 0x97513360,
  25391. 0x854a247d,
  25392. 0x8b432976,
  25393. 0xd134621f,
  25394. 0xdf3d6f14,
  25395. 0xcd267809,
  25396. 0xc32f7502,
  25397. 0xe9105633,
  25398. 0xe7195b38,
  25399. 0xf5024c25,
  25400. 0xfb0b412e,
  25401. 0x9ad7618c,
  25402. 0x94de6c87,
  25403. 0x86c57b9a,
  25404. 0x88cc7691,
  25405. 0xa2f355a0,
  25406. 0xacfa58ab,
  25407. 0xbee14fb6,
  25408. 0xb0e842bd,
  25409. 0xea9f09d4,
  25410. 0xe49604df,
  25411. 0xf68d13c2,
  25412. 0xf8841ec9,
  25413. 0xd2bb3df8,
  25414. 0xdcb230f3,
  25415. 0xcea927ee,
  25416. 0xc0a02ae5,
  25417. 0x7a47b13c,
  25418. 0x744ebc37,
  25419. 0x6655ab2a,
  25420. 0x685ca621,
  25421. 0x42638510,
  25422. 0x4c6a881b,
  25423. 0x5e719f06,
  25424. 0x5078920d,
  25425. 0x0a0fd964,
  25426. 0x0406d46f,
  25427. 0x161dc372,
  25428. 0x1814ce79,
  25429. 0x322bed48,
  25430. 0x3c22e043,
  25431. 0x2e39f75e,
  25432. 0x2030fa55,
  25433. 0xec9ab701,
  25434. 0xe293ba0a,
  25435. 0xf088ad17,
  25436. 0xfe81a01c,
  25437. 0xd4be832d,
  25438. 0xdab78e26,
  25439. 0xc8ac993b,
  25440. 0xc6a59430,
  25441. 0x9cd2df59,
  25442. 0x92dbd252,
  25443. 0x80c0c54f,
  25444. 0x8ec9c844,
  25445. 0xa4f6eb75,
  25446. 0xaaffe67e,
  25447. 0xb8e4f163,
  25448. 0xb6edfc68,
  25449. 0x0c0a67b1,
  25450. 0x02036aba,
  25451. 0x10187da7,
  25452. 0x1e1170ac,
  25453. 0x342e539d,
  25454. 0x3a275e96,
  25455. 0x283c498b,
  25456. 0x26354480,
  25457. 0x7c420fe9,
  25458. 0x724b02e2,
  25459. 0x605015ff,
  25460. 0x6e5918f4,
  25461. 0x44663bc5,
  25462. 0x4a6f36ce,
  25463. 0x587421d3,
  25464. 0x567d2cd8,
  25465. 0x37a10c7a,
  25466. 0x39a80171,
  25467. 0x2bb3166c,
  25468. 0x25ba1b67,
  25469. 0x0f853856,
  25470. 0x018c355d,
  25471. 0x13972240,
  25472. 0x1d9e2f4b,
  25473. 0x47e96422,
  25474. 0x49e06929,
  25475. 0x5bfb7e34,
  25476. 0x55f2733f,
  25477. 0x7fcd500e,
  25478. 0x71c45d05,
  25479. 0x63df4a18,
  25480. 0x6dd64713,
  25481. 0xd731dcca,
  25482. 0xd938d1c1,
  25483. 0xcb23c6dc,
  25484. 0xc52acbd7,
  25485. 0xef15e8e6,
  25486. 0xe11ce5ed,
  25487. 0xf307f2f0,
  25488. 0xfd0efffb,
  25489. 0xa779b492,
  25490. 0xa970b999,
  25491. 0xbb6bae84,
  25492. 0xb562a38f,
  25493. 0x9f5d80be,
  25494. 0x91548db5,
  25495. 0x834f9aa8,
  25496. 0x8d4697a3
  25497. ]);
  25498. function expandKey256(cipherKey) {
  25499. var b = 240, result = new Uint8Array(b);
  25500. var r = 1;
  25501. result.set(cipherKey);
  25502. for (var j = 32, i = 1; j < b; ++i) {
  25503. if (j % 32 === 16) {
  25504. t1 = s[t1];
  25505. t2 = s[t2];
  25506. t3 = s[t3];
  25507. t4 = s[t4];
  25508. } else if (j % 32 === 0) {
  25509. var t1 = result[j - 3], t2 = result[j - 2], t3 = result[j - 1], t4 = result[j - 4];
  25510. t1 = s[t1];
  25511. t2 = s[t2];
  25512. t3 = s[t3];
  25513. t4 = s[t4];
  25514. t1 = t1 ^ r;
  25515. if ((r <<= 1) >= 256) {
  25516. r = (r ^ 0x1b) & 0xFF;
  25517. }
  25518. }
  25519. for (var n = 0; n < 4; ++n) {
  25520. result[j] = t1 ^= result[j - 32];
  25521. j++;
  25522. result[j] = t2 ^= result[j - 32];
  25523. j++;
  25524. result[j] = t3 ^= result[j - 32];
  25525. j++;
  25526. result[j] = t4 ^= result[j - 32];
  25527. j++;
  25528. }
  25529. }
  25530. return result;
  25531. }
  25532. function decrypt256(input, key) {
  25533. var state = new Uint8Array(16);
  25534. state.set(input);
  25535. var i, j, k;
  25536. var t, u, v;
  25537. for (j = 0, k = 224; j < 16; ++j, ++k) {
  25538. state[j] ^= key[k];
  25539. }
  25540. for (i = 13; i >= 1; --i) {
  25541. t = state[13];
  25542. state[13] = state[9];
  25543. state[9] = state[5];
  25544. state[5] = state[1];
  25545. state[1] = t;
  25546. t = state[14];
  25547. u = state[10];
  25548. state[14] = state[6];
  25549. state[10] = state[2];
  25550. state[6] = t;
  25551. state[2] = u;
  25552. t = state[15];
  25553. u = state[11];
  25554. v = state[7];
  25555. state[15] = state[3];
  25556. state[11] = t;
  25557. state[7] = u;
  25558. state[3] = v;
  25559. for (j = 0; j < 16; ++j) {
  25560. state[j] = inv_s[state[j]];
  25561. }
  25562. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  25563. state[j] ^= key[k];
  25564. }
  25565. for (j = 0; j < 16; j += 4) {
  25566. var s0 = mix[state[j]], s1 = mix[state[j + 1]], s2 = mix[state[j + 2]], s3 = mix[state[j + 3]];
  25567. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  25568. state[j] = t >>> 24 & 0xFF;
  25569. state[j + 1] = t >> 16 & 0xFF;
  25570. state[j + 2] = t >> 8 & 0xFF;
  25571. state[j + 3] = t & 0xFF;
  25572. }
  25573. }
  25574. t = state[13];
  25575. state[13] = state[9];
  25576. state[9] = state[5];
  25577. state[5] = state[1];
  25578. state[1] = t;
  25579. t = state[14];
  25580. u = state[10];
  25581. state[14] = state[6];
  25582. state[10] = state[2];
  25583. state[6] = t;
  25584. state[2] = u;
  25585. t = state[15];
  25586. u = state[11];
  25587. v = state[7];
  25588. state[15] = state[3];
  25589. state[11] = t;
  25590. state[7] = u;
  25591. state[3] = v;
  25592. for (j = 0; j < 16; ++j) {
  25593. state[j] = inv_s[state[j]];
  25594. state[j] ^= key[j];
  25595. }
  25596. return state;
  25597. }
  25598. function encrypt256(input, key) {
  25599. var t, u, v, k;
  25600. var state = new Uint8Array(16);
  25601. state.set(input);
  25602. for (j = 0; j < 16; ++j) {
  25603. state[j] ^= key[j];
  25604. }
  25605. for (i = 1; i < 14; i++) {
  25606. for (j = 0; j < 16; ++j) {
  25607. state[j] = s[state[j]];
  25608. }
  25609. v = state[1];
  25610. state[1] = state[5];
  25611. state[5] = state[9];
  25612. state[9] = state[13];
  25613. state[13] = v;
  25614. v = state[2];
  25615. u = state[6];
  25616. state[2] = state[10];
  25617. state[6] = state[14];
  25618. state[10] = v;
  25619. state[14] = u;
  25620. v = state[3];
  25621. u = state[7];
  25622. t = state[11];
  25623. state[3] = state[15];
  25624. state[7] = v;
  25625. state[11] = u;
  25626. state[15] = t;
  25627. for (var j = 0; j < 16; j += 4) {
  25628. var s0 = state[j + 0], s1 = state[j + 1];
  25629. var s2 = state[j + 2], s3 = state[j + 3];
  25630. t = s0 ^ s1 ^ s2 ^ s3;
  25631. state[j + 0] ^= t ^ mixCol[s0 ^ s1];
  25632. state[j + 1] ^= t ^ mixCol[s1 ^ s2];
  25633. state[j + 2] ^= t ^ mixCol[s2 ^ s3];
  25634. state[j + 3] ^= t ^ mixCol[s3 ^ s0];
  25635. }
  25636. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  25637. state[j] ^= key[k];
  25638. }
  25639. }
  25640. for (j = 0; j < 16; ++j) {
  25641. state[j] = s[state[j]];
  25642. }
  25643. v = state[1];
  25644. state[1] = state[5];
  25645. state[5] = state[9];
  25646. state[9] = state[13];
  25647. state[13] = v;
  25648. v = state[2];
  25649. u = state[6];
  25650. state[2] = state[10];
  25651. state[6] = state[14];
  25652. state[10] = v;
  25653. state[14] = u;
  25654. v = state[3];
  25655. u = state[7];
  25656. t = state[11];
  25657. state[3] = state[15];
  25658. state[7] = v;
  25659. state[11] = u;
  25660. state[15] = t;
  25661. for (j = 0, k = 224; j < 16; ++j, ++k) {
  25662. state[j] ^= key[k];
  25663. }
  25664. return state;
  25665. }
  25666. function AES256Cipher(key) {
  25667. this.key = expandKey256(key);
  25668. this.buffer = new Uint8Array(16);
  25669. this.bufferPosition = 0;
  25670. }
  25671. function decryptBlock2(data, finalize) {
  25672. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [], iv = this.iv;
  25673. for (i = 0; i < sourceLength; ++i) {
  25674. buffer[bufferLength] = data[i];
  25675. ++bufferLength;
  25676. if (bufferLength < 16) {
  25677. continue;
  25678. }
  25679. var plain = decrypt256(buffer, this.key);
  25680. for (j = 0; j < 16; ++j) {
  25681. plain[j] ^= iv[j];
  25682. }
  25683. iv = buffer;
  25684. result.push(plain);
  25685. buffer = new Uint8Array(16);
  25686. bufferLength = 0;
  25687. }
  25688. this.buffer = buffer;
  25689. this.bufferLength = bufferLength;
  25690. this.iv = iv;
  25691. if (result.length === 0) {
  25692. return new Uint8Array([]);
  25693. }
  25694. var outputLength = 16 * result.length;
  25695. if (finalize) {
  25696. var lastBlock = result[result.length - 1];
  25697. var psLen = lastBlock[15];
  25698. if (psLen <= 16) {
  25699. for (i = 15, ii = 16 - psLen; i >= ii; --i) {
  25700. if (lastBlock[i] !== psLen) {
  25701. psLen = 0;
  25702. break;
  25703. }
  25704. }
  25705. outputLength -= psLen;
  25706. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  25707. }
  25708. }
  25709. var output = new Uint8Array(outputLength);
  25710. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  25711. output.set(result[i], j);
  25712. }
  25713. return output;
  25714. }
  25715. AES256Cipher.prototype = {
  25716. decryptBlock: function AES256Cipher_decryptBlock(data, finalize, iv) {
  25717. var i, sourceLength = data.length;
  25718. var buffer = this.buffer, bufferLength = this.bufferPosition;
  25719. if (iv) {
  25720. this.iv = iv;
  25721. } else {
  25722. for (i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  25723. buffer[bufferLength] = data[i];
  25724. }
  25725. if (bufferLength < 16) {
  25726. this.bufferLength = bufferLength;
  25727. return new Uint8Array([]);
  25728. }
  25729. this.iv = buffer;
  25730. data = data.subarray(16);
  25731. }
  25732. this.buffer = new Uint8Array(16);
  25733. this.bufferLength = 0;
  25734. this.decryptBlock = decryptBlock2;
  25735. return this.decryptBlock(data, finalize);
  25736. },
  25737. encrypt: function AES256Cipher_encrypt(data, iv) {
  25738. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [];
  25739. if (!iv) {
  25740. iv = new Uint8Array(16);
  25741. }
  25742. for (i = 0; i < sourceLength; ++i) {
  25743. buffer[bufferLength] = data[i];
  25744. ++bufferLength;
  25745. if (bufferLength < 16) {
  25746. continue;
  25747. }
  25748. for (j = 0; j < 16; ++j) {
  25749. buffer[j] ^= iv[j];
  25750. }
  25751. var cipher = encrypt256(buffer, this.key);
  25752. this.iv = cipher;
  25753. result.push(cipher);
  25754. buffer = new Uint8Array(16);
  25755. bufferLength = 0;
  25756. }
  25757. this.buffer = buffer;
  25758. this.bufferLength = bufferLength;
  25759. this.iv = iv;
  25760. if (result.length === 0) {
  25761. return new Uint8Array([]);
  25762. }
  25763. var outputLength = 16 * result.length;
  25764. var output = new Uint8Array(outputLength);
  25765. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  25766. output.set(result[i], j);
  25767. }
  25768. return output;
  25769. }
  25770. };
  25771. return AES256Cipher;
  25772. }();
  25773. var PDF17 = function PDF17Closure() {
  25774. function compareByteArrays(array1, array2) {
  25775. if (array1.length !== array2.length) {
  25776. return false;
  25777. }
  25778. for (var i = 0; i < array1.length; i++) {
  25779. if (array1[i] !== array2[i]) {
  25780. return false;
  25781. }
  25782. }
  25783. return true;
  25784. }
  25785. function PDF17() {
  25786. }
  25787. PDF17.prototype = {
  25788. checkOwnerPassword: function PDF17_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  25789. var hashData = new Uint8Array(password.length + 56);
  25790. hashData.set(password, 0);
  25791. hashData.set(ownerValidationSalt, password.length);
  25792. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  25793. var result = calculateSHA256(hashData, 0, hashData.length);
  25794. return compareByteArrays(result, ownerPassword);
  25795. },
  25796. checkUserPassword: function PDF17_checkUserPassword(password, userValidationSalt, userPassword) {
  25797. var hashData = new Uint8Array(password.length + 8);
  25798. hashData.set(password, 0);
  25799. hashData.set(userValidationSalt, password.length);
  25800. var result = calculateSHA256(hashData, 0, hashData.length);
  25801. return compareByteArrays(result, userPassword);
  25802. },
  25803. getOwnerKey: function PDF17_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  25804. var hashData = new Uint8Array(password.length + 56);
  25805. hashData.set(password, 0);
  25806. hashData.set(ownerKeySalt, password.length);
  25807. hashData.set(userBytes, password.length + ownerKeySalt.length);
  25808. var key = calculateSHA256(hashData, 0, hashData.length);
  25809. var cipher = new AES256Cipher(key);
  25810. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  25811. },
  25812. getUserKey: function PDF17_getUserKey(password, userKeySalt, userEncryption) {
  25813. var hashData = new Uint8Array(password.length + 8);
  25814. hashData.set(password, 0);
  25815. hashData.set(userKeySalt, password.length);
  25816. var key = calculateSHA256(hashData, 0, hashData.length);
  25817. var cipher = new AES256Cipher(key);
  25818. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  25819. }
  25820. };
  25821. return PDF17;
  25822. }();
  25823. var PDF20 = function PDF20Closure() {
  25824. function concatArrays(array1, array2) {
  25825. var t = new Uint8Array(array1.length + array2.length);
  25826. t.set(array1, 0);
  25827. t.set(array2, array1.length);
  25828. return t;
  25829. }
  25830. function calculatePDF20Hash(password, input, userBytes) {
  25831. var k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  25832. var e = [0];
  25833. var i = 0;
  25834. while (i < 64 || e[e.length - 1] > i - 32) {
  25835. var arrayLength = password.length + k.length + userBytes.length;
  25836. var k1 = new Uint8Array(arrayLength * 64);
  25837. var array = concatArrays(password, k);
  25838. array = concatArrays(array, userBytes);
  25839. for (var j = 0, pos = 0; j < 64; j++, pos += arrayLength) {
  25840. k1.set(array, pos);
  25841. }
  25842. var cipher = new AES128Cipher(k.subarray(0, 16));
  25843. e = cipher.encrypt(k1, k.subarray(16, 32));
  25844. var remainder = 0;
  25845. for (var z = 0; z < 16; z++) {
  25846. remainder *= 256 % 3;
  25847. remainder %= 3;
  25848. remainder += (e[z] >>> 0) % 3;
  25849. remainder %= 3;
  25850. }
  25851. if (remainder === 0) {
  25852. k = calculateSHA256(e, 0, e.length);
  25853. } else if (remainder === 1) {
  25854. k = calculateSHA384(e, 0, e.length);
  25855. } else if (remainder === 2) {
  25856. k = calculateSHA512(e, 0, e.length);
  25857. }
  25858. i++;
  25859. }
  25860. return k.subarray(0, 32);
  25861. }
  25862. function PDF20() {
  25863. }
  25864. function compareByteArrays(array1, array2) {
  25865. if (array1.length !== array2.length) {
  25866. return false;
  25867. }
  25868. for (var i = 0; i < array1.length; i++) {
  25869. if (array1[i] !== array2[i]) {
  25870. return false;
  25871. }
  25872. }
  25873. return true;
  25874. }
  25875. PDF20.prototype = {
  25876. hash: function PDF20_hash(password, concatBytes, userBytes) {
  25877. return calculatePDF20Hash(password, concatBytes, userBytes);
  25878. },
  25879. checkOwnerPassword: function PDF20_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  25880. var hashData = new Uint8Array(password.length + 56);
  25881. hashData.set(password, 0);
  25882. hashData.set(ownerValidationSalt, password.length);
  25883. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  25884. var result = calculatePDF20Hash(password, hashData, userBytes);
  25885. return compareByteArrays(result, ownerPassword);
  25886. },
  25887. checkUserPassword: function PDF20_checkUserPassword(password, userValidationSalt, userPassword) {
  25888. var hashData = new Uint8Array(password.length + 8);
  25889. hashData.set(password, 0);
  25890. hashData.set(userValidationSalt, password.length);
  25891. var result = calculatePDF20Hash(password, hashData, []);
  25892. return compareByteArrays(result, userPassword);
  25893. },
  25894. getOwnerKey: function PDF20_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  25895. var hashData = new Uint8Array(password.length + 56);
  25896. hashData.set(password, 0);
  25897. hashData.set(ownerKeySalt, password.length);
  25898. hashData.set(userBytes, password.length + ownerKeySalt.length);
  25899. var key = calculatePDF20Hash(password, hashData, userBytes);
  25900. var cipher = new AES256Cipher(key);
  25901. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  25902. },
  25903. getUserKey: function PDF20_getUserKey(password, userKeySalt, userEncryption) {
  25904. var hashData = new Uint8Array(password.length + 8);
  25905. hashData.set(password, 0);
  25906. hashData.set(userKeySalt, password.length);
  25907. var key = calculatePDF20Hash(password, hashData, []);
  25908. var cipher = new AES256Cipher(key);
  25909. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  25910. }
  25911. };
  25912. return PDF20;
  25913. }();
  25914. var CipherTransform = function CipherTransformClosure() {
  25915. function CipherTransform(stringCipherConstructor, streamCipherConstructor) {
  25916. this.StringCipherConstructor = stringCipherConstructor;
  25917. this.StreamCipherConstructor = streamCipherConstructor;
  25918. }
  25919. CipherTransform.prototype = {
  25920. createStream: function CipherTransform_createStream(stream, length) {
  25921. var cipher = new this.StreamCipherConstructor();
  25922. return new DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  25923. return cipher.decryptBlock(data, finalize);
  25924. });
  25925. },
  25926. decryptString: function CipherTransform_decryptString(s) {
  25927. var cipher = new this.StringCipherConstructor();
  25928. var data = stringToBytes(s);
  25929. data = cipher.decryptBlock(data, true);
  25930. return bytesToString(data);
  25931. }
  25932. };
  25933. return CipherTransform;
  25934. }();
  25935. var CipherTransformFactory = function CipherTransformFactoryClosure() {
  25936. var defaultPasswordBytes = new Uint8Array([
  25937. 0x28,
  25938. 0xBF,
  25939. 0x4E,
  25940. 0x5E,
  25941. 0x4E,
  25942. 0x75,
  25943. 0x8A,
  25944. 0x41,
  25945. 0x64,
  25946. 0x00,
  25947. 0x4E,
  25948. 0x56,
  25949. 0xFF,
  25950. 0xFA,
  25951. 0x01,
  25952. 0x08,
  25953. 0x2E,
  25954. 0x2E,
  25955. 0x00,
  25956. 0xB6,
  25957. 0xD0,
  25958. 0x68,
  25959. 0x3E,
  25960. 0x80,
  25961. 0x2F,
  25962. 0x0C,
  25963. 0xA9,
  25964. 0xFE,
  25965. 0x64,
  25966. 0x53,
  25967. 0x69,
  25968. 0x7A
  25969. ]);
  25970. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  25971. if (password) {
  25972. var passwordLength = Math.min(127, password.length);
  25973. password = password.subarray(0, passwordLength);
  25974. } else {
  25975. password = [];
  25976. }
  25977. var pdfAlgorithm;
  25978. if (revision === 6) {
  25979. pdfAlgorithm = new PDF20();
  25980. } else {
  25981. pdfAlgorithm = new PDF17();
  25982. }
  25983. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  25984. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  25985. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  25986. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  25987. }
  25988. return null;
  25989. }
  25990. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  25991. var hashDataSize = 40 + ownerPassword.length + fileId.length;
  25992. var hashData = new Uint8Array(hashDataSize), i = 0, j, n;
  25993. if (password) {
  25994. n = Math.min(32, password.length);
  25995. for (; i < n; ++i) {
  25996. hashData[i] = password[i];
  25997. }
  25998. }
  25999. j = 0;
  26000. while (i < 32) {
  26001. hashData[i++] = defaultPasswordBytes[j++];
  26002. }
  26003. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  26004. hashData[i++] = ownerPassword[j];
  26005. }
  26006. hashData[i++] = flags & 0xFF;
  26007. hashData[i++] = flags >> 8 & 0xFF;
  26008. hashData[i++] = flags >> 16 & 0xFF;
  26009. hashData[i++] = flags >>> 24 & 0xFF;
  26010. for (j = 0, n = fileId.length; j < n; ++j) {
  26011. hashData[i++] = fileId[j];
  26012. }
  26013. if (revision >= 4 && !encryptMetadata) {
  26014. hashData[i++] = 0xFF;
  26015. hashData[i++] = 0xFF;
  26016. hashData[i++] = 0xFF;
  26017. hashData[i++] = 0xFF;
  26018. }
  26019. var hash = calculateMD5(hashData, 0, i);
  26020. var keyLengthInBytes = keyLength >> 3;
  26021. if (revision >= 3) {
  26022. for (j = 0; j < 50; ++j) {
  26023. hash = calculateMD5(hash, 0, keyLengthInBytes);
  26024. }
  26025. }
  26026. var encryptionKey = hash.subarray(0, keyLengthInBytes);
  26027. var cipher, checkData;
  26028. if (revision >= 3) {
  26029. for (i = 0; i < 32; ++i) {
  26030. hashData[i] = defaultPasswordBytes[i];
  26031. }
  26032. for (j = 0, n = fileId.length; j < n; ++j) {
  26033. hashData[i++] = fileId[j];
  26034. }
  26035. cipher = new ARCFourCipher(encryptionKey);
  26036. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  26037. n = encryptionKey.length;
  26038. var derivedKey = new Uint8Array(n), k;
  26039. for (j = 1; j <= 19; ++j) {
  26040. for (k = 0; k < n; ++k) {
  26041. derivedKey[k] = encryptionKey[k] ^ j;
  26042. }
  26043. cipher = new ARCFourCipher(derivedKey);
  26044. checkData = cipher.encryptBlock(checkData);
  26045. }
  26046. for (j = 0, n = checkData.length; j < n; ++j) {
  26047. if (userPassword[j] !== checkData[j]) {
  26048. return null;
  26049. }
  26050. }
  26051. } else {
  26052. cipher = new ARCFourCipher(encryptionKey);
  26053. checkData = cipher.encryptBlock(defaultPasswordBytes);
  26054. for (j = 0, n = checkData.length; j < n; ++j) {
  26055. if (userPassword[j] !== checkData[j]) {
  26056. return null;
  26057. }
  26058. }
  26059. }
  26060. return encryptionKey;
  26061. }
  26062. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  26063. var hashData = new Uint8Array(32), i = 0, j, n;
  26064. n = Math.min(32, password.length);
  26065. for (; i < n; ++i) {
  26066. hashData[i] = password[i];
  26067. }
  26068. j = 0;
  26069. while (i < 32) {
  26070. hashData[i++] = defaultPasswordBytes[j++];
  26071. }
  26072. var hash = calculateMD5(hashData, 0, i);
  26073. var keyLengthInBytes = keyLength >> 3;
  26074. if (revision >= 3) {
  26075. for (j = 0; j < 50; ++j) {
  26076. hash = calculateMD5(hash, 0, hash.length);
  26077. }
  26078. }
  26079. var cipher, userPassword;
  26080. if (revision >= 3) {
  26081. userPassword = ownerPassword;
  26082. var derivedKey = new Uint8Array(keyLengthInBytes), k;
  26083. for (j = 19; j >= 0; j--) {
  26084. for (k = 0; k < keyLengthInBytes; ++k) {
  26085. derivedKey[k] = hash[k] ^ j;
  26086. }
  26087. cipher = new ARCFourCipher(derivedKey);
  26088. userPassword = cipher.encryptBlock(userPassword);
  26089. }
  26090. } else {
  26091. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  26092. userPassword = cipher.encryptBlock(ownerPassword);
  26093. }
  26094. return userPassword;
  26095. }
  26096. var identityName = Name.get('Identity');
  26097. function CipherTransformFactory(dict, fileId, password) {
  26098. var filter = dict.get('Filter');
  26099. if (!isName(filter, 'Standard')) {
  26100. error('unknown encryption method');
  26101. }
  26102. this.dict = dict;
  26103. var algorithm = dict.get('V');
  26104. if (!isInt(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  26105. error('unsupported encryption algorithm');
  26106. }
  26107. this.algorithm = algorithm;
  26108. var keyLength = dict.get('Length');
  26109. if (!keyLength) {
  26110. if (algorithm <= 3) {
  26111. keyLength = 40;
  26112. } else {
  26113. var cfDict = dict.get('CF');
  26114. var streamCryptoName = dict.get('StmF');
  26115. if (isDict(cfDict) && isName(streamCryptoName)) {
  26116. cfDict.suppressEncryption = true;
  26117. var handlerDict = cfDict.get(streamCryptoName.name);
  26118. keyLength = handlerDict && handlerDict.get('Length') || 128;
  26119. if (keyLength < 40) {
  26120. keyLength <<= 3;
  26121. }
  26122. }
  26123. }
  26124. }
  26125. if (!isInt(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  26126. error('invalid key length');
  26127. }
  26128. var ownerPassword = stringToBytes(dict.get('O')).subarray(0, 32);
  26129. var userPassword = stringToBytes(dict.get('U')).subarray(0, 32);
  26130. var flags = dict.get('P');
  26131. var revision = dict.get('R');
  26132. var encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get('EncryptMetadata') !== false;
  26133. this.encryptMetadata = encryptMetadata;
  26134. var fileIdBytes = stringToBytes(fileId);
  26135. var passwordBytes;
  26136. if (password) {
  26137. if (revision === 6) {
  26138. try {
  26139. password = utf8StringToString(password);
  26140. } catch (ex) {
  26141. warn('CipherTransformFactory: ' + 'Unable to convert UTF8 encoded password.');
  26142. }
  26143. }
  26144. passwordBytes = stringToBytes(password);
  26145. }
  26146. var encryptionKey;
  26147. if (algorithm !== 5) {
  26148. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  26149. } else {
  26150. var ownerValidationSalt = stringToBytes(dict.get('O')).subarray(32, 40);
  26151. var ownerKeySalt = stringToBytes(dict.get('O')).subarray(40, 48);
  26152. var uBytes = stringToBytes(dict.get('U')).subarray(0, 48);
  26153. var userValidationSalt = stringToBytes(dict.get('U')).subarray(32, 40);
  26154. var userKeySalt = stringToBytes(dict.get('U')).subarray(40, 48);
  26155. var ownerEncryption = stringToBytes(dict.get('OE'));
  26156. var userEncryption = stringToBytes(dict.get('UE'));
  26157. var perms = stringToBytes(dict.get('Perms'));
  26158. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  26159. }
  26160. if (!encryptionKey && !password) {
  26161. throw new PasswordException('No password given', PasswordResponses.NEED_PASSWORD);
  26162. } else if (!encryptionKey && password) {
  26163. var decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  26164. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  26165. }
  26166. if (!encryptionKey) {
  26167. throw new PasswordException('Incorrect Password', PasswordResponses.INCORRECT_PASSWORD);
  26168. }
  26169. this.encryptionKey = encryptionKey;
  26170. if (algorithm >= 4) {
  26171. var cf = dict.get('CF');
  26172. if (isDict(cf)) {
  26173. cf.suppressEncryption = true;
  26174. }
  26175. this.cf = cf;
  26176. this.stmf = dict.get('StmF') || identityName;
  26177. this.strf = dict.get('StrF') || identityName;
  26178. this.eff = dict.get('EFF') || this.stmf;
  26179. }
  26180. }
  26181. function buildObjectKey(num, gen, encryptionKey, isAes) {
  26182. var key = new Uint8Array(encryptionKey.length + 9), i, n;
  26183. for (i = 0, n = encryptionKey.length; i < n; ++i) {
  26184. key[i] = encryptionKey[i];
  26185. }
  26186. key[i++] = num & 0xFF;
  26187. key[i++] = num >> 8 & 0xFF;
  26188. key[i++] = num >> 16 & 0xFF;
  26189. key[i++] = gen & 0xFF;
  26190. key[i++] = gen >> 8 & 0xFF;
  26191. if (isAes) {
  26192. key[i++] = 0x73;
  26193. key[i++] = 0x41;
  26194. key[i++] = 0x6C;
  26195. key[i++] = 0x54;
  26196. }
  26197. var hash = calculateMD5(key, 0, i);
  26198. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  26199. }
  26200. function buildCipherConstructor(cf, name, num, gen, key) {
  26201. assert(isName(name), 'Invalid crypt filter name.');
  26202. var cryptFilter = cf.get(name.name);
  26203. var cfm;
  26204. if (cryptFilter !== null && cryptFilter !== undefined) {
  26205. cfm = cryptFilter.get('CFM');
  26206. }
  26207. if (!cfm || cfm.name === 'None') {
  26208. return function cipherTransformFactoryBuildCipherConstructorNone() {
  26209. return new NullCipher();
  26210. };
  26211. }
  26212. if (cfm.name === 'V2') {
  26213. return function cipherTransformFactoryBuildCipherConstructorV2() {
  26214. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  26215. };
  26216. }
  26217. if (cfm.name === 'AESV2') {
  26218. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  26219. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  26220. };
  26221. }
  26222. if (cfm.name === 'AESV3') {
  26223. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  26224. return new AES256Cipher(key);
  26225. };
  26226. }
  26227. error('Unknown crypto method');
  26228. }
  26229. CipherTransformFactory.prototype = {
  26230. createCipherTransform: function CipherTransformFactory_createCipherTransform(num, gen) {
  26231. if (this.algorithm === 4 || this.algorithm === 5) {
  26232. return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey));
  26233. }
  26234. var key = buildObjectKey(num, gen, this.encryptionKey, false);
  26235. var cipherConstructor = function buildCipherCipherConstructor() {
  26236. return new ARCFourCipher(key);
  26237. };
  26238. return new CipherTransform(cipherConstructor, cipherConstructor);
  26239. }
  26240. };
  26241. return CipherTransformFactory;
  26242. }();
  26243. exports.AES128Cipher = AES128Cipher;
  26244. exports.AES256Cipher = AES256Cipher;
  26245. exports.ARCFourCipher = ARCFourCipher;
  26246. exports.CipherTransformFactory = CipherTransformFactory;
  26247. exports.PDF17 = PDF17;
  26248. exports.PDF20 = PDF20;
  26249. exports.calculateMD5 = calculateMD5;
  26250. exports.calculateSHA256 = calculateSHA256;
  26251. exports.calculateSHA384 = calculateSHA384;
  26252. exports.calculateSHA512 = calculateSHA512;
  26253. /***/ }),
  26254. /* 13 */
  26255. /***/ (function(module, exports, __w_pdfjs_require__) {
  26256. "use strict";
  26257. var sharedUtil = __w_pdfjs_require__(0);
  26258. var corePrimitives = __w_pdfjs_require__(1);
  26259. var coreStream = __w_pdfjs_require__(2);
  26260. var coreParser = __w_pdfjs_require__(5);
  26261. var coreImage = __w_pdfjs_require__(28);
  26262. var coreColorSpace = __w_pdfjs_require__(3);
  26263. var coreMurmurHash3 = __w_pdfjs_require__(32);
  26264. var coreFonts = __w_pdfjs_require__(27);
  26265. var coreFunction = __w_pdfjs_require__(6);
  26266. var corePattern = __w_pdfjs_require__(33);
  26267. var coreCMap = __w_pdfjs_require__(24);
  26268. var coreMetrics = __w_pdfjs_require__(31);
  26269. var coreBidi = __w_pdfjs_require__(22);
  26270. var coreEncodings = __w_pdfjs_require__(4);
  26271. var coreStandardFonts = __w_pdfjs_require__(16);
  26272. var coreUnicode = __w_pdfjs_require__(17);
  26273. var coreGlyphList = __w_pdfjs_require__(7);
  26274. var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
  26275. var IDENTITY_MATRIX = sharedUtil.IDENTITY_MATRIX;
  26276. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  26277. var ImageKind = sharedUtil.ImageKind;
  26278. var OPS = sharedUtil.OPS;
  26279. var TextRenderingMode = sharedUtil.TextRenderingMode;
  26280. var Util = sharedUtil.Util;
  26281. var assert = sharedUtil.assert;
  26282. var createPromiseCapability = sharedUtil.createPromiseCapability;
  26283. var error = sharedUtil.error;
  26284. var info = sharedUtil.info;
  26285. var isArray = sharedUtil.isArray;
  26286. var isNum = sharedUtil.isNum;
  26287. var isString = sharedUtil.isString;
  26288. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  26289. var warn = sharedUtil.warn;
  26290. var Dict = corePrimitives.Dict;
  26291. var Name = corePrimitives.Name;
  26292. var isEOF = corePrimitives.isEOF;
  26293. var isCmd = corePrimitives.isCmd;
  26294. var isDict = corePrimitives.isDict;
  26295. var isName = corePrimitives.isName;
  26296. var isRef = corePrimitives.isRef;
  26297. var isStream = corePrimitives.isStream;
  26298. var DecodeStream = coreStream.DecodeStream;
  26299. var JpegStream = coreStream.JpegStream;
  26300. var Stream = coreStream.Stream;
  26301. var Lexer = coreParser.Lexer;
  26302. var Parser = coreParser.Parser;
  26303. var PDFImage = coreImage.PDFImage;
  26304. var ColorSpace = coreColorSpace.ColorSpace;
  26305. var MurmurHash3_64 = coreMurmurHash3.MurmurHash3_64;
  26306. var ErrorFont = coreFonts.ErrorFont;
  26307. var FontFlags = coreFonts.FontFlags;
  26308. var Font = coreFonts.Font;
  26309. var IdentityToUnicodeMap = coreFonts.IdentityToUnicodeMap;
  26310. var ToUnicodeMap = coreFonts.ToUnicodeMap;
  26311. var getFontType = coreFonts.getFontType;
  26312. var isPDFFunction = coreFunction.isPDFFunction;
  26313. var PDFFunction = coreFunction.PDFFunction;
  26314. var Pattern = corePattern.Pattern;
  26315. var getTilingPatternIR = corePattern.getTilingPatternIR;
  26316. var CMapFactory = coreCMap.CMapFactory;
  26317. var IdentityCMap = coreCMap.IdentityCMap;
  26318. var getMetrics = coreMetrics.getMetrics;
  26319. var bidi = coreBidi.bidi;
  26320. var WinAnsiEncoding = coreEncodings.WinAnsiEncoding;
  26321. var StandardEncoding = coreEncodings.StandardEncoding;
  26322. var MacRomanEncoding = coreEncodings.MacRomanEncoding;
  26323. var SymbolSetEncoding = coreEncodings.SymbolSetEncoding;
  26324. var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding;
  26325. var getEncoding = coreEncodings.getEncoding;
  26326. var getStdFontMap = coreStandardFonts.getStdFontMap;
  26327. var getSerifFonts = coreStandardFonts.getSerifFonts;
  26328. var getSymbolsFonts = coreStandardFonts.getSymbolsFonts;
  26329. var getNormalizedUnicodes = coreUnicode.getNormalizedUnicodes;
  26330. var reverseIfRtl = coreUnicode.reverseIfRtl;
  26331. var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph;
  26332. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  26333. var PartialEvaluator = function PartialEvaluatorClosure() {
  26334. var DefaultPartialEvaluatorOptions = {
  26335. forceDataSchema: false,
  26336. maxImageSize: -1,
  26337. disableFontFace: false,
  26338. cMapOptions: {
  26339. url: null,
  26340. packed: false
  26341. },
  26342. disableNativeImageDecoder: false
  26343. };
  26344. function NativeImageDecoder(xref, resources, handler, forceDataSchema) {
  26345. this.xref = xref;
  26346. this.resources = resources;
  26347. this.handler = handler;
  26348. this.forceDataSchema = forceDataSchema;
  26349. }
  26350. NativeImageDecoder.prototype = {
  26351. canDecode: function (image) {
  26352. return image instanceof JpegStream && NativeImageDecoder.isDecodable(image, this.xref, this.resources);
  26353. },
  26354. decode: function (image) {
  26355. var dict = image.dict;
  26356. var colorSpace = dict.get('ColorSpace', 'CS');
  26357. colorSpace = ColorSpace.parse(colorSpace, this.xref, this.resources);
  26358. var numComps = colorSpace.numComps;
  26359. var decodePromise = this.handler.sendWithPromise('JpegDecode', [
  26360. image.getIR(this.forceDataSchema),
  26361. numComps
  26362. ]);
  26363. return decodePromise.then(function (message) {
  26364. var data = message.data;
  26365. return new Stream(data, 0, data.length, image.dict);
  26366. });
  26367. }
  26368. };
  26369. NativeImageDecoder.isSupported = function NativeImageDecoder_isSupported(image, xref, res) {
  26370. var dict = image.dict;
  26371. if (dict.has('DecodeParms') || dict.has('DP')) {
  26372. return false;
  26373. }
  26374. var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res);
  26375. return (cs.name === 'DeviceGray' || cs.name === 'DeviceRGB') && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
  26376. };
  26377. NativeImageDecoder.isDecodable = function NativeImageDecoder_isDecodable(image, xref, res) {
  26378. var dict = image.dict;
  26379. if (dict.has('DecodeParms') || dict.has('DP')) {
  26380. return false;
  26381. }
  26382. var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res);
  26383. return (cs.numComps === 1 || cs.numComps === 3) && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
  26384. };
  26385. function PartialEvaluator(pdfManager, xref, handler, pageIndex, idFactory, fontCache, options) {
  26386. this.pdfManager = pdfManager;
  26387. this.xref = xref;
  26388. this.handler = handler;
  26389. this.pageIndex = pageIndex;
  26390. this.idFactory = idFactory;
  26391. this.fontCache = fontCache;
  26392. this.options = options || DefaultPartialEvaluatorOptions;
  26393. }
  26394. var TIME_SLOT_DURATION_MS = 20;
  26395. var CHECK_TIME_EVERY = 100;
  26396. function TimeSlotManager() {
  26397. this.reset();
  26398. }
  26399. TimeSlotManager.prototype = {
  26400. check: function TimeSlotManager_check() {
  26401. if (++this.checked < CHECK_TIME_EVERY) {
  26402. return false;
  26403. }
  26404. this.checked = 0;
  26405. return this.endTime <= Date.now();
  26406. },
  26407. reset: function TimeSlotManager_reset() {
  26408. this.endTime = Date.now() + TIME_SLOT_DURATION_MS;
  26409. this.checked = 0;
  26410. }
  26411. };
  26412. var deferred = Promise.resolve();
  26413. var TILING_PATTERN = 1, SHADING_PATTERN = 2;
  26414. PartialEvaluator.prototype = {
  26415. hasBlendModes: function PartialEvaluator_hasBlendModes(resources) {
  26416. if (!isDict(resources)) {
  26417. return false;
  26418. }
  26419. var processed = Object.create(null);
  26420. if (resources.objId) {
  26421. processed[resources.objId] = true;
  26422. }
  26423. var nodes = [resources], xref = this.xref;
  26424. while (nodes.length) {
  26425. var key, i, ii;
  26426. var node = nodes.shift();
  26427. var graphicStates = node.get('ExtGState');
  26428. if (isDict(graphicStates)) {
  26429. var graphicStatesKeys = graphicStates.getKeys();
  26430. for (i = 0, ii = graphicStatesKeys.length; i < ii; i++) {
  26431. key = graphicStatesKeys[i];
  26432. var graphicState = graphicStates.get(key);
  26433. var bm = graphicState.get('BM');
  26434. if (isName(bm) && bm.name !== 'Normal') {
  26435. return true;
  26436. }
  26437. }
  26438. }
  26439. var xObjects = node.get('XObject');
  26440. if (!isDict(xObjects)) {
  26441. continue;
  26442. }
  26443. var xObjectsKeys = xObjects.getKeys();
  26444. for (i = 0, ii = xObjectsKeys.length; i < ii; i++) {
  26445. key = xObjectsKeys[i];
  26446. var xObject = xObjects.getRaw(key);
  26447. if (isRef(xObject)) {
  26448. if (processed[xObject.toString()]) {
  26449. continue;
  26450. }
  26451. xObject = xref.fetch(xObject);
  26452. }
  26453. if (!isStream(xObject)) {
  26454. continue;
  26455. }
  26456. if (xObject.dict.objId) {
  26457. if (processed[xObject.dict.objId]) {
  26458. continue;
  26459. }
  26460. processed[xObject.dict.objId] = true;
  26461. }
  26462. var xResources = xObject.dict.get('Resources');
  26463. if (isDict(xResources) && (!xResources.objId || !processed[xResources.objId])) {
  26464. nodes.push(xResources);
  26465. if (xResources.objId) {
  26466. processed[xResources.objId] = true;
  26467. }
  26468. }
  26469. }
  26470. }
  26471. return false;
  26472. },
  26473. buildFormXObject: function PartialEvaluator_buildFormXObject(resources, xobj, smask, operatorList, task, initialState) {
  26474. var matrix = xobj.dict.getArray('Matrix');
  26475. var bbox = xobj.dict.getArray('BBox');
  26476. var group = xobj.dict.get('Group');
  26477. if (group) {
  26478. var groupOptions = {
  26479. matrix: matrix,
  26480. bbox: bbox,
  26481. smask: smask,
  26482. isolated: false,
  26483. knockout: false
  26484. };
  26485. var groupSubtype = group.get('S');
  26486. var colorSpace;
  26487. if (isName(groupSubtype, 'Transparency')) {
  26488. groupOptions.isolated = group.get('I') || false;
  26489. groupOptions.knockout = group.get('K') || false;
  26490. colorSpace = group.has('CS') ? ColorSpace.parse(group.get('CS'), this.xref, resources) : null;
  26491. }
  26492. if (smask && smask.backdrop) {
  26493. colorSpace = colorSpace || ColorSpace.singletons.rgb;
  26494. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  26495. }
  26496. operatorList.addOp(OPS.beginGroup, [groupOptions]);
  26497. }
  26498. operatorList.addOp(OPS.paintFormXObjectBegin, [
  26499. matrix,
  26500. bbox
  26501. ]);
  26502. return this.getOperatorList(xobj, task, xobj.dict.get('Resources') || resources, operatorList, initialState).then(function () {
  26503. operatorList.addOp(OPS.paintFormXObjectEnd, []);
  26504. if (group) {
  26505. operatorList.addOp(OPS.endGroup, [groupOptions]);
  26506. }
  26507. });
  26508. },
  26509. buildPaintImageXObject: function PartialEvaluator_buildPaintImageXObject(resources, image, inline, operatorList, cacheKey, imageCache) {
  26510. var self = this;
  26511. var dict = image.dict;
  26512. var w = dict.get('Width', 'W');
  26513. var h = dict.get('Height', 'H');
  26514. if (!(w && isNum(w)) || !(h && isNum(h))) {
  26515. warn('Image dimensions are missing, or not numbers.');
  26516. return;
  26517. }
  26518. var maxImageSize = this.options.maxImageSize;
  26519. if (maxImageSize !== -1 && w * h > maxImageSize) {
  26520. warn('Image exceeded maximum allowed size and was removed.');
  26521. return;
  26522. }
  26523. var imageMask = dict.get('ImageMask', 'IM') || false;
  26524. var imgData, args;
  26525. if (imageMask) {
  26526. var width = dict.get('Width', 'W');
  26527. var height = dict.get('Height', 'H');
  26528. var bitStrideLength = width + 7 >> 3;
  26529. var imgArray = image.getBytes(bitStrideLength * height);
  26530. var decode = dict.getArray('Decode', 'D');
  26531. var inverseDecode = !!decode && decode[0] > 0;
  26532. imgData = PDFImage.createMask(imgArray, width, height, image instanceof DecodeStream, inverseDecode);
  26533. imgData.cached = true;
  26534. args = [imgData];
  26535. operatorList.addOp(OPS.paintImageMaskXObject, args);
  26536. if (cacheKey) {
  26537. imageCache[cacheKey] = {
  26538. fn: OPS.paintImageMaskXObject,
  26539. args: args
  26540. };
  26541. }
  26542. return;
  26543. }
  26544. var softMask = dict.get('SMask', 'SM') || false;
  26545. var mask = dict.get('Mask') || false;
  26546. var SMALL_IMAGE_DIMENSIONS = 200;
  26547. if (inline && !softMask && !mask && !(image instanceof JpegStream) && w + h < SMALL_IMAGE_DIMENSIONS) {
  26548. var imageObj = new PDFImage(this.xref, resources, image, inline, null, null);
  26549. imgData = imageObj.createImageData(true);
  26550. operatorList.addOp(OPS.paintInlineImageXObject, [imgData]);
  26551. return;
  26552. }
  26553. var useNativeImageDecoder = !this.options.disableNativeImageDecoder;
  26554. var objId = 'img_' + this.idFactory.createObjId();
  26555. operatorList.addDependency(objId);
  26556. args = [
  26557. objId,
  26558. w,
  26559. h
  26560. ];
  26561. if (useNativeImageDecoder && !softMask && !mask && image instanceof JpegStream && NativeImageDecoder.isSupported(image, this.xref, resources)) {
  26562. operatorList.addOp(OPS.paintJpegXObject, args);
  26563. this.handler.send('obj', [
  26564. objId,
  26565. this.pageIndex,
  26566. 'JpegStream',
  26567. image.getIR(this.options.forceDataSchema)
  26568. ]);
  26569. return;
  26570. }
  26571. var nativeImageDecoder = null;
  26572. if (useNativeImageDecoder && (image instanceof JpegStream || mask instanceof JpegStream || softMask instanceof JpegStream)) {
  26573. nativeImageDecoder = new NativeImageDecoder(self.xref, resources, self.handler, self.options.forceDataSchema);
  26574. }
  26575. PDFImage.buildImage(self.handler, self.xref, resources, image, inline, nativeImageDecoder).then(function (imageObj) {
  26576. var imgData = imageObj.createImageData(false);
  26577. self.handler.send('obj', [
  26578. objId,
  26579. self.pageIndex,
  26580. 'Image',
  26581. imgData
  26582. ], [imgData.data.buffer]);
  26583. }).then(undefined, function (reason) {
  26584. warn('Unable to decode image: ' + reason);
  26585. self.handler.send('obj', [
  26586. objId,
  26587. self.pageIndex,
  26588. 'Image',
  26589. null
  26590. ]);
  26591. });
  26592. operatorList.addOp(OPS.paintImageXObject, args);
  26593. if (cacheKey) {
  26594. imageCache[cacheKey] = {
  26595. fn: OPS.paintImageXObject,
  26596. args: args
  26597. };
  26598. }
  26599. },
  26600. handleSMask: function PartialEvaluator_handleSmask(smask, resources, operatorList, task, stateManager) {
  26601. var smaskContent = smask.get('G');
  26602. var smaskOptions = {
  26603. subtype: smask.get('S').name,
  26604. backdrop: smask.get('BC')
  26605. };
  26606. var transferObj = smask.get('TR');
  26607. if (isPDFFunction(transferObj)) {
  26608. var transferFn = PDFFunction.parse(this.xref, transferObj);
  26609. var transferMap = new Uint8Array(256);
  26610. var tmp = new Float32Array(1);
  26611. for (var i = 0; i < 256; i++) {
  26612. tmp[0] = i / 255;
  26613. transferFn(tmp, 0, tmp, 0);
  26614. transferMap[i] = tmp[0] * 255 | 0;
  26615. }
  26616. smaskOptions.transferMap = transferMap;
  26617. }
  26618. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone());
  26619. },
  26620. handleTilingType: function PartialEvaluator_handleTilingType(fn, args, resources, pattern, patternDict, operatorList, task) {
  26621. var tilingOpList = new OperatorList();
  26622. var resourcesArray = [
  26623. patternDict.get('Resources'),
  26624. resources
  26625. ];
  26626. var patternResources = Dict.merge(this.xref, resourcesArray);
  26627. return this.getOperatorList(pattern, task, patternResources, tilingOpList).then(function () {
  26628. operatorList.addDependencies(tilingOpList.dependencies);
  26629. operatorList.addOp(fn, getTilingPatternIR({
  26630. fnArray: tilingOpList.fnArray,
  26631. argsArray: tilingOpList.argsArray
  26632. }, patternDict, args));
  26633. });
  26634. },
  26635. handleSetFont: function PartialEvaluator_handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) {
  26636. var fontName;
  26637. if (fontArgs) {
  26638. fontArgs = fontArgs.slice();
  26639. fontName = fontArgs[0].name;
  26640. }
  26641. var self = this;
  26642. return this.loadFont(fontName, fontRef, this.xref, resources).then(function (translated) {
  26643. if (!translated.font.isType3Font) {
  26644. return translated;
  26645. }
  26646. return translated.loadType3Data(self, resources, operatorList, task).then(function () {
  26647. return translated;
  26648. }, function (reason) {
  26649. self.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font });
  26650. return new TranslatedFont('g_font_error', new ErrorFont('Type3 font load error: ' + reason), translated.font);
  26651. });
  26652. }).then(function (translated) {
  26653. state.font = translated.font;
  26654. translated.send(self.handler);
  26655. return translated.loadedName;
  26656. });
  26657. },
  26658. handleText: function PartialEvaluator_handleText(chars, state) {
  26659. var font = state.font;
  26660. var glyphs = font.charsToGlyphs(chars);
  26661. var isAddToPathSet = !!(state.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
  26662. if (font.data && (isAddToPathSet || this.options.disableFontFace)) {
  26663. var buildPath = function (fontChar) {
  26664. if (!font.renderer.hasBuiltPath(fontChar)) {
  26665. var path = font.renderer.getPathJs(fontChar);
  26666. this.handler.send('commonobj', [
  26667. font.loadedName + '_path_' + fontChar,
  26668. 'FontPath',
  26669. path
  26670. ]);
  26671. }
  26672. }.bind(this);
  26673. for (var i = 0, ii = glyphs.length; i < ii; i++) {
  26674. var glyph = glyphs[i];
  26675. buildPath(glyph.fontChar);
  26676. var accent = glyph.accent;
  26677. if (accent && accent.fontChar) {
  26678. buildPath(accent.fontChar);
  26679. }
  26680. }
  26681. }
  26682. return glyphs;
  26683. },
  26684. setGState: function PartialEvaluator_setGState(resources, gState, operatorList, task, xref, stateManager) {
  26685. var gStateObj = [];
  26686. var gStateKeys = gState.getKeys();
  26687. var self = this;
  26688. var promise = Promise.resolve();
  26689. for (var i = 0, ii = gStateKeys.length; i < ii; i++) {
  26690. var key = gStateKeys[i];
  26691. var value = gState.get(key);
  26692. switch (key) {
  26693. case 'Type':
  26694. break;
  26695. case 'LW':
  26696. case 'LC':
  26697. case 'LJ':
  26698. case 'ML':
  26699. case 'D':
  26700. case 'RI':
  26701. case 'FL':
  26702. case 'CA':
  26703. case 'ca':
  26704. gStateObj.push([
  26705. key,
  26706. value
  26707. ]);
  26708. break;
  26709. case 'Font':
  26710. promise = promise.then(function () {
  26711. return self.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  26712. operatorList.addDependency(loadedName);
  26713. gStateObj.push([
  26714. key,
  26715. [
  26716. loadedName,
  26717. value[1]
  26718. ]
  26719. ]);
  26720. });
  26721. });
  26722. break;
  26723. case 'BM':
  26724. gStateObj.push([
  26725. key,
  26726. value
  26727. ]);
  26728. break;
  26729. case 'SMask':
  26730. if (isName(value, 'None')) {
  26731. gStateObj.push([
  26732. key,
  26733. false
  26734. ]);
  26735. break;
  26736. }
  26737. if (isDict(value)) {
  26738. promise = promise.then(function (dict) {
  26739. return self.handleSMask(dict, resources, operatorList, task, stateManager);
  26740. }.bind(this, value));
  26741. gStateObj.push([
  26742. key,
  26743. true
  26744. ]);
  26745. } else {
  26746. warn('Unsupported SMask type');
  26747. }
  26748. break;
  26749. case 'OP':
  26750. case 'op':
  26751. case 'OPM':
  26752. case 'BG':
  26753. case 'BG2':
  26754. case 'UCR':
  26755. case 'UCR2':
  26756. case 'TR':
  26757. case 'TR2':
  26758. case 'HT':
  26759. case 'SM':
  26760. case 'SA':
  26761. case 'AIS':
  26762. case 'TK':
  26763. info('graphic state operator ' + key);
  26764. break;
  26765. default:
  26766. info('Unknown graphic state operator ' + key);
  26767. break;
  26768. }
  26769. }
  26770. return promise.then(function () {
  26771. if (gStateObj.length > 0) {
  26772. operatorList.addOp(OPS.setGState, [gStateObj]);
  26773. }
  26774. });
  26775. },
  26776. loadFont: function PartialEvaluator_loadFont(fontName, font, xref, resources) {
  26777. function errorFont() {
  26778. return Promise.resolve(new TranslatedFont('g_font_error', new ErrorFont('Font ' + fontName + ' is not available'), font));
  26779. }
  26780. var fontRef;
  26781. if (font) {
  26782. assert(isRef(font));
  26783. fontRef = font;
  26784. } else {
  26785. var fontRes = resources.get('Font');
  26786. if (fontRes) {
  26787. fontRef = fontRes.getRaw(fontName);
  26788. } else {
  26789. warn('fontRes not available');
  26790. return errorFont();
  26791. }
  26792. }
  26793. if (!fontRef) {
  26794. warn('fontRef not available');
  26795. return errorFont();
  26796. }
  26797. if (this.fontCache.has(fontRef)) {
  26798. return this.fontCache.get(fontRef);
  26799. }
  26800. font = xref.fetchIfRef(fontRef);
  26801. if (!isDict(font)) {
  26802. return errorFont();
  26803. }
  26804. if (font.translated) {
  26805. return font.translated;
  26806. }
  26807. var fontCapability = createPromiseCapability();
  26808. var preEvaluatedFont = this.preEvaluateFont(font, xref);
  26809. var descriptor = preEvaluatedFont.descriptor;
  26810. var fontRefIsRef = isRef(fontRef), fontID;
  26811. if (fontRefIsRef) {
  26812. fontID = fontRef.toString();
  26813. }
  26814. if (isDict(descriptor)) {
  26815. if (!descriptor.fontAliases) {
  26816. descriptor.fontAliases = Object.create(null);
  26817. }
  26818. var fontAliases = descriptor.fontAliases;
  26819. var hash = preEvaluatedFont.hash;
  26820. if (fontAliases[hash]) {
  26821. var aliasFontRef = fontAliases[hash].aliasRef;
  26822. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  26823. this.fontCache.putAlias(fontRef, aliasFontRef);
  26824. return this.fontCache.get(fontRef);
  26825. }
  26826. } else {
  26827. fontAliases[hash] = { fontID: Font.getFontID() };
  26828. }
  26829. if (fontRefIsRef) {
  26830. fontAliases[hash].aliasRef = fontRef;
  26831. }
  26832. fontID = fontAliases[hash].fontID;
  26833. }
  26834. if (fontRefIsRef) {
  26835. this.fontCache.put(fontRef, fontCapability.promise);
  26836. } else {
  26837. if (!fontID) {
  26838. fontID = this.idFactory.createObjId();
  26839. }
  26840. this.fontCache.put('id_' + fontID, fontCapability.promise);
  26841. }
  26842. assert(fontID, 'The "fontID" must be defined.');
  26843. font.loadedName = 'g_' + this.pdfManager.docId + '_f' + fontID;
  26844. font.translated = fontCapability.promise;
  26845. var translatedPromise;
  26846. try {
  26847. translatedPromise = this.translateFont(preEvaluatedFont, xref);
  26848. } catch (e) {
  26849. translatedPromise = Promise.reject(e);
  26850. }
  26851. var self = this;
  26852. translatedPromise.then(function (translatedFont) {
  26853. if (translatedFont.fontType !== undefined) {
  26854. var xrefFontStats = xref.stats.fontTypes;
  26855. xrefFontStats[translatedFont.fontType] = true;
  26856. }
  26857. fontCapability.resolve(new TranslatedFont(font.loadedName, translatedFont, font));
  26858. }, function (reason) {
  26859. self.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font });
  26860. try {
  26861. var descriptor = preEvaluatedFont.descriptor;
  26862. var fontFile3 = descriptor && descriptor.get('FontFile3');
  26863. var subtype = fontFile3 && fontFile3.get('Subtype');
  26864. var fontType = getFontType(preEvaluatedFont.type, subtype && subtype.name);
  26865. var xrefFontStats = xref.stats.fontTypes;
  26866. xrefFontStats[fontType] = true;
  26867. } catch (ex) {
  26868. }
  26869. fontCapability.resolve(new TranslatedFont(font.loadedName, new ErrorFont(reason instanceof Error ? reason.message : reason), font));
  26870. });
  26871. return fontCapability.promise;
  26872. },
  26873. buildPath: function PartialEvaluator_buildPath(operatorList, fn, args) {
  26874. var lastIndex = operatorList.length - 1;
  26875. if (!args) {
  26876. args = [];
  26877. }
  26878. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== OPS.constructPath) {
  26879. operatorList.addOp(OPS.constructPath, [
  26880. [fn],
  26881. args
  26882. ]);
  26883. } else {
  26884. var opArgs = operatorList.argsArray[lastIndex];
  26885. opArgs[0].push(fn);
  26886. Array.prototype.push.apply(opArgs[1], args);
  26887. }
  26888. },
  26889. handleColorN: function PartialEvaluator_handleColorN(operatorList, fn, args, cs, patterns, resources, task, xref) {
  26890. var patternName = args[args.length - 1];
  26891. var pattern;
  26892. if (isName(patternName) && (pattern = patterns.get(patternName.name))) {
  26893. var dict = isStream(pattern) ? pattern.dict : pattern;
  26894. var typeNum = dict.get('PatternType');
  26895. if (typeNum === TILING_PATTERN) {
  26896. var color = cs.base ? cs.base.getRgb(args, 0) : null;
  26897. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task);
  26898. } else if (typeNum === SHADING_PATTERN) {
  26899. var shading = dict.get('Shading');
  26900. var matrix = dict.getArray('Matrix');
  26901. pattern = Pattern.parseShading(shading, matrix, xref, resources, this.handler);
  26902. operatorList.addOp(fn, pattern.getIR());
  26903. return Promise.resolve();
  26904. }
  26905. return Promise.reject('Unknown PatternType: ' + typeNum);
  26906. }
  26907. operatorList.addOp(fn, args);
  26908. return Promise.resolve();
  26909. },
  26910. getOperatorList: function PartialEvaluator_getOperatorList(stream, task, resources, operatorList, initialState) {
  26911. var self = this;
  26912. var xref = this.xref;
  26913. var imageCache = Object.create(null);
  26914. assert(operatorList);
  26915. resources = resources || Dict.empty;
  26916. var xobjs = resources.get('XObject') || Dict.empty;
  26917. var patterns = resources.get('Pattern') || Dict.empty;
  26918. var stateManager = new StateManager(initialState || new EvalState());
  26919. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  26920. var timeSlotManager = new TimeSlotManager();
  26921. return new Promise(function promiseBody(resolve, reject) {
  26922. var next = function (promise) {
  26923. promise.then(function () {
  26924. try {
  26925. promiseBody(resolve, reject);
  26926. } catch (ex) {
  26927. reject(ex);
  26928. }
  26929. }, reject);
  26930. };
  26931. task.ensureNotTerminated();
  26932. timeSlotManager.reset();
  26933. var stop, operation = {}, i, ii, cs;
  26934. while (!(stop = timeSlotManager.check())) {
  26935. operation.args = null;
  26936. if (!preprocessor.read(operation)) {
  26937. break;
  26938. }
  26939. var args = operation.args;
  26940. var fn = operation.fn;
  26941. switch (fn | 0) {
  26942. case OPS.paintXObject:
  26943. if (args[0].code) {
  26944. break;
  26945. }
  26946. var name = args[0].name;
  26947. if (!name) {
  26948. warn('XObject must be referred to by name.');
  26949. continue;
  26950. }
  26951. if (imageCache[name] !== undefined) {
  26952. operatorList.addOp(imageCache[name].fn, imageCache[name].args);
  26953. args = null;
  26954. continue;
  26955. }
  26956. var xobj = xobjs.get(name);
  26957. if (xobj) {
  26958. assert(isStream(xobj), 'XObject should be a stream');
  26959. var type = xobj.dict.get('Subtype');
  26960. assert(isName(type), 'XObject should have a Name subtype');
  26961. if (type.name === 'Form') {
  26962. stateManager.save();
  26963. next(self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () {
  26964. stateManager.restore();
  26965. }));
  26966. return;
  26967. } else if (type.name === 'Image') {
  26968. self.buildPaintImageXObject(resources, xobj, false, operatorList, name, imageCache);
  26969. args = null;
  26970. continue;
  26971. } else if (type.name === 'PS') {
  26972. info('Ignored XObject subtype PS');
  26973. continue;
  26974. } else {
  26975. error('Unhandled XObject subtype ' + type.name);
  26976. }
  26977. }
  26978. break;
  26979. case OPS.setFont:
  26980. var fontSize = args[1];
  26981. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state).then(function (loadedName) {
  26982. operatorList.addDependency(loadedName);
  26983. operatorList.addOp(OPS.setFont, [
  26984. loadedName,
  26985. fontSize
  26986. ]);
  26987. }));
  26988. return;
  26989. case OPS.endInlineImage:
  26990. var cacheKey = args[0].cacheKey;
  26991. if (cacheKey) {
  26992. var cacheEntry = imageCache[cacheKey];
  26993. if (cacheEntry !== undefined) {
  26994. operatorList.addOp(cacheEntry.fn, cacheEntry.args);
  26995. args = null;
  26996. continue;
  26997. }
  26998. }
  26999. self.buildPaintImageXObject(resources, args[0], true, operatorList, cacheKey, imageCache);
  27000. args = null;
  27001. continue;
  27002. case OPS.showText:
  27003. args[0] = self.handleText(args[0], stateManager.state);
  27004. break;
  27005. case OPS.showSpacedText:
  27006. var arr = args[0];
  27007. var combinedGlyphs = [];
  27008. var arrLength = arr.length;
  27009. var state = stateManager.state;
  27010. for (i = 0; i < arrLength; ++i) {
  27011. var arrItem = arr[i];
  27012. if (isString(arrItem)) {
  27013. Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
  27014. } else if (isNum(arrItem)) {
  27015. combinedGlyphs.push(arrItem);
  27016. }
  27017. }
  27018. args[0] = combinedGlyphs;
  27019. fn = OPS.showText;
  27020. break;
  27021. case OPS.nextLineShowText:
  27022. operatorList.addOp(OPS.nextLine);
  27023. args[0] = self.handleText(args[0], stateManager.state);
  27024. fn = OPS.showText;
  27025. break;
  27026. case OPS.nextLineSetSpacingShowText:
  27027. operatorList.addOp(OPS.nextLine);
  27028. operatorList.addOp(OPS.setWordSpacing, [args.shift()]);
  27029. operatorList.addOp(OPS.setCharSpacing, [args.shift()]);
  27030. args[0] = self.handleText(args[0], stateManager.state);
  27031. fn = OPS.showText;
  27032. break;
  27033. case OPS.setTextRenderingMode:
  27034. stateManager.state.textRenderingMode = args[0];
  27035. break;
  27036. case OPS.setFillColorSpace:
  27037. stateManager.state.fillColorSpace = ColorSpace.parse(args[0], xref, resources);
  27038. continue;
  27039. case OPS.setStrokeColorSpace:
  27040. stateManager.state.strokeColorSpace = ColorSpace.parse(args[0], xref, resources);
  27041. continue;
  27042. case OPS.setFillColor:
  27043. cs = stateManager.state.fillColorSpace;
  27044. args = cs.getRgb(args, 0);
  27045. fn = OPS.setFillRGBColor;
  27046. break;
  27047. case OPS.setStrokeColor:
  27048. cs = stateManager.state.strokeColorSpace;
  27049. args = cs.getRgb(args, 0);
  27050. fn = OPS.setStrokeRGBColor;
  27051. break;
  27052. case OPS.setFillGray:
  27053. stateManager.state.fillColorSpace = ColorSpace.singletons.gray;
  27054. args = ColorSpace.singletons.gray.getRgb(args, 0);
  27055. fn = OPS.setFillRGBColor;
  27056. break;
  27057. case OPS.setStrokeGray:
  27058. stateManager.state.strokeColorSpace = ColorSpace.singletons.gray;
  27059. args = ColorSpace.singletons.gray.getRgb(args, 0);
  27060. fn = OPS.setStrokeRGBColor;
  27061. break;
  27062. case OPS.setFillCMYKColor:
  27063. stateManager.state.fillColorSpace = ColorSpace.singletons.cmyk;
  27064. args = ColorSpace.singletons.cmyk.getRgb(args, 0);
  27065. fn = OPS.setFillRGBColor;
  27066. break;
  27067. case OPS.setStrokeCMYKColor:
  27068. stateManager.state.strokeColorSpace = ColorSpace.singletons.cmyk;
  27069. args = ColorSpace.singletons.cmyk.getRgb(args, 0);
  27070. fn = OPS.setStrokeRGBColor;
  27071. break;
  27072. case OPS.setFillRGBColor:
  27073. stateManager.state.fillColorSpace = ColorSpace.singletons.rgb;
  27074. args = ColorSpace.singletons.rgb.getRgb(args, 0);
  27075. break;
  27076. case OPS.setStrokeRGBColor:
  27077. stateManager.state.strokeColorSpace = ColorSpace.singletons.rgb;
  27078. args = ColorSpace.singletons.rgb.getRgb(args, 0);
  27079. break;
  27080. case OPS.setFillColorN:
  27081. cs = stateManager.state.fillColorSpace;
  27082. if (cs.name === 'Pattern') {
  27083. next(self.handleColorN(operatorList, OPS.setFillColorN, args, cs, patterns, resources, task, xref));
  27084. return;
  27085. }
  27086. args = cs.getRgb(args, 0);
  27087. fn = OPS.setFillRGBColor;
  27088. break;
  27089. case OPS.setStrokeColorN:
  27090. cs = stateManager.state.strokeColorSpace;
  27091. if (cs.name === 'Pattern') {
  27092. next(self.handleColorN(operatorList, OPS.setStrokeColorN, args, cs, patterns, resources, task, xref));
  27093. return;
  27094. }
  27095. args = cs.getRgb(args, 0);
  27096. fn = OPS.setStrokeRGBColor;
  27097. break;
  27098. case OPS.shadingFill:
  27099. var shadingRes = resources.get('Shading');
  27100. if (!shadingRes) {
  27101. error('No shading resource found');
  27102. }
  27103. var shading = shadingRes.get(args[0].name);
  27104. if (!shading) {
  27105. error('No shading object found');
  27106. }
  27107. var shadingFill = Pattern.parseShading(shading, null, xref, resources, self.handler);
  27108. var patternIR = shadingFill.getIR();
  27109. args = [patternIR];
  27110. fn = OPS.shadingFill;
  27111. break;
  27112. case OPS.setGState:
  27113. var dictName = args[0];
  27114. var extGState = resources.get('ExtGState');
  27115. if (!isDict(extGState) || !extGState.has(dictName.name)) {
  27116. break;
  27117. }
  27118. var gState = extGState.get(dictName.name);
  27119. next(self.setGState(resources, gState, operatorList, task, xref, stateManager));
  27120. return;
  27121. case OPS.moveTo:
  27122. case OPS.lineTo:
  27123. case OPS.curveTo:
  27124. case OPS.curveTo2:
  27125. case OPS.curveTo3:
  27126. case OPS.closePath:
  27127. self.buildPath(operatorList, fn, args);
  27128. continue;
  27129. case OPS.rectangle:
  27130. self.buildPath(operatorList, fn, args);
  27131. continue;
  27132. case OPS.markPoint:
  27133. case OPS.markPointProps:
  27134. case OPS.beginMarkedContent:
  27135. case OPS.beginMarkedContentProps:
  27136. case OPS.endMarkedContent:
  27137. case OPS.beginCompat:
  27138. case OPS.endCompat:
  27139. continue;
  27140. default:
  27141. if (args !== null) {
  27142. for (i = 0, ii = args.length; i < ii; i++) {
  27143. if (args[i] instanceof Dict) {
  27144. break;
  27145. }
  27146. }
  27147. if (i < ii) {
  27148. warn('getOperatorList - ignoring operator: ' + fn);
  27149. continue;
  27150. }
  27151. }
  27152. }
  27153. operatorList.addOp(fn, args);
  27154. }
  27155. if (stop) {
  27156. next(deferred);
  27157. return;
  27158. }
  27159. for (i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  27160. operatorList.addOp(OPS.restore, []);
  27161. }
  27162. resolve();
  27163. });
  27164. },
  27165. getTextContent: function PartialEvaluator_getTextContent(stream, task, resources, stateManager, normalizeWhitespace, combineTextItems) {
  27166. stateManager = stateManager || new StateManager(new TextState());
  27167. var WhitespaceRegexp = /\s/g;
  27168. var textContent = {
  27169. items: [],
  27170. styles: Object.create(null)
  27171. };
  27172. var textContentItem = {
  27173. initialized: false,
  27174. str: [],
  27175. width: 0,
  27176. height: 0,
  27177. vertical: false,
  27178. lastAdvanceWidth: 0,
  27179. lastAdvanceHeight: 0,
  27180. textAdvanceScale: 0,
  27181. spaceWidth: 0,
  27182. fakeSpaceMin: Infinity,
  27183. fakeMultiSpaceMin: Infinity,
  27184. fakeMultiSpaceMax: -0,
  27185. textRunBreakAllowed: false,
  27186. transform: null,
  27187. fontName: null
  27188. };
  27189. var SPACE_FACTOR = 0.3;
  27190. var MULTI_SPACE_FACTOR = 1.5;
  27191. var MULTI_SPACE_FACTOR_MAX = 4;
  27192. var self = this;
  27193. var xref = this.xref;
  27194. resources = xref.fetchIfRef(resources) || Dict.empty;
  27195. var xobjs = null;
  27196. var xobjsCache = Object.create(null);
  27197. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  27198. var textState;
  27199. function ensureTextContentItem() {
  27200. if (textContentItem.initialized) {
  27201. return textContentItem;
  27202. }
  27203. var font = textState.font;
  27204. if (!(font.loadedName in textContent.styles)) {
  27205. textContent.styles[font.loadedName] = {
  27206. fontFamily: font.fallbackName,
  27207. ascent: font.ascent,
  27208. descent: font.descent,
  27209. vertical: font.vertical
  27210. };
  27211. }
  27212. textContentItem.fontName = font.loadedName;
  27213. var tsm = [
  27214. textState.fontSize * textState.textHScale,
  27215. 0,
  27216. 0,
  27217. textState.fontSize,
  27218. 0,
  27219. textState.textRise
  27220. ];
  27221. if (font.isType3Font && textState.fontMatrix !== FONT_IDENTITY_MATRIX && textState.fontSize === 1) {
  27222. var glyphHeight = font.bbox[3] - font.bbox[1];
  27223. if (glyphHeight > 0) {
  27224. glyphHeight = glyphHeight * textState.fontMatrix[3];
  27225. tsm[3] *= glyphHeight;
  27226. }
  27227. }
  27228. var trm = Util.transform(textState.ctm, Util.transform(textState.textMatrix, tsm));
  27229. textContentItem.transform = trm;
  27230. if (!font.vertical) {
  27231. textContentItem.width = 0;
  27232. textContentItem.height = Math.sqrt(trm[2] * trm[2] + trm[3] * trm[3]);
  27233. textContentItem.vertical = false;
  27234. } else {
  27235. textContentItem.width = Math.sqrt(trm[0] * trm[0] + trm[1] * trm[1]);
  27236. textContentItem.height = 0;
  27237. textContentItem.vertical = true;
  27238. }
  27239. var a = textState.textLineMatrix[0];
  27240. var b = textState.textLineMatrix[1];
  27241. var scaleLineX = Math.sqrt(a * a + b * b);
  27242. a = textState.ctm[0];
  27243. b = textState.ctm[1];
  27244. var scaleCtmX = Math.sqrt(a * a + b * b);
  27245. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  27246. textContentItem.lastAdvanceWidth = 0;
  27247. textContentItem.lastAdvanceHeight = 0;
  27248. var spaceWidth = font.spaceWidth / 1000 * textState.fontSize;
  27249. if (spaceWidth) {
  27250. textContentItem.spaceWidth = spaceWidth;
  27251. textContentItem.fakeSpaceMin = spaceWidth * SPACE_FACTOR;
  27252. textContentItem.fakeMultiSpaceMin = spaceWidth * MULTI_SPACE_FACTOR;
  27253. textContentItem.fakeMultiSpaceMax = spaceWidth * MULTI_SPACE_FACTOR_MAX;
  27254. textContentItem.textRunBreakAllowed = !font.isMonospace;
  27255. } else {
  27256. textContentItem.spaceWidth = 0;
  27257. textContentItem.fakeSpaceMin = Infinity;
  27258. textContentItem.fakeMultiSpaceMin = Infinity;
  27259. textContentItem.fakeMultiSpaceMax = 0;
  27260. textContentItem.textRunBreakAllowed = false;
  27261. }
  27262. textContentItem.initialized = true;
  27263. return textContentItem;
  27264. }
  27265. function replaceWhitespace(str) {
  27266. var i = 0, ii = str.length, code;
  27267. while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7F) {
  27268. i++;
  27269. }
  27270. return i < ii ? str.replace(WhitespaceRegexp, ' ') : str;
  27271. }
  27272. function runBidiTransform(textChunk) {
  27273. var str = textChunk.str.join('');
  27274. var bidiResult = bidi(str, -1, textChunk.vertical);
  27275. return {
  27276. str: normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str,
  27277. dir: bidiResult.dir,
  27278. width: textChunk.width,
  27279. height: textChunk.height,
  27280. transform: textChunk.transform,
  27281. fontName: textChunk.fontName
  27282. };
  27283. }
  27284. function handleSetFont(fontName, fontRef) {
  27285. return self.loadFont(fontName, fontRef, xref, resources).then(function (translated) {
  27286. textState.font = translated.font;
  27287. textState.fontMatrix = translated.font.fontMatrix || FONT_IDENTITY_MATRIX;
  27288. });
  27289. }
  27290. function buildTextContentItem(chars) {
  27291. var font = textState.font;
  27292. var textChunk = ensureTextContentItem();
  27293. var width = 0;
  27294. var height = 0;
  27295. var glyphs = font.charsToGlyphs(chars);
  27296. for (var i = 0; i < glyphs.length; i++) {
  27297. var glyph = glyphs[i];
  27298. var glyphWidth = null;
  27299. if (font.vertical && glyph.vmetric) {
  27300. glyphWidth = glyph.vmetric[0];
  27301. } else {
  27302. glyphWidth = glyph.width;
  27303. }
  27304. var glyphUnicode = glyph.unicode;
  27305. var NormalizedUnicodes = getNormalizedUnicodes();
  27306. if (NormalizedUnicodes[glyphUnicode] !== undefined) {
  27307. glyphUnicode = NormalizedUnicodes[glyphUnicode];
  27308. }
  27309. glyphUnicode = reverseIfRtl(glyphUnicode);
  27310. var charSpacing = textState.charSpacing;
  27311. if (glyph.isSpace) {
  27312. var wordSpacing = textState.wordSpacing;
  27313. charSpacing += wordSpacing;
  27314. if (wordSpacing > 0) {
  27315. addFakeSpaces(wordSpacing, textChunk.str);
  27316. }
  27317. }
  27318. var tx = 0;
  27319. var ty = 0;
  27320. if (!font.vertical) {
  27321. var w0 = glyphWidth * textState.fontMatrix[0];
  27322. tx = (w0 * textState.fontSize + charSpacing) * textState.textHScale;
  27323. width += tx;
  27324. } else {
  27325. var w1 = glyphWidth * textState.fontMatrix[0];
  27326. ty = w1 * textState.fontSize + charSpacing;
  27327. height += ty;
  27328. }
  27329. textState.translateTextMatrix(tx, ty);
  27330. textChunk.str.push(glyphUnicode);
  27331. }
  27332. if (!font.vertical) {
  27333. textChunk.lastAdvanceWidth = width;
  27334. textChunk.width += width;
  27335. } else {
  27336. textChunk.lastAdvanceHeight = height;
  27337. textChunk.height += Math.abs(height);
  27338. }
  27339. return textChunk;
  27340. }
  27341. function addFakeSpaces(width, strBuf) {
  27342. if (width < textContentItem.fakeSpaceMin) {
  27343. return;
  27344. }
  27345. if (width < textContentItem.fakeMultiSpaceMin) {
  27346. strBuf.push(' ');
  27347. return;
  27348. }
  27349. var fakeSpaces = Math.round(width / textContentItem.spaceWidth);
  27350. while (fakeSpaces-- > 0) {
  27351. strBuf.push(' ');
  27352. }
  27353. }
  27354. function flushTextContentItem() {
  27355. if (!textContentItem.initialized) {
  27356. return;
  27357. }
  27358. textContentItem.width *= textContentItem.textAdvanceScale;
  27359. textContentItem.height *= textContentItem.textAdvanceScale;
  27360. textContent.items.push(runBidiTransform(textContentItem));
  27361. textContentItem.initialized = false;
  27362. textContentItem.str.length = 0;
  27363. }
  27364. var timeSlotManager = new TimeSlotManager();
  27365. return new Promise(function promiseBody(resolve, reject) {
  27366. var next = function (promise) {
  27367. promise.then(function () {
  27368. try {
  27369. promiseBody(resolve, reject);
  27370. } catch (ex) {
  27371. reject(ex);
  27372. }
  27373. }, reject);
  27374. };
  27375. task.ensureNotTerminated();
  27376. timeSlotManager.reset();
  27377. var stop, operation = {}, args = [];
  27378. while (!(stop = timeSlotManager.check())) {
  27379. args.length = 0;
  27380. operation.args = args;
  27381. if (!preprocessor.read(operation)) {
  27382. break;
  27383. }
  27384. textState = stateManager.state;
  27385. var fn = operation.fn;
  27386. args = operation.args;
  27387. var advance, diff;
  27388. switch (fn | 0) {
  27389. case OPS.setFont:
  27390. var fontNameArg = args[0].name, fontSizeArg = args[1];
  27391. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  27392. break;
  27393. }
  27394. flushTextContentItem();
  27395. textState.fontName = fontNameArg;
  27396. textState.fontSize = fontSizeArg;
  27397. next(handleSetFont(fontNameArg, null));
  27398. return;
  27399. case OPS.setTextRise:
  27400. flushTextContentItem();
  27401. textState.textRise = args[0];
  27402. break;
  27403. case OPS.setHScale:
  27404. flushTextContentItem();
  27405. textState.textHScale = args[0] / 100;
  27406. break;
  27407. case OPS.setLeading:
  27408. flushTextContentItem();
  27409. textState.leading = args[0];
  27410. break;
  27411. case OPS.moveText:
  27412. var isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0;
  27413. advance = args[0] - args[1];
  27414. if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) {
  27415. textState.translateTextLineMatrix(args[0], args[1]);
  27416. textContentItem.width += args[0] - textContentItem.lastAdvanceWidth;
  27417. textContentItem.height += args[1] - textContentItem.lastAdvanceHeight;
  27418. diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight);
  27419. addFakeSpaces(diff, textContentItem.str);
  27420. break;
  27421. }
  27422. flushTextContentItem();
  27423. textState.translateTextLineMatrix(args[0], args[1]);
  27424. textState.textMatrix = textState.textLineMatrix.slice();
  27425. break;
  27426. case OPS.setLeadingMoveText:
  27427. flushTextContentItem();
  27428. textState.leading = -args[1];
  27429. textState.translateTextLineMatrix(args[0], args[1]);
  27430. textState.textMatrix = textState.textLineMatrix.slice();
  27431. break;
  27432. case OPS.nextLine:
  27433. flushTextContentItem();
  27434. textState.carriageReturn();
  27435. break;
  27436. case OPS.setTextMatrix:
  27437. advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]);
  27438. if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) {
  27439. textState.translateTextLineMatrix(advance.width, advance.height);
  27440. textContentItem.width += advance.width - textContentItem.lastAdvanceWidth;
  27441. textContentItem.height += advance.height - textContentItem.lastAdvanceHeight;
  27442. diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight);
  27443. addFakeSpaces(diff, textContentItem.str);
  27444. break;
  27445. }
  27446. flushTextContentItem();
  27447. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  27448. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  27449. break;
  27450. case OPS.setCharSpacing:
  27451. textState.charSpacing = args[0];
  27452. break;
  27453. case OPS.setWordSpacing:
  27454. textState.wordSpacing = args[0];
  27455. break;
  27456. case OPS.beginText:
  27457. flushTextContentItem();
  27458. textState.textMatrix = IDENTITY_MATRIX.slice();
  27459. textState.textLineMatrix = IDENTITY_MATRIX.slice();
  27460. break;
  27461. case OPS.showSpacedText:
  27462. var items = args[0];
  27463. var offset;
  27464. for (var j = 0, jj = items.length; j < jj; j++) {
  27465. if (typeof items[j] === 'string') {
  27466. buildTextContentItem(items[j]);
  27467. } else if (isNum(items[j])) {
  27468. ensureTextContentItem();
  27469. advance = items[j] * textState.fontSize / 1000;
  27470. var breakTextRun = false;
  27471. if (textState.font.vertical) {
  27472. offset = advance;
  27473. textState.translateTextMatrix(0, offset);
  27474. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  27475. if (!breakTextRun) {
  27476. textContentItem.height += offset;
  27477. }
  27478. } else {
  27479. advance = -advance;
  27480. offset = advance * textState.textHScale;
  27481. textState.translateTextMatrix(offset, 0);
  27482. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  27483. if (!breakTextRun) {
  27484. textContentItem.width += offset;
  27485. }
  27486. }
  27487. if (breakTextRun) {
  27488. flushTextContentItem();
  27489. } else if (advance > 0) {
  27490. addFakeSpaces(advance, textContentItem.str);
  27491. }
  27492. }
  27493. }
  27494. break;
  27495. case OPS.showText:
  27496. buildTextContentItem(args[0]);
  27497. break;
  27498. case OPS.nextLineShowText:
  27499. flushTextContentItem();
  27500. textState.carriageReturn();
  27501. buildTextContentItem(args[0]);
  27502. break;
  27503. case OPS.nextLineSetSpacingShowText:
  27504. flushTextContentItem();
  27505. textState.wordSpacing = args[0];
  27506. textState.charSpacing = args[1];
  27507. textState.carriageReturn();
  27508. buildTextContentItem(args[2]);
  27509. break;
  27510. case OPS.paintXObject:
  27511. flushTextContentItem();
  27512. if (args[0].code) {
  27513. break;
  27514. }
  27515. if (!xobjs) {
  27516. xobjs = resources.get('XObject') || Dict.empty;
  27517. }
  27518. var name = args[0].name;
  27519. if (xobjsCache.key === name) {
  27520. if (xobjsCache.texts) {
  27521. Util.appendToArray(textContent.items, xobjsCache.texts.items);
  27522. Util.extendObj(textContent.styles, xobjsCache.texts.styles);
  27523. }
  27524. break;
  27525. }
  27526. var xobj = xobjs.get(name);
  27527. if (!xobj) {
  27528. break;
  27529. }
  27530. assert(isStream(xobj), 'XObject should be a stream');
  27531. var type = xobj.dict.get('Subtype');
  27532. assert(isName(type), 'XObject should have a Name subtype');
  27533. if ('Form' !== type.name) {
  27534. xobjsCache.key = name;
  27535. xobjsCache.texts = null;
  27536. break;
  27537. }
  27538. stateManager.save();
  27539. var matrix = xobj.dict.getArray('Matrix');
  27540. if (isArray(matrix) && matrix.length === 6) {
  27541. stateManager.transform(matrix);
  27542. }
  27543. next(self.getTextContent(xobj, task, xobj.dict.get('Resources') || resources, stateManager, normalizeWhitespace, combineTextItems).then(function (formTextContent) {
  27544. Util.appendToArray(textContent.items, formTextContent.items);
  27545. Util.extendObj(textContent.styles, formTextContent.styles);
  27546. stateManager.restore();
  27547. xobjsCache.key = name;
  27548. xobjsCache.texts = formTextContent;
  27549. }));
  27550. return;
  27551. case OPS.setGState:
  27552. flushTextContentItem();
  27553. var dictName = args[0];
  27554. var extGState = resources.get('ExtGState');
  27555. if (!isDict(extGState) || !isName(dictName)) {
  27556. break;
  27557. }
  27558. var gState = extGState.get(dictName.name);
  27559. if (!isDict(gState)) {
  27560. break;
  27561. }
  27562. var gStateFont = gState.get('Font');
  27563. if (gStateFont) {
  27564. textState.fontName = null;
  27565. textState.fontSize = gStateFont[1];
  27566. next(handleSetFont(null, gStateFont[0]));
  27567. return;
  27568. }
  27569. break;
  27570. }
  27571. }
  27572. if (stop) {
  27573. next(deferred);
  27574. return;
  27575. }
  27576. flushTextContentItem();
  27577. resolve(textContent);
  27578. });
  27579. },
  27580. extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, xref, properties) {
  27581. var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
  27582. var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined);
  27583. if (properties.composite) {
  27584. var cidSystemInfo = dict.get('CIDSystemInfo');
  27585. if (isDict(cidSystemInfo)) {
  27586. properties.cidSystemInfo = {
  27587. registry: cidSystemInfo.get('Registry'),
  27588. ordering: cidSystemInfo.get('Ordering'),
  27589. supplement: cidSystemInfo.get('Supplement')
  27590. };
  27591. }
  27592. var cidToGidMap = dict.get('CIDToGIDMap');
  27593. if (isStream(cidToGidMap)) {
  27594. properties.cidToGidMap = this.readCidToGidMap(cidToGidMap);
  27595. }
  27596. }
  27597. var differences = [];
  27598. var baseEncodingName = null;
  27599. var encoding;
  27600. if (dict.has('Encoding')) {
  27601. encoding = dict.get('Encoding');
  27602. if (isDict(encoding)) {
  27603. baseEncodingName = encoding.get('BaseEncoding');
  27604. baseEncodingName = isName(baseEncodingName) ? baseEncodingName.name : null;
  27605. if (encoding.has('Differences')) {
  27606. var diffEncoding = encoding.get('Differences');
  27607. var index = 0;
  27608. for (var j = 0, jj = diffEncoding.length; j < jj; j++) {
  27609. var data = xref.fetchIfRef(diffEncoding[j]);
  27610. if (isNum(data)) {
  27611. index = data;
  27612. } else if (isName(data)) {
  27613. differences[index++] = data.name;
  27614. } else {
  27615. error('Invalid entry in \'Differences\' array: ' + data);
  27616. }
  27617. }
  27618. }
  27619. } else if (isName(encoding)) {
  27620. baseEncodingName = encoding.name;
  27621. } else {
  27622. error('Encoding is not a Name nor a Dict');
  27623. }
  27624. if (baseEncodingName !== 'MacRomanEncoding' && baseEncodingName !== 'MacExpertEncoding' && baseEncodingName !== 'WinAnsiEncoding') {
  27625. baseEncodingName = null;
  27626. }
  27627. }
  27628. if (baseEncodingName) {
  27629. properties.defaultEncoding = getEncoding(baseEncodingName).slice();
  27630. } else {
  27631. var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  27632. var isNonsymbolicFont = !!(properties.flags & FontFlags.Nonsymbolic);
  27633. encoding = StandardEncoding;
  27634. if (properties.type === 'TrueType' && !isNonsymbolicFont) {
  27635. encoding = WinAnsiEncoding;
  27636. }
  27637. if (isSymbolicFont) {
  27638. encoding = MacRomanEncoding;
  27639. if (!properties.file) {
  27640. if (/Symbol/i.test(properties.name)) {
  27641. encoding = SymbolSetEncoding;
  27642. } else if (/Dingbats/i.test(properties.name)) {
  27643. encoding = ZapfDingbatsEncoding;
  27644. }
  27645. }
  27646. }
  27647. properties.defaultEncoding = encoding;
  27648. }
  27649. properties.differences = differences;
  27650. properties.baseEncodingName = baseEncodingName;
  27651. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  27652. properties.dict = dict;
  27653. return toUnicodePromise.then(function (toUnicode) {
  27654. properties.toUnicode = toUnicode;
  27655. return this.buildToUnicode(properties);
  27656. }.bind(this)).then(function (toUnicode) {
  27657. properties.toUnicode = toUnicode;
  27658. return properties;
  27659. });
  27660. },
  27661. buildToUnicode: function PartialEvaluator_buildToUnicode(properties) {
  27662. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  27663. if (properties.hasIncludedToUnicodeMap) {
  27664. return Promise.resolve(properties.toUnicode);
  27665. }
  27666. var toUnicode, charcode, glyphName;
  27667. if (!properties.composite) {
  27668. toUnicode = [];
  27669. var encoding = properties.defaultEncoding.slice();
  27670. var baseEncodingName = properties.baseEncodingName;
  27671. var differences = properties.differences;
  27672. for (charcode in differences) {
  27673. glyphName = differences[charcode];
  27674. if (glyphName === '.notdef') {
  27675. continue;
  27676. }
  27677. encoding[charcode] = glyphName;
  27678. }
  27679. var glyphsUnicodeMap = getGlyphsUnicode();
  27680. for (charcode in encoding) {
  27681. glyphName = encoding[charcode];
  27682. if (glyphName === '') {
  27683. continue;
  27684. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  27685. var code = 0;
  27686. switch (glyphName[0]) {
  27687. case 'G':
  27688. if (glyphName.length === 3) {
  27689. code = parseInt(glyphName.substr(1), 16);
  27690. }
  27691. break;
  27692. case 'g':
  27693. if (glyphName.length === 5) {
  27694. code = parseInt(glyphName.substr(1), 16);
  27695. }
  27696. break;
  27697. case 'C':
  27698. case 'c':
  27699. if (glyphName.length >= 3) {
  27700. code = +glyphName.substr(1);
  27701. }
  27702. break;
  27703. default:
  27704. var unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  27705. if (unicode !== -1) {
  27706. code = unicode;
  27707. }
  27708. }
  27709. if (code) {
  27710. if (baseEncodingName && code === +charcode) {
  27711. var baseEncoding = getEncoding(baseEncodingName);
  27712. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  27713. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  27714. continue;
  27715. }
  27716. }
  27717. toUnicode[charcode] = String.fromCharCode(code);
  27718. }
  27719. continue;
  27720. }
  27721. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  27722. }
  27723. return Promise.resolve(new ToUnicodeMap(toUnicode));
  27724. }
  27725. 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'))) {
  27726. var registry = properties.cidSystemInfo.registry;
  27727. var ordering = properties.cidSystemInfo.ordering;
  27728. var ucs2CMapName = Name.get(registry + '-' + ordering + '-UCS2');
  27729. return CMapFactory.create(ucs2CMapName, this.options.cMapOptions, null).then(function (ucs2CMap) {
  27730. var cMap = properties.cMap;
  27731. toUnicode = [];
  27732. cMap.forEach(function (charcode, cid) {
  27733. assert(cid <= 0xffff, 'Max size of CID is 65,535');
  27734. var ucs2 = ucs2CMap.lookup(cid);
  27735. if (ucs2) {
  27736. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  27737. }
  27738. });
  27739. return new ToUnicodeMap(toUnicode);
  27740. });
  27741. }
  27742. return Promise.resolve(new IdentityToUnicodeMap(properties.firstChar, properties.lastChar));
  27743. },
  27744. readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) {
  27745. var cmapObj = toUnicode;
  27746. if (isName(cmapObj)) {
  27747. return CMapFactory.create(cmapObj, this.options.cMapOptions, null).then(function (cmap) {
  27748. if (cmap instanceof IdentityCMap) {
  27749. return new IdentityToUnicodeMap(0, 0xFFFF);
  27750. }
  27751. return new ToUnicodeMap(cmap.getMap());
  27752. });
  27753. } else if (isStream(cmapObj)) {
  27754. return CMapFactory.create(cmapObj, this.options.cMapOptions, null).then(function (cmap) {
  27755. if (cmap instanceof IdentityCMap) {
  27756. return new IdentityToUnicodeMap(0, 0xFFFF);
  27757. }
  27758. var map = new Array(cmap.length);
  27759. cmap.forEach(function (charCode, token) {
  27760. var str = [];
  27761. for (var k = 0; k < token.length; k += 2) {
  27762. var w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  27763. if ((w1 & 0xF800) !== 0xD800) {
  27764. str.push(w1);
  27765. continue;
  27766. }
  27767. k += 2;
  27768. var w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  27769. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  27770. }
  27771. map[charCode] = String.fromCharCode.apply(String, str);
  27772. });
  27773. return new ToUnicodeMap(map);
  27774. });
  27775. }
  27776. return Promise.resolve(null);
  27777. },
  27778. readCidToGidMap: function PartialEvaluator_readCidToGidMap(cidToGidStream) {
  27779. var glyphsData = cidToGidStream.getBytes();
  27780. var result = [];
  27781. for (var j = 0, jj = glyphsData.length; j < jj; j++) {
  27782. var glyphID = glyphsData[j++] << 8 | glyphsData[j];
  27783. if (glyphID === 0) {
  27784. continue;
  27785. }
  27786. var code = j >> 1;
  27787. result[code] = glyphID;
  27788. }
  27789. return result;
  27790. },
  27791. extractWidths: function PartialEvaluator_extractWidths(dict, xref, descriptor, properties) {
  27792. var glyphsWidths = [];
  27793. var defaultWidth = 0;
  27794. var glyphsVMetrics = [];
  27795. var defaultVMetrics;
  27796. var i, ii, j, jj, start, code, widths;
  27797. if (properties.composite) {
  27798. defaultWidth = dict.get('DW') || 1000;
  27799. widths = dict.get('W');
  27800. if (widths) {
  27801. for (i = 0, ii = widths.length; i < ii; i++) {
  27802. start = xref.fetchIfRef(widths[i++]);
  27803. code = xref.fetchIfRef(widths[i]);
  27804. if (isArray(code)) {
  27805. for (j = 0, jj = code.length; j < jj; j++) {
  27806. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  27807. }
  27808. } else {
  27809. var width = xref.fetchIfRef(widths[++i]);
  27810. for (j = start; j <= code; j++) {
  27811. glyphsWidths[j] = width;
  27812. }
  27813. }
  27814. }
  27815. }
  27816. if (properties.vertical) {
  27817. var vmetrics = dict.getArray('DW2') || [
  27818. 880,
  27819. -1000
  27820. ];
  27821. defaultVMetrics = [
  27822. vmetrics[1],
  27823. defaultWidth * 0.5,
  27824. vmetrics[0]
  27825. ];
  27826. vmetrics = dict.get('W2');
  27827. if (vmetrics) {
  27828. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  27829. start = xref.fetchIfRef(vmetrics[i++]);
  27830. code = xref.fetchIfRef(vmetrics[i]);
  27831. if (isArray(code)) {
  27832. for (j = 0, jj = code.length; j < jj; j++) {
  27833. glyphsVMetrics[start++] = [
  27834. xref.fetchIfRef(code[j++]),
  27835. xref.fetchIfRef(code[j++]),
  27836. xref.fetchIfRef(code[j])
  27837. ];
  27838. }
  27839. } else {
  27840. var vmetric = [
  27841. xref.fetchIfRef(vmetrics[++i]),
  27842. xref.fetchIfRef(vmetrics[++i]),
  27843. xref.fetchIfRef(vmetrics[++i])
  27844. ];
  27845. for (j = start; j <= code; j++) {
  27846. glyphsVMetrics[j] = vmetric;
  27847. }
  27848. }
  27849. }
  27850. }
  27851. }
  27852. } else {
  27853. var firstChar = properties.firstChar;
  27854. widths = dict.get('Widths');
  27855. if (widths) {
  27856. j = firstChar;
  27857. for (i = 0, ii = widths.length; i < ii; i++) {
  27858. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  27859. }
  27860. defaultWidth = parseFloat(descriptor.get('MissingWidth')) || 0;
  27861. } else {
  27862. var baseFontName = dict.get('BaseFont');
  27863. if (isName(baseFontName)) {
  27864. var metrics = this.getBaseFontMetrics(baseFontName.name);
  27865. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  27866. defaultWidth = metrics.defaultWidth;
  27867. }
  27868. }
  27869. }
  27870. var isMonospace = true;
  27871. var firstWidth = defaultWidth;
  27872. for (var glyph in glyphsWidths) {
  27873. var glyphWidth = glyphsWidths[glyph];
  27874. if (!glyphWidth) {
  27875. continue;
  27876. }
  27877. if (!firstWidth) {
  27878. firstWidth = glyphWidth;
  27879. continue;
  27880. }
  27881. if (firstWidth !== glyphWidth) {
  27882. isMonospace = false;
  27883. break;
  27884. }
  27885. }
  27886. if (isMonospace) {
  27887. properties.flags |= FontFlags.FixedPitch;
  27888. }
  27889. properties.defaultWidth = defaultWidth;
  27890. properties.widths = glyphsWidths;
  27891. properties.defaultVMetrics = defaultVMetrics;
  27892. properties.vmetrics = glyphsVMetrics;
  27893. },
  27894. isSerifFont: function PartialEvaluator_isSerifFont(baseFontName) {
  27895. var fontNameWoStyle = baseFontName.split('-')[0];
  27896. return fontNameWoStyle in getSerifFonts() || fontNameWoStyle.search(/serif/gi) !== -1;
  27897. },
  27898. getBaseFontMetrics: function PartialEvaluator_getBaseFontMetrics(name) {
  27899. var defaultWidth = 0;
  27900. var widths = [];
  27901. var monospace = false;
  27902. var stdFontMap = getStdFontMap();
  27903. var lookupName = stdFontMap[name] || name;
  27904. var Metrics = getMetrics();
  27905. if (!(lookupName in Metrics)) {
  27906. if (this.isSerifFont(name)) {
  27907. lookupName = 'Times-Roman';
  27908. } else {
  27909. lookupName = 'Helvetica';
  27910. }
  27911. }
  27912. var glyphWidths = Metrics[lookupName];
  27913. if (isNum(glyphWidths)) {
  27914. defaultWidth = glyphWidths;
  27915. monospace = true;
  27916. } else {
  27917. widths = glyphWidths();
  27918. }
  27919. return {
  27920. defaultWidth: defaultWidth,
  27921. monospace: monospace,
  27922. widths: widths
  27923. };
  27924. },
  27925. buildCharCodeToWidth: function PartialEvaluator_bulildCharCodeToWidth(widthsByGlyphName, properties) {
  27926. var widths = Object.create(null);
  27927. var differences = properties.differences;
  27928. var encoding = properties.defaultEncoding;
  27929. for (var charCode = 0; charCode < 256; charCode++) {
  27930. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  27931. widths[charCode] = widthsByGlyphName[differences[charCode]];
  27932. continue;
  27933. }
  27934. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  27935. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  27936. continue;
  27937. }
  27938. }
  27939. return widths;
  27940. },
  27941. preEvaluateFont: function PartialEvaluator_preEvaluateFont(dict, xref) {
  27942. var baseDict = dict;
  27943. var type = dict.get('Subtype');
  27944. assert(isName(type), 'invalid font Subtype');
  27945. var composite = false;
  27946. var uint8array;
  27947. if (type.name === 'Type0') {
  27948. var df = dict.get('DescendantFonts');
  27949. if (!df) {
  27950. error('Descendant fonts are not specified');
  27951. }
  27952. dict = isArray(df) ? xref.fetchIfRef(df[0]) : df;
  27953. type = dict.get('Subtype');
  27954. assert(isName(type), 'invalid font Subtype');
  27955. composite = true;
  27956. }
  27957. var descriptor = dict.get('FontDescriptor');
  27958. if (descriptor) {
  27959. var hash = new MurmurHash3_64();
  27960. var encoding = baseDict.getRaw('Encoding');
  27961. if (isName(encoding)) {
  27962. hash.update(encoding.name);
  27963. } else if (isRef(encoding)) {
  27964. hash.update(encoding.toString());
  27965. } else if (isDict(encoding)) {
  27966. var keys = encoding.getKeys();
  27967. for (var i = 0, ii = keys.length; i < ii; i++) {
  27968. var entry = encoding.getRaw(keys[i]);
  27969. if (isName(entry)) {
  27970. hash.update(entry.name);
  27971. } else if (isRef(entry)) {
  27972. hash.update(entry.toString());
  27973. } else if (isArray(entry)) {
  27974. var diffLength = entry.length, diffBuf = new Array(diffLength);
  27975. for (var j = 0; j < diffLength; j++) {
  27976. var diffEntry = entry[j];
  27977. if (isName(diffEntry)) {
  27978. diffBuf[j] = diffEntry.name;
  27979. } else if (isNum(diffEntry) || isRef(diffEntry)) {
  27980. diffBuf[j] = diffEntry.toString();
  27981. }
  27982. }
  27983. hash.update(diffBuf.join());
  27984. }
  27985. }
  27986. }
  27987. var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
  27988. if (isStream(toUnicode)) {
  27989. var stream = toUnicode.str || toUnicode;
  27990. uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  27991. hash.update(uint8array);
  27992. } else if (isName(toUnicode)) {
  27993. hash.update(toUnicode.name);
  27994. }
  27995. var widths = dict.get('Widths') || baseDict.get('Widths');
  27996. if (widths) {
  27997. uint8array = new Uint8Array(new Uint32Array(widths).buffer);
  27998. hash.update(uint8array);
  27999. }
  28000. }
  28001. return {
  28002. descriptor: descriptor,
  28003. dict: dict,
  28004. baseDict: baseDict,
  28005. composite: composite,
  28006. type: type.name,
  28007. hash: hash ? hash.hexdigest() : ''
  28008. };
  28009. },
  28010. translateFont: function PartialEvaluator_translateFont(preEvaluatedFont, xref) {
  28011. var baseDict = preEvaluatedFont.baseDict;
  28012. var dict = preEvaluatedFont.dict;
  28013. var composite = preEvaluatedFont.composite;
  28014. var descriptor = preEvaluatedFont.descriptor;
  28015. var type = preEvaluatedFont.type;
  28016. var maxCharIndex = composite ? 0xFFFF : 0xFF;
  28017. var cMapOptions = this.options.cMapOptions;
  28018. var properties;
  28019. if (!descriptor) {
  28020. if (type === 'Type3') {
  28021. descriptor = new Dict(null);
  28022. descriptor.set('FontName', Name.get(type));
  28023. descriptor.set('FontBBox', dict.getArray('FontBBox'));
  28024. } else {
  28025. var baseFontName = dict.get('BaseFont');
  28026. if (!isName(baseFontName)) {
  28027. error('Base font is not specified');
  28028. }
  28029. baseFontName = baseFontName.name.replace(/[,_]/g, '-');
  28030. var metrics = this.getBaseFontMetrics(baseFontName);
  28031. var fontNameWoStyle = baseFontName.split('-')[0];
  28032. var flags = (this.isSerifFont(fontNameWoStyle) ? FontFlags.Serif : 0) | (metrics.monospace ? FontFlags.FixedPitch : 0) | (getSymbolsFonts()[fontNameWoStyle] ? FontFlags.Symbolic : FontFlags.Nonsymbolic);
  28033. properties = {
  28034. type: type,
  28035. name: baseFontName,
  28036. widths: metrics.widths,
  28037. defaultWidth: metrics.defaultWidth,
  28038. flags: flags,
  28039. firstChar: 0,
  28040. lastChar: maxCharIndex
  28041. };
  28042. return this.extractDataStructures(dict, dict, xref, properties).then(function (properties) {
  28043. properties.widths = this.buildCharCodeToWidth(metrics.widths, properties);
  28044. return new Font(baseFontName, null, properties);
  28045. }.bind(this));
  28046. }
  28047. }
  28048. var firstChar = dict.get('FirstChar') || 0;
  28049. var lastChar = dict.get('LastChar') || maxCharIndex;
  28050. var fontName = descriptor.get('FontName');
  28051. var baseFont = dict.get('BaseFont');
  28052. if (isString(fontName)) {
  28053. fontName = Name.get(fontName);
  28054. }
  28055. if (isString(baseFont)) {
  28056. baseFont = Name.get(baseFont);
  28057. }
  28058. if (type !== 'Type3') {
  28059. var fontNameStr = fontName && fontName.name;
  28060. var baseFontStr = baseFont && baseFont.name;
  28061. if (fontNameStr !== baseFontStr) {
  28062. info('The FontDescriptor\'s FontName is "' + fontNameStr + '" but should be the same as the Font\'s BaseFont "' + baseFontStr + '"');
  28063. if (fontNameStr && baseFontStr && baseFontStr.indexOf(fontNameStr) === 0) {
  28064. fontName = baseFont;
  28065. }
  28066. }
  28067. }
  28068. fontName = fontName || baseFont;
  28069. assert(isName(fontName), 'invalid font name');
  28070. var fontFile = descriptor.get('FontFile', 'FontFile2', 'FontFile3');
  28071. if (fontFile) {
  28072. if (fontFile.dict) {
  28073. var subtype = fontFile.dict.get('Subtype');
  28074. if (subtype) {
  28075. subtype = subtype.name;
  28076. }
  28077. var length1 = fontFile.dict.get('Length1');
  28078. var length2 = fontFile.dict.get('Length2');
  28079. var length3 = fontFile.dict.get('Length3');
  28080. }
  28081. }
  28082. properties = {
  28083. type: type,
  28084. name: fontName.name,
  28085. subtype: subtype,
  28086. file: fontFile,
  28087. length1: length1,
  28088. length2: length2,
  28089. length3: length3,
  28090. loadedName: baseDict.loadedName,
  28091. composite: composite,
  28092. wideChars: composite,
  28093. fixedPitch: false,
  28094. fontMatrix: dict.getArray('FontMatrix') || FONT_IDENTITY_MATRIX,
  28095. firstChar: firstChar || 0,
  28096. lastChar: lastChar || maxCharIndex,
  28097. bbox: descriptor.getArray('FontBBox'),
  28098. ascent: descriptor.get('Ascent'),
  28099. descent: descriptor.get('Descent'),
  28100. xHeight: descriptor.get('XHeight'),
  28101. capHeight: descriptor.get('CapHeight'),
  28102. flags: descriptor.get('Flags'),
  28103. italicAngle: descriptor.get('ItalicAngle'),
  28104. coded: false
  28105. };
  28106. var cMapPromise;
  28107. if (composite) {
  28108. var cidEncoding = baseDict.get('Encoding');
  28109. if (isName(cidEncoding)) {
  28110. properties.cidEncoding = cidEncoding.name;
  28111. }
  28112. cMapPromise = CMapFactory.create(cidEncoding, cMapOptions, null).then(function (cMap) {
  28113. properties.cMap = cMap;
  28114. properties.vertical = properties.cMap.vertical;
  28115. });
  28116. } else {
  28117. cMapPromise = Promise.resolve(undefined);
  28118. }
  28119. return cMapPromise.then(function () {
  28120. return this.extractDataStructures(dict, baseDict, xref, properties);
  28121. }.bind(this)).then(function (properties) {
  28122. this.extractWidths(dict, xref, descriptor, properties);
  28123. if (type === 'Type3') {
  28124. properties.isType3Font = true;
  28125. }
  28126. return new Font(fontName.name, fontFile, properties);
  28127. }.bind(this));
  28128. }
  28129. };
  28130. return PartialEvaluator;
  28131. }();
  28132. var TranslatedFont = function TranslatedFontClosure() {
  28133. function TranslatedFont(loadedName, font, dict) {
  28134. this.loadedName = loadedName;
  28135. this.font = font;
  28136. this.dict = dict;
  28137. this.type3Loaded = null;
  28138. this.sent = false;
  28139. }
  28140. TranslatedFont.prototype = {
  28141. send: function (handler) {
  28142. if (this.sent) {
  28143. return;
  28144. }
  28145. var fontData = this.font.exportData();
  28146. handler.send('commonobj', [
  28147. this.loadedName,
  28148. 'Font',
  28149. fontData
  28150. ]);
  28151. this.sent = true;
  28152. },
  28153. loadType3Data: function (evaluator, resources, parentOperatorList, task) {
  28154. assert(this.font.isType3Font);
  28155. if (this.type3Loaded) {
  28156. return this.type3Loaded;
  28157. }
  28158. var translatedFont = this.font;
  28159. var loadCharProcsPromise = Promise.resolve();
  28160. var charProcs = this.dict.get('CharProcs');
  28161. var fontResources = this.dict.get('Resources') || resources;
  28162. var charProcKeys = charProcs.getKeys();
  28163. var charProcOperatorList = Object.create(null);
  28164. for (var i = 0, n = charProcKeys.length; i < n; ++i) {
  28165. loadCharProcsPromise = loadCharProcsPromise.then(function (key) {
  28166. var glyphStream = charProcs.get(key);
  28167. var operatorList = new OperatorList();
  28168. return evaluator.getOperatorList(glyphStream, task, fontResources, operatorList).then(function () {
  28169. charProcOperatorList[key] = operatorList.getIR();
  28170. parentOperatorList.addDependencies(operatorList.dependencies);
  28171. }, function (reason) {
  28172. warn('Type3 font resource \"' + key + '\" is not available');
  28173. var operatorList = new OperatorList();
  28174. charProcOperatorList[key] = operatorList.getIR();
  28175. });
  28176. }.bind(this, charProcKeys[i]));
  28177. }
  28178. this.type3Loaded = loadCharProcsPromise.then(function () {
  28179. translatedFont.charProcOperatorList = charProcOperatorList;
  28180. });
  28181. return this.type3Loaded;
  28182. }
  28183. };
  28184. return TranslatedFont;
  28185. }();
  28186. var OperatorList = function OperatorListClosure() {
  28187. var CHUNK_SIZE = 1000;
  28188. var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5;
  28189. function getTransfers(queue) {
  28190. var transfers = [];
  28191. var fnArray = queue.fnArray, argsArray = queue.argsArray;
  28192. for (var i = 0, ii = queue.length; i < ii; i++) {
  28193. switch (fnArray[i]) {
  28194. case OPS.paintInlineImageXObject:
  28195. case OPS.paintInlineImageXObjectGroup:
  28196. case OPS.paintImageMaskXObject:
  28197. var arg = argsArray[i][0];
  28198. if (!arg.cached) {
  28199. transfers.push(arg.data.buffer);
  28200. }
  28201. break;
  28202. }
  28203. }
  28204. return transfers;
  28205. }
  28206. function OperatorList(intent, messageHandler, pageIndex) {
  28207. this.messageHandler = messageHandler;
  28208. this.fnArray = [];
  28209. this.argsArray = [];
  28210. this.dependencies = Object.create(null);
  28211. this._totalLength = 0;
  28212. this.pageIndex = pageIndex;
  28213. this.intent = intent;
  28214. }
  28215. OperatorList.prototype = {
  28216. get length() {
  28217. return this.argsArray.length;
  28218. },
  28219. get totalLength() {
  28220. return this._totalLength + this.length;
  28221. },
  28222. addOp: function (fn, args) {
  28223. this.fnArray.push(fn);
  28224. this.argsArray.push(args);
  28225. if (this.messageHandler) {
  28226. if (this.fnArray.length >= CHUNK_SIZE) {
  28227. this.flush();
  28228. } else if (this.fnArray.length >= CHUNK_SIZE_ABOUT && (fn === OPS.restore || fn === OPS.endText)) {
  28229. this.flush();
  28230. }
  28231. }
  28232. },
  28233. addDependency: function (dependency) {
  28234. if (dependency in this.dependencies) {
  28235. return;
  28236. }
  28237. this.dependencies[dependency] = true;
  28238. this.addOp(OPS.dependency, [dependency]);
  28239. },
  28240. addDependencies: function (dependencies) {
  28241. for (var key in dependencies) {
  28242. this.addDependency(key);
  28243. }
  28244. },
  28245. addOpList: function (opList) {
  28246. Util.extendObj(this.dependencies, opList.dependencies);
  28247. for (var i = 0, ii = opList.length; i < ii; i++) {
  28248. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  28249. }
  28250. },
  28251. getIR: function () {
  28252. return {
  28253. fnArray: this.fnArray,
  28254. argsArray: this.argsArray,
  28255. length: this.length
  28256. };
  28257. },
  28258. flush: function (lastChunk) {
  28259. if (this.intent !== 'oplist') {
  28260. new QueueOptimizer().optimize(this);
  28261. }
  28262. var transfers = getTransfers(this);
  28263. var length = this.length;
  28264. this._totalLength += length;
  28265. this.messageHandler.send('RenderPageChunk', {
  28266. operatorList: {
  28267. fnArray: this.fnArray,
  28268. argsArray: this.argsArray,
  28269. lastChunk: lastChunk,
  28270. length: length
  28271. },
  28272. pageIndex: this.pageIndex,
  28273. intent: this.intent
  28274. }, transfers);
  28275. this.dependencies = Object.create(null);
  28276. this.fnArray.length = 0;
  28277. this.argsArray.length = 0;
  28278. }
  28279. };
  28280. return OperatorList;
  28281. }();
  28282. var StateManager = function StateManagerClosure() {
  28283. function StateManager(initialState) {
  28284. this.state = initialState;
  28285. this.stateStack = [];
  28286. }
  28287. StateManager.prototype = {
  28288. save: function () {
  28289. var old = this.state;
  28290. this.stateStack.push(this.state);
  28291. this.state = old.clone();
  28292. },
  28293. restore: function () {
  28294. var prev = this.stateStack.pop();
  28295. if (prev) {
  28296. this.state = prev;
  28297. }
  28298. },
  28299. transform: function (args) {
  28300. this.state.ctm = Util.transform(this.state.ctm, args);
  28301. }
  28302. };
  28303. return StateManager;
  28304. }();
  28305. var TextState = function TextStateClosure() {
  28306. function TextState() {
  28307. this.ctm = new Float32Array(IDENTITY_MATRIX);
  28308. this.fontName = null;
  28309. this.fontSize = 0;
  28310. this.font = null;
  28311. this.fontMatrix = FONT_IDENTITY_MATRIX;
  28312. this.textMatrix = IDENTITY_MATRIX.slice();
  28313. this.textLineMatrix = IDENTITY_MATRIX.slice();
  28314. this.charSpacing = 0;
  28315. this.wordSpacing = 0;
  28316. this.leading = 0;
  28317. this.textHScale = 1;
  28318. this.textRise = 0;
  28319. }
  28320. TextState.prototype = {
  28321. setTextMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
  28322. var m = this.textMatrix;
  28323. m[0] = a;
  28324. m[1] = b;
  28325. m[2] = c;
  28326. m[3] = d;
  28327. m[4] = e;
  28328. m[5] = f;
  28329. },
  28330. setTextLineMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
  28331. var m = this.textLineMatrix;
  28332. m[0] = a;
  28333. m[1] = b;
  28334. m[2] = c;
  28335. m[3] = d;
  28336. m[4] = e;
  28337. m[5] = f;
  28338. },
  28339. translateTextMatrix: function TextState_translateTextMatrix(x, y) {
  28340. var m = this.textMatrix;
  28341. m[4] = m[0] * x + m[2] * y + m[4];
  28342. m[5] = m[1] * x + m[3] * y + m[5];
  28343. },
  28344. translateTextLineMatrix: function TextState_translateTextMatrix(x, y) {
  28345. var m = this.textLineMatrix;
  28346. m[4] = m[0] * x + m[2] * y + m[4];
  28347. m[5] = m[1] * x + m[3] * y + m[5];
  28348. },
  28349. calcTextLineMatrixAdvance: function TextState_calcTextLineMatrixAdvance(a, b, c, d, e, f) {
  28350. var font = this.font;
  28351. if (!font) {
  28352. return null;
  28353. }
  28354. var m = this.textLineMatrix;
  28355. if (!(a === m[0] && b === m[1] && c === m[2] && d === m[3])) {
  28356. return null;
  28357. }
  28358. var txDiff = e - m[4], tyDiff = f - m[5];
  28359. if (font.vertical && txDiff !== 0 || !font.vertical && tyDiff !== 0) {
  28360. return null;
  28361. }
  28362. var tx, ty, denominator = a * d - b * c;
  28363. if (font.vertical) {
  28364. tx = -tyDiff * c / denominator;
  28365. ty = tyDiff * a / denominator;
  28366. } else {
  28367. tx = txDiff * d / denominator;
  28368. ty = -txDiff * b / denominator;
  28369. }
  28370. return {
  28371. width: tx,
  28372. height: ty,
  28373. value: font.vertical ? ty : tx
  28374. };
  28375. },
  28376. calcRenderMatrix: function TextState_calcRendeMatrix(ctm) {
  28377. var tsm = [
  28378. this.fontSize * this.textHScale,
  28379. 0,
  28380. 0,
  28381. this.fontSize,
  28382. 0,
  28383. this.textRise
  28384. ];
  28385. return Util.transform(ctm, Util.transform(this.textMatrix, tsm));
  28386. },
  28387. carriageReturn: function TextState_carriageReturn() {
  28388. this.translateTextLineMatrix(0, -this.leading);
  28389. this.textMatrix = this.textLineMatrix.slice();
  28390. },
  28391. clone: function TextState_clone() {
  28392. var clone = Object.create(this);
  28393. clone.textMatrix = this.textMatrix.slice();
  28394. clone.textLineMatrix = this.textLineMatrix.slice();
  28395. clone.fontMatrix = this.fontMatrix.slice();
  28396. return clone;
  28397. }
  28398. };
  28399. return TextState;
  28400. }();
  28401. var EvalState = function EvalStateClosure() {
  28402. function EvalState() {
  28403. this.ctm = new Float32Array(IDENTITY_MATRIX);
  28404. this.font = null;
  28405. this.textRenderingMode = TextRenderingMode.FILL;
  28406. this.fillColorSpace = ColorSpace.singletons.gray;
  28407. this.strokeColorSpace = ColorSpace.singletons.gray;
  28408. }
  28409. EvalState.prototype = {
  28410. clone: function CanvasExtraState_clone() {
  28411. return Object.create(this);
  28412. }
  28413. };
  28414. return EvalState;
  28415. }();
  28416. var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() {
  28417. var getOPMap = getLookupTableFactory(function (t) {
  28418. t['w'] = {
  28419. id: OPS.setLineWidth,
  28420. numArgs: 1,
  28421. variableArgs: false
  28422. };
  28423. t['J'] = {
  28424. id: OPS.setLineCap,
  28425. numArgs: 1,
  28426. variableArgs: false
  28427. };
  28428. t['j'] = {
  28429. id: OPS.setLineJoin,
  28430. numArgs: 1,
  28431. variableArgs: false
  28432. };
  28433. t['M'] = {
  28434. id: OPS.setMiterLimit,
  28435. numArgs: 1,
  28436. variableArgs: false
  28437. };
  28438. t['d'] = {
  28439. id: OPS.setDash,
  28440. numArgs: 2,
  28441. variableArgs: false
  28442. };
  28443. t['ri'] = {
  28444. id: OPS.setRenderingIntent,
  28445. numArgs: 1,
  28446. variableArgs: false
  28447. };
  28448. t['i'] = {
  28449. id: OPS.setFlatness,
  28450. numArgs: 1,
  28451. variableArgs: false
  28452. };
  28453. t['gs'] = {
  28454. id: OPS.setGState,
  28455. numArgs: 1,
  28456. variableArgs: false
  28457. };
  28458. t['q'] = {
  28459. id: OPS.save,
  28460. numArgs: 0,
  28461. variableArgs: false
  28462. };
  28463. t['Q'] = {
  28464. id: OPS.restore,
  28465. numArgs: 0,
  28466. variableArgs: false
  28467. };
  28468. t['cm'] = {
  28469. id: OPS.transform,
  28470. numArgs: 6,
  28471. variableArgs: false
  28472. };
  28473. t['m'] = {
  28474. id: OPS.moveTo,
  28475. numArgs: 2,
  28476. variableArgs: false
  28477. };
  28478. t['l'] = {
  28479. id: OPS.lineTo,
  28480. numArgs: 2,
  28481. variableArgs: false
  28482. };
  28483. t['c'] = {
  28484. id: OPS.curveTo,
  28485. numArgs: 6,
  28486. variableArgs: false
  28487. };
  28488. t['v'] = {
  28489. id: OPS.curveTo2,
  28490. numArgs: 4,
  28491. variableArgs: false
  28492. };
  28493. t['y'] = {
  28494. id: OPS.curveTo3,
  28495. numArgs: 4,
  28496. variableArgs: false
  28497. };
  28498. t['h'] = {
  28499. id: OPS.closePath,
  28500. numArgs: 0,
  28501. variableArgs: false
  28502. };
  28503. t['re'] = {
  28504. id: OPS.rectangle,
  28505. numArgs: 4,
  28506. variableArgs: false
  28507. };
  28508. t['S'] = {
  28509. id: OPS.stroke,
  28510. numArgs: 0,
  28511. variableArgs: false
  28512. };
  28513. t['s'] = {
  28514. id: OPS.closeStroke,
  28515. numArgs: 0,
  28516. variableArgs: false
  28517. };
  28518. t['f'] = {
  28519. id: OPS.fill,
  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.eoFill,
  28530. numArgs: 0,
  28531. variableArgs: false
  28532. };
  28533. t['B'] = {
  28534. id: OPS.fillStroke,
  28535. numArgs: 0,
  28536. variableArgs: false
  28537. };
  28538. t['B*'] = {
  28539. id: OPS.eoFillStroke,
  28540. numArgs: 0,
  28541. variableArgs: false
  28542. };
  28543. t['b'] = {
  28544. id: OPS.closeFillStroke,
  28545. numArgs: 0,
  28546. variableArgs: false
  28547. };
  28548. t['b*'] = {
  28549. id: OPS.closeEOFillStroke,
  28550. numArgs: 0,
  28551. variableArgs: false
  28552. };
  28553. t['n'] = {
  28554. id: OPS.endPath,
  28555. numArgs: 0,
  28556. variableArgs: false
  28557. };
  28558. t['W'] = {
  28559. id: OPS.clip,
  28560. numArgs: 0,
  28561. variableArgs: false
  28562. };
  28563. t['W*'] = {
  28564. id: OPS.eoClip,
  28565. numArgs: 0,
  28566. variableArgs: false
  28567. };
  28568. t['BT'] = {
  28569. id: OPS.beginText,
  28570. numArgs: 0,
  28571. variableArgs: false
  28572. };
  28573. t['ET'] = {
  28574. id: OPS.endText,
  28575. numArgs: 0,
  28576. variableArgs: false
  28577. };
  28578. t['Tc'] = {
  28579. id: OPS.setCharSpacing,
  28580. numArgs: 1,
  28581. variableArgs: false
  28582. };
  28583. t['Tw'] = {
  28584. id: OPS.setWordSpacing,
  28585. numArgs: 1,
  28586. variableArgs: false
  28587. };
  28588. t['Tz'] = {
  28589. id: OPS.setHScale,
  28590. numArgs: 1,
  28591. variableArgs: false
  28592. };
  28593. t['TL'] = {
  28594. id: OPS.setLeading,
  28595. numArgs: 1,
  28596. variableArgs: false
  28597. };
  28598. t['Tf'] = {
  28599. id: OPS.setFont,
  28600. numArgs: 2,
  28601. variableArgs: false
  28602. };
  28603. t['Tr'] = {
  28604. id: OPS.setTextRenderingMode,
  28605. numArgs: 1,
  28606. variableArgs: false
  28607. };
  28608. t['Ts'] = {
  28609. id: OPS.setTextRise,
  28610. numArgs: 1,
  28611. variableArgs: false
  28612. };
  28613. t['Td'] = {
  28614. id: OPS.moveText,
  28615. numArgs: 2,
  28616. variableArgs: false
  28617. };
  28618. t['TD'] = {
  28619. id: OPS.setLeadingMoveText,
  28620. numArgs: 2,
  28621. variableArgs: false
  28622. };
  28623. t['Tm'] = {
  28624. id: OPS.setTextMatrix,
  28625. numArgs: 6,
  28626. variableArgs: false
  28627. };
  28628. t['T*'] = {
  28629. id: OPS.nextLine,
  28630. numArgs: 0,
  28631. variableArgs: false
  28632. };
  28633. t['Tj'] = {
  28634. id: OPS.showText,
  28635. numArgs: 1,
  28636. variableArgs: false
  28637. };
  28638. t['TJ'] = {
  28639. id: OPS.showSpacedText,
  28640. numArgs: 1,
  28641. variableArgs: false
  28642. };
  28643. t['\''] = {
  28644. id: OPS.nextLineShowText,
  28645. numArgs: 1,
  28646. variableArgs: false
  28647. };
  28648. t['"'] = {
  28649. id: OPS.nextLineSetSpacingShowText,
  28650. numArgs: 3,
  28651. variableArgs: false
  28652. };
  28653. t['d0'] = {
  28654. id: OPS.setCharWidth,
  28655. numArgs: 2,
  28656. variableArgs: false
  28657. };
  28658. t['d1'] = {
  28659. id: OPS.setCharWidthAndBounds,
  28660. numArgs: 6,
  28661. variableArgs: false
  28662. };
  28663. t['CS'] = {
  28664. id: OPS.setStrokeColorSpace,
  28665. numArgs: 1,
  28666. variableArgs: false
  28667. };
  28668. t['cs'] = {
  28669. id: OPS.setFillColorSpace,
  28670. numArgs: 1,
  28671. variableArgs: false
  28672. };
  28673. t['SC'] = {
  28674. id: OPS.setStrokeColor,
  28675. numArgs: 4,
  28676. variableArgs: true
  28677. };
  28678. t['SCN'] = {
  28679. id: OPS.setStrokeColorN,
  28680. numArgs: 33,
  28681. variableArgs: true
  28682. };
  28683. t['sc'] = {
  28684. id: OPS.setFillColor,
  28685. numArgs: 4,
  28686. variableArgs: true
  28687. };
  28688. t['scn'] = {
  28689. id: OPS.setFillColorN,
  28690. numArgs: 33,
  28691. variableArgs: true
  28692. };
  28693. t['G'] = {
  28694. id: OPS.setStrokeGray,
  28695. numArgs: 1,
  28696. variableArgs: false
  28697. };
  28698. t['g'] = {
  28699. id: OPS.setFillGray,
  28700. numArgs: 1,
  28701. variableArgs: false
  28702. };
  28703. t['RG'] = {
  28704. id: OPS.setStrokeRGBColor,
  28705. numArgs: 3,
  28706. variableArgs: false
  28707. };
  28708. t['rg'] = {
  28709. id: OPS.setFillRGBColor,
  28710. numArgs: 3,
  28711. variableArgs: false
  28712. };
  28713. t['K'] = {
  28714. id: OPS.setStrokeCMYKColor,
  28715. numArgs: 4,
  28716. variableArgs: false
  28717. };
  28718. t['k'] = {
  28719. id: OPS.setFillCMYKColor,
  28720. numArgs: 4,
  28721. variableArgs: false
  28722. };
  28723. t['sh'] = {
  28724. id: OPS.shadingFill,
  28725. numArgs: 1,
  28726. variableArgs: false
  28727. };
  28728. t['BI'] = {
  28729. id: OPS.beginInlineImage,
  28730. numArgs: 0,
  28731. variableArgs: false
  28732. };
  28733. t['ID'] = {
  28734. id: OPS.beginImageData,
  28735. numArgs: 0,
  28736. variableArgs: false
  28737. };
  28738. t['EI'] = {
  28739. id: OPS.endInlineImage,
  28740. numArgs: 1,
  28741. variableArgs: false
  28742. };
  28743. t['Do'] = {
  28744. id: OPS.paintXObject,
  28745. numArgs: 1,
  28746. variableArgs: false
  28747. };
  28748. t['MP'] = {
  28749. id: OPS.markPoint,
  28750. numArgs: 1,
  28751. variableArgs: false
  28752. };
  28753. t['DP'] = {
  28754. id: OPS.markPointProps,
  28755. numArgs: 2,
  28756. variableArgs: false
  28757. };
  28758. t['BMC'] = {
  28759. id: OPS.beginMarkedContent,
  28760. numArgs: 1,
  28761. variableArgs: false
  28762. };
  28763. t['BDC'] = {
  28764. id: OPS.beginMarkedContentProps,
  28765. numArgs: 2,
  28766. variableArgs: false
  28767. };
  28768. t['EMC'] = {
  28769. id: OPS.endMarkedContent,
  28770. numArgs: 0,
  28771. variableArgs: false
  28772. };
  28773. t['BX'] = {
  28774. id: OPS.beginCompat,
  28775. numArgs: 0,
  28776. variableArgs: false
  28777. };
  28778. t['EX'] = {
  28779. id: OPS.endCompat,
  28780. numArgs: 0,
  28781. variableArgs: false
  28782. };
  28783. t['BM'] = null;
  28784. t['BD'] = null;
  28785. t['true'] = null;
  28786. t['fa'] = null;
  28787. t['fal'] = null;
  28788. t['fals'] = null;
  28789. t['false'] = null;
  28790. t['nu'] = null;
  28791. t['nul'] = null;
  28792. t['null'] = null;
  28793. });
  28794. function EvaluatorPreprocessor(stream, xref, stateManager) {
  28795. this.opMap = getOPMap();
  28796. this.parser = new Parser(new Lexer(stream, this.opMap), false, xref);
  28797. this.stateManager = stateManager;
  28798. this.nonProcessedArgs = [];
  28799. }
  28800. EvaluatorPreprocessor.prototype = {
  28801. get savedStatesDepth() {
  28802. return this.stateManager.stateStack.length;
  28803. },
  28804. read: function EvaluatorPreprocessor_read(operation) {
  28805. var args = operation.args;
  28806. while (true) {
  28807. var obj = this.parser.getObj();
  28808. if (isCmd(obj)) {
  28809. var cmd = obj.cmd;
  28810. var opSpec = this.opMap[cmd];
  28811. if (!opSpec) {
  28812. warn('Unknown command "' + cmd + '"');
  28813. continue;
  28814. }
  28815. var fn = opSpec.id;
  28816. var numArgs = opSpec.numArgs;
  28817. var argsLength = args !== null ? args.length : 0;
  28818. if (!opSpec.variableArgs) {
  28819. if (argsLength !== numArgs) {
  28820. var nonProcessedArgs = this.nonProcessedArgs;
  28821. while (argsLength > numArgs) {
  28822. nonProcessedArgs.push(args.shift());
  28823. argsLength--;
  28824. }
  28825. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  28826. if (args === null) {
  28827. args = [];
  28828. }
  28829. args.unshift(nonProcessedArgs.pop());
  28830. argsLength++;
  28831. }
  28832. }
  28833. if (argsLength < numArgs) {
  28834. warn('Skipping command ' + fn + ': expected ' + numArgs + ' args, but received ' + argsLength + ' args.');
  28835. if (args !== null) {
  28836. args.length = 0;
  28837. }
  28838. continue;
  28839. }
  28840. } else if (argsLength > numArgs) {
  28841. info('Command ' + fn + ': expected [0,' + numArgs + '] args, but received ' + argsLength + ' args.');
  28842. }
  28843. this.preprocessCommand(fn, args);
  28844. operation.fn = fn;
  28845. operation.args = args;
  28846. return true;
  28847. }
  28848. if (isEOF(obj)) {
  28849. return false;
  28850. }
  28851. if (obj !== null) {
  28852. if (args === null) {
  28853. args = [];
  28854. }
  28855. args.push(obj);
  28856. assert(args.length <= 33, 'Too many arguments');
  28857. }
  28858. }
  28859. },
  28860. preprocessCommand: function EvaluatorPreprocessor_preprocessCommand(fn, args) {
  28861. switch (fn | 0) {
  28862. case OPS.save:
  28863. this.stateManager.save();
  28864. break;
  28865. case OPS.restore:
  28866. this.stateManager.restore();
  28867. break;
  28868. case OPS.transform:
  28869. this.stateManager.transform(args);
  28870. break;
  28871. }
  28872. }
  28873. };
  28874. return EvaluatorPreprocessor;
  28875. }();
  28876. var QueueOptimizer = function QueueOptimizerClosure() {
  28877. function addState(parentState, pattern, fn) {
  28878. var state = parentState;
  28879. for (var i = 0, ii = pattern.length - 1; i < ii; i++) {
  28880. var item = pattern[i];
  28881. state = state[item] || (state[item] = []);
  28882. }
  28883. state[pattern[pattern.length - 1]] = fn;
  28884. }
  28885. function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) {
  28886. var iFirstPIMXO = iFirstSave + 2;
  28887. for (var i = 0; i < count; i++) {
  28888. var arg = argsArray[iFirstPIMXO + 4 * i];
  28889. var imageMask = arg.length === 1 && arg[0];
  28890. if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) {
  28891. fnArray[iFirstPIMXO + 4 * i] = OPS.paintSolidColorImageMask;
  28892. continue;
  28893. }
  28894. break;
  28895. }
  28896. return count - i;
  28897. }
  28898. var InitialState = [];
  28899. addState(InitialState, [
  28900. OPS.save,
  28901. OPS.transform,
  28902. OPS.paintInlineImageXObject,
  28903. OPS.restore
  28904. ], function foundInlineImageGroup(context) {
  28905. var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  28906. var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  28907. var MAX_WIDTH = 1000;
  28908. var IMAGE_PADDING = 1;
  28909. var fnArray = context.fnArray, argsArray = context.argsArray;
  28910. var curr = context.iCurr;
  28911. var iFirstSave = curr - 3;
  28912. var iFirstTransform = curr - 2;
  28913. var iFirstPIIXO = curr - 1;
  28914. var i = iFirstSave + 4;
  28915. var ii = fnArray.length;
  28916. while (i + 3 < ii) {
  28917. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintInlineImageXObject || fnArray[i + 3] !== OPS.restore) {
  28918. break;
  28919. }
  28920. i += 4;
  28921. }
  28922. var count = Math.min((i - iFirstSave) / 4, MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  28923. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  28924. return i;
  28925. }
  28926. var maxX = 0;
  28927. var map = [], maxLineHeight = 0;
  28928. var currentX = IMAGE_PADDING, currentY = IMAGE_PADDING;
  28929. var q;
  28930. for (q = 0; q < count; q++) {
  28931. var transform = argsArray[iFirstTransform + (q << 2)];
  28932. var img = argsArray[iFirstPIIXO + (q << 2)][0];
  28933. if (currentX + img.width > MAX_WIDTH) {
  28934. maxX = Math.max(maxX, currentX);
  28935. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  28936. currentX = 0;
  28937. maxLineHeight = 0;
  28938. }
  28939. map.push({
  28940. transform: transform,
  28941. x: currentX,
  28942. y: currentY,
  28943. w: img.width,
  28944. h: img.height
  28945. });
  28946. currentX += img.width + 2 * IMAGE_PADDING;
  28947. maxLineHeight = Math.max(maxLineHeight, img.height);
  28948. }
  28949. var imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  28950. var imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  28951. var imgData = new Uint8Array(imgWidth * imgHeight * 4);
  28952. var imgRowSize = imgWidth << 2;
  28953. for (q = 0; q < count; q++) {
  28954. var data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  28955. var rowSize = map[q].w << 2;
  28956. var dataOffset = 0;
  28957. var offset = map[q].x + map[q].y * imgWidth << 2;
  28958. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  28959. for (var k = 0, kk = map[q].h; k < kk; k++) {
  28960. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  28961. dataOffset += rowSize;
  28962. offset += imgRowSize;
  28963. }
  28964. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  28965. while (offset >= 0) {
  28966. data[offset - 4] = data[offset];
  28967. data[offset - 3] = data[offset + 1];
  28968. data[offset - 2] = data[offset + 2];
  28969. data[offset - 1] = data[offset + 3];
  28970. data[offset + rowSize] = data[offset + rowSize - 4];
  28971. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  28972. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  28973. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  28974. offset -= imgRowSize;
  28975. }
  28976. }
  28977. fnArray.splice(iFirstSave, count * 4, OPS.paintInlineImageXObjectGroup);
  28978. argsArray.splice(iFirstSave, count * 4, [
  28979. {
  28980. width: imgWidth,
  28981. height: imgHeight,
  28982. kind: ImageKind.RGBA_32BPP,
  28983. data: imgData
  28984. },
  28985. map
  28986. ]);
  28987. return iFirstSave + 1;
  28988. });
  28989. addState(InitialState, [
  28990. OPS.save,
  28991. OPS.transform,
  28992. OPS.paintImageMaskXObject,
  28993. OPS.restore
  28994. ], function foundImageMaskGroup(context) {
  28995. var MIN_IMAGES_IN_MASKS_BLOCK = 10;
  28996. var MAX_IMAGES_IN_MASKS_BLOCK = 100;
  28997. var MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  28998. var fnArray = context.fnArray, argsArray = context.argsArray;
  28999. var curr = context.iCurr;
  29000. var iFirstSave = curr - 3;
  29001. var iFirstTransform = curr - 2;
  29002. var iFirstPIMXO = curr - 1;
  29003. var i = iFirstSave + 4;
  29004. var ii = fnArray.length;
  29005. while (i + 3 < ii) {
  29006. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintImageMaskXObject || fnArray[i + 3] !== OPS.restore) {
  29007. break;
  29008. }
  29009. i += 4;
  29010. }
  29011. var count = (i - iFirstSave) / 4;
  29012. count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray);
  29013. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  29014. return i;
  29015. }
  29016. var q;
  29017. var isSameImage = false;
  29018. var iTransform, transformArgs;
  29019. var firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  29020. if (argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0) {
  29021. isSameImage = true;
  29022. var firstTransformArg0 = argsArray[iFirstTransform][0];
  29023. var firstTransformArg3 = argsArray[iFirstTransform][3];
  29024. iTransform = iFirstTransform + 4;
  29025. var iPIMXO = iFirstPIMXO + 4;
  29026. for (q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  29027. transformArgs = argsArray[iTransform];
  29028. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== 0 || transformArgs[2] !== 0 || transformArgs[3] !== firstTransformArg3) {
  29029. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  29030. isSameImage = false;
  29031. } else {
  29032. count = q;
  29033. }
  29034. break;
  29035. }
  29036. }
  29037. }
  29038. if (isSameImage) {
  29039. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  29040. var positions = new Float32Array(count * 2);
  29041. iTransform = iFirstTransform;
  29042. for (q = 0; q < count; q++, iTransform += 4) {
  29043. transformArgs = argsArray[iTransform];
  29044. positions[q << 1] = transformArgs[4];
  29045. positions[(q << 1) + 1] = transformArgs[5];
  29046. }
  29047. fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectRepeat);
  29048. argsArray.splice(iFirstSave, count * 4, [
  29049. firstPIMXOArg0,
  29050. firstTransformArg0,
  29051. firstTransformArg3,
  29052. positions
  29053. ]);
  29054. } else {
  29055. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  29056. var images = [];
  29057. for (q = 0; q < count; q++) {
  29058. transformArgs = argsArray[iFirstTransform + (q << 2)];
  29059. var maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  29060. images.push({
  29061. data: maskParams.data,
  29062. width: maskParams.width,
  29063. height: maskParams.height,
  29064. transform: transformArgs
  29065. });
  29066. }
  29067. fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectGroup);
  29068. argsArray.splice(iFirstSave, count * 4, [images]);
  29069. }
  29070. return iFirstSave + 1;
  29071. });
  29072. addState(InitialState, [
  29073. OPS.save,
  29074. OPS.transform,
  29075. OPS.paintImageXObject,
  29076. OPS.restore
  29077. ], function (context) {
  29078. var MIN_IMAGES_IN_BLOCK = 3;
  29079. var MAX_IMAGES_IN_BLOCK = 1000;
  29080. var fnArray = context.fnArray, argsArray = context.argsArray;
  29081. var curr = context.iCurr;
  29082. var iFirstSave = curr - 3;
  29083. var iFirstTransform = curr - 2;
  29084. var iFirstPIXO = curr - 1;
  29085. var iFirstRestore = curr;
  29086. if (argsArray[iFirstTransform][1] !== 0 || argsArray[iFirstTransform][2] !== 0) {
  29087. return iFirstRestore + 1;
  29088. }
  29089. var firstPIXOArg0 = argsArray[iFirstPIXO][0];
  29090. var firstTransformArg0 = argsArray[iFirstTransform][0];
  29091. var firstTransformArg3 = argsArray[iFirstTransform][3];
  29092. var i = iFirstSave + 4;
  29093. var ii = fnArray.length;
  29094. while (i + 3 < ii) {
  29095. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintImageXObject || fnArray[i + 3] !== OPS.restore) {
  29096. break;
  29097. }
  29098. if (argsArray[i + 1][0] !== firstTransformArg0 || argsArray[i + 1][1] !== 0 || argsArray[i + 1][2] !== 0 || argsArray[i + 1][3] !== firstTransformArg3) {
  29099. break;
  29100. }
  29101. if (argsArray[i + 2][0] !== firstPIXOArg0) {
  29102. break;
  29103. }
  29104. i += 4;
  29105. }
  29106. var count = Math.min((i - iFirstSave) / 4, MAX_IMAGES_IN_BLOCK);
  29107. if (count < MIN_IMAGES_IN_BLOCK) {
  29108. return i;
  29109. }
  29110. var positions = new Float32Array(count * 2);
  29111. var iTransform = iFirstTransform;
  29112. for (var q = 0; q < count; q++, iTransform += 4) {
  29113. var transformArgs = argsArray[iTransform];
  29114. positions[q << 1] = transformArgs[4];
  29115. positions[(q << 1) + 1] = transformArgs[5];
  29116. }
  29117. var args = [
  29118. firstPIXOArg0,
  29119. firstTransformArg0,
  29120. firstTransformArg3,
  29121. positions
  29122. ];
  29123. fnArray.splice(iFirstSave, count * 4, OPS.paintImageXObjectRepeat);
  29124. argsArray.splice(iFirstSave, count * 4, args);
  29125. return iFirstSave + 1;
  29126. });
  29127. addState(InitialState, [
  29128. OPS.beginText,
  29129. OPS.setFont,
  29130. OPS.setTextMatrix,
  29131. OPS.showText,
  29132. OPS.endText
  29133. ], function (context) {
  29134. var MIN_CHARS_IN_BLOCK = 3;
  29135. var MAX_CHARS_IN_BLOCK = 1000;
  29136. var fnArray = context.fnArray, argsArray = context.argsArray;
  29137. var curr = context.iCurr;
  29138. var iFirstBeginText = curr - 4;
  29139. var iFirstSetFont = curr - 3;
  29140. var iFirstSetTextMatrix = curr - 2;
  29141. var iFirstShowText = curr - 1;
  29142. var iFirstEndText = curr;
  29143. var firstSetFontArg0 = argsArray[iFirstSetFont][0];
  29144. var firstSetFontArg1 = argsArray[iFirstSetFont][1];
  29145. var i = iFirstBeginText + 5;
  29146. var ii = fnArray.length;
  29147. while (i + 4 < ii) {
  29148. 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) {
  29149. break;
  29150. }
  29151. if (argsArray[i + 1][0] !== firstSetFontArg0 || argsArray[i + 1][1] !== firstSetFontArg1) {
  29152. break;
  29153. }
  29154. i += 5;
  29155. }
  29156. var count = Math.min((i - iFirstBeginText) / 5, MAX_CHARS_IN_BLOCK);
  29157. if (count < MIN_CHARS_IN_BLOCK) {
  29158. return i;
  29159. }
  29160. var iFirst = iFirstBeginText;
  29161. 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) {
  29162. count++;
  29163. iFirst -= 5;
  29164. }
  29165. var iEndText = iFirst + 4;
  29166. for (var q = 1; q < count; q++) {
  29167. fnArray.splice(iEndText, 3);
  29168. argsArray.splice(iEndText, 3);
  29169. iEndText += 2;
  29170. }
  29171. return iEndText + 1;
  29172. });
  29173. function QueueOptimizer() {
  29174. }
  29175. QueueOptimizer.prototype = {
  29176. optimize: function QueueOptimizer_optimize(queue) {
  29177. var fnArray = queue.fnArray, argsArray = queue.argsArray;
  29178. var context = {
  29179. iCurr: 0,
  29180. fnArray: fnArray,
  29181. argsArray: argsArray
  29182. };
  29183. var state;
  29184. var i = 0, ii = fnArray.length;
  29185. while (i < ii) {
  29186. state = (state || InitialState)[fnArray[i]];
  29187. if (typeof state === 'function') {
  29188. context.iCurr = i;
  29189. i = state(context);
  29190. state = undefined;
  29191. ii = context.fnArray.length;
  29192. } else {
  29193. i++;
  29194. }
  29195. }
  29196. }
  29197. };
  29198. return QueueOptimizer;
  29199. }();
  29200. exports.OperatorList = OperatorList;
  29201. exports.PartialEvaluator = PartialEvaluator;
  29202. /***/ }),
  29203. /* 14 */
  29204. /***/ (function(module, exports, __w_pdfjs_require__) {
  29205. "use strict";
  29206. var sharedUtil = __w_pdfjs_require__(0);
  29207. var coreArithmeticDecoder = __w_pdfjs_require__(9);
  29208. var info = sharedUtil.info;
  29209. var warn = sharedUtil.warn;
  29210. var error = sharedUtil.error;
  29211. var log2 = sharedUtil.log2;
  29212. var readUint16 = sharedUtil.readUint16;
  29213. var readUint32 = sharedUtil.readUint32;
  29214. var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder;
  29215. var JpxImage = function JpxImageClosure() {
  29216. var SubbandsGainLog2 = {
  29217. 'LL': 0,
  29218. 'LH': 1,
  29219. 'HL': 1,
  29220. 'HH': 2
  29221. };
  29222. function JpxImage() {
  29223. this.failOnCorruptedImage = false;
  29224. }
  29225. JpxImage.prototype = {
  29226. parse: function JpxImage_parse(data) {
  29227. var head = readUint16(data, 0);
  29228. if (head === 0xFF4F) {
  29229. this.parseCodestream(data, 0, data.length);
  29230. return;
  29231. }
  29232. var position = 0, length = data.length;
  29233. while (position < length) {
  29234. var headerSize = 8;
  29235. var lbox = readUint32(data, position);
  29236. var tbox = readUint32(data, position + 4);
  29237. position += headerSize;
  29238. if (lbox === 1) {
  29239. lbox = readUint32(data, position) * 4294967296 + readUint32(data, position + 4);
  29240. position += 8;
  29241. headerSize += 8;
  29242. }
  29243. if (lbox === 0) {
  29244. lbox = length - position + headerSize;
  29245. }
  29246. if (lbox < headerSize) {
  29247. error('JPX Error: Invalid box field size');
  29248. }
  29249. var dataLength = lbox - headerSize;
  29250. var jumpDataLength = true;
  29251. switch (tbox) {
  29252. case 0x6A703268:
  29253. jumpDataLength = false;
  29254. break;
  29255. case 0x636F6C72:
  29256. var method = data[position];
  29257. if (method === 1) {
  29258. var colorspace = readUint32(data, position + 3);
  29259. switch (colorspace) {
  29260. case 16:
  29261. case 17:
  29262. case 18:
  29263. break;
  29264. default:
  29265. warn('Unknown colorspace ' + colorspace);
  29266. break;
  29267. }
  29268. } else if (method === 2) {
  29269. info('ICC profile not supported');
  29270. }
  29271. break;
  29272. case 0x6A703263:
  29273. this.parseCodestream(data, position, position + dataLength);
  29274. break;
  29275. case 0x6A502020:
  29276. if (0x0d0a870a !== readUint32(data, position)) {
  29277. warn('Invalid JP2 signature');
  29278. }
  29279. break;
  29280. case 0x6A501A1A:
  29281. case 0x66747970:
  29282. case 0x72726571:
  29283. case 0x72657320:
  29284. case 0x69686472:
  29285. break;
  29286. default:
  29287. var headerType = String.fromCharCode(tbox >> 24 & 0xFF, tbox >> 16 & 0xFF, tbox >> 8 & 0xFF, tbox & 0xFF);
  29288. warn('Unsupported header type ' + tbox + ' (' + headerType + ')');
  29289. break;
  29290. }
  29291. if (jumpDataLength) {
  29292. position += dataLength;
  29293. }
  29294. }
  29295. },
  29296. parseImageProperties: function JpxImage_parseImageProperties(stream) {
  29297. var newByte = stream.getByte();
  29298. while (newByte >= 0) {
  29299. var oldByte = newByte;
  29300. newByte = stream.getByte();
  29301. var code = oldByte << 8 | newByte;
  29302. if (code === 0xFF51) {
  29303. stream.skip(4);
  29304. var Xsiz = stream.getInt32() >>> 0;
  29305. var Ysiz = stream.getInt32() >>> 0;
  29306. var XOsiz = stream.getInt32() >>> 0;
  29307. var YOsiz = stream.getInt32() >>> 0;
  29308. stream.skip(16);
  29309. var Csiz = stream.getUint16();
  29310. this.width = Xsiz - XOsiz;
  29311. this.height = Ysiz - YOsiz;
  29312. this.componentsCount = Csiz;
  29313. this.bitsPerComponent = 8;
  29314. return;
  29315. }
  29316. }
  29317. error('JPX Error: No size marker found in JPX stream');
  29318. },
  29319. parseCodestream: function JpxImage_parseCodestream(data, start, end) {
  29320. var context = {};
  29321. var doNotRecover = false;
  29322. try {
  29323. var position = start;
  29324. while (position + 1 < end) {
  29325. var code = readUint16(data, position);
  29326. position += 2;
  29327. var length = 0, j, sqcd, spqcds, spqcdSize, scalarExpounded, tile;
  29328. switch (code) {
  29329. case 0xFF4F:
  29330. context.mainHeader = true;
  29331. break;
  29332. case 0xFFD9:
  29333. break;
  29334. case 0xFF51:
  29335. length = readUint16(data, position);
  29336. var siz = {};
  29337. siz.Xsiz = readUint32(data, position + 4);
  29338. siz.Ysiz = readUint32(data, position + 8);
  29339. siz.XOsiz = readUint32(data, position + 12);
  29340. siz.YOsiz = readUint32(data, position + 16);
  29341. siz.XTsiz = readUint32(data, position + 20);
  29342. siz.YTsiz = readUint32(data, position + 24);
  29343. siz.XTOsiz = readUint32(data, position + 28);
  29344. siz.YTOsiz = readUint32(data, position + 32);
  29345. var componentsCount = readUint16(data, position + 36);
  29346. siz.Csiz = componentsCount;
  29347. var components = [];
  29348. j = position + 38;
  29349. for (var i = 0; i < componentsCount; i++) {
  29350. var component = {
  29351. precision: (data[j] & 0x7F) + 1,
  29352. isSigned: !!(data[j] & 0x80),
  29353. XRsiz: data[j + 1],
  29354. YRsiz: data[j + 1]
  29355. };
  29356. calculateComponentDimensions(component, siz);
  29357. components.push(component);
  29358. }
  29359. context.SIZ = siz;
  29360. context.components = components;
  29361. calculateTileGrids(context, components);
  29362. context.QCC = [];
  29363. context.COC = [];
  29364. break;
  29365. case 0xFF5C:
  29366. length = readUint16(data, position);
  29367. var qcd = {};
  29368. j = position + 2;
  29369. sqcd = data[j++];
  29370. switch (sqcd & 0x1F) {
  29371. case 0:
  29372. spqcdSize = 8;
  29373. scalarExpounded = true;
  29374. break;
  29375. case 1:
  29376. spqcdSize = 16;
  29377. scalarExpounded = false;
  29378. break;
  29379. case 2:
  29380. spqcdSize = 16;
  29381. scalarExpounded = true;
  29382. break;
  29383. default:
  29384. throw new Error('Invalid SQcd value ' + sqcd);
  29385. }
  29386. qcd.noQuantization = spqcdSize === 8;
  29387. qcd.scalarExpounded = scalarExpounded;
  29388. qcd.guardBits = sqcd >> 5;
  29389. spqcds = [];
  29390. while (j < length + position) {
  29391. var spqcd = {};
  29392. if (spqcdSize === 8) {
  29393. spqcd.epsilon = data[j++] >> 3;
  29394. spqcd.mu = 0;
  29395. } else {
  29396. spqcd.epsilon = data[j] >> 3;
  29397. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  29398. j += 2;
  29399. }
  29400. spqcds.push(spqcd);
  29401. }
  29402. qcd.SPqcds = spqcds;
  29403. if (context.mainHeader) {
  29404. context.QCD = qcd;
  29405. } else {
  29406. context.currentTile.QCD = qcd;
  29407. context.currentTile.QCC = [];
  29408. }
  29409. break;
  29410. case 0xFF5D:
  29411. length = readUint16(data, position);
  29412. var qcc = {};
  29413. j = position + 2;
  29414. var cqcc;
  29415. if (context.SIZ.Csiz < 257) {
  29416. cqcc = data[j++];
  29417. } else {
  29418. cqcc = readUint16(data, j);
  29419. j += 2;
  29420. }
  29421. sqcd = data[j++];
  29422. switch (sqcd & 0x1F) {
  29423. case 0:
  29424. spqcdSize = 8;
  29425. scalarExpounded = true;
  29426. break;
  29427. case 1:
  29428. spqcdSize = 16;
  29429. scalarExpounded = false;
  29430. break;
  29431. case 2:
  29432. spqcdSize = 16;
  29433. scalarExpounded = true;
  29434. break;
  29435. default:
  29436. throw new Error('Invalid SQcd value ' + sqcd);
  29437. }
  29438. qcc.noQuantization = spqcdSize === 8;
  29439. qcc.scalarExpounded = scalarExpounded;
  29440. qcc.guardBits = sqcd >> 5;
  29441. spqcds = [];
  29442. while (j < length + position) {
  29443. spqcd = {};
  29444. if (spqcdSize === 8) {
  29445. spqcd.epsilon = data[j++] >> 3;
  29446. spqcd.mu = 0;
  29447. } else {
  29448. spqcd.epsilon = data[j] >> 3;
  29449. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  29450. j += 2;
  29451. }
  29452. spqcds.push(spqcd);
  29453. }
  29454. qcc.SPqcds = spqcds;
  29455. if (context.mainHeader) {
  29456. context.QCC[cqcc] = qcc;
  29457. } else {
  29458. context.currentTile.QCC[cqcc] = qcc;
  29459. }
  29460. break;
  29461. case 0xFF52:
  29462. length = readUint16(data, position);
  29463. var cod = {};
  29464. j = position + 2;
  29465. var scod = data[j++];
  29466. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  29467. cod.sopMarkerUsed = !!(scod & 2);
  29468. cod.ephMarkerUsed = !!(scod & 4);
  29469. cod.progressionOrder = data[j++];
  29470. cod.layersCount = readUint16(data, j);
  29471. j += 2;
  29472. cod.multipleComponentTransform = data[j++];
  29473. cod.decompositionLevelsCount = data[j++];
  29474. cod.xcb = (data[j++] & 0xF) + 2;
  29475. cod.ycb = (data[j++] & 0xF) + 2;
  29476. var blockStyle = data[j++];
  29477. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  29478. cod.resetContextProbabilities = !!(blockStyle & 2);
  29479. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  29480. cod.verticalyStripe = !!(blockStyle & 8);
  29481. cod.predictableTermination = !!(blockStyle & 16);
  29482. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  29483. cod.reversibleTransformation = data[j++];
  29484. if (cod.entropyCoderWithCustomPrecincts) {
  29485. var precinctsSizes = [];
  29486. while (j < length + position) {
  29487. var precinctsSize = data[j++];
  29488. precinctsSizes.push({
  29489. PPx: precinctsSize & 0xF,
  29490. PPy: precinctsSize >> 4
  29491. });
  29492. }
  29493. cod.precinctsSizes = precinctsSizes;
  29494. }
  29495. var unsupported = [];
  29496. if (cod.selectiveArithmeticCodingBypass) {
  29497. unsupported.push('selectiveArithmeticCodingBypass');
  29498. }
  29499. if (cod.resetContextProbabilities) {
  29500. unsupported.push('resetContextProbabilities');
  29501. }
  29502. if (cod.terminationOnEachCodingPass) {
  29503. unsupported.push('terminationOnEachCodingPass');
  29504. }
  29505. if (cod.verticalyStripe) {
  29506. unsupported.push('verticalyStripe');
  29507. }
  29508. if (cod.predictableTermination) {
  29509. unsupported.push('predictableTermination');
  29510. }
  29511. if (unsupported.length > 0) {
  29512. doNotRecover = true;
  29513. throw new Error('Unsupported COD options (' + unsupported.join(', ') + ')');
  29514. }
  29515. if (context.mainHeader) {
  29516. context.COD = cod;
  29517. } else {
  29518. context.currentTile.COD = cod;
  29519. context.currentTile.COC = [];
  29520. }
  29521. break;
  29522. case 0xFF90:
  29523. length = readUint16(data, position);
  29524. tile = {};
  29525. tile.index = readUint16(data, position + 2);
  29526. tile.length = readUint32(data, position + 4);
  29527. tile.dataEnd = tile.length + position - 2;
  29528. tile.partIndex = data[position + 8];
  29529. tile.partsCount = data[position + 9];
  29530. context.mainHeader = false;
  29531. if (tile.partIndex === 0) {
  29532. tile.COD = context.COD;
  29533. tile.COC = context.COC.slice(0);
  29534. tile.QCD = context.QCD;
  29535. tile.QCC = context.QCC.slice(0);
  29536. }
  29537. context.currentTile = tile;
  29538. break;
  29539. case 0xFF93:
  29540. tile = context.currentTile;
  29541. if (tile.partIndex === 0) {
  29542. initializeTile(context, tile.index);
  29543. buildPackets(context);
  29544. }
  29545. length = tile.dataEnd - position;
  29546. parseTilePackets(context, data, position, length);
  29547. break;
  29548. case 0xFF55:
  29549. case 0xFF57:
  29550. case 0xFF58:
  29551. case 0xFF64:
  29552. length = readUint16(data, position);
  29553. break;
  29554. case 0xFF53:
  29555. throw new Error('Codestream code 0xFF53 (COC) is ' + 'not implemented');
  29556. default:
  29557. throw new Error('Unknown codestream code: ' + code.toString(16));
  29558. }
  29559. position += length;
  29560. }
  29561. } catch (e) {
  29562. if (doNotRecover || this.failOnCorruptedImage) {
  29563. error('JPX Error: ' + e.message);
  29564. } else {
  29565. warn('JPX: Trying to recover from: ' + e.message);
  29566. }
  29567. }
  29568. this.tiles = transformComponents(context);
  29569. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  29570. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  29571. this.componentsCount = context.SIZ.Csiz;
  29572. }
  29573. };
  29574. function calculateComponentDimensions(component, siz) {
  29575. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  29576. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  29577. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  29578. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  29579. component.width = component.x1 - component.x0;
  29580. component.height = component.y1 - component.y0;
  29581. }
  29582. function calculateTileGrids(context, components) {
  29583. var siz = context.SIZ;
  29584. var tile, tiles = [];
  29585. var numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  29586. var numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  29587. for (var q = 0; q < numYtiles; q++) {
  29588. for (var p = 0; p < numXtiles; p++) {
  29589. tile = {};
  29590. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  29591. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  29592. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  29593. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  29594. tile.width = tile.tx1 - tile.tx0;
  29595. tile.height = tile.ty1 - tile.ty0;
  29596. tile.components = [];
  29597. tiles.push(tile);
  29598. }
  29599. }
  29600. context.tiles = tiles;
  29601. var componentsCount = siz.Csiz;
  29602. for (var i = 0, ii = componentsCount; i < ii; i++) {
  29603. var component = components[i];
  29604. for (var j = 0, jj = tiles.length; j < jj; j++) {
  29605. var tileComponent = {};
  29606. tile = tiles[j];
  29607. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  29608. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  29609. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  29610. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  29611. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  29612. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  29613. tile.components[i] = tileComponent;
  29614. }
  29615. }
  29616. }
  29617. function getBlocksDimensions(context, component, r) {
  29618. var codOrCoc = component.codingStyleParameters;
  29619. var result = {};
  29620. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  29621. result.PPx = 15;
  29622. result.PPy = 15;
  29623. } else {
  29624. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  29625. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  29626. }
  29627. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  29628. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  29629. return result;
  29630. }
  29631. function buildPrecincts(context, resolution, dimensions) {
  29632. var precinctWidth = 1 << dimensions.PPx;
  29633. var precinctHeight = 1 << dimensions.PPy;
  29634. var isZeroRes = resolution.resLevel === 0;
  29635. var precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  29636. var precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  29637. var numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  29638. var numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  29639. var numprecincts = numprecinctswide * numprecinctshigh;
  29640. resolution.precinctParameters = {
  29641. precinctWidth: precinctWidth,
  29642. precinctHeight: precinctHeight,
  29643. numprecinctswide: numprecinctswide,
  29644. numprecinctshigh: numprecinctshigh,
  29645. numprecincts: numprecincts,
  29646. precinctWidthInSubband: precinctWidthInSubband,
  29647. precinctHeightInSubband: precinctHeightInSubband
  29648. };
  29649. }
  29650. function buildCodeblocks(context, subband, dimensions) {
  29651. var xcb_ = dimensions.xcb_;
  29652. var ycb_ = dimensions.ycb_;
  29653. var codeblockWidth = 1 << xcb_;
  29654. var codeblockHeight = 1 << ycb_;
  29655. var cbx0 = subband.tbx0 >> xcb_;
  29656. var cby0 = subband.tby0 >> ycb_;
  29657. var cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  29658. var cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  29659. var precinctParameters = subband.resolution.precinctParameters;
  29660. var codeblocks = [];
  29661. var precincts = [];
  29662. var i, j, codeblock, precinctNumber;
  29663. for (j = cby0; j < cby1; j++) {
  29664. for (i = cbx0; i < cbx1; i++) {
  29665. codeblock = {
  29666. cbx: i,
  29667. cby: j,
  29668. tbx0: codeblockWidth * i,
  29669. tby0: codeblockHeight * j,
  29670. tbx1: codeblockWidth * (i + 1),
  29671. tby1: codeblockHeight * (j + 1)
  29672. };
  29673. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  29674. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  29675. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  29676. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  29677. var pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  29678. var pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  29679. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  29680. codeblock.precinctNumber = precinctNumber;
  29681. codeblock.subbandType = subband.type;
  29682. codeblock.Lblock = 3;
  29683. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  29684. continue;
  29685. }
  29686. codeblocks.push(codeblock);
  29687. var precinct = precincts[precinctNumber];
  29688. if (precinct !== undefined) {
  29689. if (i < precinct.cbxMin) {
  29690. precinct.cbxMin = i;
  29691. } else if (i > precinct.cbxMax) {
  29692. precinct.cbxMax = i;
  29693. }
  29694. if (j < precinct.cbyMin) {
  29695. precinct.cbxMin = j;
  29696. } else if (j > precinct.cbyMax) {
  29697. precinct.cbyMax = j;
  29698. }
  29699. } else {
  29700. precincts[precinctNumber] = precinct = {
  29701. cbxMin: i,
  29702. cbyMin: j,
  29703. cbxMax: i,
  29704. cbyMax: j
  29705. };
  29706. }
  29707. codeblock.precinct = precinct;
  29708. }
  29709. }
  29710. subband.codeblockParameters = {
  29711. codeblockWidth: xcb_,
  29712. codeblockHeight: ycb_,
  29713. numcodeblockwide: cbx1 - cbx0 + 1,
  29714. numcodeblockhigh: cby1 - cby0 + 1
  29715. };
  29716. subband.codeblocks = codeblocks;
  29717. subband.precincts = precincts;
  29718. }
  29719. function createPacket(resolution, precinctNumber, layerNumber) {
  29720. var precinctCodeblocks = [];
  29721. var subbands = resolution.subbands;
  29722. for (var i = 0, ii = subbands.length; i < ii; i++) {
  29723. var subband = subbands[i];
  29724. var codeblocks = subband.codeblocks;
  29725. for (var j = 0, jj = codeblocks.length; j < jj; j++) {
  29726. var codeblock = codeblocks[j];
  29727. if (codeblock.precinctNumber !== precinctNumber) {
  29728. continue;
  29729. }
  29730. precinctCodeblocks.push(codeblock);
  29731. }
  29732. }
  29733. return {
  29734. layerNumber: layerNumber,
  29735. codeblocks: precinctCodeblocks
  29736. };
  29737. }
  29738. function LayerResolutionComponentPositionIterator(context) {
  29739. var siz = context.SIZ;
  29740. var tileIndex = context.currentTile.index;
  29741. var tile = context.tiles[tileIndex];
  29742. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29743. var componentsCount = siz.Csiz;
  29744. var maxDecompositionLevelsCount = 0;
  29745. for (var q = 0; q < componentsCount; q++) {
  29746. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  29747. }
  29748. var l = 0, r = 0, i = 0, k = 0;
  29749. this.nextPacket = function JpxImage_nextPacket() {
  29750. for (; l < layersCount; l++) {
  29751. for (; r <= maxDecompositionLevelsCount; r++) {
  29752. for (; i < componentsCount; i++) {
  29753. var component = tile.components[i];
  29754. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  29755. continue;
  29756. }
  29757. var resolution = component.resolutions[r];
  29758. var numprecincts = resolution.precinctParameters.numprecincts;
  29759. for (; k < numprecincts;) {
  29760. var packet = createPacket(resolution, k, l);
  29761. k++;
  29762. return packet;
  29763. }
  29764. k = 0;
  29765. }
  29766. i = 0;
  29767. }
  29768. r = 0;
  29769. }
  29770. error('JPX Error: Out of packets');
  29771. };
  29772. }
  29773. function ResolutionLayerComponentPositionIterator(context) {
  29774. var siz = context.SIZ;
  29775. var tileIndex = context.currentTile.index;
  29776. var tile = context.tiles[tileIndex];
  29777. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29778. var componentsCount = siz.Csiz;
  29779. var maxDecompositionLevelsCount = 0;
  29780. for (var q = 0; q < componentsCount; q++) {
  29781. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  29782. }
  29783. var r = 0, l = 0, i = 0, k = 0;
  29784. this.nextPacket = function JpxImage_nextPacket() {
  29785. for (; r <= maxDecompositionLevelsCount; r++) {
  29786. for (; l < layersCount; l++) {
  29787. for (; i < componentsCount; i++) {
  29788. var component = tile.components[i];
  29789. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  29790. continue;
  29791. }
  29792. var resolution = component.resolutions[r];
  29793. var numprecincts = resolution.precinctParameters.numprecincts;
  29794. for (; k < numprecincts;) {
  29795. var packet = createPacket(resolution, k, l);
  29796. k++;
  29797. return packet;
  29798. }
  29799. k = 0;
  29800. }
  29801. i = 0;
  29802. }
  29803. l = 0;
  29804. }
  29805. error('JPX Error: Out of packets');
  29806. };
  29807. }
  29808. function ResolutionPositionComponentLayerIterator(context) {
  29809. var siz = context.SIZ;
  29810. var tileIndex = context.currentTile.index;
  29811. var tile = context.tiles[tileIndex];
  29812. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29813. var componentsCount = siz.Csiz;
  29814. var l, r, c, p;
  29815. var maxDecompositionLevelsCount = 0;
  29816. for (c = 0; c < componentsCount; c++) {
  29817. var component = tile.components[c];
  29818. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  29819. }
  29820. var maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  29821. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  29822. var maxNumPrecincts = 0;
  29823. for (c = 0; c < componentsCount; ++c) {
  29824. var resolutions = tile.components[c].resolutions;
  29825. if (r < resolutions.length) {
  29826. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  29827. }
  29828. }
  29829. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  29830. }
  29831. l = 0;
  29832. r = 0;
  29833. c = 0;
  29834. p = 0;
  29835. this.nextPacket = function JpxImage_nextPacket() {
  29836. for (; r <= maxDecompositionLevelsCount; r++) {
  29837. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  29838. for (; c < componentsCount; c++) {
  29839. var component = tile.components[c];
  29840. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  29841. continue;
  29842. }
  29843. var resolution = component.resolutions[r];
  29844. var numprecincts = resolution.precinctParameters.numprecincts;
  29845. if (p >= numprecincts) {
  29846. continue;
  29847. }
  29848. for (; l < layersCount;) {
  29849. var packet = createPacket(resolution, p, l);
  29850. l++;
  29851. return packet;
  29852. }
  29853. l = 0;
  29854. }
  29855. c = 0;
  29856. }
  29857. p = 0;
  29858. }
  29859. error('JPX Error: Out of packets');
  29860. };
  29861. }
  29862. function PositionComponentResolutionLayerIterator(context) {
  29863. var siz = context.SIZ;
  29864. var tileIndex = context.currentTile.index;
  29865. var tile = context.tiles[tileIndex];
  29866. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29867. var componentsCount = siz.Csiz;
  29868. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  29869. var precinctsIterationSizes = precinctsSizes;
  29870. var l = 0, r = 0, c = 0, px = 0, py = 0;
  29871. this.nextPacket = function JpxImage_nextPacket() {
  29872. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  29873. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  29874. for (; c < componentsCount; c++) {
  29875. var component = tile.components[c];
  29876. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29877. for (; r <= decompositionLevelsCount; r++) {
  29878. var resolution = component.resolutions[r];
  29879. var sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  29880. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  29881. if (k === null) {
  29882. continue;
  29883. }
  29884. for (; l < layersCount;) {
  29885. var packet = createPacket(resolution, k, l);
  29886. l++;
  29887. return packet;
  29888. }
  29889. l = 0;
  29890. }
  29891. r = 0;
  29892. }
  29893. c = 0;
  29894. }
  29895. px = 0;
  29896. }
  29897. error('JPX Error: Out of packets');
  29898. };
  29899. }
  29900. function ComponentPositionResolutionLayerIterator(context) {
  29901. var siz = context.SIZ;
  29902. var tileIndex = context.currentTile.index;
  29903. var tile = context.tiles[tileIndex];
  29904. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29905. var componentsCount = siz.Csiz;
  29906. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  29907. var l = 0, r = 0, c = 0, px = 0, py = 0;
  29908. this.nextPacket = function JpxImage_nextPacket() {
  29909. for (; c < componentsCount; ++c) {
  29910. var component = tile.components[c];
  29911. var precinctsIterationSizes = precinctsSizes.components[c];
  29912. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29913. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  29914. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  29915. for (; r <= decompositionLevelsCount; r++) {
  29916. var resolution = component.resolutions[r];
  29917. var sizeInImageScale = precinctsIterationSizes.resolutions[r];
  29918. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  29919. if (k === null) {
  29920. continue;
  29921. }
  29922. for (; l < layersCount;) {
  29923. var packet = createPacket(resolution, k, l);
  29924. l++;
  29925. return packet;
  29926. }
  29927. l = 0;
  29928. }
  29929. r = 0;
  29930. }
  29931. px = 0;
  29932. }
  29933. py = 0;
  29934. }
  29935. error('JPX Error: Out of packets');
  29936. };
  29937. }
  29938. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  29939. var posX = pxIndex * precinctIterationSizes.minWidth;
  29940. var posY = pyIndex * precinctIterationSizes.minHeight;
  29941. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  29942. return null;
  29943. }
  29944. var startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  29945. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  29946. }
  29947. function getPrecinctSizesInImageScale(tile) {
  29948. var componentsCount = tile.components.length;
  29949. var minWidth = Number.MAX_VALUE;
  29950. var minHeight = Number.MAX_VALUE;
  29951. var maxNumWide = 0;
  29952. var maxNumHigh = 0;
  29953. var sizePerComponent = new Array(componentsCount);
  29954. for (var c = 0; c < componentsCount; c++) {
  29955. var component = tile.components[c];
  29956. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29957. var sizePerResolution = new Array(decompositionLevelsCount + 1);
  29958. var minWidthCurrentComponent = Number.MAX_VALUE;
  29959. var minHeightCurrentComponent = Number.MAX_VALUE;
  29960. var maxNumWideCurrentComponent = 0;
  29961. var maxNumHighCurrentComponent = 0;
  29962. var scale = 1;
  29963. for (var r = decompositionLevelsCount; r >= 0; --r) {
  29964. var resolution = component.resolutions[r];
  29965. var widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  29966. var heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  29967. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  29968. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  29969. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  29970. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  29971. sizePerResolution[r] = {
  29972. width: widthCurrentResolution,
  29973. height: heightCurrentResolution
  29974. };
  29975. scale <<= 1;
  29976. }
  29977. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  29978. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  29979. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  29980. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  29981. sizePerComponent[c] = {
  29982. resolutions: sizePerResolution,
  29983. minWidth: minWidthCurrentComponent,
  29984. minHeight: minHeightCurrentComponent,
  29985. maxNumWide: maxNumWideCurrentComponent,
  29986. maxNumHigh: maxNumHighCurrentComponent
  29987. };
  29988. }
  29989. return {
  29990. components: sizePerComponent,
  29991. minWidth: minWidth,
  29992. minHeight: minHeight,
  29993. maxNumWide: maxNumWide,
  29994. maxNumHigh: maxNumHigh
  29995. };
  29996. }
  29997. function buildPackets(context) {
  29998. var siz = context.SIZ;
  29999. var tileIndex = context.currentTile.index;
  30000. var tile = context.tiles[tileIndex];
  30001. var componentsCount = siz.Csiz;
  30002. for (var c = 0; c < componentsCount; c++) {
  30003. var component = tile.components[c];
  30004. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  30005. var resolutions = [];
  30006. var subbands = [];
  30007. for (var r = 0; r <= decompositionLevelsCount; r++) {
  30008. var blocksDimensions = getBlocksDimensions(context, component, r);
  30009. var resolution = {};
  30010. var scale = 1 << decompositionLevelsCount - r;
  30011. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  30012. resolution.try0 = Math.ceil(component.tcy0 / scale);
  30013. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  30014. resolution.try1 = Math.ceil(component.tcy1 / scale);
  30015. resolution.resLevel = r;
  30016. buildPrecincts(context, resolution, blocksDimensions);
  30017. resolutions.push(resolution);
  30018. var subband;
  30019. if (r === 0) {
  30020. subband = {};
  30021. subband.type = 'LL';
  30022. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  30023. subband.tby0 = Math.ceil(component.tcy0 / scale);
  30024. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  30025. subband.tby1 = Math.ceil(component.tcy1 / scale);
  30026. subband.resolution = resolution;
  30027. buildCodeblocks(context, subband, blocksDimensions);
  30028. subbands.push(subband);
  30029. resolution.subbands = [subband];
  30030. } else {
  30031. var bscale = 1 << decompositionLevelsCount - r + 1;
  30032. var resolutionSubbands = [];
  30033. subband = {};
  30034. subband.type = 'HL';
  30035. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  30036. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  30037. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  30038. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  30039. subband.resolution = resolution;
  30040. buildCodeblocks(context, subband, blocksDimensions);
  30041. subbands.push(subband);
  30042. resolutionSubbands.push(subband);
  30043. subband = {};
  30044. subband.type = 'LH';
  30045. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  30046. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  30047. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  30048. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  30049. subband.resolution = resolution;
  30050. buildCodeblocks(context, subband, blocksDimensions);
  30051. subbands.push(subband);
  30052. resolutionSubbands.push(subband);
  30053. subband = {};
  30054. subband.type = 'HH';
  30055. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  30056. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  30057. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  30058. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  30059. subband.resolution = resolution;
  30060. buildCodeblocks(context, subband, blocksDimensions);
  30061. subbands.push(subband);
  30062. resolutionSubbands.push(subband);
  30063. resolution.subbands = resolutionSubbands;
  30064. }
  30065. }
  30066. component.resolutions = resolutions;
  30067. component.subbands = subbands;
  30068. }
  30069. var progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  30070. switch (progressionOrder) {
  30071. case 0:
  30072. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  30073. break;
  30074. case 1:
  30075. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  30076. break;
  30077. case 2:
  30078. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  30079. break;
  30080. case 3:
  30081. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  30082. break;
  30083. case 4:
  30084. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  30085. break;
  30086. default:
  30087. error('JPX Error: Unsupported progression order ' + progressionOrder);
  30088. }
  30089. }
  30090. function parseTilePackets(context, data, offset, dataLength) {
  30091. var position = 0;
  30092. var buffer, bufferSize = 0, skipNextBit = false;
  30093. function readBits(count) {
  30094. while (bufferSize < count) {
  30095. var b = data[offset + position];
  30096. position++;
  30097. if (skipNextBit) {
  30098. buffer = buffer << 7 | b;
  30099. bufferSize += 7;
  30100. skipNextBit = false;
  30101. } else {
  30102. buffer = buffer << 8 | b;
  30103. bufferSize += 8;
  30104. }
  30105. if (b === 0xFF) {
  30106. skipNextBit = true;
  30107. }
  30108. }
  30109. bufferSize -= count;
  30110. return buffer >>> bufferSize & (1 << count) - 1;
  30111. }
  30112. function skipMarkerIfEqual(value) {
  30113. if (data[offset + position - 1] === 0xFF && data[offset + position] === value) {
  30114. skipBytes(1);
  30115. return true;
  30116. } else if (data[offset + position] === 0xFF && data[offset + position + 1] === value) {
  30117. skipBytes(2);
  30118. return true;
  30119. }
  30120. return false;
  30121. }
  30122. function skipBytes(count) {
  30123. position += count;
  30124. }
  30125. function alignToByte() {
  30126. bufferSize = 0;
  30127. if (skipNextBit) {
  30128. position++;
  30129. skipNextBit = false;
  30130. }
  30131. }
  30132. function readCodingpasses() {
  30133. if (readBits(1) === 0) {
  30134. return 1;
  30135. }
  30136. if (readBits(1) === 0) {
  30137. return 2;
  30138. }
  30139. var value = readBits(2);
  30140. if (value < 3) {
  30141. return value + 3;
  30142. }
  30143. value = readBits(5);
  30144. if (value < 31) {
  30145. return value + 6;
  30146. }
  30147. value = readBits(7);
  30148. return value + 37;
  30149. }
  30150. var tileIndex = context.currentTile.index;
  30151. var tile = context.tiles[tileIndex];
  30152. var sopMarkerUsed = context.COD.sopMarkerUsed;
  30153. var ephMarkerUsed = context.COD.ephMarkerUsed;
  30154. var packetsIterator = tile.packetsIterator;
  30155. while (position < dataLength) {
  30156. alignToByte();
  30157. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  30158. skipBytes(4);
  30159. }
  30160. var packet = packetsIterator.nextPacket();
  30161. if (!readBits(1)) {
  30162. continue;
  30163. }
  30164. var layerNumber = packet.layerNumber;
  30165. var queue = [], codeblock;
  30166. for (var i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  30167. codeblock = packet.codeblocks[i];
  30168. var precinct = codeblock.precinct;
  30169. var codeblockColumn = codeblock.cbx - precinct.cbxMin;
  30170. var codeblockRow = codeblock.cby - precinct.cbyMin;
  30171. var codeblockIncluded = false;
  30172. var firstTimeInclusion = false;
  30173. var valueReady;
  30174. if (codeblock['included'] !== undefined) {
  30175. codeblockIncluded = !!readBits(1);
  30176. } else {
  30177. precinct = codeblock.precinct;
  30178. var inclusionTree, zeroBitPlanesTree;
  30179. if (precinct['inclusionTree'] !== undefined) {
  30180. inclusionTree = precinct.inclusionTree;
  30181. } else {
  30182. var width = precinct.cbxMax - precinct.cbxMin + 1;
  30183. var height = precinct.cbyMax - precinct.cbyMin + 1;
  30184. inclusionTree = new InclusionTree(width, height, layerNumber);
  30185. zeroBitPlanesTree = new TagTree(width, height);
  30186. precinct.inclusionTree = inclusionTree;
  30187. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  30188. }
  30189. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  30190. while (true) {
  30191. if (readBits(1)) {
  30192. valueReady = !inclusionTree.nextLevel();
  30193. if (valueReady) {
  30194. codeblock.included = true;
  30195. codeblockIncluded = firstTimeInclusion = true;
  30196. break;
  30197. }
  30198. } else {
  30199. inclusionTree.incrementValue(layerNumber);
  30200. break;
  30201. }
  30202. }
  30203. }
  30204. }
  30205. if (!codeblockIncluded) {
  30206. continue;
  30207. }
  30208. if (firstTimeInclusion) {
  30209. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  30210. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  30211. while (true) {
  30212. if (readBits(1)) {
  30213. valueReady = !zeroBitPlanesTree.nextLevel();
  30214. if (valueReady) {
  30215. break;
  30216. }
  30217. } else {
  30218. zeroBitPlanesTree.incrementValue();
  30219. }
  30220. }
  30221. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  30222. }
  30223. var codingpasses = readCodingpasses();
  30224. while (readBits(1)) {
  30225. codeblock.Lblock++;
  30226. }
  30227. var codingpassesLog2 = log2(codingpasses);
  30228. var bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  30229. var codedDataLength = readBits(bits);
  30230. queue.push({
  30231. codeblock: codeblock,
  30232. codingpasses: codingpasses,
  30233. dataLength: codedDataLength
  30234. });
  30235. }
  30236. alignToByte();
  30237. if (ephMarkerUsed) {
  30238. skipMarkerIfEqual(0x92);
  30239. }
  30240. while (queue.length > 0) {
  30241. var packetItem = queue.shift();
  30242. codeblock = packetItem.codeblock;
  30243. if (codeblock['data'] === undefined) {
  30244. codeblock.data = [];
  30245. }
  30246. codeblock.data.push({
  30247. data: data,
  30248. start: offset + position,
  30249. end: offset + position + packetItem.dataLength,
  30250. codingpasses: packetItem.codingpasses
  30251. });
  30252. position += packetItem.dataLength;
  30253. }
  30254. }
  30255. return position;
  30256. }
  30257. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) {
  30258. var x0 = subband.tbx0;
  30259. var y0 = subband.tby0;
  30260. var width = subband.tbx1 - subband.tbx0;
  30261. var codeblocks = subband.codeblocks;
  30262. var right = subband.type.charAt(0) === 'H' ? 1 : 0;
  30263. var bottom = subband.type.charAt(1) === 'H' ? levelWidth : 0;
  30264. for (var i = 0, ii = codeblocks.length; i < ii; ++i) {
  30265. var codeblock = codeblocks[i];
  30266. var blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  30267. var blockHeight = codeblock.tby1_ - codeblock.tby0_;
  30268. if (blockWidth === 0 || blockHeight === 0) {
  30269. continue;
  30270. }
  30271. if (codeblock['data'] === undefined) {
  30272. continue;
  30273. }
  30274. var bitModel, currentCodingpassType;
  30275. bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  30276. currentCodingpassType = 2;
  30277. var data = codeblock.data, totalLength = 0, codingpasses = 0;
  30278. var j, jj, dataItem;
  30279. for (j = 0, jj = data.length; j < jj; j++) {
  30280. dataItem = data[j];
  30281. totalLength += dataItem.end - dataItem.start;
  30282. codingpasses += dataItem.codingpasses;
  30283. }
  30284. var encodedData = new Uint8Array(totalLength);
  30285. var position = 0;
  30286. for (j = 0, jj = data.length; j < jj; j++) {
  30287. dataItem = data[j];
  30288. var chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  30289. encodedData.set(chunk, position);
  30290. position += chunk.length;
  30291. }
  30292. var decoder = new ArithmeticDecoder(encodedData, 0, totalLength);
  30293. bitModel.setDecoder(decoder);
  30294. for (j = 0; j < codingpasses; j++) {
  30295. switch (currentCodingpassType) {
  30296. case 0:
  30297. bitModel.runSignificancePropagationPass();
  30298. break;
  30299. case 1:
  30300. bitModel.runMagnitudeRefinementPass();
  30301. break;
  30302. case 2:
  30303. bitModel.runCleanupPass();
  30304. if (segmentationSymbolUsed) {
  30305. bitModel.checkSegmentationSymbol();
  30306. }
  30307. break;
  30308. }
  30309. currentCodingpassType = (currentCodingpassType + 1) % 3;
  30310. }
  30311. var offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  30312. var sign = bitModel.coefficentsSign;
  30313. var magnitude = bitModel.coefficentsMagnitude;
  30314. var bitsDecoded = bitModel.bitsDecoded;
  30315. var magnitudeCorrection = reversible ? 0 : 0.5;
  30316. var k, n, nb;
  30317. position = 0;
  30318. var interleave = subband.type !== 'LL';
  30319. for (j = 0; j < blockHeight; j++) {
  30320. var row = offset / width | 0;
  30321. var levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  30322. for (k = 0; k < blockWidth; k++) {
  30323. n = magnitude[position];
  30324. if (n !== 0) {
  30325. n = (n + magnitudeCorrection) * delta;
  30326. if (sign[position] !== 0) {
  30327. n = -n;
  30328. }
  30329. nb = bitsDecoded[position];
  30330. var pos = interleave ? levelOffset + (offset << 1) : offset;
  30331. if (reversible && nb >= mb) {
  30332. coefficients[pos] = n;
  30333. } else {
  30334. coefficients[pos] = n * (1 << mb - nb);
  30335. }
  30336. }
  30337. offset++;
  30338. position++;
  30339. }
  30340. offset += width - blockWidth;
  30341. }
  30342. }
  30343. }
  30344. function transformTile(context, tile, c) {
  30345. var component = tile.components[c];
  30346. var codingStyleParameters = component.codingStyleParameters;
  30347. var quantizationParameters = component.quantizationParameters;
  30348. var decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  30349. var spqcds = quantizationParameters.SPqcds;
  30350. var scalarExpounded = quantizationParameters.scalarExpounded;
  30351. var guardBits = quantizationParameters.guardBits;
  30352. var segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  30353. var precision = context.components[c].precision;
  30354. var reversible = codingStyleParameters.reversibleTransformation;
  30355. var transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  30356. var subbandCoefficients = [];
  30357. var b = 0;
  30358. for (var i = 0; i <= decompositionLevelsCount; i++) {
  30359. var resolution = component.resolutions[i];
  30360. var width = resolution.trx1 - resolution.trx0;
  30361. var height = resolution.try1 - resolution.try0;
  30362. var coefficients = new Float32Array(width * height);
  30363. for (var j = 0, jj = resolution.subbands.length; j < jj; j++) {
  30364. var mu, epsilon;
  30365. if (!scalarExpounded) {
  30366. mu = spqcds[0].mu;
  30367. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  30368. } else {
  30369. mu = spqcds[b].mu;
  30370. epsilon = spqcds[b].epsilon;
  30371. b++;
  30372. }
  30373. var subband = resolution.subbands[j];
  30374. var gainLog2 = SubbandsGainLog2[subband.type];
  30375. var delta = reversible ? 1 : Math.pow(2, precision + gainLog2 - epsilon) * (1 + mu / 2048);
  30376. var mb = guardBits + epsilon - 1;
  30377. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed);
  30378. }
  30379. subbandCoefficients.push({
  30380. width: width,
  30381. height: height,
  30382. items: coefficients
  30383. });
  30384. }
  30385. var result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  30386. return {
  30387. left: component.tcx0,
  30388. top: component.tcy0,
  30389. width: result.width,
  30390. height: result.height,
  30391. items: result.items
  30392. };
  30393. }
  30394. function transformComponents(context) {
  30395. var siz = context.SIZ;
  30396. var components = context.components;
  30397. var componentsCount = siz.Csiz;
  30398. var resultImages = [];
  30399. for (var i = 0, ii = context.tiles.length; i < ii; i++) {
  30400. var tile = context.tiles[i];
  30401. var transformedTiles = [];
  30402. var c;
  30403. for (c = 0; c < componentsCount; c++) {
  30404. transformedTiles[c] = transformTile(context, tile, c);
  30405. }
  30406. var tile0 = transformedTiles[0];
  30407. var out = new Uint8Array(tile0.items.length * componentsCount);
  30408. var result = {
  30409. left: tile0.left,
  30410. top: tile0.top,
  30411. width: tile0.width,
  30412. height: tile0.height,
  30413. items: out
  30414. };
  30415. var shift, offset, max, min, maxK;
  30416. var pos = 0, j, jj, y0, y1, y2, r, g, b, k, val;
  30417. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  30418. var fourComponents = componentsCount === 4;
  30419. var y0items = transformedTiles[0].items;
  30420. var y1items = transformedTiles[1].items;
  30421. var y2items = transformedTiles[2].items;
  30422. var y3items = fourComponents ? transformedTiles[3].items : null;
  30423. shift = components[0].precision - 8;
  30424. offset = (128 << shift) + 0.5;
  30425. max = 255 * (1 << shift);
  30426. maxK = max * 0.5;
  30427. min = -maxK;
  30428. var component0 = tile.components[0];
  30429. var alpha01 = componentsCount - 3;
  30430. jj = y0items.length;
  30431. if (!component0.codingStyleParameters.reversibleTransformation) {
  30432. for (j = 0; j < jj; j++, pos += alpha01) {
  30433. y0 = y0items[j] + offset;
  30434. y1 = y1items[j];
  30435. y2 = y2items[j];
  30436. r = y0 + 1.402 * y2;
  30437. g = y0 - 0.34413 * y1 - 0.71414 * y2;
  30438. b = y0 + 1.772 * y1;
  30439. out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift;
  30440. out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift;
  30441. out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift;
  30442. }
  30443. } else {
  30444. for (j = 0; j < jj; j++, pos += alpha01) {
  30445. y0 = y0items[j] + offset;
  30446. y1 = y1items[j];
  30447. y2 = y2items[j];
  30448. g = y0 - (y2 + y1 >> 2);
  30449. r = g + y2;
  30450. b = g + y1;
  30451. out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift;
  30452. out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift;
  30453. out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift;
  30454. }
  30455. }
  30456. if (fourComponents) {
  30457. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  30458. k = y3items[j];
  30459. out[pos] = k <= min ? 0 : k >= maxK ? 255 : k + offset >> shift;
  30460. }
  30461. }
  30462. } else {
  30463. for (c = 0; c < componentsCount; c++) {
  30464. var items = transformedTiles[c].items;
  30465. shift = components[c].precision - 8;
  30466. offset = (128 << shift) + 0.5;
  30467. max = 127.5 * (1 << shift);
  30468. min = -max;
  30469. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  30470. val = items[j];
  30471. out[pos] = val <= min ? 0 : val >= max ? 255 : val + offset >> shift;
  30472. pos += componentsCount;
  30473. }
  30474. }
  30475. }
  30476. resultImages.push(result);
  30477. }
  30478. return resultImages;
  30479. }
  30480. function initializeTile(context, tileIndex) {
  30481. var siz = context.SIZ;
  30482. var componentsCount = siz.Csiz;
  30483. var tile = context.tiles[tileIndex];
  30484. for (var c = 0; c < componentsCount; c++) {
  30485. var component = tile.components[c];
  30486. var qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  30487. component.quantizationParameters = qcdOrQcc;
  30488. var codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  30489. component.codingStyleParameters = codOrCoc;
  30490. }
  30491. tile.codingStyleDefaultParameters = context.currentTile.COD;
  30492. }
  30493. var TagTree = function TagTreeClosure() {
  30494. function TagTree(width, height) {
  30495. var levelsLength = log2(Math.max(width, height)) + 1;
  30496. this.levels = [];
  30497. for (var i = 0; i < levelsLength; i++) {
  30498. var level = {
  30499. width: width,
  30500. height: height,
  30501. items: []
  30502. };
  30503. this.levels.push(level);
  30504. width = Math.ceil(width / 2);
  30505. height = Math.ceil(height / 2);
  30506. }
  30507. }
  30508. TagTree.prototype = {
  30509. reset: function TagTree_reset(i, j) {
  30510. var currentLevel = 0, value = 0, level;
  30511. while (currentLevel < this.levels.length) {
  30512. level = this.levels[currentLevel];
  30513. var index = i + j * level.width;
  30514. if (level.items[index] !== undefined) {
  30515. value = level.items[index];
  30516. break;
  30517. }
  30518. level.index = index;
  30519. i >>= 1;
  30520. j >>= 1;
  30521. currentLevel++;
  30522. }
  30523. currentLevel--;
  30524. level = this.levels[currentLevel];
  30525. level.items[level.index] = value;
  30526. this.currentLevel = currentLevel;
  30527. delete this.value;
  30528. },
  30529. incrementValue: function TagTree_incrementValue() {
  30530. var level = this.levels[this.currentLevel];
  30531. level.items[level.index]++;
  30532. },
  30533. nextLevel: function TagTree_nextLevel() {
  30534. var currentLevel = this.currentLevel;
  30535. var level = this.levels[currentLevel];
  30536. var value = level.items[level.index];
  30537. currentLevel--;
  30538. if (currentLevel < 0) {
  30539. this.value = value;
  30540. return false;
  30541. }
  30542. this.currentLevel = currentLevel;
  30543. level = this.levels[currentLevel];
  30544. level.items[level.index] = value;
  30545. return true;
  30546. }
  30547. };
  30548. return TagTree;
  30549. }();
  30550. var InclusionTree = function InclusionTreeClosure() {
  30551. function InclusionTree(width, height, defaultValue) {
  30552. var levelsLength = log2(Math.max(width, height)) + 1;
  30553. this.levels = [];
  30554. for (var i = 0; i < levelsLength; i++) {
  30555. var items = new Uint8Array(width * height);
  30556. for (var j = 0, jj = items.length; j < jj; j++) {
  30557. items[j] = defaultValue;
  30558. }
  30559. var level = {
  30560. width: width,
  30561. height: height,
  30562. items: items
  30563. };
  30564. this.levels.push(level);
  30565. width = Math.ceil(width / 2);
  30566. height = Math.ceil(height / 2);
  30567. }
  30568. }
  30569. InclusionTree.prototype = {
  30570. reset: function InclusionTree_reset(i, j, stopValue) {
  30571. var currentLevel = 0;
  30572. while (currentLevel < this.levels.length) {
  30573. var level = this.levels[currentLevel];
  30574. var index = i + j * level.width;
  30575. level.index = index;
  30576. var value = level.items[index];
  30577. if (value === 0xFF) {
  30578. break;
  30579. }
  30580. if (value > stopValue) {
  30581. this.currentLevel = currentLevel;
  30582. this.propagateValues();
  30583. return false;
  30584. }
  30585. i >>= 1;
  30586. j >>= 1;
  30587. currentLevel++;
  30588. }
  30589. this.currentLevel = currentLevel - 1;
  30590. return true;
  30591. },
  30592. incrementValue: function InclusionTree_incrementValue(stopValue) {
  30593. var level = this.levels[this.currentLevel];
  30594. level.items[level.index] = stopValue + 1;
  30595. this.propagateValues();
  30596. },
  30597. propagateValues: function InclusionTree_propagateValues() {
  30598. var levelIndex = this.currentLevel;
  30599. var level = this.levels[levelIndex];
  30600. var currentValue = level.items[level.index];
  30601. while (--levelIndex >= 0) {
  30602. level = this.levels[levelIndex];
  30603. level.items[level.index] = currentValue;
  30604. }
  30605. },
  30606. nextLevel: function InclusionTree_nextLevel() {
  30607. var currentLevel = this.currentLevel;
  30608. var level = this.levels[currentLevel];
  30609. var value = level.items[level.index];
  30610. level.items[level.index] = 0xFF;
  30611. currentLevel--;
  30612. if (currentLevel < 0) {
  30613. return false;
  30614. }
  30615. this.currentLevel = currentLevel;
  30616. level = this.levels[currentLevel];
  30617. level.items[level.index] = value;
  30618. return true;
  30619. }
  30620. };
  30621. return InclusionTree;
  30622. }();
  30623. var BitModel = function BitModelClosure() {
  30624. var UNIFORM_CONTEXT = 17;
  30625. var RUNLENGTH_CONTEXT = 18;
  30626. var LLAndLHContextsLabel = new Uint8Array([
  30627. 0,
  30628. 5,
  30629. 8,
  30630. 0,
  30631. 3,
  30632. 7,
  30633. 8,
  30634. 0,
  30635. 4,
  30636. 7,
  30637. 8,
  30638. 0,
  30639. 0,
  30640. 0,
  30641. 0,
  30642. 0,
  30643. 1,
  30644. 6,
  30645. 8,
  30646. 0,
  30647. 3,
  30648. 7,
  30649. 8,
  30650. 0,
  30651. 4,
  30652. 7,
  30653. 8,
  30654. 0,
  30655. 0,
  30656. 0,
  30657. 0,
  30658. 0,
  30659. 2,
  30660. 6,
  30661. 8,
  30662. 0,
  30663. 3,
  30664. 7,
  30665. 8,
  30666. 0,
  30667. 4,
  30668. 7,
  30669. 8,
  30670. 0,
  30671. 0,
  30672. 0,
  30673. 0,
  30674. 0,
  30675. 2,
  30676. 6,
  30677. 8,
  30678. 0,
  30679. 3,
  30680. 7,
  30681. 8,
  30682. 0,
  30683. 4,
  30684. 7,
  30685. 8,
  30686. 0,
  30687. 0,
  30688. 0,
  30689. 0,
  30690. 0,
  30691. 2,
  30692. 6,
  30693. 8,
  30694. 0,
  30695. 3,
  30696. 7,
  30697. 8,
  30698. 0,
  30699. 4,
  30700. 7,
  30701. 8
  30702. ]);
  30703. var HLContextLabel = new Uint8Array([
  30704. 0,
  30705. 3,
  30706. 4,
  30707. 0,
  30708. 5,
  30709. 7,
  30710. 7,
  30711. 0,
  30712. 8,
  30713. 8,
  30714. 8,
  30715. 0,
  30716. 0,
  30717. 0,
  30718. 0,
  30719. 0,
  30720. 1,
  30721. 3,
  30722. 4,
  30723. 0,
  30724. 6,
  30725. 7,
  30726. 7,
  30727. 0,
  30728. 8,
  30729. 8,
  30730. 8,
  30731. 0,
  30732. 0,
  30733. 0,
  30734. 0,
  30735. 0,
  30736. 2,
  30737. 3,
  30738. 4,
  30739. 0,
  30740. 6,
  30741. 7,
  30742. 7,
  30743. 0,
  30744. 8,
  30745. 8,
  30746. 8,
  30747. 0,
  30748. 0,
  30749. 0,
  30750. 0,
  30751. 0,
  30752. 2,
  30753. 3,
  30754. 4,
  30755. 0,
  30756. 6,
  30757. 7,
  30758. 7,
  30759. 0,
  30760. 8,
  30761. 8,
  30762. 8,
  30763. 0,
  30764. 0,
  30765. 0,
  30766. 0,
  30767. 0,
  30768. 2,
  30769. 3,
  30770. 4,
  30771. 0,
  30772. 6,
  30773. 7,
  30774. 7,
  30775. 0,
  30776. 8,
  30777. 8,
  30778. 8
  30779. ]);
  30780. var HHContextLabel = new Uint8Array([
  30781. 0,
  30782. 1,
  30783. 2,
  30784. 0,
  30785. 1,
  30786. 2,
  30787. 2,
  30788. 0,
  30789. 2,
  30790. 2,
  30791. 2,
  30792. 0,
  30793. 0,
  30794. 0,
  30795. 0,
  30796. 0,
  30797. 3,
  30798. 4,
  30799. 5,
  30800. 0,
  30801. 4,
  30802. 5,
  30803. 5,
  30804. 0,
  30805. 5,
  30806. 5,
  30807. 5,
  30808. 0,
  30809. 0,
  30810. 0,
  30811. 0,
  30812. 0,
  30813. 6,
  30814. 7,
  30815. 7,
  30816. 0,
  30817. 7,
  30818. 7,
  30819. 7,
  30820. 0,
  30821. 7,
  30822. 7,
  30823. 7,
  30824. 0,
  30825. 0,
  30826. 0,
  30827. 0,
  30828. 0,
  30829. 8,
  30830. 8,
  30831. 8,
  30832. 0,
  30833. 8,
  30834. 8,
  30835. 8,
  30836. 0,
  30837. 8,
  30838. 8,
  30839. 8,
  30840. 0,
  30841. 0,
  30842. 0,
  30843. 0,
  30844. 0,
  30845. 8,
  30846. 8,
  30847. 8,
  30848. 0,
  30849. 8,
  30850. 8,
  30851. 8,
  30852. 0,
  30853. 8,
  30854. 8,
  30855. 8
  30856. ]);
  30857. function BitModel(width, height, subband, zeroBitPlanes, mb) {
  30858. this.width = width;
  30859. this.height = height;
  30860. this.contextLabelTable = subband === 'HH' ? HHContextLabel : subband === 'HL' ? HLContextLabel : LLAndLHContextsLabel;
  30861. var coefficientCount = width * height;
  30862. this.neighborsSignificance = new Uint8Array(coefficientCount);
  30863. this.coefficentsSign = new Uint8Array(coefficientCount);
  30864. this.coefficentsMagnitude = mb > 14 ? new Uint32Array(coefficientCount) : mb > 6 ? new Uint16Array(coefficientCount) : new Uint8Array(coefficientCount);
  30865. this.processingFlags = new Uint8Array(coefficientCount);
  30866. var bitsDecoded = new Uint8Array(coefficientCount);
  30867. if (zeroBitPlanes !== 0) {
  30868. for (var i = 0; i < coefficientCount; i++) {
  30869. bitsDecoded[i] = zeroBitPlanes;
  30870. }
  30871. }
  30872. this.bitsDecoded = bitsDecoded;
  30873. this.reset();
  30874. }
  30875. BitModel.prototype = {
  30876. setDecoder: function BitModel_setDecoder(decoder) {
  30877. this.decoder = decoder;
  30878. },
  30879. reset: function BitModel_reset() {
  30880. this.contexts = new Int8Array(19);
  30881. this.contexts[0] = 4 << 1 | 0;
  30882. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  30883. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  30884. },
  30885. setNeighborsSignificance: function BitModel_setNeighborsSignificance(row, column, index) {
  30886. var neighborsSignificance = this.neighborsSignificance;
  30887. var width = this.width, height = this.height;
  30888. var left = column > 0;
  30889. var right = column + 1 < width;
  30890. var i;
  30891. if (row > 0) {
  30892. i = index - width;
  30893. if (left) {
  30894. neighborsSignificance[i - 1] += 0x10;
  30895. }
  30896. if (right) {
  30897. neighborsSignificance[i + 1] += 0x10;
  30898. }
  30899. neighborsSignificance[i] += 0x04;
  30900. }
  30901. if (row + 1 < height) {
  30902. i = index + width;
  30903. if (left) {
  30904. neighborsSignificance[i - 1] += 0x10;
  30905. }
  30906. if (right) {
  30907. neighborsSignificance[i + 1] += 0x10;
  30908. }
  30909. neighborsSignificance[i] += 0x04;
  30910. }
  30911. if (left) {
  30912. neighborsSignificance[index - 1] += 0x01;
  30913. }
  30914. if (right) {
  30915. neighborsSignificance[index + 1] += 0x01;
  30916. }
  30917. neighborsSignificance[index] |= 0x80;
  30918. },
  30919. runSignificancePropagationPass: function BitModel_runSignificancePropagationPass() {
  30920. var decoder = this.decoder;
  30921. var width = this.width, height = this.height;
  30922. var coefficentsMagnitude = this.coefficentsMagnitude;
  30923. var coefficentsSign = this.coefficentsSign;
  30924. var neighborsSignificance = this.neighborsSignificance;
  30925. var processingFlags = this.processingFlags;
  30926. var contexts = this.contexts;
  30927. var labels = this.contextLabelTable;
  30928. var bitsDecoded = this.bitsDecoded;
  30929. var processedInverseMask = ~1;
  30930. var processedMask = 1;
  30931. var firstMagnitudeBitMask = 2;
  30932. for (var i0 = 0; i0 < height; i0 += 4) {
  30933. for (var j = 0; j < width; j++) {
  30934. var index = i0 * width + j;
  30935. for (var i1 = 0; i1 < 4; i1++, index += width) {
  30936. var i = i0 + i1;
  30937. if (i >= height) {
  30938. break;
  30939. }
  30940. processingFlags[index] &= processedInverseMask;
  30941. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  30942. continue;
  30943. }
  30944. var contextLabel = labels[neighborsSignificance[index]];
  30945. var decision = decoder.readBit(contexts, contextLabel);
  30946. if (decision) {
  30947. var sign = this.decodeSignBit(i, j, index);
  30948. coefficentsSign[index] = sign;
  30949. coefficentsMagnitude[index] = 1;
  30950. this.setNeighborsSignificance(i, j, index);
  30951. processingFlags[index] |= firstMagnitudeBitMask;
  30952. }
  30953. bitsDecoded[index]++;
  30954. processingFlags[index] |= processedMask;
  30955. }
  30956. }
  30957. }
  30958. },
  30959. decodeSignBit: function BitModel_decodeSignBit(row, column, index) {
  30960. var width = this.width, height = this.height;
  30961. var coefficentsMagnitude = this.coefficentsMagnitude;
  30962. var coefficentsSign = this.coefficentsSign;
  30963. var contribution, sign0, sign1, significance1;
  30964. var contextLabel, decoded;
  30965. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  30966. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  30967. sign1 = coefficentsSign[index + 1];
  30968. if (significance1) {
  30969. sign0 = coefficentsSign[index - 1];
  30970. contribution = 1 - sign1 - sign0;
  30971. } else {
  30972. contribution = 1 - sign1 - sign1;
  30973. }
  30974. } else if (significance1) {
  30975. sign0 = coefficentsSign[index - 1];
  30976. contribution = 1 - sign0 - sign0;
  30977. } else {
  30978. contribution = 0;
  30979. }
  30980. var horizontalContribution = 3 * contribution;
  30981. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  30982. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  30983. sign1 = coefficentsSign[index + width];
  30984. if (significance1) {
  30985. sign0 = coefficentsSign[index - width];
  30986. contribution = 1 - sign1 - sign0 + horizontalContribution;
  30987. } else {
  30988. contribution = 1 - sign1 - sign1 + horizontalContribution;
  30989. }
  30990. } else if (significance1) {
  30991. sign0 = coefficentsSign[index - width];
  30992. contribution = 1 - sign0 - sign0 + horizontalContribution;
  30993. } else {
  30994. contribution = horizontalContribution;
  30995. }
  30996. if (contribution >= 0) {
  30997. contextLabel = 9 + contribution;
  30998. decoded = this.decoder.readBit(this.contexts, contextLabel);
  30999. } else {
  31000. contextLabel = 9 - contribution;
  31001. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  31002. }
  31003. return decoded;
  31004. },
  31005. runMagnitudeRefinementPass: function BitModel_runMagnitudeRefinementPass() {
  31006. var decoder = this.decoder;
  31007. var width = this.width, height = this.height;
  31008. var coefficentsMagnitude = this.coefficentsMagnitude;
  31009. var neighborsSignificance = this.neighborsSignificance;
  31010. var contexts = this.contexts;
  31011. var bitsDecoded = this.bitsDecoded;
  31012. var processingFlags = this.processingFlags;
  31013. var processedMask = 1;
  31014. var firstMagnitudeBitMask = 2;
  31015. var length = width * height;
  31016. var width4 = width * 4;
  31017. for (var index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  31018. indexNext = Math.min(length, index0 + width4);
  31019. for (var j = 0; j < width; j++) {
  31020. for (var index = index0 + j; index < indexNext; index += width) {
  31021. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  31022. continue;
  31023. }
  31024. var contextLabel = 16;
  31025. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  31026. processingFlags[index] ^= firstMagnitudeBitMask;
  31027. var significance = neighborsSignificance[index] & 127;
  31028. contextLabel = significance === 0 ? 15 : 14;
  31029. }
  31030. var bit = decoder.readBit(contexts, contextLabel);
  31031. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  31032. bitsDecoded[index]++;
  31033. processingFlags[index] |= processedMask;
  31034. }
  31035. }
  31036. }
  31037. },
  31038. runCleanupPass: function BitModel_runCleanupPass() {
  31039. var decoder = this.decoder;
  31040. var width = this.width, height = this.height;
  31041. var neighborsSignificance = this.neighborsSignificance;
  31042. var coefficentsMagnitude = this.coefficentsMagnitude;
  31043. var coefficentsSign = this.coefficentsSign;
  31044. var contexts = this.contexts;
  31045. var labels = this.contextLabelTable;
  31046. var bitsDecoded = this.bitsDecoded;
  31047. var processingFlags = this.processingFlags;
  31048. var processedMask = 1;
  31049. var firstMagnitudeBitMask = 2;
  31050. var oneRowDown = width;
  31051. var twoRowsDown = width * 2;
  31052. var threeRowsDown = width * 3;
  31053. var iNext;
  31054. for (var i0 = 0; i0 < height; i0 = iNext) {
  31055. iNext = Math.min(i0 + 4, height);
  31056. var indexBase = i0 * width;
  31057. var checkAllEmpty = i0 + 3 < height;
  31058. for (var j = 0; j < width; j++) {
  31059. var index0 = indexBase + j;
  31060. 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;
  31061. var i1 = 0, index = index0;
  31062. var i = i0, sign;
  31063. if (allEmpty) {
  31064. var hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  31065. if (!hasSignificantCoefficent) {
  31066. bitsDecoded[index0]++;
  31067. bitsDecoded[index0 + oneRowDown]++;
  31068. bitsDecoded[index0 + twoRowsDown]++;
  31069. bitsDecoded[index0 + threeRowsDown]++;
  31070. continue;
  31071. }
  31072. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  31073. if (i1 !== 0) {
  31074. i = i0 + i1;
  31075. index += i1 * width;
  31076. }
  31077. sign = this.decodeSignBit(i, j, index);
  31078. coefficentsSign[index] = sign;
  31079. coefficentsMagnitude[index] = 1;
  31080. this.setNeighborsSignificance(i, j, index);
  31081. processingFlags[index] |= firstMagnitudeBitMask;
  31082. index = index0;
  31083. for (var i2 = i0; i2 <= i; i2++, index += width) {
  31084. bitsDecoded[index]++;
  31085. }
  31086. i1++;
  31087. }
  31088. for (i = i0 + i1; i < iNext; i++, index += width) {
  31089. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  31090. continue;
  31091. }
  31092. var contextLabel = labels[neighborsSignificance[index]];
  31093. var decision = decoder.readBit(contexts, contextLabel);
  31094. if (decision === 1) {
  31095. sign = this.decodeSignBit(i, j, index);
  31096. coefficentsSign[index] = sign;
  31097. coefficentsMagnitude[index] = 1;
  31098. this.setNeighborsSignificance(i, j, index);
  31099. processingFlags[index] |= firstMagnitudeBitMask;
  31100. }
  31101. bitsDecoded[index]++;
  31102. }
  31103. }
  31104. }
  31105. },
  31106. checkSegmentationSymbol: function BitModel_checkSegmentationSymbol() {
  31107. var decoder = this.decoder;
  31108. var contexts = this.contexts;
  31109. 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);
  31110. if (symbol !== 0xA) {
  31111. error('JPX Error: Invalid segmentation symbol');
  31112. }
  31113. }
  31114. };
  31115. return BitModel;
  31116. }();
  31117. var Transform = function TransformClosure() {
  31118. function Transform() {
  31119. }
  31120. Transform.prototype.calculate = function transformCalculate(subbands, u0, v0) {
  31121. var ll = subbands[0];
  31122. for (var i = 1, ii = subbands.length; i < ii; i++) {
  31123. ll = this.iterate(ll, subbands[i], u0, v0);
  31124. }
  31125. return ll;
  31126. };
  31127. Transform.prototype.extend = function extend(buffer, offset, size) {
  31128. var i1 = offset - 1, j1 = offset + 1;
  31129. var i2 = offset + size - 2, j2 = offset + size;
  31130. buffer[i1--] = buffer[j1++];
  31131. buffer[j2++] = buffer[i2--];
  31132. buffer[i1--] = buffer[j1++];
  31133. buffer[j2++] = buffer[i2--];
  31134. buffer[i1--] = buffer[j1++];
  31135. buffer[j2++] = buffer[i2--];
  31136. buffer[i1] = buffer[j1];
  31137. buffer[j2] = buffer[i2];
  31138. };
  31139. Transform.prototype.iterate = function Transform_iterate(ll, hl_lh_hh, u0, v0) {
  31140. var llWidth = ll.width, llHeight = ll.height, llItems = ll.items;
  31141. var width = hl_lh_hh.width;
  31142. var height = hl_lh_hh.height;
  31143. var items = hl_lh_hh.items;
  31144. var i, j, k, l, u, v;
  31145. for (k = 0, i = 0; i < llHeight; i++) {
  31146. l = i * 2 * width;
  31147. for (j = 0; j < llWidth; j++, k++, l += 2) {
  31148. items[l] = llItems[k];
  31149. }
  31150. }
  31151. llItems = ll.items = null;
  31152. var bufferPadding = 4;
  31153. var rowBuffer = new Float32Array(width + 2 * bufferPadding);
  31154. if (width === 1) {
  31155. if ((u0 & 1) !== 0) {
  31156. for (v = 0, k = 0; v < height; v++, k += width) {
  31157. items[k] *= 0.5;
  31158. }
  31159. }
  31160. } else {
  31161. for (v = 0, k = 0; v < height; v++, k += width) {
  31162. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  31163. this.extend(rowBuffer, bufferPadding, width);
  31164. this.filter(rowBuffer, bufferPadding, width);
  31165. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  31166. }
  31167. }
  31168. var numBuffers = 16;
  31169. var colBuffers = [];
  31170. for (i = 0; i < numBuffers; i++) {
  31171. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  31172. }
  31173. var b, currentBuffer = 0;
  31174. ll = bufferPadding + height;
  31175. if (height === 1) {
  31176. if ((v0 & 1) !== 0) {
  31177. for (u = 0; u < width; u++) {
  31178. items[u] *= 0.5;
  31179. }
  31180. }
  31181. } else {
  31182. for (u = 0; u < width; u++) {
  31183. if (currentBuffer === 0) {
  31184. numBuffers = Math.min(width - u, numBuffers);
  31185. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  31186. for (b = 0; b < numBuffers; b++) {
  31187. colBuffers[b][l] = items[k + b];
  31188. }
  31189. }
  31190. currentBuffer = numBuffers;
  31191. }
  31192. currentBuffer--;
  31193. var buffer = colBuffers[currentBuffer];
  31194. this.extend(buffer, bufferPadding, height);
  31195. this.filter(buffer, bufferPadding, height);
  31196. if (currentBuffer === 0) {
  31197. k = u - numBuffers + 1;
  31198. for (l = bufferPadding; l < ll; k += width, l++) {
  31199. for (b = 0; b < numBuffers; b++) {
  31200. items[k + b] = colBuffers[b][l];
  31201. }
  31202. }
  31203. }
  31204. }
  31205. }
  31206. return {
  31207. width: width,
  31208. height: height,
  31209. items: items
  31210. };
  31211. };
  31212. return Transform;
  31213. }();
  31214. var IrreversibleTransform = function IrreversibleTransformClosure() {
  31215. function IrreversibleTransform() {
  31216. Transform.call(this);
  31217. }
  31218. IrreversibleTransform.prototype = Object.create(Transform.prototype);
  31219. IrreversibleTransform.prototype.filter = function irreversibleTransformFilter(x, offset, length) {
  31220. var len = length >> 1;
  31221. offset = offset | 0;
  31222. var j, n, current, next;
  31223. var alpha = -1.586134342059924;
  31224. var beta = -0.052980118572961;
  31225. var gamma = 0.882911075530934;
  31226. var delta = 0.443506852043971;
  31227. var K = 1.230174104914001;
  31228. var K_ = 1 / K;
  31229. j = offset - 3;
  31230. for (n = len + 4; n--; j += 2) {
  31231. x[j] *= K_;
  31232. }
  31233. j = offset - 2;
  31234. current = delta * x[j - 1];
  31235. for (n = len + 3; n--; j += 2) {
  31236. next = delta * x[j + 1];
  31237. x[j] = K * x[j] - current - next;
  31238. if (n--) {
  31239. j += 2;
  31240. current = delta * x[j + 1];
  31241. x[j] = K * x[j] - current - next;
  31242. } else {
  31243. break;
  31244. }
  31245. }
  31246. j = offset - 1;
  31247. current = gamma * x[j - 1];
  31248. for (n = len + 2; n--; j += 2) {
  31249. next = gamma * x[j + 1];
  31250. x[j] -= current + next;
  31251. if (n--) {
  31252. j += 2;
  31253. current = gamma * x[j + 1];
  31254. x[j] -= current + next;
  31255. } else {
  31256. break;
  31257. }
  31258. }
  31259. j = offset;
  31260. current = beta * x[j - 1];
  31261. for (n = len + 1; n--; j += 2) {
  31262. next = beta * x[j + 1];
  31263. x[j] -= current + next;
  31264. if (n--) {
  31265. j += 2;
  31266. current = beta * x[j + 1];
  31267. x[j] -= current + next;
  31268. } else {
  31269. break;
  31270. }
  31271. }
  31272. if (len !== 0) {
  31273. j = offset + 1;
  31274. current = alpha * x[j - 1];
  31275. for (n = len; n--; j += 2) {
  31276. next = alpha * x[j + 1];
  31277. x[j] -= current + next;
  31278. if (n--) {
  31279. j += 2;
  31280. current = alpha * x[j + 1];
  31281. x[j] -= current + next;
  31282. } else {
  31283. break;
  31284. }
  31285. }
  31286. }
  31287. };
  31288. return IrreversibleTransform;
  31289. }();
  31290. var ReversibleTransform = function ReversibleTransformClosure() {
  31291. function ReversibleTransform() {
  31292. Transform.call(this);
  31293. }
  31294. ReversibleTransform.prototype = Object.create(Transform.prototype);
  31295. ReversibleTransform.prototype.filter = function reversibleTransformFilter(x, offset, length) {
  31296. var len = length >> 1;
  31297. offset = offset | 0;
  31298. var j, n;
  31299. for (j = offset, n = len + 1; n--; j += 2) {
  31300. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  31301. }
  31302. for (j = offset + 1, n = len; n--; j += 2) {
  31303. x[j] += x[j - 1] + x[j + 1] >> 1;
  31304. }
  31305. };
  31306. return ReversibleTransform;
  31307. }();
  31308. return JpxImage;
  31309. }();
  31310. exports.JpxImage = JpxImage;
  31311. /***/ }),
  31312. /* 15 */
  31313. /***/ (function(module, exports, __w_pdfjs_require__) {
  31314. "use strict";
  31315. var sharedUtil = __w_pdfjs_require__(0);
  31316. var corePrimitives = __w_pdfjs_require__(1);
  31317. var coreCrypto = __w_pdfjs_require__(12);
  31318. var coreParser = __w_pdfjs_require__(5);
  31319. var coreChunkedStream = __w_pdfjs_require__(11);
  31320. var coreColorSpace = __w_pdfjs_require__(3);
  31321. var InvalidPDFException = sharedUtil.InvalidPDFException;
  31322. var MissingDataException = sharedUtil.MissingDataException;
  31323. var XRefParseException = sharedUtil.XRefParseException;
  31324. var assert = sharedUtil.assert;
  31325. var bytesToString = sharedUtil.bytesToString;
  31326. var createPromiseCapability = sharedUtil.createPromiseCapability;
  31327. var error = sharedUtil.error;
  31328. var info = sharedUtil.info;
  31329. var isArray = sharedUtil.isArray;
  31330. var isBool = sharedUtil.isBool;
  31331. var isInt = sharedUtil.isInt;
  31332. var isString = sharedUtil.isString;
  31333. var shadow = sharedUtil.shadow;
  31334. var stringToPDFString = sharedUtil.stringToPDFString;
  31335. var stringToUTF8String = sharedUtil.stringToUTF8String;
  31336. var warn = sharedUtil.warn;
  31337. var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
  31338. var Util = sharedUtil.Util;
  31339. var Ref = corePrimitives.Ref;
  31340. var RefSet = corePrimitives.RefSet;
  31341. var RefSetCache = corePrimitives.RefSetCache;
  31342. var isName = corePrimitives.isName;
  31343. var isCmd = corePrimitives.isCmd;
  31344. var isDict = corePrimitives.isDict;
  31345. var isRef = corePrimitives.isRef;
  31346. var isRefsEqual = corePrimitives.isRefsEqual;
  31347. var isStream = corePrimitives.isStream;
  31348. var CipherTransformFactory = coreCrypto.CipherTransformFactory;
  31349. var Lexer = coreParser.Lexer;
  31350. var Parser = coreParser.Parser;
  31351. var ChunkedStream = coreChunkedStream.ChunkedStream;
  31352. var ColorSpace = coreColorSpace.ColorSpace;
  31353. var Catalog = function CatalogClosure() {
  31354. function Catalog(pdfManager, xref, pageFactory) {
  31355. this.pdfManager = pdfManager;
  31356. this.xref = xref;
  31357. this.catDict = xref.getCatalogObj();
  31358. this.fontCache = new RefSetCache();
  31359. assert(isDict(this.catDict), 'catalog object is not a dictionary');
  31360. this.pageFactory = pageFactory;
  31361. this.pagePromises = [];
  31362. }
  31363. Catalog.prototype = {
  31364. get metadata() {
  31365. var streamRef = this.catDict.getRaw('Metadata');
  31366. if (!isRef(streamRef)) {
  31367. return shadow(this, 'metadata', null);
  31368. }
  31369. var encryptMetadata = !this.xref.encrypt ? false : this.xref.encrypt.encryptMetadata;
  31370. var stream = this.xref.fetch(streamRef, !encryptMetadata);
  31371. var metadata;
  31372. if (stream && isDict(stream.dict)) {
  31373. var type = stream.dict.get('Type');
  31374. var subtype = stream.dict.get('Subtype');
  31375. if (isName(type, 'Metadata') && isName(subtype, 'XML')) {
  31376. try {
  31377. metadata = stringToUTF8String(bytesToString(stream.getBytes()));
  31378. } catch (e) {
  31379. info('Skipping invalid metadata.');
  31380. }
  31381. }
  31382. }
  31383. return shadow(this, 'metadata', metadata);
  31384. },
  31385. get toplevelPagesDict() {
  31386. var pagesObj = this.catDict.get('Pages');
  31387. assert(isDict(pagesObj), 'invalid top-level pages dictionary');
  31388. return shadow(this, 'toplevelPagesDict', pagesObj);
  31389. },
  31390. get documentOutline() {
  31391. var obj = null;
  31392. try {
  31393. obj = this.readDocumentOutline();
  31394. } catch (ex) {
  31395. if (ex instanceof MissingDataException) {
  31396. throw ex;
  31397. }
  31398. warn('Unable to read document outline');
  31399. }
  31400. return shadow(this, 'documentOutline', obj);
  31401. },
  31402. readDocumentOutline: function Catalog_readDocumentOutline() {
  31403. var obj = this.catDict.get('Outlines');
  31404. if (!isDict(obj)) {
  31405. return null;
  31406. }
  31407. obj = obj.getRaw('First');
  31408. if (!isRef(obj)) {
  31409. return null;
  31410. }
  31411. var root = { items: [] };
  31412. var queue = [{
  31413. obj: obj,
  31414. parent: root
  31415. }];
  31416. var processed = new RefSet();
  31417. processed.put(obj);
  31418. var xref = this.xref, blackColor = new Uint8Array(3);
  31419. while (queue.length > 0) {
  31420. var i = queue.shift();
  31421. var outlineDict = xref.fetchIfRef(i.obj);
  31422. if (outlineDict === null) {
  31423. continue;
  31424. }
  31425. assert(outlineDict.has('Title'), 'Invalid outline item');
  31426. var data = {
  31427. url: null,
  31428. dest: null
  31429. };
  31430. Catalog.parseDestDictionary({
  31431. destDict: outlineDict,
  31432. resultObj: data,
  31433. docBaseUrl: this.pdfManager.docBaseUrl
  31434. });
  31435. var title = outlineDict.get('Title');
  31436. var flags = outlineDict.get('F') || 0;
  31437. var color = outlineDict.getArray('C'), rgbColor = blackColor;
  31438. if (isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  31439. rgbColor = ColorSpace.singletons.rgb.getRgb(color, 0);
  31440. }
  31441. var outlineItem = {
  31442. dest: data.dest,
  31443. url: data.url,
  31444. unsafeUrl: data.unsafeUrl,
  31445. newWindow: data.newWindow,
  31446. title: stringToPDFString(title),
  31447. color: rgbColor,
  31448. count: outlineDict.get('Count'),
  31449. bold: !!(flags & 2),
  31450. italic: !!(flags & 1),
  31451. items: []
  31452. };
  31453. i.parent.items.push(outlineItem);
  31454. obj = outlineDict.getRaw('First');
  31455. if (isRef(obj) && !processed.has(obj)) {
  31456. queue.push({
  31457. obj: obj,
  31458. parent: outlineItem
  31459. });
  31460. processed.put(obj);
  31461. }
  31462. obj = outlineDict.getRaw('Next');
  31463. if (isRef(obj) && !processed.has(obj)) {
  31464. queue.push({
  31465. obj: obj,
  31466. parent: i.parent
  31467. });
  31468. processed.put(obj);
  31469. }
  31470. }
  31471. return root.items.length > 0 ? root.items : null;
  31472. },
  31473. get numPages() {
  31474. var obj = this.toplevelPagesDict.get('Count');
  31475. assert(isInt(obj), 'page count in top level pages object is not an integer');
  31476. return shadow(this, 'num', obj);
  31477. },
  31478. get destinations() {
  31479. function fetchDestination(dest) {
  31480. return isDict(dest) ? dest.get('D') : dest;
  31481. }
  31482. var xref = this.xref;
  31483. var dests = {}, nameTreeRef, nameDictionaryRef;
  31484. var obj = this.catDict.get('Names');
  31485. if (obj && obj.has('Dests')) {
  31486. nameTreeRef = obj.getRaw('Dests');
  31487. } else if (this.catDict.has('Dests')) {
  31488. nameDictionaryRef = this.catDict.get('Dests');
  31489. }
  31490. if (nameDictionaryRef) {
  31491. obj = nameDictionaryRef;
  31492. obj.forEach(function catalogForEach(key, value) {
  31493. if (!value) {
  31494. return;
  31495. }
  31496. dests[key] = fetchDestination(value);
  31497. });
  31498. }
  31499. if (nameTreeRef) {
  31500. var nameTree = new NameTree(nameTreeRef, xref);
  31501. var names = nameTree.getAll();
  31502. for (var name in names) {
  31503. dests[name] = fetchDestination(names[name]);
  31504. }
  31505. }
  31506. return shadow(this, 'destinations', dests);
  31507. },
  31508. getDestination: function Catalog_getDestination(destinationId) {
  31509. function fetchDestination(dest) {
  31510. return isDict(dest) ? dest.get('D') : dest;
  31511. }
  31512. var xref = this.xref;
  31513. var dest = null, nameTreeRef, nameDictionaryRef;
  31514. var obj = this.catDict.get('Names');
  31515. if (obj && obj.has('Dests')) {
  31516. nameTreeRef = obj.getRaw('Dests');
  31517. } else if (this.catDict.has('Dests')) {
  31518. nameDictionaryRef = this.catDict.get('Dests');
  31519. }
  31520. if (nameDictionaryRef) {
  31521. var value = nameDictionaryRef.get(destinationId);
  31522. if (value) {
  31523. dest = fetchDestination(value);
  31524. }
  31525. }
  31526. if (nameTreeRef) {
  31527. var nameTree = new NameTree(nameTreeRef, xref);
  31528. dest = fetchDestination(nameTree.get(destinationId));
  31529. }
  31530. return dest;
  31531. },
  31532. get pageLabels() {
  31533. var obj = null;
  31534. try {
  31535. obj = this.readPageLabels();
  31536. } catch (ex) {
  31537. if (ex instanceof MissingDataException) {
  31538. throw ex;
  31539. }
  31540. warn('Unable to read page labels.');
  31541. }
  31542. return shadow(this, 'pageLabels', obj);
  31543. },
  31544. readPageLabels: function Catalog_readPageLabels() {
  31545. var obj = this.catDict.getRaw('PageLabels');
  31546. if (!obj) {
  31547. return null;
  31548. }
  31549. var pageLabels = new Array(this.numPages);
  31550. var style = null;
  31551. var prefix = '';
  31552. var numberTree = new NumberTree(obj, this.xref);
  31553. var nums = numberTree.getAll();
  31554. var currentLabel = '', currentIndex = 1;
  31555. for (var i = 0, ii = this.numPages; i < ii; i++) {
  31556. if (i in nums) {
  31557. var labelDict = nums[i];
  31558. assert(isDict(labelDict), 'The PageLabel is not a dictionary.');
  31559. var type = labelDict.get('Type');
  31560. assert(!type || isName(type, 'PageLabel'), 'Invalid type in PageLabel dictionary.');
  31561. var s = labelDict.get('S');
  31562. assert(!s || isName(s), 'Invalid style in PageLabel dictionary.');
  31563. style = s ? s.name : null;
  31564. var p = labelDict.get('P');
  31565. assert(!p || isString(p), 'Invalid prefix in PageLabel dictionary.');
  31566. prefix = p ? stringToPDFString(p) : '';
  31567. var st = labelDict.get('St');
  31568. assert(!st || isInt(st) && st >= 1, 'Invalid start in PageLabel dictionary.');
  31569. currentIndex = st || 1;
  31570. }
  31571. switch (style) {
  31572. case 'D':
  31573. currentLabel = currentIndex;
  31574. break;
  31575. case 'R':
  31576. case 'r':
  31577. currentLabel = Util.toRoman(currentIndex, style === 'r');
  31578. break;
  31579. case 'A':
  31580. case 'a':
  31581. var LIMIT = 26;
  31582. var A_UPPER_CASE = 0x41, A_LOWER_CASE = 0x61;
  31583. var baseCharCode = style === 'a' ? A_LOWER_CASE : A_UPPER_CASE;
  31584. var letterIndex = currentIndex - 1;
  31585. var character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  31586. var charBuf = [];
  31587. for (var j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) {
  31588. charBuf.push(character);
  31589. }
  31590. currentLabel = charBuf.join('');
  31591. break;
  31592. default:
  31593. assert(!style, 'Invalid style "' + style + '" in PageLabel dictionary.');
  31594. }
  31595. pageLabels[i] = prefix + currentLabel;
  31596. currentLabel = '';
  31597. currentIndex++;
  31598. }
  31599. return pageLabels;
  31600. },
  31601. get attachments() {
  31602. var xref = this.xref;
  31603. var attachments = null, nameTreeRef;
  31604. var obj = this.catDict.get('Names');
  31605. if (obj) {
  31606. nameTreeRef = obj.getRaw('EmbeddedFiles');
  31607. }
  31608. if (nameTreeRef) {
  31609. var nameTree = new NameTree(nameTreeRef, xref);
  31610. var names = nameTree.getAll();
  31611. for (var name in names) {
  31612. var fs = new FileSpec(names[name], xref);
  31613. if (!attachments) {
  31614. attachments = Object.create(null);
  31615. }
  31616. attachments[stringToPDFString(name)] = fs.serializable;
  31617. }
  31618. }
  31619. return shadow(this, 'attachments', attachments);
  31620. },
  31621. get javaScript() {
  31622. var xref = this.xref;
  31623. var obj = this.catDict.get('Names');
  31624. var javaScript = [];
  31625. function appendIfJavaScriptDict(jsDict) {
  31626. var type = jsDict.get('S');
  31627. if (!isName(type, 'JavaScript')) {
  31628. return;
  31629. }
  31630. var js = jsDict.get('JS');
  31631. if (isStream(js)) {
  31632. js = bytesToString(js.getBytes());
  31633. } else if (!isString(js)) {
  31634. return;
  31635. }
  31636. javaScript.push(stringToPDFString(js));
  31637. }
  31638. if (obj && obj.has('JavaScript')) {
  31639. var nameTree = new NameTree(obj.getRaw('JavaScript'), xref);
  31640. var names = nameTree.getAll();
  31641. for (var name in names) {
  31642. var jsDict = names[name];
  31643. if (isDict(jsDict)) {
  31644. appendIfJavaScriptDict(jsDict);
  31645. }
  31646. }
  31647. }
  31648. var openactionDict = this.catDict.get('OpenAction');
  31649. if (isDict(openactionDict, 'Action')) {
  31650. var actionType = openactionDict.get('S');
  31651. if (isName(actionType, 'Named')) {
  31652. var action = openactionDict.get('N');
  31653. if (isName(action, 'Print')) {
  31654. javaScript.push('print({});');
  31655. }
  31656. } else {
  31657. appendIfJavaScriptDict(openactionDict);
  31658. }
  31659. }
  31660. return shadow(this, 'javaScript', javaScript);
  31661. },
  31662. cleanup: function Catalog_cleanup() {
  31663. var promises = [];
  31664. this.fontCache.forEach(function (promise) {
  31665. promises.push(promise);
  31666. });
  31667. return Promise.all(promises).then(function (translatedFonts) {
  31668. for (var i = 0, ii = translatedFonts.length; i < ii; i++) {
  31669. var font = translatedFonts[i].dict;
  31670. delete font.translated;
  31671. }
  31672. this.fontCache.clear();
  31673. }.bind(this));
  31674. },
  31675. getPage: function Catalog_getPage(pageIndex) {
  31676. if (!(pageIndex in this.pagePromises)) {
  31677. this.pagePromises[pageIndex] = this.getPageDict(pageIndex).then(function (a) {
  31678. var dict = a[0];
  31679. var ref = a[1];
  31680. return this.pageFactory.createPage(pageIndex, dict, ref, this.fontCache);
  31681. }.bind(this));
  31682. }
  31683. return this.pagePromises[pageIndex];
  31684. },
  31685. getPageDict: function Catalog_getPageDict(pageIndex) {
  31686. var capability = createPromiseCapability();
  31687. var nodesToVisit = [this.catDict.getRaw('Pages')];
  31688. var currentPageIndex = 0;
  31689. var xref = this.xref;
  31690. var checkAllKids = false;
  31691. function next() {
  31692. while (nodesToVisit.length) {
  31693. var currentNode = nodesToVisit.pop();
  31694. if (isRef(currentNode)) {
  31695. xref.fetchAsync(currentNode).then(function (obj) {
  31696. if (isDict(obj, 'Page') || isDict(obj) && !obj.has('Kids')) {
  31697. if (pageIndex === currentPageIndex) {
  31698. capability.resolve([
  31699. obj,
  31700. currentNode
  31701. ]);
  31702. } else {
  31703. currentPageIndex++;
  31704. next();
  31705. }
  31706. return;
  31707. }
  31708. nodesToVisit.push(obj);
  31709. next();
  31710. }, capability.reject);
  31711. return;
  31712. }
  31713. assert(isDict(currentNode), 'page dictionary kid reference points to wrong type of object');
  31714. var count = currentNode.get('Count');
  31715. if (count === 0) {
  31716. checkAllKids = true;
  31717. }
  31718. if (currentPageIndex + count <= pageIndex) {
  31719. currentPageIndex += count;
  31720. continue;
  31721. }
  31722. var kids = currentNode.get('Kids');
  31723. assert(isArray(kids), 'page dictionary kids object is not an array');
  31724. if (!checkAllKids && count === kids.length) {
  31725. nodesToVisit = [kids[pageIndex - currentPageIndex]];
  31726. currentPageIndex = pageIndex;
  31727. continue;
  31728. } else {
  31729. for (var last = kids.length - 1; last >= 0; last--) {
  31730. nodesToVisit.push(kids[last]);
  31731. }
  31732. }
  31733. }
  31734. capability.reject('Page index ' + pageIndex + ' not found.');
  31735. }
  31736. next();
  31737. return capability.promise;
  31738. },
  31739. getPageIndex: function Catalog_getPageIndex(pageRef) {
  31740. var xref = this.xref;
  31741. function pagesBeforeRef(kidRef) {
  31742. var total = 0;
  31743. var parentRef;
  31744. return xref.fetchAsync(kidRef).then(function (node) {
  31745. if (isRefsEqual(kidRef, pageRef) && !isDict(node, 'Page') && !(isDict(node) && !node.has('Type') && node.has('Contents'))) {
  31746. throw new Error('The reference does not point to a /Page Dict.');
  31747. }
  31748. if (!node) {
  31749. return null;
  31750. }
  31751. assert(isDict(node), 'node must be a Dict.');
  31752. parentRef = node.getRaw('Parent');
  31753. return node.getAsync('Parent');
  31754. }).then(function (parent) {
  31755. if (!parent) {
  31756. return null;
  31757. }
  31758. assert(isDict(parent), 'parent must be a Dict.');
  31759. return parent.getAsync('Kids');
  31760. }).then(function (kids) {
  31761. if (!kids) {
  31762. return null;
  31763. }
  31764. var kidPromises = [];
  31765. var found = false;
  31766. for (var i = 0; i < kids.length; i++) {
  31767. var kid = kids[i];
  31768. assert(isRef(kid), 'kid must be a Ref.');
  31769. if (kid.num === kidRef.num) {
  31770. found = true;
  31771. break;
  31772. }
  31773. kidPromises.push(xref.fetchAsync(kid).then(function (kid) {
  31774. if (kid.has('Count')) {
  31775. var count = kid.get('Count');
  31776. total += count;
  31777. } else {
  31778. total++;
  31779. }
  31780. }));
  31781. }
  31782. if (!found) {
  31783. error('kid ref not found in parents kids');
  31784. }
  31785. return Promise.all(kidPromises).then(function () {
  31786. return [
  31787. total,
  31788. parentRef
  31789. ];
  31790. });
  31791. });
  31792. }
  31793. var total = 0;
  31794. function next(ref) {
  31795. return pagesBeforeRef(ref).then(function (args) {
  31796. if (!args) {
  31797. return total;
  31798. }
  31799. var count = args[0];
  31800. var parentRef = args[1];
  31801. total += count;
  31802. return next(parentRef);
  31803. });
  31804. }
  31805. return next(pageRef);
  31806. }
  31807. };
  31808. Catalog.parseDestDictionary = function Catalog_parseDestDictionary(params) {
  31809. function addDefaultProtocolToUrl(url) {
  31810. if (url.indexOf('www.') === 0) {
  31811. return 'http://' + url;
  31812. }
  31813. return url;
  31814. }
  31815. function tryConvertUrlEncoding(url) {
  31816. try {
  31817. return stringToUTF8String(url);
  31818. } catch (e) {
  31819. return url;
  31820. }
  31821. }
  31822. var destDict = params.destDict;
  31823. if (!isDict(destDict)) {
  31824. warn('Catalog_parseDestDictionary: "destDict" must be a dictionary.');
  31825. return;
  31826. }
  31827. var resultObj = params.resultObj;
  31828. if (typeof resultObj !== 'object') {
  31829. warn('Catalog_parseDestDictionary: "resultObj" must be an object.');
  31830. return;
  31831. }
  31832. var docBaseUrl = params.docBaseUrl || null;
  31833. var action = destDict.get('A'), url, dest;
  31834. if (isDict(action)) {
  31835. var linkType = action.get('S').name;
  31836. switch (linkType) {
  31837. case 'URI':
  31838. url = action.get('URI');
  31839. if (isName(url)) {
  31840. url = '/' + url.name;
  31841. } else if (isString(url)) {
  31842. url = addDefaultProtocolToUrl(url);
  31843. }
  31844. break;
  31845. case 'GoTo':
  31846. dest = action.get('D');
  31847. break;
  31848. case 'Launch':
  31849. case 'GoToR':
  31850. var urlDict = action.get('F');
  31851. if (isDict(urlDict)) {
  31852. url = urlDict.get('F') || null;
  31853. } else if (isString(urlDict)) {
  31854. url = urlDict;
  31855. }
  31856. var remoteDest = action.get('D');
  31857. if (remoteDest) {
  31858. if (isName(remoteDest)) {
  31859. remoteDest = remoteDest.name;
  31860. }
  31861. if (isString(url)) {
  31862. var baseUrl = url.split('#')[0];
  31863. if (isString(remoteDest)) {
  31864. url = baseUrl + '#' + (/^\d+$/.test(remoteDest) ? 'nameddest=' : '') + remoteDest;
  31865. } else if (isArray(remoteDest)) {
  31866. url = baseUrl + '#' + JSON.stringify(remoteDest);
  31867. }
  31868. }
  31869. }
  31870. var newWindow = action.get('NewWindow');
  31871. if (isBool(newWindow)) {
  31872. resultObj.newWindow = newWindow;
  31873. }
  31874. break;
  31875. case 'Named':
  31876. var namedAction = action.get('N');
  31877. if (isName(namedAction)) {
  31878. resultObj.action = namedAction.name;
  31879. }
  31880. break;
  31881. case 'JavaScript':
  31882. var jsAction = action.get('JS'), js;
  31883. if (isStream(jsAction)) {
  31884. js = bytesToString(jsAction.getBytes());
  31885. } else if (isString(jsAction)) {
  31886. js = jsAction;
  31887. }
  31888. if (js) {
  31889. var URL_OPEN_METHODS = [
  31890. 'app.launchURL',
  31891. 'window.open'
  31892. ];
  31893. var regex = new RegExp('^(?:' + URL_OPEN_METHODS.join('|') + ')' + '\\((?:\'|\")(\\S+)(?:\'|\")(?:,|\\))');
  31894. var jsUrl = regex.exec(stringToPDFString(js), 'i');
  31895. if (jsUrl && jsUrl[1]) {
  31896. url = jsUrl[1];
  31897. break;
  31898. }
  31899. }
  31900. default:
  31901. warn('Catalog_parseDestDictionary: Unrecognized link type "' + linkType + '".');
  31902. break;
  31903. }
  31904. } else if (destDict.has('Dest')) {
  31905. dest = destDict.get('Dest');
  31906. }
  31907. if (isString(url)) {
  31908. url = tryConvertUrlEncoding(url);
  31909. var absoluteUrl = createValidAbsoluteUrl(url, docBaseUrl);
  31910. if (absoluteUrl) {
  31911. resultObj.url = absoluteUrl.href;
  31912. }
  31913. resultObj.unsafeUrl = url;
  31914. }
  31915. if (dest) {
  31916. if (isName(dest)) {
  31917. dest = dest.name;
  31918. }
  31919. if (isString(dest) || isArray(dest)) {
  31920. resultObj.dest = dest;
  31921. }
  31922. }
  31923. };
  31924. return Catalog;
  31925. }();
  31926. var XRef = function XRefClosure() {
  31927. function XRef(stream, pdfManager) {
  31928. this.stream = stream;
  31929. this.pdfManager = pdfManager;
  31930. this.entries = [];
  31931. this.xrefstms = Object.create(null);
  31932. this.cache = [];
  31933. this.stats = {
  31934. streamTypes: [],
  31935. fontTypes: []
  31936. };
  31937. }
  31938. XRef.prototype = {
  31939. setStartXRef: function XRef_setStartXRef(startXRef) {
  31940. this.startXRefQueue = [startXRef];
  31941. },
  31942. parse: function XRef_parse(recoveryMode) {
  31943. var trailerDict;
  31944. if (!recoveryMode) {
  31945. trailerDict = this.readXRef();
  31946. } else {
  31947. warn('Indexing all PDF objects');
  31948. trailerDict = this.indexObjects();
  31949. }
  31950. trailerDict.assignXref(this);
  31951. this.trailer = trailerDict;
  31952. var encrypt = trailerDict.get('Encrypt');
  31953. if (isDict(encrypt)) {
  31954. var ids = trailerDict.get('ID');
  31955. var fileId = ids && ids.length ? ids[0] : '';
  31956. encrypt.suppressEncryption = true;
  31957. this.encrypt = new CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  31958. }
  31959. if (!(this.root = trailerDict.get('Root'))) {
  31960. error('Invalid root reference');
  31961. }
  31962. },
  31963. processXRefTable: function XRef_processXRefTable(parser) {
  31964. if (!('tableState' in this)) {
  31965. this.tableState = {
  31966. entryNum: 0,
  31967. streamPos: parser.lexer.stream.pos,
  31968. parserBuf1: parser.buf1,
  31969. parserBuf2: parser.buf2
  31970. };
  31971. }
  31972. var obj = this.readXRefTable(parser);
  31973. if (!isCmd(obj, 'trailer')) {
  31974. error('Invalid XRef table: could not find trailer dictionary');
  31975. }
  31976. var dict = parser.getObj();
  31977. if (!isDict(dict) && dict.dict) {
  31978. dict = dict.dict;
  31979. }
  31980. if (!isDict(dict)) {
  31981. error('Invalid XRef table: could not parse trailer dictionary');
  31982. }
  31983. delete this.tableState;
  31984. return dict;
  31985. },
  31986. readXRefTable: function XRef_readXRefTable(parser) {
  31987. var stream = parser.lexer.stream;
  31988. var tableState = this.tableState;
  31989. stream.pos = tableState.streamPos;
  31990. parser.buf1 = tableState.parserBuf1;
  31991. parser.buf2 = tableState.parserBuf2;
  31992. var obj;
  31993. while (true) {
  31994. if (!('firstEntryNum' in tableState) || !('entryCount' in tableState)) {
  31995. if (isCmd(obj = parser.getObj(), 'trailer')) {
  31996. break;
  31997. }
  31998. tableState.firstEntryNum = obj;
  31999. tableState.entryCount = parser.getObj();
  32000. }
  32001. var first = tableState.firstEntryNum;
  32002. var count = tableState.entryCount;
  32003. if (!isInt(first) || !isInt(count)) {
  32004. error('Invalid XRef table: wrong types in subsection header');
  32005. }
  32006. for (var i = tableState.entryNum; i < count; i++) {
  32007. tableState.streamPos = stream.pos;
  32008. tableState.entryNum = i;
  32009. tableState.parserBuf1 = parser.buf1;
  32010. tableState.parserBuf2 = parser.buf2;
  32011. var entry = {};
  32012. entry.offset = parser.getObj();
  32013. entry.gen = parser.getObj();
  32014. var type = parser.getObj();
  32015. if (isCmd(type, 'f')) {
  32016. entry.free = true;
  32017. } else if (isCmd(type, 'n')) {
  32018. entry.uncompressed = true;
  32019. }
  32020. if (!isInt(entry.offset) || !isInt(entry.gen) || !(entry.free || entry.uncompressed)) {
  32021. error('Invalid entry in XRef subsection: ' + first + ', ' + count);
  32022. }
  32023. if (i === 0 && entry.free && first === 1) {
  32024. first = 0;
  32025. }
  32026. if (!this.entries[i + first]) {
  32027. this.entries[i + first] = entry;
  32028. }
  32029. }
  32030. tableState.entryNum = 0;
  32031. tableState.streamPos = stream.pos;
  32032. tableState.parserBuf1 = parser.buf1;
  32033. tableState.parserBuf2 = parser.buf2;
  32034. delete tableState.firstEntryNum;
  32035. delete tableState.entryCount;
  32036. }
  32037. if (this.entries[0] && !this.entries[0].free) {
  32038. error('Invalid XRef table: unexpected first object');
  32039. }
  32040. return obj;
  32041. },
  32042. processXRefStream: function XRef_processXRefStream(stream) {
  32043. if (!('streamState' in this)) {
  32044. var streamParameters = stream.dict;
  32045. var byteWidths = streamParameters.get('W');
  32046. var range = streamParameters.get('Index');
  32047. if (!range) {
  32048. range = [
  32049. 0,
  32050. streamParameters.get('Size')
  32051. ];
  32052. }
  32053. this.streamState = {
  32054. entryRanges: range,
  32055. byteWidths: byteWidths,
  32056. entryNum: 0,
  32057. streamPos: stream.pos
  32058. };
  32059. }
  32060. this.readXRefStream(stream);
  32061. delete this.streamState;
  32062. return stream.dict;
  32063. },
  32064. readXRefStream: function XRef_readXRefStream(stream) {
  32065. var i, j;
  32066. var streamState = this.streamState;
  32067. stream.pos = streamState.streamPos;
  32068. var byteWidths = streamState.byteWidths;
  32069. var typeFieldWidth = byteWidths[0];
  32070. var offsetFieldWidth = byteWidths[1];
  32071. var generationFieldWidth = byteWidths[2];
  32072. var entryRanges = streamState.entryRanges;
  32073. while (entryRanges.length > 0) {
  32074. var first = entryRanges[0];
  32075. var n = entryRanges[1];
  32076. if (!isInt(first) || !isInt(n)) {
  32077. error('Invalid XRef range fields: ' + first + ', ' + n);
  32078. }
  32079. if (!isInt(typeFieldWidth) || !isInt(offsetFieldWidth) || !isInt(generationFieldWidth)) {
  32080. error('Invalid XRef entry fields length: ' + first + ', ' + n);
  32081. }
  32082. for (i = streamState.entryNum; i < n; ++i) {
  32083. streamState.entryNum = i;
  32084. streamState.streamPos = stream.pos;
  32085. var type = 0, offset = 0, generation = 0;
  32086. for (j = 0; j < typeFieldWidth; ++j) {
  32087. type = type << 8 | stream.getByte();
  32088. }
  32089. if (typeFieldWidth === 0) {
  32090. type = 1;
  32091. }
  32092. for (j = 0; j < offsetFieldWidth; ++j) {
  32093. offset = offset << 8 | stream.getByte();
  32094. }
  32095. for (j = 0; j < generationFieldWidth; ++j) {
  32096. generation = generation << 8 | stream.getByte();
  32097. }
  32098. var entry = {};
  32099. entry.offset = offset;
  32100. entry.gen = generation;
  32101. switch (type) {
  32102. case 0:
  32103. entry.free = true;
  32104. break;
  32105. case 1:
  32106. entry.uncompressed = true;
  32107. break;
  32108. case 2:
  32109. break;
  32110. default:
  32111. error('Invalid XRef entry type: ' + type);
  32112. }
  32113. if (!this.entries[first + i]) {
  32114. this.entries[first + i] = entry;
  32115. }
  32116. }
  32117. streamState.entryNum = 0;
  32118. streamState.streamPos = stream.pos;
  32119. entryRanges.splice(0, 2);
  32120. }
  32121. },
  32122. indexObjects: function XRef_indexObjects() {
  32123. var TAB = 0x9, LF = 0xA, CR = 0xD, SPACE = 0x20;
  32124. var PERCENT = 0x25, LT = 0x3C;
  32125. function readToken(data, offset) {
  32126. var token = '', ch = data[offset];
  32127. while (ch !== LF && ch !== CR && ch !== LT) {
  32128. if (++offset >= data.length) {
  32129. break;
  32130. }
  32131. token += String.fromCharCode(ch);
  32132. ch = data[offset];
  32133. }
  32134. return token;
  32135. }
  32136. function skipUntil(data, offset, what) {
  32137. var length = what.length, dataLength = data.length;
  32138. var skipped = 0;
  32139. while (offset < dataLength) {
  32140. var i = 0;
  32141. while (i < length && data[offset + i] === what[i]) {
  32142. ++i;
  32143. }
  32144. if (i >= length) {
  32145. break;
  32146. }
  32147. offset++;
  32148. skipped++;
  32149. }
  32150. return skipped;
  32151. }
  32152. var objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  32153. var trailerBytes = new Uint8Array([
  32154. 116,
  32155. 114,
  32156. 97,
  32157. 105,
  32158. 108,
  32159. 101,
  32160. 114
  32161. ]);
  32162. var startxrefBytes = new Uint8Array([
  32163. 115,
  32164. 116,
  32165. 97,
  32166. 114,
  32167. 116,
  32168. 120,
  32169. 114,
  32170. 101,
  32171. 102
  32172. ]);
  32173. var endobjBytes = new Uint8Array([
  32174. 101,
  32175. 110,
  32176. 100,
  32177. 111,
  32178. 98,
  32179. 106
  32180. ]);
  32181. var xrefBytes = new Uint8Array([
  32182. 47,
  32183. 88,
  32184. 82,
  32185. 101,
  32186. 102
  32187. ]);
  32188. this.entries.length = 0;
  32189. var stream = this.stream;
  32190. stream.pos = 0;
  32191. var buffer = stream.getBytes();
  32192. var position = stream.start, length = buffer.length;
  32193. var trailers = [], xrefStms = [];
  32194. while (position < length) {
  32195. var ch = buffer[position];
  32196. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  32197. ++position;
  32198. continue;
  32199. }
  32200. if (ch === PERCENT) {
  32201. do {
  32202. ++position;
  32203. if (position >= length) {
  32204. break;
  32205. }
  32206. ch = buffer[position];
  32207. } while (ch !== LF && ch !== CR);
  32208. continue;
  32209. }
  32210. var token = readToken(buffer, position);
  32211. var m;
  32212. if (token.indexOf('xref') === 0 && (token.length === 4 || /\s/.test(token[4]))) {
  32213. position += skipUntil(buffer, position, trailerBytes);
  32214. trailers.push(position);
  32215. position += skipUntil(buffer, position, startxrefBytes);
  32216. } else if (m = objRegExp.exec(token)) {
  32217. if (typeof this.entries[m[1]] === 'undefined') {
  32218. this.entries[m[1]] = {
  32219. offset: position - stream.start,
  32220. gen: m[2] | 0,
  32221. uncompressed: true
  32222. };
  32223. }
  32224. var contentLength = skipUntil(buffer, position, endobjBytes) + 7;
  32225. var content = buffer.subarray(position, position + contentLength);
  32226. var xrefTagOffset = skipUntil(content, 0, xrefBytes);
  32227. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  32228. xrefStms.push(position - stream.start);
  32229. this.xrefstms[position - stream.start] = 1;
  32230. }
  32231. position += contentLength;
  32232. } else if (token.indexOf('trailer') === 0 && (token.length === 7 || /\s/.test(token[7]))) {
  32233. trailers.push(position);
  32234. position += skipUntil(buffer, position, startxrefBytes);
  32235. } else {
  32236. position += token.length + 1;
  32237. }
  32238. }
  32239. var i, ii;
  32240. for (i = 0, ii = xrefStms.length; i < ii; ++i) {
  32241. this.startXRefQueue.push(xrefStms[i]);
  32242. this.readXRef(true);
  32243. }
  32244. var dict;
  32245. for (i = 0, ii = trailers.length; i < ii; ++i) {
  32246. stream.pos = trailers[i];
  32247. var parser = new Parser(new Lexer(stream), true, this, true);
  32248. var obj = parser.getObj();
  32249. if (!isCmd(obj, 'trailer')) {
  32250. continue;
  32251. }
  32252. dict = parser.getObj();
  32253. if (!isDict(dict)) {
  32254. continue;
  32255. }
  32256. if (dict.has('ID')) {
  32257. return dict;
  32258. }
  32259. }
  32260. if (dict) {
  32261. return dict;
  32262. }
  32263. throw new InvalidPDFException('Invalid PDF structure');
  32264. },
  32265. readXRef: function XRef_readXRef(recoveryMode) {
  32266. var stream = this.stream;
  32267. try {
  32268. while (this.startXRefQueue.length) {
  32269. var startXRef = this.startXRefQueue[0];
  32270. stream.pos = startXRef + stream.start;
  32271. var parser = new Parser(new Lexer(stream), true, this);
  32272. var obj = parser.getObj();
  32273. var dict;
  32274. if (isCmd(obj, 'xref')) {
  32275. dict = this.processXRefTable(parser);
  32276. if (!this.topDict) {
  32277. this.topDict = dict;
  32278. }
  32279. obj = dict.get('XRefStm');
  32280. if (isInt(obj)) {
  32281. var pos = obj;
  32282. if (!(pos in this.xrefstms)) {
  32283. this.xrefstms[pos] = 1;
  32284. this.startXRefQueue.push(pos);
  32285. }
  32286. }
  32287. } else if (isInt(obj)) {
  32288. if (!isInt(parser.getObj()) || !isCmd(parser.getObj(), 'obj') || !isStream(obj = parser.getObj())) {
  32289. error('Invalid XRef stream');
  32290. }
  32291. dict = this.processXRefStream(obj);
  32292. if (!this.topDict) {
  32293. this.topDict = dict;
  32294. }
  32295. if (!dict) {
  32296. error('Failed to read XRef stream');
  32297. }
  32298. } else {
  32299. error('Invalid XRef stream header');
  32300. }
  32301. obj = dict.get('Prev');
  32302. if (isInt(obj)) {
  32303. this.startXRefQueue.push(obj);
  32304. } else if (isRef(obj)) {
  32305. this.startXRefQueue.push(obj.num);
  32306. }
  32307. this.startXRefQueue.shift();
  32308. }
  32309. return this.topDict;
  32310. } catch (e) {
  32311. if (e instanceof MissingDataException) {
  32312. throw e;
  32313. }
  32314. info('(while reading XRef): ' + e);
  32315. }
  32316. if (recoveryMode) {
  32317. return;
  32318. }
  32319. throw new XRefParseException();
  32320. },
  32321. getEntry: function XRef_getEntry(i) {
  32322. var xrefEntry = this.entries[i];
  32323. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  32324. return xrefEntry;
  32325. }
  32326. return null;
  32327. },
  32328. fetchIfRef: function XRef_fetchIfRef(obj, suppressEncryption) {
  32329. if (!isRef(obj)) {
  32330. return obj;
  32331. }
  32332. return this.fetch(obj, suppressEncryption);
  32333. },
  32334. fetch: function XRef_fetch(ref, suppressEncryption) {
  32335. assert(isRef(ref), 'ref object is not a reference');
  32336. var num = ref.num;
  32337. if (num in this.cache) {
  32338. var cacheEntry = this.cache[num];
  32339. return cacheEntry;
  32340. }
  32341. var xrefEntry = this.getEntry(num);
  32342. if (xrefEntry === null) {
  32343. return this.cache[num] = null;
  32344. }
  32345. if (xrefEntry.uncompressed) {
  32346. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  32347. } else {
  32348. xrefEntry = this.fetchCompressed(xrefEntry, suppressEncryption);
  32349. }
  32350. if (isDict(xrefEntry)) {
  32351. xrefEntry.objId = ref.toString();
  32352. } else if (isStream(xrefEntry)) {
  32353. xrefEntry.dict.objId = ref.toString();
  32354. }
  32355. return xrefEntry;
  32356. },
  32357. fetchUncompressed: function XRef_fetchUncompressed(ref, xrefEntry, suppressEncryption) {
  32358. var gen = ref.gen;
  32359. var num = ref.num;
  32360. if (xrefEntry.gen !== gen) {
  32361. error('inconsistent generation in XRef');
  32362. }
  32363. var stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  32364. var parser = new Parser(new Lexer(stream), true, this);
  32365. var obj1 = parser.getObj();
  32366. var obj2 = parser.getObj();
  32367. var obj3 = parser.getObj();
  32368. if (!isInt(obj1) || parseInt(obj1, 10) !== num || !isInt(obj2) || parseInt(obj2, 10) !== gen || !isCmd(obj3)) {
  32369. error('bad XRef entry');
  32370. }
  32371. if (!isCmd(obj3, 'obj')) {
  32372. if (obj3.cmd.indexOf('obj') === 0) {
  32373. num = parseInt(obj3.cmd.substring(3), 10);
  32374. if (!isNaN(num)) {
  32375. return num;
  32376. }
  32377. }
  32378. error('bad XRef entry');
  32379. }
  32380. if (this.encrypt && !suppressEncryption) {
  32381. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  32382. } else {
  32383. xrefEntry = parser.getObj();
  32384. }
  32385. if (!isStream(xrefEntry)) {
  32386. this.cache[num] = xrefEntry;
  32387. }
  32388. return xrefEntry;
  32389. },
  32390. fetchCompressed: function XRef_fetchCompressed(xrefEntry, suppressEncryption) {
  32391. var tableOffset = xrefEntry.offset;
  32392. var stream = this.fetch(new Ref(tableOffset, 0));
  32393. if (!isStream(stream)) {
  32394. error('bad ObjStm stream');
  32395. }
  32396. var first = stream.dict.get('First');
  32397. var n = stream.dict.get('N');
  32398. if (!isInt(first) || !isInt(n)) {
  32399. error('invalid first and n parameters for ObjStm stream');
  32400. }
  32401. var parser = new Parser(new Lexer(stream), false, this);
  32402. parser.allowStreams = true;
  32403. var i, entries = [], num, nums = [];
  32404. for (i = 0; i < n; ++i) {
  32405. num = parser.getObj();
  32406. if (!isInt(num)) {
  32407. error('invalid object number in the ObjStm stream: ' + num);
  32408. }
  32409. nums.push(num);
  32410. var offset = parser.getObj();
  32411. if (!isInt(offset)) {
  32412. error('invalid object offset in the ObjStm stream: ' + offset);
  32413. }
  32414. }
  32415. for (i = 0; i < n; ++i) {
  32416. entries.push(parser.getObj());
  32417. if (isCmd(parser.buf1, 'endobj')) {
  32418. parser.shift();
  32419. }
  32420. num = nums[i];
  32421. var entry = this.entries[num];
  32422. if (entry && entry.offset === tableOffset && entry.gen === i) {
  32423. this.cache[num] = entries[i];
  32424. }
  32425. }
  32426. xrefEntry = entries[xrefEntry.gen];
  32427. if (xrefEntry === undefined) {
  32428. error('bad XRef entry for compressed object');
  32429. }
  32430. return xrefEntry;
  32431. },
  32432. fetchIfRefAsync: function XRef_fetchIfRefAsync(obj, suppressEncryption) {
  32433. if (!isRef(obj)) {
  32434. return Promise.resolve(obj);
  32435. }
  32436. return this.fetchAsync(obj, suppressEncryption);
  32437. },
  32438. fetchAsync: function XRef_fetchAsync(ref, suppressEncryption) {
  32439. var streamManager = this.stream.manager;
  32440. var xref = this;
  32441. return new Promise(function tryFetch(resolve, reject) {
  32442. try {
  32443. resolve(xref.fetch(ref, suppressEncryption));
  32444. } catch (e) {
  32445. if (e instanceof MissingDataException) {
  32446. streamManager.requestRange(e.begin, e.end).then(function () {
  32447. tryFetch(resolve, reject);
  32448. }, reject);
  32449. return;
  32450. }
  32451. reject(e);
  32452. }
  32453. });
  32454. },
  32455. getCatalogObj: function XRef_getCatalogObj() {
  32456. return this.root;
  32457. }
  32458. };
  32459. return XRef;
  32460. }();
  32461. var NameOrNumberTree = function NameOrNumberTreeClosure() {
  32462. function NameOrNumberTree(root, xref) {
  32463. throw new Error('Cannot initialize NameOrNumberTree.');
  32464. }
  32465. NameOrNumberTree.prototype = {
  32466. getAll: function NameOrNumberTree_getAll() {
  32467. var dict = Object.create(null);
  32468. if (!this.root) {
  32469. return dict;
  32470. }
  32471. var xref = this.xref;
  32472. var processed = new RefSet();
  32473. processed.put(this.root);
  32474. var queue = [this.root];
  32475. while (queue.length > 0) {
  32476. var i, n;
  32477. var obj = xref.fetchIfRef(queue.shift());
  32478. if (!isDict(obj)) {
  32479. continue;
  32480. }
  32481. if (obj.has('Kids')) {
  32482. var kids = obj.get('Kids');
  32483. for (i = 0, n = kids.length; i < n; i++) {
  32484. var kid = kids[i];
  32485. assert(!processed.has(kid), 'Duplicate entry in "' + this._type + '" tree.');
  32486. queue.push(kid);
  32487. processed.put(kid);
  32488. }
  32489. continue;
  32490. }
  32491. var entries = obj.get(this._type);
  32492. if (isArray(entries)) {
  32493. for (i = 0, n = entries.length; i < n; i += 2) {
  32494. dict[xref.fetchIfRef(entries[i])] = xref.fetchIfRef(entries[i + 1]);
  32495. }
  32496. }
  32497. }
  32498. return dict;
  32499. },
  32500. get: function NameOrNumberTree_get(key) {
  32501. if (!this.root) {
  32502. return null;
  32503. }
  32504. var xref = this.xref;
  32505. var kidsOrEntries = xref.fetchIfRef(this.root);
  32506. var loopCount = 0;
  32507. var MAX_LEVELS = 10;
  32508. var l, r, m;
  32509. while (kidsOrEntries.has('Kids')) {
  32510. if (++loopCount > MAX_LEVELS) {
  32511. warn('Search depth limit reached for "' + this._type + '" tree.');
  32512. return null;
  32513. }
  32514. var kids = kidsOrEntries.get('Kids');
  32515. if (!isArray(kids)) {
  32516. return null;
  32517. }
  32518. l = 0;
  32519. r = kids.length - 1;
  32520. while (l <= r) {
  32521. m = l + r >> 1;
  32522. var kid = xref.fetchIfRef(kids[m]);
  32523. var limits = kid.get('Limits');
  32524. if (key < xref.fetchIfRef(limits[0])) {
  32525. r = m - 1;
  32526. } else if (key > xref.fetchIfRef(limits[1])) {
  32527. l = m + 1;
  32528. } else {
  32529. kidsOrEntries = xref.fetchIfRef(kids[m]);
  32530. break;
  32531. }
  32532. }
  32533. if (l > r) {
  32534. return null;
  32535. }
  32536. }
  32537. var entries = kidsOrEntries.get(this._type);
  32538. if (isArray(entries)) {
  32539. l = 0;
  32540. r = entries.length - 2;
  32541. while (l <= r) {
  32542. m = l + r & ~1;
  32543. var currentKey = xref.fetchIfRef(entries[m]);
  32544. if (key < currentKey) {
  32545. r = m - 2;
  32546. } else if (key > currentKey) {
  32547. l = m + 2;
  32548. } else {
  32549. return xref.fetchIfRef(entries[m + 1]);
  32550. }
  32551. }
  32552. }
  32553. return null;
  32554. }
  32555. };
  32556. return NameOrNumberTree;
  32557. }();
  32558. var NameTree = function NameTreeClosure() {
  32559. function NameTree(root, xref) {
  32560. this.root = root;
  32561. this.xref = xref;
  32562. this._type = 'Names';
  32563. }
  32564. Util.inherit(NameTree, NameOrNumberTree, {});
  32565. return NameTree;
  32566. }();
  32567. var NumberTree = function NumberTreeClosure() {
  32568. function NumberTree(root, xref) {
  32569. this.root = root;
  32570. this.xref = xref;
  32571. this._type = 'Nums';
  32572. }
  32573. Util.inherit(NumberTree, NameOrNumberTree, {});
  32574. return NumberTree;
  32575. }();
  32576. var FileSpec = function FileSpecClosure() {
  32577. function FileSpec(root, xref) {
  32578. if (!root || !isDict(root)) {
  32579. return;
  32580. }
  32581. this.xref = xref;
  32582. this.root = root;
  32583. if (root.has('FS')) {
  32584. this.fs = root.get('FS');
  32585. }
  32586. this.description = root.has('Desc') ? stringToPDFString(root.get('Desc')) : '';
  32587. if (root.has('RF')) {
  32588. warn('Related file specifications are not supported');
  32589. }
  32590. this.contentAvailable = true;
  32591. if (!root.has('EF')) {
  32592. this.contentAvailable = false;
  32593. warn('Non-embedded file specifications are not supported');
  32594. }
  32595. }
  32596. function pickPlatformItem(dict) {
  32597. if (dict.has('UF')) {
  32598. return dict.get('UF');
  32599. } else if (dict.has('F')) {
  32600. return dict.get('F');
  32601. } else if (dict.has('Unix')) {
  32602. return dict.get('Unix');
  32603. } else if (dict.has('Mac')) {
  32604. return dict.get('Mac');
  32605. } else if (dict.has('DOS')) {
  32606. return dict.get('DOS');
  32607. }
  32608. return null;
  32609. }
  32610. FileSpec.prototype = {
  32611. get filename() {
  32612. if (!this._filename && this.root) {
  32613. var filename = pickPlatformItem(this.root) || 'unnamed';
  32614. this._filename = stringToPDFString(filename).replace(/\\\\/g, '\\').replace(/\\\//g, '/').replace(/\\/g, '/');
  32615. }
  32616. return this._filename;
  32617. },
  32618. get content() {
  32619. if (!this.contentAvailable) {
  32620. return null;
  32621. }
  32622. if (!this.contentRef && this.root) {
  32623. this.contentRef = pickPlatformItem(this.root.get('EF'));
  32624. }
  32625. var content = null;
  32626. if (this.contentRef) {
  32627. var xref = this.xref;
  32628. var fileObj = xref.fetchIfRef(this.contentRef);
  32629. if (fileObj && isStream(fileObj)) {
  32630. content = fileObj.getBytes();
  32631. } else {
  32632. warn('Embedded file specification points to non-existing/invalid ' + 'content');
  32633. }
  32634. } else {
  32635. warn('Embedded file specification does not have a content');
  32636. }
  32637. return content;
  32638. },
  32639. get serializable() {
  32640. return {
  32641. filename: this.filename,
  32642. content: this.content
  32643. };
  32644. }
  32645. };
  32646. return FileSpec;
  32647. }();
  32648. var ObjectLoader = function () {
  32649. function mayHaveChildren(value) {
  32650. return isRef(value) || isDict(value) || isArray(value) || isStream(value);
  32651. }
  32652. function addChildren(node, nodesToVisit) {
  32653. var value;
  32654. if (isDict(node) || isStream(node)) {
  32655. var map;
  32656. if (isDict(node)) {
  32657. map = node.map;
  32658. } else {
  32659. map = node.dict.map;
  32660. }
  32661. for (var key in map) {
  32662. value = map[key];
  32663. if (mayHaveChildren(value)) {
  32664. nodesToVisit.push(value);
  32665. }
  32666. }
  32667. } else if (isArray(node)) {
  32668. for (var i = 0, ii = node.length; i < ii; i++) {
  32669. value = node[i];
  32670. if (mayHaveChildren(value)) {
  32671. nodesToVisit.push(value);
  32672. }
  32673. }
  32674. }
  32675. }
  32676. function ObjectLoader(obj, keys, xref) {
  32677. this.obj = obj;
  32678. this.keys = keys;
  32679. this.xref = xref;
  32680. this.refSet = null;
  32681. this.capability = null;
  32682. }
  32683. ObjectLoader.prototype = {
  32684. load: function ObjectLoader_load() {
  32685. var keys = this.keys;
  32686. this.capability = createPromiseCapability();
  32687. if (!(this.xref.stream instanceof ChunkedStream) || this.xref.stream.getMissingChunks().length === 0) {
  32688. this.capability.resolve();
  32689. return this.capability.promise;
  32690. }
  32691. this.refSet = new RefSet();
  32692. var nodesToVisit = [];
  32693. for (var i = 0; i < keys.length; i++) {
  32694. nodesToVisit.push(this.obj[keys[i]]);
  32695. }
  32696. this._walk(nodesToVisit);
  32697. return this.capability.promise;
  32698. },
  32699. _walk: function ObjectLoader_walk(nodesToVisit) {
  32700. var nodesToRevisit = [];
  32701. var pendingRequests = [];
  32702. while (nodesToVisit.length) {
  32703. var currentNode = nodesToVisit.pop();
  32704. if (isRef(currentNode)) {
  32705. if (this.refSet.has(currentNode)) {
  32706. continue;
  32707. }
  32708. try {
  32709. var ref = currentNode;
  32710. this.refSet.put(ref);
  32711. currentNode = this.xref.fetch(currentNode);
  32712. } catch (e) {
  32713. if (!(e instanceof MissingDataException)) {
  32714. throw e;
  32715. }
  32716. nodesToRevisit.push(currentNode);
  32717. pendingRequests.push({
  32718. begin: e.begin,
  32719. end: e.end
  32720. });
  32721. }
  32722. }
  32723. if (currentNode && currentNode.getBaseStreams) {
  32724. var baseStreams = currentNode.getBaseStreams();
  32725. var foundMissingData = false;
  32726. for (var i = 0; i < baseStreams.length; i++) {
  32727. var stream = baseStreams[i];
  32728. if (stream.getMissingChunks && stream.getMissingChunks().length) {
  32729. foundMissingData = true;
  32730. pendingRequests.push({
  32731. begin: stream.start,
  32732. end: stream.end
  32733. });
  32734. }
  32735. }
  32736. if (foundMissingData) {
  32737. nodesToRevisit.push(currentNode);
  32738. }
  32739. }
  32740. addChildren(currentNode, nodesToVisit);
  32741. }
  32742. if (pendingRequests.length) {
  32743. this.xref.stream.manager.requestRanges(pendingRequests).then(function pendingRequestCallback() {
  32744. nodesToVisit = nodesToRevisit;
  32745. for (var i = 0; i < nodesToRevisit.length; i++) {
  32746. var node = nodesToRevisit[i];
  32747. if (isRef(node)) {
  32748. this.refSet.remove(node);
  32749. }
  32750. }
  32751. this._walk(nodesToVisit);
  32752. }.bind(this), this.capability.reject);
  32753. return;
  32754. }
  32755. this.refSet = null;
  32756. this.capability.resolve();
  32757. }
  32758. };
  32759. return ObjectLoader;
  32760. }();
  32761. exports.Catalog = Catalog;
  32762. exports.ObjectLoader = ObjectLoader;
  32763. exports.XRef = XRef;
  32764. exports.FileSpec = FileSpec;
  32765. /***/ }),
  32766. /* 16 */
  32767. /***/ (function(module, exports, __w_pdfjs_require__) {
  32768. "use strict";
  32769. var sharedUtil = __w_pdfjs_require__(0);
  32770. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  32771. var getStdFontMap = getLookupTableFactory(function (t) {
  32772. t['ArialNarrow'] = 'Helvetica';
  32773. t['ArialNarrow-Bold'] = 'Helvetica-Bold';
  32774. t['ArialNarrow-BoldItalic'] = 'Helvetica-BoldOblique';
  32775. t['ArialNarrow-Italic'] = 'Helvetica-Oblique';
  32776. t['ArialBlack'] = 'Helvetica';
  32777. t['ArialBlack-Bold'] = 'Helvetica-Bold';
  32778. t['ArialBlack-BoldItalic'] = 'Helvetica-BoldOblique';
  32779. t['ArialBlack-Italic'] = 'Helvetica-Oblique';
  32780. t['Arial-Black'] = 'Helvetica';
  32781. t['Arial-Black-Bold'] = 'Helvetica-Bold';
  32782. t['Arial-Black-BoldItalic'] = 'Helvetica-BoldOblique';
  32783. t['Arial-Black-Italic'] = 'Helvetica-Oblique';
  32784. t['Arial'] = 'Helvetica';
  32785. t['Arial-Bold'] = 'Helvetica-Bold';
  32786. t['Arial-BoldItalic'] = 'Helvetica-BoldOblique';
  32787. t['Arial-Italic'] = 'Helvetica-Oblique';
  32788. t['Arial-BoldItalicMT'] = 'Helvetica-BoldOblique';
  32789. t['Arial-BoldMT'] = 'Helvetica-Bold';
  32790. t['Arial-ItalicMT'] = 'Helvetica-Oblique';
  32791. t['ArialMT'] = 'Helvetica';
  32792. t['Courier-Bold'] = 'Courier-Bold';
  32793. t['Courier-BoldItalic'] = 'Courier-BoldOblique';
  32794. t['Courier-Italic'] = 'Courier-Oblique';
  32795. t['CourierNew'] = 'Courier';
  32796. t['CourierNew-Bold'] = 'Courier-Bold';
  32797. t['CourierNew-BoldItalic'] = 'Courier-BoldOblique';
  32798. t['CourierNew-Italic'] = 'Courier-Oblique';
  32799. t['CourierNewPS-BoldItalicMT'] = 'Courier-BoldOblique';
  32800. t['CourierNewPS-BoldMT'] = 'Courier-Bold';
  32801. t['CourierNewPS-ItalicMT'] = 'Courier-Oblique';
  32802. t['CourierNewPSMT'] = 'Courier';
  32803. t['Helvetica'] = 'Helvetica';
  32804. t['Helvetica-Bold'] = 'Helvetica-Bold';
  32805. t['Helvetica-BoldItalic'] = 'Helvetica-BoldOblique';
  32806. t['Helvetica-BoldOblique'] = 'Helvetica-BoldOblique';
  32807. t['Helvetica-Italic'] = 'Helvetica-Oblique';
  32808. t['Helvetica-Oblique'] = 'Helvetica-Oblique';
  32809. t['Symbol-Bold'] = 'Symbol';
  32810. t['Symbol-BoldItalic'] = 'Symbol';
  32811. t['Symbol-Italic'] = 'Symbol';
  32812. t['TimesNewRoman'] = 'Times-Roman';
  32813. t['TimesNewRoman-Bold'] = 'Times-Bold';
  32814. t['TimesNewRoman-BoldItalic'] = 'Times-BoldItalic';
  32815. t['TimesNewRoman-Italic'] = 'Times-Italic';
  32816. t['TimesNewRomanPS'] = 'Times-Roman';
  32817. t['TimesNewRomanPS-Bold'] = 'Times-Bold';
  32818. t['TimesNewRomanPS-BoldItalic'] = 'Times-BoldItalic';
  32819. t['TimesNewRomanPS-BoldItalicMT'] = 'Times-BoldItalic';
  32820. t['TimesNewRomanPS-BoldMT'] = 'Times-Bold';
  32821. t['TimesNewRomanPS-Italic'] = 'Times-Italic';
  32822. t['TimesNewRomanPS-ItalicMT'] = 'Times-Italic';
  32823. t['TimesNewRomanPSMT'] = 'Times-Roman';
  32824. t['TimesNewRomanPSMT-Bold'] = 'Times-Bold';
  32825. t['TimesNewRomanPSMT-BoldItalic'] = 'Times-BoldItalic';
  32826. t['TimesNewRomanPSMT-Italic'] = 'Times-Italic';
  32827. });
  32828. var getNonStdFontMap = getLookupTableFactory(function (t) {
  32829. t['CenturyGothic'] = 'Helvetica';
  32830. t['CenturyGothic-Bold'] = 'Helvetica-Bold';
  32831. t['CenturyGothic-BoldItalic'] = 'Helvetica-BoldOblique';
  32832. t['CenturyGothic-Italic'] = 'Helvetica-Oblique';
  32833. t['ComicSansMS'] = 'Comic Sans MS';
  32834. t['ComicSansMS-Bold'] = 'Comic Sans MS-Bold';
  32835. t['ComicSansMS-BoldItalic'] = 'Comic Sans MS-BoldItalic';
  32836. t['ComicSansMS-Italic'] = 'Comic Sans MS-Italic';
  32837. t['LucidaConsole'] = 'Courier';
  32838. t['LucidaConsole-Bold'] = 'Courier-Bold';
  32839. t['LucidaConsole-BoldItalic'] = 'Courier-BoldOblique';
  32840. t['LucidaConsole-Italic'] = 'Courier-Oblique';
  32841. t['MS-Gothic'] = 'MS Gothic';
  32842. t['MS-Gothic-Bold'] = 'MS Gothic-Bold';
  32843. t['MS-Gothic-BoldItalic'] = 'MS Gothic-BoldItalic';
  32844. t['MS-Gothic-Italic'] = 'MS Gothic-Italic';
  32845. t['MS-Mincho'] = 'MS Mincho';
  32846. t['MS-Mincho-Bold'] = 'MS Mincho-Bold';
  32847. t['MS-Mincho-BoldItalic'] = 'MS Mincho-BoldItalic';
  32848. t['MS-Mincho-Italic'] = 'MS Mincho-Italic';
  32849. t['MS-PGothic'] = 'MS PGothic';
  32850. t['MS-PGothic-Bold'] = 'MS PGothic-Bold';
  32851. t['MS-PGothic-BoldItalic'] = 'MS PGothic-BoldItalic';
  32852. t['MS-PGothic-Italic'] = 'MS PGothic-Italic';
  32853. t['MS-PMincho'] = 'MS PMincho';
  32854. t['MS-PMincho-Bold'] = 'MS PMincho-Bold';
  32855. t['MS-PMincho-BoldItalic'] = 'MS PMincho-BoldItalic';
  32856. t['MS-PMincho-Italic'] = 'MS PMincho-Italic';
  32857. t['NuptialScript'] = 'Times-Italic';
  32858. t['Wingdings'] = 'ZapfDingbats';
  32859. });
  32860. var getSerifFonts = getLookupTableFactory(function (t) {
  32861. t['Adobe Jenson'] = true;
  32862. t['Adobe Text'] = true;
  32863. t['Albertus'] = true;
  32864. t['Aldus'] = true;
  32865. t['Alexandria'] = true;
  32866. t['Algerian'] = true;
  32867. t['American Typewriter'] = true;
  32868. t['Antiqua'] = true;
  32869. t['Apex'] = true;
  32870. t['Arno'] = true;
  32871. t['Aster'] = true;
  32872. t['Aurora'] = true;
  32873. t['Baskerville'] = true;
  32874. t['Bell'] = true;
  32875. t['Bembo'] = true;
  32876. t['Bembo Schoolbook'] = true;
  32877. t['Benguiat'] = true;
  32878. t['Berkeley Old Style'] = true;
  32879. t['Bernhard Modern'] = true;
  32880. t['Berthold City'] = true;
  32881. t['Bodoni'] = true;
  32882. t['Bauer Bodoni'] = true;
  32883. t['Book Antiqua'] = true;
  32884. t['Bookman'] = true;
  32885. t['Bordeaux Roman'] = true;
  32886. t['Californian FB'] = true;
  32887. t['Calisto'] = true;
  32888. t['Calvert'] = true;
  32889. t['Capitals'] = true;
  32890. t['Cambria'] = true;
  32891. t['Cartier'] = true;
  32892. t['Caslon'] = true;
  32893. t['Catull'] = true;
  32894. t['Centaur'] = true;
  32895. t['Century Old Style'] = true;
  32896. t['Century Schoolbook'] = true;
  32897. t['Chaparral'] = true;
  32898. t['Charis SIL'] = true;
  32899. t['Cheltenham'] = true;
  32900. t['Cholla Slab'] = true;
  32901. t['Clarendon'] = true;
  32902. t['Clearface'] = true;
  32903. t['Cochin'] = true;
  32904. t['Colonna'] = true;
  32905. t['Computer Modern'] = true;
  32906. t['Concrete Roman'] = true;
  32907. t['Constantia'] = true;
  32908. t['Cooper Black'] = true;
  32909. t['Corona'] = true;
  32910. t['Ecotype'] = true;
  32911. t['Egyptienne'] = true;
  32912. t['Elephant'] = true;
  32913. t['Excelsior'] = true;
  32914. t['Fairfield'] = true;
  32915. t['FF Scala'] = true;
  32916. t['Folkard'] = true;
  32917. t['Footlight'] = true;
  32918. t['FreeSerif'] = true;
  32919. t['Friz Quadrata'] = true;
  32920. t['Garamond'] = true;
  32921. t['Gentium'] = true;
  32922. t['Georgia'] = true;
  32923. t['Gloucester'] = true;
  32924. t['Goudy Old Style'] = true;
  32925. t['Goudy Schoolbook'] = true;
  32926. t['Goudy Pro Font'] = true;
  32927. t['Granjon'] = true;
  32928. t['Guardian Egyptian'] = true;
  32929. t['Heather'] = true;
  32930. t['Hercules'] = true;
  32931. t['High Tower Text'] = true;
  32932. t['Hiroshige'] = true;
  32933. t['Hoefler Text'] = true;
  32934. t['Humana Serif'] = true;
  32935. t['Imprint'] = true;
  32936. t['Ionic No. 5'] = true;
  32937. t['Janson'] = true;
  32938. t['Joanna'] = true;
  32939. t['Korinna'] = true;
  32940. t['Lexicon'] = true;
  32941. t['Liberation Serif'] = true;
  32942. t['Linux Libertine'] = true;
  32943. t['Literaturnaya'] = true;
  32944. t['Lucida'] = true;
  32945. t['Lucida Bright'] = true;
  32946. t['Melior'] = true;
  32947. t['Memphis'] = true;
  32948. t['Miller'] = true;
  32949. t['Minion'] = true;
  32950. t['Modern'] = true;
  32951. t['Mona Lisa'] = true;
  32952. t['Mrs Eaves'] = true;
  32953. t['MS Serif'] = true;
  32954. t['Museo Slab'] = true;
  32955. t['New York'] = true;
  32956. t['Nimbus Roman'] = true;
  32957. t['NPS Rawlinson Roadway'] = true;
  32958. t['NuptialScript'] = true;
  32959. t['Palatino'] = true;
  32960. t['Perpetua'] = true;
  32961. t['Plantin'] = true;
  32962. t['Plantin Schoolbook'] = true;
  32963. t['Playbill'] = true;
  32964. t['Poor Richard'] = true;
  32965. t['Rawlinson Roadway'] = true;
  32966. t['Renault'] = true;
  32967. t['Requiem'] = true;
  32968. t['Rockwell'] = true;
  32969. t['Roman'] = true;
  32970. t['Rotis Serif'] = true;
  32971. t['Sabon'] = true;
  32972. t['Scala'] = true;
  32973. t['Seagull'] = true;
  32974. t['Sistina'] = true;
  32975. t['Souvenir'] = true;
  32976. t['STIX'] = true;
  32977. t['Stone Informal'] = true;
  32978. t['Stone Serif'] = true;
  32979. t['Sylfaen'] = true;
  32980. t['Times'] = true;
  32981. t['Trajan'] = true;
  32982. t['Trinité'] = true;
  32983. t['Trump Mediaeval'] = true;
  32984. t['Utopia'] = true;
  32985. t['Vale Type'] = true;
  32986. t['Bitstream Vera'] = true;
  32987. t['Vera Serif'] = true;
  32988. t['Versailles'] = true;
  32989. t['Wanted'] = true;
  32990. t['Weiss'] = true;
  32991. t['Wide Latin'] = true;
  32992. t['Windsor'] = true;
  32993. t['XITS'] = true;
  32994. });
  32995. var getSymbolsFonts = getLookupTableFactory(function (t) {
  32996. t['Dingbats'] = true;
  32997. t['Symbol'] = true;
  32998. t['ZapfDingbats'] = true;
  32999. });
  33000. var getGlyphMapForStandardFonts = getLookupTableFactory(function (t) {
  33001. t[2] = 10;
  33002. t[3] = 32;
  33003. t[4] = 33;
  33004. t[5] = 34;
  33005. t[6] = 35;
  33006. t[7] = 36;
  33007. t[8] = 37;
  33008. t[9] = 38;
  33009. t[10] = 39;
  33010. t[11] = 40;
  33011. t[12] = 41;
  33012. t[13] = 42;
  33013. t[14] = 43;
  33014. t[15] = 44;
  33015. t[16] = 45;
  33016. t[17] = 46;
  33017. t[18] = 47;
  33018. t[19] = 48;
  33019. t[20] = 49;
  33020. t[21] = 50;
  33021. t[22] = 51;
  33022. t[23] = 52;
  33023. t[24] = 53;
  33024. t[25] = 54;
  33025. t[26] = 55;
  33026. t[27] = 56;
  33027. t[28] = 57;
  33028. t[29] = 58;
  33029. t[30] = 894;
  33030. t[31] = 60;
  33031. t[32] = 61;
  33032. t[33] = 62;
  33033. t[34] = 63;
  33034. t[35] = 64;
  33035. t[36] = 65;
  33036. t[37] = 66;
  33037. t[38] = 67;
  33038. t[39] = 68;
  33039. t[40] = 69;
  33040. t[41] = 70;
  33041. t[42] = 71;
  33042. t[43] = 72;
  33043. t[44] = 73;
  33044. t[45] = 74;
  33045. t[46] = 75;
  33046. t[47] = 76;
  33047. t[48] = 77;
  33048. t[49] = 78;
  33049. t[50] = 79;
  33050. t[51] = 80;
  33051. t[52] = 81;
  33052. t[53] = 82;
  33053. t[54] = 83;
  33054. t[55] = 84;
  33055. t[56] = 85;
  33056. t[57] = 86;
  33057. t[58] = 87;
  33058. t[59] = 88;
  33059. t[60] = 89;
  33060. t[61] = 90;
  33061. t[62] = 91;
  33062. t[63] = 92;
  33063. t[64] = 93;
  33064. t[65] = 94;
  33065. t[66] = 95;
  33066. t[67] = 96;
  33067. t[68] = 97;
  33068. t[69] = 98;
  33069. t[70] = 99;
  33070. t[71] = 100;
  33071. t[72] = 101;
  33072. t[73] = 102;
  33073. t[74] = 103;
  33074. t[75] = 104;
  33075. t[76] = 105;
  33076. t[77] = 106;
  33077. t[78] = 107;
  33078. t[79] = 108;
  33079. t[80] = 109;
  33080. t[81] = 110;
  33081. t[82] = 111;
  33082. t[83] = 112;
  33083. t[84] = 113;
  33084. t[85] = 114;
  33085. t[86] = 115;
  33086. t[87] = 116;
  33087. t[88] = 117;
  33088. t[89] = 118;
  33089. t[90] = 119;
  33090. t[91] = 120;
  33091. t[92] = 121;
  33092. t[93] = 122;
  33093. t[94] = 123;
  33094. t[95] = 124;
  33095. t[96] = 125;
  33096. t[97] = 126;
  33097. t[98] = 196;
  33098. t[99] = 197;
  33099. t[100] = 199;
  33100. t[101] = 201;
  33101. t[102] = 209;
  33102. t[103] = 214;
  33103. t[104] = 220;
  33104. t[105] = 225;
  33105. t[106] = 224;
  33106. t[107] = 226;
  33107. t[108] = 228;
  33108. t[109] = 227;
  33109. t[110] = 229;
  33110. t[111] = 231;
  33111. t[112] = 233;
  33112. t[113] = 232;
  33113. t[114] = 234;
  33114. t[115] = 235;
  33115. t[116] = 237;
  33116. t[117] = 236;
  33117. t[118] = 238;
  33118. t[119] = 239;
  33119. t[120] = 241;
  33120. t[121] = 243;
  33121. t[122] = 242;
  33122. t[123] = 244;
  33123. t[124] = 246;
  33124. t[125] = 245;
  33125. t[126] = 250;
  33126. t[127] = 249;
  33127. t[128] = 251;
  33128. t[129] = 252;
  33129. t[130] = 8224;
  33130. t[131] = 176;
  33131. t[132] = 162;
  33132. t[133] = 163;
  33133. t[134] = 167;
  33134. t[135] = 8226;
  33135. t[136] = 182;
  33136. t[137] = 223;
  33137. t[138] = 174;
  33138. t[139] = 169;
  33139. t[140] = 8482;
  33140. t[141] = 180;
  33141. t[142] = 168;
  33142. t[143] = 8800;
  33143. t[144] = 198;
  33144. t[145] = 216;
  33145. t[146] = 8734;
  33146. t[147] = 177;
  33147. t[148] = 8804;
  33148. t[149] = 8805;
  33149. t[150] = 165;
  33150. t[151] = 181;
  33151. t[152] = 8706;
  33152. t[153] = 8721;
  33153. t[154] = 8719;
  33154. t[156] = 8747;
  33155. t[157] = 170;
  33156. t[158] = 186;
  33157. t[159] = 8486;
  33158. t[160] = 230;
  33159. t[161] = 248;
  33160. t[162] = 191;
  33161. t[163] = 161;
  33162. t[164] = 172;
  33163. t[165] = 8730;
  33164. t[166] = 402;
  33165. t[167] = 8776;
  33166. t[168] = 8710;
  33167. t[169] = 171;
  33168. t[170] = 187;
  33169. t[171] = 8230;
  33170. t[210] = 218;
  33171. t[223] = 711;
  33172. t[224] = 321;
  33173. t[225] = 322;
  33174. t[227] = 353;
  33175. t[229] = 382;
  33176. t[234] = 253;
  33177. t[252] = 263;
  33178. t[253] = 268;
  33179. t[254] = 269;
  33180. t[258] = 258;
  33181. t[260] = 260;
  33182. t[261] = 261;
  33183. t[265] = 280;
  33184. t[266] = 281;
  33185. t[268] = 283;
  33186. t[269] = 313;
  33187. t[275] = 323;
  33188. t[276] = 324;
  33189. t[278] = 328;
  33190. t[284] = 345;
  33191. t[285] = 346;
  33192. t[286] = 347;
  33193. t[292] = 367;
  33194. t[295] = 377;
  33195. t[296] = 378;
  33196. t[298] = 380;
  33197. t[305] = 963;
  33198. t[306] = 964;
  33199. t[307] = 966;
  33200. t[308] = 8215;
  33201. t[309] = 8252;
  33202. t[310] = 8319;
  33203. t[311] = 8359;
  33204. t[312] = 8592;
  33205. t[313] = 8593;
  33206. t[337] = 9552;
  33207. t[493] = 1039;
  33208. t[494] = 1040;
  33209. t[705] = 1524;
  33210. t[706] = 8362;
  33211. t[710] = 64288;
  33212. t[711] = 64298;
  33213. t[759] = 1617;
  33214. t[761] = 1776;
  33215. t[763] = 1778;
  33216. t[775] = 1652;
  33217. t[777] = 1764;
  33218. t[778] = 1780;
  33219. t[779] = 1781;
  33220. t[780] = 1782;
  33221. t[782] = 771;
  33222. t[783] = 64726;
  33223. t[786] = 8363;
  33224. t[788] = 8532;
  33225. t[790] = 768;
  33226. t[791] = 769;
  33227. t[792] = 768;
  33228. t[795] = 803;
  33229. t[797] = 64336;
  33230. t[798] = 64337;
  33231. t[799] = 64342;
  33232. t[800] = 64343;
  33233. t[801] = 64344;
  33234. t[802] = 64345;
  33235. t[803] = 64362;
  33236. t[804] = 64363;
  33237. t[805] = 64364;
  33238. t[2424] = 7821;
  33239. t[2425] = 7822;
  33240. t[2426] = 7823;
  33241. t[2427] = 7824;
  33242. t[2428] = 7825;
  33243. t[2429] = 7826;
  33244. t[2430] = 7827;
  33245. t[2433] = 7682;
  33246. t[2678] = 8045;
  33247. t[2679] = 8046;
  33248. t[2830] = 1552;
  33249. t[2838] = 686;
  33250. t[2840] = 751;
  33251. t[2842] = 753;
  33252. t[2843] = 754;
  33253. t[2844] = 755;
  33254. t[2846] = 757;
  33255. t[2856] = 767;
  33256. t[2857] = 848;
  33257. t[2858] = 849;
  33258. t[2862] = 853;
  33259. t[2863] = 854;
  33260. t[2864] = 855;
  33261. t[2865] = 861;
  33262. t[2866] = 862;
  33263. t[2906] = 7460;
  33264. t[2908] = 7462;
  33265. t[2909] = 7463;
  33266. t[2910] = 7464;
  33267. t[2912] = 7466;
  33268. t[2913] = 7467;
  33269. t[2914] = 7468;
  33270. t[2916] = 7470;
  33271. t[2917] = 7471;
  33272. t[2918] = 7472;
  33273. t[2920] = 7474;
  33274. t[2921] = 7475;
  33275. t[2922] = 7476;
  33276. t[2924] = 7478;
  33277. t[2925] = 7479;
  33278. t[2926] = 7480;
  33279. t[2928] = 7482;
  33280. t[2929] = 7483;
  33281. t[2930] = 7484;
  33282. t[2932] = 7486;
  33283. t[2933] = 7487;
  33284. t[2934] = 7488;
  33285. t[2936] = 7490;
  33286. t[2937] = 7491;
  33287. t[2938] = 7492;
  33288. t[2940] = 7494;
  33289. t[2941] = 7495;
  33290. t[2942] = 7496;
  33291. t[2944] = 7498;
  33292. t[2946] = 7500;
  33293. t[2948] = 7502;
  33294. t[2950] = 7504;
  33295. t[2951] = 7505;
  33296. t[2952] = 7506;
  33297. t[2954] = 7508;
  33298. t[2955] = 7509;
  33299. t[2956] = 7510;
  33300. t[2958] = 7512;
  33301. t[2959] = 7513;
  33302. t[2960] = 7514;
  33303. t[2962] = 7516;
  33304. t[2963] = 7517;
  33305. t[2964] = 7518;
  33306. t[2966] = 7520;
  33307. t[2967] = 7521;
  33308. t[2968] = 7522;
  33309. t[2970] = 7524;
  33310. t[2971] = 7525;
  33311. t[2972] = 7526;
  33312. t[2974] = 7528;
  33313. t[2975] = 7529;
  33314. t[2976] = 7530;
  33315. t[2978] = 1537;
  33316. t[2979] = 1538;
  33317. t[2980] = 1539;
  33318. t[2982] = 1549;
  33319. t[2983] = 1551;
  33320. t[2984] = 1552;
  33321. t[2986] = 1554;
  33322. t[2987] = 1555;
  33323. t[2988] = 1556;
  33324. t[2990] = 1623;
  33325. t[2991] = 1624;
  33326. t[2995] = 1775;
  33327. t[2999] = 1791;
  33328. t[3002] = 64290;
  33329. t[3003] = 64291;
  33330. t[3004] = 64292;
  33331. t[3006] = 64294;
  33332. t[3007] = 64295;
  33333. t[3008] = 64296;
  33334. t[3011] = 1900;
  33335. t[3014] = 8223;
  33336. t[3015] = 8244;
  33337. t[3017] = 7532;
  33338. t[3018] = 7533;
  33339. t[3019] = 7534;
  33340. t[3075] = 7590;
  33341. t[3076] = 7591;
  33342. t[3079] = 7594;
  33343. t[3080] = 7595;
  33344. t[3083] = 7598;
  33345. t[3084] = 7599;
  33346. t[3087] = 7602;
  33347. t[3088] = 7603;
  33348. t[3091] = 7606;
  33349. t[3092] = 7607;
  33350. t[3095] = 7610;
  33351. t[3096] = 7611;
  33352. t[3099] = 7614;
  33353. t[3100] = 7615;
  33354. t[3103] = 7618;
  33355. t[3104] = 7619;
  33356. t[3107] = 8337;
  33357. t[3108] = 8338;
  33358. t[3116] = 1884;
  33359. t[3119] = 1885;
  33360. t[3120] = 1885;
  33361. t[3123] = 1886;
  33362. t[3124] = 1886;
  33363. t[3127] = 1887;
  33364. t[3128] = 1887;
  33365. t[3131] = 1888;
  33366. t[3132] = 1888;
  33367. t[3135] = 1889;
  33368. t[3136] = 1889;
  33369. t[3139] = 1890;
  33370. t[3140] = 1890;
  33371. t[3143] = 1891;
  33372. t[3144] = 1891;
  33373. t[3147] = 1892;
  33374. t[3148] = 1892;
  33375. t[3153] = 580;
  33376. t[3154] = 581;
  33377. t[3157] = 584;
  33378. t[3158] = 585;
  33379. t[3161] = 588;
  33380. t[3162] = 589;
  33381. t[3165] = 891;
  33382. t[3166] = 892;
  33383. t[3169] = 1274;
  33384. t[3170] = 1275;
  33385. t[3173] = 1278;
  33386. t[3174] = 1279;
  33387. t[3181] = 7622;
  33388. t[3182] = 7623;
  33389. t[3282] = 11799;
  33390. t[3316] = 578;
  33391. t[3379] = 42785;
  33392. t[3393] = 1159;
  33393. t[3416] = 8377;
  33394. });
  33395. var getSupplementalGlyphMapForArialBlack = getLookupTableFactory(function (t) {
  33396. t[227] = 322;
  33397. t[264] = 261;
  33398. t[291] = 346;
  33399. });
  33400. exports.getStdFontMap = getStdFontMap;
  33401. exports.getNonStdFontMap = getNonStdFontMap;
  33402. exports.getSerifFonts = getSerifFonts;
  33403. exports.getSymbolsFonts = getSymbolsFonts;
  33404. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  33405. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  33406. /***/ }),
  33407. /* 17 */
  33408. /***/ (function(module, exports, __w_pdfjs_require__) {
  33409. "use strict";
  33410. var sharedUtil = __w_pdfjs_require__(0);
  33411. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  33412. var getSpecialPUASymbols = getLookupTableFactory(function (t) {
  33413. t[63721] = 0x00A9;
  33414. t[63193] = 0x00A9;
  33415. t[63720] = 0x00AE;
  33416. t[63194] = 0x00AE;
  33417. t[63722] = 0x2122;
  33418. t[63195] = 0x2122;
  33419. t[63729] = 0x23A7;
  33420. t[63730] = 0x23A8;
  33421. t[63731] = 0x23A9;
  33422. t[63740] = 0x23AB;
  33423. t[63741] = 0x23AC;
  33424. t[63742] = 0x23AD;
  33425. t[63726] = 0x23A1;
  33426. t[63727] = 0x23A2;
  33427. t[63728] = 0x23A3;
  33428. t[63737] = 0x23A4;
  33429. t[63738] = 0x23A5;
  33430. t[63739] = 0x23A6;
  33431. t[63723] = 0x239B;
  33432. t[63724] = 0x239C;
  33433. t[63725] = 0x239D;
  33434. t[63734] = 0x239E;
  33435. t[63735] = 0x239F;
  33436. t[63736] = 0x23A0;
  33437. });
  33438. function mapSpecialUnicodeValues(code) {
  33439. if (code >= 0xFFF0 && code <= 0xFFFF) {
  33440. return 0;
  33441. } else if (code >= 0xF600 && code <= 0xF8FF) {
  33442. return getSpecialPUASymbols()[code] || code;
  33443. }
  33444. return code;
  33445. }
  33446. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  33447. var unicode = glyphsUnicodeMap[name];
  33448. if (unicode !== undefined) {
  33449. return unicode;
  33450. }
  33451. if (!name) {
  33452. return -1;
  33453. }
  33454. if (name[0] === 'u') {
  33455. var nameLen = name.length, hexStr;
  33456. if (nameLen === 7 && name[1] === 'n' && name[2] === 'i') {
  33457. hexStr = name.substr(3);
  33458. } else if (nameLen >= 5 && nameLen <= 7) {
  33459. hexStr = name.substr(1);
  33460. } else {
  33461. return -1;
  33462. }
  33463. if (hexStr === hexStr.toUpperCase()) {
  33464. unicode = parseInt(hexStr, 16);
  33465. if (unicode >= 0) {
  33466. return unicode;
  33467. }
  33468. }
  33469. }
  33470. return -1;
  33471. }
  33472. var UnicodeRanges = [
  33473. {
  33474. 'begin': 0x0000,
  33475. 'end': 0x007F
  33476. },
  33477. {
  33478. 'begin': 0x0080,
  33479. 'end': 0x00FF
  33480. },
  33481. {
  33482. 'begin': 0x0100,
  33483. 'end': 0x017F
  33484. },
  33485. {
  33486. 'begin': 0x0180,
  33487. 'end': 0x024F
  33488. },
  33489. {
  33490. 'begin': 0x0250,
  33491. 'end': 0x02AF
  33492. },
  33493. {
  33494. 'begin': 0x02B0,
  33495. 'end': 0x02FF
  33496. },
  33497. {
  33498. 'begin': 0x0300,
  33499. 'end': 0x036F
  33500. },
  33501. {
  33502. 'begin': 0x0370,
  33503. 'end': 0x03FF
  33504. },
  33505. {
  33506. 'begin': 0x2C80,
  33507. 'end': 0x2CFF
  33508. },
  33509. {
  33510. 'begin': 0x0400,
  33511. 'end': 0x04FF
  33512. },
  33513. {
  33514. 'begin': 0x0530,
  33515. 'end': 0x058F
  33516. },
  33517. {
  33518. 'begin': 0x0590,
  33519. 'end': 0x05FF
  33520. },
  33521. {
  33522. 'begin': 0xA500,
  33523. 'end': 0xA63F
  33524. },
  33525. {
  33526. 'begin': 0x0600,
  33527. 'end': 0x06FF
  33528. },
  33529. {
  33530. 'begin': 0x07C0,
  33531. 'end': 0x07FF
  33532. },
  33533. {
  33534. 'begin': 0x0900,
  33535. 'end': 0x097F
  33536. },
  33537. {
  33538. 'begin': 0x0980,
  33539. 'end': 0x09FF
  33540. },
  33541. {
  33542. 'begin': 0x0A00,
  33543. 'end': 0x0A7F
  33544. },
  33545. {
  33546. 'begin': 0x0A80,
  33547. 'end': 0x0AFF
  33548. },
  33549. {
  33550. 'begin': 0x0B00,
  33551. 'end': 0x0B7F
  33552. },
  33553. {
  33554. 'begin': 0x0B80,
  33555. 'end': 0x0BFF
  33556. },
  33557. {
  33558. 'begin': 0x0C00,
  33559. 'end': 0x0C7F
  33560. },
  33561. {
  33562. 'begin': 0x0C80,
  33563. 'end': 0x0CFF
  33564. },
  33565. {
  33566. 'begin': 0x0D00,
  33567. 'end': 0x0D7F
  33568. },
  33569. {
  33570. 'begin': 0x0E00,
  33571. 'end': 0x0E7F
  33572. },
  33573. {
  33574. 'begin': 0x0E80,
  33575. 'end': 0x0EFF
  33576. },
  33577. {
  33578. 'begin': 0x10A0,
  33579. 'end': 0x10FF
  33580. },
  33581. {
  33582. 'begin': 0x1B00,
  33583. 'end': 0x1B7F
  33584. },
  33585. {
  33586. 'begin': 0x1100,
  33587. 'end': 0x11FF
  33588. },
  33589. {
  33590. 'begin': 0x1E00,
  33591. 'end': 0x1EFF
  33592. },
  33593. {
  33594. 'begin': 0x1F00,
  33595. 'end': 0x1FFF
  33596. },
  33597. {
  33598. 'begin': 0x2000,
  33599. 'end': 0x206F
  33600. },
  33601. {
  33602. 'begin': 0x2070,
  33603. 'end': 0x209F
  33604. },
  33605. {
  33606. 'begin': 0x20A0,
  33607. 'end': 0x20CF
  33608. },
  33609. {
  33610. 'begin': 0x20D0,
  33611. 'end': 0x20FF
  33612. },
  33613. {
  33614. 'begin': 0x2100,
  33615. 'end': 0x214F
  33616. },
  33617. {
  33618. 'begin': 0x2150,
  33619. 'end': 0x218F
  33620. },
  33621. {
  33622. 'begin': 0x2190,
  33623. 'end': 0x21FF
  33624. },
  33625. {
  33626. 'begin': 0x2200,
  33627. 'end': 0x22FF
  33628. },
  33629. {
  33630. 'begin': 0x2300,
  33631. 'end': 0x23FF
  33632. },
  33633. {
  33634. 'begin': 0x2400,
  33635. 'end': 0x243F
  33636. },
  33637. {
  33638. 'begin': 0x2440,
  33639. 'end': 0x245F
  33640. },
  33641. {
  33642. 'begin': 0x2460,
  33643. 'end': 0x24FF
  33644. },
  33645. {
  33646. 'begin': 0x2500,
  33647. 'end': 0x257F
  33648. },
  33649. {
  33650. 'begin': 0x2580,
  33651. 'end': 0x259F
  33652. },
  33653. {
  33654. 'begin': 0x25A0,
  33655. 'end': 0x25FF
  33656. },
  33657. {
  33658. 'begin': 0x2600,
  33659. 'end': 0x26FF
  33660. },
  33661. {
  33662. 'begin': 0x2700,
  33663. 'end': 0x27BF
  33664. },
  33665. {
  33666. 'begin': 0x3000,
  33667. 'end': 0x303F
  33668. },
  33669. {
  33670. 'begin': 0x3040,
  33671. 'end': 0x309F
  33672. },
  33673. {
  33674. 'begin': 0x30A0,
  33675. 'end': 0x30FF
  33676. },
  33677. {
  33678. 'begin': 0x3100,
  33679. 'end': 0x312F
  33680. },
  33681. {
  33682. 'begin': 0x3130,
  33683. 'end': 0x318F
  33684. },
  33685. {
  33686. 'begin': 0xA840,
  33687. 'end': 0xA87F
  33688. },
  33689. {
  33690. 'begin': 0x3200,
  33691. 'end': 0x32FF
  33692. },
  33693. {
  33694. 'begin': 0x3300,
  33695. 'end': 0x33FF
  33696. },
  33697. {
  33698. 'begin': 0xAC00,
  33699. 'end': 0xD7AF
  33700. },
  33701. {
  33702. 'begin': 0xD800,
  33703. 'end': 0xDFFF
  33704. },
  33705. {
  33706. 'begin': 0x10900,
  33707. 'end': 0x1091F
  33708. },
  33709. {
  33710. 'begin': 0x4E00,
  33711. 'end': 0x9FFF
  33712. },
  33713. {
  33714. 'begin': 0xE000,
  33715. 'end': 0xF8FF
  33716. },
  33717. {
  33718. 'begin': 0x31C0,
  33719. 'end': 0x31EF
  33720. },
  33721. {
  33722. 'begin': 0xFB00,
  33723. 'end': 0xFB4F
  33724. },
  33725. {
  33726. 'begin': 0xFB50,
  33727. 'end': 0xFDFF
  33728. },
  33729. {
  33730. 'begin': 0xFE20,
  33731. 'end': 0xFE2F
  33732. },
  33733. {
  33734. 'begin': 0xFE10,
  33735. 'end': 0xFE1F
  33736. },
  33737. {
  33738. 'begin': 0xFE50,
  33739. 'end': 0xFE6F
  33740. },
  33741. {
  33742. 'begin': 0xFE70,
  33743. 'end': 0xFEFF
  33744. },
  33745. {
  33746. 'begin': 0xFF00,
  33747. 'end': 0xFFEF
  33748. },
  33749. {
  33750. 'begin': 0xFFF0,
  33751. 'end': 0xFFFF
  33752. },
  33753. {
  33754. 'begin': 0x0F00,
  33755. 'end': 0x0FFF
  33756. },
  33757. {
  33758. 'begin': 0x0700,
  33759. 'end': 0x074F
  33760. },
  33761. {
  33762. 'begin': 0x0780,
  33763. 'end': 0x07BF
  33764. },
  33765. {
  33766. 'begin': 0x0D80,
  33767. 'end': 0x0DFF
  33768. },
  33769. {
  33770. 'begin': 0x1000,
  33771. 'end': 0x109F
  33772. },
  33773. {
  33774. 'begin': 0x1200,
  33775. 'end': 0x137F
  33776. },
  33777. {
  33778. 'begin': 0x13A0,
  33779. 'end': 0x13FF
  33780. },
  33781. {
  33782. 'begin': 0x1400,
  33783. 'end': 0x167F
  33784. },
  33785. {
  33786. 'begin': 0x1680,
  33787. 'end': 0x169F
  33788. },
  33789. {
  33790. 'begin': 0x16A0,
  33791. 'end': 0x16FF
  33792. },
  33793. {
  33794. 'begin': 0x1780,
  33795. 'end': 0x17FF
  33796. },
  33797. {
  33798. 'begin': 0x1800,
  33799. 'end': 0x18AF
  33800. },
  33801. {
  33802. 'begin': 0x2800,
  33803. 'end': 0x28FF
  33804. },
  33805. {
  33806. 'begin': 0xA000,
  33807. 'end': 0xA48F
  33808. },
  33809. {
  33810. 'begin': 0x1700,
  33811. 'end': 0x171F
  33812. },
  33813. {
  33814. 'begin': 0x10300,
  33815. 'end': 0x1032F
  33816. },
  33817. {
  33818. 'begin': 0x10330,
  33819. 'end': 0x1034F
  33820. },
  33821. {
  33822. 'begin': 0x10400,
  33823. 'end': 0x1044F
  33824. },
  33825. {
  33826. 'begin': 0x1D000,
  33827. 'end': 0x1D0FF
  33828. },
  33829. {
  33830. 'begin': 0x1D400,
  33831. 'end': 0x1D7FF
  33832. },
  33833. {
  33834. 'begin': 0xFF000,
  33835. 'end': 0xFFFFD
  33836. },
  33837. {
  33838. 'begin': 0xFE00,
  33839. 'end': 0xFE0F
  33840. },
  33841. {
  33842. 'begin': 0xE0000,
  33843. 'end': 0xE007F
  33844. },
  33845. {
  33846. 'begin': 0x1900,
  33847. 'end': 0x194F
  33848. },
  33849. {
  33850. 'begin': 0x1950,
  33851. 'end': 0x197F
  33852. },
  33853. {
  33854. 'begin': 0x1980,
  33855. 'end': 0x19DF
  33856. },
  33857. {
  33858. 'begin': 0x1A00,
  33859. 'end': 0x1A1F
  33860. },
  33861. {
  33862. 'begin': 0x2C00,
  33863. 'end': 0x2C5F
  33864. },
  33865. {
  33866. 'begin': 0x2D30,
  33867. 'end': 0x2D7F
  33868. },
  33869. {
  33870. 'begin': 0x4DC0,
  33871. 'end': 0x4DFF
  33872. },
  33873. {
  33874. 'begin': 0xA800,
  33875. 'end': 0xA82F
  33876. },
  33877. {
  33878. 'begin': 0x10000,
  33879. 'end': 0x1007F
  33880. },
  33881. {
  33882. 'begin': 0x10140,
  33883. 'end': 0x1018F
  33884. },
  33885. {
  33886. 'begin': 0x10380,
  33887. 'end': 0x1039F
  33888. },
  33889. {
  33890. 'begin': 0x103A0,
  33891. 'end': 0x103DF
  33892. },
  33893. {
  33894. 'begin': 0x10450,
  33895. 'end': 0x1047F
  33896. },
  33897. {
  33898. 'begin': 0x10480,
  33899. 'end': 0x104AF
  33900. },
  33901. {
  33902. 'begin': 0x10800,
  33903. 'end': 0x1083F
  33904. },
  33905. {
  33906. 'begin': 0x10A00,
  33907. 'end': 0x10A5F
  33908. },
  33909. {
  33910. 'begin': 0x1D300,
  33911. 'end': 0x1D35F
  33912. },
  33913. {
  33914. 'begin': 0x12000,
  33915. 'end': 0x123FF
  33916. },
  33917. {
  33918. 'begin': 0x1D360,
  33919. 'end': 0x1D37F
  33920. },
  33921. {
  33922. 'begin': 0x1B80,
  33923. 'end': 0x1BBF
  33924. },
  33925. {
  33926. 'begin': 0x1C00,
  33927. 'end': 0x1C4F
  33928. },
  33929. {
  33930. 'begin': 0x1C50,
  33931. 'end': 0x1C7F
  33932. },
  33933. {
  33934. 'begin': 0xA880,
  33935. 'end': 0xA8DF
  33936. },
  33937. {
  33938. 'begin': 0xA900,
  33939. 'end': 0xA92F
  33940. },
  33941. {
  33942. 'begin': 0xA930,
  33943. 'end': 0xA95F
  33944. },
  33945. {
  33946. 'begin': 0xAA00,
  33947. 'end': 0xAA5F
  33948. },
  33949. {
  33950. 'begin': 0x10190,
  33951. 'end': 0x101CF
  33952. },
  33953. {
  33954. 'begin': 0x101D0,
  33955. 'end': 0x101FF
  33956. },
  33957. {
  33958. 'begin': 0x102A0,
  33959. 'end': 0x102DF
  33960. },
  33961. {
  33962. 'begin': 0x1F030,
  33963. 'end': 0x1F09F
  33964. }
  33965. ];
  33966. function getUnicodeRangeFor(value) {
  33967. for (var i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  33968. var range = UnicodeRanges[i];
  33969. if (value >= range.begin && value < range.end) {
  33970. return i;
  33971. }
  33972. }
  33973. return -1;
  33974. }
  33975. function isRTLRangeFor(value) {
  33976. var range = UnicodeRanges[13];
  33977. if (value >= range.begin && value < range.end) {
  33978. return true;
  33979. }
  33980. range = UnicodeRanges[11];
  33981. if (value >= range.begin && value < range.end) {
  33982. return true;
  33983. }
  33984. return false;
  33985. }
  33986. var getNormalizedUnicodes = getLookupTableFactory(function (t) {
  33987. t['\u00A8'] = '\u0020\u0308';
  33988. t['\u00AF'] = '\u0020\u0304';
  33989. t['\u00B4'] = '\u0020\u0301';
  33990. t['\u00B5'] = '\u03BC';
  33991. t['\u00B8'] = '\u0020\u0327';
  33992. t['\u0132'] = '\u0049\u004A';
  33993. t['\u0133'] = '\u0069\u006A';
  33994. t['\u013F'] = '\u004C\u00B7';
  33995. t['\u0140'] = '\u006C\u00B7';
  33996. t['\u0149'] = '\u02BC\u006E';
  33997. t['\u017F'] = '\u0073';
  33998. t['\u01C4'] = '\u0044\u017D';
  33999. t['\u01C5'] = '\u0044\u017E';
  34000. t['\u01C6'] = '\u0064\u017E';
  34001. t['\u01C7'] = '\u004C\u004A';
  34002. t['\u01C8'] = '\u004C\u006A';
  34003. t['\u01C9'] = '\u006C\u006A';
  34004. t['\u01CA'] = '\u004E\u004A';
  34005. t['\u01CB'] = '\u004E\u006A';
  34006. t['\u01CC'] = '\u006E\u006A';
  34007. t['\u01F1'] = '\u0044\u005A';
  34008. t['\u01F2'] = '\u0044\u007A';
  34009. t['\u01F3'] = '\u0064\u007A';
  34010. t['\u02D8'] = '\u0020\u0306';
  34011. t['\u02D9'] = '\u0020\u0307';
  34012. t['\u02DA'] = '\u0020\u030A';
  34013. t['\u02DB'] = '\u0020\u0328';
  34014. t['\u02DC'] = '\u0020\u0303';
  34015. t['\u02DD'] = '\u0020\u030B';
  34016. t['\u037A'] = '\u0020\u0345';
  34017. t['\u0384'] = '\u0020\u0301';
  34018. t['\u03D0'] = '\u03B2';
  34019. t['\u03D1'] = '\u03B8';
  34020. t['\u03D2'] = '\u03A5';
  34021. t['\u03D5'] = '\u03C6';
  34022. t['\u03D6'] = '\u03C0';
  34023. t['\u03F0'] = '\u03BA';
  34024. t['\u03F1'] = '\u03C1';
  34025. t['\u03F2'] = '\u03C2';
  34026. t['\u03F4'] = '\u0398';
  34027. t['\u03F5'] = '\u03B5';
  34028. t['\u03F9'] = '\u03A3';
  34029. t['\u0587'] = '\u0565\u0582';
  34030. t['\u0675'] = '\u0627\u0674';
  34031. t['\u0676'] = '\u0648\u0674';
  34032. t['\u0677'] = '\u06C7\u0674';
  34033. t['\u0678'] = '\u064A\u0674';
  34034. t['\u0E33'] = '\u0E4D\u0E32';
  34035. t['\u0EB3'] = '\u0ECD\u0EB2';
  34036. t['\u0EDC'] = '\u0EAB\u0E99';
  34037. t['\u0EDD'] = '\u0EAB\u0EA1';
  34038. t['\u0F77'] = '\u0FB2\u0F81';
  34039. t['\u0F79'] = '\u0FB3\u0F81';
  34040. t['\u1E9A'] = '\u0061\u02BE';
  34041. t['\u1FBD'] = '\u0020\u0313';
  34042. t['\u1FBF'] = '\u0020\u0313';
  34043. t['\u1FC0'] = '\u0020\u0342';
  34044. t['\u1FFE'] = '\u0020\u0314';
  34045. t['\u2002'] = '\u0020';
  34046. t['\u2003'] = '\u0020';
  34047. t['\u2004'] = '\u0020';
  34048. t['\u2005'] = '\u0020';
  34049. t['\u2006'] = '\u0020';
  34050. t['\u2008'] = '\u0020';
  34051. t['\u2009'] = '\u0020';
  34052. t['\u200A'] = '\u0020';
  34053. t['\u2017'] = '\u0020\u0333';
  34054. t['\u2024'] = '\u002E';
  34055. t['\u2025'] = '\u002E\u002E';
  34056. t['\u2026'] = '\u002E\u002E\u002E';
  34057. t['\u2033'] = '\u2032\u2032';
  34058. t['\u2034'] = '\u2032\u2032\u2032';
  34059. t['\u2036'] = '\u2035\u2035';
  34060. t['\u2037'] = '\u2035\u2035\u2035';
  34061. t['\u203C'] = '\u0021\u0021';
  34062. t['\u203E'] = '\u0020\u0305';
  34063. t['\u2047'] = '\u003F\u003F';
  34064. t['\u2048'] = '\u003F\u0021';
  34065. t['\u2049'] = '\u0021\u003F';
  34066. t['\u2057'] = '\u2032\u2032\u2032\u2032';
  34067. t['\u205F'] = '\u0020';
  34068. t['\u20A8'] = '\u0052\u0073';
  34069. t['\u2100'] = '\u0061\u002F\u0063';
  34070. t['\u2101'] = '\u0061\u002F\u0073';
  34071. t['\u2103'] = '\u00B0\u0043';
  34072. t['\u2105'] = '\u0063\u002F\u006F';
  34073. t['\u2106'] = '\u0063\u002F\u0075';
  34074. t['\u2107'] = '\u0190';
  34075. t['\u2109'] = '\u00B0\u0046';
  34076. t['\u2116'] = '\u004E\u006F';
  34077. t['\u2121'] = '\u0054\u0045\u004C';
  34078. t['\u2135'] = '\u05D0';
  34079. t['\u2136'] = '\u05D1';
  34080. t['\u2137'] = '\u05D2';
  34081. t['\u2138'] = '\u05D3';
  34082. t['\u213B'] = '\u0046\u0041\u0058';
  34083. t['\u2160'] = '\u0049';
  34084. t['\u2161'] = '\u0049\u0049';
  34085. t['\u2162'] = '\u0049\u0049\u0049';
  34086. t['\u2163'] = '\u0049\u0056';
  34087. t['\u2164'] = '\u0056';
  34088. t['\u2165'] = '\u0056\u0049';
  34089. t['\u2166'] = '\u0056\u0049\u0049';
  34090. t['\u2167'] = '\u0056\u0049\u0049\u0049';
  34091. t['\u2168'] = '\u0049\u0058';
  34092. t['\u2169'] = '\u0058';
  34093. t['\u216A'] = '\u0058\u0049';
  34094. t['\u216B'] = '\u0058\u0049\u0049';
  34095. t['\u216C'] = '\u004C';
  34096. t['\u216D'] = '\u0043';
  34097. t['\u216E'] = '\u0044';
  34098. t['\u216F'] = '\u004D';
  34099. t['\u2170'] = '\u0069';
  34100. t['\u2171'] = '\u0069\u0069';
  34101. t['\u2172'] = '\u0069\u0069\u0069';
  34102. t['\u2173'] = '\u0069\u0076';
  34103. t['\u2174'] = '\u0076';
  34104. t['\u2175'] = '\u0076\u0069';
  34105. t['\u2176'] = '\u0076\u0069\u0069';
  34106. t['\u2177'] = '\u0076\u0069\u0069\u0069';
  34107. t['\u2178'] = '\u0069\u0078';
  34108. t['\u2179'] = '\u0078';
  34109. t['\u217A'] = '\u0078\u0069';
  34110. t['\u217B'] = '\u0078\u0069\u0069';
  34111. t['\u217C'] = '\u006C';
  34112. t['\u217D'] = '\u0063';
  34113. t['\u217E'] = '\u0064';
  34114. t['\u217F'] = '\u006D';
  34115. t['\u222C'] = '\u222B\u222B';
  34116. t['\u222D'] = '\u222B\u222B\u222B';
  34117. t['\u222F'] = '\u222E\u222E';
  34118. t['\u2230'] = '\u222E\u222E\u222E';
  34119. t['\u2474'] = '\u0028\u0031\u0029';
  34120. t['\u2475'] = '\u0028\u0032\u0029';
  34121. t['\u2476'] = '\u0028\u0033\u0029';
  34122. t['\u2477'] = '\u0028\u0034\u0029';
  34123. t['\u2478'] = '\u0028\u0035\u0029';
  34124. t['\u2479'] = '\u0028\u0036\u0029';
  34125. t['\u247A'] = '\u0028\u0037\u0029';
  34126. t['\u247B'] = '\u0028\u0038\u0029';
  34127. t['\u247C'] = '\u0028\u0039\u0029';
  34128. t['\u247D'] = '\u0028\u0031\u0030\u0029';
  34129. t['\u247E'] = '\u0028\u0031\u0031\u0029';
  34130. t['\u247F'] = '\u0028\u0031\u0032\u0029';
  34131. t['\u2480'] = '\u0028\u0031\u0033\u0029';
  34132. t['\u2481'] = '\u0028\u0031\u0034\u0029';
  34133. t['\u2482'] = '\u0028\u0031\u0035\u0029';
  34134. t['\u2483'] = '\u0028\u0031\u0036\u0029';
  34135. t['\u2484'] = '\u0028\u0031\u0037\u0029';
  34136. t['\u2485'] = '\u0028\u0031\u0038\u0029';
  34137. t['\u2486'] = '\u0028\u0031\u0039\u0029';
  34138. t['\u2487'] = '\u0028\u0032\u0030\u0029';
  34139. t['\u2488'] = '\u0031\u002E';
  34140. t['\u2489'] = '\u0032\u002E';
  34141. t['\u248A'] = '\u0033\u002E';
  34142. t['\u248B'] = '\u0034\u002E';
  34143. t['\u248C'] = '\u0035\u002E';
  34144. t['\u248D'] = '\u0036\u002E';
  34145. t['\u248E'] = '\u0037\u002E';
  34146. t['\u248F'] = '\u0038\u002E';
  34147. t['\u2490'] = '\u0039\u002E';
  34148. t['\u2491'] = '\u0031\u0030\u002E';
  34149. t['\u2492'] = '\u0031\u0031\u002E';
  34150. t['\u2493'] = '\u0031\u0032\u002E';
  34151. t['\u2494'] = '\u0031\u0033\u002E';
  34152. t['\u2495'] = '\u0031\u0034\u002E';
  34153. t['\u2496'] = '\u0031\u0035\u002E';
  34154. t['\u2497'] = '\u0031\u0036\u002E';
  34155. t['\u2498'] = '\u0031\u0037\u002E';
  34156. t['\u2499'] = '\u0031\u0038\u002E';
  34157. t['\u249A'] = '\u0031\u0039\u002E';
  34158. t['\u249B'] = '\u0032\u0030\u002E';
  34159. t['\u249C'] = '\u0028\u0061\u0029';
  34160. t['\u249D'] = '\u0028\u0062\u0029';
  34161. t['\u249E'] = '\u0028\u0063\u0029';
  34162. t['\u249F'] = '\u0028\u0064\u0029';
  34163. t['\u24A0'] = '\u0028\u0065\u0029';
  34164. t['\u24A1'] = '\u0028\u0066\u0029';
  34165. t['\u24A2'] = '\u0028\u0067\u0029';
  34166. t['\u24A3'] = '\u0028\u0068\u0029';
  34167. t['\u24A4'] = '\u0028\u0069\u0029';
  34168. t['\u24A5'] = '\u0028\u006A\u0029';
  34169. t['\u24A6'] = '\u0028\u006B\u0029';
  34170. t['\u24A7'] = '\u0028\u006C\u0029';
  34171. t['\u24A8'] = '\u0028\u006D\u0029';
  34172. t['\u24A9'] = '\u0028\u006E\u0029';
  34173. t['\u24AA'] = '\u0028\u006F\u0029';
  34174. t['\u24AB'] = '\u0028\u0070\u0029';
  34175. t['\u24AC'] = '\u0028\u0071\u0029';
  34176. t['\u24AD'] = '\u0028\u0072\u0029';
  34177. t['\u24AE'] = '\u0028\u0073\u0029';
  34178. t['\u24AF'] = '\u0028\u0074\u0029';
  34179. t['\u24B0'] = '\u0028\u0075\u0029';
  34180. t['\u24B1'] = '\u0028\u0076\u0029';
  34181. t['\u24B2'] = '\u0028\u0077\u0029';
  34182. t['\u24B3'] = '\u0028\u0078\u0029';
  34183. t['\u24B4'] = '\u0028\u0079\u0029';
  34184. t['\u24B5'] = '\u0028\u007A\u0029';
  34185. t['\u2A0C'] = '\u222B\u222B\u222B\u222B';
  34186. t['\u2A74'] = '\u003A\u003A\u003D';
  34187. t['\u2A75'] = '\u003D\u003D';
  34188. t['\u2A76'] = '\u003D\u003D\u003D';
  34189. t['\u2E9F'] = '\u6BCD';
  34190. t['\u2EF3'] = '\u9F9F';
  34191. t['\u2F00'] = '\u4E00';
  34192. t['\u2F01'] = '\u4E28';
  34193. t['\u2F02'] = '\u4E36';
  34194. t['\u2F03'] = '\u4E3F';
  34195. t['\u2F04'] = '\u4E59';
  34196. t['\u2F05'] = '\u4E85';
  34197. t['\u2F06'] = '\u4E8C';
  34198. t['\u2F07'] = '\u4EA0';
  34199. t['\u2F08'] = '\u4EBA';
  34200. t['\u2F09'] = '\u513F';
  34201. t['\u2F0A'] = '\u5165';
  34202. t['\u2F0B'] = '\u516B';
  34203. t['\u2F0C'] = '\u5182';
  34204. t['\u2F0D'] = '\u5196';
  34205. t['\u2F0E'] = '\u51AB';
  34206. t['\u2F0F'] = '\u51E0';
  34207. t['\u2F10'] = '\u51F5';
  34208. t['\u2F11'] = '\u5200';
  34209. t['\u2F12'] = '\u529B';
  34210. t['\u2F13'] = '\u52F9';
  34211. t['\u2F14'] = '\u5315';
  34212. t['\u2F15'] = '\u531A';
  34213. t['\u2F16'] = '\u5338';
  34214. t['\u2F17'] = '\u5341';
  34215. t['\u2F18'] = '\u535C';
  34216. t['\u2F19'] = '\u5369';
  34217. t['\u2F1A'] = '\u5382';
  34218. t['\u2F1B'] = '\u53B6';
  34219. t['\u2F1C'] = '\u53C8';
  34220. t['\u2F1D'] = '\u53E3';
  34221. t['\u2F1E'] = '\u56D7';
  34222. t['\u2F1F'] = '\u571F';
  34223. t['\u2F20'] = '\u58EB';
  34224. t['\u2F21'] = '\u5902';
  34225. t['\u2F22'] = '\u590A';
  34226. t['\u2F23'] = '\u5915';
  34227. t['\u2F24'] = '\u5927';
  34228. t['\u2F25'] = '\u5973';
  34229. t['\u2F26'] = '\u5B50';
  34230. t['\u2F27'] = '\u5B80';
  34231. t['\u2F28'] = '\u5BF8';
  34232. t['\u2F29'] = '\u5C0F';
  34233. t['\u2F2A'] = '\u5C22';
  34234. t['\u2F2B'] = '\u5C38';
  34235. t['\u2F2C'] = '\u5C6E';
  34236. t['\u2F2D'] = '\u5C71';
  34237. t['\u2F2E'] = '\u5DDB';
  34238. t['\u2F2F'] = '\u5DE5';
  34239. t['\u2F30'] = '\u5DF1';
  34240. t['\u2F31'] = '\u5DFE';
  34241. t['\u2F32'] = '\u5E72';
  34242. t['\u2F33'] = '\u5E7A';
  34243. t['\u2F34'] = '\u5E7F';
  34244. t['\u2F35'] = '\u5EF4';
  34245. t['\u2F36'] = '\u5EFE';
  34246. t['\u2F37'] = '\u5F0B';
  34247. t['\u2F38'] = '\u5F13';
  34248. t['\u2F39'] = '\u5F50';
  34249. t['\u2F3A'] = '\u5F61';
  34250. t['\u2F3B'] = '\u5F73';
  34251. t['\u2F3C'] = '\u5FC3';
  34252. t['\u2F3D'] = '\u6208';
  34253. t['\u2F3E'] = '\u6236';
  34254. t['\u2F3F'] = '\u624B';
  34255. t['\u2F40'] = '\u652F';
  34256. t['\u2F41'] = '\u6534';
  34257. t['\u2F42'] = '\u6587';
  34258. t['\u2F43'] = '\u6597';
  34259. t['\u2F44'] = '\u65A4';
  34260. t['\u2F45'] = '\u65B9';
  34261. t['\u2F46'] = '\u65E0';
  34262. t['\u2F47'] = '\u65E5';
  34263. t['\u2F48'] = '\u66F0';
  34264. t['\u2F49'] = '\u6708';
  34265. t['\u2F4A'] = '\u6728';
  34266. t['\u2F4B'] = '\u6B20';
  34267. t['\u2F4C'] = '\u6B62';
  34268. t['\u2F4D'] = '\u6B79';
  34269. t['\u2F4E'] = '\u6BB3';
  34270. t['\u2F4F'] = '\u6BCB';
  34271. t['\u2F50'] = '\u6BD4';
  34272. t['\u2F51'] = '\u6BDB';
  34273. t['\u2F52'] = '\u6C0F';
  34274. t['\u2F53'] = '\u6C14';
  34275. t['\u2F54'] = '\u6C34';
  34276. t['\u2F55'] = '\u706B';
  34277. t['\u2F56'] = '\u722A';
  34278. t['\u2F57'] = '\u7236';
  34279. t['\u2F58'] = '\u723B';
  34280. t['\u2F59'] = '\u723F';
  34281. t['\u2F5A'] = '\u7247';
  34282. t['\u2F5B'] = '\u7259';
  34283. t['\u2F5C'] = '\u725B';
  34284. t['\u2F5D'] = '\u72AC';
  34285. t['\u2F5E'] = '\u7384';
  34286. t['\u2F5F'] = '\u7389';
  34287. t['\u2F60'] = '\u74DC';
  34288. t['\u2F61'] = '\u74E6';
  34289. t['\u2F62'] = '\u7518';
  34290. t['\u2F63'] = '\u751F';
  34291. t['\u2F64'] = '\u7528';
  34292. t['\u2F65'] = '\u7530';
  34293. t['\u2F66'] = '\u758B';
  34294. t['\u2F67'] = '\u7592';
  34295. t['\u2F68'] = '\u7676';
  34296. t['\u2F69'] = '\u767D';
  34297. t['\u2F6A'] = '\u76AE';
  34298. t['\u2F6B'] = '\u76BF';
  34299. t['\u2F6C'] = '\u76EE';
  34300. t['\u2F6D'] = '\u77DB';
  34301. t['\u2F6E'] = '\u77E2';
  34302. t['\u2F6F'] = '\u77F3';
  34303. t['\u2F70'] = '\u793A';
  34304. t['\u2F71'] = '\u79B8';
  34305. t['\u2F72'] = '\u79BE';
  34306. t['\u2F73'] = '\u7A74';
  34307. t['\u2F74'] = '\u7ACB';
  34308. t['\u2F75'] = '\u7AF9';
  34309. t['\u2F76'] = '\u7C73';
  34310. t['\u2F77'] = '\u7CF8';
  34311. t['\u2F78'] = '\u7F36';
  34312. t['\u2F79'] = '\u7F51';
  34313. t['\u2F7A'] = '\u7F8A';
  34314. t['\u2F7B'] = '\u7FBD';
  34315. t['\u2F7C'] = '\u8001';
  34316. t['\u2F7D'] = '\u800C';
  34317. t['\u2F7E'] = '\u8012';
  34318. t['\u2F7F'] = '\u8033';
  34319. t['\u2F80'] = '\u807F';
  34320. t['\u2F81'] = '\u8089';
  34321. t['\u2F82'] = '\u81E3';
  34322. t['\u2F83'] = '\u81EA';
  34323. t['\u2F84'] = '\u81F3';
  34324. t['\u2F85'] = '\u81FC';
  34325. t['\u2F86'] = '\u820C';
  34326. t['\u2F87'] = '\u821B';
  34327. t['\u2F88'] = '\u821F';
  34328. t['\u2F89'] = '\u826E';
  34329. t['\u2F8A'] = '\u8272';
  34330. t['\u2F8B'] = '\u8278';
  34331. t['\u2F8C'] = '\u864D';
  34332. t['\u2F8D'] = '\u866B';
  34333. t['\u2F8E'] = '\u8840';
  34334. t['\u2F8F'] = '\u884C';
  34335. t['\u2F90'] = '\u8863';
  34336. t['\u2F91'] = '\u897E';
  34337. t['\u2F92'] = '\u898B';
  34338. t['\u2F93'] = '\u89D2';
  34339. t['\u2F94'] = '\u8A00';
  34340. t['\u2F95'] = '\u8C37';
  34341. t['\u2F96'] = '\u8C46';
  34342. t['\u2F97'] = '\u8C55';
  34343. t['\u2F98'] = '\u8C78';
  34344. t['\u2F99'] = '\u8C9D';
  34345. t['\u2F9A'] = '\u8D64';
  34346. t['\u2F9B'] = '\u8D70';
  34347. t['\u2F9C'] = '\u8DB3';
  34348. t['\u2F9D'] = '\u8EAB';
  34349. t['\u2F9E'] = '\u8ECA';
  34350. t['\u2F9F'] = '\u8F9B';
  34351. t['\u2FA0'] = '\u8FB0';
  34352. t['\u2FA1'] = '\u8FB5';
  34353. t['\u2FA2'] = '\u9091';
  34354. t['\u2FA3'] = '\u9149';
  34355. t['\u2FA4'] = '\u91C6';
  34356. t['\u2FA5'] = '\u91CC';
  34357. t['\u2FA6'] = '\u91D1';
  34358. t['\u2FA7'] = '\u9577';
  34359. t['\u2FA8'] = '\u9580';
  34360. t['\u2FA9'] = '\u961C';
  34361. t['\u2FAA'] = '\u96B6';
  34362. t['\u2FAB'] = '\u96B9';
  34363. t['\u2FAC'] = '\u96E8';
  34364. t['\u2FAD'] = '\u9751';
  34365. t['\u2FAE'] = '\u975E';
  34366. t['\u2FAF'] = '\u9762';
  34367. t['\u2FB0'] = '\u9769';
  34368. t['\u2FB1'] = '\u97CB';
  34369. t['\u2FB2'] = '\u97ED';
  34370. t['\u2FB3'] = '\u97F3';
  34371. t['\u2FB4'] = '\u9801';
  34372. t['\u2FB5'] = '\u98A8';
  34373. t['\u2FB6'] = '\u98DB';
  34374. t['\u2FB7'] = '\u98DF';
  34375. t['\u2FB8'] = '\u9996';
  34376. t['\u2FB9'] = '\u9999';
  34377. t['\u2FBA'] = '\u99AC';
  34378. t['\u2FBB'] = '\u9AA8';
  34379. t['\u2FBC'] = '\u9AD8';
  34380. t['\u2FBD'] = '\u9ADF';
  34381. t['\u2FBE'] = '\u9B25';
  34382. t['\u2FBF'] = '\u9B2F';
  34383. t['\u2FC0'] = '\u9B32';
  34384. t['\u2FC1'] = '\u9B3C';
  34385. t['\u2FC2'] = '\u9B5A';
  34386. t['\u2FC3'] = '\u9CE5';
  34387. t['\u2FC4'] = '\u9E75';
  34388. t['\u2FC5'] = '\u9E7F';
  34389. t['\u2FC6'] = '\u9EA5';
  34390. t['\u2FC7'] = '\u9EBB';
  34391. t['\u2FC8'] = '\u9EC3';
  34392. t['\u2FC9'] = '\u9ECD';
  34393. t['\u2FCA'] = '\u9ED1';
  34394. t['\u2FCB'] = '\u9EF9';
  34395. t['\u2FCC'] = '\u9EFD';
  34396. t['\u2FCD'] = '\u9F0E';
  34397. t['\u2FCE'] = '\u9F13';
  34398. t['\u2FCF'] = '\u9F20';
  34399. t['\u2FD0'] = '\u9F3B';
  34400. t['\u2FD1'] = '\u9F4A';
  34401. t['\u2FD2'] = '\u9F52';
  34402. t['\u2FD3'] = '\u9F8D';
  34403. t['\u2FD4'] = '\u9F9C';
  34404. t['\u2FD5'] = '\u9FA0';
  34405. t['\u3036'] = '\u3012';
  34406. t['\u3038'] = '\u5341';
  34407. t['\u3039'] = '\u5344';
  34408. t['\u303A'] = '\u5345';
  34409. t['\u309B'] = '\u0020\u3099';
  34410. t['\u309C'] = '\u0020\u309A';
  34411. t['\u3131'] = '\u1100';
  34412. t['\u3132'] = '\u1101';
  34413. t['\u3133'] = '\u11AA';
  34414. t['\u3134'] = '\u1102';
  34415. t['\u3135'] = '\u11AC';
  34416. t['\u3136'] = '\u11AD';
  34417. t['\u3137'] = '\u1103';
  34418. t['\u3138'] = '\u1104';
  34419. t['\u3139'] = '\u1105';
  34420. t['\u313A'] = '\u11B0';
  34421. t['\u313B'] = '\u11B1';
  34422. t['\u313C'] = '\u11B2';
  34423. t['\u313D'] = '\u11B3';
  34424. t['\u313E'] = '\u11B4';
  34425. t['\u313F'] = '\u11B5';
  34426. t['\u3140'] = '\u111A';
  34427. t['\u3141'] = '\u1106';
  34428. t['\u3142'] = '\u1107';
  34429. t['\u3143'] = '\u1108';
  34430. t['\u3144'] = '\u1121';
  34431. t['\u3145'] = '\u1109';
  34432. t['\u3146'] = '\u110A';
  34433. t['\u3147'] = '\u110B';
  34434. t['\u3148'] = '\u110C';
  34435. t['\u3149'] = '\u110D';
  34436. t['\u314A'] = '\u110E';
  34437. t['\u314B'] = '\u110F';
  34438. t['\u314C'] = '\u1110';
  34439. t['\u314D'] = '\u1111';
  34440. t['\u314E'] = '\u1112';
  34441. t['\u314F'] = '\u1161';
  34442. t['\u3150'] = '\u1162';
  34443. t['\u3151'] = '\u1163';
  34444. t['\u3152'] = '\u1164';
  34445. t['\u3153'] = '\u1165';
  34446. t['\u3154'] = '\u1166';
  34447. t['\u3155'] = '\u1167';
  34448. t['\u3156'] = '\u1168';
  34449. t['\u3157'] = '\u1169';
  34450. t['\u3158'] = '\u116A';
  34451. t['\u3159'] = '\u116B';
  34452. t['\u315A'] = '\u116C';
  34453. t['\u315B'] = '\u116D';
  34454. t['\u315C'] = '\u116E';
  34455. t['\u315D'] = '\u116F';
  34456. t['\u315E'] = '\u1170';
  34457. t['\u315F'] = '\u1171';
  34458. t['\u3160'] = '\u1172';
  34459. t['\u3161'] = '\u1173';
  34460. t['\u3162'] = '\u1174';
  34461. t['\u3163'] = '\u1175';
  34462. t['\u3164'] = '\u1160';
  34463. t['\u3165'] = '\u1114';
  34464. t['\u3166'] = '\u1115';
  34465. t['\u3167'] = '\u11C7';
  34466. t['\u3168'] = '\u11C8';
  34467. t['\u3169'] = '\u11CC';
  34468. t['\u316A'] = '\u11CE';
  34469. t['\u316B'] = '\u11D3';
  34470. t['\u316C'] = '\u11D7';
  34471. t['\u316D'] = '\u11D9';
  34472. t['\u316E'] = '\u111C';
  34473. t['\u316F'] = '\u11DD';
  34474. t['\u3170'] = '\u11DF';
  34475. t['\u3171'] = '\u111D';
  34476. t['\u3172'] = '\u111E';
  34477. t['\u3173'] = '\u1120';
  34478. t['\u3174'] = '\u1122';
  34479. t['\u3175'] = '\u1123';
  34480. t['\u3176'] = '\u1127';
  34481. t['\u3177'] = '\u1129';
  34482. t['\u3178'] = '\u112B';
  34483. t['\u3179'] = '\u112C';
  34484. t['\u317A'] = '\u112D';
  34485. t['\u317B'] = '\u112E';
  34486. t['\u317C'] = '\u112F';
  34487. t['\u317D'] = '\u1132';
  34488. t['\u317E'] = '\u1136';
  34489. t['\u317F'] = '\u1140';
  34490. t['\u3180'] = '\u1147';
  34491. t['\u3181'] = '\u114C';
  34492. t['\u3182'] = '\u11F1';
  34493. t['\u3183'] = '\u11F2';
  34494. t['\u3184'] = '\u1157';
  34495. t['\u3185'] = '\u1158';
  34496. t['\u3186'] = '\u1159';
  34497. t['\u3187'] = '\u1184';
  34498. t['\u3188'] = '\u1185';
  34499. t['\u3189'] = '\u1188';
  34500. t['\u318A'] = '\u1191';
  34501. t['\u318B'] = '\u1192';
  34502. t['\u318C'] = '\u1194';
  34503. t['\u318D'] = '\u119E';
  34504. t['\u318E'] = '\u11A1';
  34505. t['\u3200'] = '\u0028\u1100\u0029';
  34506. t['\u3201'] = '\u0028\u1102\u0029';
  34507. t['\u3202'] = '\u0028\u1103\u0029';
  34508. t['\u3203'] = '\u0028\u1105\u0029';
  34509. t['\u3204'] = '\u0028\u1106\u0029';
  34510. t['\u3205'] = '\u0028\u1107\u0029';
  34511. t['\u3206'] = '\u0028\u1109\u0029';
  34512. t['\u3207'] = '\u0028\u110B\u0029';
  34513. t['\u3208'] = '\u0028\u110C\u0029';
  34514. t['\u3209'] = '\u0028\u110E\u0029';
  34515. t['\u320A'] = '\u0028\u110F\u0029';
  34516. t['\u320B'] = '\u0028\u1110\u0029';
  34517. t['\u320C'] = '\u0028\u1111\u0029';
  34518. t['\u320D'] = '\u0028\u1112\u0029';
  34519. t['\u320E'] = '\u0028\u1100\u1161\u0029';
  34520. t['\u320F'] = '\u0028\u1102\u1161\u0029';
  34521. t['\u3210'] = '\u0028\u1103\u1161\u0029';
  34522. t['\u3211'] = '\u0028\u1105\u1161\u0029';
  34523. t['\u3212'] = '\u0028\u1106\u1161\u0029';
  34524. t['\u3213'] = '\u0028\u1107\u1161\u0029';
  34525. t['\u3214'] = '\u0028\u1109\u1161\u0029';
  34526. t['\u3215'] = '\u0028\u110B\u1161\u0029';
  34527. t['\u3216'] = '\u0028\u110C\u1161\u0029';
  34528. t['\u3217'] = '\u0028\u110E\u1161\u0029';
  34529. t['\u3218'] = '\u0028\u110F\u1161\u0029';
  34530. t['\u3219'] = '\u0028\u1110\u1161\u0029';
  34531. t['\u321A'] = '\u0028\u1111\u1161\u0029';
  34532. t['\u321B'] = '\u0028\u1112\u1161\u0029';
  34533. t['\u321C'] = '\u0028\u110C\u116E\u0029';
  34534. t['\u321D'] = '\u0028\u110B\u1169\u110C\u1165\u11AB\u0029';
  34535. t['\u321E'] = '\u0028\u110B\u1169\u1112\u116E\u0029';
  34536. t['\u3220'] = '\u0028\u4E00\u0029';
  34537. t['\u3221'] = '\u0028\u4E8C\u0029';
  34538. t['\u3222'] = '\u0028\u4E09\u0029';
  34539. t['\u3223'] = '\u0028\u56DB\u0029';
  34540. t['\u3224'] = '\u0028\u4E94\u0029';
  34541. t['\u3225'] = '\u0028\u516D\u0029';
  34542. t['\u3226'] = '\u0028\u4E03\u0029';
  34543. t['\u3227'] = '\u0028\u516B\u0029';
  34544. t['\u3228'] = '\u0028\u4E5D\u0029';
  34545. t['\u3229'] = '\u0028\u5341\u0029';
  34546. t['\u322A'] = '\u0028\u6708\u0029';
  34547. t['\u322B'] = '\u0028\u706B\u0029';
  34548. t['\u322C'] = '\u0028\u6C34\u0029';
  34549. t['\u322D'] = '\u0028\u6728\u0029';
  34550. t['\u322E'] = '\u0028\u91D1\u0029';
  34551. t['\u322F'] = '\u0028\u571F\u0029';
  34552. t['\u3230'] = '\u0028\u65E5\u0029';
  34553. t['\u3231'] = '\u0028\u682A\u0029';
  34554. t['\u3232'] = '\u0028\u6709\u0029';
  34555. t['\u3233'] = '\u0028\u793E\u0029';
  34556. t['\u3234'] = '\u0028\u540D\u0029';
  34557. t['\u3235'] = '\u0028\u7279\u0029';
  34558. t['\u3236'] = '\u0028\u8CA1\u0029';
  34559. t['\u3237'] = '\u0028\u795D\u0029';
  34560. t['\u3238'] = '\u0028\u52B4\u0029';
  34561. t['\u3239'] = '\u0028\u4EE3\u0029';
  34562. t['\u323A'] = '\u0028\u547C\u0029';
  34563. t['\u323B'] = '\u0028\u5B66\u0029';
  34564. t['\u323C'] = '\u0028\u76E3\u0029';
  34565. t['\u323D'] = '\u0028\u4F01\u0029';
  34566. t['\u323E'] = '\u0028\u8CC7\u0029';
  34567. t['\u323F'] = '\u0028\u5354\u0029';
  34568. t['\u3240'] = '\u0028\u796D\u0029';
  34569. t['\u3241'] = '\u0028\u4F11\u0029';
  34570. t['\u3242'] = '\u0028\u81EA\u0029';
  34571. t['\u3243'] = '\u0028\u81F3\u0029';
  34572. t['\u32C0'] = '\u0031\u6708';
  34573. t['\u32C1'] = '\u0032\u6708';
  34574. t['\u32C2'] = '\u0033\u6708';
  34575. t['\u32C3'] = '\u0034\u6708';
  34576. t['\u32C4'] = '\u0035\u6708';
  34577. t['\u32C5'] = '\u0036\u6708';
  34578. t['\u32C6'] = '\u0037\u6708';
  34579. t['\u32C7'] = '\u0038\u6708';
  34580. t['\u32C8'] = '\u0039\u6708';
  34581. t['\u32C9'] = '\u0031\u0030\u6708';
  34582. t['\u32CA'] = '\u0031\u0031\u6708';
  34583. t['\u32CB'] = '\u0031\u0032\u6708';
  34584. t['\u3358'] = '\u0030\u70B9';
  34585. t['\u3359'] = '\u0031\u70B9';
  34586. t['\u335A'] = '\u0032\u70B9';
  34587. t['\u335B'] = '\u0033\u70B9';
  34588. t['\u335C'] = '\u0034\u70B9';
  34589. t['\u335D'] = '\u0035\u70B9';
  34590. t['\u335E'] = '\u0036\u70B9';
  34591. t['\u335F'] = '\u0037\u70B9';
  34592. t['\u3360'] = '\u0038\u70B9';
  34593. t['\u3361'] = '\u0039\u70B9';
  34594. t['\u3362'] = '\u0031\u0030\u70B9';
  34595. t['\u3363'] = '\u0031\u0031\u70B9';
  34596. t['\u3364'] = '\u0031\u0032\u70B9';
  34597. t['\u3365'] = '\u0031\u0033\u70B9';
  34598. t['\u3366'] = '\u0031\u0034\u70B9';
  34599. t['\u3367'] = '\u0031\u0035\u70B9';
  34600. t['\u3368'] = '\u0031\u0036\u70B9';
  34601. t['\u3369'] = '\u0031\u0037\u70B9';
  34602. t['\u336A'] = '\u0031\u0038\u70B9';
  34603. t['\u336B'] = '\u0031\u0039\u70B9';
  34604. t['\u336C'] = '\u0032\u0030\u70B9';
  34605. t['\u336D'] = '\u0032\u0031\u70B9';
  34606. t['\u336E'] = '\u0032\u0032\u70B9';
  34607. t['\u336F'] = '\u0032\u0033\u70B9';
  34608. t['\u3370'] = '\u0032\u0034\u70B9';
  34609. t['\u33E0'] = '\u0031\u65E5';
  34610. t['\u33E1'] = '\u0032\u65E5';
  34611. t['\u33E2'] = '\u0033\u65E5';
  34612. t['\u33E3'] = '\u0034\u65E5';
  34613. t['\u33E4'] = '\u0035\u65E5';
  34614. t['\u33E5'] = '\u0036\u65E5';
  34615. t['\u33E6'] = '\u0037\u65E5';
  34616. t['\u33E7'] = '\u0038\u65E5';
  34617. t['\u33E8'] = '\u0039\u65E5';
  34618. t['\u33E9'] = '\u0031\u0030\u65E5';
  34619. t['\u33EA'] = '\u0031\u0031\u65E5';
  34620. t['\u33EB'] = '\u0031\u0032\u65E5';
  34621. t['\u33EC'] = '\u0031\u0033\u65E5';
  34622. t['\u33ED'] = '\u0031\u0034\u65E5';
  34623. t['\u33EE'] = '\u0031\u0035\u65E5';
  34624. t['\u33EF'] = '\u0031\u0036\u65E5';
  34625. t['\u33F0'] = '\u0031\u0037\u65E5';
  34626. t['\u33F1'] = '\u0031\u0038\u65E5';
  34627. t['\u33F2'] = '\u0031\u0039\u65E5';
  34628. t['\u33F3'] = '\u0032\u0030\u65E5';
  34629. t['\u33F4'] = '\u0032\u0031\u65E5';
  34630. t['\u33F5'] = '\u0032\u0032\u65E5';
  34631. t['\u33F6'] = '\u0032\u0033\u65E5';
  34632. t['\u33F7'] = '\u0032\u0034\u65E5';
  34633. t['\u33F8'] = '\u0032\u0035\u65E5';
  34634. t['\u33F9'] = '\u0032\u0036\u65E5';
  34635. t['\u33FA'] = '\u0032\u0037\u65E5';
  34636. t['\u33FB'] = '\u0032\u0038\u65E5';
  34637. t['\u33FC'] = '\u0032\u0039\u65E5';
  34638. t['\u33FD'] = '\u0033\u0030\u65E5';
  34639. t['\u33FE'] = '\u0033\u0031\u65E5';
  34640. t['\uFB00'] = '\u0066\u0066';
  34641. t['\uFB01'] = '\u0066\u0069';
  34642. t['\uFB02'] = '\u0066\u006C';
  34643. t['\uFB03'] = '\u0066\u0066\u0069';
  34644. t['\uFB04'] = '\u0066\u0066\u006C';
  34645. t['\uFB05'] = '\u017F\u0074';
  34646. t['\uFB06'] = '\u0073\u0074';
  34647. t['\uFB13'] = '\u0574\u0576';
  34648. t['\uFB14'] = '\u0574\u0565';
  34649. t['\uFB15'] = '\u0574\u056B';
  34650. t['\uFB16'] = '\u057E\u0576';
  34651. t['\uFB17'] = '\u0574\u056D';
  34652. t['\uFB4F'] = '\u05D0\u05DC';
  34653. t['\uFB50'] = '\u0671';
  34654. t['\uFB51'] = '\u0671';
  34655. t['\uFB52'] = '\u067B';
  34656. t['\uFB53'] = '\u067B';
  34657. t['\uFB54'] = '\u067B';
  34658. t['\uFB55'] = '\u067B';
  34659. t['\uFB56'] = '\u067E';
  34660. t['\uFB57'] = '\u067E';
  34661. t['\uFB58'] = '\u067E';
  34662. t['\uFB59'] = '\u067E';
  34663. t['\uFB5A'] = '\u0680';
  34664. t['\uFB5B'] = '\u0680';
  34665. t['\uFB5C'] = '\u0680';
  34666. t['\uFB5D'] = '\u0680';
  34667. t['\uFB5E'] = '\u067A';
  34668. t['\uFB5F'] = '\u067A';
  34669. t['\uFB60'] = '\u067A';
  34670. t['\uFB61'] = '\u067A';
  34671. t['\uFB62'] = '\u067F';
  34672. t['\uFB63'] = '\u067F';
  34673. t['\uFB64'] = '\u067F';
  34674. t['\uFB65'] = '\u067F';
  34675. t['\uFB66'] = '\u0679';
  34676. t['\uFB67'] = '\u0679';
  34677. t['\uFB68'] = '\u0679';
  34678. t['\uFB69'] = '\u0679';
  34679. t['\uFB6A'] = '\u06A4';
  34680. t['\uFB6B'] = '\u06A4';
  34681. t['\uFB6C'] = '\u06A4';
  34682. t['\uFB6D'] = '\u06A4';
  34683. t['\uFB6E'] = '\u06A6';
  34684. t['\uFB6F'] = '\u06A6';
  34685. t['\uFB70'] = '\u06A6';
  34686. t['\uFB71'] = '\u06A6';
  34687. t['\uFB72'] = '\u0684';
  34688. t['\uFB73'] = '\u0684';
  34689. t['\uFB74'] = '\u0684';
  34690. t['\uFB75'] = '\u0684';
  34691. t['\uFB76'] = '\u0683';
  34692. t['\uFB77'] = '\u0683';
  34693. t['\uFB78'] = '\u0683';
  34694. t['\uFB79'] = '\u0683';
  34695. t['\uFB7A'] = '\u0686';
  34696. t['\uFB7B'] = '\u0686';
  34697. t['\uFB7C'] = '\u0686';
  34698. t['\uFB7D'] = '\u0686';
  34699. t['\uFB7E'] = '\u0687';
  34700. t['\uFB7F'] = '\u0687';
  34701. t['\uFB80'] = '\u0687';
  34702. t['\uFB81'] = '\u0687';
  34703. t['\uFB82'] = '\u068D';
  34704. t['\uFB83'] = '\u068D';
  34705. t['\uFB84'] = '\u068C';
  34706. t['\uFB85'] = '\u068C';
  34707. t['\uFB86'] = '\u068E';
  34708. t['\uFB87'] = '\u068E';
  34709. t['\uFB88'] = '\u0688';
  34710. t['\uFB89'] = '\u0688';
  34711. t['\uFB8A'] = '\u0698';
  34712. t['\uFB8B'] = '\u0698';
  34713. t['\uFB8C'] = '\u0691';
  34714. t['\uFB8D'] = '\u0691';
  34715. t['\uFB8E'] = '\u06A9';
  34716. t['\uFB8F'] = '\u06A9';
  34717. t['\uFB90'] = '\u06A9';
  34718. t['\uFB91'] = '\u06A9';
  34719. t['\uFB92'] = '\u06AF';
  34720. t['\uFB93'] = '\u06AF';
  34721. t['\uFB94'] = '\u06AF';
  34722. t['\uFB95'] = '\u06AF';
  34723. t['\uFB96'] = '\u06B3';
  34724. t['\uFB97'] = '\u06B3';
  34725. t['\uFB98'] = '\u06B3';
  34726. t['\uFB99'] = '\u06B3';
  34727. t['\uFB9A'] = '\u06B1';
  34728. t['\uFB9B'] = '\u06B1';
  34729. t['\uFB9C'] = '\u06B1';
  34730. t['\uFB9D'] = '\u06B1';
  34731. t['\uFB9E'] = '\u06BA';
  34732. t['\uFB9F'] = '\u06BA';
  34733. t['\uFBA0'] = '\u06BB';
  34734. t['\uFBA1'] = '\u06BB';
  34735. t['\uFBA2'] = '\u06BB';
  34736. t['\uFBA3'] = '\u06BB';
  34737. t['\uFBA4'] = '\u06C0';
  34738. t['\uFBA5'] = '\u06C0';
  34739. t['\uFBA6'] = '\u06C1';
  34740. t['\uFBA7'] = '\u06C1';
  34741. t['\uFBA8'] = '\u06C1';
  34742. t['\uFBA9'] = '\u06C1';
  34743. t['\uFBAA'] = '\u06BE';
  34744. t['\uFBAB'] = '\u06BE';
  34745. t['\uFBAC'] = '\u06BE';
  34746. t['\uFBAD'] = '\u06BE';
  34747. t['\uFBAE'] = '\u06D2';
  34748. t['\uFBAF'] = '\u06D2';
  34749. t['\uFBB0'] = '\u06D3';
  34750. t['\uFBB1'] = '\u06D3';
  34751. t['\uFBD3'] = '\u06AD';
  34752. t['\uFBD4'] = '\u06AD';
  34753. t['\uFBD5'] = '\u06AD';
  34754. t['\uFBD6'] = '\u06AD';
  34755. t['\uFBD7'] = '\u06C7';
  34756. t['\uFBD8'] = '\u06C7';
  34757. t['\uFBD9'] = '\u06C6';
  34758. t['\uFBDA'] = '\u06C6';
  34759. t['\uFBDB'] = '\u06C8';
  34760. t['\uFBDC'] = '\u06C8';
  34761. t['\uFBDD'] = '\u0677';
  34762. t['\uFBDE'] = '\u06CB';
  34763. t['\uFBDF'] = '\u06CB';
  34764. t['\uFBE0'] = '\u06C5';
  34765. t['\uFBE1'] = '\u06C5';
  34766. t['\uFBE2'] = '\u06C9';
  34767. t['\uFBE3'] = '\u06C9';
  34768. t['\uFBE4'] = '\u06D0';
  34769. t['\uFBE5'] = '\u06D0';
  34770. t['\uFBE6'] = '\u06D0';
  34771. t['\uFBE7'] = '\u06D0';
  34772. t['\uFBE8'] = '\u0649';
  34773. t['\uFBE9'] = '\u0649';
  34774. t['\uFBEA'] = '\u0626\u0627';
  34775. t['\uFBEB'] = '\u0626\u0627';
  34776. t['\uFBEC'] = '\u0626\u06D5';
  34777. t['\uFBED'] = '\u0626\u06D5';
  34778. t['\uFBEE'] = '\u0626\u0648';
  34779. t['\uFBEF'] = '\u0626\u0648';
  34780. t['\uFBF0'] = '\u0626\u06C7';
  34781. t['\uFBF1'] = '\u0626\u06C7';
  34782. t['\uFBF2'] = '\u0626\u06C6';
  34783. t['\uFBF3'] = '\u0626\u06C6';
  34784. t['\uFBF4'] = '\u0626\u06C8';
  34785. t['\uFBF5'] = '\u0626\u06C8';
  34786. t['\uFBF6'] = '\u0626\u06D0';
  34787. t['\uFBF7'] = '\u0626\u06D0';
  34788. t['\uFBF8'] = '\u0626\u06D0';
  34789. t['\uFBF9'] = '\u0626\u0649';
  34790. t['\uFBFA'] = '\u0626\u0649';
  34791. t['\uFBFB'] = '\u0626\u0649';
  34792. t['\uFBFC'] = '\u06CC';
  34793. t['\uFBFD'] = '\u06CC';
  34794. t['\uFBFE'] = '\u06CC';
  34795. t['\uFBFF'] = '\u06CC';
  34796. t['\uFC00'] = '\u0626\u062C';
  34797. t['\uFC01'] = '\u0626\u062D';
  34798. t['\uFC02'] = '\u0626\u0645';
  34799. t['\uFC03'] = '\u0626\u0649';
  34800. t['\uFC04'] = '\u0626\u064A';
  34801. t['\uFC05'] = '\u0628\u062C';
  34802. t['\uFC06'] = '\u0628\u062D';
  34803. t['\uFC07'] = '\u0628\u062E';
  34804. t['\uFC08'] = '\u0628\u0645';
  34805. t['\uFC09'] = '\u0628\u0649';
  34806. t['\uFC0A'] = '\u0628\u064A';
  34807. t['\uFC0B'] = '\u062A\u062C';
  34808. t['\uFC0C'] = '\u062A\u062D';
  34809. t['\uFC0D'] = '\u062A\u062E';
  34810. t['\uFC0E'] = '\u062A\u0645';
  34811. t['\uFC0F'] = '\u062A\u0649';
  34812. t['\uFC10'] = '\u062A\u064A';
  34813. t['\uFC11'] = '\u062B\u062C';
  34814. t['\uFC12'] = '\u062B\u0645';
  34815. t['\uFC13'] = '\u062B\u0649';
  34816. t['\uFC14'] = '\u062B\u064A';
  34817. t['\uFC15'] = '\u062C\u062D';
  34818. t['\uFC16'] = '\u062C\u0645';
  34819. t['\uFC17'] = '\u062D\u062C';
  34820. t['\uFC18'] = '\u062D\u0645';
  34821. t['\uFC19'] = '\u062E\u062C';
  34822. t['\uFC1A'] = '\u062E\u062D';
  34823. t['\uFC1B'] = '\u062E\u0645';
  34824. t['\uFC1C'] = '\u0633\u062C';
  34825. t['\uFC1D'] = '\u0633\u062D';
  34826. t['\uFC1E'] = '\u0633\u062E';
  34827. t['\uFC1F'] = '\u0633\u0645';
  34828. t['\uFC20'] = '\u0635\u062D';
  34829. t['\uFC21'] = '\u0635\u0645';
  34830. t['\uFC22'] = '\u0636\u062C';
  34831. t['\uFC23'] = '\u0636\u062D';
  34832. t['\uFC24'] = '\u0636\u062E';
  34833. t['\uFC25'] = '\u0636\u0645';
  34834. t['\uFC26'] = '\u0637\u062D';
  34835. t['\uFC27'] = '\u0637\u0645';
  34836. t['\uFC28'] = '\u0638\u0645';
  34837. t['\uFC29'] = '\u0639\u062C';
  34838. t['\uFC2A'] = '\u0639\u0645';
  34839. t['\uFC2B'] = '\u063A\u062C';
  34840. t['\uFC2C'] = '\u063A\u0645';
  34841. t['\uFC2D'] = '\u0641\u062C';
  34842. t['\uFC2E'] = '\u0641\u062D';
  34843. t['\uFC2F'] = '\u0641\u062E';
  34844. t['\uFC30'] = '\u0641\u0645';
  34845. t['\uFC31'] = '\u0641\u0649';
  34846. t['\uFC32'] = '\u0641\u064A';
  34847. t['\uFC33'] = '\u0642\u062D';
  34848. t['\uFC34'] = '\u0642\u0645';
  34849. t['\uFC35'] = '\u0642\u0649';
  34850. t['\uFC36'] = '\u0642\u064A';
  34851. t['\uFC37'] = '\u0643\u0627';
  34852. t['\uFC38'] = '\u0643\u062C';
  34853. t['\uFC39'] = '\u0643\u062D';
  34854. t['\uFC3A'] = '\u0643\u062E';
  34855. t['\uFC3B'] = '\u0643\u0644';
  34856. t['\uFC3C'] = '\u0643\u0645';
  34857. t['\uFC3D'] = '\u0643\u0649';
  34858. t['\uFC3E'] = '\u0643\u064A';
  34859. t['\uFC3F'] = '\u0644\u062C';
  34860. t['\uFC40'] = '\u0644\u062D';
  34861. t['\uFC41'] = '\u0644\u062E';
  34862. t['\uFC42'] = '\u0644\u0645';
  34863. t['\uFC43'] = '\u0644\u0649';
  34864. t['\uFC44'] = '\u0644\u064A';
  34865. t['\uFC45'] = '\u0645\u062C';
  34866. t['\uFC46'] = '\u0645\u062D';
  34867. t['\uFC47'] = '\u0645\u062E';
  34868. t['\uFC48'] = '\u0645\u0645';
  34869. t['\uFC49'] = '\u0645\u0649';
  34870. t['\uFC4A'] = '\u0645\u064A';
  34871. t['\uFC4B'] = '\u0646\u062C';
  34872. t['\uFC4C'] = '\u0646\u062D';
  34873. t['\uFC4D'] = '\u0646\u062E';
  34874. t['\uFC4E'] = '\u0646\u0645';
  34875. t['\uFC4F'] = '\u0646\u0649';
  34876. t['\uFC50'] = '\u0646\u064A';
  34877. t['\uFC51'] = '\u0647\u062C';
  34878. t['\uFC52'] = '\u0647\u0645';
  34879. t['\uFC53'] = '\u0647\u0649';
  34880. t['\uFC54'] = '\u0647\u064A';
  34881. t['\uFC55'] = '\u064A\u062C';
  34882. t['\uFC56'] = '\u064A\u062D';
  34883. t['\uFC57'] = '\u064A\u062E';
  34884. t['\uFC58'] = '\u064A\u0645';
  34885. t['\uFC59'] = '\u064A\u0649';
  34886. t['\uFC5A'] = '\u064A\u064A';
  34887. t['\uFC5B'] = '\u0630\u0670';
  34888. t['\uFC5C'] = '\u0631\u0670';
  34889. t['\uFC5D'] = '\u0649\u0670';
  34890. t['\uFC5E'] = '\u0020\u064C\u0651';
  34891. t['\uFC5F'] = '\u0020\u064D\u0651';
  34892. t['\uFC60'] = '\u0020\u064E\u0651';
  34893. t['\uFC61'] = '\u0020\u064F\u0651';
  34894. t['\uFC62'] = '\u0020\u0650\u0651';
  34895. t['\uFC63'] = '\u0020\u0651\u0670';
  34896. t['\uFC64'] = '\u0626\u0631';
  34897. t['\uFC65'] = '\u0626\u0632';
  34898. t['\uFC66'] = '\u0626\u0645';
  34899. t['\uFC67'] = '\u0626\u0646';
  34900. t['\uFC68'] = '\u0626\u0649';
  34901. t['\uFC69'] = '\u0626\u064A';
  34902. t['\uFC6A'] = '\u0628\u0631';
  34903. t['\uFC6B'] = '\u0628\u0632';
  34904. t['\uFC6C'] = '\u0628\u0645';
  34905. t['\uFC6D'] = '\u0628\u0646';
  34906. t['\uFC6E'] = '\u0628\u0649';
  34907. t['\uFC6F'] = '\u0628\u064A';
  34908. t['\uFC70'] = '\u062A\u0631';
  34909. t['\uFC71'] = '\u062A\u0632';
  34910. t['\uFC72'] = '\u062A\u0645';
  34911. t['\uFC73'] = '\u062A\u0646';
  34912. t['\uFC74'] = '\u062A\u0649';
  34913. t['\uFC75'] = '\u062A\u064A';
  34914. t['\uFC76'] = '\u062B\u0631';
  34915. t['\uFC77'] = '\u062B\u0632';
  34916. t['\uFC78'] = '\u062B\u0645';
  34917. t['\uFC79'] = '\u062B\u0646';
  34918. t['\uFC7A'] = '\u062B\u0649';
  34919. t['\uFC7B'] = '\u062B\u064A';
  34920. t['\uFC7C'] = '\u0641\u0649';
  34921. t['\uFC7D'] = '\u0641\u064A';
  34922. t['\uFC7E'] = '\u0642\u0649';
  34923. t['\uFC7F'] = '\u0642\u064A';
  34924. t['\uFC80'] = '\u0643\u0627';
  34925. t['\uFC81'] = '\u0643\u0644';
  34926. t['\uFC82'] = '\u0643\u0645';
  34927. t['\uFC83'] = '\u0643\u0649';
  34928. t['\uFC84'] = '\u0643\u064A';
  34929. t['\uFC85'] = '\u0644\u0645';
  34930. t['\uFC86'] = '\u0644\u0649';
  34931. t['\uFC87'] = '\u0644\u064A';
  34932. t['\uFC88'] = '\u0645\u0627';
  34933. t['\uFC89'] = '\u0645\u0645';
  34934. t['\uFC8A'] = '\u0646\u0631';
  34935. t['\uFC8B'] = '\u0646\u0632';
  34936. t['\uFC8C'] = '\u0646\u0645';
  34937. t['\uFC8D'] = '\u0646\u0646';
  34938. t['\uFC8E'] = '\u0646\u0649';
  34939. t['\uFC8F'] = '\u0646\u064A';
  34940. t['\uFC90'] = '\u0649\u0670';
  34941. t['\uFC91'] = '\u064A\u0631';
  34942. t['\uFC92'] = '\u064A\u0632';
  34943. t['\uFC93'] = '\u064A\u0645';
  34944. t['\uFC94'] = '\u064A\u0646';
  34945. t['\uFC95'] = '\u064A\u0649';
  34946. t['\uFC96'] = '\u064A\u064A';
  34947. t['\uFC97'] = '\u0626\u062C';
  34948. t['\uFC98'] = '\u0626\u062D';
  34949. t['\uFC99'] = '\u0626\u062E';
  34950. t['\uFC9A'] = '\u0626\u0645';
  34951. t['\uFC9B'] = '\u0626\u0647';
  34952. t['\uFC9C'] = '\u0628\u062C';
  34953. t['\uFC9D'] = '\u0628\u062D';
  34954. t['\uFC9E'] = '\u0628\u062E';
  34955. t['\uFC9F'] = '\u0628\u0645';
  34956. t['\uFCA0'] = '\u0628\u0647';
  34957. t['\uFCA1'] = '\u062A\u062C';
  34958. t['\uFCA2'] = '\u062A\u062D';
  34959. t['\uFCA3'] = '\u062A\u062E';
  34960. t['\uFCA4'] = '\u062A\u0645';
  34961. t['\uFCA5'] = '\u062A\u0647';
  34962. t['\uFCA6'] = '\u062B\u0645';
  34963. t['\uFCA7'] = '\u062C\u062D';
  34964. t['\uFCA8'] = '\u062C\u0645';
  34965. t['\uFCA9'] = '\u062D\u062C';
  34966. t['\uFCAA'] = '\u062D\u0645';
  34967. t['\uFCAB'] = '\u062E\u062C';
  34968. t['\uFCAC'] = '\u062E\u0645';
  34969. t['\uFCAD'] = '\u0633\u062C';
  34970. t['\uFCAE'] = '\u0633\u062D';
  34971. t['\uFCAF'] = '\u0633\u062E';
  34972. t['\uFCB0'] = '\u0633\u0645';
  34973. t['\uFCB1'] = '\u0635\u062D';
  34974. t['\uFCB2'] = '\u0635\u062E';
  34975. t['\uFCB3'] = '\u0635\u0645';
  34976. t['\uFCB4'] = '\u0636\u062C';
  34977. t['\uFCB5'] = '\u0636\u062D';
  34978. t['\uFCB6'] = '\u0636\u062E';
  34979. t['\uFCB7'] = '\u0636\u0645';
  34980. t['\uFCB8'] = '\u0637\u062D';
  34981. t['\uFCB9'] = '\u0638\u0645';
  34982. t['\uFCBA'] = '\u0639\u062C';
  34983. t['\uFCBB'] = '\u0639\u0645';
  34984. t['\uFCBC'] = '\u063A\u062C';
  34985. t['\uFCBD'] = '\u063A\u0645';
  34986. t['\uFCBE'] = '\u0641\u062C';
  34987. t['\uFCBF'] = '\u0641\u062D';
  34988. t['\uFCC0'] = '\u0641\u062E';
  34989. t['\uFCC1'] = '\u0641\u0645';
  34990. t['\uFCC2'] = '\u0642\u062D';
  34991. t['\uFCC3'] = '\u0642\u0645';
  34992. t['\uFCC4'] = '\u0643\u062C';
  34993. t['\uFCC5'] = '\u0643\u062D';
  34994. t['\uFCC6'] = '\u0643\u062E';
  34995. t['\uFCC7'] = '\u0643\u0644';
  34996. t['\uFCC8'] = '\u0643\u0645';
  34997. t['\uFCC9'] = '\u0644\u062C';
  34998. t['\uFCCA'] = '\u0644\u062D';
  34999. t['\uFCCB'] = '\u0644\u062E';
  35000. t['\uFCCC'] = '\u0644\u0645';
  35001. t['\uFCCD'] = '\u0644\u0647';
  35002. t['\uFCCE'] = '\u0645\u062C';
  35003. t['\uFCCF'] = '\u0645\u062D';
  35004. t['\uFCD0'] = '\u0645\u062E';
  35005. t['\uFCD1'] = '\u0645\u0645';
  35006. t['\uFCD2'] = '\u0646\u062C';
  35007. t['\uFCD3'] = '\u0646\u062D';
  35008. t['\uFCD4'] = '\u0646\u062E';
  35009. t['\uFCD5'] = '\u0646\u0645';
  35010. t['\uFCD6'] = '\u0646\u0647';
  35011. t['\uFCD7'] = '\u0647\u062C';
  35012. t['\uFCD8'] = '\u0647\u0645';
  35013. t['\uFCD9'] = '\u0647\u0670';
  35014. t['\uFCDA'] = '\u064A\u062C';
  35015. t['\uFCDB'] = '\u064A\u062D';
  35016. t['\uFCDC'] = '\u064A\u062E';
  35017. t['\uFCDD'] = '\u064A\u0645';
  35018. t['\uFCDE'] = '\u064A\u0647';
  35019. t['\uFCDF'] = '\u0626\u0645';
  35020. t['\uFCE0'] = '\u0626\u0647';
  35021. t['\uFCE1'] = '\u0628\u0645';
  35022. t['\uFCE2'] = '\u0628\u0647';
  35023. t['\uFCE3'] = '\u062A\u0645';
  35024. t['\uFCE4'] = '\u062A\u0647';
  35025. t['\uFCE5'] = '\u062B\u0645';
  35026. t['\uFCE6'] = '\u062B\u0647';
  35027. t['\uFCE7'] = '\u0633\u0645';
  35028. t['\uFCE8'] = '\u0633\u0647';
  35029. t['\uFCE9'] = '\u0634\u0645';
  35030. t['\uFCEA'] = '\u0634\u0647';
  35031. t['\uFCEB'] = '\u0643\u0644';
  35032. t['\uFCEC'] = '\u0643\u0645';
  35033. t['\uFCED'] = '\u0644\u0645';
  35034. t['\uFCEE'] = '\u0646\u0645';
  35035. t['\uFCEF'] = '\u0646\u0647';
  35036. t['\uFCF0'] = '\u064A\u0645';
  35037. t['\uFCF1'] = '\u064A\u0647';
  35038. t['\uFCF2'] = '\u0640\u064E\u0651';
  35039. t['\uFCF3'] = '\u0640\u064F\u0651';
  35040. t['\uFCF4'] = '\u0640\u0650\u0651';
  35041. t['\uFCF5'] = '\u0637\u0649';
  35042. t['\uFCF6'] = '\u0637\u064A';
  35043. t['\uFCF7'] = '\u0639\u0649';
  35044. t['\uFCF8'] = '\u0639\u064A';
  35045. t['\uFCF9'] = '\u063A\u0649';
  35046. t['\uFCFA'] = '\u063A\u064A';
  35047. t['\uFCFB'] = '\u0633\u0649';
  35048. t['\uFCFC'] = '\u0633\u064A';
  35049. t['\uFCFD'] = '\u0634\u0649';
  35050. t['\uFCFE'] = '\u0634\u064A';
  35051. t['\uFCFF'] = '\u062D\u0649';
  35052. t['\uFD00'] = '\u062D\u064A';
  35053. t['\uFD01'] = '\u062C\u0649';
  35054. t['\uFD02'] = '\u062C\u064A';
  35055. t['\uFD03'] = '\u062E\u0649';
  35056. t['\uFD04'] = '\u062E\u064A';
  35057. t['\uFD05'] = '\u0635\u0649';
  35058. t['\uFD06'] = '\u0635\u064A';
  35059. t['\uFD07'] = '\u0636\u0649';
  35060. t['\uFD08'] = '\u0636\u064A';
  35061. t['\uFD09'] = '\u0634\u062C';
  35062. t['\uFD0A'] = '\u0634\u062D';
  35063. t['\uFD0B'] = '\u0634\u062E';
  35064. t['\uFD0C'] = '\u0634\u0645';
  35065. t['\uFD0D'] = '\u0634\u0631';
  35066. t['\uFD0E'] = '\u0633\u0631';
  35067. t['\uFD0F'] = '\u0635\u0631';
  35068. t['\uFD10'] = '\u0636\u0631';
  35069. t['\uFD11'] = '\u0637\u0649';
  35070. t['\uFD12'] = '\u0637\u064A';
  35071. t['\uFD13'] = '\u0639\u0649';
  35072. t['\uFD14'] = '\u0639\u064A';
  35073. t['\uFD15'] = '\u063A\u0649';
  35074. t['\uFD16'] = '\u063A\u064A';
  35075. t['\uFD17'] = '\u0633\u0649';
  35076. t['\uFD18'] = '\u0633\u064A';
  35077. t['\uFD19'] = '\u0634\u0649';
  35078. t['\uFD1A'] = '\u0634\u064A';
  35079. t['\uFD1B'] = '\u062D\u0649';
  35080. t['\uFD1C'] = '\u062D\u064A';
  35081. t['\uFD1D'] = '\u062C\u0649';
  35082. t['\uFD1E'] = '\u062C\u064A';
  35083. t['\uFD1F'] = '\u062E\u0649';
  35084. t['\uFD20'] = '\u062E\u064A';
  35085. t['\uFD21'] = '\u0635\u0649';
  35086. t['\uFD22'] = '\u0635\u064A';
  35087. t['\uFD23'] = '\u0636\u0649';
  35088. t['\uFD24'] = '\u0636\u064A';
  35089. t['\uFD25'] = '\u0634\u062C';
  35090. t['\uFD26'] = '\u0634\u062D';
  35091. t['\uFD27'] = '\u0634\u062E';
  35092. t['\uFD28'] = '\u0634\u0645';
  35093. t['\uFD29'] = '\u0634\u0631';
  35094. t['\uFD2A'] = '\u0633\u0631';
  35095. t['\uFD2B'] = '\u0635\u0631';
  35096. t['\uFD2C'] = '\u0636\u0631';
  35097. t['\uFD2D'] = '\u0634\u062C';
  35098. t['\uFD2E'] = '\u0634\u062D';
  35099. t['\uFD2F'] = '\u0634\u062E';
  35100. t['\uFD30'] = '\u0634\u0645';
  35101. t['\uFD31'] = '\u0633\u0647';
  35102. t['\uFD32'] = '\u0634\u0647';
  35103. t['\uFD33'] = '\u0637\u0645';
  35104. t['\uFD34'] = '\u0633\u062C';
  35105. t['\uFD35'] = '\u0633\u062D';
  35106. t['\uFD36'] = '\u0633\u062E';
  35107. t['\uFD37'] = '\u0634\u062C';
  35108. t['\uFD38'] = '\u0634\u062D';
  35109. t['\uFD39'] = '\u0634\u062E';
  35110. t['\uFD3A'] = '\u0637\u0645';
  35111. t['\uFD3B'] = '\u0638\u0645';
  35112. t['\uFD3C'] = '\u0627\u064B';
  35113. t['\uFD3D'] = '\u0627\u064B';
  35114. t['\uFD50'] = '\u062A\u062C\u0645';
  35115. t['\uFD51'] = '\u062A\u062D\u062C';
  35116. t['\uFD52'] = '\u062A\u062D\u062C';
  35117. t['\uFD53'] = '\u062A\u062D\u0645';
  35118. t['\uFD54'] = '\u062A\u062E\u0645';
  35119. t['\uFD55'] = '\u062A\u0645\u062C';
  35120. t['\uFD56'] = '\u062A\u0645\u062D';
  35121. t['\uFD57'] = '\u062A\u0645\u062E';
  35122. t['\uFD58'] = '\u062C\u0645\u062D';
  35123. t['\uFD59'] = '\u062C\u0645\u062D';
  35124. t['\uFD5A'] = '\u062D\u0645\u064A';
  35125. t['\uFD5B'] = '\u062D\u0645\u0649';
  35126. t['\uFD5C'] = '\u0633\u062D\u062C';
  35127. t['\uFD5D'] = '\u0633\u062C\u062D';
  35128. t['\uFD5E'] = '\u0633\u062C\u0649';
  35129. t['\uFD5F'] = '\u0633\u0645\u062D';
  35130. t['\uFD60'] = '\u0633\u0645\u062D';
  35131. t['\uFD61'] = '\u0633\u0645\u062C';
  35132. t['\uFD62'] = '\u0633\u0645\u0645';
  35133. t['\uFD63'] = '\u0633\u0645\u0645';
  35134. t['\uFD64'] = '\u0635\u062D\u062D';
  35135. t['\uFD65'] = '\u0635\u062D\u062D';
  35136. t['\uFD66'] = '\u0635\u0645\u0645';
  35137. t['\uFD67'] = '\u0634\u062D\u0645';
  35138. t['\uFD68'] = '\u0634\u062D\u0645';
  35139. t['\uFD69'] = '\u0634\u062C\u064A';
  35140. t['\uFD6A'] = '\u0634\u0645\u062E';
  35141. t['\uFD6B'] = '\u0634\u0645\u062E';
  35142. t['\uFD6C'] = '\u0634\u0645\u0645';
  35143. t['\uFD6D'] = '\u0634\u0645\u0645';
  35144. t['\uFD6E'] = '\u0636\u062D\u0649';
  35145. t['\uFD6F'] = '\u0636\u062E\u0645';
  35146. t['\uFD70'] = '\u0636\u062E\u0645';
  35147. t['\uFD71'] = '\u0637\u0645\u062D';
  35148. t['\uFD72'] = '\u0637\u0645\u062D';
  35149. t['\uFD73'] = '\u0637\u0645\u0645';
  35150. t['\uFD74'] = '\u0637\u0645\u064A';
  35151. t['\uFD75'] = '\u0639\u062C\u0645';
  35152. t['\uFD76'] = '\u0639\u0645\u0645';
  35153. t['\uFD77'] = '\u0639\u0645\u0645';
  35154. t['\uFD78'] = '\u0639\u0645\u0649';
  35155. t['\uFD79'] = '\u063A\u0645\u0645';
  35156. t['\uFD7A'] = '\u063A\u0645\u064A';
  35157. t['\uFD7B'] = '\u063A\u0645\u0649';
  35158. t['\uFD7C'] = '\u0641\u062E\u0645';
  35159. t['\uFD7D'] = '\u0641\u062E\u0645';
  35160. t['\uFD7E'] = '\u0642\u0645\u062D';
  35161. t['\uFD7F'] = '\u0642\u0645\u0645';
  35162. t['\uFD80'] = '\u0644\u062D\u0645';
  35163. t['\uFD81'] = '\u0644\u062D\u064A';
  35164. t['\uFD82'] = '\u0644\u062D\u0649';
  35165. t['\uFD83'] = '\u0644\u062C\u062C';
  35166. t['\uFD84'] = '\u0644\u062C\u062C';
  35167. t['\uFD85'] = '\u0644\u062E\u0645';
  35168. t['\uFD86'] = '\u0644\u062E\u0645';
  35169. t['\uFD87'] = '\u0644\u0645\u062D';
  35170. t['\uFD88'] = '\u0644\u0645\u062D';
  35171. t['\uFD89'] = '\u0645\u062D\u062C';
  35172. t['\uFD8A'] = '\u0645\u062D\u0645';
  35173. t['\uFD8B'] = '\u0645\u062D\u064A';
  35174. t['\uFD8C'] = '\u0645\u062C\u062D';
  35175. t['\uFD8D'] = '\u0645\u062C\u0645';
  35176. t['\uFD8E'] = '\u0645\u062E\u062C';
  35177. t['\uFD8F'] = '\u0645\u062E\u0645';
  35178. t['\uFD92'] = '\u0645\u062C\u062E';
  35179. t['\uFD93'] = '\u0647\u0645\u062C';
  35180. t['\uFD94'] = '\u0647\u0645\u0645';
  35181. t['\uFD95'] = '\u0646\u062D\u0645';
  35182. t['\uFD96'] = '\u0646\u062D\u0649';
  35183. t['\uFD97'] = '\u0646\u062C\u0645';
  35184. t['\uFD98'] = '\u0646\u062C\u0645';
  35185. t['\uFD99'] = '\u0646\u062C\u0649';
  35186. t['\uFD9A'] = '\u0646\u0645\u064A';
  35187. t['\uFD9B'] = '\u0646\u0645\u0649';
  35188. t['\uFD9C'] = '\u064A\u0645\u0645';
  35189. t['\uFD9D'] = '\u064A\u0645\u0645';
  35190. t['\uFD9E'] = '\u0628\u062E\u064A';
  35191. t['\uFD9F'] = '\u062A\u062C\u064A';
  35192. t['\uFDA0'] = '\u062A\u062C\u0649';
  35193. t['\uFDA1'] = '\u062A\u062E\u064A';
  35194. t['\uFDA2'] = '\u062A\u062E\u0649';
  35195. t['\uFDA3'] = '\u062A\u0645\u064A';
  35196. t['\uFDA4'] = '\u062A\u0645\u0649';
  35197. t['\uFDA5'] = '\u062C\u0645\u064A';
  35198. t['\uFDA6'] = '\u062C\u062D\u0649';
  35199. t['\uFDA7'] = '\u062C\u0645\u0649';
  35200. t['\uFDA8'] = '\u0633\u062E\u0649';
  35201. t['\uFDA9'] = '\u0635\u062D\u064A';
  35202. t['\uFDAA'] = '\u0634\u062D\u064A';
  35203. t['\uFDAB'] = '\u0636\u062D\u064A';
  35204. t['\uFDAC'] = '\u0644\u062C\u064A';
  35205. t['\uFDAD'] = '\u0644\u0645\u064A';
  35206. t['\uFDAE'] = '\u064A\u062D\u064A';
  35207. t['\uFDAF'] = '\u064A\u062C\u064A';
  35208. t['\uFDB0'] = '\u064A\u0645\u064A';
  35209. t['\uFDB1'] = '\u0645\u0645\u064A';
  35210. t['\uFDB2'] = '\u0642\u0645\u064A';
  35211. t['\uFDB3'] = '\u0646\u062D\u064A';
  35212. t['\uFDB4'] = '\u0642\u0645\u062D';
  35213. t['\uFDB5'] = '\u0644\u062D\u0645';
  35214. t['\uFDB6'] = '\u0639\u0645\u064A';
  35215. t['\uFDB7'] = '\u0643\u0645\u064A';
  35216. t['\uFDB8'] = '\u0646\u062C\u062D';
  35217. t['\uFDB9'] = '\u0645\u062E\u064A';
  35218. t['\uFDBA'] = '\u0644\u062C\u0645';
  35219. t['\uFDBB'] = '\u0643\u0645\u0645';
  35220. t['\uFDBC'] = '\u0644\u062C\u0645';
  35221. t['\uFDBD'] = '\u0646\u062C\u062D';
  35222. t['\uFDBE'] = '\u062C\u062D\u064A';
  35223. t['\uFDBF'] = '\u062D\u062C\u064A';
  35224. t['\uFDC0'] = '\u0645\u062C\u064A';
  35225. t['\uFDC1'] = '\u0641\u0645\u064A';
  35226. t['\uFDC2'] = '\u0628\u062D\u064A';
  35227. t['\uFDC3'] = '\u0643\u0645\u0645';
  35228. t['\uFDC4'] = '\u0639\u062C\u0645';
  35229. t['\uFDC5'] = '\u0635\u0645\u0645';
  35230. t['\uFDC6'] = '\u0633\u062E\u064A';
  35231. t['\uFDC7'] = '\u0646\u062C\u064A';
  35232. t['\uFE49'] = '\u203E';
  35233. t['\uFE4A'] = '\u203E';
  35234. t['\uFE4B'] = '\u203E';
  35235. t['\uFE4C'] = '\u203E';
  35236. t['\uFE4D'] = '\u005F';
  35237. t['\uFE4E'] = '\u005F';
  35238. t['\uFE4F'] = '\u005F';
  35239. t['\uFE80'] = '\u0621';
  35240. t['\uFE81'] = '\u0622';
  35241. t['\uFE82'] = '\u0622';
  35242. t['\uFE83'] = '\u0623';
  35243. t['\uFE84'] = '\u0623';
  35244. t['\uFE85'] = '\u0624';
  35245. t['\uFE86'] = '\u0624';
  35246. t['\uFE87'] = '\u0625';
  35247. t['\uFE88'] = '\u0625';
  35248. t['\uFE89'] = '\u0626';
  35249. t['\uFE8A'] = '\u0626';
  35250. t['\uFE8B'] = '\u0626';
  35251. t['\uFE8C'] = '\u0626';
  35252. t['\uFE8D'] = '\u0627';
  35253. t['\uFE8E'] = '\u0627';
  35254. t['\uFE8F'] = '\u0628';
  35255. t['\uFE90'] = '\u0628';
  35256. t['\uFE91'] = '\u0628';
  35257. t['\uFE92'] = '\u0628';
  35258. t['\uFE93'] = '\u0629';
  35259. t['\uFE94'] = '\u0629';
  35260. t['\uFE95'] = '\u062A';
  35261. t['\uFE96'] = '\u062A';
  35262. t['\uFE97'] = '\u062A';
  35263. t['\uFE98'] = '\u062A';
  35264. t['\uFE99'] = '\u062B';
  35265. t['\uFE9A'] = '\u062B';
  35266. t['\uFE9B'] = '\u062B';
  35267. t['\uFE9C'] = '\u062B';
  35268. t['\uFE9D'] = '\u062C';
  35269. t['\uFE9E'] = '\u062C';
  35270. t['\uFE9F'] = '\u062C';
  35271. t['\uFEA0'] = '\u062C';
  35272. t['\uFEA1'] = '\u062D';
  35273. t['\uFEA2'] = '\u062D';
  35274. t['\uFEA3'] = '\u062D';
  35275. t['\uFEA4'] = '\u062D';
  35276. t['\uFEA5'] = '\u062E';
  35277. t['\uFEA6'] = '\u062E';
  35278. t['\uFEA7'] = '\u062E';
  35279. t['\uFEA8'] = '\u062E';
  35280. t['\uFEA9'] = '\u062F';
  35281. t['\uFEAA'] = '\u062F';
  35282. t['\uFEAB'] = '\u0630';
  35283. t['\uFEAC'] = '\u0630';
  35284. t['\uFEAD'] = '\u0631';
  35285. t['\uFEAE'] = '\u0631';
  35286. t['\uFEAF'] = '\u0632';
  35287. t['\uFEB0'] = '\u0632';
  35288. t['\uFEB1'] = '\u0633';
  35289. t['\uFEB2'] = '\u0633';
  35290. t['\uFEB3'] = '\u0633';
  35291. t['\uFEB4'] = '\u0633';
  35292. t['\uFEB5'] = '\u0634';
  35293. t['\uFEB6'] = '\u0634';
  35294. t['\uFEB7'] = '\u0634';
  35295. t['\uFEB8'] = '\u0634';
  35296. t['\uFEB9'] = '\u0635';
  35297. t['\uFEBA'] = '\u0635';
  35298. t['\uFEBB'] = '\u0635';
  35299. t['\uFEBC'] = '\u0635';
  35300. t['\uFEBD'] = '\u0636';
  35301. t['\uFEBE'] = '\u0636';
  35302. t['\uFEBF'] = '\u0636';
  35303. t['\uFEC0'] = '\u0636';
  35304. t['\uFEC1'] = '\u0637';
  35305. t['\uFEC2'] = '\u0637';
  35306. t['\uFEC3'] = '\u0637';
  35307. t['\uFEC4'] = '\u0637';
  35308. t['\uFEC5'] = '\u0638';
  35309. t['\uFEC6'] = '\u0638';
  35310. t['\uFEC7'] = '\u0638';
  35311. t['\uFEC8'] = '\u0638';
  35312. t['\uFEC9'] = '\u0639';
  35313. t['\uFECA'] = '\u0639';
  35314. t['\uFECB'] = '\u0639';
  35315. t['\uFECC'] = '\u0639';
  35316. t['\uFECD'] = '\u063A';
  35317. t['\uFECE'] = '\u063A';
  35318. t['\uFECF'] = '\u063A';
  35319. t['\uFED0'] = '\u063A';
  35320. t['\uFED1'] = '\u0641';
  35321. t['\uFED2'] = '\u0641';
  35322. t['\uFED3'] = '\u0641';
  35323. t['\uFED4'] = '\u0641';
  35324. t['\uFED5'] = '\u0642';
  35325. t['\uFED6'] = '\u0642';
  35326. t['\uFED7'] = '\u0642';
  35327. t['\uFED8'] = '\u0642';
  35328. t['\uFED9'] = '\u0643';
  35329. t['\uFEDA'] = '\u0643';
  35330. t['\uFEDB'] = '\u0643';
  35331. t['\uFEDC'] = '\u0643';
  35332. t['\uFEDD'] = '\u0644';
  35333. t['\uFEDE'] = '\u0644';
  35334. t['\uFEDF'] = '\u0644';
  35335. t['\uFEE0'] = '\u0644';
  35336. t['\uFEE1'] = '\u0645';
  35337. t['\uFEE2'] = '\u0645';
  35338. t['\uFEE3'] = '\u0645';
  35339. t['\uFEE4'] = '\u0645';
  35340. t['\uFEE5'] = '\u0646';
  35341. t['\uFEE6'] = '\u0646';
  35342. t['\uFEE7'] = '\u0646';
  35343. t['\uFEE8'] = '\u0646';
  35344. t['\uFEE9'] = '\u0647';
  35345. t['\uFEEA'] = '\u0647';
  35346. t['\uFEEB'] = '\u0647';
  35347. t['\uFEEC'] = '\u0647';
  35348. t['\uFEED'] = '\u0648';
  35349. t['\uFEEE'] = '\u0648';
  35350. t['\uFEEF'] = '\u0649';
  35351. t['\uFEF0'] = '\u0649';
  35352. t['\uFEF1'] = '\u064A';
  35353. t['\uFEF2'] = '\u064A';
  35354. t['\uFEF3'] = '\u064A';
  35355. t['\uFEF4'] = '\u064A';
  35356. t['\uFEF5'] = '\u0644\u0622';
  35357. t['\uFEF6'] = '\u0644\u0622';
  35358. t['\uFEF7'] = '\u0644\u0623';
  35359. t['\uFEF8'] = '\u0644\u0623';
  35360. t['\uFEF9'] = '\u0644\u0625';
  35361. t['\uFEFA'] = '\u0644\u0625';
  35362. t['\uFEFB'] = '\u0644\u0627';
  35363. t['\uFEFC'] = '\u0644\u0627';
  35364. });
  35365. function reverseIfRtl(chars) {
  35366. var charsLength = chars.length;
  35367. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  35368. return chars;
  35369. }
  35370. var s = '';
  35371. for (var ii = charsLength - 1; ii >= 0; ii--) {
  35372. s += chars[ii];
  35373. }
  35374. return s;
  35375. }
  35376. exports.mapSpecialUnicodeValues = mapSpecialUnicodeValues;
  35377. exports.reverseIfRtl = reverseIfRtl;
  35378. exports.getUnicodeRangeFor = getUnicodeRangeFor;
  35379. exports.getNormalizedUnicodes = getNormalizedUnicodes;
  35380. exports.getUnicodeForGlyph = getUnicodeForGlyph;
  35381. /***/ }),
  35382. /* 18 */
  35383. /***/ (function(module, exports, __w_pdfjs_require__) {
  35384. "use strict";
  35385. var sharedUtil = __w_pdfjs_require__(0);
  35386. var coreWorker = __w_pdfjs_require__(8);
  35387. var OK_RESPONSE = 200;
  35388. var PARTIAL_CONTENT_RESPONSE = 206;
  35389. function NetworkManager(url, args) {
  35390. this.url = url;
  35391. args = args || {};
  35392. this.isHttp = /^https?:/i.test(url);
  35393. this.httpHeaders = this.isHttp && args.httpHeaders || {};
  35394. this.withCredentials = args.withCredentials || false;
  35395. this.getXhr = args.getXhr || function NetworkManager_getXhr() {
  35396. return new XMLHttpRequest();
  35397. };
  35398. this.currXhrId = 0;
  35399. this.pendingRequests = Object.create(null);
  35400. this.loadedRequests = Object.create(null);
  35401. }
  35402. function getArrayBuffer(xhr) {
  35403. var data = xhr.response;
  35404. if (typeof data !== 'string') {
  35405. return data;
  35406. }
  35407. var length = data.length;
  35408. var array = new Uint8Array(length);
  35409. for (var i = 0; i < length; i++) {
  35410. array[i] = data.charCodeAt(i) & 0xFF;
  35411. }
  35412. return array.buffer;
  35413. }
  35414. var supportsMozChunked = function supportsMozChunkedClosure() {
  35415. try {
  35416. var x = new XMLHttpRequest();
  35417. x.open('GET', 'https://example.com');
  35418. x.responseType = 'moz-chunked-arraybuffer';
  35419. return x.responseType === 'moz-chunked-arraybuffer';
  35420. } catch (e) {
  35421. return false;
  35422. }
  35423. }();
  35424. NetworkManager.prototype = {
  35425. requestRange: function NetworkManager_requestRange(begin, end, listeners) {
  35426. var args = {
  35427. begin: begin,
  35428. end: end
  35429. };
  35430. for (var prop in listeners) {
  35431. args[prop] = listeners[prop];
  35432. }
  35433. return this.request(args);
  35434. },
  35435. requestFull: function NetworkManager_requestFull(listeners) {
  35436. return this.request(listeners);
  35437. },
  35438. request: function NetworkManager_request(args) {
  35439. var xhr = this.getXhr();
  35440. var xhrId = this.currXhrId++;
  35441. var pendingRequest = this.pendingRequests[xhrId] = { xhr: xhr };
  35442. xhr.open('GET', this.url);
  35443. xhr.withCredentials = this.withCredentials;
  35444. for (var property in this.httpHeaders) {
  35445. var value = this.httpHeaders[property];
  35446. if (typeof value === 'undefined') {
  35447. continue;
  35448. }
  35449. xhr.setRequestHeader(property, value);
  35450. }
  35451. if (this.isHttp && 'begin' in args && 'end' in args) {
  35452. var rangeStr = args.begin + '-' + (args.end - 1);
  35453. xhr.setRequestHeader('Range', 'bytes=' + rangeStr);
  35454. pendingRequest.expectedStatus = 206;
  35455. } else {
  35456. pendingRequest.expectedStatus = 200;
  35457. }
  35458. var useMozChunkedLoading = supportsMozChunked && !!args.onProgressiveData;
  35459. if (useMozChunkedLoading) {
  35460. xhr.responseType = 'moz-chunked-arraybuffer';
  35461. pendingRequest.onProgressiveData = args.onProgressiveData;
  35462. pendingRequest.mozChunked = true;
  35463. } else {
  35464. xhr.responseType = 'arraybuffer';
  35465. }
  35466. if (args.onError) {
  35467. xhr.onerror = function (evt) {
  35468. args.onError(xhr.status);
  35469. };
  35470. }
  35471. xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);
  35472. xhr.onprogress = this.onProgress.bind(this, xhrId);
  35473. pendingRequest.onHeadersReceived = args.onHeadersReceived;
  35474. pendingRequest.onDone = args.onDone;
  35475. pendingRequest.onError = args.onError;
  35476. pendingRequest.onProgress = args.onProgress;
  35477. xhr.send(null);
  35478. return xhrId;
  35479. },
  35480. onProgress: function NetworkManager_onProgress(xhrId, evt) {
  35481. var pendingRequest = this.pendingRequests[xhrId];
  35482. if (!pendingRequest) {
  35483. return;
  35484. }
  35485. if (pendingRequest.mozChunked) {
  35486. var chunk = getArrayBuffer(pendingRequest.xhr);
  35487. pendingRequest.onProgressiveData(chunk);
  35488. }
  35489. var onProgress = pendingRequest.onProgress;
  35490. if (onProgress) {
  35491. onProgress(evt);
  35492. }
  35493. },
  35494. onStateChange: function NetworkManager_onStateChange(xhrId, evt) {
  35495. var pendingRequest = this.pendingRequests[xhrId];
  35496. if (!pendingRequest) {
  35497. return;
  35498. }
  35499. var xhr = pendingRequest.xhr;
  35500. if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {
  35501. pendingRequest.onHeadersReceived();
  35502. delete pendingRequest.onHeadersReceived;
  35503. }
  35504. if (xhr.readyState !== 4) {
  35505. return;
  35506. }
  35507. if (!(xhrId in this.pendingRequests)) {
  35508. return;
  35509. }
  35510. delete this.pendingRequests[xhrId];
  35511. if (xhr.status === 0 && this.isHttp) {
  35512. if (pendingRequest.onError) {
  35513. pendingRequest.onError(xhr.status);
  35514. }
  35515. return;
  35516. }
  35517. var xhrStatus = xhr.status || OK_RESPONSE;
  35518. var ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;
  35519. if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) {
  35520. if (pendingRequest.onError) {
  35521. pendingRequest.onError(xhr.status);
  35522. }
  35523. return;
  35524. }
  35525. this.loadedRequests[xhrId] = true;
  35526. var chunk = getArrayBuffer(xhr);
  35527. if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
  35528. var rangeHeader = xhr.getResponseHeader('Content-Range');
  35529. var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
  35530. var begin = parseInt(matches[1], 10);
  35531. pendingRequest.onDone({
  35532. begin: begin,
  35533. chunk: chunk
  35534. });
  35535. } else if (pendingRequest.onProgressiveData) {
  35536. pendingRequest.onDone(null);
  35537. } else if (chunk) {
  35538. pendingRequest.onDone({
  35539. begin: 0,
  35540. chunk: chunk
  35541. });
  35542. } else if (pendingRequest.onError) {
  35543. pendingRequest.onError(xhr.status);
  35544. }
  35545. },
  35546. hasPendingRequests: function NetworkManager_hasPendingRequests() {
  35547. for (var xhrId in this.pendingRequests) {
  35548. return true;
  35549. }
  35550. return false;
  35551. },
  35552. getRequestXhr: function NetworkManager_getXhr(xhrId) {
  35553. return this.pendingRequests[xhrId].xhr;
  35554. },
  35555. isStreamingRequest: function NetworkManager_isStreamingRequest(xhrId) {
  35556. return !!this.pendingRequests[xhrId].onProgressiveData;
  35557. },
  35558. isPendingRequest: function NetworkManager_isPendingRequest(xhrId) {
  35559. return xhrId in this.pendingRequests;
  35560. },
  35561. isLoadedRequest: function NetworkManager_isLoadedRequest(xhrId) {
  35562. return xhrId in this.loadedRequests;
  35563. },
  35564. abortAllRequests: function NetworkManager_abortAllRequests() {
  35565. for (var xhrId in this.pendingRequests) {
  35566. this.abortRequest(xhrId | 0);
  35567. }
  35568. },
  35569. abortRequest: function NetworkManager_abortRequest(xhrId) {
  35570. var xhr = this.pendingRequests[xhrId].xhr;
  35571. delete this.pendingRequests[xhrId];
  35572. xhr.abort();
  35573. }
  35574. };
  35575. var assert = sharedUtil.assert;
  35576. var createPromiseCapability = sharedUtil.createPromiseCapability;
  35577. var isInt = sharedUtil.isInt;
  35578. var MissingPDFException = sharedUtil.MissingPDFException;
  35579. var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
  35580. function PDFNetworkStream(options) {
  35581. this._options = options;
  35582. var source = options.source;
  35583. this._manager = new NetworkManager(source.url, {
  35584. httpHeaders: source.httpHeaders,
  35585. withCredentials: source.withCredentials
  35586. });
  35587. this._rangeChunkSize = source.rangeChunkSize;
  35588. this._fullRequestReader = null;
  35589. this._rangeRequestReaders = [];
  35590. }
  35591. PDFNetworkStream.prototype = {
  35592. _onRangeRequestReaderClosed: function PDFNetworkStream_onRangeRequestReaderClosed(reader) {
  35593. var i = this._rangeRequestReaders.indexOf(reader);
  35594. if (i >= 0) {
  35595. this._rangeRequestReaders.splice(i, 1);
  35596. }
  35597. },
  35598. getFullReader: function PDFNetworkStream_getFullReader() {
  35599. assert(!this._fullRequestReader);
  35600. this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._options);
  35601. return this._fullRequestReader;
  35602. },
  35603. getRangeReader: function PDFNetworkStream_getRangeReader(begin, end) {
  35604. var reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end);
  35605. reader.onClosed = this._onRangeRequestReaderClosed.bind(this);
  35606. this._rangeRequestReaders.push(reader);
  35607. return reader;
  35608. },
  35609. cancelAllRequests: function PDFNetworkStream_cancelAllRequests(reason) {
  35610. if (this._fullRequestReader) {
  35611. this._fullRequestReader.cancel(reason);
  35612. }
  35613. var readers = this._rangeRequestReaders.slice(0);
  35614. readers.forEach(function (reader) {
  35615. reader.cancel(reason);
  35616. });
  35617. }
  35618. };
  35619. function PDFNetworkStreamFullRequestReader(manager, options) {
  35620. this._manager = manager;
  35621. var source = options.source;
  35622. var args = {
  35623. onHeadersReceived: this._onHeadersReceived.bind(this),
  35624. onProgressiveData: source.disableStream ? null : this._onProgressiveData.bind(this),
  35625. onDone: this._onDone.bind(this),
  35626. onError: this._onError.bind(this),
  35627. onProgress: this._onProgress.bind(this)
  35628. };
  35629. this._url = source.url;
  35630. this._fullRequestId = manager.requestFull(args);
  35631. this._headersReceivedCapability = createPromiseCapability();
  35632. this._disableRange = options.disableRange || false;
  35633. this._contentLength = source.length;
  35634. this._rangeChunkSize = source.rangeChunkSize;
  35635. if (!this._rangeChunkSize && !this._disableRange) {
  35636. this._disableRange = true;
  35637. }
  35638. this._isStreamingSupported = false;
  35639. this._isRangeSupported = false;
  35640. this._cachedChunks = [];
  35641. this._requests = [];
  35642. this._done = false;
  35643. this._storedError = undefined;
  35644. this.onProgress = null;
  35645. }
  35646. PDFNetworkStreamFullRequestReader.prototype = {
  35647. _validateRangeRequestCapabilities: function PDFNetworkStreamFullRequestReader_validateRangeRequestCapabilities() {
  35648. if (this._disableRange) {
  35649. return false;
  35650. }
  35651. var networkManager = this._manager;
  35652. if (!networkManager.isHttp) {
  35653. return false;
  35654. }
  35655. var fullRequestXhrId = this._fullRequestId;
  35656. var fullRequestXhr = networkManager.getRequestXhr(fullRequestXhrId);
  35657. if (fullRequestXhr.getResponseHeader('Accept-Ranges') !== 'bytes') {
  35658. return false;
  35659. }
  35660. var contentEncoding = fullRequestXhr.getResponseHeader('Content-Encoding') || 'identity';
  35661. if (contentEncoding !== 'identity') {
  35662. return false;
  35663. }
  35664. var length = fullRequestXhr.getResponseHeader('Content-Length');
  35665. length = parseInt(length, 10);
  35666. if (!isInt(length)) {
  35667. return false;
  35668. }
  35669. this._contentLength = length;
  35670. if (length <= 2 * this._rangeChunkSize) {
  35671. return false;
  35672. }
  35673. return true;
  35674. },
  35675. _onHeadersReceived: function PDFNetworkStreamFullRequestReader_onHeadersReceived() {
  35676. if (this._validateRangeRequestCapabilities()) {
  35677. this._isRangeSupported = true;
  35678. }
  35679. var networkManager = this._manager;
  35680. var fullRequestXhrId = this._fullRequestId;
  35681. if (networkManager.isStreamingRequest(fullRequestXhrId)) {
  35682. this._isStreamingSupported = true;
  35683. } else if (this._isRangeSupported) {
  35684. networkManager.abortRequest(fullRequestXhrId);
  35685. }
  35686. this._headersReceivedCapability.resolve();
  35687. },
  35688. _onProgressiveData: function PDFNetworkStreamFullRequestReader_onProgressiveData(chunk) {
  35689. if (this._requests.length > 0) {
  35690. var requestCapability = this._requests.shift();
  35691. requestCapability.resolve({
  35692. value: chunk,
  35693. done: false
  35694. });
  35695. } else {
  35696. this._cachedChunks.push(chunk);
  35697. }
  35698. },
  35699. _onDone: function PDFNetworkStreamFullRequestReader_onDone(args) {
  35700. if (args) {
  35701. this._onProgressiveData(args.chunk);
  35702. }
  35703. this._done = true;
  35704. if (this._cachedChunks.length > 0) {
  35705. return;
  35706. }
  35707. this._requests.forEach(function (requestCapability) {
  35708. requestCapability.resolve({
  35709. value: undefined,
  35710. done: true
  35711. });
  35712. });
  35713. this._requests = [];
  35714. },
  35715. _onError: function PDFNetworkStreamFullRequestReader_onError(status) {
  35716. var url = this._url;
  35717. var exception;
  35718. if (status === 404 || status === 0 && /^file:/.test(url)) {
  35719. exception = new MissingPDFException('Missing PDF "' + url + '".');
  35720. } else {
  35721. exception = new UnexpectedResponseException('Unexpected server response (' + status + ') while retrieving PDF "' + url + '".', status);
  35722. }
  35723. this._storedError = exception;
  35724. this._headersReceivedCapability.reject(exception);
  35725. this._requests.forEach(function (requestCapability) {
  35726. requestCapability.reject(exception);
  35727. });
  35728. this._requests = [];
  35729. this._cachedChunks = [];
  35730. },
  35731. _onProgress: function PDFNetworkStreamFullRequestReader_onProgress(data) {
  35732. if (this.onProgress) {
  35733. this.onProgress({
  35734. loaded: data.loaded,
  35735. total: data.lengthComputable ? data.total : this._contentLength
  35736. });
  35737. }
  35738. },
  35739. get isRangeSupported() {
  35740. return this._isRangeSupported;
  35741. },
  35742. get isStreamingSupported() {
  35743. return this._isStreamingSupported;
  35744. },
  35745. get contentLength() {
  35746. return this._contentLength;
  35747. },
  35748. get headersReady() {
  35749. return this._headersReceivedCapability.promise;
  35750. },
  35751. read: function PDFNetworkStreamFullRequestReader_read() {
  35752. if (this._storedError) {
  35753. return Promise.reject(this._storedError);
  35754. }
  35755. if (this._cachedChunks.length > 0) {
  35756. var chunk = this._cachedChunks.shift();
  35757. return Promise.resolve(chunk);
  35758. }
  35759. if (this._done) {
  35760. return Promise.resolve({
  35761. value: undefined,
  35762. done: true
  35763. });
  35764. }
  35765. var requestCapability = createPromiseCapability();
  35766. this._requests.push(requestCapability);
  35767. return requestCapability.promise;
  35768. },
  35769. cancel: function PDFNetworkStreamFullRequestReader_cancel(reason) {
  35770. this._done = true;
  35771. this._headersReceivedCapability.reject(reason);
  35772. this._requests.forEach(function (requestCapability) {
  35773. requestCapability.resolve({
  35774. value: undefined,
  35775. done: true
  35776. });
  35777. });
  35778. this._requests = [];
  35779. if (this._manager.isPendingRequest(this._fullRequestId)) {
  35780. this._manager.abortRequest(this._fullRequestId);
  35781. }
  35782. this._fullRequestReader = null;
  35783. }
  35784. };
  35785. function PDFNetworkStreamRangeRequestReader(manager, begin, end) {
  35786. this._manager = manager;
  35787. var args = {
  35788. onDone: this._onDone.bind(this),
  35789. onProgress: this._onProgress.bind(this)
  35790. };
  35791. this._requestId = manager.requestRange(begin, end, args);
  35792. this._requests = [];
  35793. this._queuedChunk = null;
  35794. this._done = false;
  35795. this.onProgress = null;
  35796. this.onClosed = null;
  35797. }
  35798. PDFNetworkStreamRangeRequestReader.prototype = {
  35799. _close: function PDFNetworkStreamRangeRequestReader_close() {
  35800. if (this.onClosed) {
  35801. this.onClosed(this);
  35802. }
  35803. },
  35804. _onDone: function PDFNetworkStreamRangeRequestReader_onDone(data) {
  35805. var chunk = data.chunk;
  35806. if (this._requests.length > 0) {
  35807. var requestCapability = this._requests.shift();
  35808. requestCapability.resolve({
  35809. value: chunk,
  35810. done: false
  35811. });
  35812. } else {
  35813. this._queuedChunk = chunk;
  35814. }
  35815. this._done = true;
  35816. this._requests.forEach(function (requestCapability) {
  35817. requestCapability.resolve({
  35818. value: undefined,
  35819. done: true
  35820. });
  35821. });
  35822. this._requests = [];
  35823. this._close();
  35824. },
  35825. _onProgress: function PDFNetworkStreamRangeRequestReader_onProgress(evt) {
  35826. if (!this.isStreamingSupported && this.onProgress) {
  35827. this.onProgress({ loaded: evt.loaded });
  35828. }
  35829. },
  35830. get isStreamingSupported() {
  35831. return false;
  35832. },
  35833. read: function PDFNetworkStreamRangeRequestReader_read() {
  35834. if (this._queuedChunk !== null) {
  35835. var chunk = this._queuedChunk;
  35836. this._queuedChunk = null;
  35837. return Promise.resolve({
  35838. value: chunk,
  35839. done: false
  35840. });
  35841. }
  35842. if (this._done) {
  35843. return Promise.resolve({
  35844. value: undefined,
  35845. done: true
  35846. });
  35847. }
  35848. var requestCapability = createPromiseCapability();
  35849. this._requests.push(requestCapability);
  35850. return requestCapability.promise;
  35851. },
  35852. cancel: function PDFNetworkStreamRangeRequestReader_cancel(reason) {
  35853. this._done = true;
  35854. this._requests.forEach(function (requestCapability) {
  35855. requestCapability.resolve({
  35856. value: undefined,
  35857. done: true
  35858. });
  35859. });
  35860. this._requests = [];
  35861. if (this._manager.isPendingRequest(this._requestId)) {
  35862. this._manager.abortRequest(this._requestId);
  35863. }
  35864. this._close();
  35865. }
  35866. };
  35867. coreWorker.setPDFNetworkStreamClass(PDFNetworkStream);
  35868. exports.PDFNetworkStream = PDFNetworkStream;
  35869. exports.NetworkManager = NetworkManager;
  35870. /***/ }),
  35871. /* 19 */
  35872. /***/ (function(module, exports) {
  35873. var g;
  35874. g = function () {
  35875. return this;
  35876. }();
  35877. try {
  35878. g = g || Function("return this")() || (1, eval)("this");
  35879. } catch (e) {
  35880. if (typeof window === "object")
  35881. g = window;
  35882. }
  35883. module.exports = g;
  35884. /***/ }),
  35885. /* 20 */
  35886. /***/ (function(module, exports) {
  35887. module.exports = function (module) {
  35888. if (!module.webpackPolyfill) {
  35889. module.deprecate = function () {
  35890. };
  35891. module.paths = [];
  35892. if (!module.children)
  35893. module.children = [];
  35894. Object.defineProperty(module, "loaded", {
  35895. enumerable: true,
  35896. get: function () {
  35897. return module.l;
  35898. }
  35899. });
  35900. Object.defineProperty(module, "id", {
  35901. enumerable: true,
  35902. get: function () {
  35903. return module.i;
  35904. }
  35905. });
  35906. module.webpackPolyfill = 1;
  35907. }
  35908. return module;
  35909. };
  35910. /***/ }),
  35911. /* 21 */
  35912. /***/ (function(module, exports, __w_pdfjs_require__) {
  35913. "use strict";
  35914. var sharedUtil = __w_pdfjs_require__(0);
  35915. var corePrimitives = __w_pdfjs_require__(1);
  35916. var coreStream = __w_pdfjs_require__(2);
  35917. var coreColorSpace = __w_pdfjs_require__(3);
  35918. var coreObj = __w_pdfjs_require__(15);
  35919. var coreEvaluator = __w_pdfjs_require__(13);
  35920. var AnnotationBorderStyleType = sharedUtil.AnnotationBorderStyleType;
  35921. var AnnotationFieldFlag = sharedUtil.AnnotationFieldFlag;
  35922. var AnnotationFlag = sharedUtil.AnnotationFlag;
  35923. var AnnotationType = sharedUtil.AnnotationType;
  35924. var OPS = sharedUtil.OPS;
  35925. var Util = sharedUtil.Util;
  35926. var isArray = sharedUtil.isArray;
  35927. var isInt = sharedUtil.isInt;
  35928. var stringToBytes = sharedUtil.stringToBytes;
  35929. var stringToPDFString = sharedUtil.stringToPDFString;
  35930. var warn = sharedUtil.warn;
  35931. var Dict = corePrimitives.Dict;
  35932. var isDict = corePrimitives.isDict;
  35933. var isName = corePrimitives.isName;
  35934. var isRef = corePrimitives.isRef;
  35935. var Stream = coreStream.Stream;
  35936. var ColorSpace = coreColorSpace.ColorSpace;
  35937. var Catalog = coreObj.Catalog;
  35938. var ObjectLoader = coreObj.ObjectLoader;
  35939. var FileSpec = coreObj.FileSpec;
  35940. var OperatorList = coreEvaluator.OperatorList;
  35941. function AnnotationFactory() {
  35942. }
  35943. AnnotationFactory.prototype = {
  35944. create: function AnnotationFactory_create(xref, ref, pdfManager, idFactory) {
  35945. var dict = xref.fetchIfRef(ref);
  35946. if (!isDict(dict)) {
  35947. return;
  35948. }
  35949. var id = isRef(ref) ? ref.toString() : 'annot_' + idFactory.createObjId();
  35950. var subtype = dict.get('Subtype');
  35951. subtype = isName(subtype) ? subtype.name : null;
  35952. var parameters = {
  35953. xref: xref,
  35954. dict: dict,
  35955. ref: isRef(ref) ? ref : null,
  35956. subtype: subtype,
  35957. id: id,
  35958. pdfManager: pdfManager
  35959. };
  35960. switch (subtype) {
  35961. case 'Link':
  35962. return new LinkAnnotation(parameters);
  35963. case 'Text':
  35964. return new TextAnnotation(parameters);
  35965. case 'Widget':
  35966. var fieldType = Util.getInheritableProperty(dict, 'FT');
  35967. fieldType = isName(fieldType) ? fieldType.name : null;
  35968. switch (fieldType) {
  35969. case 'Tx':
  35970. return new TextWidgetAnnotation(parameters);
  35971. case 'Btn':
  35972. return new ButtonWidgetAnnotation(parameters);
  35973. case 'Ch':
  35974. return new ChoiceWidgetAnnotation(parameters);
  35975. }
  35976. warn('Unimplemented widget field type "' + fieldType + '", ' + 'falling back to base field type.');
  35977. return new WidgetAnnotation(parameters);
  35978. case 'Popup':
  35979. return new PopupAnnotation(parameters);
  35980. case 'Highlight':
  35981. return new HighlightAnnotation(parameters);
  35982. case 'Underline':
  35983. return new UnderlineAnnotation(parameters);
  35984. case 'Squiggly':
  35985. return new SquigglyAnnotation(parameters);
  35986. case 'StrikeOut':
  35987. return new StrikeOutAnnotation(parameters);
  35988. case 'FileAttachment':
  35989. return new FileAttachmentAnnotation(parameters);
  35990. default:
  35991. if (!subtype) {
  35992. warn('Annotation is missing the required /Subtype.');
  35993. } else {
  35994. warn('Unimplemented annotation type "' + subtype + '", ' + 'falling back to base annotation.');
  35995. }
  35996. return new Annotation(parameters);
  35997. }
  35998. }
  35999. };
  36000. var Annotation = function AnnotationClosure() {
  36001. function getTransformMatrix(rect, bbox, matrix) {
  36002. var bounds = Util.getAxialAlignedBoundingBox(bbox, matrix);
  36003. var minX = bounds[0];
  36004. var minY = bounds[1];
  36005. var maxX = bounds[2];
  36006. var maxY = bounds[3];
  36007. if (minX === maxX || minY === maxY) {
  36008. return [
  36009. 1,
  36010. 0,
  36011. 0,
  36012. 1,
  36013. rect[0],
  36014. rect[1]
  36015. ];
  36016. }
  36017. var xRatio = (rect[2] - rect[0]) / (maxX - minX);
  36018. var yRatio = (rect[3] - rect[1]) / (maxY - minY);
  36019. return [
  36020. xRatio,
  36021. 0,
  36022. 0,
  36023. yRatio,
  36024. rect[0] - minX * xRatio,
  36025. rect[1] - minY * yRatio
  36026. ];
  36027. }
  36028. function getDefaultAppearance(dict) {
  36029. var appearanceState = dict.get('AP');
  36030. if (!isDict(appearanceState)) {
  36031. return;
  36032. }
  36033. var appearance;
  36034. var appearances = appearanceState.get('N');
  36035. if (isDict(appearances)) {
  36036. var as = dict.get('AS');
  36037. if (as && appearances.has(as.name)) {
  36038. appearance = appearances.get(as.name);
  36039. }
  36040. } else {
  36041. appearance = appearances;
  36042. }
  36043. return appearance;
  36044. }
  36045. function Annotation(params) {
  36046. var dict = params.dict;
  36047. this.setFlags(dict.get('F'));
  36048. this.setRectangle(dict.getArray('Rect'));
  36049. this.setColor(dict.getArray('C'));
  36050. this.setBorderStyle(dict);
  36051. this.appearance = getDefaultAppearance(dict);
  36052. this.data = {};
  36053. this.data.id = params.id;
  36054. this.data.subtype = params.subtype;
  36055. this.data.annotationFlags = this.flags;
  36056. this.data.rect = this.rectangle;
  36057. this.data.color = this.color;
  36058. this.data.borderStyle = this.borderStyle;
  36059. this.data.hasAppearance = !!this.appearance;
  36060. }
  36061. Annotation.prototype = {
  36062. _hasFlag: function Annotation_hasFlag(flags, flag) {
  36063. return !!(flags & flag);
  36064. },
  36065. _isViewable: function Annotation_isViewable(flags) {
  36066. return !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.HIDDEN) && !this._hasFlag(flags, AnnotationFlag.NOVIEW);
  36067. },
  36068. _isPrintable: function AnnotationFlag_isPrintable(flags) {
  36069. return this._hasFlag(flags, AnnotationFlag.PRINT) && !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.HIDDEN);
  36070. },
  36071. get viewable() {
  36072. if (this.flags === 0) {
  36073. return true;
  36074. }
  36075. return this._isViewable(this.flags);
  36076. },
  36077. get printable() {
  36078. if (this.flags === 0) {
  36079. return false;
  36080. }
  36081. return this._isPrintable(this.flags);
  36082. },
  36083. setFlags: function Annotation_setFlags(flags) {
  36084. this.flags = isInt(flags) && flags > 0 ? flags : 0;
  36085. },
  36086. hasFlag: function Annotation_hasFlag(flag) {
  36087. return this._hasFlag(this.flags, flag);
  36088. },
  36089. setRectangle: function Annotation_setRectangle(rectangle) {
  36090. if (isArray(rectangle) && rectangle.length === 4) {
  36091. this.rectangle = Util.normalizeRect(rectangle);
  36092. } else {
  36093. this.rectangle = [
  36094. 0,
  36095. 0,
  36096. 0,
  36097. 0
  36098. ];
  36099. }
  36100. },
  36101. setColor: function Annotation_setColor(color) {
  36102. var rgbColor = new Uint8Array(3);
  36103. if (!isArray(color)) {
  36104. this.color = rgbColor;
  36105. return;
  36106. }
  36107. switch (color.length) {
  36108. case 0:
  36109. this.color = null;
  36110. break;
  36111. case 1:
  36112. ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  36113. this.color = rgbColor;
  36114. break;
  36115. case 3:
  36116. ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  36117. this.color = rgbColor;
  36118. break;
  36119. case 4:
  36120. ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  36121. this.color = rgbColor;
  36122. break;
  36123. default:
  36124. this.color = rgbColor;
  36125. break;
  36126. }
  36127. },
  36128. setBorderStyle: function Annotation_setBorderStyle(borderStyle) {
  36129. this.borderStyle = new AnnotationBorderStyle();
  36130. if (!isDict(borderStyle)) {
  36131. return;
  36132. }
  36133. if (borderStyle.has('BS')) {
  36134. var dict = borderStyle.get('BS');
  36135. var dictType = dict.get('Type');
  36136. if (!dictType || isName(dictType, 'Border')) {
  36137. this.borderStyle.setWidth(dict.get('W'));
  36138. this.borderStyle.setStyle(dict.get('S'));
  36139. this.borderStyle.setDashArray(dict.getArray('D'));
  36140. }
  36141. } else if (borderStyle.has('Border')) {
  36142. var array = borderStyle.getArray('Border');
  36143. if (isArray(array) && array.length >= 3) {
  36144. this.borderStyle.setHorizontalCornerRadius(array[0]);
  36145. this.borderStyle.setVerticalCornerRadius(array[1]);
  36146. this.borderStyle.setWidth(array[2]);
  36147. if (array.length === 4) {
  36148. this.borderStyle.setDashArray(array[3]);
  36149. }
  36150. }
  36151. } else {
  36152. this.borderStyle.setWidth(0);
  36153. }
  36154. },
  36155. _preparePopup: function Annotation_preparePopup(dict) {
  36156. if (!dict.has('C')) {
  36157. this.data.color = null;
  36158. }
  36159. this.data.hasPopup = dict.has('Popup');
  36160. this.data.title = stringToPDFString(dict.get('T') || '');
  36161. this.data.contents = stringToPDFString(dict.get('Contents') || '');
  36162. },
  36163. loadResources: function Annotation_loadResources(keys) {
  36164. return new Promise(function (resolve, reject) {
  36165. this.appearance.dict.getAsync('Resources').then(function (resources) {
  36166. if (!resources) {
  36167. resolve();
  36168. return;
  36169. }
  36170. var objectLoader = new ObjectLoader(resources.map, keys, resources.xref);
  36171. objectLoader.load().then(function () {
  36172. resolve(resources);
  36173. }, reject);
  36174. }, reject);
  36175. }.bind(this));
  36176. },
  36177. getOperatorList: function Annotation_getOperatorList(evaluator, task, renderForms) {
  36178. if (!this.appearance) {
  36179. return Promise.resolve(new OperatorList());
  36180. }
  36181. var data = this.data;
  36182. var appearanceDict = this.appearance.dict;
  36183. var resourcesPromise = this.loadResources([
  36184. 'ExtGState',
  36185. 'ColorSpace',
  36186. 'Pattern',
  36187. 'Shading',
  36188. 'XObject',
  36189. 'Font'
  36190. ]);
  36191. var bbox = appearanceDict.getArray('BBox') || [
  36192. 0,
  36193. 0,
  36194. 1,
  36195. 1
  36196. ];
  36197. var matrix = appearanceDict.getArray('Matrix') || [
  36198. 1,
  36199. 0,
  36200. 0,
  36201. 1,
  36202. 0,
  36203. 0
  36204. ];
  36205. var transform = getTransformMatrix(data.rect, bbox, matrix);
  36206. var self = this;
  36207. return resourcesPromise.then(function (resources) {
  36208. var opList = new OperatorList();
  36209. opList.addOp(OPS.beginAnnotation, [
  36210. data.rect,
  36211. transform,
  36212. matrix
  36213. ]);
  36214. return evaluator.getOperatorList(self.appearance, task, resources, opList).then(function () {
  36215. opList.addOp(OPS.endAnnotation, []);
  36216. self.appearance.reset();
  36217. return opList;
  36218. });
  36219. });
  36220. }
  36221. };
  36222. Annotation.appendToOperatorList = function Annotation_appendToOperatorList(annotations, opList, partialEvaluator, task, intent, renderForms) {
  36223. var annotationPromises = [];
  36224. for (var i = 0, n = annotations.length; i < n; ++i) {
  36225. if (intent === 'display' && annotations[i].viewable || intent === 'print' && annotations[i].printable) {
  36226. annotationPromises.push(annotations[i].getOperatorList(partialEvaluator, task, renderForms));
  36227. }
  36228. }
  36229. return Promise.all(annotationPromises).then(function (operatorLists) {
  36230. opList.addOp(OPS.beginAnnotations, []);
  36231. for (var i = 0, n = operatorLists.length; i < n; ++i) {
  36232. opList.addOpList(operatorLists[i]);
  36233. }
  36234. opList.addOp(OPS.endAnnotations, []);
  36235. });
  36236. };
  36237. return Annotation;
  36238. }();
  36239. var AnnotationBorderStyle = function AnnotationBorderStyleClosure() {
  36240. function AnnotationBorderStyle() {
  36241. this.width = 1;
  36242. this.style = AnnotationBorderStyleType.SOLID;
  36243. this.dashArray = [3];
  36244. this.horizontalCornerRadius = 0;
  36245. this.verticalCornerRadius = 0;
  36246. }
  36247. AnnotationBorderStyle.prototype = {
  36248. setWidth: function AnnotationBorderStyle_setWidth(width) {
  36249. if (width === (width | 0)) {
  36250. this.width = width;
  36251. }
  36252. },
  36253. setStyle: function AnnotationBorderStyle_setStyle(style) {
  36254. if (!style) {
  36255. return;
  36256. }
  36257. switch (style.name) {
  36258. case 'S':
  36259. this.style = AnnotationBorderStyleType.SOLID;
  36260. break;
  36261. case 'D':
  36262. this.style = AnnotationBorderStyleType.DASHED;
  36263. break;
  36264. case 'B':
  36265. this.style = AnnotationBorderStyleType.BEVELED;
  36266. break;
  36267. case 'I':
  36268. this.style = AnnotationBorderStyleType.INSET;
  36269. break;
  36270. case 'U':
  36271. this.style = AnnotationBorderStyleType.UNDERLINE;
  36272. break;
  36273. default:
  36274. break;
  36275. }
  36276. },
  36277. setDashArray: function AnnotationBorderStyle_setDashArray(dashArray) {
  36278. if (isArray(dashArray) && dashArray.length > 0) {
  36279. var isValid = true;
  36280. var allZeros = true;
  36281. for (var i = 0, len = dashArray.length; i < len; i++) {
  36282. var element = dashArray[i];
  36283. var validNumber = +element >= 0;
  36284. if (!validNumber) {
  36285. isValid = false;
  36286. break;
  36287. } else if (element > 0) {
  36288. allZeros = false;
  36289. }
  36290. }
  36291. if (isValid && !allZeros) {
  36292. this.dashArray = dashArray;
  36293. } else {
  36294. this.width = 0;
  36295. }
  36296. } else if (dashArray) {
  36297. this.width = 0;
  36298. }
  36299. },
  36300. setHorizontalCornerRadius: function AnnotationBorderStyle_setHorizontalCornerRadius(radius) {
  36301. if (radius === (radius | 0)) {
  36302. this.horizontalCornerRadius = radius;
  36303. }
  36304. },
  36305. setVerticalCornerRadius: function AnnotationBorderStyle_setVerticalCornerRadius(radius) {
  36306. if (radius === (radius | 0)) {
  36307. this.verticalCornerRadius = radius;
  36308. }
  36309. }
  36310. };
  36311. return AnnotationBorderStyle;
  36312. }();
  36313. var WidgetAnnotation = function WidgetAnnotationClosure() {
  36314. function WidgetAnnotation(params) {
  36315. Annotation.call(this, params);
  36316. var dict = params.dict;
  36317. var data = this.data;
  36318. data.annotationType = AnnotationType.WIDGET;
  36319. data.fieldName = this._constructFieldName(dict);
  36320. data.fieldValue = Util.getInheritableProperty(dict, 'V', true);
  36321. data.alternativeText = stringToPDFString(dict.get('TU') || '');
  36322. data.defaultAppearance = Util.getInheritableProperty(dict, 'DA') || '';
  36323. var fieldType = Util.getInheritableProperty(dict, 'FT');
  36324. data.fieldType = isName(fieldType) ? fieldType.name : null;
  36325. this.fieldResources = Util.getInheritableProperty(dict, 'DR') || Dict.empty;
  36326. data.fieldFlags = Util.getInheritableProperty(dict, 'Ff');
  36327. if (!isInt(data.fieldFlags) || data.fieldFlags < 0) {
  36328. data.fieldFlags = 0;
  36329. }
  36330. data.readOnly = this.hasFieldFlag(AnnotationFieldFlag.READONLY);
  36331. if (data.fieldType === 'Sig') {
  36332. this.setFlags(AnnotationFlag.HIDDEN);
  36333. }
  36334. }
  36335. Util.inherit(WidgetAnnotation, Annotation, {
  36336. _constructFieldName: function WidgetAnnotation_constructFieldName(dict) {
  36337. if (!dict.has('T') && !dict.has('Parent')) {
  36338. warn('Unknown field name, falling back to empty field name.');
  36339. return '';
  36340. }
  36341. if (!dict.has('Parent')) {
  36342. return stringToPDFString(dict.get('T'));
  36343. }
  36344. var fieldName = [];
  36345. if (dict.has('T')) {
  36346. fieldName.unshift(stringToPDFString(dict.get('T')));
  36347. }
  36348. var loopDict = dict;
  36349. while (loopDict.has('Parent')) {
  36350. loopDict = loopDict.get('Parent');
  36351. if (loopDict.has('T')) {
  36352. fieldName.unshift(stringToPDFString(loopDict.get('T')));
  36353. }
  36354. }
  36355. return fieldName.join('.');
  36356. },
  36357. hasFieldFlag: function WidgetAnnotation_hasFieldFlag(flag) {
  36358. return !!(this.data.fieldFlags & flag);
  36359. }
  36360. });
  36361. return WidgetAnnotation;
  36362. }();
  36363. var TextWidgetAnnotation = function TextWidgetAnnotationClosure() {
  36364. function TextWidgetAnnotation(params) {
  36365. WidgetAnnotation.call(this, params);
  36366. this.data.fieldValue = stringToPDFString(this.data.fieldValue || '');
  36367. var alignment = Util.getInheritableProperty(params.dict, 'Q');
  36368. if (!isInt(alignment) || alignment < 0 || alignment > 2) {
  36369. alignment = null;
  36370. }
  36371. this.data.textAlignment = alignment;
  36372. var maximumLength = Util.getInheritableProperty(params.dict, 'MaxLen');
  36373. if (!isInt(maximumLength) || maximumLength < 0) {
  36374. maximumLength = null;
  36375. }
  36376. this.data.maxLen = maximumLength;
  36377. this.data.multiLine = this.hasFieldFlag(AnnotationFieldFlag.MULTILINE);
  36378. this.data.comb = this.hasFieldFlag(AnnotationFieldFlag.COMB) && !this.hasFieldFlag(AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== null;
  36379. }
  36380. Util.inherit(TextWidgetAnnotation, WidgetAnnotation, {
  36381. getOperatorList: function TextWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  36382. var operatorList = new OperatorList();
  36383. if (renderForms) {
  36384. return Promise.resolve(operatorList);
  36385. }
  36386. if (this.appearance) {
  36387. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  36388. }
  36389. if (!this.data.defaultAppearance) {
  36390. return Promise.resolve(operatorList);
  36391. }
  36392. var stream = new Stream(stringToBytes(this.data.defaultAppearance));
  36393. return evaluator.getOperatorList(stream, task, this.fieldResources, operatorList).then(function () {
  36394. return operatorList;
  36395. });
  36396. }
  36397. });
  36398. return TextWidgetAnnotation;
  36399. }();
  36400. var ButtonWidgetAnnotation = function ButtonWidgetAnnotationClosure() {
  36401. function ButtonWidgetAnnotation(params) {
  36402. WidgetAnnotation.call(this, params);
  36403. this.data.checkBox = !this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  36404. if (this.data.checkBox) {
  36405. if (!isName(this.data.fieldValue)) {
  36406. return;
  36407. }
  36408. this.data.fieldValue = this.data.fieldValue.name;
  36409. }
  36410. this.data.radioButton = this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  36411. if (this.data.radioButton) {
  36412. this.data.fieldValue = this.data.buttonValue = null;
  36413. var fieldParent = params.dict.get('Parent');
  36414. if (isDict(fieldParent) && fieldParent.has('V')) {
  36415. var fieldParentValue = fieldParent.get('V');
  36416. if (isName(fieldParentValue)) {
  36417. this.data.fieldValue = fieldParentValue.name;
  36418. }
  36419. }
  36420. var appearanceStates = params.dict.get('AP');
  36421. if (!isDict(appearanceStates)) {
  36422. return;
  36423. }
  36424. var normalAppearanceState = appearanceStates.get('N');
  36425. if (!isDict(normalAppearanceState)) {
  36426. return;
  36427. }
  36428. var keys = normalAppearanceState.getKeys();
  36429. for (var i = 0, ii = keys.length; i < ii; i++) {
  36430. if (keys[i] !== 'Off') {
  36431. this.data.buttonValue = keys[i];
  36432. break;
  36433. }
  36434. }
  36435. }
  36436. }
  36437. Util.inherit(ButtonWidgetAnnotation, WidgetAnnotation, {
  36438. getOperatorList: function ButtonWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  36439. var operatorList = new OperatorList();
  36440. if (renderForms) {
  36441. return Promise.resolve(operatorList);
  36442. }
  36443. if (this.appearance) {
  36444. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  36445. }
  36446. return Promise.resolve(operatorList);
  36447. }
  36448. });
  36449. return ButtonWidgetAnnotation;
  36450. }();
  36451. var ChoiceWidgetAnnotation = function ChoiceWidgetAnnotationClosure() {
  36452. function ChoiceWidgetAnnotation(params) {
  36453. WidgetAnnotation.call(this, params);
  36454. this.data.options = [];
  36455. var options = params.dict.get('Opt');
  36456. if (isArray(options)) {
  36457. var xref = params.xref;
  36458. for (var i = 0, ii = options.length; i < ii; i++) {
  36459. var option = xref.fetchIfRef(options[i]);
  36460. var isOptionArray = isArray(option);
  36461. this.data.options[i] = {
  36462. exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option,
  36463. displayValue: isOptionArray ? xref.fetchIfRef(option[1]) : option
  36464. };
  36465. }
  36466. }
  36467. if (!isArray(this.data.fieldValue)) {
  36468. this.data.fieldValue = [this.data.fieldValue];
  36469. }
  36470. this.data.combo = this.hasFieldFlag(AnnotationFieldFlag.COMBO);
  36471. this.data.multiSelect = this.hasFieldFlag(AnnotationFieldFlag.MULTISELECT);
  36472. }
  36473. Util.inherit(ChoiceWidgetAnnotation, WidgetAnnotation, {
  36474. getOperatorList: function ChoiceWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  36475. var operatorList = new OperatorList();
  36476. if (renderForms) {
  36477. return Promise.resolve(operatorList);
  36478. }
  36479. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  36480. }
  36481. });
  36482. return ChoiceWidgetAnnotation;
  36483. }();
  36484. var TextAnnotation = function TextAnnotationClosure() {
  36485. var DEFAULT_ICON_SIZE = 22;
  36486. function TextAnnotation(parameters) {
  36487. Annotation.call(this, parameters);
  36488. this.data.annotationType = AnnotationType.TEXT;
  36489. if (this.data.hasAppearance) {
  36490. this.data.name = 'NoIcon';
  36491. } else {
  36492. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  36493. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  36494. this.data.name = parameters.dict.has('Name') ? parameters.dict.get('Name').name : 'Note';
  36495. }
  36496. this._preparePopup(parameters.dict);
  36497. }
  36498. Util.inherit(TextAnnotation, Annotation, {});
  36499. return TextAnnotation;
  36500. }();
  36501. var LinkAnnotation = function LinkAnnotationClosure() {
  36502. function LinkAnnotation(params) {
  36503. Annotation.call(this, params);
  36504. var data = this.data;
  36505. data.annotationType = AnnotationType.LINK;
  36506. Catalog.parseDestDictionary({
  36507. destDict: params.dict,
  36508. resultObj: data,
  36509. docBaseUrl: params.pdfManager.docBaseUrl
  36510. });
  36511. }
  36512. Util.inherit(LinkAnnotation, Annotation, {});
  36513. return LinkAnnotation;
  36514. }();
  36515. var PopupAnnotation = function PopupAnnotationClosure() {
  36516. function PopupAnnotation(parameters) {
  36517. Annotation.call(this, parameters);
  36518. this.data.annotationType = AnnotationType.POPUP;
  36519. var dict = parameters.dict;
  36520. var parentItem = dict.get('Parent');
  36521. if (!parentItem) {
  36522. warn('Popup annotation has a missing or invalid parent annotation.');
  36523. return;
  36524. }
  36525. this.data.parentId = dict.getRaw('Parent').toString();
  36526. this.data.title = stringToPDFString(parentItem.get('T') || '');
  36527. this.data.contents = stringToPDFString(parentItem.get('Contents') || '');
  36528. if (!parentItem.has('C')) {
  36529. this.data.color = null;
  36530. } else {
  36531. this.setColor(parentItem.getArray('C'));
  36532. this.data.color = this.color;
  36533. }
  36534. if (!this.viewable) {
  36535. var parentFlags = parentItem.get('F');
  36536. if (this._isViewable(parentFlags)) {
  36537. this.setFlags(parentFlags);
  36538. }
  36539. }
  36540. }
  36541. Util.inherit(PopupAnnotation, Annotation, {});
  36542. return PopupAnnotation;
  36543. }();
  36544. var HighlightAnnotation = function HighlightAnnotationClosure() {
  36545. function HighlightAnnotation(parameters) {
  36546. Annotation.call(this, parameters);
  36547. this.data.annotationType = AnnotationType.HIGHLIGHT;
  36548. this._preparePopup(parameters.dict);
  36549. this.data.borderStyle.setWidth(0);
  36550. }
  36551. Util.inherit(HighlightAnnotation, Annotation, {});
  36552. return HighlightAnnotation;
  36553. }();
  36554. var UnderlineAnnotation = function UnderlineAnnotationClosure() {
  36555. function UnderlineAnnotation(parameters) {
  36556. Annotation.call(this, parameters);
  36557. this.data.annotationType = AnnotationType.UNDERLINE;
  36558. this._preparePopup(parameters.dict);
  36559. this.data.borderStyle.setWidth(0);
  36560. }
  36561. Util.inherit(UnderlineAnnotation, Annotation, {});
  36562. return UnderlineAnnotation;
  36563. }();
  36564. var SquigglyAnnotation = function SquigglyAnnotationClosure() {
  36565. function SquigglyAnnotation(parameters) {
  36566. Annotation.call(this, parameters);
  36567. this.data.annotationType = AnnotationType.SQUIGGLY;
  36568. this._preparePopup(parameters.dict);
  36569. this.data.borderStyle.setWidth(0);
  36570. }
  36571. Util.inherit(SquigglyAnnotation, Annotation, {});
  36572. return SquigglyAnnotation;
  36573. }();
  36574. var StrikeOutAnnotation = function StrikeOutAnnotationClosure() {
  36575. function StrikeOutAnnotation(parameters) {
  36576. Annotation.call(this, parameters);
  36577. this.data.annotationType = AnnotationType.STRIKEOUT;
  36578. this._preparePopup(parameters.dict);
  36579. this.data.borderStyle.setWidth(0);
  36580. }
  36581. Util.inherit(StrikeOutAnnotation, Annotation, {});
  36582. return StrikeOutAnnotation;
  36583. }();
  36584. var FileAttachmentAnnotation = function FileAttachmentAnnotationClosure() {
  36585. function FileAttachmentAnnotation(parameters) {
  36586. Annotation.call(this, parameters);
  36587. var file = new FileSpec(parameters.dict.get('FS'), parameters.xref);
  36588. this.data.annotationType = AnnotationType.FILEATTACHMENT;
  36589. this.data.file = file.serializable;
  36590. this._preparePopup(parameters.dict);
  36591. }
  36592. Util.inherit(FileAttachmentAnnotation, Annotation, {});
  36593. return FileAttachmentAnnotation;
  36594. }();
  36595. exports.Annotation = Annotation;
  36596. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  36597. exports.AnnotationFactory = AnnotationFactory;
  36598. /***/ }),
  36599. /* 22 */
  36600. /***/ (function(module, exports, __w_pdfjs_require__) {
  36601. "use strict";
  36602. var sharedUtil = __w_pdfjs_require__(0);
  36603. var warn = sharedUtil.warn;
  36604. var baseTypes = [
  36605. 'BN',
  36606. 'BN',
  36607. 'BN',
  36608. 'BN',
  36609. 'BN',
  36610. 'BN',
  36611. 'BN',
  36612. 'BN',
  36613. 'BN',
  36614. 'S',
  36615. 'B',
  36616. 'S',
  36617. 'WS',
  36618. 'B',
  36619. 'BN',
  36620. 'BN',
  36621. 'BN',
  36622. 'BN',
  36623. 'BN',
  36624. 'BN',
  36625. 'BN',
  36626. 'BN',
  36627. 'BN',
  36628. 'BN',
  36629. 'BN',
  36630. 'BN',
  36631. 'BN',
  36632. 'BN',
  36633. 'B',
  36634. 'B',
  36635. 'B',
  36636. 'S',
  36637. 'WS',
  36638. 'ON',
  36639. 'ON',
  36640. 'ET',
  36641. 'ET',
  36642. 'ET',
  36643. 'ON',
  36644. 'ON',
  36645. 'ON',
  36646. 'ON',
  36647. 'ON',
  36648. 'ES',
  36649. 'CS',
  36650. 'ES',
  36651. 'CS',
  36652. 'CS',
  36653. 'EN',
  36654. 'EN',
  36655. 'EN',
  36656. 'EN',
  36657. 'EN',
  36658. 'EN',
  36659. 'EN',
  36660. 'EN',
  36661. 'EN',
  36662. 'EN',
  36663. 'CS',
  36664. 'ON',
  36665. 'ON',
  36666. 'ON',
  36667. 'ON',
  36668. 'ON',
  36669. 'ON',
  36670. 'L',
  36671. 'L',
  36672. 'L',
  36673. 'L',
  36674. 'L',
  36675. 'L',
  36676. 'L',
  36677. 'L',
  36678. 'L',
  36679. 'L',
  36680. 'L',
  36681. 'L',
  36682. 'L',
  36683. 'L',
  36684. 'L',
  36685. 'L',
  36686. 'L',
  36687. 'L',
  36688. 'L',
  36689. 'L',
  36690. 'L',
  36691. 'L',
  36692. 'L',
  36693. 'L',
  36694. 'L',
  36695. 'L',
  36696. 'ON',
  36697. 'ON',
  36698. 'ON',
  36699. 'ON',
  36700. 'ON',
  36701. 'ON',
  36702. 'L',
  36703. 'L',
  36704. 'L',
  36705. 'L',
  36706. 'L',
  36707. 'L',
  36708. 'L',
  36709. 'L',
  36710. 'L',
  36711. 'L',
  36712. 'L',
  36713. 'L',
  36714. 'L',
  36715. 'L',
  36716. 'L',
  36717. 'L',
  36718. 'L',
  36719. 'L',
  36720. 'L',
  36721. 'L',
  36722. 'L',
  36723. 'L',
  36724. 'L',
  36725. 'L',
  36726. 'L',
  36727. 'L',
  36728. 'ON',
  36729. 'ON',
  36730. 'ON',
  36731. 'ON',
  36732. 'BN',
  36733. 'BN',
  36734. 'BN',
  36735. 'BN',
  36736. 'BN',
  36737. 'BN',
  36738. 'B',
  36739. 'BN',
  36740. 'BN',
  36741. 'BN',
  36742. 'BN',
  36743. 'BN',
  36744. 'BN',
  36745. 'BN',
  36746. 'BN',
  36747. 'BN',
  36748. 'BN',
  36749. 'BN',
  36750. 'BN',
  36751. 'BN',
  36752. 'BN',
  36753. 'BN',
  36754. 'BN',
  36755. 'BN',
  36756. 'BN',
  36757. 'BN',
  36758. 'BN',
  36759. 'BN',
  36760. 'BN',
  36761. 'BN',
  36762. 'BN',
  36763. 'BN',
  36764. 'BN',
  36765. 'CS',
  36766. 'ON',
  36767. 'ET',
  36768. 'ET',
  36769. 'ET',
  36770. 'ET',
  36771. 'ON',
  36772. 'ON',
  36773. 'ON',
  36774. 'ON',
  36775. 'L',
  36776. 'ON',
  36777. 'ON',
  36778. 'BN',
  36779. 'ON',
  36780. 'ON',
  36781. 'ET',
  36782. 'ET',
  36783. 'EN',
  36784. 'EN',
  36785. 'ON',
  36786. 'L',
  36787. 'ON',
  36788. 'ON',
  36789. 'ON',
  36790. 'EN',
  36791. 'L',
  36792. 'ON',
  36793. 'ON',
  36794. 'ON',
  36795. 'ON',
  36796. 'ON',
  36797. 'L',
  36798. 'L',
  36799. 'L',
  36800. 'L',
  36801. 'L',
  36802. 'L',
  36803. 'L',
  36804. 'L',
  36805. 'L',
  36806. 'L',
  36807. 'L',
  36808. 'L',
  36809. 'L',
  36810. 'L',
  36811. 'L',
  36812. 'L',
  36813. 'L',
  36814. 'L',
  36815. 'L',
  36816. 'L',
  36817. 'L',
  36818. 'L',
  36819. 'L',
  36820. 'ON',
  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. 'L',
  36836. 'L',
  36837. 'L',
  36838. 'L',
  36839. 'L',
  36840. 'L',
  36841. 'L',
  36842. 'L',
  36843. 'L',
  36844. 'L',
  36845. 'L',
  36846. 'L',
  36847. 'L',
  36848. 'L',
  36849. 'L',
  36850. 'L',
  36851. 'L',
  36852. 'ON',
  36853. 'L',
  36854. 'L',
  36855. 'L',
  36856. 'L',
  36857. 'L',
  36858. 'L',
  36859. 'L',
  36860. 'L'
  36861. ];
  36862. var arabicTypes = [
  36863. 'AN',
  36864. 'AN',
  36865. 'AN',
  36866. 'AN',
  36867. 'AN',
  36868. 'AN',
  36869. 'ON',
  36870. 'ON',
  36871. 'AL',
  36872. 'ET',
  36873. 'ET',
  36874. 'AL',
  36875. 'CS',
  36876. 'AL',
  36877. 'ON',
  36878. 'ON',
  36879. 'NSM',
  36880. 'NSM',
  36881. 'NSM',
  36882. 'NSM',
  36883. 'NSM',
  36884. 'NSM',
  36885. 'NSM',
  36886. 'NSM',
  36887. 'NSM',
  36888. 'NSM',
  36889. 'NSM',
  36890. 'AL',
  36891. 'AL',
  36892. '',
  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. 'AL',
  36922. 'AL',
  36923. 'AL',
  36924. 'AL',
  36925. 'AL',
  36926. 'AL',
  36927. 'AL',
  36928. 'AL',
  36929. 'AL',
  36930. 'AL',
  36931. 'AL',
  36932. 'AL',
  36933. 'AL',
  36934. 'AL',
  36935. 'AL',
  36936. 'AL',
  36937. 'AL',
  36938. 'NSM',
  36939. 'NSM',
  36940. 'NSM',
  36941. 'NSM',
  36942. 'NSM',
  36943. 'NSM',
  36944. 'NSM',
  36945. 'NSM',
  36946. 'NSM',
  36947. 'NSM',
  36948. 'NSM',
  36949. 'NSM',
  36950. 'NSM',
  36951. 'NSM',
  36952. 'NSM',
  36953. 'NSM',
  36954. 'NSM',
  36955. 'NSM',
  36956. 'NSM',
  36957. 'NSM',
  36958. 'NSM',
  36959. 'AN',
  36960. 'AN',
  36961. 'AN',
  36962. 'AN',
  36963. 'AN',
  36964. 'AN',
  36965. 'AN',
  36966. 'AN',
  36967. 'AN',
  36968. 'AN',
  36969. 'ET',
  36970. 'AN',
  36971. 'AN',
  36972. 'AL',
  36973. 'AL',
  36974. 'AL',
  36975. 'NSM',
  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. 'AL',
  37061. 'AL',
  37062. 'AL',
  37063. 'AL',
  37064. 'AL',
  37065. 'AL',
  37066. 'AL',
  37067. 'AL',
  37068. 'AL',
  37069. 'AL',
  37070. 'AL',
  37071. 'AL',
  37072. 'AL',
  37073. 'AL',
  37074. 'AL',
  37075. 'AL',
  37076. 'AL',
  37077. 'NSM',
  37078. 'NSM',
  37079. 'NSM',
  37080. 'NSM',
  37081. 'NSM',
  37082. 'NSM',
  37083. 'NSM',
  37084. 'AN',
  37085. 'ON',
  37086. 'NSM',
  37087. 'NSM',
  37088. 'NSM',
  37089. 'NSM',
  37090. 'NSM',
  37091. 'NSM',
  37092. 'AL',
  37093. 'AL',
  37094. 'NSM',
  37095. 'NSM',
  37096. 'ON',
  37097. 'NSM',
  37098. 'NSM',
  37099. 'NSM',
  37100. 'NSM',
  37101. 'AL',
  37102. 'AL',
  37103. 'EN',
  37104. 'EN',
  37105. 'EN',
  37106. 'EN',
  37107. 'EN',
  37108. 'EN',
  37109. 'EN',
  37110. 'EN',
  37111. 'EN',
  37112. 'EN',
  37113. 'AL',
  37114. 'AL',
  37115. 'AL',
  37116. 'AL',
  37117. 'AL',
  37118. 'AL'
  37119. ];
  37120. function isOdd(i) {
  37121. return (i & 1) !== 0;
  37122. }
  37123. function isEven(i) {
  37124. return (i & 1) === 0;
  37125. }
  37126. function findUnequal(arr, start, value) {
  37127. for (var j = start, jj = arr.length; j < jj; ++j) {
  37128. if (arr[j] !== value) {
  37129. return j;
  37130. }
  37131. }
  37132. return j;
  37133. }
  37134. function setValues(arr, start, end, value) {
  37135. for (var j = start; j < end; ++j) {
  37136. arr[j] = value;
  37137. }
  37138. }
  37139. function reverseValues(arr, start, end) {
  37140. for (var i = start, j = end - 1; i < j; ++i, --j) {
  37141. var temp = arr[i];
  37142. arr[i] = arr[j];
  37143. arr[j] = temp;
  37144. }
  37145. }
  37146. function createBidiText(str, isLTR, vertical) {
  37147. return {
  37148. str: str,
  37149. dir: vertical ? 'ttb' : isLTR ? 'ltr' : 'rtl'
  37150. };
  37151. }
  37152. var chars = [];
  37153. var types = [];
  37154. function bidi(str, startLevel, vertical) {
  37155. var isLTR = true;
  37156. var strLength = str.length;
  37157. if (strLength === 0 || vertical) {
  37158. return createBidiText(str, isLTR, vertical);
  37159. }
  37160. chars.length = strLength;
  37161. types.length = strLength;
  37162. var numBidi = 0;
  37163. var i, ii;
  37164. for (i = 0; i < strLength; ++i) {
  37165. chars[i] = str.charAt(i);
  37166. var charCode = str.charCodeAt(i);
  37167. var charType = 'L';
  37168. if (charCode <= 0x00ff) {
  37169. charType = baseTypes[charCode];
  37170. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  37171. charType = 'R';
  37172. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  37173. charType = arabicTypes[charCode & 0xff];
  37174. if (!charType) {
  37175. warn('Bidi: invalid Unicode character ' + charCode.toString(16));
  37176. }
  37177. } else if (0x0700 <= charCode && charCode <= 0x08AC) {
  37178. charType = 'AL';
  37179. }
  37180. if (charType === 'R' || charType === 'AL' || charType === 'AN') {
  37181. numBidi++;
  37182. }
  37183. types[i] = charType;
  37184. }
  37185. if (numBidi === 0) {
  37186. isLTR = true;
  37187. return createBidiText(str, isLTR);
  37188. }
  37189. if (startLevel === -1) {
  37190. if (numBidi / strLength < 0.3) {
  37191. isLTR = true;
  37192. startLevel = 0;
  37193. } else {
  37194. isLTR = false;
  37195. startLevel = 1;
  37196. }
  37197. }
  37198. var levels = [];
  37199. for (i = 0; i < strLength; ++i) {
  37200. levels[i] = startLevel;
  37201. }
  37202. var e = isOdd(startLevel) ? 'R' : 'L';
  37203. var sor = e;
  37204. var eor = sor;
  37205. var lastType = sor;
  37206. for (i = 0; i < strLength; ++i) {
  37207. if (types[i] === 'NSM') {
  37208. types[i] = lastType;
  37209. } else {
  37210. lastType = types[i];
  37211. }
  37212. }
  37213. lastType = sor;
  37214. var t;
  37215. for (i = 0; i < strLength; ++i) {
  37216. t = types[i];
  37217. if (t === 'EN') {
  37218. types[i] = lastType === 'AL' ? 'AN' : 'EN';
  37219. } else if (t === 'R' || t === 'L' || t === 'AL') {
  37220. lastType = t;
  37221. }
  37222. }
  37223. for (i = 0; i < strLength; ++i) {
  37224. t = types[i];
  37225. if (t === 'AL') {
  37226. types[i] = 'R';
  37227. }
  37228. }
  37229. for (i = 1; i < strLength - 1; ++i) {
  37230. if (types[i] === 'ES' && types[i - 1] === 'EN' && types[i + 1] === 'EN') {
  37231. types[i] = 'EN';
  37232. }
  37233. if (types[i] === 'CS' && (types[i - 1] === 'EN' || types[i - 1] === 'AN') && types[i + 1] === types[i - 1]) {
  37234. types[i] = types[i - 1];
  37235. }
  37236. }
  37237. for (i = 0; i < strLength; ++i) {
  37238. if (types[i] === 'EN') {
  37239. var j;
  37240. for (j = i - 1; j >= 0; --j) {
  37241. if (types[j] !== 'ET') {
  37242. break;
  37243. }
  37244. types[j] = 'EN';
  37245. }
  37246. for (j = i + 1; j < strLength; ++j) {
  37247. if (types[j] !== 'ET') {
  37248. break;
  37249. }
  37250. types[j] = 'EN';
  37251. }
  37252. }
  37253. }
  37254. for (i = 0; i < strLength; ++i) {
  37255. t = types[i];
  37256. if (t === 'WS' || t === 'ES' || t === 'ET' || t === 'CS') {
  37257. types[i] = 'ON';
  37258. }
  37259. }
  37260. lastType = sor;
  37261. for (i = 0; i < strLength; ++i) {
  37262. t = types[i];
  37263. if (t === 'EN') {
  37264. types[i] = lastType === 'L' ? 'L' : 'EN';
  37265. } else if (t === 'R' || t === 'L') {
  37266. lastType = t;
  37267. }
  37268. }
  37269. for (i = 0; i < strLength; ++i) {
  37270. if (types[i] === 'ON') {
  37271. var end = findUnequal(types, i + 1, 'ON');
  37272. var before = sor;
  37273. if (i > 0) {
  37274. before = types[i - 1];
  37275. }
  37276. var after = eor;
  37277. if (end + 1 < strLength) {
  37278. after = types[end + 1];
  37279. }
  37280. if (before !== 'L') {
  37281. before = 'R';
  37282. }
  37283. if (after !== 'L') {
  37284. after = 'R';
  37285. }
  37286. if (before === after) {
  37287. setValues(types, i, end, before);
  37288. }
  37289. i = end - 1;
  37290. }
  37291. }
  37292. for (i = 0; i < strLength; ++i) {
  37293. if (types[i] === 'ON') {
  37294. types[i] = e;
  37295. }
  37296. }
  37297. for (i = 0; i < strLength; ++i) {
  37298. t = types[i];
  37299. if (isEven(levels[i])) {
  37300. if (t === 'R') {
  37301. levels[i] += 1;
  37302. } else if (t === 'AN' || t === 'EN') {
  37303. levels[i] += 2;
  37304. }
  37305. } else {
  37306. if (t === 'L' || t === 'AN' || t === 'EN') {
  37307. levels[i] += 1;
  37308. }
  37309. }
  37310. }
  37311. var highestLevel = -1;
  37312. var lowestOddLevel = 99;
  37313. var level;
  37314. for (i = 0, ii = levels.length; i < ii; ++i) {
  37315. level = levels[i];
  37316. if (highestLevel < level) {
  37317. highestLevel = level;
  37318. }
  37319. if (lowestOddLevel > level && isOdd(level)) {
  37320. lowestOddLevel = level;
  37321. }
  37322. }
  37323. for (level = highestLevel; level >= lowestOddLevel; --level) {
  37324. var start = -1;
  37325. for (i = 0, ii = levels.length; i < ii; ++i) {
  37326. if (levels[i] < level) {
  37327. if (start >= 0) {
  37328. reverseValues(chars, start, i);
  37329. start = -1;
  37330. }
  37331. } else if (start < 0) {
  37332. start = i;
  37333. }
  37334. }
  37335. if (start >= 0) {
  37336. reverseValues(chars, start, levels.length);
  37337. }
  37338. }
  37339. for (i = 0, ii = chars.length; i < ii; ++i) {
  37340. var ch = chars[i];
  37341. if (ch === '<' || ch === '>') {
  37342. chars[i] = '';
  37343. }
  37344. }
  37345. return createBidiText(chars.join(''), isLTR);
  37346. }
  37347. exports.bidi = bidi;
  37348. /***/ }),
  37349. /* 23 */
  37350. /***/ (function(module, exports, __w_pdfjs_require__) {
  37351. "use strict";
  37352. var ISOAdobeCharset = [
  37353. '.notdef',
  37354. 'space',
  37355. 'exclam',
  37356. 'quotedbl',
  37357. 'numbersign',
  37358. 'dollar',
  37359. 'percent',
  37360. 'ampersand',
  37361. 'quoteright',
  37362. 'parenleft',
  37363. 'parenright',
  37364. 'asterisk',
  37365. 'plus',
  37366. 'comma',
  37367. 'hyphen',
  37368. 'period',
  37369. 'slash',
  37370. 'zero',
  37371. 'one',
  37372. 'two',
  37373. 'three',
  37374. 'four',
  37375. 'five',
  37376. 'six',
  37377. 'seven',
  37378. 'eight',
  37379. 'nine',
  37380. 'colon',
  37381. 'semicolon',
  37382. 'less',
  37383. 'equal',
  37384. 'greater',
  37385. 'question',
  37386. 'at',
  37387. 'A',
  37388. 'B',
  37389. 'C',
  37390. 'D',
  37391. 'E',
  37392. 'F',
  37393. 'G',
  37394. 'H',
  37395. 'I',
  37396. 'J',
  37397. 'K',
  37398. 'L',
  37399. 'M',
  37400. 'N',
  37401. 'O',
  37402. 'P',
  37403. 'Q',
  37404. 'R',
  37405. 'S',
  37406. 'T',
  37407. 'U',
  37408. 'V',
  37409. 'W',
  37410. 'X',
  37411. 'Y',
  37412. 'Z',
  37413. 'bracketleft',
  37414. 'backslash',
  37415. 'bracketright',
  37416. 'asciicircum',
  37417. 'underscore',
  37418. 'quoteleft',
  37419. 'a',
  37420. 'b',
  37421. 'c',
  37422. 'd',
  37423. 'e',
  37424. 'f',
  37425. 'g',
  37426. 'h',
  37427. 'i',
  37428. 'j',
  37429. 'k',
  37430. 'l',
  37431. 'm',
  37432. 'n',
  37433. 'o',
  37434. 'p',
  37435. 'q',
  37436. 'r',
  37437. 's',
  37438. 't',
  37439. 'u',
  37440. 'v',
  37441. 'w',
  37442. 'x',
  37443. 'y',
  37444. 'z',
  37445. 'braceleft',
  37446. 'bar',
  37447. 'braceright',
  37448. 'asciitilde',
  37449. 'exclamdown',
  37450. 'cent',
  37451. 'sterling',
  37452. 'fraction',
  37453. 'yen',
  37454. 'florin',
  37455. 'section',
  37456. 'currency',
  37457. 'quotesingle',
  37458. 'quotedblleft',
  37459. 'guillemotleft',
  37460. 'guilsinglleft',
  37461. 'guilsinglright',
  37462. 'fi',
  37463. 'fl',
  37464. 'endash',
  37465. 'dagger',
  37466. 'daggerdbl',
  37467. 'periodcentered',
  37468. 'paragraph',
  37469. 'bullet',
  37470. 'quotesinglbase',
  37471. 'quotedblbase',
  37472. 'quotedblright',
  37473. 'guillemotright',
  37474. 'ellipsis',
  37475. 'perthousand',
  37476. 'questiondown',
  37477. 'grave',
  37478. 'acute',
  37479. 'circumflex',
  37480. 'tilde',
  37481. 'macron',
  37482. 'breve',
  37483. 'dotaccent',
  37484. 'dieresis',
  37485. 'ring',
  37486. 'cedilla',
  37487. 'hungarumlaut',
  37488. 'ogonek',
  37489. 'caron',
  37490. 'emdash',
  37491. 'AE',
  37492. 'ordfeminine',
  37493. 'Lslash',
  37494. 'Oslash',
  37495. 'OE',
  37496. 'ordmasculine',
  37497. 'ae',
  37498. 'dotlessi',
  37499. 'lslash',
  37500. 'oslash',
  37501. 'oe',
  37502. 'germandbls',
  37503. 'onesuperior',
  37504. 'logicalnot',
  37505. 'mu',
  37506. 'trademark',
  37507. 'Eth',
  37508. 'onehalf',
  37509. 'plusminus',
  37510. 'Thorn',
  37511. 'onequarter',
  37512. 'divide',
  37513. 'brokenbar',
  37514. 'degree',
  37515. 'thorn',
  37516. 'threequarters',
  37517. 'twosuperior',
  37518. 'registered',
  37519. 'minus',
  37520. 'eth',
  37521. 'multiply',
  37522. 'threesuperior',
  37523. 'copyright',
  37524. 'Aacute',
  37525. 'Acircumflex',
  37526. 'Adieresis',
  37527. 'Agrave',
  37528. 'Aring',
  37529. 'Atilde',
  37530. 'Ccedilla',
  37531. 'Eacute',
  37532. 'Ecircumflex',
  37533. 'Edieresis',
  37534. 'Egrave',
  37535. 'Iacute',
  37536. 'Icircumflex',
  37537. 'Idieresis',
  37538. 'Igrave',
  37539. 'Ntilde',
  37540. 'Oacute',
  37541. 'Ocircumflex',
  37542. 'Odieresis',
  37543. 'Ograve',
  37544. 'Otilde',
  37545. 'Scaron',
  37546. 'Uacute',
  37547. 'Ucircumflex',
  37548. 'Udieresis',
  37549. 'Ugrave',
  37550. 'Yacute',
  37551. 'Ydieresis',
  37552. 'Zcaron',
  37553. 'aacute',
  37554. 'acircumflex',
  37555. 'adieresis',
  37556. 'agrave',
  37557. 'aring',
  37558. 'atilde',
  37559. 'ccedilla',
  37560. 'eacute',
  37561. 'ecircumflex',
  37562. 'edieresis',
  37563. 'egrave',
  37564. 'iacute',
  37565. 'icircumflex',
  37566. 'idieresis',
  37567. 'igrave',
  37568. 'ntilde',
  37569. 'oacute',
  37570. 'ocircumflex',
  37571. 'odieresis',
  37572. 'ograve',
  37573. 'otilde',
  37574. 'scaron',
  37575. 'uacute',
  37576. 'ucircumflex',
  37577. 'udieresis',
  37578. 'ugrave',
  37579. 'yacute',
  37580. 'ydieresis',
  37581. 'zcaron'
  37582. ];
  37583. var ExpertCharset = [
  37584. '.notdef',
  37585. 'space',
  37586. 'exclamsmall',
  37587. 'Hungarumlautsmall',
  37588. 'dollaroldstyle',
  37589. 'dollarsuperior',
  37590. 'ampersandsmall',
  37591. 'Acutesmall',
  37592. 'parenleftsuperior',
  37593. 'parenrightsuperior',
  37594. 'twodotenleader',
  37595. 'onedotenleader',
  37596. 'comma',
  37597. 'hyphen',
  37598. 'period',
  37599. 'fraction',
  37600. 'zerooldstyle',
  37601. 'oneoldstyle',
  37602. 'twooldstyle',
  37603. 'threeoldstyle',
  37604. 'fouroldstyle',
  37605. 'fiveoldstyle',
  37606. 'sixoldstyle',
  37607. 'sevenoldstyle',
  37608. 'eightoldstyle',
  37609. 'nineoldstyle',
  37610. 'colon',
  37611. 'semicolon',
  37612. 'commasuperior',
  37613. 'threequartersemdash',
  37614. 'periodsuperior',
  37615. 'questionsmall',
  37616. 'asuperior',
  37617. 'bsuperior',
  37618. 'centsuperior',
  37619. 'dsuperior',
  37620. 'esuperior',
  37621. 'isuperior',
  37622. 'lsuperior',
  37623. 'msuperior',
  37624. 'nsuperior',
  37625. 'osuperior',
  37626. 'rsuperior',
  37627. 'ssuperior',
  37628. 'tsuperior',
  37629. 'ff',
  37630. 'fi',
  37631. 'fl',
  37632. 'ffi',
  37633. 'ffl',
  37634. 'parenleftinferior',
  37635. 'parenrightinferior',
  37636. 'Circumflexsmall',
  37637. 'hyphensuperior',
  37638. 'Gravesmall',
  37639. 'Asmall',
  37640. 'Bsmall',
  37641. 'Csmall',
  37642. 'Dsmall',
  37643. 'Esmall',
  37644. 'Fsmall',
  37645. 'Gsmall',
  37646. 'Hsmall',
  37647. 'Ismall',
  37648. 'Jsmall',
  37649. 'Ksmall',
  37650. 'Lsmall',
  37651. 'Msmall',
  37652. 'Nsmall',
  37653. 'Osmall',
  37654. 'Psmall',
  37655. 'Qsmall',
  37656. 'Rsmall',
  37657. 'Ssmall',
  37658. 'Tsmall',
  37659. 'Usmall',
  37660. 'Vsmall',
  37661. 'Wsmall',
  37662. 'Xsmall',
  37663. 'Ysmall',
  37664. 'Zsmall',
  37665. 'colonmonetary',
  37666. 'onefitted',
  37667. 'rupiah',
  37668. 'Tildesmall',
  37669. 'exclamdownsmall',
  37670. 'centoldstyle',
  37671. 'Lslashsmall',
  37672. 'Scaronsmall',
  37673. 'Zcaronsmall',
  37674. 'Dieresissmall',
  37675. 'Brevesmall',
  37676. 'Caronsmall',
  37677. 'Dotaccentsmall',
  37678. 'Macronsmall',
  37679. 'figuredash',
  37680. 'hypheninferior',
  37681. 'Ogoneksmall',
  37682. 'Ringsmall',
  37683. 'Cedillasmall',
  37684. 'onequarter',
  37685. 'onehalf',
  37686. 'threequarters',
  37687. 'questiondownsmall',
  37688. 'oneeighth',
  37689. 'threeeighths',
  37690. 'fiveeighths',
  37691. 'seveneighths',
  37692. 'onethird',
  37693. 'twothirds',
  37694. 'zerosuperior',
  37695. 'onesuperior',
  37696. 'twosuperior',
  37697. 'threesuperior',
  37698. 'foursuperior',
  37699. 'fivesuperior',
  37700. 'sixsuperior',
  37701. 'sevensuperior',
  37702. 'eightsuperior',
  37703. 'ninesuperior',
  37704. 'zeroinferior',
  37705. 'oneinferior',
  37706. 'twoinferior',
  37707. 'threeinferior',
  37708. 'fourinferior',
  37709. 'fiveinferior',
  37710. 'sixinferior',
  37711. 'seveninferior',
  37712. 'eightinferior',
  37713. 'nineinferior',
  37714. 'centinferior',
  37715. 'dollarinferior',
  37716. 'periodinferior',
  37717. 'commainferior',
  37718. 'Agravesmall',
  37719. 'Aacutesmall',
  37720. 'Acircumflexsmall',
  37721. 'Atildesmall',
  37722. 'Adieresissmall',
  37723. 'Aringsmall',
  37724. 'AEsmall',
  37725. 'Ccedillasmall',
  37726. 'Egravesmall',
  37727. 'Eacutesmall',
  37728. 'Ecircumflexsmall',
  37729. 'Edieresissmall',
  37730. 'Igravesmall',
  37731. 'Iacutesmall',
  37732. 'Icircumflexsmall',
  37733. 'Idieresissmall',
  37734. 'Ethsmall',
  37735. 'Ntildesmall',
  37736. 'Ogravesmall',
  37737. 'Oacutesmall',
  37738. 'Ocircumflexsmall',
  37739. 'Otildesmall',
  37740. 'Odieresissmall',
  37741. 'OEsmall',
  37742. 'Oslashsmall',
  37743. 'Ugravesmall',
  37744. 'Uacutesmall',
  37745. 'Ucircumflexsmall',
  37746. 'Udieresissmall',
  37747. 'Yacutesmall',
  37748. 'Thornsmall',
  37749. 'Ydieresissmall'
  37750. ];
  37751. var ExpertSubsetCharset = [
  37752. '.notdef',
  37753. 'space',
  37754. 'dollaroldstyle',
  37755. 'dollarsuperior',
  37756. 'parenleftsuperior',
  37757. 'parenrightsuperior',
  37758. 'twodotenleader',
  37759. 'onedotenleader',
  37760. 'comma',
  37761. 'hyphen',
  37762. 'period',
  37763. 'fraction',
  37764. 'zerooldstyle',
  37765. 'oneoldstyle',
  37766. 'twooldstyle',
  37767. 'threeoldstyle',
  37768. 'fouroldstyle',
  37769. 'fiveoldstyle',
  37770. 'sixoldstyle',
  37771. 'sevenoldstyle',
  37772. 'eightoldstyle',
  37773. 'nineoldstyle',
  37774. 'colon',
  37775. 'semicolon',
  37776. 'commasuperior',
  37777. 'threequartersemdash',
  37778. 'periodsuperior',
  37779. 'asuperior',
  37780. 'bsuperior',
  37781. 'centsuperior',
  37782. 'dsuperior',
  37783. 'esuperior',
  37784. 'isuperior',
  37785. 'lsuperior',
  37786. 'msuperior',
  37787. 'nsuperior',
  37788. 'osuperior',
  37789. 'rsuperior',
  37790. 'ssuperior',
  37791. 'tsuperior',
  37792. 'ff',
  37793. 'fi',
  37794. 'fl',
  37795. 'ffi',
  37796. 'ffl',
  37797. 'parenleftinferior',
  37798. 'parenrightinferior',
  37799. 'hyphensuperior',
  37800. 'colonmonetary',
  37801. 'onefitted',
  37802. 'rupiah',
  37803. 'centoldstyle',
  37804. 'figuredash',
  37805. 'hypheninferior',
  37806. 'onequarter',
  37807. 'onehalf',
  37808. 'threequarters',
  37809. 'oneeighth',
  37810. 'threeeighths',
  37811. 'fiveeighths',
  37812. 'seveneighths',
  37813. 'onethird',
  37814. 'twothirds',
  37815. 'zerosuperior',
  37816. 'onesuperior',
  37817. 'twosuperior',
  37818. 'threesuperior',
  37819. 'foursuperior',
  37820. 'fivesuperior',
  37821. 'sixsuperior',
  37822. 'sevensuperior',
  37823. 'eightsuperior',
  37824. 'ninesuperior',
  37825. 'zeroinferior',
  37826. 'oneinferior',
  37827. 'twoinferior',
  37828. 'threeinferior',
  37829. 'fourinferior',
  37830. 'fiveinferior',
  37831. 'sixinferior',
  37832. 'seveninferior',
  37833. 'eightinferior',
  37834. 'nineinferior',
  37835. 'centinferior',
  37836. 'dollarinferior',
  37837. 'periodinferior',
  37838. 'commainferior'
  37839. ];
  37840. exports.ISOAdobeCharset = ISOAdobeCharset;
  37841. exports.ExpertCharset = ExpertCharset;
  37842. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  37843. /***/ }),
  37844. /* 24 */
  37845. /***/ (function(module, exports, __w_pdfjs_require__) {
  37846. "use strict";
  37847. var sharedUtil = __w_pdfjs_require__(0);
  37848. var corePrimitives = __w_pdfjs_require__(1);
  37849. var coreStream = __w_pdfjs_require__(2);
  37850. var coreParser = __w_pdfjs_require__(5);
  37851. var Util = sharedUtil.Util;
  37852. var assert = sharedUtil.assert;
  37853. var warn = sharedUtil.warn;
  37854. var error = sharedUtil.error;
  37855. var isInt = sharedUtil.isInt;
  37856. var isString = sharedUtil.isString;
  37857. var MissingDataException = sharedUtil.MissingDataException;
  37858. var isEOF = corePrimitives.isEOF;
  37859. var isName = corePrimitives.isName;
  37860. var isCmd = corePrimitives.isCmd;
  37861. var isStream = corePrimitives.isStream;
  37862. var StringStream = coreStream.StringStream;
  37863. var Lexer = coreParser.Lexer;
  37864. var BUILT_IN_CMAPS = [
  37865. 'Adobe-GB1-UCS2',
  37866. 'Adobe-CNS1-UCS2',
  37867. 'Adobe-Japan1-UCS2',
  37868. 'Adobe-Korea1-UCS2',
  37869. '78-EUC-H',
  37870. '78-EUC-V',
  37871. '78-H',
  37872. '78-RKSJ-H',
  37873. '78-RKSJ-V',
  37874. '78-V',
  37875. '78ms-RKSJ-H',
  37876. '78ms-RKSJ-V',
  37877. '83pv-RKSJ-H',
  37878. '90ms-RKSJ-H',
  37879. '90ms-RKSJ-V',
  37880. '90msp-RKSJ-H',
  37881. '90msp-RKSJ-V',
  37882. '90pv-RKSJ-H',
  37883. '90pv-RKSJ-V',
  37884. 'Add-H',
  37885. 'Add-RKSJ-H',
  37886. 'Add-RKSJ-V',
  37887. 'Add-V',
  37888. 'Adobe-CNS1-0',
  37889. 'Adobe-CNS1-1',
  37890. 'Adobe-CNS1-2',
  37891. 'Adobe-CNS1-3',
  37892. 'Adobe-CNS1-4',
  37893. 'Adobe-CNS1-5',
  37894. 'Adobe-CNS1-6',
  37895. 'Adobe-GB1-0',
  37896. 'Adobe-GB1-1',
  37897. 'Adobe-GB1-2',
  37898. 'Adobe-GB1-3',
  37899. 'Adobe-GB1-4',
  37900. 'Adobe-GB1-5',
  37901. 'Adobe-Japan1-0',
  37902. 'Adobe-Japan1-1',
  37903. 'Adobe-Japan1-2',
  37904. 'Adobe-Japan1-3',
  37905. 'Adobe-Japan1-4',
  37906. 'Adobe-Japan1-5',
  37907. 'Adobe-Japan1-6',
  37908. 'Adobe-Korea1-0',
  37909. 'Adobe-Korea1-1',
  37910. 'Adobe-Korea1-2',
  37911. 'B5-H',
  37912. 'B5-V',
  37913. 'B5pc-H',
  37914. 'B5pc-V',
  37915. 'CNS-EUC-H',
  37916. 'CNS-EUC-V',
  37917. 'CNS1-H',
  37918. 'CNS1-V',
  37919. 'CNS2-H',
  37920. 'CNS2-V',
  37921. 'ETHK-B5-H',
  37922. 'ETHK-B5-V',
  37923. 'ETen-B5-H',
  37924. 'ETen-B5-V',
  37925. 'ETenms-B5-H',
  37926. 'ETenms-B5-V',
  37927. 'EUC-H',
  37928. 'EUC-V',
  37929. 'Ext-H',
  37930. 'Ext-RKSJ-H',
  37931. 'Ext-RKSJ-V',
  37932. 'Ext-V',
  37933. 'GB-EUC-H',
  37934. 'GB-EUC-V',
  37935. 'GB-H',
  37936. 'GB-V',
  37937. 'GBK-EUC-H',
  37938. 'GBK-EUC-V',
  37939. 'GBK2K-H',
  37940. 'GBK2K-V',
  37941. 'GBKp-EUC-H',
  37942. 'GBKp-EUC-V',
  37943. 'GBT-EUC-H',
  37944. 'GBT-EUC-V',
  37945. 'GBT-H',
  37946. 'GBT-V',
  37947. 'GBTpc-EUC-H',
  37948. 'GBTpc-EUC-V',
  37949. 'GBpc-EUC-H',
  37950. 'GBpc-EUC-V',
  37951. 'H',
  37952. 'HKdla-B5-H',
  37953. 'HKdla-B5-V',
  37954. 'HKdlb-B5-H',
  37955. 'HKdlb-B5-V',
  37956. 'HKgccs-B5-H',
  37957. 'HKgccs-B5-V',
  37958. 'HKm314-B5-H',
  37959. 'HKm314-B5-V',
  37960. 'HKm471-B5-H',
  37961. 'HKm471-B5-V',
  37962. 'HKscs-B5-H',
  37963. 'HKscs-B5-V',
  37964. 'Hankaku',
  37965. 'Hiragana',
  37966. 'KSC-EUC-H',
  37967. 'KSC-EUC-V',
  37968. 'KSC-H',
  37969. 'KSC-Johab-H',
  37970. 'KSC-Johab-V',
  37971. 'KSC-V',
  37972. 'KSCms-UHC-H',
  37973. 'KSCms-UHC-HW-H',
  37974. 'KSCms-UHC-HW-V',
  37975. 'KSCms-UHC-V',
  37976. 'KSCpc-EUC-H',
  37977. 'KSCpc-EUC-V',
  37978. 'Katakana',
  37979. 'NWP-H',
  37980. 'NWP-V',
  37981. 'RKSJ-H',
  37982. 'RKSJ-V',
  37983. 'Roman',
  37984. 'UniCNS-UCS2-H',
  37985. 'UniCNS-UCS2-V',
  37986. 'UniCNS-UTF16-H',
  37987. 'UniCNS-UTF16-V',
  37988. 'UniCNS-UTF32-H',
  37989. 'UniCNS-UTF32-V',
  37990. 'UniCNS-UTF8-H',
  37991. 'UniCNS-UTF8-V',
  37992. 'UniGB-UCS2-H',
  37993. 'UniGB-UCS2-V',
  37994. 'UniGB-UTF16-H',
  37995. 'UniGB-UTF16-V',
  37996. 'UniGB-UTF32-H',
  37997. 'UniGB-UTF32-V',
  37998. 'UniGB-UTF8-H',
  37999. 'UniGB-UTF8-V',
  38000. 'UniJIS-UCS2-H',
  38001. 'UniJIS-UCS2-HW-H',
  38002. 'UniJIS-UCS2-HW-V',
  38003. 'UniJIS-UCS2-V',
  38004. 'UniJIS-UTF16-H',
  38005. 'UniJIS-UTF16-V',
  38006. 'UniJIS-UTF32-H',
  38007. 'UniJIS-UTF32-V',
  38008. 'UniJIS-UTF8-H',
  38009. 'UniJIS-UTF8-V',
  38010. 'UniJIS2004-UTF16-H',
  38011. 'UniJIS2004-UTF16-V',
  38012. 'UniJIS2004-UTF32-H',
  38013. 'UniJIS2004-UTF32-V',
  38014. 'UniJIS2004-UTF8-H',
  38015. 'UniJIS2004-UTF8-V',
  38016. 'UniJISPro-UCS2-HW-V',
  38017. 'UniJISPro-UCS2-V',
  38018. 'UniJISPro-UTF8-V',
  38019. 'UniJISX0213-UTF32-H',
  38020. 'UniJISX0213-UTF32-V',
  38021. 'UniJISX02132004-UTF32-H',
  38022. 'UniJISX02132004-UTF32-V',
  38023. 'UniKS-UCS2-H',
  38024. 'UniKS-UCS2-V',
  38025. 'UniKS-UTF16-H',
  38026. 'UniKS-UTF16-V',
  38027. 'UniKS-UTF32-H',
  38028. 'UniKS-UTF32-V',
  38029. 'UniKS-UTF8-H',
  38030. 'UniKS-UTF8-V',
  38031. 'V',
  38032. 'WP-Symbol'
  38033. ];
  38034. var CMap = function CMapClosure() {
  38035. function CMap(builtInCMap) {
  38036. this.codespaceRanges = [
  38037. [],
  38038. [],
  38039. [],
  38040. []
  38041. ];
  38042. this.numCodespaceRanges = 0;
  38043. this._map = [];
  38044. this.name = '';
  38045. this.vertical = false;
  38046. this.useCMap = null;
  38047. this.builtInCMap = builtInCMap;
  38048. }
  38049. CMap.prototype = {
  38050. addCodespaceRange: function (n, low, high) {
  38051. this.codespaceRanges[n - 1].push(low, high);
  38052. this.numCodespaceRanges++;
  38053. },
  38054. mapCidRange: function (low, high, dstLow) {
  38055. while (low <= high) {
  38056. this._map[low++] = dstLow++;
  38057. }
  38058. },
  38059. mapBfRange: function (low, high, dstLow) {
  38060. var lastByte = dstLow.length - 1;
  38061. while (low <= high) {
  38062. this._map[low++] = dstLow;
  38063. dstLow = dstLow.substr(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
  38064. }
  38065. },
  38066. mapBfRangeToArray: function (low, high, array) {
  38067. var i = 0, ii = array.length;
  38068. while (low <= high && i < ii) {
  38069. this._map[low] = array[i++];
  38070. ++low;
  38071. }
  38072. },
  38073. mapOne: function (src, dst) {
  38074. this._map[src] = dst;
  38075. },
  38076. lookup: function (code) {
  38077. return this._map[code];
  38078. },
  38079. contains: function (code) {
  38080. return this._map[code] !== undefined;
  38081. },
  38082. forEach: function (callback) {
  38083. var map = this._map;
  38084. var length = map.length;
  38085. var i;
  38086. if (length <= 0x10000) {
  38087. for (i = 0; i < length; i++) {
  38088. if (map[i] !== undefined) {
  38089. callback(i, map[i]);
  38090. }
  38091. }
  38092. } else {
  38093. for (i in this._map) {
  38094. callback(i, map[i]);
  38095. }
  38096. }
  38097. },
  38098. charCodeOf: function (value) {
  38099. return this._map.indexOf(value);
  38100. },
  38101. getMap: function () {
  38102. return this._map;
  38103. },
  38104. readCharCode: function (str, offset, out) {
  38105. var c = 0;
  38106. var codespaceRanges = this.codespaceRanges;
  38107. var codespaceRangesLen = this.codespaceRanges.length;
  38108. for (var n = 0; n < codespaceRangesLen; n++) {
  38109. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  38110. var codespaceRange = codespaceRanges[n];
  38111. for (var k = 0, kk = codespaceRange.length; k < kk;) {
  38112. var low = codespaceRange[k++];
  38113. var high = codespaceRange[k++];
  38114. if (c >= low && c <= high) {
  38115. out.charcode = c;
  38116. out.length = n + 1;
  38117. return;
  38118. }
  38119. }
  38120. }
  38121. out.charcode = 0;
  38122. out.length = 1;
  38123. },
  38124. get length() {
  38125. return this._map.length;
  38126. },
  38127. get isIdentityCMap() {
  38128. if (!(this.name === 'Identity-H' || this.name === 'Identity-V')) {
  38129. return false;
  38130. }
  38131. if (this._map.length !== 0x10000) {
  38132. return false;
  38133. }
  38134. for (var i = 0; i < 0x10000; i++) {
  38135. if (this._map[i] !== i) {
  38136. return false;
  38137. }
  38138. }
  38139. return true;
  38140. }
  38141. };
  38142. return CMap;
  38143. }();
  38144. var IdentityCMap = function IdentityCMapClosure() {
  38145. function IdentityCMap(vertical, n) {
  38146. CMap.call(this);
  38147. this.vertical = vertical;
  38148. this.addCodespaceRange(n, 0, 0xffff);
  38149. }
  38150. Util.inherit(IdentityCMap, CMap, {});
  38151. IdentityCMap.prototype = {
  38152. addCodespaceRange: CMap.prototype.addCodespaceRange,
  38153. mapCidRange: function (low, high, dstLow) {
  38154. error('should not call mapCidRange');
  38155. },
  38156. mapBfRange: function (low, high, dstLow) {
  38157. error('should not call mapBfRange');
  38158. },
  38159. mapBfRangeToArray: function (low, high, array) {
  38160. error('should not call mapBfRangeToArray');
  38161. },
  38162. mapOne: function (src, dst) {
  38163. error('should not call mapCidOne');
  38164. },
  38165. lookup: function (code) {
  38166. return isInt(code) && code <= 0xffff ? code : undefined;
  38167. },
  38168. contains: function (code) {
  38169. return isInt(code) && code <= 0xffff;
  38170. },
  38171. forEach: function (callback) {
  38172. for (var i = 0; i <= 0xffff; i++) {
  38173. callback(i, i);
  38174. }
  38175. },
  38176. charCodeOf: function (value) {
  38177. return isInt(value) && value <= 0xffff ? value : -1;
  38178. },
  38179. getMap: function () {
  38180. var map = new Array(0x10000);
  38181. for (var i = 0; i <= 0xffff; i++) {
  38182. map[i] = i;
  38183. }
  38184. return map;
  38185. },
  38186. readCharCode: CMap.prototype.readCharCode,
  38187. get length() {
  38188. return 0x10000;
  38189. },
  38190. get isIdentityCMap() {
  38191. error('should not access .isIdentityCMap');
  38192. }
  38193. };
  38194. return IdentityCMap;
  38195. }();
  38196. var BinaryCMapReader = function BinaryCMapReaderClosure() {
  38197. function fetchBinaryData(url) {
  38198. return new Promise(function (resolve, reject) {
  38199. var request = new XMLHttpRequest();
  38200. request.open('GET', url, true);
  38201. request.responseType = 'arraybuffer';
  38202. request.onreadystatechange = function () {
  38203. if (request.readyState === XMLHttpRequest.DONE) {
  38204. if (!request.response || request.status !== 200 && request.status !== 0) {
  38205. reject(new Error('Unable to get binary cMap at: ' + url));
  38206. } else {
  38207. resolve(new Uint8Array(request.response));
  38208. }
  38209. }
  38210. };
  38211. request.send(null);
  38212. });
  38213. }
  38214. function hexToInt(a, size) {
  38215. var n = 0;
  38216. for (var i = 0; i <= size; i++) {
  38217. n = n << 8 | a[i];
  38218. }
  38219. return n >>> 0;
  38220. }
  38221. function hexToStr(a, size) {
  38222. if (size === 1) {
  38223. return String.fromCharCode(a[0], a[1]);
  38224. }
  38225. if (size === 3) {
  38226. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  38227. }
  38228. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  38229. }
  38230. function addHex(a, b, size) {
  38231. var c = 0;
  38232. for (var i = size; i >= 0; i--) {
  38233. c += a[i] + b[i];
  38234. a[i] = c & 255;
  38235. c >>= 8;
  38236. }
  38237. }
  38238. function incHex(a, size) {
  38239. var c = 1;
  38240. for (var i = size; i >= 0 && c > 0; i--) {
  38241. c += a[i];
  38242. a[i] = c & 255;
  38243. c >>= 8;
  38244. }
  38245. }
  38246. var MAX_NUM_SIZE = 16;
  38247. var MAX_ENCODED_NUM_SIZE = 19;
  38248. function BinaryCMapStream(data) {
  38249. this.buffer = data;
  38250. this.pos = 0;
  38251. this.end = data.length;
  38252. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  38253. }
  38254. BinaryCMapStream.prototype = {
  38255. readByte: function () {
  38256. if (this.pos >= this.end) {
  38257. return -1;
  38258. }
  38259. return this.buffer[this.pos++];
  38260. },
  38261. readNumber: function () {
  38262. var n = 0;
  38263. var last;
  38264. do {
  38265. var b = this.readByte();
  38266. if (b < 0) {
  38267. error('unexpected EOF in bcmap');
  38268. }
  38269. last = !(b & 0x80);
  38270. n = n << 7 | b & 0x7F;
  38271. } while (!last);
  38272. return n;
  38273. },
  38274. readSigned: function () {
  38275. var n = this.readNumber();
  38276. return n & 1 ? ~(n >>> 1) : n >>> 1;
  38277. },
  38278. readHex: function (num, size) {
  38279. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  38280. this.pos += size + 1;
  38281. },
  38282. readHexNumber: function (num, size) {
  38283. var last;
  38284. var stack = this.tmpBuf, sp = 0;
  38285. do {
  38286. var b = this.readByte();
  38287. if (b < 0) {
  38288. error('unexpected EOF in bcmap');
  38289. }
  38290. last = !(b & 0x80);
  38291. stack[sp++] = b & 0x7F;
  38292. } while (!last);
  38293. var i = size, buffer = 0, bufferSize = 0;
  38294. while (i >= 0) {
  38295. while (bufferSize < 8 && stack.length > 0) {
  38296. buffer = stack[--sp] << bufferSize | buffer;
  38297. bufferSize += 7;
  38298. }
  38299. num[i] = buffer & 255;
  38300. i--;
  38301. buffer >>= 8;
  38302. bufferSize -= 8;
  38303. }
  38304. },
  38305. readHexSigned: function (num, size) {
  38306. this.readHexNumber(num, size);
  38307. var sign = num[size] & 1 ? 255 : 0;
  38308. var c = 0;
  38309. for (var i = 0; i <= size; i++) {
  38310. c = (c & 1) << 8 | num[i];
  38311. num[i] = c >> 1 ^ sign;
  38312. }
  38313. },
  38314. readString: function () {
  38315. var len = this.readNumber();
  38316. var s = '';
  38317. for (var i = 0; i < len; i++) {
  38318. s += String.fromCharCode(this.readNumber());
  38319. }
  38320. return s;
  38321. }
  38322. };
  38323. function processBinaryCMap(url, cMap, extend) {
  38324. return fetchBinaryData(url).then(function (data) {
  38325. var stream = new BinaryCMapStream(data);
  38326. var header = stream.readByte();
  38327. cMap.vertical = !!(header & 1);
  38328. var useCMap = null;
  38329. var start = new Uint8Array(MAX_NUM_SIZE);
  38330. var end = new Uint8Array(MAX_NUM_SIZE);
  38331. var char = new Uint8Array(MAX_NUM_SIZE);
  38332. var charCode = new Uint8Array(MAX_NUM_SIZE);
  38333. var tmp = new Uint8Array(MAX_NUM_SIZE);
  38334. var code;
  38335. var b;
  38336. while ((b = stream.readByte()) >= 0) {
  38337. var type = b >> 5;
  38338. if (type === 7) {
  38339. switch (b & 0x1F) {
  38340. case 0:
  38341. stream.readString();
  38342. break;
  38343. case 1:
  38344. useCMap = stream.readString();
  38345. break;
  38346. }
  38347. continue;
  38348. }
  38349. var sequence = !!(b & 0x10);
  38350. var dataSize = b & 15;
  38351. assert(dataSize + 1 <= MAX_NUM_SIZE);
  38352. var ucs2DataSize = 1;
  38353. var subitemsCount = stream.readNumber();
  38354. var i;
  38355. switch (type) {
  38356. case 0:
  38357. stream.readHex(start, dataSize);
  38358. stream.readHexNumber(end, dataSize);
  38359. addHex(end, start, dataSize);
  38360. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  38361. for (i = 1; i < subitemsCount; i++) {
  38362. incHex(end, dataSize);
  38363. stream.readHexNumber(start, dataSize);
  38364. addHex(start, end, dataSize);
  38365. stream.readHexNumber(end, dataSize);
  38366. addHex(end, start, dataSize);
  38367. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  38368. }
  38369. break;
  38370. case 1:
  38371. stream.readHex(start, dataSize);
  38372. stream.readHexNumber(end, dataSize);
  38373. addHex(end, start, dataSize);
  38374. code = stream.readNumber();
  38375. for (i = 1; i < subitemsCount; i++) {
  38376. incHex(end, dataSize);
  38377. stream.readHexNumber(start, dataSize);
  38378. addHex(start, end, dataSize);
  38379. stream.readHexNumber(end, dataSize);
  38380. addHex(end, start, dataSize);
  38381. code = stream.readNumber();
  38382. }
  38383. break;
  38384. case 2:
  38385. stream.readHex(char, dataSize);
  38386. code = stream.readNumber();
  38387. cMap.mapOne(hexToInt(char, dataSize), code);
  38388. for (i = 1; i < subitemsCount; i++) {
  38389. incHex(char, dataSize);
  38390. if (!sequence) {
  38391. stream.readHexNumber(tmp, dataSize);
  38392. addHex(char, tmp, dataSize);
  38393. }
  38394. code = stream.readSigned() + (code + 1);
  38395. cMap.mapOne(hexToInt(char, dataSize), code);
  38396. }
  38397. break;
  38398. case 3:
  38399. stream.readHex(start, dataSize);
  38400. stream.readHexNumber(end, dataSize);
  38401. addHex(end, start, dataSize);
  38402. code = stream.readNumber();
  38403. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  38404. for (i = 1; i < subitemsCount; i++) {
  38405. incHex(end, dataSize);
  38406. if (!sequence) {
  38407. stream.readHexNumber(start, dataSize);
  38408. addHex(start, end, dataSize);
  38409. } else {
  38410. start.set(end);
  38411. }
  38412. stream.readHexNumber(end, dataSize);
  38413. addHex(end, start, dataSize);
  38414. code = stream.readNumber();
  38415. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  38416. }
  38417. break;
  38418. case 4:
  38419. stream.readHex(char, ucs2DataSize);
  38420. stream.readHex(charCode, dataSize);
  38421. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  38422. for (i = 1; i < subitemsCount; i++) {
  38423. incHex(char, ucs2DataSize);
  38424. if (!sequence) {
  38425. stream.readHexNumber(tmp, ucs2DataSize);
  38426. addHex(char, tmp, ucs2DataSize);
  38427. }
  38428. incHex(charCode, dataSize);
  38429. stream.readHexSigned(tmp, dataSize);
  38430. addHex(charCode, tmp, dataSize);
  38431. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  38432. }
  38433. break;
  38434. case 5:
  38435. stream.readHex(start, ucs2DataSize);
  38436. stream.readHexNumber(end, ucs2DataSize);
  38437. addHex(end, start, ucs2DataSize);
  38438. stream.readHex(charCode, dataSize);
  38439. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  38440. for (i = 1; i < subitemsCount; i++) {
  38441. incHex(end, ucs2DataSize);
  38442. if (!sequence) {
  38443. stream.readHexNumber(start, ucs2DataSize);
  38444. addHex(start, end, ucs2DataSize);
  38445. } else {
  38446. start.set(end);
  38447. }
  38448. stream.readHexNumber(end, ucs2DataSize);
  38449. addHex(end, start, ucs2DataSize);
  38450. stream.readHex(charCode, dataSize);
  38451. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  38452. }
  38453. break;
  38454. default:
  38455. error('Unknown type: ' + type);
  38456. break;
  38457. }
  38458. }
  38459. if (useCMap) {
  38460. return extend(useCMap);
  38461. }
  38462. return cMap;
  38463. });
  38464. }
  38465. function BinaryCMapReader() {
  38466. }
  38467. BinaryCMapReader.prototype = { read: processBinaryCMap };
  38468. return BinaryCMapReader;
  38469. }();
  38470. var CMapFactory = function CMapFactoryClosure() {
  38471. function strToInt(str) {
  38472. var a = 0;
  38473. for (var i = 0; i < str.length; i++) {
  38474. a = a << 8 | str.charCodeAt(i);
  38475. }
  38476. return a >>> 0;
  38477. }
  38478. function expectString(obj) {
  38479. if (!isString(obj)) {
  38480. error('Malformed CMap: expected string.');
  38481. }
  38482. }
  38483. function expectInt(obj) {
  38484. if (!isInt(obj)) {
  38485. error('Malformed CMap: expected int.');
  38486. }
  38487. }
  38488. function parseBfChar(cMap, lexer) {
  38489. while (true) {
  38490. var obj = lexer.getObj();
  38491. if (isEOF(obj)) {
  38492. break;
  38493. }
  38494. if (isCmd(obj, 'endbfchar')) {
  38495. return;
  38496. }
  38497. expectString(obj);
  38498. var src = strToInt(obj);
  38499. obj = lexer.getObj();
  38500. expectString(obj);
  38501. var dst = obj;
  38502. cMap.mapOne(src, dst);
  38503. }
  38504. }
  38505. function parseBfRange(cMap, lexer) {
  38506. while (true) {
  38507. var obj = lexer.getObj();
  38508. if (isEOF(obj)) {
  38509. break;
  38510. }
  38511. if (isCmd(obj, 'endbfrange')) {
  38512. return;
  38513. }
  38514. expectString(obj);
  38515. var low = strToInt(obj);
  38516. obj = lexer.getObj();
  38517. expectString(obj);
  38518. var high = strToInt(obj);
  38519. obj = lexer.getObj();
  38520. if (isInt(obj) || isString(obj)) {
  38521. var dstLow = isInt(obj) ? String.fromCharCode(obj) : obj;
  38522. cMap.mapBfRange(low, high, dstLow);
  38523. } else if (isCmd(obj, '[')) {
  38524. obj = lexer.getObj();
  38525. var array = [];
  38526. while (!isCmd(obj, ']') && !isEOF(obj)) {
  38527. array.push(obj);
  38528. obj = lexer.getObj();
  38529. }
  38530. cMap.mapBfRangeToArray(low, high, array);
  38531. } else {
  38532. break;
  38533. }
  38534. }
  38535. error('Invalid bf range.');
  38536. }
  38537. function parseCidChar(cMap, lexer) {
  38538. while (true) {
  38539. var obj = lexer.getObj();
  38540. if (isEOF(obj)) {
  38541. break;
  38542. }
  38543. if (isCmd(obj, 'endcidchar')) {
  38544. return;
  38545. }
  38546. expectString(obj);
  38547. var src = strToInt(obj);
  38548. obj = lexer.getObj();
  38549. expectInt(obj);
  38550. var dst = obj;
  38551. cMap.mapOne(src, dst);
  38552. }
  38553. }
  38554. function parseCidRange(cMap, lexer) {
  38555. while (true) {
  38556. var obj = lexer.getObj();
  38557. if (isEOF(obj)) {
  38558. break;
  38559. }
  38560. if (isCmd(obj, 'endcidrange')) {
  38561. return;
  38562. }
  38563. expectString(obj);
  38564. var low = strToInt(obj);
  38565. obj = lexer.getObj();
  38566. expectString(obj);
  38567. var high = strToInt(obj);
  38568. obj = lexer.getObj();
  38569. expectInt(obj);
  38570. var dstLow = obj;
  38571. cMap.mapCidRange(low, high, dstLow);
  38572. }
  38573. }
  38574. function parseCodespaceRange(cMap, lexer) {
  38575. while (true) {
  38576. var obj = lexer.getObj();
  38577. if (isEOF(obj)) {
  38578. break;
  38579. }
  38580. if (isCmd(obj, 'endcodespacerange')) {
  38581. return;
  38582. }
  38583. if (!isString(obj)) {
  38584. break;
  38585. }
  38586. var low = strToInt(obj);
  38587. obj = lexer.getObj();
  38588. if (!isString(obj)) {
  38589. break;
  38590. }
  38591. var high = strToInt(obj);
  38592. cMap.addCodespaceRange(obj.length, low, high);
  38593. }
  38594. error('Invalid codespace range.');
  38595. }
  38596. function parseWMode(cMap, lexer) {
  38597. var obj = lexer.getObj();
  38598. if (isInt(obj)) {
  38599. cMap.vertical = !!obj;
  38600. }
  38601. }
  38602. function parseCMapName(cMap, lexer) {
  38603. var obj = lexer.getObj();
  38604. if (isName(obj) && isString(obj.name)) {
  38605. cMap.name = obj.name;
  38606. }
  38607. }
  38608. function parseCMap(cMap, lexer, builtInCMapParams, useCMap) {
  38609. var previous;
  38610. var embededUseCMap;
  38611. objLoop:
  38612. while (true) {
  38613. try {
  38614. var obj = lexer.getObj();
  38615. if (isEOF(obj)) {
  38616. break;
  38617. } else if (isName(obj)) {
  38618. if (obj.name === 'WMode') {
  38619. parseWMode(cMap, lexer);
  38620. } else if (obj.name === 'CMapName') {
  38621. parseCMapName(cMap, lexer);
  38622. }
  38623. previous = obj;
  38624. } else if (isCmd(obj)) {
  38625. switch (obj.cmd) {
  38626. case 'endcmap':
  38627. break objLoop;
  38628. case 'usecmap':
  38629. if (isName(previous)) {
  38630. embededUseCMap = previous.name;
  38631. }
  38632. break;
  38633. case 'begincodespacerange':
  38634. parseCodespaceRange(cMap, lexer);
  38635. break;
  38636. case 'beginbfchar':
  38637. parseBfChar(cMap, lexer);
  38638. break;
  38639. case 'begincidchar':
  38640. parseCidChar(cMap, lexer);
  38641. break;
  38642. case 'beginbfrange':
  38643. parseBfRange(cMap, lexer);
  38644. break;
  38645. case 'begincidrange':
  38646. parseCidRange(cMap, lexer);
  38647. break;
  38648. }
  38649. }
  38650. } catch (ex) {
  38651. if (ex instanceof MissingDataException) {
  38652. throw ex;
  38653. }
  38654. warn('Invalid cMap data: ' + ex);
  38655. continue;
  38656. }
  38657. }
  38658. if (!useCMap && embededUseCMap) {
  38659. useCMap = embededUseCMap;
  38660. }
  38661. if (useCMap) {
  38662. return extendCMap(cMap, builtInCMapParams, useCMap);
  38663. }
  38664. return Promise.resolve(cMap);
  38665. }
  38666. function extendCMap(cMap, builtInCMapParams, useCMap) {
  38667. return createBuiltInCMap(useCMap, builtInCMapParams).then(function (newCMap) {
  38668. cMap.useCMap = newCMap;
  38669. if (cMap.numCodespaceRanges === 0) {
  38670. var useCodespaceRanges = cMap.useCMap.codespaceRanges;
  38671. for (var i = 0; i < useCodespaceRanges.length; i++) {
  38672. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  38673. }
  38674. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  38675. }
  38676. cMap.useCMap.forEach(function (key, value) {
  38677. if (!cMap.contains(key)) {
  38678. cMap.mapOne(key, cMap.useCMap.lookup(key));
  38679. }
  38680. });
  38681. return cMap;
  38682. });
  38683. }
  38684. function parseBinaryCMap(name, builtInCMapParams) {
  38685. var url = builtInCMapParams.url + name + '.bcmap';
  38686. var cMap = new CMap(true);
  38687. return new BinaryCMapReader().read(url, cMap, function (useCMap) {
  38688. return extendCMap(cMap, builtInCMapParams, useCMap);
  38689. });
  38690. }
  38691. function createBuiltInCMap(name, builtInCMapParams) {
  38692. if (name === 'Identity-H') {
  38693. return Promise.resolve(new IdentityCMap(false, 2));
  38694. } else if (name === 'Identity-V') {
  38695. return Promise.resolve(new IdentityCMap(true, 2));
  38696. }
  38697. if (BUILT_IN_CMAPS.indexOf(name) === -1) {
  38698. return Promise.reject(new Error('Unknown cMap name: ' + name));
  38699. }
  38700. assert(builtInCMapParams, 'built-in cMap parameters are not provided');
  38701. if (builtInCMapParams.packed) {
  38702. return parseBinaryCMap(name, builtInCMapParams);
  38703. }
  38704. return new Promise(function (resolve, reject) {
  38705. var url = builtInCMapParams.url + name;
  38706. var request = new XMLHttpRequest();
  38707. request.onreadystatechange = function () {
  38708. if (request.readyState === XMLHttpRequest.DONE) {
  38709. if (request.status === 200 || request.status === 0) {
  38710. var cMap = new CMap(true);
  38711. var lexer = new Lexer(new StringStream(request.responseText));
  38712. parseCMap(cMap, lexer, builtInCMapParams, null).then(function (parsedCMap) {
  38713. resolve(parsedCMap);
  38714. });
  38715. } else {
  38716. reject(new Error('Unable to get cMap at: ' + url));
  38717. }
  38718. }
  38719. };
  38720. request.open('GET', url, true);
  38721. request.send(null);
  38722. });
  38723. }
  38724. return {
  38725. create: function (encoding, builtInCMapParams, useCMap) {
  38726. if (isName(encoding)) {
  38727. return createBuiltInCMap(encoding.name, builtInCMapParams);
  38728. } else if (isStream(encoding)) {
  38729. var cMap = new CMap();
  38730. var lexer = new Lexer(encoding);
  38731. return parseCMap(cMap, lexer, builtInCMapParams, useCMap).then(function (parsedCMap) {
  38732. if (parsedCMap.isIdentityCMap) {
  38733. return createBuiltInCMap(parsedCMap.name, builtInCMapParams);
  38734. }
  38735. return parsedCMap;
  38736. });
  38737. }
  38738. return Promise.reject(new Error('Encoding required.'));
  38739. }
  38740. };
  38741. }();
  38742. exports.CMap = CMap;
  38743. exports.CMapFactory = CMapFactory;
  38744. exports.IdentityCMap = IdentityCMap;
  38745. /***/ }),
  38746. /* 25 */
  38747. /***/ (function(module, exports, __w_pdfjs_require__) {
  38748. "use strict";
  38749. var sharedUtil = __w_pdfjs_require__(0);
  38750. var corePrimitives = __w_pdfjs_require__(1);
  38751. var coreStream = __w_pdfjs_require__(2);
  38752. var coreObj = __w_pdfjs_require__(15);
  38753. var coreParser = __w_pdfjs_require__(5);
  38754. var coreCrypto = __w_pdfjs_require__(12);
  38755. var coreEvaluator = __w_pdfjs_require__(13);
  38756. var coreAnnotation = __w_pdfjs_require__(21);
  38757. var MissingDataException = sharedUtil.MissingDataException;
  38758. var Util = sharedUtil.Util;
  38759. var assert = sharedUtil.assert;
  38760. var error = sharedUtil.error;
  38761. var info = sharedUtil.info;
  38762. var isArray = sharedUtil.isArray;
  38763. var isArrayBuffer = sharedUtil.isArrayBuffer;
  38764. var isNum = sharedUtil.isNum;
  38765. var isString = sharedUtil.isString;
  38766. var shadow = sharedUtil.shadow;
  38767. var stringToBytes = sharedUtil.stringToBytes;
  38768. var stringToPDFString = sharedUtil.stringToPDFString;
  38769. var warn = sharedUtil.warn;
  38770. var isSpace = sharedUtil.isSpace;
  38771. var Dict = corePrimitives.Dict;
  38772. var isDict = corePrimitives.isDict;
  38773. var isName = corePrimitives.isName;
  38774. var isStream = corePrimitives.isStream;
  38775. var NullStream = coreStream.NullStream;
  38776. var Stream = coreStream.Stream;
  38777. var StreamsSequenceStream = coreStream.StreamsSequenceStream;
  38778. var Catalog = coreObj.Catalog;
  38779. var ObjectLoader = coreObj.ObjectLoader;
  38780. var XRef = coreObj.XRef;
  38781. var Linearization = coreParser.Linearization;
  38782. var calculateMD5 = coreCrypto.calculateMD5;
  38783. var OperatorList = coreEvaluator.OperatorList;
  38784. var PartialEvaluator = coreEvaluator.PartialEvaluator;
  38785. var Annotation = coreAnnotation.Annotation;
  38786. var AnnotationFactory = coreAnnotation.AnnotationFactory;
  38787. var Page = function PageClosure() {
  38788. var DEFAULT_USER_UNIT = 1.0;
  38789. var LETTER_SIZE_MEDIABOX = [
  38790. 0,
  38791. 0,
  38792. 612,
  38793. 792
  38794. ];
  38795. function Page(pdfManager, xref, pageIndex, pageDict, ref, fontCache) {
  38796. this.pdfManager = pdfManager;
  38797. this.pageIndex = pageIndex;
  38798. this.pageDict = pageDict;
  38799. this.xref = xref;
  38800. this.ref = ref;
  38801. this.fontCache = fontCache;
  38802. this.evaluatorOptions = pdfManager.evaluatorOptions;
  38803. this.resourcesPromise = null;
  38804. var uniquePrefix = 'p' + this.pageIndex + '_';
  38805. var idCounters = { obj: 0 };
  38806. this.idFactory = {
  38807. createObjId: function () {
  38808. return uniquePrefix + ++idCounters.obj;
  38809. }
  38810. };
  38811. }
  38812. Page.prototype = {
  38813. getPageProp: function Page_getPageProp(key) {
  38814. return this.pageDict.get(key);
  38815. },
  38816. getInheritedPageProp: function Page_getInheritedPageProp(key, getArray) {
  38817. var dict = this.pageDict, valueArray = null, loopCount = 0;
  38818. var MAX_LOOP_COUNT = 100;
  38819. getArray = getArray || false;
  38820. while (dict) {
  38821. var value = getArray ? dict.getArray(key) : dict.get(key);
  38822. if (value) {
  38823. if (!valueArray) {
  38824. valueArray = [];
  38825. }
  38826. valueArray.push(value);
  38827. }
  38828. if (++loopCount > MAX_LOOP_COUNT) {
  38829. warn('Page_getInheritedPageProp: maximum loop count exceeded.');
  38830. break;
  38831. }
  38832. dict = dict.get('Parent');
  38833. }
  38834. if (!valueArray) {
  38835. return Dict.empty;
  38836. }
  38837. if (valueArray.length === 1 || !isDict(valueArray[0]) || loopCount > MAX_LOOP_COUNT) {
  38838. return valueArray[0];
  38839. }
  38840. return Dict.merge(this.xref, valueArray);
  38841. },
  38842. get content() {
  38843. return this.getPageProp('Contents');
  38844. },
  38845. get resources() {
  38846. return shadow(this, 'resources', this.getInheritedPageProp('Resources'));
  38847. },
  38848. get mediaBox() {
  38849. var mediaBox = this.getInheritedPageProp('MediaBox', true);
  38850. if (!isArray(mediaBox) || mediaBox.length !== 4) {
  38851. return shadow(this, 'mediaBox', LETTER_SIZE_MEDIABOX);
  38852. }
  38853. return shadow(this, 'mediaBox', mediaBox);
  38854. },
  38855. get cropBox() {
  38856. var cropBox = this.getInheritedPageProp('CropBox', true);
  38857. if (!isArray(cropBox) || cropBox.length !== 4) {
  38858. return shadow(this, 'cropBox', this.mediaBox);
  38859. }
  38860. return shadow(this, 'cropBox', cropBox);
  38861. },
  38862. get userUnit() {
  38863. var obj = this.getPageProp('UserUnit');
  38864. if (!isNum(obj) || obj <= 0) {
  38865. obj = DEFAULT_USER_UNIT;
  38866. }
  38867. return shadow(this, 'userUnit', obj);
  38868. },
  38869. get view() {
  38870. var mediaBox = this.mediaBox, cropBox = this.cropBox;
  38871. if (mediaBox === cropBox) {
  38872. return shadow(this, 'view', mediaBox);
  38873. }
  38874. var intersection = Util.intersect(cropBox, mediaBox);
  38875. return shadow(this, 'view', intersection || mediaBox);
  38876. },
  38877. get rotate() {
  38878. var rotate = this.getInheritedPageProp('Rotate') || 0;
  38879. if (rotate % 90 !== 0) {
  38880. rotate = 0;
  38881. } else if (rotate >= 360) {
  38882. rotate = rotate % 360;
  38883. } else if (rotate < 0) {
  38884. rotate = (rotate % 360 + 360) % 360;
  38885. }
  38886. return shadow(this, 'rotate', rotate);
  38887. },
  38888. getContentStream: function Page_getContentStream() {
  38889. var content = this.content;
  38890. var stream;
  38891. if (isArray(content)) {
  38892. var xref = this.xref;
  38893. var i, n = content.length;
  38894. var streams = [];
  38895. for (i = 0; i < n; ++i) {
  38896. streams.push(xref.fetchIfRef(content[i]));
  38897. }
  38898. stream = new StreamsSequenceStream(streams);
  38899. } else if (isStream(content)) {
  38900. stream = content;
  38901. } else {
  38902. stream = new NullStream();
  38903. }
  38904. return stream;
  38905. },
  38906. loadResources: function Page_loadResources(keys) {
  38907. if (!this.resourcesPromise) {
  38908. this.resourcesPromise = this.pdfManager.ensure(this, 'resources');
  38909. }
  38910. return this.resourcesPromise.then(function resourceSuccess() {
  38911. var objectLoader = new ObjectLoader(this.resources.map, keys, this.xref);
  38912. return objectLoader.load();
  38913. }.bind(this));
  38914. },
  38915. getOperatorList: function Page_getOperatorList(handler, task, intent, renderInteractiveForms) {
  38916. var self = this;
  38917. var pdfManager = this.pdfManager;
  38918. var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', []);
  38919. var resourcesPromise = this.loadResources([
  38920. 'ExtGState',
  38921. 'ColorSpace',
  38922. 'Pattern',
  38923. 'Shading',
  38924. 'XObject',
  38925. 'Font'
  38926. ]);
  38927. var partialEvaluator = new PartialEvaluator(pdfManager, this.xref, handler, this.pageIndex, this.idFactory, this.fontCache, this.evaluatorOptions);
  38928. var dataPromises = Promise.all([
  38929. contentStreamPromise,
  38930. resourcesPromise
  38931. ]);
  38932. var pageListPromise = dataPromises.then(function (data) {
  38933. var contentStream = data[0];
  38934. var opList = new OperatorList(intent, handler, self.pageIndex);
  38935. handler.send('StartRenderPage', {
  38936. transparency: partialEvaluator.hasBlendModes(self.resources),
  38937. pageIndex: self.pageIndex,
  38938. intent: intent
  38939. });
  38940. return partialEvaluator.getOperatorList(contentStream, task, self.resources, opList).then(function () {
  38941. return opList;
  38942. });
  38943. });
  38944. var annotationsPromise = pdfManager.ensure(this, 'annotations');
  38945. return Promise.all([
  38946. pageListPromise,
  38947. annotationsPromise
  38948. ]).then(function (datas) {
  38949. var pageOpList = datas[0];
  38950. var annotations = datas[1];
  38951. if (annotations.length === 0) {
  38952. pageOpList.flush(true);
  38953. return pageOpList;
  38954. }
  38955. var annotationsReadyPromise = Annotation.appendToOperatorList(annotations, pageOpList, partialEvaluator, task, intent, renderInteractiveForms);
  38956. return annotationsReadyPromise.then(function () {
  38957. pageOpList.flush(true);
  38958. return pageOpList;
  38959. });
  38960. });
  38961. },
  38962. extractTextContent: function Page_extractTextContent(task, normalizeWhitespace, combineTextItems) {
  38963. var handler = {
  38964. on: function nullHandlerOn() {
  38965. },
  38966. send: function nullHandlerSend() {
  38967. }
  38968. };
  38969. var self = this;
  38970. var pdfManager = this.pdfManager;
  38971. var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', []);
  38972. var resourcesPromise = this.loadResources([
  38973. 'ExtGState',
  38974. 'XObject',
  38975. 'Font'
  38976. ]);
  38977. var dataPromises = Promise.all([
  38978. contentStreamPromise,
  38979. resourcesPromise
  38980. ]);
  38981. return dataPromises.then(function (data) {
  38982. var contentStream = data[0];
  38983. var partialEvaluator = new PartialEvaluator(pdfManager, self.xref, handler, self.pageIndex, self.idFactory, self.fontCache, self.evaluatorOptions);
  38984. return partialEvaluator.getTextContent(contentStream, task, self.resources, null, normalizeWhitespace, combineTextItems);
  38985. });
  38986. },
  38987. getAnnotationsData: function Page_getAnnotationsData(intent) {
  38988. var annotations = this.annotations;
  38989. var annotationsData = [];
  38990. for (var i = 0, n = annotations.length; i < n; ++i) {
  38991. if (intent) {
  38992. if (!(intent === 'display' && annotations[i].viewable) && !(intent === 'print' && annotations[i].printable)) {
  38993. continue;
  38994. }
  38995. }
  38996. annotationsData.push(annotations[i].data);
  38997. }
  38998. return annotationsData;
  38999. },
  39000. get annotations() {
  39001. var annotations = [];
  39002. var annotationRefs = this.getInheritedPageProp('Annots') || [];
  39003. var annotationFactory = new AnnotationFactory();
  39004. for (var i = 0, n = annotationRefs.length; i < n; ++i) {
  39005. var annotationRef = annotationRefs[i];
  39006. var annotation = annotationFactory.create(this.xref, annotationRef, this.pdfManager, this.idFactory);
  39007. if (annotation) {
  39008. annotations.push(annotation);
  39009. }
  39010. }
  39011. return shadow(this, 'annotations', annotations);
  39012. }
  39013. };
  39014. return Page;
  39015. }();
  39016. var PDFDocument = function PDFDocumentClosure() {
  39017. var FINGERPRINT_FIRST_BYTES = 1024;
  39018. var EMPTY_FINGERPRINT = '\x00\x00\x00\x00\x00\x00\x00' + '\x00\x00\x00\x00\x00\x00\x00\x00\x00';
  39019. function PDFDocument(pdfManager, arg) {
  39020. var stream;
  39021. if (isStream(arg)) {
  39022. stream = arg;
  39023. } else if (isArrayBuffer(arg)) {
  39024. stream = new Stream(arg);
  39025. } else {
  39026. error('PDFDocument: Unknown argument type');
  39027. }
  39028. assert(stream.length > 0, 'stream must have data');
  39029. this.pdfManager = pdfManager;
  39030. this.stream = stream;
  39031. this.xref = new XRef(stream, pdfManager);
  39032. }
  39033. function find(stream, needle, limit, backwards) {
  39034. var pos = stream.pos;
  39035. var end = stream.end;
  39036. var strBuf = [];
  39037. if (pos + limit > end) {
  39038. limit = end - pos;
  39039. }
  39040. for (var n = 0; n < limit; ++n) {
  39041. strBuf.push(String.fromCharCode(stream.getByte()));
  39042. }
  39043. var str = strBuf.join('');
  39044. stream.pos = pos;
  39045. var index = backwards ? str.lastIndexOf(needle) : str.indexOf(needle);
  39046. if (index === -1) {
  39047. return false;
  39048. }
  39049. stream.pos += index;
  39050. return true;
  39051. }
  39052. var DocumentInfoValidators = {
  39053. get entries() {
  39054. return shadow(this, 'entries', {
  39055. Title: isString,
  39056. Author: isString,
  39057. Subject: isString,
  39058. Keywords: isString,
  39059. Creator: isString,
  39060. Producer: isString,
  39061. CreationDate: isString,
  39062. ModDate: isString,
  39063. Trapped: isName
  39064. });
  39065. }
  39066. };
  39067. PDFDocument.prototype = {
  39068. parse: function PDFDocument_parse(recoveryMode) {
  39069. this.setup(recoveryMode);
  39070. var version = this.catalog.catDict.get('Version');
  39071. if (isName(version)) {
  39072. this.pdfFormatVersion = version.name;
  39073. }
  39074. try {
  39075. this.acroForm = this.catalog.catDict.get('AcroForm');
  39076. if (this.acroForm) {
  39077. this.xfa = this.acroForm.get('XFA');
  39078. var fields = this.acroForm.get('Fields');
  39079. if ((!fields || !isArray(fields) || fields.length === 0) && !this.xfa) {
  39080. this.acroForm = null;
  39081. }
  39082. }
  39083. } catch (ex) {
  39084. info('Something wrong with AcroForm entry');
  39085. this.acroForm = null;
  39086. }
  39087. },
  39088. get linearization() {
  39089. var linearization = null;
  39090. if (this.stream.length) {
  39091. try {
  39092. linearization = Linearization.create(this.stream);
  39093. } catch (err) {
  39094. if (err instanceof MissingDataException) {
  39095. throw err;
  39096. }
  39097. info(err);
  39098. }
  39099. }
  39100. return shadow(this, 'linearization', linearization);
  39101. },
  39102. get startXRef() {
  39103. var stream = this.stream;
  39104. var startXRef = 0;
  39105. var linearization = this.linearization;
  39106. if (linearization) {
  39107. stream.reset();
  39108. if (find(stream, 'endobj', 1024)) {
  39109. startXRef = stream.pos + 6;
  39110. }
  39111. } else {
  39112. var step = 1024;
  39113. var found = false, pos = stream.end;
  39114. while (!found && pos > 0) {
  39115. pos -= step - 'startxref'.length;
  39116. if (pos < 0) {
  39117. pos = 0;
  39118. }
  39119. stream.pos = pos;
  39120. found = find(stream, 'startxref', step, true);
  39121. }
  39122. if (found) {
  39123. stream.skip(9);
  39124. var ch;
  39125. do {
  39126. ch = stream.getByte();
  39127. } while (isSpace(ch));
  39128. var str = '';
  39129. while (ch >= 0x20 && ch <= 0x39) {
  39130. str += String.fromCharCode(ch);
  39131. ch = stream.getByte();
  39132. }
  39133. startXRef = parseInt(str, 10);
  39134. if (isNaN(startXRef)) {
  39135. startXRef = 0;
  39136. }
  39137. }
  39138. }
  39139. return shadow(this, 'startXRef', startXRef);
  39140. },
  39141. get mainXRefEntriesOffset() {
  39142. var mainXRefEntriesOffset = 0;
  39143. var linearization = this.linearization;
  39144. if (linearization) {
  39145. mainXRefEntriesOffset = linearization.mainXRefEntriesOffset;
  39146. }
  39147. return shadow(this, 'mainXRefEntriesOffset', mainXRefEntriesOffset);
  39148. },
  39149. checkHeader: function PDFDocument_checkHeader() {
  39150. var stream = this.stream;
  39151. stream.reset();
  39152. if (find(stream, '%PDF-', 1024)) {
  39153. stream.moveStart();
  39154. var MAX_VERSION_LENGTH = 12;
  39155. var version = '', ch;
  39156. while ((ch = stream.getByte()) > 0x20) {
  39157. if (version.length >= MAX_VERSION_LENGTH) {
  39158. break;
  39159. }
  39160. version += String.fromCharCode(ch);
  39161. }
  39162. if (!this.pdfFormatVersion) {
  39163. this.pdfFormatVersion = version.substring(5);
  39164. }
  39165. return;
  39166. }
  39167. },
  39168. parseStartXRef: function PDFDocument_parseStartXRef() {
  39169. var startXRef = this.startXRef;
  39170. this.xref.setStartXRef(startXRef);
  39171. },
  39172. setup: function PDFDocument_setup(recoveryMode) {
  39173. this.xref.parse(recoveryMode);
  39174. var self = this;
  39175. var pageFactory = {
  39176. createPage: function (pageIndex, dict, ref, fontCache) {
  39177. return new Page(self.pdfManager, self.xref, pageIndex, dict, ref, fontCache);
  39178. }
  39179. };
  39180. this.catalog = new Catalog(this.pdfManager, this.xref, pageFactory);
  39181. },
  39182. get numPages() {
  39183. var linearization = this.linearization;
  39184. var num = linearization ? linearization.numPages : this.catalog.numPages;
  39185. return shadow(this, 'numPages', num);
  39186. },
  39187. get documentInfo() {
  39188. var docInfo = {
  39189. PDFFormatVersion: this.pdfFormatVersion,
  39190. IsAcroFormPresent: !!this.acroForm,
  39191. IsXFAPresent: !!this.xfa
  39192. };
  39193. var infoDict;
  39194. try {
  39195. infoDict = this.xref.trailer.get('Info');
  39196. } catch (err) {
  39197. info('The document information dictionary is invalid.');
  39198. }
  39199. if (infoDict) {
  39200. var validEntries = DocumentInfoValidators.entries;
  39201. for (var key in validEntries) {
  39202. if (infoDict.has(key)) {
  39203. var value = infoDict.get(key);
  39204. if (validEntries[key](value)) {
  39205. docInfo[key] = typeof value !== 'string' ? value : stringToPDFString(value);
  39206. } else {
  39207. info('Bad value in document info for "' + key + '"');
  39208. }
  39209. }
  39210. }
  39211. }
  39212. return shadow(this, 'documentInfo', docInfo);
  39213. },
  39214. get fingerprint() {
  39215. var xref = this.xref, hash, fileID = '';
  39216. var idArray = xref.trailer.get('ID');
  39217. if (idArray && isArray(idArray) && idArray[0] && isString(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) {
  39218. hash = stringToBytes(idArray[0]);
  39219. } else {
  39220. if (this.stream.ensureRange) {
  39221. this.stream.ensureRange(0, Math.min(FINGERPRINT_FIRST_BYTES, this.stream.end));
  39222. }
  39223. hash = calculateMD5(this.stream.bytes.subarray(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  39224. }
  39225. for (var i = 0, n = hash.length; i < n; i++) {
  39226. var hex = hash[i].toString(16);
  39227. fileID += hex.length === 1 ? '0' + hex : hex;
  39228. }
  39229. return shadow(this, 'fingerprint', fileID);
  39230. },
  39231. getPage: function PDFDocument_getPage(pageIndex) {
  39232. return this.catalog.getPage(pageIndex);
  39233. },
  39234. cleanup: function PDFDocument_cleanup() {
  39235. return this.catalog.cleanup();
  39236. }
  39237. };
  39238. return PDFDocument;
  39239. }();
  39240. exports.Page = Page;
  39241. exports.PDFDocument = PDFDocument;
  39242. /***/ }),
  39243. /* 26 */
  39244. /***/ (function(module, exports, __w_pdfjs_require__) {
  39245. "use strict";
  39246. var sharedUtil = __w_pdfjs_require__(0);
  39247. var coreStream = __w_pdfjs_require__(2);
  39248. var coreGlyphList = __w_pdfjs_require__(7);
  39249. var coreEncodings = __w_pdfjs_require__(4);
  39250. var coreCFFParser = __w_pdfjs_require__(10);
  39251. var Util = sharedUtil.Util;
  39252. var bytesToString = sharedUtil.bytesToString;
  39253. var error = sharedUtil.error;
  39254. var Stream = coreStream.Stream;
  39255. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  39256. var StandardEncoding = coreEncodings.StandardEncoding;
  39257. var CFFParser = coreCFFParser.CFFParser;
  39258. var FontRendererFactory = function FontRendererFactoryClosure() {
  39259. function getLong(data, offset) {
  39260. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  39261. }
  39262. function getUshort(data, offset) {
  39263. return data[offset] << 8 | data[offset + 1];
  39264. }
  39265. function parseCmap(data, start, end) {
  39266. var offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16);
  39267. var format = getUshort(data, start + offset);
  39268. var ranges, p, i;
  39269. if (format === 4) {
  39270. getUshort(data, start + offset + 2);
  39271. var segCount = getUshort(data, start + offset + 6) >> 1;
  39272. p = start + offset + 14;
  39273. ranges = [];
  39274. for (i = 0; i < segCount; i++, p += 2) {
  39275. ranges[i] = { end: getUshort(data, p) };
  39276. }
  39277. p += 2;
  39278. for (i = 0; i < segCount; i++, p += 2) {
  39279. ranges[i].start = getUshort(data, p);
  39280. }
  39281. for (i = 0; i < segCount; i++, p += 2) {
  39282. ranges[i].idDelta = getUshort(data, p);
  39283. }
  39284. for (i = 0; i < segCount; i++, p += 2) {
  39285. var idOffset = getUshort(data, p);
  39286. if (idOffset === 0) {
  39287. continue;
  39288. }
  39289. ranges[i].ids = [];
  39290. for (var j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  39291. ranges[i].ids[j] = getUshort(data, p + idOffset);
  39292. idOffset += 2;
  39293. }
  39294. }
  39295. return ranges;
  39296. } else if (format === 12) {
  39297. getLong(data, start + offset + 4);
  39298. var groups = getLong(data, start + offset + 12);
  39299. p = start + offset + 16;
  39300. ranges = [];
  39301. for (i = 0; i < groups; i++) {
  39302. ranges.push({
  39303. start: getLong(data, p),
  39304. end: getLong(data, p + 4),
  39305. idDelta: getLong(data, p + 8) - getLong(data, p)
  39306. });
  39307. p += 12;
  39308. }
  39309. return ranges;
  39310. }
  39311. error('not supported cmap: ' + format);
  39312. }
  39313. function parseCff(data, start, end, seacAnalysisEnabled) {
  39314. var properties = {};
  39315. var parser = new CFFParser(new Stream(data, start, end - start), properties, seacAnalysisEnabled);
  39316. var cff = parser.parse();
  39317. return {
  39318. glyphs: cff.charStrings.objects,
  39319. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  39320. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects
  39321. };
  39322. }
  39323. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  39324. var itemSize, itemDecode;
  39325. if (isGlyphLocationsLong) {
  39326. itemSize = 4;
  39327. itemDecode = function fontItemDecodeLong(data, offset) {
  39328. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  39329. };
  39330. } else {
  39331. itemSize = 2;
  39332. itemDecode = function fontItemDecode(data, offset) {
  39333. return data[offset] << 9 | data[offset + 1] << 1;
  39334. };
  39335. }
  39336. var glyphs = [];
  39337. var startOffset = itemDecode(loca, 0);
  39338. for (var j = itemSize; j < loca.length; j += itemSize) {
  39339. var endOffset = itemDecode(loca, j);
  39340. glyphs.push(glyf.subarray(startOffset, endOffset));
  39341. startOffset = endOffset;
  39342. }
  39343. return glyphs;
  39344. }
  39345. function lookupCmap(ranges, unicode) {
  39346. var code = unicode.charCodeAt(0), gid = 0;
  39347. var l = 0, r = ranges.length - 1;
  39348. while (l < r) {
  39349. var c = l + r + 1 >> 1;
  39350. if (code < ranges[c].start) {
  39351. r = c - 1;
  39352. } else {
  39353. l = c;
  39354. }
  39355. }
  39356. if (ranges[l].start <= code && code <= ranges[l].end) {
  39357. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xFFFF;
  39358. }
  39359. return {
  39360. charCode: code,
  39361. glyphId: gid
  39362. };
  39363. }
  39364. function compileGlyf(code, cmds, font) {
  39365. function moveTo(x, y) {
  39366. cmds.push({
  39367. cmd: 'moveTo',
  39368. args: [
  39369. x,
  39370. y
  39371. ]
  39372. });
  39373. }
  39374. function lineTo(x, y) {
  39375. cmds.push({
  39376. cmd: 'lineTo',
  39377. args: [
  39378. x,
  39379. y
  39380. ]
  39381. });
  39382. }
  39383. function quadraticCurveTo(xa, ya, x, y) {
  39384. cmds.push({
  39385. cmd: 'quadraticCurveTo',
  39386. args: [
  39387. xa,
  39388. ya,
  39389. x,
  39390. y
  39391. ]
  39392. });
  39393. }
  39394. var i = 0;
  39395. var numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16;
  39396. var flags;
  39397. var x = 0, y = 0;
  39398. i += 10;
  39399. if (numberOfContours < 0) {
  39400. do {
  39401. flags = code[i] << 8 | code[i + 1];
  39402. var glyphIndex = code[i + 2] << 8 | code[i + 3];
  39403. i += 4;
  39404. var arg1, arg2;
  39405. if (flags & 0x01) {
  39406. arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16;
  39407. arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16;
  39408. i += 4;
  39409. } else {
  39410. arg1 = code[i++];
  39411. arg2 = code[i++];
  39412. }
  39413. if (flags & 0x02) {
  39414. x = arg1;
  39415. y = arg2;
  39416. } else {
  39417. x = 0;
  39418. y = 0;
  39419. }
  39420. var scaleX = 1, scaleY = 1, scale01 = 0, scale10 = 0;
  39421. if (flags & 0x08) {
  39422. scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  39423. i += 2;
  39424. } else if (flags & 0x40) {
  39425. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  39426. scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  39427. i += 4;
  39428. } else if (flags & 0x80) {
  39429. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  39430. scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  39431. scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824;
  39432. scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824;
  39433. i += 8;
  39434. }
  39435. var subglyph = font.glyphs[glyphIndex];
  39436. if (subglyph) {
  39437. cmds.push({ cmd: 'save' });
  39438. cmds.push({
  39439. cmd: 'transform',
  39440. args: [
  39441. scaleX,
  39442. scale01,
  39443. scale10,
  39444. scaleY,
  39445. x,
  39446. y
  39447. ]
  39448. });
  39449. compileGlyf(subglyph, cmds, font);
  39450. cmds.push({ cmd: 'restore' });
  39451. }
  39452. } while (flags & 0x20);
  39453. } else {
  39454. var endPtsOfContours = [];
  39455. var j, jj;
  39456. for (j = 0; j < numberOfContours; j++) {
  39457. endPtsOfContours.push(code[i] << 8 | code[i + 1]);
  39458. i += 2;
  39459. }
  39460. var instructionLength = code[i] << 8 | code[i + 1];
  39461. i += 2 + instructionLength;
  39462. var numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
  39463. var points = [];
  39464. while (points.length < numberOfPoints) {
  39465. flags = code[i++];
  39466. var repeat = 1;
  39467. if (flags & 0x08) {
  39468. repeat += code[i++];
  39469. }
  39470. while (repeat-- > 0) {
  39471. points.push({ flags: flags });
  39472. }
  39473. }
  39474. for (j = 0; j < numberOfPoints; j++) {
  39475. switch (points[j].flags & 0x12) {
  39476. case 0x00:
  39477. x += (code[i] << 24 | code[i + 1] << 16) >> 16;
  39478. i += 2;
  39479. break;
  39480. case 0x02:
  39481. x -= code[i++];
  39482. break;
  39483. case 0x12:
  39484. x += code[i++];
  39485. break;
  39486. }
  39487. points[j].x = x;
  39488. }
  39489. for (j = 0; j < numberOfPoints; j++) {
  39490. switch (points[j].flags & 0x24) {
  39491. case 0x00:
  39492. y += (code[i] << 24 | code[i + 1] << 16) >> 16;
  39493. i += 2;
  39494. break;
  39495. case 0x04:
  39496. y -= code[i++];
  39497. break;
  39498. case 0x24:
  39499. y += code[i++];
  39500. break;
  39501. }
  39502. points[j].y = y;
  39503. }
  39504. var startPoint = 0;
  39505. for (i = 0; i < numberOfContours; i++) {
  39506. var endPoint = endPtsOfContours[i];
  39507. var contour = points.slice(startPoint, endPoint + 1);
  39508. if (contour[0].flags & 1) {
  39509. contour.push(contour[0]);
  39510. } else if (contour[contour.length - 1].flags & 1) {
  39511. contour.unshift(contour[contour.length - 1]);
  39512. } else {
  39513. var p = {
  39514. flags: 1,
  39515. x: (contour[0].x + contour[contour.length - 1].x) / 2,
  39516. y: (contour[0].y + contour[contour.length - 1].y) / 2
  39517. };
  39518. contour.unshift(p);
  39519. contour.push(p);
  39520. }
  39521. moveTo(contour[0].x, contour[0].y);
  39522. for (j = 1, jj = contour.length; j < jj; j++) {
  39523. if (contour[j].flags & 1) {
  39524. lineTo(contour[j].x, contour[j].y);
  39525. } else if (contour[j + 1].flags & 1) {
  39526. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  39527. j++;
  39528. } else {
  39529. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  39530. }
  39531. }
  39532. startPoint = endPoint + 1;
  39533. }
  39534. }
  39535. }
  39536. function compileCharString(code, cmds, font) {
  39537. var stack = [];
  39538. var x = 0, y = 0;
  39539. var stems = 0;
  39540. function moveTo(x, y) {
  39541. cmds.push({
  39542. cmd: 'moveTo',
  39543. args: [
  39544. x,
  39545. y
  39546. ]
  39547. });
  39548. }
  39549. function lineTo(x, y) {
  39550. cmds.push({
  39551. cmd: 'lineTo',
  39552. args: [
  39553. x,
  39554. y
  39555. ]
  39556. });
  39557. }
  39558. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  39559. cmds.push({
  39560. cmd: 'bezierCurveTo',
  39561. args: [
  39562. x1,
  39563. y1,
  39564. x2,
  39565. y2,
  39566. x,
  39567. y
  39568. ]
  39569. });
  39570. }
  39571. function parse(code) {
  39572. var i = 0;
  39573. while (i < code.length) {
  39574. var stackClean = false;
  39575. var v = code[i++];
  39576. var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  39577. switch (v) {
  39578. case 1:
  39579. stems += stack.length >> 1;
  39580. stackClean = true;
  39581. break;
  39582. case 3:
  39583. stems += stack.length >> 1;
  39584. stackClean = true;
  39585. break;
  39586. case 4:
  39587. y += stack.pop();
  39588. moveTo(x, y);
  39589. stackClean = true;
  39590. break;
  39591. case 5:
  39592. while (stack.length > 0) {
  39593. x += stack.shift();
  39594. y += stack.shift();
  39595. lineTo(x, y);
  39596. }
  39597. break;
  39598. case 6:
  39599. while (stack.length > 0) {
  39600. x += stack.shift();
  39601. lineTo(x, y);
  39602. if (stack.length === 0) {
  39603. break;
  39604. }
  39605. y += stack.shift();
  39606. lineTo(x, y);
  39607. }
  39608. break;
  39609. case 7:
  39610. while (stack.length > 0) {
  39611. y += stack.shift();
  39612. lineTo(x, y);
  39613. if (stack.length === 0) {
  39614. break;
  39615. }
  39616. x += stack.shift();
  39617. lineTo(x, y);
  39618. }
  39619. break;
  39620. case 8:
  39621. while (stack.length > 0) {
  39622. xa = x + stack.shift();
  39623. ya = y + stack.shift();
  39624. xb = xa + stack.shift();
  39625. yb = ya + stack.shift();
  39626. x = xb + stack.shift();
  39627. y = yb + stack.shift();
  39628. bezierCurveTo(xa, ya, xb, yb, x, y);
  39629. }
  39630. break;
  39631. case 10:
  39632. n = stack.pop() + font.subrsBias;
  39633. subrCode = font.subrs[n];
  39634. if (subrCode) {
  39635. parse(subrCode);
  39636. }
  39637. break;
  39638. case 11:
  39639. return;
  39640. case 12:
  39641. v = code[i++];
  39642. switch (v) {
  39643. case 34:
  39644. xa = x + stack.shift();
  39645. xb = xa + stack.shift();
  39646. y1 = y + stack.shift();
  39647. x = xb + stack.shift();
  39648. bezierCurveTo(xa, y, xb, y1, x, y1);
  39649. xa = x + stack.shift();
  39650. xb = xa + stack.shift();
  39651. x = xb + stack.shift();
  39652. bezierCurveTo(xa, y1, xb, y, x, y);
  39653. break;
  39654. case 35:
  39655. xa = x + stack.shift();
  39656. ya = y + stack.shift();
  39657. xb = xa + stack.shift();
  39658. yb = ya + stack.shift();
  39659. x = xb + stack.shift();
  39660. y = yb + stack.shift();
  39661. bezierCurveTo(xa, ya, xb, yb, x, y);
  39662. xa = x + stack.shift();
  39663. ya = y + stack.shift();
  39664. xb = xa + stack.shift();
  39665. yb = ya + stack.shift();
  39666. x = xb + stack.shift();
  39667. y = yb + stack.shift();
  39668. bezierCurveTo(xa, ya, xb, yb, x, y);
  39669. stack.pop();
  39670. break;
  39671. case 36:
  39672. xa = x + stack.shift();
  39673. y1 = y + stack.shift();
  39674. xb = xa + stack.shift();
  39675. y2 = y1 + stack.shift();
  39676. x = xb + stack.shift();
  39677. bezierCurveTo(xa, y1, xb, y2, x, y2);
  39678. xa = x + stack.shift();
  39679. xb = xa + stack.shift();
  39680. y3 = y2 + stack.shift();
  39681. x = xb + stack.shift();
  39682. bezierCurveTo(xa, y2, xb, y3, x, y);
  39683. break;
  39684. case 37:
  39685. var x0 = x, y0 = y;
  39686. xa = x + stack.shift();
  39687. ya = y + stack.shift();
  39688. xb = xa + stack.shift();
  39689. yb = ya + stack.shift();
  39690. x = xb + stack.shift();
  39691. y = yb + stack.shift();
  39692. bezierCurveTo(xa, ya, xb, yb, x, y);
  39693. xa = x + stack.shift();
  39694. ya = y + stack.shift();
  39695. xb = xa + stack.shift();
  39696. yb = ya + stack.shift();
  39697. x = xb;
  39698. y = yb;
  39699. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  39700. x += stack.shift();
  39701. } else {
  39702. y += stack.shift();
  39703. }
  39704. bezierCurveTo(xa, ya, xb, yb, x, y);
  39705. break;
  39706. default:
  39707. error('unknown operator: 12 ' + v);
  39708. }
  39709. break;
  39710. case 14:
  39711. if (stack.length >= 4) {
  39712. var achar = stack.pop();
  39713. var bchar = stack.pop();
  39714. y = stack.pop();
  39715. x = stack.pop();
  39716. cmds.push({ cmd: 'save' });
  39717. cmds.push({
  39718. cmd: 'translate',
  39719. args: [
  39720. x,
  39721. y
  39722. ]
  39723. });
  39724. var cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[achar]]));
  39725. compileCharString(font.glyphs[cmap.glyphId], cmds, font);
  39726. cmds.push({ cmd: 'restore' });
  39727. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[bchar]]));
  39728. compileCharString(font.glyphs[cmap.glyphId], cmds, font);
  39729. }
  39730. return;
  39731. case 18:
  39732. stems += stack.length >> 1;
  39733. stackClean = true;
  39734. break;
  39735. case 19:
  39736. stems += stack.length >> 1;
  39737. i += stems + 7 >> 3;
  39738. stackClean = true;
  39739. break;
  39740. case 20:
  39741. stems += stack.length >> 1;
  39742. i += stems + 7 >> 3;
  39743. stackClean = true;
  39744. break;
  39745. case 21:
  39746. y += stack.pop();
  39747. x += stack.pop();
  39748. moveTo(x, y);
  39749. stackClean = true;
  39750. break;
  39751. case 22:
  39752. x += stack.pop();
  39753. moveTo(x, y);
  39754. stackClean = true;
  39755. break;
  39756. case 23:
  39757. stems += stack.length >> 1;
  39758. stackClean = true;
  39759. break;
  39760. case 24:
  39761. while (stack.length > 2) {
  39762. xa = x + stack.shift();
  39763. ya = y + stack.shift();
  39764. xb = xa + stack.shift();
  39765. yb = ya + stack.shift();
  39766. x = xb + stack.shift();
  39767. y = yb + stack.shift();
  39768. bezierCurveTo(xa, ya, xb, yb, x, y);
  39769. }
  39770. x += stack.shift();
  39771. y += stack.shift();
  39772. lineTo(x, y);
  39773. break;
  39774. case 25:
  39775. while (stack.length > 6) {
  39776. x += stack.shift();
  39777. y += stack.shift();
  39778. lineTo(x, y);
  39779. }
  39780. xa = x + stack.shift();
  39781. ya = y + stack.shift();
  39782. xb = xa + stack.shift();
  39783. yb = ya + stack.shift();
  39784. x = xb + stack.shift();
  39785. y = yb + stack.shift();
  39786. bezierCurveTo(xa, ya, xb, yb, x, y);
  39787. break;
  39788. case 26:
  39789. if (stack.length % 2) {
  39790. x += stack.shift();
  39791. }
  39792. while (stack.length > 0) {
  39793. xa = x;
  39794. ya = y + stack.shift();
  39795. xb = xa + stack.shift();
  39796. yb = ya + stack.shift();
  39797. x = xb;
  39798. y = yb + stack.shift();
  39799. bezierCurveTo(xa, ya, xb, yb, x, y);
  39800. }
  39801. break;
  39802. case 27:
  39803. if (stack.length % 2) {
  39804. y += stack.shift();
  39805. }
  39806. while (stack.length > 0) {
  39807. xa = x + stack.shift();
  39808. ya = y;
  39809. xb = xa + stack.shift();
  39810. yb = ya + stack.shift();
  39811. x = xb + stack.shift();
  39812. y = yb;
  39813. bezierCurveTo(xa, ya, xb, yb, x, y);
  39814. }
  39815. break;
  39816. case 28:
  39817. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  39818. i += 2;
  39819. break;
  39820. case 29:
  39821. n = stack.pop() + font.gsubrsBias;
  39822. subrCode = font.gsubrs[n];
  39823. if (subrCode) {
  39824. parse(subrCode);
  39825. }
  39826. break;
  39827. case 30:
  39828. while (stack.length > 0) {
  39829. xa = x;
  39830. ya = y + stack.shift();
  39831. xb = xa + stack.shift();
  39832. yb = ya + stack.shift();
  39833. x = xb + stack.shift();
  39834. y = yb + (stack.length === 1 ? stack.shift() : 0);
  39835. bezierCurveTo(xa, ya, xb, yb, x, y);
  39836. if (stack.length === 0) {
  39837. break;
  39838. }
  39839. xa = x + stack.shift();
  39840. ya = y;
  39841. xb = xa + stack.shift();
  39842. yb = ya + stack.shift();
  39843. y = yb + stack.shift();
  39844. x = xb + (stack.length === 1 ? stack.shift() : 0);
  39845. bezierCurveTo(xa, ya, xb, yb, x, y);
  39846. }
  39847. break;
  39848. case 31:
  39849. while (stack.length > 0) {
  39850. xa = x + stack.shift();
  39851. ya = y;
  39852. xb = xa + stack.shift();
  39853. yb = ya + stack.shift();
  39854. y = yb + stack.shift();
  39855. x = xb + (stack.length === 1 ? stack.shift() : 0);
  39856. bezierCurveTo(xa, ya, xb, yb, x, y);
  39857. if (stack.length === 0) {
  39858. break;
  39859. }
  39860. xa = x;
  39861. ya = y + stack.shift();
  39862. xb = xa + stack.shift();
  39863. yb = ya + stack.shift();
  39864. x = xb + stack.shift();
  39865. y = yb + (stack.length === 1 ? stack.shift() : 0);
  39866. bezierCurveTo(xa, ya, xb, yb, x, y);
  39867. }
  39868. break;
  39869. default:
  39870. if (v < 32) {
  39871. error('unknown operator: ' + v);
  39872. }
  39873. if (v < 247) {
  39874. stack.push(v - 139);
  39875. } else if (v < 251) {
  39876. stack.push((v - 247) * 256 + code[i++] + 108);
  39877. } else if (v < 255) {
  39878. stack.push(-(v - 251) * 256 - code[i++] - 108);
  39879. } else {
  39880. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  39881. i += 4;
  39882. }
  39883. break;
  39884. }
  39885. if (stackClean) {
  39886. stack.length = 0;
  39887. }
  39888. }
  39889. }
  39890. parse(code);
  39891. }
  39892. var noop = '';
  39893. function CompiledFont(fontMatrix) {
  39894. this.compiledGlyphs = Object.create(null);
  39895. this.compiledCharCodeToGlyphId = Object.create(null);
  39896. this.fontMatrix = fontMatrix;
  39897. }
  39898. CompiledFont.prototype = {
  39899. getPathJs: function (unicode) {
  39900. var cmap = lookupCmap(this.cmap, unicode);
  39901. var fn = this.compiledGlyphs[cmap.glyphId];
  39902. if (!fn) {
  39903. fn = this.compileGlyph(this.glyphs[cmap.glyphId]);
  39904. this.compiledGlyphs[cmap.glyphId] = fn;
  39905. }
  39906. if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
  39907. this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId;
  39908. }
  39909. return fn;
  39910. },
  39911. compileGlyph: function (code) {
  39912. if (!code || code.length === 0 || code[0] === 14) {
  39913. return noop;
  39914. }
  39915. var cmds = [];
  39916. cmds.push({ cmd: 'save' });
  39917. cmds.push({
  39918. cmd: 'transform',
  39919. args: this.fontMatrix.slice()
  39920. });
  39921. cmds.push({
  39922. cmd: 'scale',
  39923. args: [
  39924. 'size',
  39925. '-size'
  39926. ]
  39927. });
  39928. this.compileGlyphImpl(code, cmds);
  39929. cmds.push({ cmd: 'restore' });
  39930. return cmds;
  39931. },
  39932. compileGlyphImpl: function () {
  39933. error('Children classes should implement this.');
  39934. },
  39935. hasBuiltPath: function (unicode) {
  39936. var cmap = lookupCmap(this.cmap, unicode);
  39937. return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCode] !== undefined;
  39938. }
  39939. };
  39940. function TrueTypeCompiled(glyphs, cmap, fontMatrix) {
  39941. fontMatrix = fontMatrix || [
  39942. 0.000488,
  39943. 0,
  39944. 0,
  39945. 0.000488,
  39946. 0,
  39947. 0
  39948. ];
  39949. CompiledFont.call(this, fontMatrix);
  39950. this.glyphs = glyphs;
  39951. this.cmap = cmap;
  39952. }
  39953. Util.inherit(TrueTypeCompiled, CompiledFont, {
  39954. compileGlyphImpl: function (code, cmds) {
  39955. compileGlyf(code, cmds, this);
  39956. }
  39957. });
  39958. function Type2Compiled(cffInfo, cmap, fontMatrix, glyphNameMap) {
  39959. fontMatrix = fontMatrix || [
  39960. 0.001,
  39961. 0,
  39962. 0,
  39963. 0.001,
  39964. 0,
  39965. 0
  39966. ];
  39967. CompiledFont.call(this, fontMatrix);
  39968. this.glyphs = cffInfo.glyphs;
  39969. this.gsubrs = cffInfo.gsubrs || [];
  39970. this.subrs = cffInfo.subrs || [];
  39971. this.cmap = cmap;
  39972. this.glyphNameMap = glyphNameMap || getGlyphsUnicode();
  39973. this.gsubrsBias = this.gsubrs.length < 1240 ? 107 : this.gsubrs.length < 33900 ? 1131 : 32768;
  39974. this.subrsBias = this.subrs.length < 1240 ? 107 : this.subrs.length < 33900 ? 1131 : 32768;
  39975. }
  39976. Util.inherit(Type2Compiled, CompiledFont, {
  39977. compileGlyphImpl: function (code, cmds) {
  39978. compileCharString(code, cmds, this);
  39979. }
  39980. });
  39981. return {
  39982. create: function FontRendererFactory_create(font, seacAnalysisEnabled) {
  39983. var data = new Uint8Array(font.data);
  39984. var cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  39985. var numTables = getUshort(data, 4);
  39986. for (var i = 0, p = 12; i < numTables; i++, p += 16) {
  39987. var tag = bytesToString(data.subarray(p, p + 4));
  39988. var offset = getLong(data, p + 8);
  39989. var length = getLong(data, p + 12);
  39990. switch (tag) {
  39991. case 'cmap':
  39992. cmap = parseCmap(data, offset, offset + length);
  39993. break;
  39994. case 'glyf':
  39995. glyf = data.subarray(offset, offset + length);
  39996. break;
  39997. case 'loca':
  39998. loca = data.subarray(offset, offset + length);
  39999. break;
  40000. case 'head':
  40001. unitsPerEm = getUshort(data, offset + 18);
  40002. indexToLocFormat = getUshort(data, offset + 50);
  40003. break;
  40004. case 'CFF ':
  40005. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  40006. break;
  40007. }
  40008. }
  40009. if (glyf) {
  40010. var fontMatrix = !unitsPerEm ? font.fontMatrix : [
  40011. 1 / unitsPerEm,
  40012. 0,
  40013. 0,
  40014. 1 / unitsPerEm,
  40015. 0,
  40016. 0
  40017. ];
  40018. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  40019. }
  40020. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  40021. }
  40022. };
  40023. }();
  40024. exports.FontRendererFactory = FontRendererFactory;
  40025. /***/ }),
  40026. /* 27 */
  40027. /***/ (function(module, exports, __w_pdfjs_require__) {
  40028. "use strict";
  40029. var sharedUtil = __w_pdfjs_require__(0);
  40030. var corePrimitives = __w_pdfjs_require__(1);
  40031. var coreStream = __w_pdfjs_require__(2);
  40032. var coreGlyphList = __w_pdfjs_require__(7);
  40033. var coreFontRenderer = __w_pdfjs_require__(26);
  40034. var coreEncodings = __w_pdfjs_require__(4);
  40035. var coreStandardFonts = __w_pdfjs_require__(16);
  40036. var coreUnicode = __w_pdfjs_require__(17);
  40037. var coreType1Parser = __w_pdfjs_require__(36);
  40038. var coreCFFParser = __w_pdfjs_require__(10);
  40039. var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
  40040. var FontType = sharedUtil.FontType;
  40041. var assert = sharedUtil.assert;
  40042. var bytesToString = sharedUtil.bytesToString;
  40043. var error = sharedUtil.error;
  40044. var info = sharedUtil.info;
  40045. var isArray = sharedUtil.isArray;
  40046. var isInt = sharedUtil.isInt;
  40047. var isNum = sharedUtil.isNum;
  40048. var readUint32 = sharedUtil.readUint32;
  40049. var shadow = sharedUtil.shadow;
  40050. var string32 = sharedUtil.string32;
  40051. var warn = sharedUtil.warn;
  40052. var MissingDataException = sharedUtil.MissingDataException;
  40053. var isSpace = sharedUtil.isSpace;
  40054. var Stream = coreStream.Stream;
  40055. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  40056. var getDingbatsGlyphsUnicode = coreGlyphList.getDingbatsGlyphsUnicode;
  40057. var FontRendererFactory = coreFontRenderer.FontRendererFactory;
  40058. var StandardEncoding = coreEncodings.StandardEncoding;
  40059. var MacRomanEncoding = coreEncodings.MacRomanEncoding;
  40060. var SymbolSetEncoding = coreEncodings.SymbolSetEncoding;
  40061. var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding;
  40062. var getEncoding = coreEncodings.getEncoding;
  40063. var getStdFontMap = coreStandardFonts.getStdFontMap;
  40064. var getNonStdFontMap = coreStandardFonts.getNonStdFontMap;
  40065. var getGlyphMapForStandardFonts = coreStandardFonts.getGlyphMapForStandardFonts;
  40066. var getSupplementalGlyphMapForArialBlack = coreStandardFonts.getSupplementalGlyphMapForArialBlack;
  40067. var getUnicodeRangeFor = coreUnicode.getUnicodeRangeFor;
  40068. var mapSpecialUnicodeValues = coreUnicode.mapSpecialUnicodeValues;
  40069. var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph;
  40070. var Type1Parser = coreType1Parser.Type1Parser;
  40071. var CFFStandardStrings = coreCFFParser.CFFStandardStrings;
  40072. var CFFParser = coreCFFParser.CFFParser;
  40073. var CFFCompiler = coreCFFParser.CFFCompiler;
  40074. var CFF = coreCFFParser.CFF;
  40075. var CFFHeader = coreCFFParser.CFFHeader;
  40076. var CFFTopDict = coreCFFParser.CFFTopDict;
  40077. var CFFPrivateDict = coreCFFParser.CFFPrivateDict;
  40078. var CFFStrings = coreCFFParser.CFFStrings;
  40079. var CFFIndex = coreCFFParser.CFFIndex;
  40080. var CFFCharset = coreCFFParser.CFFCharset;
  40081. var PRIVATE_USE_OFFSET_START = 0xE000;
  40082. var PRIVATE_USE_OFFSET_END = 0xF8FF;
  40083. var SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = false;
  40084. var PDF_GLYPH_SPACE_UNITS = 1000;
  40085. var SEAC_ANALYSIS_ENABLED = false;
  40086. var FontFlags = {
  40087. FixedPitch: 1,
  40088. Serif: 2,
  40089. Symbolic: 4,
  40090. Script: 8,
  40091. Nonsymbolic: 32,
  40092. Italic: 64,
  40093. AllCap: 65536,
  40094. SmallCap: 131072,
  40095. ForceBold: 262144
  40096. };
  40097. var MacStandardGlyphOrdering = [
  40098. '.notdef',
  40099. '.null',
  40100. 'nonmarkingreturn',
  40101. 'space',
  40102. 'exclam',
  40103. 'quotedbl',
  40104. 'numbersign',
  40105. 'dollar',
  40106. 'percent',
  40107. 'ampersand',
  40108. 'quotesingle',
  40109. 'parenleft',
  40110. 'parenright',
  40111. 'asterisk',
  40112. 'plus',
  40113. 'comma',
  40114. 'hyphen',
  40115. 'period',
  40116. 'slash',
  40117. 'zero',
  40118. 'one',
  40119. 'two',
  40120. 'three',
  40121. 'four',
  40122. 'five',
  40123. 'six',
  40124. 'seven',
  40125. 'eight',
  40126. 'nine',
  40127. 'colon',
  40128. 'semicolon',
  40129. 'less',
  40130. 'equal',
  40131. 'greater',
  40132. 'question',
  40133. 'at',
  40134. 'A',
  40135. 'B',
  40136. 'C',
  40137. 'D',
  40138. 'E',
  40139. 'F',
  40140. 'G',
  40141. 'H',
  40142. 'I',
  40143. 'J',
  40144. 'K',
  40145. 'L',
  40146. 'M',
  40147. 'N',
  40148. 'O',
  40149. 'P',
  40150. 'Q',
  40151. 'R',
  40152. 'S',
  40153. 'T',
  40154. 'U',
  40155. 'V',
  40156. 'W',
  40157. 'X',
  40158. 'Y',
  40159. 'Z',
  40160. 'bracketleft',
  40161. 'backslash',
  40162. 'bracketright',
  40163. 'asciicircum',
  40164. 'underscore',
  40165. 'grave',
  40166. 'a',
  40167. 'b',
  40168. 'c',
  40169. 'd',
  40170. 'e',
  40171. 'f',
  40172. 'g',
  40173. 'h',
  40174. 'i',
  40175. 'j',
  40176. 'k',
  40177. 'l',
  40178. 'm',
  40179. 'n',
  40180. 'o',
  40181. 'p',
  40182. 'q',
  40183. 'r',
  40184. 's',
  40185. 't',
  40186. 'u',
  40187. 'v',
  40188. 'w',
  40189. 'x',
  40190. 'y',
  40191. 'z',
  40192. 'braceleft',
  40193. 'bar',
  40194. 'braceright',
  40195. 'asciitilde',
  40196. 'Adieresis',
  40197. 'Aring',
  40198. 'Ccedilla',
  40199. 'Eacute',
  40200. 'Ntilde',
  40201. 'Odieresis',
  40202. 'Udieresis',
  40203. 'aacute',
  40204. 'agrave',
  40205. 'acircumflex',
  40206. 'adieresis',
  40207. 'atilde',
  40208. 'aring',
  40209. 'ccedilla',
  40210. 'eacute',
  40211. 'egrave',
  40212. 'ecircumflex',
  40213. 'edieresis',
  40214. 'iacute',
  40215. 'igrave',
  40216. 'icircumflex',
  40217. 'idieresis',
  40218. 'ntilde',
  40219. 'oacute',
  40220. 'ograve',
  40221. 'ocircumflex',
  40222. 'odieresis',
  40223. 'otilde',
  40224. 'uacute',
  40225. 'ugrave',
  40226. 'ucircumflex',
  40227. 'udieresis',
  40228. 'dagger',
  40229. 'degree',
  40230. 'cent',
  40231. 'sterling',
  40232. 'section',
  40233. 'bullet',
  40234. 'paragraph',
  40235. 'germandbls',
  40236. 'registered',
  40237. 'copyright',
  40238. 'trademark',
  40239. 'acute',
  40240. 'dieresis',
  40241. 'notequal',
  40242. 'AE',
  40243. 'Oslash',
  40244. 'infinity',
  40245. 'plusminus',
  40246. 'lessequal',
  40247. 'greaterequal',
  40248. 'yen',
  40249. 'mu',
  40250. 'partialdiff',
  40251. 'summation',
  40252. 'product',
  40253. 'pi',
  40254. 'integral',
  40255. 'ordfeminine',
  40256. 'ordmasculine',
  40257. 'Omega',
  40258. 'ae',
  40259. 'oslash',
  40260. 'questiondown',
  40261. 'exclamdown',
  40262. 'logicalnot',
  40263. 'radical',
  40264. 'florin',
  40265. 'approxequal',
  40266. 'Delta',
  40267. 'guillemotleft',
  40268. 'guillemotright',
  40269. 'ellipsis',
  40270. 'nonbreakingspace',
  40271. 'Agrave',
  40272. 'Atilde',
  40273. 'Otilde',
  40274. 'OE',
  40275. 'oe',
  40276. 'endash',
  40277. 'emdash',
  40278. 'quotedblleft',
  40279. 'quotedblright',
  40280. 'quoteleft',
  40281. 'quoteright',
  40282. 'divide',
  40283. 'lozenge',
  40284. 'ydieresis',
  40285. 'Ydieresis',
  40286. 'fraction',
  40287. 'currency',
  40288. 'guilsinglleft',
  40289. 'guilsinglright',
  40290. 'fi',
  40291. 'fl',
  40292. 'daggerdbl',
  40293. 'periodcentered',
  40294. 'quotesinglbase',
  40295. 'quotedblbase',
  40296. 'perthousand',
  40297. 'Acircumflex',
  40298. 'Ecircumflex',
  40299. 'Aacute',
  40300. 'Edieresis',
  40301. 'Egrave',
  40302. 'Iacute',
  40303. 'Icircumflex',
  40304. 'Idieresis',
  40305. 'Igrave',
  40306. 'Oacute',
  40307. 'Ocircumflex',
  40308. 'apple',
  40309. 'Ograve',
  40310. 'Uacute',
  40311. 'Ucircumflex',
  40312. 'Ugrave',
  40313. 'dotlessi',
  40314. 'circumflex',
  40315. 'tilde',
  40316. 'macron',
  40317. 'breve',
  40318. 'dotaccent',
  40319. 'ring',
  40320. 'cedilla',
  40321. 'hungarumlaut',
  40322. 'ogonek',
  40323. 'caron',
  40324. 'Lslash',
  40325. 'lslash',
  40326. 'Scaron',
  40327. 'scaron',
  40328. 'Zcaron',
  40329. 'zcaron',
  40330. 'brokenbar',
  40331. 'Eth',
  40332. 'eth',
  40333. 'Yacute',
  40334. 'yacute',
  40335. 'Thorn',
  40336. 'thorn',
  40337. 'minus',
  40338. 'multiply',
  40339. 'onesuperior',
  40340. 'twosuperior',
  40341. 'threesuperior',
  40342. 'onehalf',
  40343. 'onequarter',
  40344. 'threequarters',
  40345. 'franc',
  40346. 'Gbreve',
  40347. 'gbreve',
  40348. 'Idotaccent',
  40349. 'Scedilla',
  40350. 'scedilla',
  40351. 'Cacute',
  40352. 'cacute',
  40353. 'Ccaron',
  40354. 'ccaron',
  40355. 'dcroat'
  40356. ];
  40357. function adjustWidths(properties) {
  40358. if (!properties.fontMatrix) {
  40359. return;
  40360. }
  40361. if (properties.fontMatrix[0] === FONT_IDENTITY_MATRIX[0]) {
  40362. return;
  40363. }
  40364. var scale = 0.001 / properties.fontMatrix[0];
  40365. var glyphsWidths = properties.widths;
  40366. for (var glyph in glyphsWidths) {
  40367. glyphsWidths[glyph] *= scale;
  40368. }
  40369. properties.defaultWidth *= scale;
  40370. }
  40371. function adjustToUnicode(properties, builtInEncoding) {
  40372. if (properties.hasIncludedToUnicodeMap) {
  40373. return;
  40374. }
  40375. if (properties.hasEncoding) {
  40376. return;
  40377. }
  40378. if (builtInEncoding === properties.defaultEncoding) {
  40379. return;
  40380. }
  40381. if (properties.toUnicode instanceof IdentityToUnicodeMap) {
  40382. return;
  40383. }
  40384. var toUnicode = [], glyphsUnicodeMap = getGlyphsUnicode();
  40385. for (var charCode in builtInEncoding) {
  40386. var glyphName = builtInEncoding[charCode];
  40387. var unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  40388. if (unicode !== -1) {
  40389. toUnicode[charCode] = String.fromCharCode(unicode);
  40390. }
  40391. }
  40392. properties.toUnicode.amend(toUnicode);
  40393. }
  40394. function getFontType(type, subtype) {
  40395. switch (type) {
  40396. case 'Type1':
  40397. return subtype === 'Type1C' ? FontType.TYPE1C : FontType.TYPE1;
  40398. case 'CIDFontType0':
  40399. return subtype === 'CIDFontType0C' ? FontType.CIDFONTTYPE0C : FontType.CIDFONTTYPE0;
  40400. case 'OpenType':
  40401. return FontType.OPENTYPE;
  40402. case 'TrueType':
  40403. return FontType.TRUETYPE;
  40404. case 'CIDFontType2':
  40405. return FontType.CIDFONTTYPE2;
  40406. case 'MMType1':
  40407. return FontType.MMTYPE1;
  40408. case 'Type0':
  40409. return FontType.TYPE0;
  40410. default:
  40411. return FontType.UNKNOWN;
  40412. }
  40413. }
  40414. function recoverGlyphName(name, glyphsUnicodeMap) {
  40415. if (glyphsUnicodeMap[name] !== undefined) {
  40416. return name;
  40417. }
  40418. var unicode = getUnicodeForGlyph(name, glyphsUnicodeMap);
  40419. if (unicode !== -1) {
  40420. for (var key in glyphsUnicodeMap) {
  40421. if (glyphsUnicodeMap[key] === unicode) {
  40422. return key;
  40423. }
  40424. }
  40425. }
  40426. info('Unable to recover a standard glyph name for: ' + name);
  40427. return name;
  40428. }
  40429. var Glyph = function GlyphClosure() {
  40430. function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  40431. this.fontChar = fontChar;
  40432. this.unicode = unicode;
  40433. this.accent = accent;
  40434. this.width = width;
  40435. this.vmetric = vmetric;
  40436. this.operatorListId = operatorListId;
  40437. this.isSpace = isSpace;
  40438. this.isInFont = isInFont;
  40439. }
  40440. Glyph.prototype.matchesForCache = function (fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  40441. 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;
  40442. };
  40443. return Glyph;
  40444. }();
  40445. var ToUnicodeMap = function ToUnicodeMapClosure() {
  40446. function ToUnicodeMap(cmap) {
  40447. this._map = cmap;
  40448. }
  40449. ToUnicodeMap.prototype = {
  40450. get length() {
  40451. return this._map.length;
  40452. },
  40453. forEach: function (callback) {
  40454. for (var charCode in this._map) {
  40455. callback(charCode, this._map[charCode].charCodeAt(0));
  40456. }
  40457. },
  40458. has: function (i) {
  40459. return this._map[i] !== undefined;
  40460. },
  40461. get: function (i) {
  40462. return this._map[i];
  40463. },
  40464. charCodeOf: function (v) {
  40465. return this._map.indexOf(v);
  40466. },
  40467. amend: function (map) {
  40468. for (var charCode in map) {
  40469. this._map[charCode] = map[charCode];
  40470. }
  40471. }
  40472. };
  40473. return ToUnicodeMap;
  40474. }();
  40475. var IdentityToUnicodeMap = function IdentityToUnicodeMapClosure() {
  40476. function IdentityToUnicodeMap(firstChar, lastChar) {
  40477. this.firstChar = firstChar;
  40478. this.lastChar = lastChar;
  40479. }
  40480. IdentityToUnicodeMap.prototype = {
  40481. get length() {
  40482. return this.lastChar + 1 - this.firstChar;
  40483. },
  40484. forEach: function (callback) {
  40485. for (var i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  40486. callback(i, i);
  40487. }
  40488. },
  40489. has: function (i) {
  40490. return this.firstChar <= i && i <= this.lastChar;
  40491. },
  40492. get: function (i) {
  40493. if (this.firstChar <= i && i <= this.lastChar) {
  40494. return String.fromCharCode(i);
  40495. }
  40496. return undefined;
  40497. },
  40498. charCodeOf: function (v) {
  40499. return isInt(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  40500. },
  40501. amend: function (map) {
  40502. error('Should not call amend()');
  40503. }
  40504. };
  40505. return IdentityToUnicodeMap;
  40506. }();
  40507. var OpenTypeFileBuilder = function OpenTypeFileBuilderClosure() {
  40508. function writeInt16(dest, offset, num) {
  40509. dest[offset] = num >> 8 & 0xFF;
  40510. dest[offset + 1] = num & 0xFF;
  40511. }
  40512. function writeInt32(dest, offset, num) {
  40513. dest[offset] = num >> 24 & 0xFF;
  40514. dest[offset + 1] = num >> 16 & 0xFF;
  40515. dest[offset + 2] = num >> 8 & 0xFF;
  40516. dest[offset + 3] = num & 0xFF;
  40517. }
  40518. function writeData(dest, offset, data) {
  40519. var i, ii;
  40520. if (data instanceof Uint8Array) {
  40521. dest.set(data, offset);
  40522. } else if (typeof data === 'string') {
  40523. for (i = 0, ii = data.length; i < ii; i++) {
  40524. dest[offset++] = data.charCodeAt(i) & 0xFF;
  40525. }
  40526. } else {
  40527. for (i = 0, ii = data.length; i < ii; i++) {
  40528. dest[offset++] = data[i] & 0xFF;
  40529. }
  40530. }
  40531. }
  40532. function OpenTypeFileBuilder(sfnt) {
  40533. this.sfnt = sfnt;
  40534. this.tables = Object.create(null);
  40535. }
  40536. OpenTypeFileBuilder.getSearchParams = function OpenTypeFileBuilder_getSearchParams(entriesCount, entrySize) {
  40537. var maxPower2 = 1, log2 = 0;
  40538. while ((maxPower2 ^ entriesCount) > maxPower2) {
  40539. maxPower2 <<= 1;
  40540. log2++;
  40541. }
  40542. var searchRange = maxPower2 * entrySize;
  40543. return {
  40544. range: searchRange,
  40545. entry: log2,
  40546. rangeShift: entrySize * entriesCount - searchRange
  40547. };
  40548. };
  40549. var OTF_HEADER_SIZE = 12;
  40550. var OTF_TABLE_ENTRY_SIZE = 16;
  40551. OpenTypeFileBuilder.prototype = {
  40552. toArray: function OpenTypeFileBuilder_toArray() {
  40553. var sfnt = this.sfnt;
  40554. var tables = this.tables;
  40555. var tablesNames = Object.keys(tables);
  40556. tablesNames.sort();
  40557. var numTables = tablesNames.length;
  40558. var i, j, jj, table, tableName;
  40559. var offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  40560. var tableOffsets = [offset];
  40561. for (i = 0; i < numTables; i++) {
  40562. table = tables[tablesNames[i]];
  40563. var paddedLength = (table.length + 3 & ~3) >>> 0;
  40564. offset += paddedLength;
  40565. tableOffsets.push(offset);
  40566. }
  40567. var file = new Uint8Array(offset);
  40568. for (i = 0; i < numTables; i++) {
  40569. table = tables[tablesNames[i]];
  40570. writeData(file, tableOffsets[i], table);
  40571. }
  40572. if (sfnt === 'true') {
  40573. sfnt = string32(0x00010000);
  40574. }
  40575. file[0] = sfnt.charCodeAt(0) & 0xFF;
  40576. file[1] = sfnt.charCodeAt(1) & 0xFF;
  40577. file[2] = sfnt.charCodeAt(2) & 0xFF;
  40578. file[3] = sfnt.charCodeAt(3) & 0xFF;
  40579. writeInt16(file, 4, numTables);
  40580. var searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  40581. writeInt16(file, 6, searchParams.range);
  40582. writeInt16(file, 8, searchParams.entry);
  40583. writeInt16(file, 10, searchParams.rangeShift);
  40584. offset = OTF_HEADER_SIZE;
  40585. for (i = 0; i < numTables; i++) {
  40586. tableName = tablesNames[i];
  40587. file[offset] = tableName.charCodeAt(0) & 0xFF;
  40588. file[offset + 1] = tableName.charCodeAt(1) & 0xFF;
  40589. file[offset + 2] = tableName.charCodeAt(2) & 0xFF;
  40590. file[offset + 3] = tableName.charCodeAt(3) & 0xFF;
  40591. var checksum = 0;
  40592. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  40593. var quad = readUint32(file, j);
  40594. checksum = checksum + quad >>> 0;
  40595. }
  40596. writeInt32(file, offset + 4, checksum);
  40597. writeInt32(file, offset + 8, tableOffsets[i]);
  40598. writeInt32(file, offset + 12, tables[tableName].length);
  40599. offset += OTF_TABLE_ENTRY_SIZE;
  40600. }
  40601. return file;
  40602. },
  40603. addTable: function OpenTypeFileBuilder_addTable(tag, data) {
  40604. if (tag in this.tables) {
  40605. throw new Error('Table ' + tag + ' already exists');
  40606. }
  40607. this.tables[tag] = data;
  40608. }
  40609. };
  40610. return OpenTypeFileBuilder;
  40611. }();
  40612. var ProblematicCharRanges = new Int32Array([
  40613. 0x0000,
  40614. 0x0020,
  40615. 0x007F,
  40616. 0x00A1,
  40617. 0x00AD,
  40618. 0x00AE,
  40619. 0x0600,
  40620. 0x0780,
  40621. 0x08A0,
  40622. 0x10A0,
  40623. 0x1780,
  40624. 0x1800,
  40625. 0x1C00,
  40626. 0x1C50,
  40627. 0x2000,
  40628. 0x2010,
  40629. 0x2011,
  40630. 0x2012,
  40631. 0x2028,
  40632. 0x2030,
  40633. 0x205F,
  40634. 0x2070,
  40635. 0x25CC,
  40636. 0x25CD,
  40637. 0x3000,
  40638. 0x3001,
  40639. 0xAA60,
  40640. 0xAA80,
  40641. 0xFFF0,
  40642. 0x10000
  40643. ]);
  40644. var Font = function FontClosure() {
  40645. function Font(name, file, properties) {
  40646. var charCode, glyphName, unicode;
  40647. this.name = name;
  40648. this.loadedName = properties.loadedName;
  40649. this.isType3Font = properties.isType3Font;
  40650. this.sizes = [];
  40651. this.missingFile = false;
  40652. this.glyphCache = Object.create(null);
  40653. this.isSerifFont = !!(properties.flags & FontFlags.Serif);
  40654. this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  40655. this.isMonospace = !!(properties.flags & FontFlags.FixedPitch);
  40656. var type = properties.type;
  40657. var subtype = properties.subtype;
  40658. this.type = type;
  40659. this.fallbackName = this.isMonospace ? 'monospace' : this.isSerifFont ? 'serif' : 'sans-serif';
  40660. this.differences = properties.differences;
  40661. this.widths = properties.widths;
  40662. this.defaultWidth = properties.defaultWidth;
  40663. this.composite = properties.composite;
  40664. this.wideChars = properties.wideChars;
  40665. this.cMap = properties.cMap;
  40666. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  40667. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  40668. this.fontMatrix = properties.fontMatrix;
  40669. this.bbox = properties.bbox;
  40670. this.toUnicode = properties.toUnicode;
  40671. this.toFontChar = [];
  40672. if (properties.type === 'Type3') {
  40673. for (charCode = 0; charCode < 256; charCode++) {
  40674. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  40675. }
  40676. this.fontType = FontType.TYPE3;
  40677. return;
  40678. }
  40679. this.cidEncoding = properties.cidEncoding;
  40680. this.vertical = properties.vertical;
  40681. if (this.vertical) {
  40682. this.vmetrics = properties.vmetrics;
  40683. this.defaultVMetrics = properties.defaultVMetrics;
  40684. }
  40685. var glyphsUnicodeMap;
  40686. if (!file || file.isEmpty) {
  40687. if (file) {
  40688. warn('Font file is empty in "' + name + '" (' + this.loadedName + ')');
  40689. }
  40690. this.missingFile = true;
  40691. var fontName = name.replace(/[,_]/g, '-');
  40692. var stdFontMap = getStdFontMap(), nonStdFontMap = getNonStdFontMap();
  40693. var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  40694. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  40695. this.bold = fontName.search(/bold/gi) !== -1;
  40696. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  40697. this.black = name.search(/Black/g) !== -1;
  40698. this.remeasure = Object.keys(this.widths).length > 0;
  40699. if (isStandardFont && type === 'CIDFontType2' && properties.cidEncoding.indexOf('Identity-') === 0) {
  40700. var GlyphMapForStandardFonts = getGlyphMapForStandardFonts();
  40701. var map = [];
  40702. for (charCode in GlyphMapForStandardFonts) {
  40703. map[+charCode] = GlyphMapForStandardFonts[charCode];
  40704. }
  40705. if (/Arial-?Black/i.test(name)) {
  40706. var SupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack();
  40707. for (charCode in SupplementalGlyphMapForArialBlack) {
  40708. map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
  40709. }
  40710. }
  40711. var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
  40712. if (!isIdentityUnicode) {
  40713. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  40714. map[+charCode] = unicodeCharCode;
  40715. });
  40716. }
  40717. this.toFontChar = map;
  40718. this.toUnicode = new ToUnicodeMap(map);
  40719. } else if (/Symbol/i.test(fontName)) {
  40720. this.toFontChar = buildToFontChar(SymbolSetEncoding, getGlyphsUnicode(), properties.differences);
  40721. } else if (/Dingbats/i.test(fontName)) {
  40722. if (/Wingdings/i.test(name)) {
  40723. warn('Non-embedded Wingdings font, falling back to ZapfDingbats.');
  40724. }
  40725. this.toFontChar = buildToFontChar(ZapfDingbatsEncoding, getDingbatsGlyphsUnicode(), properties.differences);
  40726. } else if (isStandardFont) {
  40727. this.toFontChar = buildToFontChar(properties.defaultEncoding, getGlyphsUnicode(), properties.differences);
  40728. } else {
  40729. glyphsUnicodeMap = getGlyphsUnicode();
  40730. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  40731. if (!this.composite) {
  40732. glyphName = properties.differences[charCode] || properties.defaultEncoding[charCode];
  40733. unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  40734. if (unicode !== -1) {
  40735. unicodeCharCode = unicode;
  40736. }
  40737. }
  40738. this.toFontChar[charCode] = unicodeCharCode;
  40739. }.bind(this));
  40740. }
  40741. this.loadedName = fontName.split('-')[0];
  40742. this.loading = false;
  40743. this.fontType = getFontType(type, subtype);
  40744. return;
  40745. }
  40746. if (subtype === 'Type1C') {
  40747. if (type !== 'Type1' && type !== 'MMType1') {
  40748. if (isTrueTypeFile(file)) {
  40749. subtype = 'TrueType';
  40750. } else {
  40751. type = 'Type1';
  40752. }
  40753. } else if (isOpenTypeFile(file)) {
  40754. type = subtype = 'OpenType';
  40755. }
  40756. }
  40757. if (subtype === 'CIDFontType0C' && type !== 'CIDFontType0') {
  40758. type = 'CIDFontType0';
  40759. }
  40760. if (subtype === 'OpenType') {
  40761. type = 'OpenType';
  40762. }
  40763. if (type === 'CIDFontType0') {
  40764. if (isType1File(file)) {
  40765. subtype = 'CIDFontType0';
  40766. } else if (isOpenTypeFile(file)) {
  40767. type = subtype = 'OpenType';
  40768. } else {
  40769. subtype = 'CIDFontType0C';
  40770. }
  40771. }
  40772. var data;
  40773. switch (type) {
  40774. case 'MMType1':
  40775. info('MMType1 font (' + name + '), falling back to Type1.');
  40776. case 'Type1':
  40777. case 'CIDFontType0':
  40778. this.mimetype = 'font/opentype';
  40779. var cff = subtype === 'Type1C' || subtype === 'CIDFontType0C' ? new CFFFont(file, properties) : new Type1Font(name, file, properties);
  40780. adjustWidths(properties);
  40781. data = this.convert(name, cff, properties);
  40782. break;
  40783. case 'OpenType':
  40784. case 'TrueType':
  40785. case 'CIDFontType2':
  40786. this.mimetype = 'font/opentype';
  40787. data = this.checkAndRepair(name, file, properties);
  40788. if (this.isOpenType) {
  40789. adjustWidths(properties);
  40790. type = 'OpenType';
  40791. }
  40792. break;
  40793. default:
  40794. error('Font ' + type + ' is not supported');
  40795. break;
  40796. }
  40797. this.data = data;
  40798. this.fontType = getFontType(type, subtype);
  40799. this.fontMatrix = properties.fontMatrix;
  40800. this.widths = properties.widths;
  40801. this.defaultWidth = properties.defaultWidth;
  40802. this.toUnicode = properties.toUnicode;
  40803. this.encoding = properties.baseEncoding;
  40804. this.seacMap = properties.seacMap;
  40805. this.loading = true;
  40806. }
  40807. Font.getFontID = function () {
  40808. var ID = 1;
  40809. return function Font_getFontID() {
  40810. return String(ID++);
  40811. };
  40812. }();
  40813. function int16(b0, b1) {
  40814. return (b0 << 8) + b1;
  40815. }
  40816. function signedInt16(b0, b1) {
  40817. var value = (b0 << 8) + b1;
  40818. return value & 1 << 15 ? value - 0x10000 : value;
  40819. }
  40820. function int32(b0, b1, b2, b3) {
  40821. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  40822. }
  40823. function string16(value) {
  40824. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  40825. }
  40826. function safeString16(value) {
  40827. value = value > 0x7FFF ? 0x7FFF : value < -0x8000 ? -0x8000 : value;
  40828. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  40829. }
  40830. function isTrueTypeFile(file) {
  40831. var header = file.peekBytes(4);
  40832. return readUint32(header, 0) === 0x00010000;
  40833. }
  40834. function isOpenTypeFile(file) {
  40835. var header = file.peekBytes(4);
  40836. return bytesToString(header) === 'OTTO';
  40837. }
  40838. function isType1File(file) {
  40839. var header = file.peekBytes(2);
  40840. if (header[0] === 0x25 && header[1] === 0x21) {
  40841. return true;
  40842. }
  40843. if (header[0] === 0x80 && header[1] === 0x01) {
  40844. return true;
  40845. }
  40846. return false;
  40847. }
  40848. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  40849. var toFontChar = [], unicode;
  40850. for (var i = 0, ii = encoding.length; i < ii; i++) {
  40851. unicode = getUnicodeForGlyph(encoding[i], glyphsUnicodeMap);
  40852. if (unicode !== -1) {
  40853. toFontChar[i] = unicode;
  40854. }
  40855. }
  40856. for (var charCode in differences) {
  40857. unicode = getUnicodeForGlyph(differences[charCode], glyphsUnicodeMap);
  40858. if (unicode !== -1) {
  40859. toFontChar[+charCode] = unicode;
  40860. }
  40861. }
  40862. return toFontChar;
  40863. }
  40864. function isProblematicUnicodeLocation(code) {
  40865. var i = 0, j = ProblematicCharRanges.length - 1;
  40866. while (i < j) {
  40867. var c = i + j + 1 >> 1;
  40868. if (code < ProblematicCharRanges[c]) {
  40869. j = c - 1;
  40870. } else {
  40871. i = c;
  40872. }
  40873. }
  40874. return !(i & 1);
  40875. }
  40876. function adjustMapping(charCodeToGlyphId, properties) {
  40877. var toUnicode = properties.toUnicode;
  40878. var isSymbolic = !!(properties.flags & FontFlags.Symbolic);
  40879. var isIdentityUnicode = properties.toUnicode instanceof IdentityToUnicodeMap;
  40880. var newMap = Object.create(null);
  40881. var toFontChar = [];
  40882. var usedFontCharCodes = [];
  40883. var nextAvailableFontCharCode = PRIVATE_USE_OFFSET_START;
  40884. for (var originalCharCode in charCodeToGlyphId) {
  40885. originalCharCode |= 0;
  40886. var glyphId = charCodeToGlyphId[originalCharCode];
  40887. var fontCharCode = originalCharCode;
  40888. var hasUnicodeValue = false;
  40889. if (!isIdentityUnicode && toUnicode.has(originalCharCode)) {
  40890. hasUnicodeValue = true;
  40891. var unicode = toUnicode.get(fontCharCode);
  40892. if (unicode.length === 1) {
  40893. fontCharCode = unicode.charCodeAt(0);
  40894. }
  40895. }
  40896. if ((usedFontCharCodes[fontCharCode] !== undefined || isProblematicUnicodeLocation(fontCharCode) || isSymbolic && !hasUnicodeValue) && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END) {
  40897. do {
  40898. fontCharCode = nextAvailableFontCharCode++;
  40899. if (SKIP_PRIVATE_USE_RANGE_F000_TO_F01F && fontCharCode === 0xF000) {
  40900. fontCharCode = 0xF020;
  40901. nextAvailableFontCharCode = fontCharCode + 1;
  40902. }
  40903. } while (usedFontCharCodes[fontCharCode] !== undefined && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END);
  40904. }
  40905. newMap[fontCharCode] = glyphId;
  40906. toFontChar[originalCharCode] = fontCharCode;
  40907. usedFontCharCodes[fontCharCode] = true;
  40908. }
  40909. return {
  40910. toFontChar: toFontChar,
  40911. charCodeToGlyphId: newMap,
  40912. nextAvailableFontCharCode: nextAvailableFontCharCode
  40913. };
  40914. }
  40915. function getRanges(glyphs, numGlyphs) {
  40916. var codes = [];
  40917. for (var charCode in glyphs) {
  40918. if (glyphs[charCode] >= numGlyphs) {
  40919. continue;
  40920. }
  40921. codes.push({
  40922. fontCharCode: charCode | 0,
  40923. glyphId: glyphs[charCode]
  40924. });
  40925. }
  40926. codes.sort(function fontGetRangesSort(a, b) {
  40927. return a.fontCharCode - b.fontCharCode;
  40928. });
  40929. var ranges = [];
  40930. var length = codes.length;
  40931. for (var n = 0; n < length;) {
  40932. var start = codes[n].fontCharCode;
  40933. var codeIndices = [codes[n].glyphId];
  40934. ++n;
  40935. var end = start;
  40936. while (n < length && end + 1 === codes[n].fontCharCode) {
  40937. codeIndices.push(codes[n].glyphId);
  40938. ++end;
  40939. ++n;
  40940. if (end === 0xFFFF) {
  40941. break;
  40942. }
  40943. }
  40944. ranges.push([
  40945. start,
  40946. end,
  40947. codeIndices
  40948. ]);
  40949. }
  40950. return ranges;
  40951. }
  40952. function createCmapTable(glyphs, numGlyphs) {
  40953. var ranges = getRanges(glyphs, numGlyphs);
  40954. var numTables = ranges[ranges.length - 1][1] > 0xFFFF ? 2 : 1;
  40955. var cmap = '\x00\x00' + string16(numTables) + '\x00\x03' + '\x00\x01' + string32(4 + numTables * 8);
  40956. var i, ii, j, jj;
  40957. for (i = ranges.length - 1; i >= 0; --i) {
  40958. if (ranges[i][0] <= 0xFFFF) {
  40959. break;
  40960. }
  40961. }
  40962. var bmpLength = i + 1;
  40963. if (ranges[i][0] < 0xFFFF && ranges[i][1] === 0xFFFF) {
  40964. ranges[i][1] = 0xFFFE;
  40965. }
  40966. var trailingRangesCount = ranges[i][1] < 0xFFFF ? 1 : 0;
  40967. var segCount = bmpLength + trailingRangesCount;
  40968. var searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2);
  40969. var startCount = '';
  40970. var endCount = '';
  40971. var idDeltas = '';
  40972. var idRangeOffsets = '';
  40973. var glyphsIds = '';
  40974. var bias = 0;
  40975. var range, start, end, codes;
  40976. for (i = 0, ii = bmpLength; i < ii; i++) {
  40977. range = ranges[i];
  40978. start = range[0];
  40979. end = range[1];
  40980. startCount += string16(start);
  40981. endCount += string16(end);
  40982. codes = range[2];
  40983. var contiguous = true;
  40984. for (j = 1, jj = codes.length; j < jj; ++j) {
  40985. if (codes[j] !== codes[j - 1] + 1) {
  40986. contiguous = false;
  40987. break;
  40988. }
  40989. }
  40990. if (!contiguous) {
  40991. var offset = (segCount - i) * 2 + bias * 2;
  40992. bias += end - start + 1;
  40993. idDeltas += string16(0);
  40994. idRangeOffsets += string16(offset);
  40995. for (j = 0, jj = codes.length; j < jj; ++j) {
  40996. glyphsIds += string16(codes[j]);
  40997. }
  40998. } else {
  40999. var startCode = codes[0];
  41000. idDeltas += string16(startCode - start & 0xFFFF);
  41001. idRangeOffsets += string16(0);
  41002. }
  41003. }
  41004. if (trailingRangesCount > 0) {
  41005. endCount += '\xFF\xFF';
  41006. startCount += '\xFF\xFF';
  41007. idDeltas += '\x00\x01';
  41008. idRangeOffsets += '\x00\x00';
  41009. }
  41010. var format314 = '\x00\x00' + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + '\x00\x00' + startCount + idDeltas + idRangeOffsets + glyphsIds;
  41011. var format31012 = '';
  41012. var header31012 = '';
  41013. if (numTables > 1) {
  41014. cmap += '\x00\x03' + '\x00\x0A' + string32(4 + numTables * 8 + 4 + format314.length);
  41015. format31012 = '';
  41016. for (i = 0, ii = ranges.length; i < ii; i++) {
  41017. range = ranges[i];
  41018. start = range[0];
  41019. codes = range[2];
  41020. var code = codes[0];
  41021. for (j = 1, jj = codes.length; j < jj; ++j) {
  41022. if (codes[j] !== codes[j - 1] + 1) {
  41023. end = range[0] + j - 1;
  41024. format31012 += string32(start) + string32(end) + string32(code);
  41025. start = end + 1;
  41026. code = codes[j];
  41027. }
  41028. }
  41029. format31012 += string32(start) + string32(range[1]) + string32(code);
  41030. }
  41031. header31012 = '\x00\x0C' + '\x00\x00' + string32(format31012.length + 16) + '\x00\x00\x00\x00' + string32(format31012.length / 12);
  41032. }
  41033. return cmap + '\x00\x04' + string16(format314.length + 4) + format314 + header31012 + format31012;
  41034. }
  41035. function validateOS2Table(os2) {
  41036. var stream = new Stream(os2.data);
  41037. var version = stream.getUint16();
  41038. stream.getBytes(60);
  41039. var selection = stream.getUint16();
  41040. if (version < 4 && selection & 0x0300) {
  41041. return false;
  41042. }
  41043. var firstChar = stream.getUint16();
  41044. var lastChar = stream.getUint16();
  41045. if (firstChar > lastChar) {
  41046. return false;
  41047. }
  41048. stream.getBytes(6);
  41049. var usWinAscent = stream.getUint16();
  41050. if (usWinAscent === 0) {
  41051. return false;
  41052. }
  41053. os2.data[8] = os2.data[9] = 0;
  41054. return true;
  41055. }
  41056. function createOS2Table(properties, charstrings, override) {
  41057. override = override || {
  41058. unitsPerEm: 0,
  41059. yMax: 0,
  41060. yMin: 0,
  41061. ascent: 0,
  41062. descent: 0
  41063. };
  41064. var ulUnicodeRange1 = 0;
  41065. var ulUnicodeRange2 = 0;
  41066. var ulUnicodeRange3 = 0;
  41067. var ulUnicodeRange4 = 0;
  41068. var firstCharIndex = null;
  41069. var lastCharIndex = 0;
  41070. if (charstrings) {
  41071. for (var code in charstrings) {
  41072. code |= 0;
  41073. if (firstCharIndex > code || !firstCharIndex) {
  41074. firstCharIndex = code;
  41075. }
  41076. if (lastCharIndex < code) {
  41077. lastCharIndex = code;
  41078. }
  41079. var position = getUnicodeRangeFor(code);
  41080. if (position < 32) {
  41081. ulUnicodeRange1 |= 1 << position;
  41082. } else if (position < 64) {
  41083. ulUnicodeRange2 |= 1 << position - 32;
  41084. } else if (position < 96) {
  41085. ulUnicodeRange3 |= 1 << position - 64;
  41086. } else if (position < 123) {
  41087. ulUnicodeRange4 |= 1 << position - 96;
  41088. } else {
  41089. error('Unicode ranges Bits > 123 are reserved for internal usage');
  41090. }
  41091. }
  41092. } else {
  41093. firstCharIndex = 0;
  41094. lastCharIndex = 255;
  41095. }
  41096. var bbox = properties.bbox || [
  41097. 0,
  41098. 0,
  41099. 0,
  41100. 0
  41101. ];
  41102. var unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0];
  41103. var scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  41104. var typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  41105. var typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  41106. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  41107. typoDescent = -typoDescent;
  41108. }
  41109. var winAscent = override.yMax || typoAscent;
  41110. var winDescent = -override.yMin || -typoDescent;
  41111. 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';
  41112. }
  41113. function createPostTable(properties) {
  41114. var angle = Math.floor(properties.italicAngle * Math.pow(2, 16));
  41115. 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';
  41116. }
  41117. function createNameTable(name, proto) {
  41118. if (!proto) {
  41119. proto = [
  41120. [],
  41121. []
  41122. ];
  41123. }
  41124. var strings = [
  41125. proto[0][0] || 'Original licence',
  41126. proto[0][1] || name,
  41127. proto[0][2] || 'Unknown',
  41128. proto[0][3] || 'uniqueID',
  41129. proto[0][4] || name,
  41130. proto[0][5] || 'Version 0.11',
  41131. proto[0][6] || '',
  41132. proto[0][7] || 'Unknown',
  41133. proto[0][8] || 'Unknown',
  41134. proto[0][9] || 'Unknown'
  41135. ];
  41136. var stringsUnicode = [];
  41137. var i, ii, j, jj, str;
  41138. for (i = 0, ii = strings.length; i < ii; i++) {
  41139. str = proto[1][i] || strings[i];
  41140. var strBufUnicode = [];
  41141. for (j = 0, jj = str.length; j < jj; j++) {
  41142. strBufUnicode.push(string16(str.charCodeAt(j)));
  41143. }
  41144. stringsUnicode.push(strBufUnicode.join(''));
  41145. }
  41146. var names = [
  41147. strings,
  41148. stringsUnicode
  41149. ];
  41150. var platforms = [
  41151. '\x00\x01',
  41152. '\x00\x03'
  41153. ];
  41154. var encodings = [
  41155. '\x00\x00',
  41156. '\x00\x01'
  41157. ];
  41158. var languages = [
  41159. '\x00\x00',
  41160. '\x04\x09'
  41161. ];
  41162. var namesRecordCount = strings.length * platforms.length;
  41163. var nameTable = '\x00\x00' + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  41164. var strOffset = 0;
  41165. for (i = 0, ii = platforms.length; i < ii; i++) {
  41166. var strs = names[i];
  41167. for (j = 0, jj = strs.length; j < jj; j++) {
  41168. str = strs[j];
  41169. var nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  41170. nameTable += nameRecord;
  41171. strOffset += str.length;
  41172. }
  41173. }
  41174. nameTable += strings.join('') + stringsUnicode.join('');
  41175. return nameTable;
  41176. }
  41177. Font.prototype = {
  41178. name: null,
  41179. font: null,
  41180. mimetype: null,
  41181. encoding: null,
  41182. get renderer() {
  41183. var renderer = FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED);
  41184. return shadow(this, 'renderer', renderer);
  41185. },
  41186. exportData: function Font_exportData() {
  41187. var data = {};
  41188. for (var i in this) {
  41189. if (this.hasOwnProperty(i)) {
  41190. data[i] = this[i];
  41191. }
  41192. }
  41193. return data;
  41194. },
  41195. checkAndRepair: function Font_checkAndRepair(name, font, properties) {
  41196. function readTableEntry(file) {
  41197. var tag = bytesToString(file.getBytes(4));
  41198. var checksum = file.getInt32() >>> 0;
  41199. var offset = file.getInt32() >>> 0;
  41200. var length = file.getInt32() >>> 0;
  41201. var previousPosition = file.pos;
  41202. file.pos = file.start ? file.start : 0;
  41203. file.skip(offset);
  41204. var data = file.getBytes(length);
  41205. file.pos = previousPosition;
  41206. if (tag === 'head') {
  41207. data[8] = data[9] = data[10] = data[11] = 0;
  41208. data[17] |= 0x20;
  41209. }
  41210. return {
  41211. tag: tag,
  41212. checksum: checksum,
  41213. length: length,
  41214. offset: offset,
  41215. data: data
  41216. };
  41217. }
  41218. function readOpenTypeHeader(ttf) {
  41219. return {
  41220. version: bytesToString(ttf.getBytes(4)),
  41221. numTables: ttf.getUint16(),
  41222. searchRange: ttf.getUint16(),
  41223. entrySelector: ttf.getUint16(),
  41224. rangeShift: ttf.getUint16()
  41225. };
  41226. }
  41227. function readCmapTable(cmap, font, isSymbolicFont, hasEncoding) {
  41228. if (!cmap) {
  41229. warn('No cmap table available.');
  41230. return {
  41231. platformId: -1,
  41232. encodingId: -1,
  41233. mappings: [],
  41234. hasShortCmap: false
  41235. };
  41236. }
  41237. var segment;
  41238. var start = (font.start ? font.start : 0) + cmap.offset;
  41239. font.pos = start;
  41240. font.getUint16();
  41241. var numTables = font.getUint16();
  41242. var potentialTable;
  41243. var canBreak = false;
  41244. for (var i = 0; i < numTables; i++) {
  41245. var platformId = font.getUint16();
  41246. var encodingId = font.getUint16();
  41247. var offset = font.getInt32() >>> 0;
  41248. var useTable = false;
  41249. if (platformId === 0 && encodingId === 0) {
  41250. useTable = true;
  41251. } else if (platformId === 1 && encodingId === 0) {
  41252. useTable = true;
  41253. } else if (platformId === 3 && encodingId === 1 && (!isSymbolicFont && hasEncoding || !potentialTable)) {
  41254. useTable = true;
  41255. if (!isSymbolicFont) {
  41256. canBreak = true;
  41257. }
  41258. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  41259. useTable = true;
  41260. canBreak = true;
  41261. }
  41262. if (useTable) {
  41263. potentialTable = {
  41264. platformId: platformId,
  41265. encodingId: encodingId,
  41266. offset: offset
  41267. };
  41268. }
  41269. if (canBreak) {
  41270. break;
  41271. }
  41272. }
  41273. if (potentialTable) {
  41274. font.pos = start + potentialTable.offset;
  41275. }
  41276. if (!potentialTable || font.peekByte() === -1) {
  41277. warn('Could not find a preferred cmap table.');
  41278. return {
  41279. platformId: -1,
  41280. encodingId: -1,
  41281. mappings: [],
  41282. hasShortCmap: false
  41283. };
  41284. }
  41285. var format = font.getUint16();
  41286. font.getUint16();
  41287. font.getUint16();
  41288. var hasShortCmap = false;
  41289. var mappings = [];
  41290. var j, glyphId;
  41291. if (format === 0) {
  41292. for (j = 0; j < 256; j++) {
  41293. var index = font.getByte();
  41294. if (!index) {
  41295. continue;
  41296. }
  41297. mappings.push({
  41298. charCode: j,
  41299. glyphId: index
  41300. });
  41301. }
  41302. hasShortCmap = true;
  41303. } else if (format === 4) {
  41304. var segCount = font.getUint16() >> 1;
  41305. font.getBytes(6);
  41306. var segIndex, segments = [];
  41307. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41308. segments.push({ end: font.getUint16() });
  41309. }
  41310. font.getUint16();
  41311. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41312. segments[segIndex].start = font.getUint16();
  41313. }
  41314. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41315. segments[segIndex].delta = font.getUint16();
  41316. }
  41317. var offsetsCount = 0;
  41318. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41319. segment = segments[segIndex];
  41320. var rangeOffset = font.getUint16();
  41321. if (!rangeOffset) {
  41322. segment.offsetIndex = -1;
  41323. continue;
  41324. }
  41325. var offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  41326. segment.offsetIndex = offsetIndex;
  41327. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  41328. }
  41329. var offsets = [];
  41330. for (j = 0; j < offsetsCount; j++) {
  41331. offsets.push(font.getUint16());
  41332. }
  41333. for (segIndex = 0; segIndex < segCount; segIndex++) {
  41334. segment = segments[segIndex];
  41335. start = segment.start;
  41336. var end = segment.end;
  41337. var delta = segment.delta;
  41338. offsetIndex = segment.offsetIndex;
  41339. for (j = start; j <= end; j++) {
  41340. if (j === 0xFFFF) {
  41341. continue;
  41342. }
  41343. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  41344. glyphId = glyphId + delta & 0xFFFF;
  41345. if (glyphId === 0) {
  41346. continue;
  41347. }
  41348. mappings.push({
  41349. charCode: j,
  41350. glyphId: glyphId
  41351. });
  41352. }
  41353. }
  41354. } else if (format === 6) {
  41355. var firstCode = font.getUint16();
  41356. var entryCount = font.getUint16();
  41357. for (j = 0; j < entryCount; j++) {
  41358. glyphId = font.getUint16();
  41359. var charCode = firstCode + j;
  41360. mappings.push({
  41361. charCode: charCode,
  41362. glyphId: glyphId
  41363. });
  41364. }
  41365. } else {
  41366. warn('cmap table has unsupported format: ' + format);
  41367. return {
  41368. platformId: -1,
  41369. encodingId: -1,
  41370. mappings: [],
  41371. hasShortCmap: false
  41372. };
  41373. }
  41374. mappings.sort(function (a, b) {
  41375. return a.charCode - b.charCode;
  41376. });
  41377. for (i = 1; i < mappings.length; i++) {
  41378. if (mappings[i - 1].charCode === mappings[i].charCode) {
  41379. mappings.splice(i, 1);
  41380. i--;
  41381. }
  41382. }
  41383. return {
  41384. platformId: potentialTable.platformId,
  41385. encodingId: potentialTable.encodingId,
  41386. mappings: mappings,
  41387. hasShortCmap: hasShortCmap
  41388. };
  41389. }
  41390. function sanitizeMetrics(font, header, metrics, numGlyphs) {
  41391. if (!header) {
  41392. if (metrics) {
  41393. metrics.data = null;
  41394. }
  41395. return;
  41396. }
  41397. font.pos = (font.start ? font.start : 0) + header.offset;
  41398. font.pos += header.length - 2;
  41399. var numOfMetrics = font.getUint16();
  41400. if (numOfMetrics > numGlyphs) {
  41401. info('The numOfMetrics (' + numOfMetrics + ') should not be ' + 'greater than the numGlyphs (' + numGlyphs + ')');
  41402. numOfMetrics = numGlyphs;
  41403. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  41404. header.data[35] = numOfMetrics & 0x00ff;
  41405. }
  41406. var numOfSidebearings = numGlyphs - numOfMetrics;
  41407. var numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  41408. if (numMissing > 0) {
  41409. var entries = new Uint8Array(metrics.length + numMissing * 2);
  41410. entries.set(metrics.data);
  41411. metrics.data = entries;
  41412. }
  41413. }
  41414. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  41415. if (sourceEnd - sourceStart <= 12) {
  41416. return 0;
  41417. }
  41418. var glyf = source.subarray(sourceStart, sourceEnd);
  41419. var contoursCount = glyf[0] << 8 | glyf[1];
  41420. if (contoursCount & 0x8000) {
  41421. dest.set(glyf, destStart);
  41422. return glyf.length;
  41423. }
  41424. var i, j = 10, flagsCount = 0;
  41425. for (i = 0; i < contoursCount; i++) {
  41426. var endPoint = glyf[j] << 8 | glyf[j + 1];
  41427. flagsCount = endPoint + 1;
  41428. j += 2;
  41429. }
  41430. var instructionsStart = j;
  41431. var instructionsLength = glyf[j] << 8 | glyf[j + 1];
  41432. j += 2 + instructionsLength;
  41433. var instructionsEnd = j;
  41434. var coordinatesLength = 0;
  41435. for (i = 0; i < flagsCount; i++) {
  41436. var flag = glyf[j++];
  41437. if (flag & 0xC0) {
  41438. glyf[j - 1] = flag & 0x3F;
  41439. }
  41440. var xyLength = (flag & 2 ? 1 : flag & 16 ? 0 : 2) + (flag & 4 ? 1 : flag & 32 ? 0 : 2);
  41441. coordinatesLength += xyLength;
  41442. if (flag & 8) {
  41443. var repeat = glyf[j++];
  41444. i += repeat;
  41445. coordinatesLength += repeat * xyLength;
  41446. }
  41447. }
  41448. if (coordinatesLength === 0) {
  41449. return 0;
  41450. }
  41451. var glyphDataLength = j + coordinatesLength;
  41452. if (glyphDataLength > glyf.length) {
  41453. return 0;
  41454. }
  41455. if (!hintsValid && instructionsLength > 0) {
  41456. dest.set(glyf.subarray(0, instructionsStart), destStart);
  41457. dest.set([
  41458. 0,
  41459. 0
  41460. ], destStart + instructionsStart);
  41461. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  41462. glyphDataLength -= instructionsLength;
  41463. if (glyf.length - glyphDataLength > 3) {
  41464. glyphDataLength = glyphDataLength + 3 & ~3;
  41465. }
  41466. return glyphDataLength;
  41467. }
  41468. if (glyf.length - glyphDataLength > 3) {
  41469. glyphDataLength = glyphDataLength + 3 & ~3;
  41470. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  41471. return glyphDataLength;
  41472. }
  41473. dest.set(glyf, destStart);
  41474. return glyf.length;
  41475. }
  41476. function sanitizeHead(head, numGlyphs, locaLength) {
  41477. var data = head.data;
  41478. var version = int32(data[0], data[1], data[2], data[3]);
  41479. if (version >> 16 !== 1) {
  41480. info('Attempting to fix invalid version in head table: ' + version);
  41481. data[0] = 0;
  41482. data[1] = 1;
  41483. data[2] = 0;
  41484. data[3] = 0;
  41485. }
  41486. var indexToLocFormat = int16(data[50], data[51]);
  41487. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  41488. info('Attempting to fix invalid indexToLocFormat in head table: ' + indexToLocFormat);
  41489. var numGlyphsPlusOne = numGlyphs + 1;
  41490. if (locaLength === numGlyphsPlusOne << 1) {
  41491. data[50] = 0;
  41492. data[51] = 0;
  41493. } else if (locaLength === numGlyphsPlusOne << 2) {
  41494. data[50] = 0;
  41495. data[51] = 1;
  41496. } else {
  41497. warn('Could not fix indexToLocFormat: ' + indexToLocFormat);
  41498. }
  41499. }
  41500. }
  41501. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry) {
  41502. var itemSize, itemDecode, itemEncode;
  41503. if (isGlyphLocationsLong) {
  41504. itemSize = 4;
  41505. itemDecode = function fontItemDecodeLong(data, offset) {
  41506. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  41507. };
  41508. itemEncode = function fontItemEncodeLong(data, offset, value) {
  41509. data[offset] = value >>> 24 & 0xFF;
  41510. data[offset + 1] = value >> 16 & 0xFF;
  41511. data[offset + 2] = value >> 8 & 0xFF;
  41512. data[offset + 3] = value & 0xFF;
  41513. };
  41514. } else {
  41515. itemSize = 2;
  41516. itemDecode = function fontItemDecode(data, offset) {
  41517. return data[offset] << 9 | data[offset + 1] << 1;
  41518. };
  41519. itemEncode = function fontItemEncode(data, offset, value) {
  41520. data[offset] = value >> 9 & 0xFF;
  41521. data[offset + 1] = value >> 1 & 0xFF;
  41522. };
  41523. }
  41524. var locaData = loca.data;
  41525. var locaDataSize = itemSize * (1 + numGlyphs);
  41526. if (locaData.length !== locaDataSize) {
  41527. locaData = new Uint8Array(locaDataSize);
  41528. locaData.set(loca.data.subarray(0, locaDataSize));
  41529. loca.data = locaData;
  41530. }
  41531. var oldGlyfData = glyf.data;
  41532. var oldGlyfDataLength = oldGlyfData.length;
  41533. var newGlyfData = new Uint8Array(oldGlyfDataLength);
  41534. var startOffset = itemDecode(locaData, 0);
  41535. var writeOffset = 0;
  41536. var missingGlyphData = Object.create(null);
  41537. itemEncode(locaData, 0, writeOffset);
  41538. var i, j;
  41539. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  41540. var endOffset = itemDecode(locaData, j);
  41541. if (endOffset > oldGlyfDataLength && (oldGlyfDataLength + 3 & ~3) === endOffset) {
  41542. endOffset = oldGlyfDataLength;
  41543. }
  41544. if (endOffset > oldGlyfDataLength) {
  41545. itemEncode(locaData, j, writeOffset);
  41546. startOffset = endOffset;
  41547. continue;
  41548. }
  41549. if (startOffset === endOffset) {
  41550. missingGlyphData[i] = true;
  41551. }
  41552. var newLength = sanitizeGlyph(oldGlyfData, startOffset, endOffset, newGlyfData, writeOffset, hintsValid);
  41553. writeOffset += newLength;
  41554. itemEncode(locaData, j, writeOffset);
  41555. startOffset = endOffset;
  41556. }
  41557. if (writeOffset === 0) {
  41558. var simpleGlyph = new Uint8Array([
  41559. 0,
  41560. 1,
  41561. 0,
  41562. 0,
  41563. 0,
  41564. 0,
  41565. 0,
  41566. 0,
  41567. 0,
  41568. 0,
  41569. 0,
  41570. 0,
  41571. 0,
  41572. 0,
  41573. 49,
  41574. 0
  41575. ]);
  41576. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  41577. itemEncode(locaData, j, simpleGlyph.length);
  41578. }
  41579. glyf.data = simpleGlyph;
  41580. return missingGlyphData;
  41581. }
  41582. if (dupFirstEntry) {
  41583. var firstEntryLength = itemDecode(locaData, itemSize);
  41584. if (newGlyfData.length > firstEntryLength + writeOffset) {
  41585. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  41586. } else {
  41587. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  41588. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  41589. }
  41590. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  41591. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  41592. } else {
  41593. glyf.data = newGlyfData.subarray(0, writeOffset);
  41594. }
  41595. return missingGlyphData;
  41596. }
  41597. function readPostScriptTable(post, properties, maxpNumGlyphs) {
  41598. var start = (font.start ? font.start : 0) + post.offset;
  41599. font.pos = start;
  41600. var length = post.length, end = start + length;
  41601. var version = font.getInt32();
  41602. font.getBytes(28);
  41603. var glyphNames;
  41604. var valid = true;
  41605. var i;
  41606. switch (version) {
  41607. case 0x00010000:
  41608. glyphNames = MacStandardGlyphOrdering;
  41609. break;
  41610. case 0x00020000:
  41611. var numGlyphs = font.getUint16();
  41612. if (numGlyphs !== maxpNumGlyphs) {
  41613. valid = false;
  41614. break;
  41615. }
  41616. var glyphNameIndexes = [];
  41617. for (i = 0; i < numGlyphs; ++i) {
  41618. var index = font.getUint16();
  41619. if (index >= 32768) {
  41620. valid = false;
  41621. break;
  41622. }
  41623. glyphNameIndexes.push(index);
  41624. }
  41625. if (!valid) {
  41626. break;
  41627. }
  41628. var customNames = [];
  41629. var strBuf = [];
  41630. while (font.pos < end) {
  41631. var stringLength = font.getByte();
  41632. strBuf.length = stringLength;
  41633. for (i = 0; i < stringLength; ++i) {
  41634. strBuf[i] = String.fromCharCode(font.getByte());
  41635. }
  41636. customNames.push(strBuf.join(''));
  41637. }
  41638. glyphNames = [];
  41639. for (i = 0; i < numGlyphs; ++i) {
  41640. var j = glyphNameIndexes[i];
  41641. if (j < 258) {
  41642. glyphNames.push(MacStandardGlyphOrdering[j]);
  41643. continue;
  41644. }
  41645. glyphNames.push(customNames[j - 258]);
  41646. }
  41647. break;
  41648. case 0x00030000:
  41649. break;
  41650. default:
  41651. warn('Unknown/unsupported post table version ' + version);
  41652. valid = false;
  41653. if (properties.defaultEncoding) {
  41654. glyphNames = properties.defaultEncoding;
  41655. }
  41656. break;
  41657. }
  41658. properties.glyphNames = glyphNames;
  41659. return valid;
  41660. }
  41661. function readNameTable(nameTable) {
  41662. var start = (font.start ? font.start : 0) + nameTable.offset;
  41663. font.pos = start;
  41664. var names = [
  41665. [],
  41666. []
  41667. ];
  41668. var length = nameTable.length, end = start + length;
  41669. var format = font.getUint16();
  41670. var FORMAT_0_HEADER_LENGTH = 6;
  41671. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  41672. return names;
  41673. }
  41674. var numRecords = font.getUint16();
  41675. var stringsStart = font.getUint16();
  41676. var records = [];
  41677. var NAME_RECORD_LENGTH = 12;
  41678. var i, ii;
  41679. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  41680. var r = {
  41681. platform: font.getUint16(),
  41682. encoding: font.getUint16(),
  41683. language: font.getUint16(),
  41684. name: font.getUint16(),
  41685. length: font.getUint16(),
  41686. offset: font.getUint16()
  41687. };
  41688. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  41689. records.push(r);
  41690. }
  41691. }
  41692. for (i = 0, ii = records.length; i < ii; i++) {
  41693. var record = records[i];
  41694. if (record.length <= 0) {
  41695. continue;
  41696. }
  41697. var pos = start + stringsStart + record.offset;
  41698. if (pos + record.length > end) {
  41699. continue;
  41700. }
  41701. font.pos = pos;
  41702. var nameIndex = record.name;
  41703. if (record.encoding) {
  41704. var str = '';
  41705. for (var j = 0, jj = record.length; j < jj; j += 2) {
  41706. str += String.fromCharCode(font.getUint16());
  41707. }
  41708. names[1][nameIndex] = str;
  41709. } else {
  41710. names[0][nameIndex] = bytesToString(font.getBytes(record.length));
  41711. }
  41712. }
  41713. return names;
  41714. }
  41715. var TTOpsStackDeltas = [
  41716. 0,
  41717. 0,
  41718. 0,
  41719. 0,
  41720. 0,
  41721. 0,
  41722. 0,
  41723. 0,
  41724. -2,
  41725. -2,
  41726. -2,
  41727. -2,
  41728. 0,
  41729. 0,
  41730. -2,
  41731. -5,
  41732. -1,
  41733. -1,
  41734. -1,
  41735. -1,
  41736. -1,
  41737. -1,
  41738. -1,
  41739. -1,
  41740. 0,
  41741. 0,
  41742. -1,
  41743. 0,
  41744. -1,
  41745. -1,
  41746. -1,
  41747. -1,
  41748. 1,
  41749. -1,
  41750. -999,
  41751. 0,
  41752. 1,
  41753. 0,
  41754. -1,
  41755. -2,
  41756. 0,
  41757. -1,
  41758. -2,
  41759. -1,
  41760. -1,
  41761. 0,
  41762. -1,
  41763. -1,
  41764. 0,
  41765. 0,
  41766. -999,
  41767. -999,
  41768. -1,
  41769. -1,
  41770. -1,
  41771. -1,
  41772. -2,
  41773. -999,
  41774. -2,
  41775. -2,
  41776. -999,
  41777. 0,
  41778. -2,
  41779. -2,
  41780. 0,
  41781. 0,
  41782. -2,
  41783. 0,
  41784. -2,
  41785. 0,
  41786. 0,
  41787. 0,
  41788. -2,
  41789. -1,
  41790. -1,
  41791. 1,
  41792. 1,
  41793. 0,
  41794. 0,
  41795. -1,
  41796. -1,
  41797. -1,
  41798. -1,
  41799. -1,
  41800. -1,
  41801. -1,
  41802. 0,
  41803. 0,
  41804. -1,
  41805. 0,
  41806. -1,
  41807. -1,
  41808. 0,
  41809. -999,
  41810. -1,
  41811. -1,
  41812. -1,
  41813. -1,
  41814. -1,
  41815. -1,
  41816. 0,
  41817. 0,
  41818. 0,
  41819. 0,
  41820. 0,
  41821. 0,
  41822. 0,
  41823. 0,
  41824. 0,
  41825. 0,
  41826. 0,
  41827. 0,
  41828. -2,
  41829. -999,
  41830. -999,
  41831. -999,
  41832. -999,
  41833. -999,
  41834. -1,
  41835. -1,
  41836. -2,
  41837. -2,
  41838. 0,
  41839. 0,
  41840. 0,
  41841. 0,
  41842. -1,
  41843. -1,
  41844. -999,
  41845. -2,
  41846. -2,
  41847. 0,
  41848. 0,
  41849. -1,
  41850. -2,
  41851. -2,
  41852. 0,
  41853. 0,
  41854. 0,
  41855. -1,
  41856. -1,
  41857. -1,
  41858. -2
  41859. ];
  41860. function sanitizeTTProgram(table, ttContext) {
  41861. var data = table.data;
  41862. var i = 0, j, n, b, funcId, pc, lastEndf = 0, lastDeff = 0;
  41863. var stack = [];
  41864. var callstack = [];
  41865. var functionsCalled = [];
  41866. var tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  41867. var inFDEF = false, ifLevel = 0, inELSE = 0;
  41868. for (var ii = data.length; i < ii;) {
  41869. var op = data[i++];
  41870. if (op === 0x40) {
  41871. n = data[i++];
  41872. if (inFDEF || inELSE) {
  41873. i += n;
  41874. } else {
  41875. for (j = 0; j < n; j++) {
  41876. stack.push(data[i++]);
  41877. }
  41878. }
  41879. } else if (op === 0x41) {
  41880. n = data[i++];
  41881. if (inFDEF || inELSE) {
  41882. i += n * 2;
  41883. } else {
  41884. for (j = 0; j < n; j++) {
  41885. b = data[i++];
  41886. stack.push(b << 8 | data[i++]);
  41887. }
  41888. }
  41889. } else if ((op & 0xF8) === 0xB0) {
  41890. n = op - 0xB0 + 1;
  41891. if (inFDEF || inELSE) {
  41892. i += n;
  41893. } else {
  41894. for (j = 0; j < n; j++) {
  41895. stack.push(data[i++]);
  41896. }
  41897. }
  41898. } else if ((op & 0xF8) === 0xB8) {
  41899. n = op - 0xB8 + 1;
  41900. if (inFDEF || inELSE) {
  41901. i += n * 2;
  41902. } else {
  41903. for (j = 0; j < n; j++) {
  41904. b = data[i++];
  41905. stack.push(b << 8 | data[i++]);
  41906. }
  41907. }
  41908. } else if (op === 0x2B && !tooComplexToFollowFunctions) {
  41909. if (!inFDEF && !inELSE) {
  41910. funcId = stack[stack.length - 1];
  41911. ttContext.functionsUsed[funcId] = true;
  41912. if (funcId in ttContext.functionsStackDeltas) {
  41913. stack.length += ttContext.functionsStackDeltas[funcId];
  41914. } else if (funcId in ttContext.functionsDefined && functionsCalled.indexOf(funcId) < 0) {
  41915. callstack.push({
  41916. data: data,
  41917. i: i,
  41918. stackTop: stack.length - 1
  41919. });
  41920. functionsCalled.push(funcId);
  41921. pc = ttContext.functionsDefined[funcId];
  41922. if (!pc) {
  41923. warn('TT: CALL non-existent function');
  41924. ttContext.hintsValid = false;
  41925. return;
  41926. }
  41927. data = pc.data;
  41928. i = pc.i;
  41929. }
  41930. }
  41931. } else if (op === 0x2C && !tooComplexToFollowFunctions) {
  41932. if (inFDEF || inELSE) {
  41933. warn('TT: nested FDEFs not allowed');
  41934. tooComplexToFollowFunctions = true;
  41935. }
  41936. inFDEF = true;
  41937. lastDeff = i;
  41938. funcId = stack.pop();
  41939. ttContext.functionsDefined[funcId] = {
  41940. data: data,
  41941. i: i
  41942. };
  41943. } else if (op === 0x2D) {
  41944. if (inFDEF) {
  41945. inFDEF = false;
  41946. lastEndf = i;
  41947. } else {
  41948. pc = callstack.pop();
  41949. if (!pc) {
  41950. warn('TT: ENDF bad stack');
  41951. ttContext.hintsValid = false;
  41952. return;
  41953. }
  41954. funcId = functionsCalled.pop();
  41955. data = pc.data;
  41956. i = pc.i;
  41957. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  41958. }
  41959. } else if (op === 0x89) {
  41960. if (inFDEF || inELSE) {
  41961. warn('TT: nested IDEFs not allowed');
  41962. tooComplexToFollowFunctions = true;
  41963. }
  41964. inFDEF = true;
  41965. lastDeff = i;
  41966. } else if (op === 0x58) {
  41967. ++ifLevel;
  41968. } else if (op === 0x1B) {
  41969. inELSE = ifLevel;
  41970. } else if (op === 0x59) {
  41971. if (inELSE === ifLevel) {
  41972. inELSE = 0;
  41973. }
  41974. --ifLevel;
  41975. } else if (op === 0x1C) {
  41976. if (!inFDEF && !inELSE) {
  41977. var offset = stack[stack.length - 1];
  41978. if (offset > 0) {
  41979. i += offset - 1;
  41980. }
  41981. }
  41982. }
  41983. if (!inFDEF && !inELSE) {
  41984. var stackDelta = op <= 0x8E ? TTOpsStackDeltas[op] : op >= 0xC0 && op <= 0xDF ? -1 : op >= 0xE0 ? -2 : 0;
  41985. if (op >= 0x71 && op <= 0x75) {
  41986. n = stack.pop();
  41987. if (!isNaN(n)) {
  41988. stackDelta = -n * 2;
  41989. }
  41990. }
  41991. while (stackDelta < 0 && stack.length > 0) {
  41992. stack.pop();
  41993. stackDelta++;
  41994. }
  41995. while (stackDelta > 0) {
  41996. stack.push(NaN);
  41997. stackDelta--;
  41998. }
  41999. }
  42000. }
  42001. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  42002. var content = [data];
  42003. if (i > data.length) {
  42004. content.push(new Uint8Array(i - data.length));
  42005. }
  42006. if (lastDeff > lastEndf) {
  42007. warn('TT: complementing a missing function tail');
  42008. content.push(new Uint8Array([
  42009. 0x22,
  42010. 0x2D
  42011. ]));
  42012. }
  42013. foldTTTable(table, content);
  42014. }
  42015. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  42016. if (ttContext.tooComplexToFollowFunctions) {
  42017. return;
  42018. }
  42019. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  42020. warn('TT: more functions defined than expected');
  42021. ttContext.hintsValid = false;
  42022. return;
  42023. }
  42024. for (var j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  42025. if (j > maxFunctionDefs) {
  42026. warn('TT: invalid function id: ' + j);
  42027. ttContext.hintsValid = false;
  42028. return;
  42029. }
  42030. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  42031. warn('TT: undefined function: ' + j);
  42032. ttContext.hintsValid = false;
  42033. return;
  42034. }
  42035. }
  42036. }
  42037. function foldTTTable(table, content) {
  42038. if (content.length > 1) {
  42039. var newLength = 0;
  42040. var j, jj;
  42041. for (j = 0, jj = content.length; j < jj; j++) {
  42042. newLength += content[j].length;
  42043. }
  42044. newLength = newLength + 3 & ~3;
  42045. var result = new Uint8Array(newLength);
  42046. var pos = 0;
  42047. for (j = 0, jj = content.length; j < jj; j++) {
  42048. result.set(content[j], pos);
  42049. pos += content[j].length;
  42050. }
  42051. table.data = result;
  42052. table.length = newLength;
  42053. }
  42054. }
  42055. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  42056. var ttContext = {
  42057. functionsDefined: [],
  42058. functionsUsed: [],
  42059. functionsStackDeltas: [],
  42060. tooComplexToFollowFunctions: false,
  42061. hintsValid: true
  42062. };
  42063. if (fpgm) {
  42064. sanitizeTTProgram(fpgm, ttContext);
  42065. }
  42066. if (prep) {
  42067. sanitizeTTProgram(prep, ttContext);
  42068. }
  42069. if (fpgm) {
  42070. checkInvalidFunctions(ttContext, maxFunctionDefs);
  42071. }
  42072. if (cvt && cvt.length & 1) {
  42073. var cvtData = new Uint8Array(cvt.length + 1);
  42074. cvtData.set(cvt.data);
  42075. cvt.data = cvtData;
  42076. }
  42077. return ttContext.hintsValid;
  42078. }
  42079. font = new Stream(new Uint8Array(font.getBytes()));
  42080. var VALID_TABLES = [
  42081. 'OS/2',
  42082. 'cmap',
  42083. 'head',
  42084. 'hhea',
  42085. 'hmtx',
  42086. 'maxp',
  42087. 'name',
  42088. 'post',
  42089. 'loca',
  42090. 'glyf',
  42091. 'fpgm',
  42092. 'prep',
  42093. 'cvt ',
  42094. 'CFF '
  42095. ];
  42096. var header = readOpenTypeHeader(font);
  42097. var numTables = header.numTables;
  42098. var cff, cffFile;
  42099. var tables = Object.create(null);
  42100. tables['OS/2'] = null;
  42101. tables['cmap'] = null;
  42102. tables['head'] = null;
  42103. tables['hhea'] = null;
  42104. tables['hmtx'] = null;
  42105. tables['maxp'] = null;
  42106. tables['name'] = null;
  42107. tables['post'] = null;
  42108. var table;
  42109. for (var i = 0; i < numTables; i++) {
  42110. table = readTableEntry(font);
  42111. if (VALID_TABLES.indexOf(table.tag) < 0) {
  42112. continue;
  42113. }
  42114. if (table.length === 0) {
  42115. continue;
  42116. }
  42117. tables[table.tag] = table;
  42118. }
  42119. var isTrueType = !tables['CFF '];
  42120. if (!isTrueType) {
  42121. if (header.version === 'OTTO' && !properties.composite || !tables['head'] || !tables['hhea'] || !tables['maxp'] || !tables['post']) {
  42122. cffFile = new Stream(tables['CFF '].data);
  42123. cff = new CFFFont(cffFile, properties);
  42124. adjustWidths(properties);
  42125. return this.convert(name, cff, properties);
  42126. }
  42127. delete tables['glyf'];
  42128. delete tables['loca'];
  42129. delete tables['fpgm'];
  42130. delete tables['prep'];
  42131. delete tables['cvt '];
  42132. this.isOpenType = true;
  42133. } else {
  42134. if (!tables['loca']) {
  42135. error('Required "loca" table is not found');
  42136. }
  42137. if (!tables['glyf']) {
  42138. warn('Required "glyf" table is not found -- trying to recover.');
  42139. tables['glyf'] = {
  42140. tag: 'glyf',
  42141. data: new Uint8Array(0)
  42142. };
  42143. }
  42144. this.isOpenType = false;
  42145. }
  42146. if (!tables['maxp']) {
  42147. error('Required "maxp" table is not found');
  42148. }
  42149. font.pos = (font.start || 0) + tables['maxp'].offset;
  42150. var version = font.getInt32();
  42151. var numGlyphs = font.getUint16();
  42152. var maxFunctionDefs = 0;
  42153. if (version >= 0x00010000 && tables['maxp'].length >= 22) {
  42154. font.pos += 8;
  42155. var maxZones = font.getUint16();
  42156. if (maxZones > 2) {
  42157. tables['maxp'].data[14] = 0;
  42158. tables['maxp'].data[15] = 2;
  42159. }
  42160. font.pos += 4;
  42161. maxFunctionDefs = font.getUint16();
  42162. }
  42163. var dupFirstEntry = false;
  42164. if (properties.type === 'CIDFontType2' && properties.toUnicode && properties.toUnicode.get(0) > '\u0000') {
  42165. dupFirstEntry = true;
  42166. numGlyphs++;
  42167. tables['maxp'].data[4] = numGlyphs >> 8;
  42168. tables['maxp'].data[5] = numGlyphs & 255;
  42169. }
  42170. var hintsValid = sanitizeTTPrograms(tables['fpgm'], tables['prep'], tables['cvt '], maxFunctionDefs);
  42171. if (!hintsValid) {
  42172. delete tables['fpgm'];
  42173. delete tables['prep'];
  42174. delete tables['cvt '];
  42175. }
  42176. sanitizeMetrics(font, tables['hhea'], tables['hmtx'], numGlyphs);
  42177. if (!tables['head']) {
  42178. error('Required "head" table is not found');
  42179. }
  42180. sanitizeHead(tables['head'], numGlyphs, isTrueType ? tables['loca'].length : 0);
  42181. var missingGlyphs = Object.create(null);
  42182. if (isTrueType) {
  42183. var isGlyphLocationsLong = int16(tables['head'].data[50], tables['head'].data[51]);
  42184. missingGlyphs = sanitizeGlyphLocations(tables['loca'], tables['glyf'], numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry);
  42185. }
  42186. if (!tables['hhea']) {
  42187. error('Required "hhea" table is not found');
  42188. }
  42189. if (tables['hhea'].data[10] === 0 && tables['hhea'].data[11] === 0) {
  42190. tables['hhea'].data[10] = 0xFF;
  42191. tables['hhea'].data[11] = 0xFF;
  42192. }
  42193. var metricsOverride = {
  42194. unitsPerEm: int16(tables['head'].data[18], tables['head'].data[19]),
  42195. yMax: int16(tables['head'].data[42], tables['head'].data[43]),
  42196. yMin: signedInt16(tables['head'].data[38], tables['head'].data[39]),
  42197. ascent: int16(tables['hhea'].data[4], tables['hhea'].data[5]),
  42198. descent: signedInt16(tables['hhea'].data[6], tables['hhea'].data[7])
  42199. };
  42200. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  42201. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  42202. if (tables['post']) {
  42203. var valid = readPostScriptTable(tables['post'], properties, numGlyphs);
  42204. if (!valid) {
  42205. tables['post'] = null;
  42206. }
  42207. }
  42208. var charCodeToGlyphId = [], charCode;
  42209. var toUnicode = properties.toUnicode, widths = properties.widths;
  42210. var skipToUnicode = toUnicode instanceof IdentityToUnicodeMap || toUnicode.length === 0x10000;
  42211. function hasGlyph(glyphId, charCode, widthCode) {
  42212. if (!missingGlyphs[glyphId]) {
  42213. return true;
  42214. }
  42215. if (!skipToUnicode && charCode >= 0 && toUnicode.has(charCode)) {
  42216. return true;
  42217. }
  42218. if (widths && widthCode >= 0 && isNum(widths[widthCode])) {
  42219. return true;
  42220. }
  42221. return false;
  42222. }
  42223. if (properties.composite) {
  42224. var cidToGidMap = properties.cidToGidMap || [];
  42225. var isCidToGidMapEmpty = cidToGidMap.length === 0;
  42226. properties.cMap.forEach(function (charCode, cid) {
  42227. assert(cid <= 0xffff, 'Max size of CID is 65,535');
  42228. var glyphId = -1;
  42229. if (isCidToGidMapEmpty) {
  42230. glyphId = cid;
  42231. } else if (cidToGidMap[cid] !== undefined) {
  42232. glyphId = cidToGidMap[cid];
  42233. }
  42234. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId, charCode, cid)) {
  42235. charCodeToGlyphId[charCode] = glyphId;
  42236. }
  42237. });
  42238. if (dupFirstEntry && (isCidToGidMapEmpty || !charCodeToGlyphId[0])) {
  42239. charCodeToGlyphId[0] = numGlyphs - 1;
  42240. }
  42241. } else {
  42242. var cmapTable = readCmapTable(tables['cmap'], font, this.isSymbolicFont, properties.hasEncoding);
  42243. var cmapPlatformId = cmapTable.platformId;
  42244. var cmapEncodingId = cmapTable.encodingId;
  42245. var cmapMappings = cmapTable.mappings;
  42246. var cmapMappingsLength = cmapMappings.length;
  42247. if (properties.hasEncoding && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0) || cmapPlatformId === -1 && cmapEncodingId === -1 && !!getEncoding(properties.baseEncodingName)) {
  42248. var baseEncoding = [];
  42249. if (properties.baseEncodingName === 'MacRomanEncoding' || properties.baseEncodingName === 'WinAnsiEncoding') {
  42250. baseEncoding = getEncoding(properties.baseEncodingName);
  42251. }
  42252. var glyphsUnicodeMap = getGlyphsUnicode();
  42253. for (charCode = 0; charCode < 256; charCode++) {
  42254. var glyphName, standardGlyphName;
  42255. if (this.differences && charCode in this.differences) {
  42256. glyphName = this.differences[charCode];
  42257. } else if (charCode in baseEncoding && baseEncoding[charCode] !== '') {
  42258. glyphName = baseEncoding[charCode];
  42259. } else {
  42260. glyphName = StandardEncoding[charCode];
  42261. }
  42262. if (!glyphName) {
  42263. continue;
  42264. }
  42265. standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  42266. var unicodeOrCharCode, isUnicode = false;
  42267. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  42268. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  42269. isUnicode = true;
  42270. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  42271. unicodeOrCharCode = MacRomanEncoding.indexOf(standardGlyphName);
  42272. }
  42273. var found = false;
  42274. for (i = 0; i < cmapMappingsLength; ++i) {
  42275. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  42276. continue;
  42277. }
  42278. var code = isUnicode ? charCode : unicodeOrCharCode;
  42279. if (hasGlyph(cmapMappings[i].glyphId, code, -1)) {
  42280. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  42281. found = true;
  42282. break;
  42283. }
  42284. }
  42285. if (!found && properties.glyphNames) {
  42286. var glyphId = properties.glyphNames.indexOf(glyphName);
  42287. if (glyphId === -1 && standardGlyphName !== glyphName) {
  42288. glyphId = properties.glyphNames.indexOf(standardGlyphName);
  42289. }
  42290. if (glyphId > 0 && hasGlyph(glyphId, -1, -1)) {
  42291. charCodeToGlyphId[charCode] = glyphId;
  42292. found = true;
  42293. }
  42294. }
  42295. if (!found) {
  42296. charCodeToGlyphId[charCode] = 0;
  42297. }
  42298. }
  42299. } else if (cmapPlatformId === 0 && cmapEncodingId === 0) {
  42300. for (i = 0; i < cmapMappingsLength; ++i) {
  42301. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  42302. }
  42303. } else {
  42304. for (i = 0; i < cmapMappingsLength; ++i) {
  42305. charCode = cmapMappings[i].charCode & 0xFF;
  42306. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  42307. }
  42308. }
  42309. }
  42310. if (charCodeToGlyphId.length === 0) {
  42311. charCodeToGlyphId[0] = 0;
  42312. }
  42313. var newMapping = adjustMapping(charCodeToGlyphId, properties);
  42314. this.toFontChar = newMapping.toFontChar;
  42315. tables['cmap'] = {
  42316. tag: 'cmap',
  42317. data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphs)
  42318. };
  42319. if (!tables['OS/2'] || !validateOS2Table(tables['OS/2'])) {
  42320. tables['OS/2'] = {
  42321. tag: 'OS/2',
  42322. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  42323. };
  42324. }
  42325. if (!tables['post']) {
  42326. tables['post'] = {
  42327. tag: 'post',
  42328. data: createPostTable(properties)
  42329. };
  42330. }
  42331. if (!isTrueType) {
  42332. try {
  42333. cffFile = new Stream(tables['CFF '].data);
  42334. var parser = new CFFParser(cffFile, properties, SEAC_ANALYSIS_ENABLED);
  42335. cff = parser.parse();
  42336. var compiler = new CFFCompiler(cff);
  42337. tables['CFF '].data = compiler.compile();
  42338. } catch (e) {
  42339. warn('Failed to compile font ' + properties.loadedName);
  42340. }
  42341. }
  42342. if (!tables['name']) {
  42343. tables['name'] = {
  42344. tag: 'name',
  42345. data: createNameTable(this.name)
  42346. };
  42347. } else {
  42348. var namePrototype = readNameTable(tables['name']);
  42349. tables['name'].data = createNameTable(name, namePrototype);
  42350. }
  42351. var builder = new OpenTypeFileBuilder(header.version);
  42352. for (var tableTag in tables) {
  42353. builder.addTable(tableTag, tables[tableTag].data);
  42354. }
  42355. return builder.toArray();
  42356. },
  42357. convert: function Font_convert(fontName, font, properties) {
  42358. properties.fixedPitch = false;
  42359. if (properties.builtInEncoding) {
  42360. adjustToUnicode(properties, properties.builtInEncoding);
  42361. }
  42362. var mapping = font.getGlyphMapping(properties);
  42363. var newMapping = adjustMapping(mapping, properties);
  42364. this.toFontChar = newMapping.toFontChar;
  42365. var numGlyphs = font.numGlyphs;
  42366. function getCharCodes(charCodeToGlyphId, glyphId) {
  42367. var charCodes = null;
  42368. for (var charCode in charCodeToGlyphId) {
  42369. if (glyphId === charCodeToGlyphId[charCode]) {
  42370. if (!charCodes) {
  42371. charCodes = [];
  42372. }
  42373. charCodes.push(charCode | 0);
  42374. }
  42375. }
  42376. return charCodes;
  42377. }
  42378. function createCharCode(charCodeToGlyphId, glyphId) {
  42379. for (var charCode in charCodeToGlyphId) {
  42380. if (glyphId === charCodeToGlyphId[charCode]) {
  42381. return charCode | 0;
  42382. }
  42383. }
  42384. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  42385. return newMapping.nextAvailableFontCharCode++;
  42386. }
  42387. var seacs = font.seacs;
  42388. if (SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  42389. var matrix = properties.fontMatrix || FONT_IDENTITY_MATRIX;
  42390. var charset = font.getCharset();
  42391. var seacMap = Object.create(null);
  42392. for (var glyphId in seacs) {
  42393. glyphId |= 0;
  42394. var seac = seacs[glyphId];
  42395. var baseGlyphName = StandardEncoding[seac[2]];
  42396. var accentGlyphName = StandardEncoding[seac[3]];
  42397. var baseGlyphId = charset.indexOf(baseGlyphName);
  42398. var accentGlyphId = charset.indexOf(accentGlyphName);
  42399. if (baseGlyphId < 0 || accentGlyphId < 0) {
  42400. continue;
  42401. }
  42402. var accentOffset = {
  42403. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  42404. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  42405. };
  42406. var charCodes = getCharCodes(mapping, glyphId);
  42407. if (!charCodes) {
  42408. continue;
  42409. }
  42410. for (var i = 0, ii = charCodes.length; i < ii; i++) {
  42411. var charCode = charCodes[i];
  42412. var charCodeToGlyphId = newMapping.charCodeToGlyphId;
  42413. var baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  42414. var accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  42415. seacMap[charCode] = {
  42416. baseFontCharCode: baseFontCharCode,
  42417. accentFontCharCode: accentFontCharCode,
  42418. accentOffset: accentOffset
  42419. };
  42420. }
  42421. }
  42422. properties.seacMap = seacMap;
  42423. }
  42424. var unitsPerEm = 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0];
  42425. var builder = new OpenTypeFileBuilder('\x4F\x54\x54\x4F');
  42426. builder.addTable('CFF ', font.data);
  42427. builder.addTable('OS/2', createOS2Table(properties, newMapping.charCodeToGlyphId));
  42428. builder.addTable('cmap', createCmapTable(newMapping.charCodeToGlyphId, numGlyphs));
  42429. 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');
  42430. 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));
  42431. builder.addTable('hmtx', function fontFieldsHmtx() {
  42432. var charstrings = font.charstrings;
  42433. var cffWidths = font.cff ? font.cff.widths : null;
  42434. var hmtx = '\x00\x00\x00\x00';
  42435. for (var i = 1, ii = numGlyphs; i < ii; i++) {
  42436. var width = 0;
  42437. if (charstrings) {
  42438. var charstring = charstrings[i - 1];
  42439. width = 'width' in charstring ? charstring.width : 0;
  42440. } else if (cffWidths) {
  42441. width = Math.ceil(cffWidths[i] || 0);
  42442. }
  42443. hmtx += string16(width) + string16(0);
  42444. }
  42445. return hmtx;
  42446. }());
  42447. builder.addTable('maxp', '\x00\x00\x50\x00' + string16(numGlyphs));
  42448. builder.addTable('name', createNameTable(fontName));
  42449. builder.addTable('post', createPostTable(properties));
  42450. return builder.toArray();
  42451. },
  42452. get spaceWidth() {
  42453. if ('_shadowWidth' in this) {
  42454. return this._shadowWidth;
  42455. }
  42456. var possibleSpaceReplacements = [
  42457. 'space',
  42458. 'minus',
  42459. 'one',
  42460. 'i',
  42461. 'I'
  42462. ];
  42463. var width;
  42464. for (var i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  42465. var glyphName = possibleSpaceReplacements[i];
  42466. if (glyphName in this.widths) {
  42467. width = this.widths[glyphName];
  42468. break;
  42469. }
  42470. var glyphsUnicodeMap = getGlyphsUnicode();
  42471. var glyphUnicode = glyphsUnicodeMap[glyphName];
  42472. var charcode = 0;
  42473. if (this.composite) {
  42474. if (this.cMap.contains(glyphUnicode)) {
  42475. charcode = this.cMap.lookup(glyphUnicode);
  42476. }
  42477. }
  42478. if (!charcode && this.toUnicode) {
  42479. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  42480. }
  42481. if (charcode <= 0) {
  42482. charcode = glyphUnicode;
  42483. }
  42484. width = this.widths[charcode];
  42485. if (width) {
  42486. break;
  42487. }
  42488. }
  42489. width = width || this.defaultWidth;
  42490. this._shadowWidth = width;
  42491. return width;
  42492. },
  42493. charToGlyph: function Font_charToGlyph(charcode, isSpace) {
  42494. var fontCharCode, width, operatorListId;
  42495. var widthCode = charcode;
  42496. if (this.cMap && this.cMap.contains(charcode)) {
  42497. widthCode = this.cMap.lookup(charcode);
  42498. }
  42499. width = this.widths[widthCode];
  42500. width = isNum(width) ? width : this.defaultWidth;
  42501. var vmetric = this.vmetrics && this.vmetrics[widthCode];
  42502. var unicode = this.toUnicode.get(charcode) || charcode;
  42503. if (typeof unicode === 'number') {
  42504. unicode = String.fromCharCode(unicode);
  42505. }
  42506. var isInFont = charcode in this.toFontChar;
  42507. fontCharCode = this.toFontChar[charcode] || charcode;
  42508. if (this.missingFile) {
  42509. fontCharCode = mapSpecialUnicodeValues(fontCharCode);
  42510. }
  42511. if (this.isType3Font) {
  42512. operatorListId = fontCharCode;
  42513. }
  42514. var accent = null;
  42515. if (this.seacMap && this.seacMap[charcode]) {
  42516. isInFont = true;
  42517. var seac = this.seacMap[charcode];
  42518. fontCharCode = seac.baseFontCharCode;
  42519. accent = {
  42520. fontChar: String.fromCharCode(seac.accentFontCharCode),
  42521. offset: seac.accentOffset
  42522. };
  42523. }
  42524. var fontChar = String.fromCharCode(fontCharCode);
  42525. var glyph = this.glyphCache[charcode];
  42526. if (!glyph || !glyph.matchesForCache(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  42527. glyph = new Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  42528. this.glyphCache[charcode] = glyph;
  42529. }
  42530. return glyph;
  42531. },
  42532. charsToGlyphs: function Font_charsToGlyphs(chars) {
  42533. var charsCache = this.charsCache;
  42534. var glyphs, glyph, charcode;
  42535. if (charsCache) {
  42536. glyphs = charsCache[chars];
  42537. if (glyphs) {
  42538. return glyphs;
  42539. }
  42540. }
  42541. if (!charsCache) {
  42542. charsCache = this.charsCache = Object.create(null);
  42543. }
  42544. glyphs = [];
  42545. var charsCacheKey = chars;
  42546. var i = 0, ii;
  42547. if (this.cMap) {
  42548. var c = Object.create(null);
  42549. while (i < chars.length) {
  42550. this.cMap.readCharCode(chars, i, c);
  42551. charcode = c.charcode;
  42552. var length = c.length;
  42553. i += length;
  42554. var isSpace = length === 1 && chars.charCodeAt(i - 1) === 0x20;
  42555. glyph = this.charToGlyph(charcode, isSpace);
  42556. glyphs.push(glyph);
  42557. }
  42558. } else {
  42559. for (i = 0, ii = chars.length; i < ii; ++i) {
  42560. charcode = chars.charCodeAt(i);
  42561. glyph = this.charToGlyph(charcode, charcode === 0x20);
  42562. glyphs.push(glyph);
  42563. }
  42564. }
  42565. return charsCache[charsCacheKey] = glyphs;
  42566. }
  42567. };
  42568. return Font;
  42569. }();
  42570. var ErrorFont = function ErrorFontClosure() {
  42571. function ErrorFont(error) {
  42572. this.error = error;
  42573. this.loadedName = 'g_font_error';
  42574. this.loading = false;
  42575. }
  42576. ErrorFont.prototype = {
  42577. charsToGlyphs: function ErrorFont_charsToGlyphs() {
  42578. return [];
  42579. },
  42580. exportData: function ErrorFont_exportData() {
  42581. return { error: this.error };
  42582. }
  42583. };
  42584. return ErrorFont;
  42585. }();
  42586. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  42587. var charCodeToGlyphId = Object.create(null);
  42588. var glyphId, charCode, baseEncoding;
  42589. var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  42590. if (properties.baseEncodingName) {
  42591. baseEncoding = getEncoding(properties.baseEncodingName);
  42592. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  42593. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  42594. if (glyphId >= 0) {
  42595. charCodeToGlyphId[charCode] = glyphId;
  42596. } else {
  42597. charCodeToGlyphId[charCode] = 0;
  42598. }
  42599. }
  42600. } else if (isSymbolicFont) {
  42601. for (charCode in builtInEncoding) {
  42602. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  42603. }
  42604. } else {
  42605. baseEncoding = StandardEncoding;
  42606. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  42607. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  42608. if (glyphId >= 0) {
  42609. charCodeToGlyphId[charCode] = glyphId;
  42610. } else {
  42611. charCodeToGlyphId[charCode] = 0;
  42612. }
  42613. }
  42614. }
  42615. var differences = properties.differences, glyphsUnicodeMap;
  42616. if (differences) {
  42617. for (charCode in differences) {
  42618. var glyphName = differences[charCode];
  42619. glyphId = glyphNames.indexOf(glyphName);
  42620. if (glyphId === -1) {
  42621. if (!glyphsUnicodeMap) {
  42622. glyphsUnicodeMap = getGlyphsUnicode();
  42623. }
  42624. var standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  42625. if (standardGlyphName !== glyphName) {
  42626. glyphId = glyphNames.indexOf(standardGlyphName);
  42627. }
  42628. }
  42629. if (glyphId >= 0) {
  42630. charCodeToGlyphId[charCode] = glyphId;
  42631. } else {
  42632. charCodeToGlyphId[charCode] = 0;
  42633. }
  42634. }
  42635. }
  42636. return charCodeToGlyphId;
  42637. }
  42638. var Type1Font = function Type1FontClosure() {
  42639. function findBlock(streamBytes, signature, startIndex) {
  42640. var streamBytesLength = streamBytes.length;
  42641. var signatureLength = signature.length;
  42642. var scanLength = streamBytesLength - signatureLength;
  42643. var i = startIndex, j, found = false;
  42644. while (i < scanLength) {
  42645. j = 0;
  42646. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  42647. j++;
  42648. }
  42649. if (j >= signatureLength) {
  42650. i += j;
  42651. while (i < streamBytesLength && isSpace(streamBytes[i])) {
  42652. i++;
  42653. }
  42654. found = true;
  42655. break;
  42656. }
  42657. i++;
  42658. }
  42659. return {
  42660. found: found,
  42661. length: i
  42662. };
  42663. }
  42664. function getHeaderBlock(stream, suggestedLength) {
  42665. var EEXEC_SIGNATURE = [
  42666. 0x65,
  42667. 0x65,
  42668. 0x78,
  42669. 0x65,
  42670. 0x63
  42671. ];
  42672. var streamStartPos = stream.pos;
  42673. var headerBytes, headerBytesLength, block;
  42674. try {
  42675. headerBytes = stream.getBytes(suggestedLength);
  42676. headerBytesLength = headerBytes.length;
  42677. } catch (ex) {
  42678. if (ex instanceof MissingDataException) {
  42679. throw ex;
  42680. }
  42681. }
  42682. if (headerBytesLength === suggestedLength) {
  42683. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  42684. if (block.found && block.length === suggestedLength) {
  42685. return {
  42686. stream: new Stream(headerBytes),
  42687. length: suggestedLength
  42688. };
  42689. }
  42690. }
  42691. warn('Invalid "Length1" property in Type1 font -- trying to recover.');
  42692. stream.pos = streamStartPos;
  42693. var SCAN_BLOCK_LENGTH = 2048;
  42694. var actualLength;
  42695. while (true) {
  42696. var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  42697. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  42698. if (block.length === 0) {
  42699. break;
  42700. }
  42701. stream.pos += block.length;
  42702. if (block.found) {
  42703. actualLength = stream.pos - streamStartPos;
  42704. break;
  42705. }
  42706. }
  42707. stream.pos = streamStartPos;
  42708. if (actualLength) {
  42709. return {
  42710. stream: new Stream(stream.getBytes(actualLength)),
  42711. length: actualLength
  42712. };
  42713. }
  42714. warn('Unable to recover "Length1" property in Type1 font -- using as is.');
  42715. return {
  42716. stream: new Stream(stream.getBytes(suggestedLength)),
  42717. length: suggestedLength
  42718. };
  42719. }
  42720. function getEexecBlock(stream, suggestedLength) {
  42721. var eexecBytes = stream.getBytes();
  42722. return {
  42723. stream: new Stream(eexecBytes),
  42724. length: eexecBytes.length
  42725. };
  42726. }
  42727. function Type1Font(name, file, properties) {
  42728. var PFB_HEADER_SIZE = 6;
  42729. var headerBlockLength = properties.length1;
  42730. var eexecBlockLength = properties.length2;
  42731. var pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  42732. var pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  42733. if (pfbHeaderPresent) {
  42734. file.skip(PFB_HEADER_SIZE);
  42735. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  42736. }
  42737. var headerBlock = getHeaderBlock(file, headerBlockLength);
  42738. headerBlockLength = headerBlock.length;
  42739. var headerBlockParser = new Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED);
  42740. headerBlockParser.extractFontHeader(properties);
  42741. if (pfbHeaderPresent) {
  42742. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  42743. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  42744. }
  42745. var eexecBlock = getEexecBlock(file, eexecBlockLength);
  42746. eexecBlockLength = eexecBlock.length;
  42747. var eexecBlockParser = new Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED);
  42748. var data = eexecBlockParser.extractFontProgram();
  42749. for (var info in data.properties) {
  42750. properties[info] = data.properties[info];
  42751. }
  42752. var charstrings = data.charstrings;
  42753. var type2Charstrings = this.getType2Charstrings(charstrings);
  42754. var subrs = this.getType2Subrs(data.subrs);
  42755. this.charstrings = charstrings;
  42756. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  42757. this.seacs = this.getSeacs(data.charstrings);
  42758. }
  42759. Type1Font.prototype = {
  42760. get numGlyphs() {
  42761. return this.charstrings.length + 1;
  42762. },
  42763. getCharset: function Type1Font_getCharset() {
  42764. var charset = ['.notdef'];
  42765. var charstrings = this.charstrings;
  42766. for (var glyphId = 0; glyphId < charstrings.length; glyphId++) {
  42767. charset.push(charstrings[glyphId].glyphName);
  42768. }
  42769. return charset;
  42770. },
  42771. getGlyphMapping: function Type1Font_getGlyphMapping(properties) {
  42772. var charstrings = this.charstrings;
  42773. var glyphNames = ['.notdef'], glyphId;
  42774. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  42775. glyphNames.push(charstrings[glyphId].glyphName);
  42776. }
  42777. var encoding = properties.builtInEncoding;
  42778. if (encoding) {
  42779. var builtInEncoding = Object.create(null);
  42780. for (var charCode in encoding) {
  42781. glyphId = glyphNames.indexOf(encoding[charCode]);
  42782. if (glyphId >= 0) {
  42783. builtInEncoding[charCode] = glyphId;
  42784. }
  42785. }
  42786. }
  42787. return type1FontGlyphMapping(properties, builtInEncoding, glyphNames);
  42788. },
  42789. getSeacs: function Type1Font_getSeacs(charstrings) {
  42790. var i, ii;
  42791. var seacMap = [];
  42792. for (i = 0, ii = charstrings.length; i < ii; i++) {
  42793. var charstring = charstrings[i];
  42794. if (charstring.seac) {
  42795. seacMap[i + 1] = charstring.seac;
  42796. }
  42797. }
  42798. return seacMap;
  42799. },
  42800. getType2Charstrings: function Type1Font_getType2Charstrings(type1Charstrings) {
  42801. var type2Charstrings = [];
  42802. for (var i = 0, ii = type1Charstrings.length; i < ii; i++) {
  42803. type2Charstrings.push(type1Charstrings[i].charstring);
  42804. }
  42805. return type2Charstrings;
  42806. },
  42807. getType2Subrs: function Type1Font_getType2Subrs(type1Subrs) {
  42808. var bias = 0;
  42809. var count = type1Subrs.length;
  42810. if (count < 1133) {
  42811. bias = 107;
  42812. } else if (count < 33769) {
  42813. bias = 1131;
  42814. } else {
  42815. bias = 32768;
  42816. }
  42817. var type2Subrs = [];
  42818. var i;
  42819. for (i = 0; i < bias; i++) {
  42820. type2Subrs.push([0x0B]);
  42821. }
  42822. for (i = 0; i < count; i++) {
  42823. type2Subrs.push(type1Subrs[i]);
  42824. }
  42825. return type2Subrs;
  42826. },
  42827. wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) {
  42828. var cff = new CFF();
  42829. cff.header = new CFFHeader(1, 0, 4, 4);
  42830. cff.names = [name];
  42831. var topDict = new CFFTopDict();
  42832. topDict.setByName('version', 391);
  42833. topDict.setByName('Notice', 392);
  42834. topDict.setByName('FullName', 393);
  42835. topDict.setByName('FamilyName', 394);
  42836. topDict.setByName('Weight', 395);
  42837. topDict.setByName('Encoding', null);
  42838. topDict.setByName('FontMatrix', properties.fontMatrix);
  42839. topDict.setByName('FontBBox', properties.bbox);
  42840. topDict.setByName('charset', null);
  42841. topDict.setByName('CharStrings', null);
  42842. topDict.setByName('Private', null);
  42843. cff.topDict = topDict;
  42844. var strings = new CFFStrings();
  42845. strings.add('Version 0.11');
  42846. strings.add('See original notice');
  42847. strings.add(name);
  42848. strings.add(name);
  42849. strings.add('Medium');
  42850. cff.strings = strings;
  42851. cff.globalSubrIndex = new CFFIndex();
  42852. var count = glyphs.length;
  42853. var charsetArray = [0];
  42854. var i, ii;
  42855. for (i = 0; i < count; i++) {
  42856. var index = CFFStandardStrings.indexOf(charstrings[i].glyphName);
  42857. if (index === -1) {
  42858. index = 0;
  42859. }
  42860. charsetArray.push(index >> 8 & 0xff, index & 0xff);
  42861. }
  42862. cff.charset = new CFFCharset(false, 0, [], charsetArray);
  42863. var charStringsIndex = new CFFIndex();
  42864. charStringsIndex.add([
  42865. 0x8B,
  42866. 0x0E
  42867. ]);
  42868. for (i = 0; i < count; i++) {
  42869. var glyph = glyphs[i];
  42870. if (glyph.length === 0) {
  42871. charStringsIndex.add([
  42872. 0x8B,
  42873. 0x0E
  42874. ]);
  42875. continue;
  42876. }
  42877. charStringsIndex.add(glyph);
  42878. }
  42879. cff.charStrings = charStringsIndex;
  42880. var privateDict = new CFFPrivateDict();
  42881. privateDict.setByName('Subrs', null);
  42882. var fields = [
  42883. 'BlueValues',
  42884. 'OtherBlues',
  42885. 'FamilyBlues',
  42886. 'FamilyOtherBlues',
  42887. 'StemSnapH',
  42888. 'StemSnapV',
  42889. 'BlueShift',
  42890. 'BlueFuzz',
  42891. 'BlueScale',
  42892. 'LanguageGroup',
  42893. 'ExpansionFactor',
  42894. 'ForceBold',
  42895. 'StdHW',
  42896. 'StdVW'
  42897. ];
  42898. for (i = 0, ii = fields.length; i < ii; i++) {
  42899. var field = fields[i];
  42900. if (!(field in properties.privateData)) {
  42901. continue;
  42902. }
  42903. var value = properties.privateData[field];
  42904. if (isArray(value)) {
  42905. for (var j = value.length - 1; j > 0; j--) {
  42906. value[j] -= value[j - 1];
  42907. }
  42908. }
  42909. privateDict.setByName(field, value);
  42910. }
  42911. cff.topDict.privateDict = privateDict;
  42912. var subrIndex = new CFFIndex();
  42913. for (i = 0, ii = subrs.length; i < ii; i++) {
  42914. subrIndex.add(subrs[i]);
  42915. }
  42916. privateDict.subrsIndex = subrIndex;
  42917. var compiler = new CFFCompiler(cff);
  42918. return compiler.compile();
  42919. }
  42920. };
  42921. return Type1Font;
  42922. }();
  42923. var CFFFont = function CFFFontClosure() {
  42924. function CFFFont(file, properties) {
  42925. this.properties = properties;
  42926. var parser = new CFFParser(file, properties, SEAC_ANALYSIS_ENABLED);
  42927. this.cff = parser.parse();
  42928. var compiler = new CFFCompiler(this.cff);
  42929. this.seacs = this.cff.seacs;
  42930. try {
  42931. this.data = compiler.compile();
  42932. } catch (e) {
  42933. warn('Failed to compile font ' + properties.loadedName);
  42934. this.data = file;
  42935. }
  42936. }
  42937. CFFFont.prototype = {
  42938. get numGlyphs() {
  42939. return this.cff.charStrings.count;
  42940. },
  42941. getCharset: function CFFFont_getCharset() {
  42942. return this.cff.charset.charset;
  42943. },
  42944. getGlyphMapping: function CFFFont_getGlyphMapping() {
  42945. var cff = this.cff;
  42946. var properties = this.properties;
  42947. var charsets = cff.charset.charset;
  42948. var charCodeToGlyphId;
  42949. var glyphId;
  42950. if (properties.composite) {
  42951. charCodeToGlyphId = Object.create(null);
  42952. if (cff.isCIDFont) {
  42953. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  42954. var cid = charsets[glyphId];
  42955. var charCode = properties.cMap.charCodeOf(cid);
  42956. charCodeToGlyphId[charCode] = glyphId;
  42957. }
  42958. } else {
  42959. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  42960. charCodeToGlyphId[glyphId] = glyphId;
  42961. }
  42962. }
  42963. return charCodeToGlyphId;
  42964. }
  42965. var encoding = cff.encoding ? cff.encoding.encoding : null;
  42966. charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets);
  42967. return charCodeToGlyphId;
  42968. }
  42969. };
  42970. return CFFFont;
  42971. }();
  42972. (function checkSeacSupport() {
  42973. if (typeof navigator !== 'undefined' && /Windows/.test(navigator.userAgent)) {
  42974. SEAC_ANALYSIS_ENABLED = true;
  42975. }
  42976. }());
  42977. (function checkChromeWindows() {
  42978. if (typeof navigator !== 'undefined' && /Windows.*Chrome/.test(navigator.userAgent)) {
  42979. SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = true;
  42980. }
  42981. }());
  42982. exports.ErrorFont = ErrorFont;
  42983. exports.Font = Font;
  42984. exports.FontFlags = FontFlags;
  42985. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  42986. exports.ToUnicodeMap = ToUnicodeMap;
  42987. exports.getFontType = getFontType;
  42988. /***/ }),
  42989. /* 28 */
  42990. /***/ (function(module, exports, __w_pdfjs_require__) {
  42991. "use strict";
  42992. var sharedUtil = __w_pdfjs_require__(0);
  42993. var corePrimitives = __w_pdfjs_require__(1);
  42994. var coreColorSpace = __w_pdfjs_require__(3);
  42995. var coreStream = __w_pdfjs_require__(2);
  42996. var coreJpx = __w_pdfjs_require__(14);
  42997. var ImageKind = sharedUtil.ImageKind;
  42998. var assert = sharedUtil.assert;
  42999. var error = sharedUtil.error;
  43000. var info = sharedUtil.info;
  43001. var isArray = sharedUtil.isArray;
  43002. var warn = sharedUtil.warn;
  43003. var Name = corePrimitives.Name;
  43004. var isStream = corePrimitives.isStream;
  43005. var ColorSpace = coreColorSpace.ColorSpace;
  43006. var DecodeStream = coreStream.DecodeStream;
  43007. var JpegStream = coreStream.JpegStream;
  43008. var JpxImage = coreJpx.JpxImage;
  43009. var PDFImage = function PDFImageClosure() {
  43010. function handleImageData(image, nativeDecoder) {
  43011. if (nativeDecoder && nativeDecoder.canDecode(image)) {
  43012. return nativeDecoder.decode(image);
  43013. }
  43014. return Promise.resolve(image);
  43015. }
  43016. function decodeAndClamp(value, addend, coefficient, max) {
  43017. value = addend + value * coefficient;
  43018. return value < 0 ? 0 : value > max ? max : value;
  43019. }
  43020. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  43021. var length = w2 * h2;
  43022. var dest = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
  43023. var xRatio = w1 / w2;
  43024. var yRatio = h1 / h2;
  43025. var i, j, py, newIndex = 0, oldIndex;
  43026. var xScaled = new Uint16Array(w2);
  43027. var w1Scanline = w1;
  43028. for (i = 0; i < w2; i++) {
  43029. xScaled[i] = Math.floor(i * xRatio);
  43030. }
  43031. for (i = 0; i < h2; i++) {
  43032. py = Math.floor(i * yRatio) * w1Scanline;
  43033. for (j = 0; j < w2; j++) {
  43034. oldIndex = py + xScaled[j];
  43035. dest[newIndex++] = src[oldIndex];
  43036. }
  43037. }
  43038. return dest;
  43039. }
  43040. function PDFImage(xref, res, image, inline, smask, mask, isMask) {
  43041. this.image = image;
  43042. var dict = image.dict;
  43043. if (dict.has('Filter')) {
  43044. var filter = dict.get('Filter').name;
  43045. if (filter === 'JPXDecode') {
  43046. var jpxImage = new JpxImage();
  43047. jpxImage.parseImageProperties(image.stream);
  43048. image.stream.reset();
  43049. image.bitsPerComponent = jpxImage.bitsPerComponent;
  43050. image.numComps = jpxImage.componentsCount;
  43051. } else if (filter === 'JBIG2Decode') {
  43052. image.bitsPerComponent = 1;
  43053. image.numComps = 1;
  43054. }
  43055. }
  43056. this.width = dict.get('Width', 'W');
  43057. this.height = dict.get('Height', 'H');
  43058. if (this.width < 1 || this.height < 1) {
  43059. error('Invalid image width: ' + this.width + ' or height: ' + this.height);
  43060. }
  43061. this.interpolate = dict.get('Interpolate', 'I') || false;
  43062. this.imageMask = dict.get('ImageMask', 'IM') || false;
  43063. this.matte = dict.get('Matte') || false;
  43064. var bitsPerComponent = image.bitsPerComponent;
  43065. if (!bitsPerComponent) {
  43066. bitsPerComponent = dict.get('BitsPerComponent', 'BPC');
  43067. if (!bitsPerComponent) {
  43068. if (this.imageMask) {
  43069. bitsPerComponent = 1;
  43070. } else {
  43071. error('Bits per component missing in image: ' + this.imageMask);
  43072. }
  43073. }
  43074. }
  43075. this.bpc = bitsPerComponent;
  43076. if (!this.imageMask) {
  43077. var colorSpace = dict.get('ColorSpace', 'CS');
  43078. if (!colorSpace) {
  43079. info('JPX images (which do not require color spaces)');
  43080. switch (image.numComps) {
  43081. case 1:
  43082. colorSpace = Name.get('DeviceGray');
  43083. break;
  43084. case 3:
  43085. colorSpace = Name.get('DeviceRGB');
  43086. break;
  43087. case 4:
  43088. colorSpace = Name.get('DeviceCMYK');
  43089. break;
  43090. default:
  43091. error('JPX images with ' + this.numComps + ' color components not supported.');
  43092. }
  43093. }
  43094. this.colorSpace = ColorSpace.parse(colorSpace, xref, res);
  43095. this.numComps = this.colorSpace.numComps;
  43096. }
  43097. this.decode = dict.getArray('Decode', 'D');
  43098. this.needsDecode = false;
  43099. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode) || isMask && !ColorSpace.isDefaultDecode(this.decode, 1))) {
  43100. this.needsDecode = true;
  43101. var max = (1 << bitsPerComponent) - 1;
  43102. this.decodeCoefficients = [];
  43103. this.decodeAddends = [];
  43104. for (var i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  43105. var dmin = this.decode[i];
  43106. var dmax = this.decode[i + 1];
  43107. this.decodeCoefficients[j] = dmax - dmin;
  43108. this.decodeAddends[j] = max * dmin;
  43109. }
  43110. }
  43111. if (smask) {
  43112. this.smask = new PDFImage(xref, res, smask, false);
  43113. } else if (mask) {
  43114. if (isStream(mask)) {
  43115. var maskDict = mask.dict, imageMask = maskDict.get('ImageMask', 'IM');
  43116. if (!imageMask) {
  43117. warn('Ignoring /Mask in image without /ImageMask.');
  43118. } else {
  43119. this.mask = new PDFImage(xref, res, mask, false, null, null, true);
  43120. }
  43121. } else {
  43122. this.mask = mask;
  43123. }
  43124. }
  43125. }
  43126. PDFImage.buildImage = function PDFImage_buildImage(handler, xref, res, image, inline, nativeDecoder) {
  43127. var imagePromise = handleImageData(image, nativeDecoder);
  43128. var smaskPromise;
  43129. var maskPromise;
  43130. var smask = image.dict.get('SMask');
  43131. var mask = image.dict.get('Mask');
  43132. if (smask) {
  43133. smaskPromise = handleImageData(smask, nativeDecoder);
  43134. maskPromise = Promise.resolve(null);
  43135. } else {
  43136. smaskPromise = Promise.resolve(null);
  43137. if (mask) {
  43138. if (isStream(mask)) {
  43139. maskPromise = handleImageData(mask, nativeDecoder);
  43140. } else if (isArray(mask)) {
  43141. maskPromise = Promise.resolve(mask);
  43142. } else {
  43143. warn('Unsupported mask format.');
  43144. maskPromise = Promise.resolve(null);
  43145. }
  43146. } else {
  43147. maskPromise = Promise.resolve(null);
  43148. }
  43149. }
  43150. return Promise.all([
  43151. imagePromise,
  43152. smaskPromise,
  43153. maskPromise
  43154. ]).then(function (results) {
  43155. var imageData = results[0];
  43156. var smaskData = results[1];
  43157. var maskData = results[2];
  43158. return new PDFImage(xref, res, imageData, inline, smaskData, maskData);
  43159. });
  43160. };
  43161. PDFImage.createMask = function PDFImage_createMask(imgArray, width, height, imageIsFromDecodeStream, inverseDecode) {
  43162. var computedLength = (width + 7 >> 3) * height;
  43163. var actualLength = imgArray.byteLength;
  43164. var haveFullData = computedLength === actualLength;
  43165. var data, i;
  43166. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  43167. data = imgArray;
  43168. } else if (!inverseDecode) {
  43169. data = new Uint8Array(actualLength);
  43170. data.set(imgArray);
  43171. } else {
  43172. data = new Uint8Array(computedLength);
  43173. data.set(imgArray);
  43174. for (i = actualLength; i < computedLength; i++) {
  43175. data[i] = 0xff;
  43176. }
  43177. }
  43178. if (inverseDecode) {
  43179. for (i = 0; i < actualLength; i++) {
  43180. data[i] = ~data[i];
  43181. }
  43182. }
  43183. return {
  43184. data: data,
  43185. width: width,
  43186. height: height
  43187. };
  43188. };
  43189. PDFImage.prototype = {
  43190. get drawWidth() {
  43191. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  43192. },
  43193. get drawHeight() {
  43194. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  43195. },
  43196. decodeBuffer: function PDFImage_decodeBuffer(buffer) {
  43197. var bpc = this.bpc;
  43198. var numComps = this.numComps;
  43199. var decodeAddends = this.decodeAddends;
  43200. var decodeCoefficients = this.decodeCoefficients;
  43201. var max = (1 << bpc) - 1;
  43202. var i, ii;
  43203. if (bpc === 1) {
  43204. for (i = 0, ii = buffer.length; i < ii; i++) {
  43205. buffer[i] = +!buffer[i];
  43206. }
  43207. return;
  43208. }
  43209. var index = 0;
  43210. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  43211. for (var j = 0; j < numComps; j++) {
  43212. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  43213. index++;
  43214. }
  43215. }
  43216. },
  43217. getComponents: function PDFImage_getComponents(buffer) {
  43218. var bpc = this.bpc;
  43219. if (bpc === 8) {
  43220. return buffer;
  43221. }
  43222. var width = this.width;
  43223. var height = this.height;
  43224. var numComps = this.numComps;
  43225. var length = width * height * numComps;
  43226. var bufferPos = 0;
  43227. var output = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
  43228. var rowComps = width * numComps;
  43229. var max = (1 << bpc) - 1;
  43230. var i = 0, ii, buf;
  43231. if (bpc === 1) {
  43232. var mask, loop1End, loop2End;
  43233. for (var j = 0; j < height; j++) {
  43234. loop1End = i + (rowComps & ~7);
  43235. loop2End = i + rowComps;
  43236. while (i < loop1End) {
  43237. buf = buffer[bufferPos++];
  43238. output[i] = buf >> 7 & 1;
  43239. output[i + 1] = buf >> 6 & 1;
  43240. output[i + 2] = buf >> 5 & 1;
  43241. output[i + 3] = buf >> 4 & 1;
  43242. output[i + 4] = buf >> 3 & 1;
  43243. output[i + 5] = buf >> 2 & 1;
  43244. output[i + 6] = buf >> 1 & 1;
  43245. output[i + 7] = buf & 1;
  43246. i += 8;
  43247. }
  43248. if (i < loop2End) {
  43249. buf = buffer[bufferPos++];
  43250. mask = 128;
  43251. while (i < loop2End) {
  43252. output[i++] = +!!(buf & mask);
  43253. mask >>= 1;
  43254. }
  43255. }
  43256. }
  43257. } else {
  43258. var bits = 0;
  43259. buf = 0;
  43260. for (i = 0, ii = length; i < ii; ++i) {
  43261. if (i % rowComps === 0) {
  43262. buf = 0;
  43263. bits = 0;
  43264. }
  43265. while (bits < bpc) {
  43266. buf = buf << 8 | buffer[bufferPos++];
  43267. bits += 8;
  43268. }
  43269. var remainingBits = bits - bpc;
  43270. var value = buf >> remainingBits;
  43271. output[i] = value < 0 ? 0 : value > max ? max : value;
  43272. buf = buf & (1 << remainingBits) - 1;
  43273. bits = remainingBits;
  43274. }
  43275. }
  43276. return output;
  43277. },
  43278. fillOpacity: function PDFImage_fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  43279. var smask = this.smask;
  43280. var mask = this.mask;
  43281. var alphaBuf, sw, sh, i, ii, j;
  43282. if (smask) {
  43283. sw = smask.width;
  43284. sh = smask.height;
  43285. alphaBuf = new Uint8Array(sw * sh);
  43286. smask.fillGrayBuffer(alphaBuf);
  43287. if (sw !== width || sh !== height) {
  43288. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  43289. }
  43290. } else if (mask) {
  43291. if (mask instanceof PDFImage) {
  43292. sw = mask.width;
  43293. sh = mask.height;
  43294. alphaBuf = new Uint8Array(sw * sh);
  43295. mask.numComps = 1;
  43296. mask.fillGrayBuffer(alphaBuf);
  43297. for (i = 0, ii = sw * sh; i < ii; ++i) {
  43298. alphaBuf[i] = 255 - alphaBuf[i];
  43299. }
  43300. if (sw !== width || sh !== height) {
  43301. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  43302. }
  43303. } else if (isArray(mask)) {
  43304. alphaBuf = new Uint8Array(width * height);
  43305. var numComps = this.numComps;
  43306. for (i = 0, ii = width * height; i < ii; ++i) {
  43307. var opacity = 0;
  43308. var imageOffset = i * numComps;
  43309. for (j = 0; j < numComps; ++j) {
  43310. var color = image[imageOffset + j];
  43311. var maskOffset = j * 2;
  43312. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  43313. opacity = 255;
  43314. break;
  43315. }
  43316. }
  43317. alphaBuf[i] = opacity;
  43318. }
  43319. } else {
  43320. error('Unknown mask format.');
  43321. }
  43322. }
  43323. if (alphaBuf) {
  43324. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  43325. rgbaBuf[j] = alphaBuf[i];
  43326. }
  43327. } else {
  43328. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  43329. rgbaBuf[j] = 255;
  43330. }
  43331. }
  43332. },
  43333. undoPreblend: function PDFImage_undoPreblend(buffer, width, height) {
  43334. var matte = this.smask && this.smask.matte;
  43335. if (!matte) {
  43336. return;
  43337. }
  43338. var matteRgb = this.colorSpace.getRgb(matte, 0);
  43339. var matteR = matteRgb[0];
  43340. var matteG = matteRgb[1];
  43341. var matteB = matteRgb[2];
  43342. var length = width * height * 4;
  43343. var r, g, b;
  43344. for (var i = 0; i < length; i += 4) {
  43345. var alpha = buffer[i + 3];
  43346. if (alpha === 0) {
  43347. buffer[i] = 255;
  43348. buffer[i + 1] = 255;
  43349. buffer[i + 2] = 255;
  43350. continue;
  43351. }
  43352. var k = 255 / alpha;
  43353. r = (buffer[i] - matteR) * k + matteR;
  43354. g = (buffer[i + 1] - matteG) * k + matteG;
  43355. b = (buffer[i + 2] - matteB) * k + matteB;
  43356. buffer[i] = r <= 0 ? 0 : r >= 255 ? 255 : r | 0;
  43357. buffer[i + 1] = g <= 0 ? 0 : g >= 255 ? 255 : g | 0;
  43358. buffer[i + 2] = b <= 0 ? 0 : b >= 255 ? 255 : b | 0;
  43359. }
  43360. },
  43361. createImageData: function PDFImage_createImageData(forceRGBA) {
  43362. var drawWidth = this.drawWidth;
  43363. var drawHeight = this.drawHeight;
  43364. var imgData = {
  43365. width: drawWidth,
  43366. height: drawHeight
  43367. };
  43368. var numComps = this.numComps;
  43369. var originalWidth = this.width;
  43370. var originalHeight = this.height;
  43371. var bpc = this.bpc;
  43372. var rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  43373. var imgArray;
  43374. if (!forceRGBA) {
  43375. var kind;
  43376. if (this.colorSpace.name === 'DeviceGray' && bpc === 1) {
  43377. kind = ImageKind.GRAYSCALE_1BPP;
  43378. } else if (this.colorSpace.name === 'DeviceRGB' && bpc === 8 && !this.needsDecode) {
  43379. kind = ImageKind.RGB_24BPP;
  43380. }
  43381. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  43382. imgData.kind = kind;
  43383. imgArray = this.getImageBytes(originalHeight * rowBytes);
  43384. if (this.image instanceof DecodeStream) {
  43385. imgData.data = imgArray;
  43386. } else {
  43387. var newArray = new Uint8Array(imgArray.length);
  43388. newArray.set(imgArray);
  43389. imgData.data = newArray;
  43390. }
  43391. if (this.needsDecode) {
  43392. assert(kind === ImageKind.GRAYSCALE_1BPP);
  43393. var buffer = imgData.data;
  43394. for (var i = 0, ii = buffer.length; i < ii; i++) {
  43395. buffer[i] ^= 0xff;
  43396. }
  43397. }
  43398. return imgData;
  43399. }
  43400. if (this.image instanceof JpegStream && !this.smask && !this.mask && (this.colorSpace.name === 'DeviceGray' || this.colorSpace.name === 'DeviceRGB' || this.colorSpace.name === 'DeviceCMYK')) {
  43401. imgData.kind = ImageKind.RGB_24BPP;
  43402. imgData.data = this.getImageBytes(originalHeight * rowBytes, drawWidth, drawHeight, true);
  43403. return imgData;
  43404. }
  43405. }
  43406. imgArray = this.getImageBytes(originalHeight * rowBytes);
  43407. var actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  43408. var comps = this.getComponents(imgArray);
  43409. var alpha01, maybeUndoPreblend;
  43410. if (!forceRGBA && !this.smask && !this.mask) {
  43411. imgData.kind = ImageKind.RGB_24BPP;
  43412. imgData.data = new Uint8Array(drawWidth * drawHeight * 3);
  43413. alpha01 = 0;
  43414. maybeUndoPreblend = false;
  43415. } else {
  43416. imgData.kind = ImageKind.RGBA_32BPP;
  43417. imgData.data = new Uint8Array(drawWidth * drawHeight * 4);
  43418. alpha01 = 1;
  43419. maybeUndoPreblend = true;
  43420. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  43421. }
  43422. if (this.needsDecode) {
  43423. this.decodeBuffer(comps);
  43424. }
  43425. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  43426. if (maybeUndoPreblend) {
  43427. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  43428. }
  43429. return imgData;
  43430. },
  43431. fillGrayBuffer: function PDFImage_fillGrayBuffer(buffer) {
  43432. var numComps = this.numComps;
  43433. if (numComps !== 1) {
  43434. error('Reading gray scale from a color image: ' + numComps);
  43435. }
  43436. var width = this.width;
  43437. var height = this.height;
  43438. var bpc = this.bpc;
  43439. var rowBytes = width * numComps * bpc + 7 >> 3;
  43440. var imgArray = this.getImageBytes(height * rowBytes);
  43441. var comps = this.getComponents(imgArray);
  43442. var i, length;
  43443. if (bpc === 1) {
  43444. length = width * height;
  43445. if (this.needsDecode) {
  43446. for (i = 0; i < length; ++i) {
  43447. buffer[i] = comps[i] - 1 & 255;
  43448. }
  43449. } else {
  43450. for (i = 0; i < length; ++i) {
  43451. buffer[i] = -comps[i] & 255;
  43452. }
  43453. }
  43454. return;
  43455. }
  43456. if (this.needsDecode) {
  43457. this.decodeBuffer(comps);
  43458. }
  43459. length = width * height;
  43460. var scale = 255 / ((1 << bpc) - 1);
  43461. for (i = 0; i < length; ++i) {
  43462. buffer[i] = scale * comps[i] | 0;
  43463. }
  43464. },
  43465. getImageBytes: function PDFImage_getImageBytes(length, drawWidth, drawHeight, forceRGB) {
  43466. this.image.reset();
  43467. this.image.drawWidth = drawWidth || this.width;
  43468. this.image.drawHeight = drawHeight || this.height;
  43469. this.image.forceRGB = !!forceRGB;
  43470. return this.image.getBytes(length);
  43471. }
  43472. };
  43473. return PDFImage;
  43474. }();
  43475. exports.PDFImage = PDFImage;
  43476. /***/ }),
  43477. /* 29 */
  43478. /***/ (function(module, exports, __w_pdfjs_require__) {
  43479. "use strict";
  43480. var sharedUtil = __w_pdfjs_require__(0);
  43481. var coreArithmeticDecoder = __w_pdfjs_require__(9);
  43482. var error = sharedUtil.error;
  43483. var log2 = sharedUtil.log2;
  43484. var readInt8 = sharedUtil.readInt8;
  43485. var readUint16 = sharedUtil.readUint16;
  43486. var readUint32 = sharedUtil.readUint32;
  43487. var shadow = sharedUtil.shadow;
  43488. var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder;
  43489. var Jbig2Image = function Jbig2ImageClosure() {
  43490. function ContextCache() {
  43491. }
  43492. ContextCache.prototype = {
  43493. getContexts: function (id) {
  43494. if (id in this) {
  43495. return this[id];
  43496. }
  43497. return this[id] = new Int8Array(1 << 16);
  43498. }
  43499. };
  43500. function DecodingContext(data, start, end) {
  43501. this.data = data;
  43502. this.start = start;
  43503. this.end = end;
  43504. }
  43505. DecodingContext.prototype = {
  43506. get decoder() {
  43507. var decoder = new ArithmeticDecoder(this.data, this.start, this.end);
  43508. return shadow(this, 'decoder', decoder);
  43509. },
  43510. get contextCache() {
  43511. var cache = new ContextCache();
  43512. return shadow(this, 'contextCache', cache);
  43513. }
  43514. };
  43515. function decodeInteger(contextCache, procedure, decoder) {
  43516. var contexts = contextCache.getContexts(procedure);
  43517. var prev = 1;
  43518. function readBits(length) {
  43519. var v = 0;
  43520. for (var i = 0; i < length; i++) {
  43521. var bit = decoder.readBit(contexts, prev);
  43522. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  43523. v = v << 1 | bit;
  43524. }
  43525. return v >>> 0;
  43526. }
  43527. var sign = readBits(1);
  43528. 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);
  43529. return sign === 0 ? value : value > 0 ? -value : null;
  43530. }
  43531. function decodeIAID(contextCache, decoder, codeLength) {
  43532. var contexts = contextCache.getContexts('IAID');
  43533. var prev = 1;
  43534. for (var i = 0; i < codeLength; i++) {
  43535. var bit = decoder.readBit(contexts, prev);
  43536. prev = prev << 1 | bit;
  43537. }
  43538. if (codeLength < 31) {
  43539. return prev & (1 << codeLength) - 1;
  43540. }
  43541. return prev & 0x7FFFFFFF;
  43542. }
  43543. var SegmentTypes = [
  43544. 'SymbolDictionary',
  43545. null,
  43546. null,
  43547. null,
  43548. 'IntermediateTextRegion',
  43549. null,
  43550. 'ImmediateTextRegion',
  43551. 'ImmediateLosslessTextRegion',
  43552. null,
  43553. null,
  43554. null,
  43555. null,
  43556. null,
  43557. null,
  43558. null,
  43559. null,
  43560. 'patternDictionary',
  43561. null,
  43562. null,
  43563. null,
  43564. 'IntermediateHalftoneRegion',
  43565. null,
  43566. 'ImmediateHalftoneRegion',
  43567. 'ImmediateLosslessHalftoneRegion',
  43568. null,
  43569. null,
  43570. null,
  43571. null,
  43572. null,
  43573. null,
  43574. null,
  43575. null,
  43576. null,
  43577. null,
  43578. null,
  43579. null,
  43580. 'IntermediateGenericRegion',
  43581. null,
  43582. 'ImmediateGenericRegion',
  43583. 'ImmediateLosslessGenericRegion',
  43584. 'IntermediateGenericRefinementRegion',
  43585. null,
  43586. 'ImmediateGenericRefinementRegion',
  43587. 'ImmediateLosslessGenericRefinementRegion',
  43588. null,
  43589. null,
  43590. null,
  43591. null,
  43592. 'PageInformation',
  43593. 'EndOfPage',
  43594. 'EndOfStripe',
  43595. 'EndOfFile',
  43596. 'Profiles',
  43597. 'Tables',
  43598. null,
  43599. null,
  43600. null,
  43601. null,
  43602. null,
  43603. null,
  43604. null,
  43605. null,
  43606. 'Extension'
  43607. ];
  43608. var CodingTemplates = [
  43609. [
  43610. {
  43611. x: -1,
  43612. y: -2
  43613. },
  43614. {
  43615. x: 0,
  43616. y: -2
  43617. },
  43618. {
  43619. x: 1,
  43620. y: -2
  43621. },
  43622. {
  43623. x: -2,
  43624. y: -1
  43625. },
  43626. {
  43627. x: -1,
  43628. y: -1
  43629. },
  43630. {
  43631. x: 0,
  43632. y: -1
  43633. },
  43634. {
  43635. x: 1,
  43636. y: -1
  43637. },
  43638. {
  43639. x: 2,
  43640. y: -1
  43641. },
  43642. {
  43643. x: -4,
  43644. y: 0
  43645. },
  43646. {
  43647. x: -3,
  43648. y: 0
  43649. },
  43650. {
  43651. x: -2,
  43652. y: 0
  43653. },
  43654. {
  43655. x: -1,
  43656. y: 0
  43657. }
  43658. ],
  43659. [
  43660. {
  43661. x: -1,
  43662. y: -2
  43663. },
  43664. {
  43665. x: 0,
  43666. y: -2
  43667. },
  43668. {
  43669. x: 1,
  43670. y: -2
  43671. },
  43672. {
  43673. x: 2,
  43674. y: -2
  43675. },
  43676. {
  43677. x: -2,
  43678. y: -1
  43679. },
  43680. {
  43681. x: -1,
  43682. y: -1
  43683. },
  43684. {
  43685. x: 0,
  43686. y: -1
  43687. },
  43688. {
  43689. x: 1,
  43690. y: -1
  43691. },
  43692. {
  43693. x: 2,
  43694. y: -1
  43695. },
  43696. {
  43697. x: -3,
  43698. y: 0
  43699. },
  43700. {
  43701. x: -2,
  43702. y: 0
  43703. },
  43704. {
  43705. x: -1,
  43706. y: 0
  43707. }
  43708. ],
  43709. [
  43710. {
  43711. x: -1,
  43712. y: -2
  43713. },
  43714. {
  43715. x: 0,
  43716. y: -2
  43717. },
  43718. {
  43719. x: 1,
  43720. y: -2
  43721. },
  43722. {
  43723. x: -2,
  43724. y: -1
  43725. },
  43726. {
  43727. x: -1,
  43728. y: -1
  43729. },
  43730. {
  43731. x: 0,
  43732. y: -1
  43733. },
  43734. {
  43735. x: 1,
  43736. y: -1
  43737. },
  43738. {
  43739. x: -2,
  43740. y: 0
  43741. },
  43742. {
  43743. x: -1,
  43744. y: 0
  43745. }
  43746. ],
  43747. [
  43748. {
  43749. x: -3,
  43750. y: -1
  43751. },
  43752. {
  43753. x: -2,
  43754. y: -1
  43755. },
  43756. {
  43757. x: -1,
  43758. y: -1
  43759. },
  43760. {
  43761. x: 0,
  43762. y: -1
  43763. },
  43764. {
  43765. x: 1,
  43766. y: -1
  43767. },
  43768. {
  43769. x: -4,
  43770. y: 0
  43771. },
  43772. {
  43773. x: -3,
  43774. y: 0
  43775. },
  43776. {
  43777. x: -2,
  43778. y: 0
  43779. },
  43780. {
  43781. x: -1,
  43782. y: 0
  43783. }
  43784. ]
  43785. ];
  43786. var RefinementTemplates = [
  43787. {
  43788. coding: [
  43789. {
  43790. x: 0,
  43791. y: -1
  43792. },
  43793. {
  43794. x: 1,
  43795. y: -1
  43796. },
  43797. {
  43798. x: -1,
  43799. y: 0
  43800. }
  43801. ],
  43802. reference: [
  43803. {
  43804. x: 0,
  43805. y: -1
  43806. },
  43807. {
  43808. x: 1,
  43809. y: -1
  43810. },
  43811. {
  43812. x: -1,
  43813. y: 0
  43814. },
  43815. {
  43816. x: 0,
  43817. y: 0
  43818. },
  43819. {
  43820. x: 1,
  43821. y: 0
  43822. },
  43823. {
  43824. x: -1,
  43825. y: 1
  43826. },
  43827. {
  43828. x: 0,
  43829. y: 1
  43830. },
  43831. {
  43832. x: 1,
  43833. y: 1
  43834. }
  43835. ]
  43836. },
  43837. {
  43838. coding: [
  43839. {
  43840. x: -1,
  43841. y: -1
  43842. },
  43843. {
  43844. x: 0,
  43845. y: -1
  43846. },
  43847. {
  43848. x: 1,
  43849. y: -1
  43850. },
  43851. {
  43852. x: -1,
  43853. y: 0
  43854. }
  43855. ],
  43856. reference: [
  43857. {
  43858. x: 0,
  43859. y: -1
  43860. },
  43861. {
  43862. x: -1,
  43863. y: 0
  43864. },
  43865. {
  43866. x: 0,
  43867. y: 0
  43868. },
  43869. {
  43870. x: 1,
  43871. y: 0
  43872. },
  43873. {
  43874. x: 0,
  43875. y: 1
  43876. },
  43877. {
  43878. x: 1,
  43879. y: 1
  43880. }
  43881. ]
  43882. }
  43883. ];
  43884. var ReusedContexts = [
  43885. 0x9B25,
  43886. 0x0795,
  43887. 0x00E5,
  43888. 0x0195
  43889. ];
  43890. var RefinementReusedContexts = [
  43891. 0x0020,
  43892. 0x0008
  43893. ];
  43894. function decodeBitmapTemplate0(width, height, decodingContext) {
  43895. var decoder = decodingContext.decoder;
  43896. var contexts = decodingContext.contextCache.getContexts('GB');
  43897. var contextLabel, i, j, pixel, row, row1, row2, bitmap = [];
  43898. var OLD_PIXEL_MASK = 0x7BF7;
  43899. for (i = 0; i < height; i++) {
  43900. row = bitmap[i] = new Uint8Array(width);
  43901. row1 = i < 1 ? row : bitmap[i - 1];
  43902. row2 = i < 2 ? row : bitmap[i - 2];
  43903. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  43904. for (j = 0; j < width; j++) {
  43905. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  43906. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  43907. }
  43908. }
  43909. return bitmap;
  43910. }
  43911. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  43912. if (mmr) {
  43913. error('JBIG2 error: MMR encoding is not supported');
  43914. }
  43915. 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) {
  43916. return decodeBitmapTemplate0(width, height, decodingContext);
  43917. }
  43918. var useskip = !!skip;
  43919. var template = CodingTemplates[templateIndex].concat(at);
  43920. template.sort(function (a, b) {
  43921. return a.y - b.y || a.x - b.x;
  43922. });
  43923. var templateLength = template.length;
  43924. var templateX = new Int8Array(templateLength);
  43925. var templateY = new Int8Array(templateLength);
  43926. var changingTemplateEntries = [];
  43927. var reuseMask = 0, minX = 0, maxX = 0, minY = 0;
  43928. var c, k;
  43929. for (k = 0; k < templateLength; k++) {
  43930. templateX[k] = template[k].x;
  43931. templateY[k] = template[k].y;
  43932. minX = Math.min(minX, template[k].x);
  43933. maxX = Math.max(maxX, template[k].x);
  43934. minY = Math.min(minY, template[k].y);
  43935. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  43936. reuseMask |= 1 << templateLength - 1 - k;
  43937. } else {
  43938. changingTemplateEntries.push(k);
  43939. }
  43940. }
  43941. var changingEntriesLength = changingTemplateEntries.length;
  43942. var changingTemplateX = new Int8Array(changingEntriesLength);
  43943. var changingTemplateY = new Int8Array(changingEntriesLength);
  43944. var changingTemplateBit = new Uint16Array(changingEntriesLength);
  43945. for (c = 0; c < changingEntriesLength; c++) {
  43946. k = changingTemplateEntries[c];
  43947. changingTemplateX[c] = template[k].x;
  43948. changingTemplateY[c] = template[k].y;
  43949. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  43950. }
  43951. var sbb_left = -minX;
  43952. var sbb_top = -minY;
  43953. var sbb_right = width - maxX;
  43954. var pseudoPixelContext = ReusedContexts[templateIndex];
  43955. var row = new Uint8Array(width);
  43956. var bitmap = [];
  43957. var decoder = decodingContext.decoder;
  43958. var contexts = decodingContext.contextCache.getContexts('GB');
  43959. var ltp = 0, j, i0, j0, contextLabel = 0, bit, shift;
  43960. for (var i = 0; i < height; i++) {
  43961. if (prediction) {
  43962. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  43963. ltp ^= sltp;
  43964. if (ltp) {
  43965. bitmap.push(row);
  43966. continue;
  43967. }
  43968. }
  43969. row = new Uint8Array(row);
  43970. bitmap.push(row);
  43971. for (j = 0; j < width; j++) {
  43972. if (useskip && skip[i][j]) {
  43973. row[j] = 0;
  43974. continue;
  43975. }
  43976. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  43977. contextLabel = contextLabel << 1 & reuseMask;
  43978. for (k = 0; k < changingEntriesLength; k++) {
  43979. i0 = i + changingTemplateY[k];
  43980. j0 = j + changingTemplateX[k];
  43981. bit = bitmap[i0][j0];
  43982. if (bit) {
  43983. bit = changingTemplateBit[k];
  43984. contextLabel |= bit;
  43985. }
  43986. }
  43987. } else {
  43988. contextLabel = 0;
  43989. shift = templateLength - 1;
  43990. for (k = 0; k < templateLength; k++, shift--) {
  43991. j0 = j + templateX[k];
  43992. if (j0 >= 0 && j0 < width) {
  43993. i0 = i + templateY[k];
  43994. if (i0 >= 0) {
  43995. bit = bitmap[i0][j0];
  43996. if (bit) {
  43997. contextLabel |= bit << shift;
  43998. }
  43999. }
  44000. }
  44001. }
  44002. }
  44003. var pixel = decoder.readBit(contexts, contextLabel);
  44004. row[j] = pixel;
  44005. }
  44006. }
  44007. return bitmap;
  44008. }
  44009. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  44010. var codingTemplate = RefinementTemplates[templateIndex].coding;
  44011. if (templateIndex === 0) {
  44012. codingTemplate = codingTemplate.concat([at[0]]);
  44013. }
  44014. var codingTemplateLength = codingTemplate.length;
  44015. var codingTemplateX = new Int32Array(codingTemplateLength);
  44016. var codingTemplateY = new Int32Array(codingTemplateLength);
  44017. var k;
  44018. for (k = 0; k < codingTemplateLength; k++) {
  44019. codingTemplateX[k] = codingTemplate[k].x;
  44020. codingTemplateY[k] = codingTemplate[k].y;
  44021. }
  44022. var referenceTemplate = RefinementTemplates[templateIndex].reference;
  44023. if (templateIndex === 0) {
  44024. referenceTemplate = referenceTemplate.concat([at[1]]);
  44025. }
  44026. var referenceTemplateLength = referenceTemplate.length;
  44027. var referenceTemplateX = new Int32Array(referenceTemplateLength);
  44028. var referenceTemplateY = new Int32Array(referenceTemplateLength);
  44029. for (k = 0; k < referenceTemplateLength; k++) {
  44030. referenceTemplateX[k] = referenceTemplate[k].x;
  44031. referenceTemplateY[k] = referenceTemplate[k].y;
  44032. }
  44033. var referenceWidth = referenceBitmap[0].length;
  44034. var referenceHeight = referenceBitmap.length;
  44035. var pseudoPixelContext = RefinementReusedContexts[templateIndex];
  44036. var bitmap = [];
  44037. var decoder = decodingContext.decoder;
  44038. var contexts = decodingContext.contextCache.getContexts('GR');
  44039. var ltp = 0;
  44040. for (var i = 0; i < height; i++) {
  44041. if (prediction) {
  44042. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  44043. ltp ^= sltp;
  44044. if (ltp) {
  44045. error('JBIG2 error: prediction is not supported');
  44046. }
  44047. }
  44048. var row = new Uint8Array(width);
  44049. bitmap.push(row);
  44050. for (var j = 0; j < width; j++) {
  44051. var i0, j0;
  44052. var contextLabel = 0;
  44053. for (k = 0; k < codingTemplateLength; k++) {
  44054. i0 = i + codingTemplateY[k];
  44055. j0 = j + codingTemplateX[k];
  44056. if (i0 < 0 || j0 < 0 || j0 >= width) {
  44057. contextLabel <<= 1;
  44058. } else {
  44059. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  44060. }
  44061. }
  44062. for (k = 0; k < referenceTemplateLength; k++) {
  44063. i0 = i + referenceTemplateY[k] + offsetY;
  44064. j0 = j + referenceTemplateX[k] + offsetX;
  44065. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  44066. contextLabel <<= 1;
  44067. } else {
  44068. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  44069. }
  44070. }
  44071. var pixel = decoder.readBit(contexts, contextLabel);
  44072. row[j] = pixel;
  44073. }
  44074. }
  44075. return bitmap;
  44076. }
  44077. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext) {
  44078. if (huffman) {
  44079. error('JBIG2 error: huffman is not supported');
  44080. }
  44081. var newSymbols = [];
  44082. var currentHeight = 0;
  44083. var symbolCodeLength = log2(symbols.length + numberOfNewSymbols);
  44084. var decoder = decodingContext.decoder;
  44085. var contextCache = decodingContext.contextCache;
  44086. while (newSymbols.length < numberOfNewSymbols) {
  44087. var deltaHeight = decodeInteger(contextCache, 'IADH', decoder);
  44088. currentHeight += deltaHeight;
  44089. var currentWidth = 0;
  44090. while (true) {
  44091. var deltaWidth = decodeInteger(contextCache, 'IADW', decoder);
  44092. if (deltaWidth === null) {
  44093. break;
  44094. }
  44095. currentWidth += deltaWidth;
  44096. var bitmap;
  44097. if (refinement) {
  44098. var numberOfInstances = decodeInteger(contextCache, 'IAAI', decoder);
  44099. if (numberOfInstances > 1) {
  44100. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext);
  44101. } else {
  44102. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  44103. var rdx = decodeInteger(contextCache, 'IARDX', decoder);
  44104. var rdy = decodeInteger(contextCache, 'IARDY', decoder);
  44105. var symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  44106. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  44107. }
  44108. } else {
  44109. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  44110. }
  44111. newSymbols.push(bitmap);
  44112. }
  44113. }
  44114. var exportedSymbols = [];
  44115. var flags = [], currentFlag = false;
  44116. var totalSymbolsLength = symbols.length + numberOfNewSymbols;
  44117. while (flags.length < totalSymbolsLength) {
  44118. var runLength = decodeInteger(contextCache, 'IAEX', decoder);
  44119. while (runLength--) {
  44120. flags.push(currentFlag);
  44121. }
  44122. currentFlag = !currentFlag;
  44123. }
  44124. for (var i = 0, ii = symbols.length; i < ii; i++) {
  44125. if (flags[i]) {
  44126. exportedSymbols.push(symbols[i]);
  44127. }
  44128. }
  44129. for (var j = 0; j < numberOfNewSymbols; i++, j++) {
  44130. if (flags[i]) {
  44131. exportedSymbols.push(newSymbols[j]);
  44132. }
  44133. }
  44134. return exportedSymbols;
  44135. }
  44136. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext) {
  44137. if (huffman) {
  44138. error('JBIG2 error: huffman is not supported');
  44139. }
  44140. var bitmap = [];
  44141. var i, row;
  44142. for (i = 0; i < height; i++) {
  44143. row = new Uint8Array(width);
  44144. if (defaultPixelValue) {
  44145. for (var j = 0; j < width; j++) {
  44146. row[j] = defaultPixelValue;
  44147. }
  44148. }
  44149. bitmap.push(row);
  44150. }
  44151. var decoder = decodingContext.decoder;
  44152. var contextCache = decodingContext.contextCache;
  44153. var stripT = -decodeInteger(contextCache, 'IADT', decoder);
  44154. var firstS = 0;
  44155. i = 0;
  44156. while (i < numberOfSymbolInstances) {
  44157. var deltaT = decodeInteger(contextCache, 'IADT', decoder);
  44158. stripT += deltaT;
  44159. var deltaFirstS = decodeInteger(contextCache, 'IAFS', decoder);
  44160. firstS += deltaFirstS;
  44161. var currentS = firstS;
  44162. do {
  44163. var currentT = stripSize === 1 ? 0 : decodeInteger(contextCache, 'IAIT', decoder);
  44164. var t = stripSize * stripT + currentT;
  44165. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  44166. var applyRefinement = refinement && decodeInteger(contextCache, 'IARI', decoder);
  44167. var symbolBitmap = inputSymbols[symbolId];
  44168. var symbolWidth = symbolBitmap[0].length;
  44169. var symbolHeight = symbolBitmap.length;
  44170. if (applyRefinement) {
  44171. var rdw = decodeInteger(contextCache, 'IARDW', decoder);
  44172. var rdh = decodeInteger(contextCache, 'IARDH', decoder);
  44173. var rdx = decodeInteger(contextCache, 'IARDX', decoder);
  44174. var rdy = decodeInteger(contextCache, 'IARDY', decoder);
  44175. symbolWidth += rdw;
  44176. symbolHeight += rdh;
  44177. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  44178. }
  44179. var offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight);
  44180. var offsetS = currentS - (referenceCorner & 2 ? symbolWidth : 0);
  44181. var s2, t2, symbolRow;
  44182. if (transposed) {
  44183. for (s2 = 0; s2 < symbolHeight; s2++) {
  44184. row = bitmap[offsetS + s2];
  44185. if (!row) {
  44186. continue;
  44187. }
  44188. symbolRow = symbolBitmap[s2];
  44189. var maxWidth = Math.min(width - offsetT, symbolWidth);
  44190. switch (combinationOperator) {
  44191. case 0:
  44192. for (t2 = 0; t2 < maxWidth; t2++) {
  44193. row[offsetT + t2] |= symbolRow[t2];
  44194. }
  44195. break;
  44196. case 2:
  44197. for (t2 = 0; t2 < maxWidth; t2++) {
  44198. row[offsetT + t2] ^= symbolRow[t2];
  44199. }
  44200. break;
  44201. default:
  44202. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  44203. }
  44204. }
  44205. currentS += symbolHeight - 1;
  44206. } else {
  44207. for (t2 = 0; t2 < symbolHeight; t2++) {
  44208. row = bitmap[offsetT + t2];
  44209. if (!row) {
  44210. continue;
  44211. }
  44212. symbolRow = symbolBitmap[t2];
  44213. switch (combinationOperator) {
  44214. case 0:
  44215. for (s2 = 0; s2 < symbolWidth; s2++) {
  44216. row[offsetS + s2] |= symbolRow[s2];
  44217. }
  44218. break;
  44219. case 2:
  44220. for (s2 = 0; s2 < symbolWidth; s2++) {
  44221. row[offsetS + s2] ^= symbolRow[s2];
  44222. }
  44223. break;
  44224. default:
  44225. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  44226. }
  44227. }
  44228. currentS += symbolWidth - 1;
  44229. }
  44230. i++;
  44231. var deltaS = decodeInteger(contextCache, 'IADS', decoder);
  44232. if (deltaS === null) {
  44233. break;
  44234. }
  44235. currentS += deltaS + dsOffset;
  44236. } while (true);
  44237. }
  44238. return bitmap;
  44239. }
  44240. function readSegmentHeader(data, start) {
  44241. var segmentHeader = {};
  44242. segmentHeader.number = readUint32(data, start);
  44243. var flags = data[start + 4];
  44244. var segmentType = flags & 0x3F;
  44245. if (!SegmentTypes[segmentType]) {
  44246. error('JBIG2 error: invalid segment type: ' + segmentType);
  44247. }
  44248. segmentHeader.type = segmentType;
  44249. segmentHeader.typeName = SegmentTypes[segmentType];
  44250. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  44251. var pageAssociationFieldSize = !!(flags & 0x40);
  44252. var referredFlags = data[start + 5];
  44253. var referredToCount = referredFlags >> 5 & 7;
  44254. var retainBits = [referredFlags & 31];
  44255. var position = start + 6;
  44256. if (referredFlags === 7) {
  44257. referredToCount = readUint32(data, position - 1) & 0x1FFFFFFF;
  44258. position += 3;
  44259. var bytes = referredToCount + 7 >> 3;
  44260. retainBits[0] = data[position++];
  44261. while (--bytes > 0) {
  44262. retainBits.push(data[position++]);
  44263. }
  44264. } else if (referredFlags === 5 || referredFlags === 6) {
  44265. error('JBIG2 error: invalid referred-to flags');
  44266. }
  44267. segmentHeader.retainBits = retainBits;
  44268. var referredToSegmentNumberSize = segmentHeader.number <= 256 ? 1 : segmentHeader.number <= 65536 ? 2 : 4;
  44269. var referredTo = [];
  44270. var i, ii;
  44271. for (i = 0; i < referredToCount; i++) {
  44272. var number = referredToSegmentNumberSize === 1 ? data[position] : referredToSegmentNumberSize === 2 ? readUint16(data, position) : readUint32(data, position);
  44273. referredTo.push(number);
  44274. position += referredToSegmentNumberSize;
  44275. }
  44276. segmentHeader.referredTo = referredTo;
  44277. if (!pageAssociationFieldSize) {
  44278. segmentHeader.pageAssociation = data[position++];
  44279. } else {
  44280. segmentHeader.pageAssociation = readUint32(data, position);
  44281. position += 4;
  44282. }
  44283. segmentHeader.length = readUint32(data, position);
  44284. position += 4;
  44285. if (segmentHeader.length === 0xFFFFFFFF) {
  44286. if (segmentType === 38) {
  44287. var genericRegionInfo = readRegionSegmentInformation(data, position);
  44288. var genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  44289. var genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  44290. var searchPatternLength = 6;
  44291. var searchPattern = new Uint8Array(searchPatternLength);
  44292. if (!genericRegionMmr) {
  44293. searchPattern[0] = 0xFF;
  44294. searchPattern[1] = 0xAC;
  44295. }
  44296. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xFF;
  44297. searchPattern[3] = genericRegionInfo.height >> 16 & 0xFF;
  44298. searchPattern[4] = genericRegionInfo.height >> 8 & 0xFF;
  44299. searchPattern[5] = genericRegionInfo.height & 0xFF;
  44300. for (i = position, ii = data.length; i < ii; i++) {
  44301. var j = 0;
  44302. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  44303. j++;
  44304. }
  44305. if (j === searchPatternLength) {
  44306. segmentHeader.length = i + searchPatternLength;
  44307. break;
  44308. }
  44309. }
  44310. if (segmentHeader.length === 0xFFFFFFFF) {
  44311. error('JBIG2 error: segment end was not found');
  44312. }
  44313. } else {
  44314. error('JBIG2 error: invalid unknown segment length');
  44315. }
  44316. }
  44317. segmentHeader.headerEnd = position;
  44318. return segmentHeader;
  44319. }
  44320. function readSegments(header, data, start, end) {
  44321. var segments = [];
  44322. var position = start;
  44323. while (position < end) {
  44324. var segmentHeader = readSegmentHeader(data, position);
  44325. position = segmentHeader.headerEnd;
  44326. var segment = {
  44327. header: segmentHeader,
  44328. data: data
  44329. };
  44330. if (!header.randomAccess) {
  44331. segment.start = position;
  44332. position += segmentHeader.length;
  44333. segment.end = position;
  44334. }
  44335. segments.push(segment);
  44336. if (segmentHeader.type === 51) {
  44337. break;
  44338. }
  44339. }
  44340. if (header.randomAccess) {
  44341. for (var i = 0, ii = segments.length; i < ii; i++) {
  44342. segments[i].start = position;
  44343. position += segments[i].header.length;
  44344. segments[i].end = position;
  44345. }
  44346. }
  44347. return segments;
  44348. }
  44349. function readRegionSegmentInformation(data, start) {
  44350. return {
  44351. width: readUint32(data, start),
  44352. height: readUint32(data, start + 4),
  44353. x: readUint32(data, start + 8),
  44354. y: readUint32(data, start + 12),
  44355. combinationOperator: data[start + 16] & 7
  44356. };
  44357. }
  44358. var RegionSegmentInformationFieldLength = 17;
  44359. function processSegment(segment, visitor) {
  44360. var header = segment.header;
  44361. var data = segment.data, position = segment.start, end = segment.end;
  44362. var args, at, i, atLength;
  44363. switch (header.type) {
  44364. case 0:
  44365. var dictionary = {};
  44366. var dictionaryFlags = readUint16(data, position);
  44367. dictionary.huffman = !!(dictionaryFlags & 1);
  44368. dictionary.refinement = !!(dictionaryFlags & 2);
  44369. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  44370. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  44371. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  44372. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  44373. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  44374. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  44375. dictionary.template = dictionaryFlags >> 10 & 3;
  44376. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  44377. position += 2;
  44378. if (!dictionary.huffman) {
  44379. atLength = dictionary.template === 0 ? 4 : 1;
  44380. at = [];
  44381. for (i = 0; i < atLength; i++) {
  44382. at.push({
  44383. x: readInt8(data, position),
  44384. y: readInt8(data, position + 1)
  44385. });
  44386. position += 2;
  44387. }
  44388. dictionary.at = at;
  44389. }
  44390. if (dictionary.refinement && !dictionary.refinementTemplate) {
  44391. at = [];
  44392. for (i = 0; i < 2; i++) {
  44393. at.push({
  44394. x: readInt8(data, position),
  44395. y: readInt8(data, position + 1)
  44396. });
  44397. position += 2;
  44398. }
  44399. dictionary.refinementAt = at;
  44400. }
  44401. dictionary.numberOfExportedSymbols = readUint32(data, position);
  44402. position += 4;
  44403. dictionary.numberOfNewSymbols = readUint32(data, position);
  44404. position += 4;
  44405. args = [
  44406. dictionary,
  44407. header.number,
  44408. header.referredTo,
  44409. data,
  44410. position,
  44411. end
  44412. ];
  44413. break;
  44414. case 6:
  44415. case 7:
  44416. var textRegion = {};
  44417. textRegion.info = readRegionSegmentInformation(data, position);
  44418. position += RegionSegmentInformationFieldLength;
  44419. var textRegionSegmentFlags = readUint16(data, position);
  44420. position += 2;
  44421. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  44422. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  44423. textRegion.stripSize = 1 << (textRegionSegmentFlags >> 2 & 3);
  44424. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  44425. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  44426. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  44427. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  44428. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  44429. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  44430. if (textRegion.huffman) {
  44431. var textRegionHuffmanFlags = readUint16(data, position);
  44432. position += 2;
  44433. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  44434. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  44435. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  44436. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  44437. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  44438. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  44439. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  44440. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 14);
  44441. }
  44442. if (textRegion.refinement && !textRegion.refinementTemplate) {
  44443. at = [];
  44444. for (i = 0; i < 2; i++) {
  44445. at.push({
  44446. x: readInt8(data, position),
  44447. y: readInt8(data, position + 1)
  44448. });
  44449. position += 2;
  44450. }
  44451. textRegion.refinementAt = at;
  44452. }
  44453. textRegion.numberOfSymbolInstances = readUint32(data, position);
  44454. position += 4;
  44455. if (textRegion.huffman) {
  44456. error('JBIG2 error: huffman is not supported');
  44457. }
  44458. args = [
  44459. textRegion,
  44460. header.referredTo,
  44461. data,
  44462. position,
  44463. end
  44464. ];
  44465. break;
  44466. case 38:
  44467. case 39:
  44468. var genericRegion = {};
  44469. genericRegion.info = readRegionSegmentInformation(data, position);
  44470. position += RegionSegmentInformationFieldLength;
  44471. var genericRegionSegmentFlags = data[position++];
  44472. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  44473. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  44474. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  44475. if (!genericRegion.mmr) {
  44476. atLength = genericRegion.template === 0 ? 4 : 1;
  44477. at = [];
  44478. for (i = 0; i < atLength; i++) {
  44479. at.push({
  44480. x: readInt8(data, position),
  44481. y: readInt8(data, position + 1)
  44482. });
  44483. position += 2;
  44484. }
  44485. genericRegion.at = at;
  44486. }
  44487. args = [
  44488. genericRegion,
  44489. data,
  44490. position,
  44491. end
  44492. ];
  44493. break;
  44494. case 48:
  44495. var pageInfo = {
  44496. width: readUint32(data, position),
  44497. height: readUint32(data, position + 4),
  44498. resolutionX: readUint32(data, position + 8),
  44499. resolutionY: readUint32(data, position + 12)
  44500. };
  44501. if (pageInfo.height === 0xFFFFFFFF) {
  44502. delete pageInfo.height;
  44503. }
  44504. var pageSegmentFlags = data[position + 16];
  44505. readUint16(data, position + 17);
  44506. pageInfo.lossless = !!(pageSegmentFlags & 1);
  44507. pageInfo.refinement = !!(pageSegmentFlags & 2);
  44508. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  44509. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  44510. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  44511. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  44512. args = [pageInfo];
  44513. break;
  44514. case 49:
  44515. break;
  44516. case 50:
  44517. break;
  44518. case 51:
  44519. break;
  44520. case 62:
  44521. break;
  44522. default:
  44523. error('JBIG2 error: segment type ' + header.typeName + '(' + header.type + ') is not implemented');
  44524. }
  44525. var callbackName = 'on' + header.typeName;
  44526. if (callbackName in visitor) {
  44527. visitor[callbackName].apply(visitor, args);
  44528. }
  44529. }
  44530. function processSegments(segments, visitor) {
  44531. for (var i = 0, ii = segments.length; i < ii; i++) {
  44532. processSegment(segments[i], visitor);
  44533. }
  44534. }
  44535. function parseJbig2(data, start, end) {
  44536. var position = start;
  44537. 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) {
  44538. error('JBIG2 error: invalid header');
  44539. }
  44540. var header = {};
  44541. position += 8;
  44542. var flags = data[position++];
  44543. header.randomAccess = !(flags & 1);
  44544. if (!(flags & 2)) {
  44545. header.numberOfPages = readUint32(data, position);
  44546. position += 4;
  44547. }
  44548. readSegments(header, data, position, end);
  44549. error('Not implemented');
  44550. }
  44551. function parseJbig2Chunks(chunks) {
  44552. var visitor = new SimpleSegmentVisitor();
  44553. for (var i = 0, ii = chunks.length; i < ii; i++) {
  44554. var chunk = chunks[i];
  44555. var segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  44556. processSegments(segments, visitor);
  44557. }
  44558. return visitor.buffer;
  44559. }
  44560. function SimpleSegmentVisitor() {
  44561. }
  44562. SimpleSegmentVisitor.prototype = {
  44563. onPageInformation: function SimpleSegmentVisitor_onPageInformation(info) {
  44564. this.currentPageInfo = info;
  44565. var rowSize = info.width + 7 >> 3;
  44566. var buffer = new Uint8Array(rowSize * info.height);
  44567. if (info.defaultPixelValue) {
  44568. for (var i = 0, ii = buffer.length; i < ii; i++) {
  44569. buffer[i] = 0xFF;
  44570. }
  44571. }
  44572. this.buffer = buffer;
  44573. },
  44574. drawBitmap: function SimpleSegmentVisitor_drawBitmap(regionInfo, bitmap) {
  44575. var pageInfo = this.currentPageInfo;
  44576. var width = regionInfo.width, height = regionInfo.height;
  44577. var rowSize = pageInfo.width + 7 >> 3;
  44578. var combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  44579. var buffer = this.buffer;
  44580. var mask0 = 128 >> (regionInfo.x & 7);
  44581. var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  44582. var i, j, mask, offset;
  44583. switch (combinationOperator) {
  44584. case 0:
  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. case 2:
  44602. for (i = 0; i < height; i++) {
  44603. mask = mask0;
  44604. offset = offset0;
  44605. for (j = 0; j < width; j++) {
  44606. if (bitmap[i][j]) {
  44607. buffer[offset] ^= mask;
  44608. }
  44609. mask >>= 1;
  44610. if (!mask) {
  44611. mask = 128;
  44612. offset++;
  44613. }
  44614. }
  44615. offset0 += rowSize;
  44616. }
  44617. break;
  44618. default:
  44619. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  44620. }
  44621. },
  44622. onImmediateGenericRegion: function SimpleSegmentVisitor_onImmediateGenericRegion(region, data, start, end) {
  44623. var regionInfo = region.info;
  44624. var decodingContext = new DecodingContext(data, start, end);
  44625. var bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  44626. this.drawBitmap(regionInfo, bitmap);
  44627. },
  44628. onImmediateLosslessGenericRegion: function SimpleSegmentVisitor_onImmediateLosslessGenericRegion() {
  44629. this.onImmediateGenericRegion.apply(this, arguments);
  44630. },
  44631. onSymbolDictionary: function SimpleSegmentVisitor_onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  44632. var huffmanTables;
  44633. if (dictionary.huffman) {
  44634. error('JBIG2 error: huffman is not supported');
  44635. }
  44636. var symbols = this.symbols;
  44637. if (!symbols) {
  44638. this.symbols = symbols = {};
  44639. }
  44640. var inputSymbols = [];
  44641. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  44642. inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]);
  44643. }
  44644. var decodingContext = new DecodingContext(data, start, end);
  44645. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext);
  44646. },
  44647. onImmediateTextRegion: function SimpleSegmentVisitor_onImmediateTextRegion(region, referredSegments, data, start, end) {
  44648. var regionInfo = region.info;
  44649. var huffmanTables;
  44650. var symbols = this.symbols;
  44651. var inputSymbols = [];
  44652. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  44653. inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]);
  44654. }
  44655. var symbolCodeLength = log2(inputSymbols.length);
  44656. var decodingContext = new DecodingContext(data, start, end);
  44657. 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);
  44658. this.drawBitmap(regionInfo, bitmap);
  44659. },
  44660. onImmediateLosslessTextRegion: function SimpleSegmentVisitor_onImmediateLosslessTextRegion() {
  44661. this.onImmediateTextRegion.apply(this, arguments);
  44662. }
  44663. };
  44664. function Jbig2Image() {
  44665. }
  44666. Jbig2Image.prototype = {
  44667. parseChunks: function Jbig2Image_parseChunks(chunks) {
  44668. return parseJbig2Chunks(chunks);
  44669. }
  44670. };
  44671. return Jbig2Image;
  44672. }();
  44673. exports.Jbig2Image = Jbig2Image;
  44674. /***/ }),
  44675. /* 30 */
  44676. /***/ (function(module, exports, __w_pdfjs_require__) {
  44677. "use strict";
  44678. var sharedUtil = __w_pdfjs_require__(0);
  44679. var error = sharedUtil.error;
  44680. var JpegImage = function JpegImageClosure() {
  44681. var dctZigZag = new Uint8Array([
  44682. 0,
  44683. 1,
  44684. 8,
  44685. 16,
  44686. 9,
  44687. 2,
  44688. 3,
  44689. 10,
  44690. 17,
  44691. 24,
  44692. 32,
  44693. 25,
  44694. 18,
  44695. 11,
  44696. 4,
  44697. 5,
  44698. 12,
  44699. 19,
  44700. 26,
  44701. 33,
  44702. 40,
  44703. 48,
  44704. 41,
  44705. 34,
  44706. 27,
  44707. 20,
  44708. 13,
  44709. 6,
  44710. 7,
  44711. 14,
  44712. 21,
  44713. 28,
  44714. 35,
  44715. 42,
  44716. 49,
  44717. 56,
  44718. 57,
  44719. 50,
  44720. 43,
  44721. 36,
  44722. 29,
  44723. 22,
  44724. 15,
  44725. 23,
  44726. 30,
  44727. 37,
  44728. 44,
  44729. 51,
  44730. 58,
  44731. 59,
  44732. 52,
  44733. 45,
  44734. 38,
  44735. 31,
  44736. 39,
  44737. 46,
  44738. 53,
  44739. 60,
  44740. 61,
  44741. 54,
  44742. 47,
  44743. 55,
  44744. 62,
  44745. 63
  44746. ]);
  44747. var dctCos1 = 4017;
  44748. var dctSin1 = 799;
  44749. var dctCos3 = 3406;
  44750. var dctSin3 = 2276;
  44751. var dctCos6 = 1567;
  44752. var dctSin6 = 3784;
  44753. var dctSqrt2 = 5793;
  44754. var dctSqrt1d2 = 2896;
  44755. function JpegImage() {
  44756. this.decodeTransform = null;
  44757. this.colorTransform = -1;
  44758. }
  44759. function buildHuffmanTable(codeLengths, values) {
  44760. var k = 0, code = [], i, j, length = 16;
  44761. while (length > 0 && !codeLengths[length - 1]) {
  44762. length--;
  44763. }
  44764. code.push({
  44765. children: [],
  44766. index: 0
  44767. });
  44768. var p = code[0], q;
  44769. for (i = 0; i < length; i++) {
  44770. for (j = 0; j < codeLengths[i]; j++) {
  44771. p = code.pop();
  44772. p.children[p.index] = values[k];
  44773. while (p.index > 0) {
  44774. p = code.pop();
  44775. }
  44776. p.index++;
  44777. code.push(p);
  44778. while (code.length <= i) {
  44779. code.push(q = {
  44780. children: [],
  44781. index: 0
  44782. });
  44783. p.children[p.index] = q.children;
  44784. p = q;
  44785. }
  44786. k++;
  44787. }
  44788. if (i + 1 < length) {
  44789. code.push(q = {
  44790. children: [],
  44791. index: 0
  44792. });
  44793. p.children[p.index] = q.children;
  44794. p = q;
  44795. }
  44796. }
  44797. return code[0].children;
  44798. }
  44799. function getBlockBufferOffset(component, row, col) {
  44800. return 64 * ((component.blocksPerLine + 1) * row + col);
  44801. }
  44802. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive) {
  44803. var mcusPerLine = frame.mcusPerLine;
  44804. var progressive = frame.progressive;
  44805. var startOffset = offset, bitsData = 0, bitsCount = 0;
  44806. function readBit() {
  44807. if (bitsCount > 0) {
  44808. bitsCount--;
  44809. return bitsData >> bitsCount & 1;
  44810. }
  44811. bitsData = data[offset++];
  44812. if (bitsData === 0xFF) {
  44813. var nextByte = data[offset++];
  44814. if (nextByte) {
  44815. error('JPEG error: unexpected marker ' + (bitsData << 8 | nextByte).toString(16));
  44816. }
  44817. }
  44818. bitsCount = 7;
  44819. return bitsData >>> 7;
  44820. }
  44821. function decodeHuffman(tree) {
  44822. var node = tree;
  44823. while (true) {
  44824. node = node[readBit()];
  44825. if (typeof node === 'number') {
  44826. return node;
  44827. }
  44828. if (typeof node !== 'object') {
  44829. error('JPEG error: invalid huffman sequence');
  44830. }
  44831. }
  44832. }
  44833. function receive(length) {
  44834. var n = 0;
  44835. while (length > 0) {
  44836. n = n << 1 | readBit();
  44837. length--;
  44838. }
  44839. return n;
  44840. }
  44841. function receiveAndExtend(length) {
  44842. if (length === 1) {
  44843. return readBit() === 1 ? 1 : -1;
  44844. }
  44845. var n = receive(length);
  44846. if (n >= 1 << length - 1) {
  44847. return n;
  44848. }
  44849. return n + (-1 << length) + 1;
  44850. }
  44851. function decodeBaseline(component, offset) {
  44852. var t = decodeHuffman(component.huffmanTableDC);
  44853. var diff = t === 0 ? 0 : receiveAndExtend(t);
  44854. component.blockData[offset] = component.pred += diff;
  44855. var k = 1;
  44856. while (k < 64) {
  44857. var rs = decodeHuffman(component.huffmanTableAC);
  44858. var s = rs & 15, r = rs >> 4;
  44859. if (s === 0) {
  44860. if (r < 15) {
  44861. break;
  44862. }
  44863. k += 16;
  44864. continue;
  44865. }
  44866. k += r;
  44867. var z = dctZigZag[k];
  44868. component.blockData[offset + z] = receiveAndExtend(s);
  44869. k++;
  44870. }
  44871. }
  44872. function decodeDCFirst(component, offset) {
  44873. var t = decodeHuffman(component.huffmanTableDC);
  44874. var diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  44875. component.blockData[offset] = component.pred += diff;
  44876. }
  44877. function decodeDCSuccessive(component, offset) {
  44878. component.blockData[offset] |= readBit() << successive;
  44879. }
  44880. var eobrun = 0;
  44881. function decodeACFirst(component, offset) {
  44882. if (eobrun > 0) {
  44883. eobrun--;
  44884. return;
  44885. }
  44886. var k = spectralStart, e = spectralEnd;
  44887. while (k <= e) {
  44888. var rs = decodeHuffman(component.huffmanTableAC);
  44889. var s = rs & 15, r = rs >> 4;
  44890. if (s === 0) {
  44891. if (r < 15) {
  44892. eobrun = receive(r) + (1 << r) - 1;
  44893. break;
  44894. }
  44895. k += 16;
  44896. continue;
  44897. }
  44898. k += r;
  44899. var z = dctZigZag[k];
  44900. component.blockData[offset + z] = receiveAndExtend(s) * (1 << successive);
  44901. k++;
  44902. }
  44903. }
  44904. var successiveACState = 0, successiveACNextValue;
  44905. function decodeACSuccessive(component, offset) {
  44906. var k = spectralStart;
  44907. var e = spectralEnd;
  44908. var r = 0;
  44909. var s;
  44910. var rs;
  44911. while (k <= e) {
  44912. var z = dctZigZag[k];
  44913. switch (successiveACState) {
  44914. case 0:
  44915. rs = decodeHuffman(component.huffmanTableAC);
  44916. s = rs & 15;
  44917. r = rs >> 4;
  44918. if (s === 0) {
  44919. if (r < 15) {
  44920. eobrun = receive(r) + (1 << r);
  44921. successiveACState = 4;
  44922. } else {
  44923. r = 16;
  44924. successiveACState = 1;
  44925. }
  44926. } else {
  44927. if (s !== 1) {
  44928. error('JPEG error: invalid ACn encoding');
  44929. }
  44930. successiveACNextValue = receiveAndExtend(s);
  44931. successiveACState = r ? 2 : 3;
  44932. }
  44933. continue;
  44934. case 1:
  44935. case 2:
  44936. if (component.blockData[offset + z]) {
  44937. component.blockData[offset + z] += readBit() << successive;
  44938. } else {
  44939. r--;
  44940. if (r === 0) {
  44941. successiveACState = successiveACState === 2 ? 3 : 0;
  44942. }
  44943. }
  44944. break;
  44945. case 3:
  44946. if (component.blockData[offset + z]) {
  44947. component.blockData[offset + z] += readBit() << successive;
  44948. } else {
  44949. component.blockData[offset + z] = successiveACNextValue << successive;
  44950. successiveACState = 0;
  44951. }
  44952. break;
  44953. case 4:
  44954. if (component.blockData[offset + z]) {
  44955. component.blockData[offset + z] += readBit() << successive;
  44956. }
  44957. break;
  44958. }
  44959. k++;
  44960. }
  44961. if (successiveACState === 4) {
  44962. eobrun--;
  44963. if (eobrun === 0) {
  44964. successiveACState = 0;
  44965. }
  44966. }
  44967. }
  44968. function decodeMcu(component, decode, mcu, row, col) {
  44969. var mcuRow = mcu / mcusPerLine | 0;
  44970. var mcuCol = mcu % mcusPerLine;
  44971. var blockRow = mcuRow * component.v + row;
  44972. var blockCol = mcuCol * component.h + col;
  44973. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  44974. decode(component, offset);
  44975. }
  44976. function decodeBlock(component, decode, mcu) {
  44977. var blockRow = mcu / component.blocksPerLine | 0;
  44978. var blockCol = mcu % component.blocksPerLine;
  44979. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  44980. decode(component, offset);
  44981. }
  44982. var componentsLength = components.length;
  44983. var component, i, j, k, n;
  44984. var decodeFn;
  44985. if (progressive) {
  44986. if (spectralStart === 0) {
  44987. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  44988. } else {
  44989. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  44990. }
  44991. } else {
  44992. decodeFn = decodeBaseline;
  44993. }
  44994. var mcu = 0, marker;
  44995. var mcuExpected;
  44996. if (componentsLength === 1) {
  44997. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  44998. } else {
  44999. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  45000. }
  45001. if (!resetInterval) {
  45002. resetInterval = mcuExpected;
  45003. }
  45004. var h, v;
  45005. while (mcu < mcuExpected) {
  45006. for (i = 0; i < componentsLength; i++) {
  45007. components[i].pred = 0;
  45008. }
  45009. eobrun = 0;
  45010. if (componentsLength === 1) {
  45011. component = components[0];
  45012. for (n = 0; n < resetInterval; n++) {
  45013. decodeBlock(component, decodeFn, mcu);
  45014. mcu++;
  45015. }
  45016. } else {
  45017. for (n = 0; n < resetInterval; n++) {
  45018. for (i = 0; i < componentsLength; i++) {
  45019. component = components[i];
  45020. h = component.h;
  45021. v = component.v;
  45022. for (j = 0; j < v; j++) {
  45023. for (k = 0; k < h; k++) {
  45024. decodeMcu(component, decodeFn, mcu, j, k);
  45025. }
  45026. }
  45027. }
  45028. mcu++;
  45029. }
  45030. }
  45031. bitsCount = 0;
  45032. marker = data[offset] << 8 | data[offset + 1];
  45033. while (data[offset] === 0x00 && offset < data.length - 1) {
  45034. offset++;
  45035. marker = data[offset] << 8 | data[offset + 1];
  45036. }
  45037. if (marker <= 0xFF00) {
  45038. error('JPEG error: marker was not found');
  45039. }
  45040. if (marker >= 0xFFD0 && marker <= 0xFFD7) {
  45041. offset += 2;
  45042. } else {
  45043. break;
  45044. }
  45045. }
  45046. return offset - startOffset;
  45047. }
  45048. function quantizeAndInverse(component, blockBufferOffset, p) {
  45049. var qt = component.quantizationTable, blockData = component.blockData;
  45050. var v0, v1, v2, v3, v4, v5, v6, v7;
  45051. var p0, p1, p2, p3, p4, p5, p6, p7;
  45052. var t;
  45053. if (!qt) {
  45054. error('JPEG error: missing required Quantization Table.');
  45055. }
  45056. for (var row = 0; row < 64; row += 8) {
  45057. p0 = blockData[blockBufferOffset + row];
  45058. p1 = blockData[blockBufferOffset + row + 1];
  45059. p2 = blockData[blockBufferOffset + row + 2];
  45060. p3 = blockData[blockBufferOffset + row + 3];
  45061. p4 = blockData[blockBufferOffset + row + 4];
  45062. p5 = blockData[blockBufferOffset + row + 5];
  45063. p6 = blockData[blockBufferOffset + row + 6];
  45064. p7 = blockData[blockBufferOffset + row + 7];
  45065. p0 *= qt[row];
  45066. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  45067. t = dctSqrt2 * p0 + 512 >> 10;
  45068. p[row] = t;
  45069. p[row + 1] = t;
  45070. p[row + 2] = t;
  45071. p[row + 3] = t;
  45072. p[row + 4] = t;
  45073. p[row + 5] = t;
  45074. p[row + 6] = t;
  45075. p[row + 7] = t;
  45076. continue;
  45077. }
  45078. p1 *= qt[row + 1];
  45079. p2 *= qt[row + 2];
  45080. p3 *= qt[row + 3];
  45081. p4 *= qt[row + 4];
  45082. p5 *= qt[row + 5];
  45083. p6 *= qt[row + 6];
  45084. p7 *= qt[row + 7];
  45085. v0 = dctSqrt2 * p0 + 128 >> 8;
  45086. v1 = dctSqrt2 * p4 + 128 >> 8;
  45087. v2 = p2;
  45088. v3 = p6;
  45089. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  45090. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  45091. v5 = p3 << 4;
  45092. v6 = p5 << 4;
  45093. v0 = v0 + v1 + 1 >> 1;
  45094. v1 = v0 - v1;
  45095. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  45096. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  45097. v3 = t;
  45098. v4 = v4 + v6 + 1 >> 1;
  45099. v6 = v4 - v6;
  45100. v7 = v7 + v5 + 1 >> 1;
  45101. v5 = v7 - v5;
  45102. v0 = v0 + v3 + 1 >> 1;
  45103. v3 = v0 - v3;
  45104. v1 = v1 + v2 + 1 >> 1;
  45105. v2 = v1 - v2;
  45106. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  45107. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  45108. v7 = t;
  45109. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  45110. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  45111. v6 = t;
  45112. p[row] = v0 + v7;
  45113. p[row + 7] = v0 - v7;
  45114. p[row + 1] = v1 + v6;
  45115. p[row + 6] = v1 - v6;
  45116. p[row + 2] = v2 + v5;
  45117. p[row + 5] = v2 - v5;
  45118. p[row + 3] = v3 + v4;
  45119. p[row + 4] = v3 - v4;
  45120. }
  45121. for (var col = 0; col < 8; ++col) {
  45122. p0 = p[col];
  45123. p1 = p[col + 8];
  45124. p2 = p[col + 16];
  45125. p3 = p[col + 24];
  45126. p4 = p[col + 32];
  45127. p5 = p[col + 40];
  45128. p6 = p[col + 48];
  45129. p7 = p[col + 56];
  45130. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  45131. t = dctSqrt2 * p0 + 8192 >> 14;
  45132. t = t < -2040 ? 0 : t >= 2024 ? 255 : t + 2056 >> 4;
  45133. blockData[blockBufferOffset + col] = t;
  45134. blockData[blockBufferOffset + col + 8] = t;
  45135. blockData[blockBufferOffset + col + 16] = t;
  45136. blockData[blockBufferOffset + col + 24] = t;
  45137. blockData[blockBufferOffset + col + 32] = t;
  45138. blockData[blockBufferOffset + col + 40] = t;
  45139. blockData[blockBufferOffset + col + 48] = t;
  45140. blockData[blockBufferOffset + col + 56] = t;
  45141. continue;
  45142. }
  45143. v0 = dctSqrt2 * p0 + 2048 >> 12;
  45144. v1 = dctSqrt2 * p4 + 2048 >> 12;
  45145. v2 = p2;
  45146. v3 = p6;
  45147. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  45148. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  45149. v5 = p3;
  45150. v6 = p5;
  45151. v0 = (v0 + v1 + 1 >> 1) + 4112;
  45152. v1 = v0 - v1;
  45153. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  45154. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  45155. v3 = t;
  45156. v4 = v4 + v6 + 1 >> 1;
  45157. v6 = v4 - v6;
  45158. v7 = v7 + v5 + 1 >> 1;
  45159. v5 = v7 - v5;
  45160. v0 = v0 + v3 + 1 >> 1;
  45161. v3 = v0 - v3;
  45162. v1 = v1 + v2 + 1 >> 1;
  45163. v2 = v1 - v2;
  45164. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  45165. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  45166. v7 = t;
  45167. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  45168. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  45169. v6 = t;
  45170. p0 = v0 + v7;
  45171. p7 = v0 - v7;
  45172. p1 = v1 + v6;
  45173. p6 = v1 - v6;
  45174. p2 = v2 + v5;
  45175. p5 = v2 - v5;
  45176. p3 = v3 + v4;
  45177. p4 = v3 - v4;
  45178. p0 = p0 < 16 ? 0 : p0 >= 4080 ? 255 : p0 >> 4;
  45179. p1 = p1 < 16 ? 0 : p1 >= 4080 ? 255 : p1 >> 4;
  45180. p2 = p2 < 16 ? 0 : p2 >= 4080 ? 255 : p2 >> 4;
  45181. p3 = p3 < 16 ? 0 : p3 >= 4080 ? 255 : p3 >> 4;
  45182. p4 = p4 < 16 ? 0 : p4 >= 4080 ? 255 : p4 >> 4;
  45183. p5 = p5 < 16 ? 0 : p5 >= 4080 ? 255 : p5 >> 4;
  45184. p6 = p6 < 16 ? 0 : p6 >= 4080 ? 255 : p6 >> 4;
  45185. p7 = p7 < 16 ? 0 : p7 >= 4080 ? 255 : p7 >> 4;
  45186. blockData[blockBufferOffset + col] = p0;
  45187. blockData[blockBufferOffset + col + 8] = p1;
  45188. blockData[blockBufferOffset + col + 16] = p2;
  45189. blockData[blockBufferOffset + col + 24] = p3;
  45190. blockData[blockBufferOffset + col + 32] = p4;
  45191. blockData[blockBufferOffset + col + 40] = p5;
  45192. blockData[blockBufferOffset + col + 48] = p6;
  45193. blockData[blockBufferOffset + col + 56] = p7;
  45194. }
  45195. }
  45196. function buildComponentData(frame, component) {
  45197. var blocksPerLine = component.blocksPerLine;
  45198. var blocksPerColumn = component.blocksPerColumn;
  45199. var computationBuffer = new Int16Array(64);
  45200. for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  45201. for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  45202. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  45203. quantizeAndInverse(component, offset, computationBuffer);
  45204. }
  45205. }
  45206. return component.blockData;
  45207. }
  45208. function clamp0to255(a) {
  45209. return a <= 0 ? 0 : a >= 255 ? 255 : a;
  45210. }
  45211. JpegImage.prototype = {
  45212. parse: function parse(data) {
  45213. function readUint16() {
  45214. var value = data[offset] << 8 | data[offset + 1];
  45215. offset += 2;
  45216. return value;
  45217. }
  45218. function readDataBlock() {
  45219. var length = readUint16();
  45220. var array = data.subarray(offset, offset + length - 2);
  45221. offset += array.length;
  45222. return array;
  45223. }
  45224. function prepareComponents(frame) {
  45225. var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  45226. var mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  45227. for (var i = 0; i < frame.components.length; i++) {
  45228. component = frame.components[i];
  45229. var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  45230. var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  45231. var blocksPerLineForMcu = mcusPerLine * component.h;
  45232. var blocksPerColumnForMcu = mcusPerColumn * component.v;
  45233. var blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  45234. component.blockData = new Int16Array(blocksBufferSize);
  45235. component.blocksPerLine = blocksPerLine;
  45236. component.blocksPerColumn = blocksPerColumn;
  45237. }
  45238. frame.mcusPerLine = mcusPerLine;
  45239. frame.mcusPerColumn = mcusPerColumn;
  45240. }
  45241. var offset = 0;
  45242. var jfif = null;
  45243. var adobe = null;
  45244. var frame, resetInterval;
  45245. var quantizationTables = [];
  45246. var huffmanTablesAC = [], huffmanTablesDC = [];
  45247. var fileMarker = readUint16();
  45248. if (fileMarker !== 0xFFD8) {
  45249. error('JPEG error: SOI not found');
  45250. }
  45251. fileMarker = readUint16();
  45252. while (fileMarker !== 0xFFD9) {
  45253. var i, j, l;
  45254. switch (fileMarker) {
  45255. case 0xFFE0:
  45256. case 0xFFE1:
  45257. case 0xFFE2:
  45258. case 0xFFE3:
  45259. case 0xFFE4:
  45260. case 0xFFE5:
  45261. case 0xFFE6:
  45262. case 0xFFE7:
  45263. case 0xFFE8:
  45264. case 0xFFE9:
  45265. case 0xFFEA:
  45266. case 0xFFEB:
  45267. case 0xFFEC:
  45268. case 0xFFED:
  45269. case 0xFFEE:
  45270. case 0xFFEF:
  45271. case 0xFFFE:
  45272. var appData = readDataBlock();
  45273. if (fileMarker === 0xFFE0) {
  45274. if (appData[0] === 0x4A && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  45275. jfif = {
  45276. version: {
  45277. major: appData[5],
  45278. minor: appData[6]
  45279. },
  45280. densityUnits: appData[7],
  45281. xDensity: appData[8] << 8 | appData[9],
  45282. yDensity: appData[10] << 8 | appData[11],
  45283. thumbWidth: appData[12],
  45284. thumbHeight: appData[13],
  45285. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  45286. };
  45287. }
  45288. }
  45289. if (fileMarker === 0xFFEE) {
  45290. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6F && appData[3] === 0x62 && appData[4] === 0x65) {
  45291. adobe = {
  45292. version: appData[5] << 8 | appData[6],
  45293. flags0: appData[7] << 8 | appData[8],
  45294. flags1: appData[9] << 8 | appData[10],
  45295. transformCode: appData[11]
  45296. };
  45297. }
  45298. }
  45299. break;
  45300. case 0xFFDB:
  45301. var quantizationTablesLength = readUint16();
  45302. var quantizationTablesEnd = quantizationTablesLength + offset - 2;
  45303. var z;
  45304. while (offset < quantizationTablesEnd) {
  45305. var quantizationTableSpec = data[offset++];
  45306. var tableData = new Uint16Array(64);
  45307. if (quantizationTableSpec >> 4 === 0) {
  45308. for (j = 0; j < 64; j++) {
  45309. z = dctZigZag[j];
  45310. tableData[z] = data[offset++];
  45311. }
  45312. } else if (quantizationTableSpec >> 4 === 1) {
  45313. for (j = 0; j < 64; j++) {
  45314. z = dctZigZag[j];
  45315. tableData[z] = readUint16();
  45316. }
  45317. } else {
  45318. error('JPEG error: DQT - invalid table spec');
  45319. }
  45320. quantizationTables[quantizationTableSpec & 15] = tableData;
  45321. }
  45322. break;
  45323. case 0xFFC0:
  45324. case 0xFFC1:
  45325. case 0xFFC2:
  45326. if (frame) {
  45327. error('JPEG error: Only single frame JPEGs supported');
  45328. }
  45329. readUint16();
  45330. frame = {};
  45331. frame.extended = fileMarker === 0xFFC1;
  45332. frame.progressive = fileMarker === 0xFFC2;
  45333. frame.precision = data[offset++];
  45334. frame.scanLines = readUint16();
  45335. frame.samplesPerLine = readUint16();
  45336. frame.components = [];
  45337. frame.componentIds = {};
  45338. var componentsCount = data[offset++], componentId;
  45339. var maxH = 0, maxV = 0;
  45340. for (i = 0; i < componentsCount; i++) {
  45341. componentId = data[offset];
  45342. var h = data[offset + 1] >> 4;
  45343. var v = data[offset + 1] & 15;
  45344. if (maxH < h) {
  45345. maxH = h;
  45346. }
  45347. if (maxV < v) {
  45348. maxV = v;
  45349. }
  45350. var qId = data[offset + 2];
  45351. l = frame.components.push({
  45352. h: h,
  45353. v: v,
  45354. quantizationId: qId,
  45355. quantizationTable: null
  45356. });
  45357. frame.componentIds[componentId] = l - 1;
  45358. offset += 3;
  45359. }
  45360. frame.maxH = maxH;
  45361. frame.maxV = maxV;
  45362. prepareComponents(frame);
  45363. break;
  45364. case 0xFFC4:
  45365. var huffmanLength = readUint16();
  45366. for (i = 2; i < huffmanLength;) {
  45367. var huffmanTableSpec = data[offset++];
  45368. var codeLengths = new Uint8Array(16);
  45369. var codeLengthSum = 0;
  45370. for (j = 0; j < 16; j++, offset++) {
  45371. codeLengthSum += codeLengths[j] = data[offset];
  45372. }
  45373. var huffmanValues = new Uint8Array(codeLengthSum);
  45374. for (j = 0; j < codeLengthSum; j++, offset++) {
  45375. huffmanValues[j] = data[offset];
  45376. }
  45377. i += 17 + codeLengthSum;
  45378. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  45379. }
  45380. break;
  45381. case 0xFFDD:
  45382. readUint16();
  45383. resetInterval = readUint16();
  45384. break;
  45385. case 0xFFDA:
  45386. readUint16();
  45387. var selectorsCount = data[offset++];
  45388. var components = [], component;
  45389. for (i = 0; i < selectorsCount; i++) {
  45390. var componentIndex = frame.componentIds[data[offset++]];
  45391. component = frame.components[componentIndex];
  45392. var tableSpec = data[offset++];
  45393. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  45394. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  45395. components.push(component);
  45396. }
  45397. var spectralStart = data[offset++];
  45398. var spectralEnd = data[offset++];
  45399. var successiveApproximation = data[offset++];
  45400. var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15);
  45401. offset += processed;
  45402. break;
  45403. case 0xFFFF:
  45404. if (data[offset] !== 0xFF) {
  45405. offset--;
  45406. }
  45407. break;
  45408. default:
  45409. if (data[offset - 3] === 0xFF && data[offset - 2] >= 0xC0 && data[offset - 2] <= 0xFE) {
  45410. offset -= 3;
  45411. break;
  45412. }
  45413. error('JPEG error: unknown marker ' + fileMarker.toString(16));
  45414. }
  45415. fileMarker = readUint16();
  45416. }
  45417. this.width = frame.samplesPerLine;
  45418. this.height = frame.scanLines;
  45419. this.jfif = jfif;
  45420. this.adobe = adobe;
  45421. this.components = [];
  45422. for (i = 0; i < frame.components.length; i++) {
  45423. component = frame.components[i];
  45424. var quantizationTable = quantizationTables[component.quantizationId];
  45425. if (quantizationTable) {
  45426. component.quantizationTable = quantizationTable;
  45427. }
  45428. this.components.push({
  45429. output: buildComponentData(frame, component),
  45430. scaleX: component.h / frame.maxH,
  45431. scaleY: component.v / frame.maxV,
  45432. blocksPerLine: component.blocksPerLine,
  45433. blocksPerColumn: component.blocksPerColumn
  45434. });
  45435. }
  45436. this.numComponents = this.components.length;
  45437. },
  45438. _getLinearizedBlockData: function getLinearizedBlockData(width, height) {
  45439. var scaleX = this.width / width, scaleY = this.height / height;
  45440. var component, componentScaleX, componentScaleY, blocksPerScanline;
  45441. var x, y, i, j, k;
  45442. var index;
  45443. var offset = 0;
  45444. var output;
  45445. var numComponents = this.components.length;
  45446. var dataLength = width * height * numComponents;
  45447. var data = new Uint8Array(dataLength);
  45448. var xScaleBlockOffset = new Uint32Array(width);
  45449. var mask3LSB = 0xfffffff8;
  45450. for (i = 0; i < numComponents; i++) {
  45451. component = this.components[i];
  45452. componentScaleX = component.scaleX * scaleX;
  45453. componentScaleY = component.scaleY * scaleY;
  45454. offset = i;
  45455. output = component.output;
  45456. blocksPerScanline = component.blocksPerLine + 1 << 3;
  45457. for (x = 0; x < width; x++) {
  45458. j = 0 | x * componentScaleX;
  45459. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  45460. }
  45461. for (y = 0; y < height; y++) {
  45462. j = 0 | y * componentScaleY;
  45463. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  45464. for (x = 0; x < width; x++) {
  45465. data[offset] = output[index + xScaleBlockOffset[x]];
  45466. offset += numComponents;
  45467. }
  45468. }
  45469. }
  45470. var transform = this.decodeTransform;
  45471. if (transform) {
  45472. for (i = 0; i < dataLength;) {
  45473. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  45474. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  45475. }
  45476. }
  45477. }
  45478. return data;
  45479. },
  45480. _isColorConversionNeeded: function isColorConversionNeeded() {
  45481. if (this.adobe && this.adobe.transformCode) {
  45482. return true;
  45483. } else if (this.numComponents === 3) {
  45484. if (!this.adobe && this.colorTransform === 0) {
  45485. return false;
  45486. }
  45487. return true;
  45488. }
  45489. if (!this.adobe && this.colorTransform === 1) {
  45490. return true;
  45491. }
  45492. return false;
  45493. },
  45494. _convertYccToRgb: function convertYccToRgb(data) {
  45495. var Y, Cb, Cr;
  45496. for (var i = 0, length = data.length; i < length; i += 3) {
  45497. Y = data[i];
  45498. Cb = data[i + 1];
  45499. Cr = data[i + 2];
  45500. data[i] = clamp0to255(Y - 179.456 + 1.402 * Cr);
  45501. data[i + 1] = clamp0to255(Y + 135.459 - 0.344 * Cb - 0.714 * Cr);
  45502. data[i + 2] = clamp0to255(Y - 226.816 + 1.772 * Cb);
  45503. }
  45504. return data;
  45505. },
  45506. _convertYcckToRgb: function convertYcckToRgb(data) {
  45507. var Y, Cb, Cr, k;
  45508. var offset = 0;
  45509. for (var i = 0, length = data.length; i < length; i += 4) {
  45510. Y = data[i];
  45511. Cb = data[i + 1];
  45512. Cr = data[i + 2];
  45513. k = data[i + 3];
  45514. 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);
  45515. 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);
  45516. 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);
  45517. data[offset++] = clamp0to255(r);
  45518. data[offset++] = clamp0to255(g);
  45519. data[offset++] = clamp0to255(b);
  45520. }
  45521. return data;
  45522. },
  45523. _convertYcckToCmyk: function convertYcckToCmyk(data) {
  45524. var Y, Cb, Cr;
  45525. for (var i = 0, length = data.length; i < length; i += 4) {
  45526. Y = data[i];
  45527. Cb = data[i + 1];
  45528. Cr = data[i + 2];
  45529. data[i] = clamp0to255(434.456 - Y - 1.402 * Cr);
  45530. data[i + 1] = clamp0to255(119.541 - Y + 0.344 * Cb + 0.714 * Cr);
  45531. data[i + 2] = clamp0to255(481.816 - Y - 1.772 * Cb);
  45532. }
  45533. return data;
  45534. },
  45535. _convertCmykToRgb: function convertCmykToRgb(data) {
  45536. var c, m, y, k;
  45537. var offset = 0;
  45538. var min = -255 * 255 * 255;
  45539. var scale = 1 / 255 / 255;
  45540. for (var i = 0, length = data.length; i < length; i += 4) {
  45541. c = data[i];
  45542. m = data[i + 1];
  45543. y = data[i + 2];
  45544. k = data[i + 3];
  45545. 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);
  45546. 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);
  45547. 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);
  45548. data[offset++] = r >= 0 ? 255 : r <= min ? 0 : 255 + r * scale | 0;
  45549. data[offset++] = g >= 0 ? 255 : g <= min ? 0 : 255 + g * scale | 0;
  45550. data[offset++] = b >= 0 ? 255 : b <= min ? 0 : 255 + b * scale | 0;
  45551. }
  45552. return data;
  45553. },
  45554. getData: function getData(width, height, forceRGBoutput) {
  45555. if (this.numComponents > 4) {
  45556. error('JPEG error: Unsupported color mode');
  45557. }
  45558. var data = this._getLinearizedBlockData(width, height);
  45559. if (this.numComponents === 1 && forceRGBoutput) {
  45560. var dataLength = data.length;
  45561. var rgbData = new Uint8Array(dataLength * 3);
  45562. var offset = 0;
  45563. for (var i = 0; i < dataLength; i++) {
  45564. var grayColor = data[i];
  45565. rgbData[offset++] = grayColor;
  45566. rgbData[offset++] = grayColor;
  45567. rgbData[offset++] = grayColor;
  45568. }
  45569. return rgbData;
  45570. } else if (this.numComponents === 3 && this._isColorConversionNeeded()) {
  45571. return this._convertYccToRgb(data);
  45572. } else if (this.numComponents === 4) {
  45573. if (this._isColorConversionNeeded()) {
  45574. if (forceRGBoutput) {
  45575. return this._convertYcckToRgb(data);
  45576. }
  45577. return this._convertYcckToCmyk(data);
  45578. } else if (forceRGBoutput) {
  45579. return this._convertCmykToRgb(data);
  45580. }
  45581. }
  45582. return data;
  45583. }
  45584. };
  45585. return JpegImage;
  45586. }();
  45587. exports.JpegImage = JpegImage;
  45588. /***/ }),
  45589. /* 31 */
  45590. /***/ (function(module, exports, __w_pdfjs_require__) {
  45591. "use strict";
  45592. var sharedUtil = __w_pdfjs_require__(0);
  45593. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  45594. var getMetrics = getLookupTableFactory(function (t) {
  45595. t['Courier'] = 600;
  45596. t['Courier-Bold'] = 600;
  45597. t['Courier-BoldOblique'] = 600;
  45598. t['Courier-Oblique'] = 600;
  45599. t['Helvetica'] = getLookupTableFactory(function (t) {
  45600. t['space'] = 278;
  45601. t['exclam'] = 278;
  45602. t['quotedbl'] = 355;
  45603. t['numbersign'] = 556;
  45604. t['dollar'] = 556;
  45605. t['percent'] = 889;
  45606. t['ampersand'] = 667;
  45607. t['quoteright'] = 222;
  45608. t['parenleft'] = 333;
  45609. t['parenright'] = 333;
  45610. t['asterisk'] = 389;
  45611. t['plus'] = 584;
  45612. t['comma'] = 278;
  45613. t['hyphen'] = 333;
  45614. t['period'] = 278;
  45615. t['slash'] = 278;
  45616. t['zero'] = 556;
  45617. t['one'] = 556;
  45618. t['two'] = 556;
  45619. t['three'] = 556;
  45620. t['four'] = 556;
  45621. t['five'] = 556;
  45622. t['six'] = 556;
  45623. t['seven'] = 556;
  45624. t['eight'] = 556;
  45625. t['nine'] = 556;
  45626. t['colon'] = 278;
  45627. t['semicolon'] = 278;
  45628. t['less'] = 584;
  45629. t['equal'] = 584;
  45630. t['greater'] = 584;
  45631. t['question'] = 556;
  45632. t['at'] = 1015;
  45633. t['A'] = 667;
  45634. t['B'] = 667;
  45635. t['C'] = 722;
  45636. t['D'] = 722;
  45637. t['E'] = 667;
  45638. t['F'] = 611;
  45639. t['G'] = 778;
  45640. t['H'] = 722;
  45641. t['I'] = 278;
  45642. t['J'] = 500;
  45643. t['K'] = 667;
  45644. t['L'] = 556;
  45645. t['M'] = 833;
  45646. t['N'] = 722;
  45647. t['O'] = 778;
  45648. t['P'] = 667;
  45649. t['Q'] = 778;
  45650. t['R'] = 722;
  45651. t['S'] = 667;
  45652. t['T'] = 611;
  45653. t['U'] = 722;
  45654. t['V'] = 667;
  45655. t['W'] = 944;
  45656. t['X'] = 667;
  45657. t['Y'] = 667;
  45658. t['Z'] = 611;
  45659. t['bracketleft'] = 278;
  45660. t['backslash'] = 278;
  45661. t['bracketright'] = 278;
  45662. t['asciicircum'] = 469;
  45663. t['underscore'] = 556;
  45664. t['quoteleft'] = 222;
  45665. t['a'] = 556;
  45666. t['b'] = 556;
  45667. t['c'] = 500;
  45668. t['d'] = 556;
  45669. t['e'] = 556;
  45670. t['f'] = 278;
  45671. t['g'] = 556;
  45672. t['h'] = 556;
  45673. t['i'] = 222;
  45674. t['j'] = 222;
  45675. t['k'] = 500;
  45676. t['l'] = 222;
  45677. t['m'] = 833;
  45678. t['n'] = 556;
  45679. t['o'] = 556;
  45680. t['p'] = 556;
  45681. t['q'] = 556;
  45682. t['r'] = 333;
  45683. t['s'] = 500;
  45684. t['t'] = 278;
  45685. t['u'] = 556;
  45686. t['v'] = 500;
  45687. t['w'] = 722;
  45688. t['x'] = 500;
  45689. t['y'] = 500;
  45690. t['z'] = 500;
  45691. t['braceleft'] = 334;
  45692. t['bar'] = 260;
  45693. t['braceright'] = 334;
  45694. t['asciitilde'] = 584;
  45695. t['exclamdown'] = 333;
  45696. t['cent'] = 556;
  45697. t['sterling'] = 556;
  45698. t['fraction'] = 167;
  45699. t['yen'] = 556;
  45700. t['florin'] = 556;
  45701. t['section'] = 556;
  45702. t['currency'] = 556;
  45703. t['quotesingle'] = 191;
  45704. t['quotedblleft'] = 333;
  45705. t['guillemotleft'] = 556;
  45706. t['guilsinglleft'] = 333;
  45707. t['guilsinglright'] = 333;
  45708. t['fi'] = 500;
  45709. t['fl'] = 500;
  45710. t['endash'] = 556;
  45711. t['dagger'] = 556;
  45712. t['daggerdbl'] = 556;
  45713. t['periodcentered'] = 278;
  45714. t['paragraph'] = 537;
  45715. t['bullet'] = 350;
  45716. t['quotesinglbase'] = 222;
  45717. t['quotedblbase'] = 333;
  45718. t['quotedblright'] = 333;
  45719. t['guillemotright'] = 556;
  45720. t['ellipsis'] = 1000;
  45721. t['perthousand'] = 1000;
  45722. t['questiondown'] = 611;
  45723. t['grave'] = 333;
  45724. t['acute'] = 333;
  45725. t['circumflex'] = 333;
  45726. t['tilde'] = 333;
  45727. t['macron'] = 333;
  45728. t['breve'] = 333;
  45729. t['dotaccent'] = 333;
  45730. t['dieresis'] = 333;
  45731. t['ring'] = 333;
  45732. t['cedilla'] = 333;
  45733. t['hungarumlaut'] = 333;
  45734. t['ogonek'] = 333;
  45735. t['caron'] = 333;
  45736. t['emdash'] = 1000;
  45737. t['AE'] = 1000;
  45738. t['ordfeminine'] = 370;
  45739. t['Lslash'] = 556;
  45740. t['Oslash'] = 778;
  45741. t['OE'] = 1000;
  45742. t['ordmasculine'] = 365;
  45743. t['ae'] = 889;
  45744. t['dotlessi'] = 278;
  45745. t['lslash'] = 222;
  45746. t['oslash'] = 611;
  45747. t['oe'] = 944;
  45748. t['germandbls'] = 611;
  45749. t['Idieresis'] = 278;
  45750. t['eacute'] = 556;
  45751. t['abreve'] = 556;
  45752. t['uhungarumlaut'] = 556;
  45753. t['ecaron'] = 556;
  45754. t['Ydieresis'] = 667;
  45755. t['divide'] = 584;
  45756. t['Yacute'] = 667;
  45757. t['Acircumflex'] = 667;
  45758. t['aacute'] = 556;
  45759. t['Ucircumflex'] = 722;
  45760. t['yacute'] = 500;
  45761. t['scommaaccent'] = 500;
  45762. t['ecircumflex'] = 556;
  45763. t['Uring'] = 722;
  45764. t['Udieresis'] = 722;
  45765. t['aogonek'] = 556;
  45766. t['Uacute'] = 722;
  45767. t['uogonek'] = 556;
  45768. t['Edieresis'] = 667;
  45769. t['Dcroat'] = 722;
  45770. t['commaaccent'] = 250;
  45771. t['copyright'] = 737;
  45772. t['Emacron'] = 667;
  45773. t['ccaron'] = 500;
  45774. t['aring'] = 556;
  45775. t['Ncommaaccent'] = 722;
  45776. t['lacute'] = 222;
  45777. t['agrave'] = 556;
  45778. t['Tcommaaccent'] = 611;
  45779. t['Cacute'] = 722;
  45780. t['atilde'] = 556;
  45781. t['Edotaccent'] = 667;
  45782. t['scaron'] = 500;
  45783. t['scedilla'] = 500;
  45784. t['iacute'] = 278;
  45785. t['lozenge'] = 471;
  45786. t['Rcaron'] = 722;
  45787. t['Gcommaaccent'] = 778;
  45788. t['ucircumflex'] = 556;
  45789. t['acircumflex'] = 556;
  45790. t['Amacron'] = 667;
  45791. t['rcaron'] = 333;
  45792. t['ccedilla'] = 500;
  45793. t['Zdotaccent'] = 611;
  45794. t['Thorn'] = 667;
  45795. t['Omacron'] = 778;
  45796. t['Racute'] = 722;
  45797. t['Sacute'] = 667;
  45798. t['dcaron'] = 643;
  45799. t['Umacron'] = 722;
  45800. t['uring'] = 556;
  45801. t['threesuperior'] = 333;
  45802. t['Ograve'] = 778;
  45803. t['Agrave'] = 667;
  45804. t['Abreve'] = 667;
  45805. t['multiply'] = 584;
  45806. t['uacute'] = 556;
  45807. t['Tcaron'] = 611;
  45808. t['partialdiff'] = 476;
  45809. t['ydieresis'] = 500;
  45810. t['Nacute'] = 722;
  45811. t['icircumflex'] = 278;
  45812. t['Ecircumflex'] = 667;
  45813. t['adieresis'] = 556;
  45814. t['edieresis'] = 556;
  45815. t['cacute'] = 500;
  45816. t['nacute'] = 556;
  45817. t['umacron'] = 556;
  45818. t['Ncaron'] = 722;
  45819. t['Iacute'] = 278;
  45820. t['plusminus'] = 584;
  45821. t['brokenbar'] = 260;
  45822. t['registered'] = 737;
  45823. t['Gbreve'] = 778;
  45824. t['Idotaccent'] = 278;
  45825. t['summation'] = 600;
  45826. t['Egrave'] = 667;
  45827. t['racute'] = 333;
  45828. t['omacron'] = 556;
  45829. t['Zacute'] = 611;
  45830. t['Zcaron'] = 611;
  45831. t['greaterequal'] = 549;
  45832. t['Eth'] = 722;
  45833. t['Ccedilla'] = 722;
  45834. t['lcommaaccent'] = 222;
  45835. t['tcaron'] = 317;
  45836. t['eogonek'] = 556;
  45837. t['Uogonek'] = 722;
  45838. t['Aacute'] = 667;
  45839. t['Adieresis'] = 667;
  45840. t['egrave'] = 556;
  45841. t['zacute'] = 500;
  45842. t['iogonek'] = 222;
  45843. t['Oacute'] = 778;
  45844. t['oacute'] = 556;
  45845. t['amacron'] = 556;
  45846. t['sacute'] = 500;
  45847. t['idieresis'] = 278;
  45848. t['Ocircumflex'] = 778;
  45849. t['Ugrave'] = 722;
  45850. t['Delta'] = 612;
  45851. t['thorn'] = 556;
  45852. t['twosuperior'] = 333;
  45853. t['Odieresis'] = 778;
  45854. t['mu'] = 556;
  45855. t['igrave'] = 278;
  45856. t['ohungarumlaut'] = 556;
  45857. t['Eogonek'] = 667;
  45858. t['dcroat'] = 556;
  45859. t['threequarters'] = 834;
  45860. t['Scedilla'] = 667;
  45861. t['lcaron'] = 299;
  45862. t['Kcommaaccent'] = 667;
  45863. t['Lacute'] = 556;
  45864. t['trademark'] = 1000;
  45865. t['edotaccent'] = 556;
  45866. t['Igrave'] = 278;
  45867. t['Imacron'] = 278;
  45868. t['Lcaron'] = 556;
  45869. t['onehalf'] = 834;
  45870. t['lessequal'] = 549;
  45871. t['ocircumflex'] = 556;
  45872. t['ntilde'] = 556;
  45873. t['Uhungarumlaut'] = 722;
  45874. t['Eacute'] = 667;
  45875. t['emacron'] = 556;
  45876. t['gbreve'] = 556;
  45877. t['onequarter'] = 834;
  45878. t['Scaron'] = 667;
  45879. t['Scommaaccent'] = 667;
  45880. t['Ohungarumlaut'] = 778;
  45881. t['degree'] = 400;
  45882. t['ograve'] = 556;
  45883. t['Ccaron'] = 722;
  45884. t['ugrave'] = 556;
  45885. t['radical'] = 453;
  45886. t['Dcaron'] = 722;
  45887. t['rcommaaccent'] = 333;
  45888. t['Ntilde'] = 722;
  45889. t['otilde'] = 556;
  45890. t['Rcommaaccent'] = 722;
  45891. t['Lcommaaccent'] = 556;
  45892. t['Atilde'] = 667;
  45893. t['Aogonek'] = 667;
  45894. t['Aring'] = 667;
  45895. t['Otilde'] = 778;
  45896. t['zdotaccent'] = 500;
  45897. t['Ecaron'] = 667;
  45898. t['Iogonek'] = 278;
  45899. t['kcommaaccent'] = 500;
  45900. t['minus'] = 584;
  45901. t['Icircumflex'] = 278;
  45902. t['ncaron'] = 556;
  45903. t['tcommaaccent'] = 278;
  45904. t['logicalnot'] = 584;
  45905. t['odieresis'] = 556;
  45906. t['udieresis'] = 556;
  45907. t['notequal'] = 549;
  45908. t['gcommaaccent'] = 556;
  45909. t['eth'] = 556;
  45910. t['zcaron'] = 500;
  45911. t['ncommaaccent'] = 556;
  45912. t['onesuperior'] = 333;
  45913. t['imacron'] = 278;
  45914. t['Euro'] = 556;
  45915. });
  45916. t['Helvetica-Bold'] = getLookupTableFactory(function (t) {
  45917. t['space'] = 278;
  45918. t['exclam'] = 333;
  45919. t['quotedbl'] = 474;
  45920. t['numbersign'] = 556;
  45921. t['dollar'] = 556;
  45922. t['percent'] = 889;
  45923. t['ampersand'] = 722;
  45924. t['quoteright'] = 278;
  45925. t['parenleft'] = 333;
  45926. t['parenright'] = 333;
  45927. t['asterisk'] = 389;
  45928. t['plus'] = 584;
  45929. t['comma'] = 278;
  45930. t['hyphen'] = 333;
  45931. t['period'] = 278;
  45932. t['slash'] = 278;
  45933. t['zero'] = 556;
  45934. t['one'] = 556;
  45935. t['two'] = 556;
  45936. t['three'] = 556;
  45937. t['four'] = 556;
  45938. t['five'] = 556;
  45939. t['six'] = 556;
  45940. t['seven'] = 556;
  45941. t['eight'] = 556;
  45942. t['nine'] = 556;
  45943. t['colon'] = 333;
  45944. t['semicolon'] = 333;
  45945. t['less'] = 584;
  45946. t['equal'] = 584;
  45947. t['greater'] = 584;
  45948. t['question'] = 611;
  45949. t['at'] = 975;
  45950. t['A'] = 722;
  45951. t['B'] = 722;
  45952. t['C'] = 722;
  45953. t['D'] = 722;
  45954. t['E'] = 667;
  45955. t['F'] = 611;
  45956. t['G'] = 778;
  45957. t['H'] = 722;
  45958. t['I'] = 278;
  45959. t['J'] = 556;
  45960. t['K'] = 722;
  45961. t['L'] = 611;
  45962. t['M'] = 833;
  45963. t['N'] = 722;
  45964. t['O'] = 778;
  45965. t['P'] = 667;
  45966. t['Q'] = 778;
  45967. t['R'] = 722;
  45968. t['S'] = 667;
  45969. t['T'] = 611;
  45970. t['U'] = 722;
  45971. t['V'] = 667;
  45972. t['W'] = 944;
  45973. t['X'] = 667;
  45974. t['Y'] = 667;
  45975. t['Z'] = 611;
  45976. t['bracketleft'] = 333;
  45977. t['backslash'] = 278;
  45978. t['bracketright'] = 333;
  45979. t['asciicircum'] = 584;
  45980. t['underscore'] = 556;
  45981. t['quoteleft'] = 278;
  45982. t['a'] = 556;
  45983. t['b'] = 611;
  45984. t['c'] = 556;
  45985. t['d'] = 611;
  45986. t['e'] = 556;
  45987. t['f'] = 333;
  45988. t['g'] = 611;
  45989. t['h'] = 611;
  45990. t['i'] = 278;
  45991. t['j'] = 278;
  45992. t['k'] = 556;
  45993. t['l'] = 278;
  45994. t['m'] = 889;
  45995. t['n'] = 611;
  45996. t['o'] = 611;
  45997. t['p'] = 611;
  45998. t['q'] = 611;
  45999. t['r'] = 389;
  46000. t['s'] = 556;
  46001. t['t'] = 333;
  46002. t['u'] = 611;
  46003. t['v'] = 556;
  46004. t['w'] = 778;
  46005. t['x'] = 556;
  46006. t['y'] = 556;
  46007. t['z'] = 500;
  46008. t['braceleft'] = 389;
  46009. t['bar'] = 280;
  46010. t['braceright'] = 389;
  46011. t['asciitilde'] = 584;
  46012. t['exclamdown'] = 333;
  46013. t['cent'] = 556;
  46014. t['sterling'] = 556;
  46015. t['fraction'] = 167;
  46016. t['yen'] = 556;
  46017. t['florin'] = 556;
  46018. t['section'] = 556;
  46019. t['currency'] = 556;
  46020. t['quotesingle'] = 238;
  46021. t['quotedblleft'] = 500;
  46022. t['guillemotleft'] = 556;
  46023. t['guilsinglleft'] = 333;
  46024. t['guilsinglright'] = 333;
  46025. t['fi'] = 611;
  46026. t['fl'] = 611;
  46027. t['endash'] = 556;
  46028. t['dagger'] = 556;
  46029. t['daggerdbl'] = 556;
  46030. t['periodcentered'] = 278;
  46031. t['paragraph'] = 556;
  46032. t['bullet'] = 350;
  46033. t['quotesinglbase'] = 278;
  46034. t['quotedblbase'] = 500;
  46035. t['quotedblright'] = 500;
  46036. t['guillemotright'] = 556;
  46037. t['ellipsis'] = 1000;
  46038. t['perthousand'] = 1000;
  46039. t['questiondown'] = 611;
  46040. t['grave'] = 333;
  46041. t['acute'] = 333;
  46042. t['circumflex'] = 333;
  46043. t['tilde'] = 333;
  46044. t['macron'] = 333;
  46045. t['breve'] = 333;
  46046. t['dotaccent'] = 333;
  46047. t['dieresis'] = 333;
  46048. t['ring'] = 333;
  46049. t['cedilla'] = 333;
  46050. t['hungarumlaut'] = 333;
  46051. t['ogonek'] = 333;
  46052. t['caron'] = 333;
  46053. t['emdash'] = 1000;
  46054. t['AE'] = 1000;
  46055. t['ordfeminine'] = 370;
  46056. t['Lslash'] = 611;
  46057. t['Oslash'] = 778;
  46058. t['OE'] = 1000;
  46059. t['ordmasculine'] = 365;
  46060. t['ae'] = 889;
  46061. t['dotlessi'] = 278;
  46062. t['lslash'] = 278;
  46063. t['oslash'] = 611;
  46064. t['oe'] = 944;
  46065. t['germandbls'] = 611;
  46066. t['Idieresis'] = 278;
  46067. t['eacute'] = 556;
  46068. t['abreve'] = 556;
  46069. t['uhungarumlaut'] = 611;
  46070. t['ecaron'] = 556;
  46071. t['Ydieresis'] = 667;
  46072. t['divide'] = 584;
  46073. t['Yacute'] = 667;
  46074. t['Acircumflex'] = 722;
  46075. t['aacute'] = 556;
  46076. t['Ucircumflex'] = 722;
  46077. t['yacute'] = 556;
  46078. t['scommaaccent'] = 556;
  46079. t['ecircumflex'] = 556;
  46080. t['Uring'] = 722;
  46081. t['Udieresis'] = 722;
  46082. t['aogonek'] = 556;
  46083. t['Uacute'] = 722;
  46084. t['uogonek'] = 611;
  46085. t['Edieresis'] = 667;
  46086. t['Dcroat'] = 722;
  46087. t['commaaccent'] = 250;
  46088. t['copyright'] = 737;
  46089. t['Emacron'] = 667;
  46090. t['ccaron'] = 556;
  46091. t['aring'] = 556;
  46092. t['Ncommaaccent'] = 722;
  46093. t['lacute'] = 278;
  46094. t['agrave'] = 556;
  46095. t['Tcommaaccent'] = 611;
  46096. t['Cacute'] = 722;
  46097. t['atilde'] = 556;
  46098. t['Edotaccent'] = 667;
  46099. t['scaron'] = 556;
  46100. t['scedilla'] = 556;
  46101. t['iacute'] = 278;
  46102. t['lozenge'] = 494;
  46103. t['Rcaron'] = 722;
  46104. t['Gcommaaccent'] = 778;
  46105. t['ucircumflex'] = 611;
  46106. t['acircumflex'] = 556;
  46107. t['Amacron'] = 722;
  46108. t['rcaron'] = 389;
  46109. t['ccedilla'] = 556;
  46110. t['Zdotaccent'] = 611;
  46111. t['Thorn'] = 667;
  46112. t['Omacron'] = 778;
  46113. t['Racute'] = 722;
  46114. t['Sacute'] = 667;
  46115. t['dcaron'] = 743;
  46116. t['Umacron'] = 722;
  46117. t['uring'] = 611;
  46118. t['threesuperior'] = 333;
  46119. t['Ograve'] = 778;
  46120. t['Agrave'] = 722;
  46121. t['Abreve'] = 722;
  46122. t['multiply'] = 584;
  46123. t['uacute'] = 611;
  46124. t['Tcaron'] = 611;
  46125. t['partialdiff'] = 494;
  46126. t['ydieresis'] = 556;
  46127. t['Nacute'] = 722;
  46128. t['icircumflex'] = 278;
  46129. t['Ecircumflex'] = 667;
  46130. t['adieresis'] = 556;
  46131. t['edieresis'] = 556;
  46132. t['cacute'] = 556;
  46133. t['nacute'] = 611;
  46134. t['umacron'] = 611;
  46135. t['Ncaron'] = 722;
  46136. t['Iacute'] = 278;
  46137. t['plusminus'] = 584;
  46138. t['brokenbar'] = 280;
  46139. t['registered'] = 737;
  46140. t['Gbreve'] = 778;
  46141. t['Idotaccent'] = 278;
  46142. t['summation'] = 600;
  46143. t['Egrave'] = 667;
  46144. t['racute'] = 389;
  46145. t['omacron'] = 611;
  46146. t['Zacute'] = 611;
  46147. t['Zcaron'] = 611;
  46148. t['greaterequal'] = 549;
  46149. t['Eth'] = 722;
  46150. t['Ccedilla'] = 722;
  46151. t['lcommaaccent'] = 278;
  46152. t['tcaron'] = 389;
  46153. t['eogonek'] = 556;
  46154. t['Uogonek'] = 722;
  46155. t['Aacute'] = 722;
  46156. t['Adieresis'] = 722;
  46157. t['egrave'] = 556;
  46158. t['zacute'] = 500;
  46159. t['iogonek'] = 278;
  46160. t['Oacute'] = 778;
  46161. t['oacute'] = 611;
  46162. t['amacron'] = 556;
  46163. t['sacute'] = 556;
  46164. t['idieresis'] = 278;
  46165. t['Ocircumflex'] = 778;
  46166. t['Ugrave'] = 722;
  46167. t['Delta'] = 612;
  46168. t['thorn'] = 611;
  46169. t['twosuperior'] = 333;
  46170. t['Odieresis'] = 778;
  46171. t['mu'] = 611;
  46172. t['igrave'] = 278;
  46173. t['ohungarumlaut'] = 611;
  46174. t['Eogonek'] = 667;
  46175. t['dcroat'] = 611;
  46176. t['threequarters'] = 834;
  46177. t['Scedilla'] = 667;
  46178. t['lcaron'] = 400;
  46179. t['Kcommaaccent'] = 722;
  46180. t['Lacute'] = 611;
  46181. t['trademark'] = 1000;
  46182. t['edotaccent'] = 556;
  46183. t['Igrave'] = 278;
  46184. t['Imacron'] = 278;
  46185. t['Lcaron'] = 611;
  46186. t['onehalf'] = 834;
  46187. t['lessequal'] = 549;
  46188. t['ocircumflex'] = 611;
  46189. t['ntilde'] = 611;
  46190. t['Uhungarumlaut'] = 722;
  46191. t['Eacute'] = 667;
  46192. t['emacron'] = 556;
  46193. t['gbreve'] = 611;
  46194. t['onequarter'] = 834;
  46195. t['Scaron'] = 667;
  46196. t['Scommaaccent'] = 667;
  46197. t['Ohungarumlaut'] = 778;
  46198. t['degree'] = 400;
  46199. t['ograve'] = 611;
  46200. t['Ccaron'] = 722;
  46201. t['ugrave'] = 611;
  46202. t['radical'] = 549;
  46203. t['Dcaron'] = 722;
  46204. t['rcommaaccent'] = 389;
  46205. t['Ntilde'] = 722;
  46206. t['otilde'] = 611;
  46207. t['Rcommaaccent'] = 722;
  46208. t['Lcommaaccent'] = 611;
  46209. t['Atilde'] = 722;
  46210. t['Aogonek'] = 722;
  46211. t['Aring'] = 722;
  46212. t['Otilde'] = 778;
  46213. t['zdotaccent'] = 500;
  46214. t['Ecaron'] = 667;
  46215. t['Iogonek'] = 278;
  46216. t['kcommaaccent'] = 556;
  46217. t['minus'] = 584;
  46218. t['Icircumflex'] = 278;
  46219. t['ncaron'] = 611;
  46220. t['tcommaaccent'] = 333;
  46221. t['logicalnot'] = 584;
  46222. t['odieresis'] = 611;
  46223. t['udieresis'] = 611;
  46224. t['notequal'] = 549;
  46225. t['gcommaaccent'] = 611;
  46226. t['eth'] = 611;
  46227. t['zcaron'] = 500;
  46228. t['ncommaaccent'] = 611;
  46229. t['onesuperior'] = 333;
  46230. t['imacron'] = 278;
  46231. t['Euro'] = 556;
  46232. });
  46233. t['Helvetica-BoldOblique'] = getLookupTableFactory(function (t) {
  46234. t['space'] = 278;
  46235. t['exclam'] = 333;
  46236. t['quotedbl'] = 474;
  46237. t['numbersign'] = 556;
  46238. t['dollar'] = 556;
  46239. t['percent'] = 889;
  46240. t['ampersand'] = 722;
  46241. t['quoteright'] = 278;
  46242. t['parenleft'] = 333;
  46243. t['parenright'] = 333;
  46244. t['asterisk'] = 389;
  46245. t['plus'] = 584;
  46246. t['comma'] = 278;
  46247. t['hyphen'] = 333;
  46248. t['period'] = 278;
  46249. t['slash'] = 278;
  46250. t['zero'] = 556;
  46251. t['one'] = 556;
  46252. t['two'] = 556;
  46253. t['three'] = 556;
  46254. t['four'] = 556;
  46255. t['five'] = 556;
  46256. t['six'] = 556;
  46257. t['seven'] = 556;
  46258. t['eight'] = 556;
  46259. t['nine'] = 556;
  46260. t['colon'] = 333;
  46261. t['semicolon'] = 333;
  46262. t['less'] = 584;
  46263. t['equal'] = 584;
  46264. t['greater'] = 584;
  46265. t['question'] = 611;
  46266. t['at'] = 975;
  46267. t['A'] = 722;
  46268. t['B'] = 722;
  46269. t['C'] = 722;
  46270. t['D'] = 722;
  46271. t['E'] = 667;
  46272. t['F'] = 611;
  46273. t['G'] = 778;
  46274. t['H'] = 722;
  46275. t['I'] = 278;
  46276. t['J'] = 556;
  46277. t['K'] = 722;
  46278. t['L'] = 611;
  46279. t['M'] = 833;
  46280. t['N'] = 722;
  46281. t['O'] = 778;
  46282. t['P'] = 667;
  46283. t['Q'] = 778;
  46284. t['R'] = 722;
  46285. t['S'] = 667;
  46286. t['T'] = 611;
  46287. t['U'] = 722;
  46288. t['V'] = 667;
  46289. t['W'] = 944;
  46290. t['X'] = 667;
  46291. t['Y'] = 667;
  46292. t['Z'] = 611;
  46293. t['bracketleft'] = 333;
  46294. t['backslash'] = 278;
  46295. t['bracketright'] = 333;
  46296. t['asciicircum'] = 584;
  46297. t['underscore'] = 556;
  46298. t['quoteleft'] = 278;
  46299. t['a'] = 556;
  46300. t['b'] = 611;
  46301. t['c'] = 556;
  46302. t['d'] = 611;
  46303. t['e'] = 556;
  46304. t['f'] = 333;
  46305. t['g'] = 611;
  46306. t['h'] = 611;
  46307. t['i'] = 278;
  46308. t['j'] = 278;
  46309. t['k'] = 556;
  46310. t['l'] = 278;
  46311. t['m'] = 889;
  46312. t['n'] = 611;
  46313. t['o'] = 611;
  46314. t['p'] = 611;
  46315. t['q'] = 611;
  46316. t['r'] = 389;
  46317. t['s'] = 556;
  46318. t['t'] = 333;
  46319. t['u'] = 611;
  46320. t['v'] = 556;
  46321. t['w'] = 778;
  46322. t['x'] = 556;
  46323. t['y'] = 556;
  46324. t['z'] = 500;
  46325. t['braceleft'] = 389;
  46326. t['bar'] = 280;
  46327. t['braceright'] = 389;
  46328. t['asciitilde'] = 584;
  46329. t['exclamdown'] = 333;
  46330. t['cent'] = 556;
  46331. t['sterling'] = 556;
  46332. t['fraction'] = 167;
  46333. t['yen'] = 556;
  46334. t['florin'] = 556;
  46335. t['section'] = 556;
  46336. t['currency'] = 556;
  46337. t['quotesingle'] = 238;
  46338. t['quotedblleft'] = 500;
  46339. t['guillemotleft'] = 556;
  46340. t['guilsinglleft'] = 333;
  46341. t['guilsinglright'] = 333;
  46342. t['fi'] = 611;
  46343. t['fl'] = 611;
  46344. t['endash'] = 556;
  46345. t['dagger'] = 556;
  46346. t['daggerdbl'] = 556;
  46347. t['periodcentered'] = 278;
  46348. t['paragraph'] = 556;
  46349. t['bullet'] = 350;
  46350. t['quotesinglbase'] = 278;
  46351. t['quotedblbase'] = 500;
  46352. t['quotedblright'] = 500;
  46353. t['guillemotright'] = 556;
  46354. t['ellipsis'] = 1000;
  46355. t['perthousand'] = 1000;
  46356. t['questiondown'] = 611;
  46357. t['grave'] = 333;
  46358. t['acute'] = 333;
  46359. t['circumflex'] = 333;
  46360. t['tilde'] = 333;
  46361. t['macron'] = 333;
  46362. t['breve'] = 333;
  46363. t['dotaccent'] = 333;
  46364. t['dieresis'] = 333;
  46365. t['ring'] = 333;
  46366. t['cedilla'] = 333;
  46367. t['hungarumlaut'] = 333;
  46368. t['ogonek'] = 333;
  46369. t['caron'] = 333;
  46370. t['emdash'] = 1000;
  46371. t['AE'] = 1000;
  46372. t['ordfeminine'] = 370;
  46373. t['Lslash'] = 611;
  46374. t['Oslash'] = 778;
  46375. t['OE'] = 1000;
  46376. t['ordmasculine'] = 365;
  46377. t['ae'] = 889;
  46378. t['dotlessi'] = 278;
  46379. t['lslash'] = 278;
  46380. t['oslash'] = 611;
  46381. t['oe'] = 944;
  46382. t['germandbls'] = 611;
  46383. t['Idieresis'] = 278;
  46384. t['eacute'] = 556;
  46385. t['abreve'] = 556;
  46386. t['uhungarumlaut'] = 611;
  46387. t['ecaron'] = 556;
  46388. t['Ydieresis'] = 667;
  46389. t['divide'] = 584;
  46390. t['Yacute'] = 667;
  46391. t['Acircumflex'] = 722;
  46392. t['aacute'] = 556;
  46393. t['Ucircumflex'] = 722;
  46394. t['yacute'] = 556;
  46395. t['scommaaccent'] = 556;
  46396. t['ecircumflex'] = 556;
  46397. t['Uring'] = 722;
  46398. t['Udieresis'] = 722;
  46399. t['aogonek'] = 556;
  46400. t['Uacute'] = 722;
  46401. t['uogonek'] = 611;
  46402. t['Edieresis'] = 667;
  46403. t['Dcroat'] = 722;
  46404. t['commaaccent'] = 250;
  46405. t['copyright'] = 737;
  46406. t['Emacron'] = 667;
  46407. t['ccaron'] = 556;
  46408. t['aring'] = 556;
  46409. t['Ncommaaccent'] = 722;
  46410. t['lacute'] = 278;
  46411. t['agrave'] = 556;
  46412. t['Tcommaaccent'] = 611;
  46413. t['Cacute'] = 722;
  46414. t['atilde'] = 556;
  46415. t['Edotaccent'] = 667;
  46416. t['scaron'] = 556;
  46417. t['scedilla'] = 556;
  46418. t['iacute'] = 278;
  46419. t['lozenge'] = 494;
  46420. t['Rcaron'] = 722;
  46421. t['Gcommaaccent'] = 778;
  46422. t['ucircumflex'] = 611;
  46423. t['acircumflex'] = 556;
  46424. t['Amacron'] = 722;
  46425. t['rcaron'] = 389;
  46426. t['ccedilla'] = 556;
  46427. t['Zdotaccent'] = 611;
  46428. t['Thorn'] = 667;
  46429. t['Omacron'] = 778;
  46430. t['Racute'] = 722;
  46431. t['Sacute'] = 667;
  46432. t['dcaron'] = 743;
  46433. t['Umacron'] = 722;
  46434. t['uring'] = 611;
  46435. t['threesuperior'] = 333;
  46436. t['Ograve'] = 778;
  46437. t['Agrave'] = 722;
  46438. t['Abreve'] = 722;
  46439. t['multiply'] = 584;
  46440. t['uacute'] = 611;
  46441. t['Tcaron'] = 611;
  46442. t['partialdiff'] = 494;
  46443. t['ydieresis'] = 556;
  46444. t['Nacute'] = 722;
  46445. t['icircumflex'] = 278;
  46446. t['Ecircumflex'] = 667;
  46447. t['adieresis'] = 556;
  46448. t['edieresis'] = 556;
  46449. t['cacute'] = 556;
  46450. t['nacute'] = 611;
  46451. t['umacron'] = 611;
  46452. t['Ncaron'] = 722;
  46453. t['Iacute'] = 278;
  46454. t['plusminus'] = 584;
  46455. t['brokenbar'] = 280;
  46456. t['registered'] = 737;
  46457. t['Gbreve'] = 778;
  46458. t['Idotaccent'] = 278;
  46459. t['summation'] = 600;
  46460. t['Egrave'] = 667;
  46461. t['racute'] = 389;
  46462. t['omacron'] = 611;
  46463. t['Zacute'] = 611;
  46464. t['Zcaron'] = 611;
  46465. t['greaterequal'] = 549;
  46466. t['Eth'] = 722;
  46467. t['Ccedilla'] = 722;
  46468. t['lcommaaccent'] = 278;
  46469. t['tcaron'] = 389;
  46470. t['eogonek'] = 556;
  46471. t['Uogonek'] = 722;
  46472. t['Aacute'] = 722;
  46473. t['Adieresis'] = 722;
  46474. t['egrave'] = 556;
  46475. t['zacute'] = 500;
  46476. t['iogonek'] = 278;
  46477. t['Oacute'] = 778;
  46478. t['oacute'] = 611;
  46479. t['amacron'] = 556;
  46480. t['sacute'] = 556;
  46481. t['idieresis'] = 278;
  46482. t['Ocircumflex'] = 778;
  46483. t['Ugrave'] = 722;
  46484. t['Delta'] = 612;
  46485. t['thorn'] = 611;
  46486. t['twosuperior'] = 333;
  46487. t['Odieresis'] = 778;
  46488. t['mu'] = 611;
  46489. t['igrave'] = 278;
  46490. t['ohungarumlaut'] = 611;
  46491. t['Eogonek'] = 667;
  46492. t['dcroat'] = 611;
  46493. t['threequarters'] = 834;
  46494. t['Scedilla'] = 667;
  46495. t['lcaron'] = 400;
  46496. t['Kcommaaccent'] = 722;
  46497. t['Lacute'] = 611;
  46498. t['trademark'] = 1000;
  46499. t['edotaccent'] = 556;
  46500. t['Igrave'] = 278;
  46501. t['Imacron'] = 278;
  46502. t['Lcaron'] = 611;
  46503. t['onehalf'] = 834;
  46504. t['lessequal'] = 549;
  46505. t['ocircumflex'] = 611;
  46506. t['ntilde'] = 611;
  46507. t['Uhungarumlaut'] = 722;
  46508. t['Eacute'] = 667;
  46509. t['emacron'] = 556;
  46510. t['gbreve'] = 611;
  46511. t['onequarter'] = 834;
  46512. t['Scaron'] = 667;
  46513. t['Scommaaccent'] = 667;
  46514. t['Ohungarumlaut'] = 778;
  46515. t['degree'] = 400;
  46516. t['ograve'] = 611;
  46517. t['Ccaron'] = 722;
  46518. t['ugrave'] = 611;
  46519. t['radical'] = 549;
  46520. t['Dcaron'] = 722;
  46521. t['rcommaaccent'] = 389;
  46522. t['Ntilde'] = 722;
  46523. t['otilde'] = 611;
  46524. t['Rcommaaccent'] = 722;
  46525. t['Lcommaaccent'] = 611;
  46526. t['Atilde'] = 722;
  46527. t['Aogonek'] = 722;
  46528. t['Aring'] = 722;
  46529. t['Otilde'] = 778;
  46530. t['zdotaccent'] = 500;
  46531. t['Ecaron'] = 667;
  46532. t['Iogonek'] = 278;
  46533. t['kcommaaccent'] = 556;
  46534. t['minus'] = 584;
  46535. t['Icircumflex'] = 278;
  46536. t['ncaron'] = 611;
  46537. t['tcommaaccent'] = 333;
  46538. t['logicalnot'] = 584;
  46539. t['odieresis'] = 611;
  46540. t['udieresis'] = 611;
  46541. t['notequal'] = 549;
  46542. t['gcommaaccent'] = 611;
  46543. t['eth'] = 611;
  46544. t['zcaron'] = 500;
  46545. t['ncommaaccent'] = 611;
  46546. t['onesuperior'] = 333;
  46547. t['imacron'] = 278;
  46548. t['Euro'] = 556;
  46549. });
  46550. t['Helvetica-Oblique'] = getLookupTableFactory(function (t) {
  46551. t['space'] = 278;
  46552. t['exclam'] = 278;
  46553. t['quotedbl'] = 355;
  46554. t['numbersign'] = 556;
  46555. t['dollar'] = 556;
  46556. t['percent'] = 889;
  46557. t['ampersand'] = 667;
  46558. t['quoteright'] = 222;
  46559. t['parenleft'] = 333;
  46560. t['parenright'] = 333;
  46561. t['asterisk'] = 389;
  46562. t['plus'] = 584;
  46563. t['comma'] = 278;
  46564. t['hyphen'] = 333;
  46565. t['period'] = 278;
  46566. t['slash'] = 278;
  46567. t['zero'] = 556;
  46568. t['one'] = 556;
  46569. t['two'] = 556;
  46570. t['three'] = 556;
  46571. t['four'] = 556;
  46572. t['five'] = 556;
  46573. t['six'] = 556;
  46574. t['seven'] = 556;
  46575. t['eight'] = 556;
  46576. t['nine'] = 556;
  46577. t['colon'] = 278;
  46578. t['semicolon'] = 278;
  46579. t['less'] = 584;
  46580. t['equal'] = 584;
  46581. t['greater'] = 584;
  46582. t['question'] = 556;
  46583. t['at'] = 1015;
  46584. t['A'] = 667;
  46585. t['B'] = 667;
  46586. t['C'] = 722;
  46587. t['D'] = 722;
  46588. t['E'] = 667;
  46589. t['F'] = 611;
  46590. t['G'] = 778;
  46591. t['H'] = 722;
  46592. t['I'] = 278;
  46593. t['J'] = 500;
  46594. t['K'] = 667;
  46595. t['L'] = 556;
  46596. t['M'] = 833;
  46597. t['N'] = 722;
  46598. t['O'] = 778;
  46599. t['P'] = 667;
  46600. t['Q'] = 778;
  46601. t['R'] = 722;
  46602. t['S'] = 667;
  46603. t['T'] = 611;
  46604. t['U'] = 722;
  46605. t['V'] = 667;
  46606. t['W'] = 944;
  46607. t['X'] = 667;
  46608. t['Y'] = 667;
  46609. t['Z'] = 611;
  46610. t['bracketleft'] = 278;
  46611. t['backslash'] = 278;
  46612. t['bracketright'] = 278;
  46613. t['asciicircum'] = 469;
  46614. t['underscore'] = 556;
  46615. t['quoteleft'] = 222;
  46616. t['a'] = 556;
  46617. t['b'] = 556;
  46618. t['c'] = 500;
  46619. t['d'] = 556;
  46620. t['e'] = 556;
  46621. t['f'] = 278;
  46622. t['g'] = 556;
  46623. t['h'] = 556;
  46624. t['i'] = 222;
  46625. t['j'] = 222;
  46626. t['k'] = 500;
  46627. t['l'] = 222;
  46628. t['m'] = 833;
  46629. t['n'] = 556;
  46630. t['o'] = 556;
  46631. t['p'] = 556;
  46632. t['q'] = 556;
  46633. t['r'] = 333;
  46634. t['s'] = 500;
  46635. t['t'] = 278;
  46636. t['u'] = 556;
  46637. t['v'] = 500;
  46638. t['w'] = 722;
  46639. t['x'] = 500;
  46640. t['y'] = 500;
  46641. t['z'] = 500;
  46642. t['braceleft'] = 334;
  46643. t['bar'] = 260;
  46644. t['braceright'] = 334;
  46645. t['asciitilde'] = 584;
  46646. t['exclamdown'] = 333;
  46647. t['cent'] = 556;
  46648. t['sterling'] = 556;
  46649. t['fraction'] = 167;
  46650. t['yen'] = 556;
  46651. t['florin'] = 556;
  46652. t['section'] = 556;
  46653. t['currency'] = 556;
  46654. t['quotesingle'] = 191;
  46655. t['quotedblleft'] = 333;
  46656. t['guillemotleft'] = 556;
  46657. t['guilsinglleft'] = 333;
  46658. t['guilsinglright'] = 333;
  46659. t['fi'] = 500;
  46660. t['fl'] = 500;
  46661. t['endash'] = 556;
  46662. t['dagger'] = 556;
  46663. t['daggerdbl'] = 556;
  46664. t['periodcentered'] = 278;
  46665. t['paragraph'] = 537;
  46666. t['bullet'] = 350;
  46667. t['quotesinglbase'] = 222;
  46668. t['quotedblbase'] = 333;
  46669. t['quotedblright'] = 333;
  46670. t['guillemotright'] = 556;
  46671. t['ellipsis'] = 1000;
  46672. t['perthousand'] = 1000;
  46673. t['questiondown'] = 611;
  46674. t['grave'] = 333;
  46675. t['acute'] = 333;
  46676. t['circumflex'] = 333;
  46677. t['tilde'] = 333;
  46678. t['macron'] = 333;
  46679. t['breve'] = 333;
  46680. t['dotaccent'] = 333;
  46681. t['dieresis'] = 333;
  46682. t['ring'] = 333;
  46683. t['cedilla'] = 333;
  46684. t['hungarumlaut'] = 333;
  46685. t['ogonek'] = 333;
  46686. t['caron'] = 333;
  46687. t['emdash'] = 1000;
  46688. t['AE'] = 1000;
  46689. t['ordfeminine'] = 370;
  46690. t['Lslash'] = 556;
  46691. t['Oslash'] = 778;
  46692. t['OE'] = 1000;
  46693. t['ordmasculine'] = 365;
  46694. t['ae'] = 889;
  46695. t['dotlessi'] = 278;
  46696. t['lslash'] = 222;
  46697. t['oslash'] = 611;
  46698. t['oe'] = 944;
  46699. t['germandbls'] = 611;
  46700. t['Idieresis'] = 278;
  46701. t['eacute'] = 556;
  46702. t['abreve'] = 556;
  46703. t['uhungarumlaut'] = 556;
  46704. t['ecaron'] = 556;
  46705. t['Ydieresis'] = 667;
  46706. t['divide'] = 584;
  46707. t['Yacute'] = 667;
  46708. t['Acircumflex'] = 667;
  46709. t['aacute'] = 556;
  46710. t['Ucircumflex'] = 722;
  46711. t['yacute'] = 500;
  46712. t['scommaaccent'] = 500;
  46713. t['ecircumflex'] = 556;
  46714. t['Uring'] = 722;
  46715. t['Udieresis'] = 722;
  46716. t['aogonek'] = 556;
  46717. t['Uacute'] = 722;
  46718. t['uogonek'] = 556;
  46719. t['Edieresis'] = 667;
  46720. t['Dcroat'] = 722;
  46721. t['commaaccent'] = 250;
  46722. t['copyright'] = 737;
  46723. t['Emacron'] = 667;
  46724. t['ccaron'] = 500;
  46725. t['aring'] = 556;
  46726. t['Ncommaaccent'] = 722;
  46727. t['lacute'] = 222;
  46728. t['agrave'] = 556;
  46729. t['Tcommaaccent'] = 611;
  46730. t['Cacute'] = 722;
  46731. t['atilde'] = 556;
  46732. t['Edotaccent'] = 667;
  46733. t['scaron'] = 500;
  46734. t['scedilla'] = 500;
  46735. t['iacute'] = 278;
  46736. t['lozenge'] = 471;
  46737. t['Rcaron'] = 722;
  46738. t['Gcommaaccent'] = 778;
  46739. t['ucircumflex'] = 556;
  46740. t['acircumflex'] = 556;
  46741. t['Amacron'] = 667;
  46742. t['rcaron'] = 333;
  46743. t['ccedilla'] = 500;
  46744. t['Zdotaccent'] = 611;
  46745. t['Thorn'] = 667;
  46746. t['Omacron'] = 778;
  46747. t['Racute'] = 722;
  46748. t['Sacute'] = 667;
  46749. t['dcaron'] = 643;
  46750. t['Umacron'] = 722;
  46751. t['uring'] = 556;
  46752. t['threesuperior'] = 333;
  46753. t['Ograve'] = 778;
  46754. t['Agrave'] = 667;
  46755. t['Abreve'] = 667;
  46756. t['multiply'] = 584;
  46757. t['uacute'] = 556;
  46758. t['Tcaron'] = 611;
  46759. t['partialdiff'] = 476;
  46760. t['ydieresis'] = 500;
  46761. t['Nacute'] = 722;
  46762. t['icircumflex'] = 278;
  46763. t['Ecircumflex'] = 667;
  46764. t['adieresis'] = 556;
  46765. t['edieresis'] = 556;
  46766. t['cacute'] = 500;
  46767. t['nacute'] = 556;
  46768. t['umacron'] = 556;
  46769. t['Ncaron'] = 722;
  46770. t['Iacute'] = 278;
  46771. t['plusminus'] = 584;
  46772. t['brokenbar'] = 260;
  46773. t['registered'] = 737;
  46774. t['Gbreve'] = 778;
  46775. t['Idotaccent'] = 278;
  46776. t['summation'] = 600;
  46777. t['Egrave'] = 667;
  46778. t['racute'] = 333;
  46779. t['omacron'] = 556;
  46780. t['Zacute'] = 611;
  46781. t['Zcaron'] = 611;
  46782. t['greaterequal'] = 549;
  46783. t['Eth'] = 722;
  46784. t['Ccedilla'] = 722;
  46785. t['lcommaaccent'] = 222;
  46786. t['tcaron'] = 317;
  46787. t['eogonek'] = 556;
  46788. t['Uogonek'] = 722;
  46789. t['Aacute'] = 667;
  46790. t['Adieresis'] = 667;
  46791. t['egrave'] = 556;
  46792. t['zacute'] = 500;
  46793. t['iogonek'] = 222;
  46794. t['Oacute'] = 778;
  46795. t['oacute'] = 556;
  46796. t['amacron'] = 556;
  46797. t['sacute'] = 500;
  46798. t['idieresis'] = 278;
  46799. t['Ocircumflex'] = 778;
  46800. t['Ugrave'] = 722;
  46801. t['Delta'] = 612;
  46802. t['thorn'] = 556;
  46803. t['twosuperior'] = 333;
  46804. t['Odieresis'] = 778;
  46805. t['mu'] = 556;
  46806. t['igrave'] = 278;
  46807. t['ohungarumlaut'] = 556;
  46808. t['Eogonek'] = 667;
  46809. t['dcroat'] = 556;
  46810. t['threequarters'] = 834;
  46811. t['Scedilla'] = 667;
  46812. t['lcaron'] = 299;
  46813. t['Kcommaaccent'] = 667;
  46814. t['Lacute'] = 556;
  46815. t['trademark'] = 1000;
  46816. t['edotaccent'] = 556;
  46817. t['Igrave'] = 278;
  46818. t['Imacron'] = 278;
  46819. t['Lcaron'] = 556;
  46820. t['onehalf'] = 834;
  46821. t['lessequal'] = 549;
  46822. t['ocircumflex'] = 556;
  46823. t['ntilde'] = 556;
  46824. t['Uhungarumlaut'] = 722;
  46825. t['Eacute'] = 667;
  46826. t['emacron'] = 556;
  46827. t['gbreve'] = 556;
  46828. t['onequarter'] = 834;
  46829. t['Scaron'] = 667;
  46830. t['Scommaaccent'] = 667;
  46831. t['Ohungarumlaut'] = 778;
  46832. t['degree'] = 400;
  46833. t['ograve'] = 556;
  46834. t['Ccaron'] = 722;
  46835. t['ugrave'] = 556;
  46836. t['radical'] = 453;
  46837. t['Dcaron'] = 722;
  46838. t['rcommaaccent'] = 333;
  46839. t['Ntilde'] = 722;
  46840. t['otilde'] = 556;
  46841. t['Rcommaaccent'] = 722;
  46842. t['Lcommaaccent'] = 556;
  46843. t['Atilde'] = 667;
  46844. t['Aogonek'] = 667;
  46845. t['Aring'] = 667;
  46846. t['Otilde'] = 778;
  46847. t['zdotaccent'] = 500;
  46848. t['Ecaron'] = 667;
  46849. t['Iogonek'] = 278;
  46850. t['kcommaaccent'] = 500;
  46851. t['minus'] = 584;
  46852. t['Icircumflex'] = 278;
  46853. t['ncaron'] = 556;
  46854. t['tcommaaccent'] = 278;
  46855. t['logicalnot'] = 584;
  46856. t['odieresis'] = 556;
  46857. t['udieresis'] = 556;
  46858. t['notequal'] = 549;
  46859. t['gcommaaccent'] = 556;
  46860. t['eth'] = 556;
  46861. t['zcaron'] = 500;
  46862. t['ncommaaccent'] = 556;
  46863. t['onesuperior'] = 333;
  46864. t['imacron'] = 278;
  46865. t['Euro'] = 556;
  46866. });
  46867. t['Symbol'] = getLookupTableFactory(function (t) {
  46868. t['space'] = 250;
  46869. t['exclam'] = 333;
  46870. t['universal'] = 713;
  46871. t['numbersign'] = 500;
  46872. t['existential'] = 549;
  46873. t['percent'] = 833;
  46874. t['ampersand'] = 778;
  46875. t['suchthat'] = 439;
  46876. t['parenleft'] = 333;
  46877. t['parenright'] = 333;
  46878. t['asteriskmath'] = 500;
  46879. t['plus'] = 549;
  46880. t['comma'] = 250;
  46881. t['minus'] = 549;
  46882. t['period'] = 250;
  46883. t['slash'] = 278;
  46884. t['zero'] = 500;
  46885. t['one'] = 500;
  46886. t['two'] = 500;
  46887. t['three'] = 500;
  46888. t['four'] = 500;
  46889. t['five'] = 500;
  46890. t['six'] = 500;
  46891. t['seven'] = 500;
  46892. t['eight'] = 500;
  46893. t['nine'] = 500;
  46894. t['colon'] = 278;
  46895. t['semicolon'] = 278;
  46896. t['less'] = 549;
  46897. t['equal'] = 549;
  46898. t['greater'] = 549;
  46899. t['question'] = 444;
  46900. t['congruent'] = 549;
  46901. t['Alpha'] = 722;
  46902. t['Beta'] = 667;
  46903. t['Chi'] = 722;
  46904. t['Delta'] = 612;
  46905. t['Epsilon'] = 611;
  46906. t['Phi'] = 763;
  46907. t['Gamma'] = 603;
  46908. t['Eta'] = 722;
  46909. t['Iota'] = 333;
  46910. t['theta1'] = 631;
  46911. t['Kappa'] = 722;
  46912. t['Lambda'] = 686;
  46913. t['Mu'] = 889;
  46914. t['Nu'] = 722;
  46915. t['Omicron'] = 722;
  46916. t['Pi'] = 768;
  46917. t['Theta'] = 741;
  46918. t['Rho'] = 556;
  46919. t['Sigma'] = 592;
  46920. t['Tau'] = 611;
  46921. t['Upsilon'] = 690;
  46922. t['sigma1'] = 439;
  46923. t['Omega'] = 768;
  46924. t['Xi'] = 645;
  46925. t['Psi'] = 795;
  46926. t['Zeta'] = 611;
  46927. t['bracketleft'] = 333;
  46928. t['therefore'] = 863;
  46929. t['bracketright'] = 333;
  46930. t['perpendicular'] = 658;
  46931. t['underscore'] = 500;
  46932. t['radicalex'] = 500;
  46933. t['alpha'] = 631;
  46934. t['beta'] = 549;
  46935. t['chi'] = 549;
  46936. t['delta'] = 494;
  46937. t['epsilon'] = 439;
  46938. t['phi'] = 521;
  46939. t['gamma'] = 411;
  46940. t['eta'] = 603;
  46941. t['iota'] = 329;
  46942. t['phi1'] = 603;
  46943. t['kappa'] = 549;
  46944. t['lambda'] = 549;
  46945. t['mu'] = 576;
  46946. t['nu'] = 521;
  46947. t['omicron'] = 549;
  46948. t['pi'] = 549;
  46949. t['theta'] = 521;
  46950. t['rho'] = 549;
  46951. t['sigma'] = 603;
  46952. t['tau'] = 439;
  46953. t['upsilon'] = 576;
  46954. t['omega1'] = 713;
  46955. t['omega'] = 686;
  46956. t['xi'] = 493;
  46957. t['psi'] = 686;
  46958. t['zeta'] = 494;
  46959. t['braceleft'] = 480;
  46960. t['bar'] = 200;
  46961. t['braceright'] = 480;
  46962. t['similar'] = 549;
  46963. t['Euro'] = 750;
  46964. t['Upsilon1'] = 620;
  46965. t['minute'] = 247;
  46966. t['lessequal'] = 549;
  46967. t['fraction'] = 167;
  46968. t['infinity'] = 713;
  46969. t['florin'] = 500;
  46970. t['club'] = 753;
  46971. t['diamond'] = 753;
  46972. t['heart'] = 753;
  46973. t['spade'] = 753;
  46974. t['arrowboth'] = 1042;
  46975. t['arrowleft'] = 987;
  46976. t['arrowup'] = 603;
  46977. t['arrowright'] = 987;
  46978. t['arrowdown'] = 603;
  46979. t['degree'] = 400;
  46980. t['plusminus'] = 549;
  46981. t['second'] = 411;
  46982. t['greaterequal'] = 549;
  46983. t['multiply'] = 549;
  46984. t['proportional'] = 713;
  46985. t['partialdiff'] = 494;
  46986. t['bullet'] = 460;
  46987. t['divide'] = 549;
  46988. t['notequal'] = 549;
  46989. t['equivalence'] = 549;
  46990. t['approxequal'] = 549;
  46991. t['ellipsis'] = 1000;
  46992. t['arrowvertex'] = 603;
  46993. t['arrowhorizex'] = 1000;
  46994. t['carriagereturn'] = 658;
  46995. t['aleph'] = 823;
  46996. t['Ifraktur'] = 686;
  46997. t['Rfraktur'] = 795;
  46998. t['weierstrass'] = 987;
  46999. t['circlemultiply'] = 768;
  47000. t['circleplus'] = 768;
  47001. t['emptyset'] = 823;
  47002. t['intersection'] = 768;
  47003. t['union'] = 768;
  47004. t['propersuperset'] = 713;
  47005. t['reflexsuperset'] = 713;
  47006. t['notsubset'] = 713;
  47007. t['propersubset'] = 713;
  47008. t['reflexsubset'] = 713;
  47009. t['element'] = 713;
  47010. t['notelement'] = 713;
  47011. t['angle'] = 768;
  47012. t['gradient'] = 713;
  47013. t['registerserif'] = 790;
  47014. t['copyrightserif'] = 790;
  47015. t['trademarkserif'] = 890;
  47016. t['product'] = 823;
  47017. t['radical'] = 549;
  47018. t['dotmath'] = 250;
  47019. t['logicalnot'] = 713;
  47020. t['logicaland'] = 603;
  47021. t['logicalor'] = 603;
  47022. t['arrowdblboth'] = 1042;
  47023. t['arrowdblleft'] = 987;
  47024. t['arrowdblup'] = 603;
  47025. t['arrowdblright'] = 987;
  47026. t['arrowdbldown'] = 603;
  47027. t['lozenge'] = 494;
  47028. t['angleleft'] = 329;
  47029. t['registersans'] = 790;
  47030. t['copyrightsans'] = 790;
  47031. t['trademarksans'] = 786;
  47032. t['summation'] = 713;
  47033. t['parenlefttp'] = 384;
  47034. t['parenleftex'] = 384;
  47035. t['parenleftbt'] = 384;
  47036. t['bracketlefttp'] = 384;
  47037. t['bracketleftex'] = 384;
  47038. t['bracketleftbt'] = 384;
  47039. t['bracelefttp'] = 494;
  47040. t['braceleftmid'] = 494;
  47041. t['braceleftbt'] = 494;
  47042. t['braceex'] = 494;
  47043. t['angleright'] = 329;
  47044. t['integral'] = 274;
  47045. t['integraltp'] = 686;
  47046. t['integralex'] = 686;
  47047. t['integralbt'] = 686;
  47048. t['parenrighttp'] = 384;
  47049. t['parenrightex'] = 384;
  47050. t['parenrightbt'] = 384;
  47051. t['bracketrighttp'] = 384;
  47052. t['bracketrightex'] = 384;
  47053. t['bracketrightbt'] = 384;
  47054. t['bracerighttp'] = 494;
  47055. t['bracerightmid'] = 494;
  47056. t['bracerightbt'] = 494;
  47057. t['apple'] = 790;
  47058. });
  47059. t['Times-Roman'] = getLookupTableFactory(function (t) {
  47060. t['space'] = 250;
  47061. t['exclam'] = 333;
  47062. t['quotedbl'] = 408;
  47063. t['numbersign'] = 500;
  47064. t['dollar'] = 500;
  47065. t['percent'] = 833;
  47066. t['ampersand'] = 778;
  47067. t['quoteright'] = 333;
  47068. t['parenleft'] = 333;
  47069. t['parenright'] = 333;
  47070. t['asterisk'] = 500;
  47071. t['plus'] = 564;
  47072. t['comma'] = 250;
  47073. t['hyphen'] = 333;
  47074. t['period'] = 250;
  47075. t['slash'] = 278;
  47076. t['zero'] = 500;
  47077. t['one'] = 500;
  47078. t['two'] = 500;
  47079. t['three'] = 500;
  47080. t['four'] = 500;
  47081. t['five'] = 500;
  47082. t['six'] = 500;
  47083. t['seven'] = 500;
  47084. t['eight'] = 500;
  47085. t['nine'] = 500;
  47086. t['colon'] = 278;
  47087. t['semicolon'] = 278;
  47088. t['less'] = 564;
  47089. t['equal'] = 564;
  47090. t['greater'] = 564;
  47091. t['question'] = 444;
  47092. t['at'] = 921;
  47093. t['A'] = 722;
  47094. t['B'] = 667;
  47095. t['C'] = 667;
  47096. t['D'] = 722;
  47097. t['E'] = 611;
  47098. t['F'] = 556;
  47099. t['G'] = 722;
  47100. t['H'] = 722;
  47101. t['I'] = 333;
  47102. t['J'] = 389;
  47103. t['K'] = 722;
  47104. t['L'] = 611;
  47105. t['M'] = 889;
  47106. t['N'] = 722;
  47107. t['O'] = 722;
  47108. t['P'] = 556;
  47109. t['Q'] = 722;
  47110. t['R'] = 667;
  47111. t['S'] = 556;
  47112. t['T'] = 611;
  47113. t['U'] = 722;
  47114. t['V'] = 722;
  47115. t['W'] = 944;
  47116. t['X'] = 722;
  47117. t['Y'] = 722;
  47118. t['Z'] = 611;
  47119. t['bracketleft'] = 333;
  47120. t['backslash'] = 278;
  47121. t['bracketright'] = 333;
  47122. t['asciicircum'] = 469;
  47123. t['underscore'] = 500;
  47124. t['quoteleft'] = 333;
  47125. t['a'] = 444;
  47126. t['b'] = 500;
  47127. t['c'] = 444;
  47128. t['d'] = 500;
  47129. t['e'] = 444;
  47130. t['f'] = 333;
  47131. t['g'] = 500;
  47132. t['h'] = 500;
  47133. t['i'] = 278;
  47134. t['j'] = 278;
  47135. t['k'] = 500;
  47136. t['l'] = 278;
  47137. t['m'] = 778;
  47138. t['n'] = 500;
  47139. t['o'] = 500;
  47140. t['p'] = 500;
  47141. t['q'] = 500;
  47142. t['r'] = 333;
  47143. t['s'] = 389;
  47144. t['t'] = 278;
  47145. t['u'] = 500;
  47146. t['v'] = 500;
  47147. t['w'] = 722;
  47148. t['x'] = 500;
  47149. t['y'] = 500;
  47150. t['z'] = 444;
  47151. t['braceleft'] = 480;
  47152. t['bar'] = 200;
  47153. t['braceright'] = 480;
  47154. t['asciitilde'] = 541;
  47155. t['exclamdown'] = 333;
  47156. t['cent'] = 500;
  47157. t['sterling'] = 500;
  47158. t['fraction'] = 167;
  47159. t['yen'] = 500;
  47160. t['florin'] = 500;
  47161. t['section'] = 500;
  47162. t['currency'] = 500;
  47163. t['quotesingle'] = 180;
  47164. t['quotedblleft'] = 444;
  47165. t['guillemotleft'] = 500;
  47166. t['guilsinglleft'] = 333;
  47167. t['guilsinglright'] = 333;
  47168. t['fi'] = 556;
  47169. t['fl'] = 556;
  47170. t['endash'] = 500;
  47171. t['dagger'] = 500;
  47172. t['daggerdbl'] = 500;
  47173. t['periodcentered'] = 250;
  47174. t['paragraph'] = 453;
  47175. t['bullet'] = 350;
  47176. t['quotesinglbase'] = 333;
  47177. t['quotedblbase'] = 444;
  47178. t['quotedblright'] = 444;
  47179. t['guillemotright'] = 500;
  47180. t['ellipsis'] = 1000;
  47181. t['perthousand'] = 1000;
  47182. t['questiondown'] = 444;
  47183. t['grave'] = 333;
  47184. t['acute'] = 333;
  47185. t['circumflex'] = 333;
  47186. t['tilde'] = 333;
  47187. t['macron'] = 333;
  47188. t['breve'] = 333;
  47189. t['dotaccent'] = 333;
  47190. t['dieresis'] = 333;
  47191. t['ring'] = 333;
  47192. t['cedilla'] = 333;
  47193. t['hungarumlaut'] = 333;
  47194. t['ogonek'] = 333;
  47195. t['caron'] = 333;
  47196. t['emdash'] = 1000;
  47197. t['AE'] = 889;
  47198. t['ordfeminine'] = 276;
  47199. t['Lslash'] = 611;
  47200. t['Oslash'] = 722;
  47201. t['OE'] = 889;
  47202. t['ordmasculine'] = 310;
  47203. t['ae'] = 667;
  47204. t['dotlessi'] = 278;
  47205. t['lslash'] = 278;
  47206. t['oslash'] = 500;
  47207. t['oe'] = 722;
  47208. t['germandbls'] = 500;
  47209. t['Idieresis'] = 333;
  47210. t['eacute'] = 444;
  47211. t['abreve'] = 444;
  47212. t['uhungarumlaut'] = 500;
  47213. t['ecaron'] = 444;
  47214. t['Ydieresis'] = 722;
  47215. t['divide'] = 564;
  47216. t['Yacute'] = 722;
  47217. t['Acircumflex'] = 722;
  47218. t['aacute'] = 444;
  47219. t['Ucircumflex'] = 722;
  47220. t['yacute'] = 500;
  47221. t['scommaaccent'] = 389;
  47222. t['ecircumflex'] = 444;
  47223. t['Uring'] = 722;
  47224. t['Udieresis'] = 722;
  47225. t['aogonek'] = 444;
  47226. t['Uacute'] = 722;
  47227. t['uogonek'] = 500;
  47228. t['Edieresis'] = 611;
  47229. t['Dcroat'] = 722;
  47230. t['commaaccent'] = 250;
  47231. t['copyright'] = 760;
  47232. t['Emacron'] = 611;
  47233. t['ccaron'] = 444;
  47234. t['aring'] = 444;
  47235. t['Ncommaaccent'] = 722;
  47236. t['lacute'] = 278;
  47237. t['agrave'] = 444;
  47238. t['Tcommaaccent'] = 611;
  47239. t['Cacute'] = 667;
  47240. t['atilde'] = 444;
  47241. t['Edotaccent'] = 611;
  47242. t['scaron'] = 389;
  47243. t['scedilla'] = 389;
  47244. t['iacute'] = 278;
  47245. t['lozenge'] = 471;
  47246. t['Rcaron'] = 667;
  47247. t['Gcommaaccent'] = 722;
  47248. t['ucircumflex'] = 500;
  47249. t['acircumflex'] = 444;
  47250. t['Amacron'] = 722;
  47251. t['rcaron'] = 333;
  47252. t['ccedilla'] = 444;
  47253. t['Zdotaccent'] = 611;
  47254. t['Thorn'] = 556;
  47255. t['Omacron'] = 722;
  47256. t['Racute'] = 667;
  47257. t['Sacute'] = 556;
  47258. t['dcaron'] = 588;
  47259. t['Umacron'] = 722;
  47260. t['uring'] = 500;
  47261. t['threesuperior'] = 300;
  47262. t['Ograve'] = 722;
  47263. t['Agrave'] = 722;
  47264. t['Abreve'] = 722;
  47265. t['multiply'] = 564;
  47266. t['uacute'] = 500;
  47267. t['Tcaron'] = 611;
  47268. t['partialdiff'] = 476;
  47269. t['ydieresis'] = 500;
  47270. t['Nacute'] = 722;
  47271. t['icircumflex'] = 278;
  47272. t['Ecircumflex'] = 611;
  47273. t['adieresis'] = 444;
  47274. t['edieresis'] = 444;
  47275. t['cacute'] = 444;
  47276. t['nacute'] = 500;
  47277. t['umacron'] = 500;
  47278. t['Ncaron'] = 722;
  47279. t['Iacute'] = 333;
  47280. t['plusminus'] = 564;
  47281. t['brokenbar'] = 200;
  47282. t['registered'] = 760;
  47283. t['Gbreve'] = 722;
  47284. t['Idotaccent'] = 333;
  47285. t['summation'] = 600;
  47286. t['Egrave'] = 611;
  47287. t['racute'] = 333;
  47288. t['omacron'] = 500;
  47289. t['Zacute'] = 611;
  47290. t['Zcaron'] = 611;
  47291. t['greaterequal'] = 549;
  47292. t['Eth'] = 722;
  47293. t['Ccedilla'] = 667;
  47294. t['lcommaaccent'] = 278;
  47295. t['tcaron'] = 326;
  47296. t['eogonek'] = 444;
  47297. t['Uogonek'] = 722;
  47298. t['Aacute'] = 722;
  47299. t['Adieresis'] = 722;
  47300. t['egrave'] = 444;
  47301. t['zacute'] = 444;
  47302. t['iogonek'] = 278;
  47303. t['Oacute'] = 722;
  47304. t['oacute'] = 500;
  47305. t['amacron'] = 444;
  47306. t['sacute'] = 389;
  47307. t['idieresis'] = 278;
  47308. t['Ocircumflex'] = 722;
  47309. t['Ugrave'] = 722;
  47310. t['Delta'] = 612;
  47311. t['thorn'] = 500;
  47312. t['twosuperior'] = 300;
  47313. t['Odieresis'] = 722;
  47314. t['mu'] = 500;
  47315. t['igrave'] = 278;
  47316. t['ohungarumlaut'] = 500;
  47317. t['Eogonek'] = 611;
  47318. t['dcroat'] = 500;
  47319. t['threequarters'] = 750;
  47320. t['Scedilla'] = 556;
  47321. t['lcaron'] = 344;
  47322. t['Kcommaaccent'] = 722;
  47323. t['Lacute'] = 611;
  47324. t['trademark'] = 980;
  47325. t['edotaccent'] = 444;
  47326. t['Igrave'] = 333;
  47327. t['Imacron'] = 333;
  47328. t['Lcaron'] = 611;
  47329. t['onehalf'] = 750;
  47330. t['lessequal'] = 549;
  47331. t['ocircumflex'] = 500;
  47332. t['ntilde'] = 500;
  47333. t['Uhungarumlaut'] = 722;
  47334. t['Eacute'] = 611;
  47335. t['emacron'] = 444;
  47336. t['gbreve'] = 500;
  47337. t['onequarter'] = 750;
  47338. t['Scaron'] = 556;
  47339. t['Scommaaccent'] = 556;
  47340. t['Ohungarumlaut'] = 722;
  47341. t['degree'] = 400;
  47342. t['ograve'] = 500;
  47343. t['Ccaron'] = 667;
  47344. t['ugrave'] = 500;
  47345. t['radical'] = 453;
  47346. t['Dcaron'] = 722;
  47347. t['rcommaaccent'] = 333;
  47348. t['Ntilde'] = 722;
  47349. t['otilde'] = 500;
  47350. t['Rcommaaccent'] = 667;
  47351. t['Lcommaaccent'] = 611;
  47352. t['Atilde'] = 722;
  47353. t['Aogonek'] = 722;
  47354. t['Aring'] = 722;
  47355. t['Otilde'] = 722;
  47356. t['zdotaccent'] = 444;
  47357. t['Ecaron'] = 611;
  47358. t['Iogonek'] = 333;
  47359. t['kcommaaccent'] = 500;
  47360. t['minus'] = 564;
  47361. t['Icircumflex'] = 333;
  47362. t['ncaron'] = 500;
  47363. t['tcommaaccent'] = 278;
  47364. t['logicalnot'] = 564;
  47365. t['odieresis'] = 500;
  47366. t['udieresis'] = 500;
  47367. t['notequal'] = 549;
  47368. t['gcommaaccent'] = 500;
  47369. t['eth'] = 500;
  47370. t['zcaron'] = 444;
  47371. t['ncommaaccent'] = 500;
  47372. t['onesuperior'] = 300;
  47373. t['imacron'] = 278;
  47374. t['Euro'] = 500;
  47375. });
  47376. t['Times-Bold'] = getLookupTableFactory(function (t) {
  47377. t['space'] = 250;
  47378. t['exclam'] = 333;
  47379. t['quotedbl'] = 555;
  47380. t['numbersign'] = 500;
  47381. t['dollar'] = 500;
  47382. t['percent'] = 1000;
  47383. t['ampersand'] = 833;
  47384. t['quoteright'] = 333;
  47385. t['parenleft'] = 333;
  47386. t['parenright'] = 333;
  47387. t['asterisk'] = 500;
  47388. t['plus'] = 570;
  47389. t['comma'] = 250;
  47390. t['hyphen'] = 333;
  47391. t['period'] = 250;
  47392. t['slash'] = 278;
  47393. t['zero'] = 500;
  47394. t['one'] = 500;
  47395. t['two'] = 500;
  47396. t['three'] = 500;
  47397. t['four'] = 500;
  47398. t['five'] = 500;
  47399. t['six'] = 500;
  47400. t['seven'] = 500;
  47401. t['eight'] = 500;
  47402. t['nine'] = 500;
  47403. t['colon'] = 333;
  47404. t['semicolon'] = 333;
  47405. t['less'] = 570;
  47406. t['equal'] = 570;
  47407. t['greater'] = 570;
  47408. t['question'] = 500;
  47409. t['at'] = 930;
  47410. t['A'] = 722;
  47411. t['B'] = 667;
  47412. t['C'] = 722;
  47413. t['D'] = 722;
  47414. t['E'] = 667;
  47415. t['F'] = 611;
  47416. t['G'] = 778;
  47417. t['H'] = 778;
  47418. t['I'] = 389;
  47419. t['J'] = 500;
  47420. t['K'] = 778;
  47421. t['L'] = 667;
  47422. t['M'] = 944;
  47423. t['N'] = 722;
  47424. t['O'] = 778;
  47425. t['P'] = 611;
  47426. t['Q'] = 778;
  47427. t['R'] = 722;
  47428. t['S'] = 556;
  47429. t['T'] = 667;
  47430. t['U'] = 722;
  47431. t['V'] = 722;
  47432. t['W'] = 1000;
  47433. t['X'] = 722;
  47434. t['Y'] = 722;
  47435. t['Z'] = 667;
  47436. t['bracketleft'] = 333;
  47437. t['backslash'] = 278;
  47438. t['bracketright'] = 333;
  47439. t['asciicircum'] = 581;
  47440. t['underscore'] = 500;
  47441. t['quoteleft'] = 333;
  47442. t['a'] = 500;
  47443. t['b'] = 556;
  47444. t['c'] = 444;
  47445. t['d'] = 556;
  47446. t['e'] = 444;
  47447. t['f'] = 333;
  47448. t['g'] = 500;
  47449. t['h'] = 556;
  47450. t['i'] = 278;
  47451. t['j'] = 333;
  47452. t['k'] = 556;
  47453. t['l'] = 278;
  47454. t['m'] = 833;
  47455. t['n'] = 556;
  47456. t['o'] = 500;
  47457. t['p'] = 556;
  47458. t['q'] = 556;
  47459. t['r'] = 444;
  47460. t['s'] = 389;
  47461. t['t'] = 333;
  47462. t['u'] = 556;
  47463. t['v'] = 500;
  47464. t['w'] = 722;
  47465. t['x'] = 500;
  47466. t['y'] = 500;
  47467. t['z'] = 444;
  47468. t['braceleft'] = 394;
  47469. t['bar'] = 220;
  47470. t['braceright'] = 394;
  47471. t['asciitilde'] = 520;
  47472. t['exclamdown'] = 333;
  47473. t['cent'] = 500;
  47474. t['sterling'] = 500;
  47475. t['fraction'] = 167;
  47476. t['yen'] = 500;
  47477. t['florin'] = 500;
  47478. t['section'] = 500;
  47479. t['currency'] = 500;
  47480. t['quotesingle'] = 278;
  47481. t['quotedblleft'] = 500;
  47482. t['guillemotleft'] = 500;
  47483. t['guilsinglleft'] = 333;
  47484. t['guilsinglright'] = 333;
  47485. t['fi'] = 556;
  47486. t['fl'] = 556;
  47487. t['endash'] = 500;
  47488. t['dagger'] = 500;
  47489. t['daggerdbl'] = 500;
  47490. t['periodcentered'] = 250;
  47491. t['paragraph'] = 540;
  47492. t['bullet'] = 350;
  47493. t['quotesinglbase'] = 333;
  47494. t['quotedblbase'] = 500;
  47495. t['quotedblright'] = 500;
  47496. t['guillemotright'] = 500;
  47497. t['ellipsis'] = 1000;
  47498. t['perthousand'] = 1000;
  47499. t['questiondown'] = 500;
  47500. t['grave'] = 333;
  47501. t['acute'] = 333;
  47502. t['circumflex'] = 333;
  47503. t['tilde'] = 333;
  47504. t['macron'] = 333;
  47505. t['breve'] = 333;
  47506. t['dotaccent'] = 333;
  47507. t['dieresis'] = 333;
  47508. t['ring'] = 333;
  47509. t['cedilla'] = 333;
  47510. t['hungarumlaut'] = 333;
  47511. t['ogonek'] = 333;
  47512. t['caron'] = 333;
  47513. t['emdash'] = 1000;
  47514. t['AE'] = 1000;
  47515. t['ordfeminine'] = 300;
  47516. t['Lslash'] = 667;
  47517. t['Oslash'] = 778;
  47518. t['OE'] = 1000;
  47519. t['ordmasculine'] = 330;
  47520. t['ae'] = 722;
  47521. t['dotlessi'] = 278;
  47522. t['lslash'] = 278;
  47523. t['oslash'] = 500;
  47524. t['oe'] = 722;
  47525. t['germandbls'] = 556;
  47526. t['Idieresis'] = 389;
  47527. t['eacute'] = 444;
  47528. t['abreve'] = 500;
  47529. t['uhungarumlaut'] = 556;
  47530. t['ecaron'] = 444;
  47531. t['Ydieresis'] = 722;
  47532. t['divide'] = 570;
  47533. t['Yacute'] = 722;
  47534. t['Acircumflex'] = 722;
  47535. t['aacute'] = 500;
  47536. t['Ucircumflex'] = 722;
  47537. t['yacute'] = 500;
  47538. t['scommaaccent'] = 389;
  47539. t['ecircumflex'] = 444;
  47540. t['Uring'] = 722;
  47541. t['Udieresis'] = 722;
  47542. t['aogonek'] = 500;
  47543. t['Uacute'] = 722;
  47544. t['uogonek'] = 556;
  47545. t['Edieresis'] = 667;
  47546. t['Dcroat'] = 722;
  47547. t['commaaccent'] = 250;
  47548. t['copyright'] = 747;
  47549. t['Emacron'] = 667;
  47550. t['ccaron'] = 444;
  47551. t['aring'] = 500;
  47552. t['Ncommaaccent'] = 722;
  47553. t['lacute'] = 278;
  47554. t['agrave'] = 500;
  47555. t['Tcommaaccent'] = 667;
  47556. t['Cacute'] = 722;
  47557. t['atilde'] = 500;
  47558. t['Edotaccent'] = 667;
  47559. t['scaron'] = 389;
  47560. t['scedilla'] = 389;
  47561. t['iacute'] = 278;
  47562. t['lozenge'] = 494;
  47563. t['Rcaron'] = 722;
  47564. t['Gcommaaccent'] = 778;
  47565. t['ucircumflex'] = 556;
  47566. t['acircumflex'] = 500;
  47567. t['Amacron'] = 722;
  47568. t['rcaron'] = 444;
  47569. t['ccedilla'] = 444;
  47570. t['Zdotaccent'] = 667;
  47571. t['Thorn'] = 611;
  47572. t['Omacron'] = 778;
  47573. t['Racute'] = 722;
  47574. t['Sacute'] = 556;
  47575. t['dcaron'] = 672;
  47576. t['Umacron'] = 722;
  47577. t['uring'] = 556;
  47578. t['threesuperior'] = 300;
  47579. t['Ograve'] = 778;
  47580. t['Agrave'] = 722;
  47581. t['Abreve'] = 722;
  47582. t['multiply'] = 570;
  47583. t['uacute'] = 556;
  47584. t['Tcaron'] = 667;
  47585. t['partialdiff'] = 494;
  47586. t['ydieresis'] = 500;
  47587. t['Nacute'] = 722;
  47588. t['icircumflex'] = 278;
  47589. t['Ecircumflex'] = 667;
  47590. t['adieresis'] = 500;
  47591. t['edieresis'] = 444;
  47592. t['cacute'] = 444;
  47593. t['nacute'] = 556;
  47594. t['umacron'] = 556;
  47595. t['Ncaron'] = 722;
  47596. t['Iacute'] = 389;
  47597. t['plusminus'] = 570;
  47598. t['brokenbar'] = 220;
  47599. t['registered'] = 747;
  47600. t['Gbreve'] = 778;
  47601. t['Idotaccent'] = 389;
  47602. t['summation'] = 600;
  47603. t['Egrave'] = 667;
  47604. t['racute'] = 444;
  47605. t['omacron'] = 500;
  47606. t['Zacute'] = 667;
  47607. t['Zcaron'] = 667;
  47608. t['greaterequal'] = 549;
  47609. t['Eth'] = 722;
  47610. t['Ccedilla'] = 722;
  47611. t['lcommaaccent'] = 278;
  47612. t['tcaron'] = 416;
  47613. t['eogonek'] = 444;
  47614. t['Uogonek'] = 722;
  47615. t['Aacute'] = 722;
  47616. t['Adieresis'] = 722;
  47617. t['egrave'] = 444;
  47618. t['zacute'] = 444;
  47619. t['iogonek'] = 278;
  47620. t['Oacute'] = 778;
  47621. t['oacute'] = 500;
  47622. t['amacron'] = 500;
  47623. t['sacute'] = 389;
  47624. t['idieresis'] = 278;
  47625. t['Ocircumflex'] = 778;
  47626. t['Ugrave'] = 722;
  47627. t['Delta'] = 612;
  47628. t['thorn'] = 556;
  47629. t['twosuperior'] = 300;
  47630. t['Odieresis'] = 778;
  47631. t['mu'] = 556;
  47632. t['igrave'] = 278;
  47633. t['ohungarumlaut'] = 500;
  47634. t['Eogonek'] = 667;
  47635. t['dcroat'] = 556;
  47636. t['threequarters'] = 750;
  47637. t['Scedilla'] = 556;
  47638. t['lcaron'] = 394;
  47639. t['Kcommaaccent'] = 778;
  47640. t['Lacute'] = 667;
  47641. t['trademark'] = 1000;
  47642. t['edotaccent'] = 444;
  47643. t['Igrave'] = 389;
  47644. t['Imacron'] = 389;
  47645. t['Lcaron'] = 667;
  47646. t['onehalf'] = 750;
  47647. t['lessequal'] = 549;
  47648. t['ocircumflex'] = 500;
  47649. t['ntilde'] = 556;
  47650. t['Uhungarumlaut'] = 722;
  47651. t['Eacute'] = 667;
  47652. t['emacron'] = 444;
  47653. t['gbreve'] = 500;
  47654. t['onequarter'] = 750;
  47655. t['Scaron'] = 556;
  47656. t['Scommaaccent'] = 556;
  47657. t['Ohungarumlaut'] = 778;
  47658. t['degree'] = 400;
  47659. t['ograve'] = 500;
  47660. t['Ccaron'] = 722;
  47661. t['ugrave'] = 556;
  47662. t['radical'] = 549;
  47663. t['Dcaron'] = 722;
  47664. t['rcommaaccent'] = 444;
  47665. t['Ntilde'] = 722;
  47666. t['otilde'] = 500;
  47667. t['Rcommaaccent'] = 722;
  47668. t['Lcommaaccent'] = 667;
  47669. t['Atilde'] = 722;
  47670. t['Aogonek'] = 722;
  47671. t['Aring'] = 722;
  47672. t['Otilde'] = 778;
  47673. t['zdotaccent'] = 444;
  47674. t['Ecaron'] = 667;
  47675. t['Iogonek'] = 389;
  47676. t['kcommaaccent'] = 556;
  47677. t['minus'] = 570;
  47678. t['Icircumflex'] = 389;
  47679. t['ncaron'] = 556;
  47680. t['tcommaaccent'] = 333;
  47681. t['logicalnot'] = 570;
  47682. t['odieresis'] = 500;
  47683. t['udieresis'] = 556;
  47684. t['notequal'] = 549;
  47685. t['gcommaaccent'] = 500;
  47686. t['eth'] = 500;
  47687. t['zcaron'] = 444;
  47688. t['ncommaaccent'] = 556;
  47689. t['onesuperior'] = 300;
  47690. t['imacron'] = 278;
  47691. t['Euro'] = 500;
  47692. });
  47693. t['Times-BoldItalic'] = getLookupTableFactory(function (t) {
  47694. t['space'] = 250;
  47695. t['exclam'] = 389;
  47696. t['quotedbl'] = 555;
  47697. t['numbersign'] = 500;
  47698. t['dollar'] = 500;
  47699. t['percent'] = 833;
  47700. t['ampersand'] = 778;
  47701. t['quoteright'] = 333;
  47702. t['parenleft'] = 333;
  47703. t['parenright'] = 333;
  47704. t['asterisk'] = 500;
  47705. t['plus'] = 570;
  47706. t['comma'] = 250;
  47707. t['hyphen'] = 333;
  47708. t['period'] = 250;
  47709. t['slash'] = 278;
  47710. t['zero'] = 500;
  47711. t['one'] = 500;
  47712. t['two'] = 500;
  47713. t['three'] = 500;
  47714. t['four'] = 500;
  47715. t['five'] = 500;
  47716. t['six'] = 500;
  47717. t['seven'] = 500;
  47718. t['eight'] = 500;
  47719. t['nine'] = 500;
  47720. t['colon'] = 333;
  47721. t['semicolon'] = 333;
  47722. t['less'] = 570;
  47723. t['equal'] = 570;
  47724. t['greater'] = 570;
  47725. t['question'] = 500;
  47726. t['at'] = 832;
  47727. t['A'] = 667;
  47728. t['B'] = 667;
  47729. t['C'] = 667;
  47730. t['D'] = 722;
  47731. t['E'] = 667;
  47732. t['F'] = 667;
  47733. t['G'] = 722;
  47734. t['H'] = 778;
  47735. t['I'] = 389;
  47736. t['J'] = 500;
  47737. t['K'] = 667;
  47738. t['L'] = 611;
  47739. t['M'] = 889;
  47740. t['N'] = 722;
  47741. t['O'] = 722;
  47742. t['P'] = 611;
  47743. t['Q'] = 722;
  47744. t['R'] = 667;
  47745. t['S'] = 556;
  47746. t['T'] = 611;
  47747. t['U'] = 722;
  47748. t['V'] = 667;
  47749. t['W'] = 889;
  47750. t['X'] = 667;
  47751. t['Y'] = 611;
  47752. t['Z'] = 611;
  47753. t['bracketleft'] = 333;
  47754. t['backslash'] = 278;
  47755. t['bracketright'] = 333;
  47756. t['asciicircum'] = 570;
  47757. t['underscore'] = 500;
  47758. t['quoteleft'] = 333;
  47759. t['a'] = 500;
  47760. t['b'] = 500;
  47761. t['c'] = 444;
  47762. t['d'] = 500;
  47763. t['e'] = 444;
  47764. t['f'] = 333;
  47765. t['g'] = 500;
  47766. t['h'] = 556;
  47767. t['i'] = 278;
  47768. t['j'] = 278;
  47769. t['k'] = 500;
  47770. t['l'] = 278;
  47771. t['m'] = 778;
  47772. t['n'] = 556;
  47773. t['o'] = 500;
  47774. t['p'] = 500;
  47775. t['q'] = 500;
  47776. t['r'] = 389;
  47777. t['s'] = 389;
  47778. t['t'] = 278;
  47779. t['u'] = 556;
  47780. t['v'] = 444;
  47781. t['w'] = 667;
  47782. t['x'] = 500;
  47783. t['y'] = 444;
  47784. t['z'] = 389;
  47785. t['braceleft'] = 348;
  47786. t['bar'] = 220;
  47787. t['braceright'] = 348;
  47788. t['asciitilde'] = 570;
  47789. t['exclamdown'] = 389;
  47790. t['cent'] = 500;
  47791. t['sterling'] = 500;
  47792. t['fraction'] = 167;
  47793. t['yen'] = 500;
  47794. t['florin'] = 500;
  47795. t['section'] = 500;
  47796. t['currency'] = 500;
  47797. t['quotesingle'] = 278;
  47798. t['quotedblleft'] = 500;
  47799. t['guillemotleft'] = 500;
  47800. t['guilsinglleft'] = 333;
  47801. t['guilsinglright'] = 333;
  47802. t['fi'] = 556;
  47803. t['fl'] = 556;
  47804. t['endash'] = 500;
  47805. t['dagger'] = 500;
  47806. t['daggerdbl'] = 500;
  47807. t['periodcentered'] = 250;
  47808. t['paragraph'] = 500;
  47809. t['bullet'] = 350;
  47810. t['quotesinglbase'] = 333;
  47811. t['quotedblbase'] = 500;
  47812. t['quotedblright'] = 500;
  47813. t['guillemotright'] = 500;
  47814. t['ellipsis'] = 1000;
  47815. t['perthousand'] = 1000;
  47816. t['questiondown'] = 500;
  47817. t['grave'] = 333;
  47818. t['acute'] = 333;
  47819. t['circumflex'] = 333;
  47820. t['tilde'] = 333;
  47821. t['macron'] = 333;
  47822. t['breve'] = 333;
  47823. t['dotaccent'] = 333;
  47824. t['dieresis'] = 333;
  47825. t['ring'] = 333;
  47826. t['cedilla'] = 333;
  47827. t['hungarumlaut'] = 333;
  47828. t['ogonek'] = 333;
  47829. t['caron'] = 333;
  47830. t['emdash'] = 1000;
  47831. t['AE'] = 944;
  47832. t['ordfeminine'] = 266;
  47833. t['Lslash'] = 611;
  47834. t['Oslash'] = 722;
  47835. t['OE'] = 944;
  47836. t['ordmasculine'] = 300;
  47837. t['ae'] = 722;
  47838. t['dotlessi'] = 278;
  47839. t['lslash'] = 278;
  47840. t['oslash'] = 500;
  47841. t['oe'] = 722;
  47842. t['germandbls'] = 500;
  47843. t['Idieresis'] = 389;
  47844. t['eacute'] = 444;
  47845. t['abreve'] = 500;
  47846. t['uhungarumlaut'] = 556;
  47847. t['ecaron'] = 444;
  47848. t['Ydieresis'] = 611;
  47849. t['divide'] = 570;
  47850. t['Yacute'] = 611;
  47851. t['Acircumflex'] = 667;
  47852. t['aacute'] = 500;
  47853. t['Ucircumflex'] = 722;
  47854. t['yacute'] = 444;
  47855. t['scommaaccent'] = 389;
  47856. t['ecircumflex'] = 444;
  47857. t['Uring'] = 722;
  47858. t['Udieresis'] = 722;
  47859. t['aogonek'] = 500;
  47860. t['Uacute'] = 722;
  47861. t['uogonek'] = 556;
  47862. t['Edieresis'] = 667;
  47863. t['Dcroat'] = 722;
  47864. t['commaaccent'] = 250;
  47865. t['copyright'] = 747;
  47866. t['Emacron'] = 667;
  47867. t['ccaron'] = 444;
  47868. t['aring'] = 500;
  47869. t['Ncommaaccent'] = 722;
  47870. t['lacute'] = 278;
  47871. t['agrave'] = 500;
  47872. t['Tcommaaccent'] = 611;
  47873. t['Cacute'] = 667;
  47874. t['atilde'] = 500;
  47875. t['Edotaccent'] = 667;
  47876. t['scaron'] = 389;
  47877. t['scedilla'] = 389;
  47878. t['iacute'] = 278;
  47879. t['lozenge'] = 494;
  47880. t['Rcaron'] = 667;
  47881. t['Gcommaaccent'] = 722;
  47882. t['ucircumflex'] = 556;
  47883. t['acircumflex'] = 500;
  47884. t['Amacron'] = 667;
  47885. t['rcaron'] = 389;
  47886. t['ccedilla'] = 444;
  47887. t['Zdotaccent'] = 611;
  47888. t['Thorn'] = 611;
  47889. t['Omacron'] = 722;
  47890. t['Racute'] = 667;
  47891. t['Sacute'] = 556;
  47892. t['dcaron'] = 608;
  47893. t['Umacron'] = 722;
  47894. t['uring'] = 556;
  47895. t['threesuperior'] = 300;
  47896. t['Ograve'] = 722;
  47897. t['Agrave'] = 667;
  47898. t['Abreve'] = 667;
  47899. t['multiply'] = 570;
  47900. t['uacute'] = 556;
  47901. t['Tcaron'] = 611;
  47902. t['partialdiff'] = 494;
  47903. t['ydieresis'] = 444;
  47904. t['Nacute'] = 722;
  47905. t['icircumflex'] = 278;
  47906. t['Ecircumflex'] = 667;
  47907. t['adieresis'] = 500;
  47908. t['edieresis'] = 444;
  47909. t['cacute'] = 444;
  47910. t['nacute'] = 556;
  47911. t['umacron'] = 556;
  47912. t['Ncaron'] = 722;
  47913. t['Iacute'] = 389;
  47914. t['plusminus'] = 570;
  47915. t['brokenbar'] = 220;
  47916. t['registered'] = 747;
  47917. t['Gbreve'] = 722;
  47918. t['Idotaccent'] = 389;
  47919. t['summation'] = 600;
  47920. t['Egrave'] = 667;
  47921. t['racute'] = 389;
  47922. t['omacron'] = 500;
  47923. t['Zacute'] = 611;
  47924. t['Zcaron'] = 611;
  47925. t['greaterequal'] = 549;
  47926. t['Eth'] = 722;
  47927. t['Ccedilla'] = 667;
  47928. t['lcommaaccent'] = 278;
  47929. t['tcaron'] = 366;
  47930. t['eogonek'] = 444;
  47931. t['Uogonek'] = 722;
  47932. t['Aacute'] = 667;
  47933. t['Adieresis'] = 667;
  47934. t['egrave'] = 444;
  47935. t['zacute'] = 389;
  47936. t['iogonek'] = 278;
  47937. t['Oacute'] = 722;
  47938. t['oacute'] = 500;
  47939. t['amacron'] = 500;
  47940. t['sacute'] = 389;
  47941. t['idieresis'] = 278;
  47942. t['Ocircumflex'] = 722;
  47943. t['Ugrave'] = 722;
  47944. t['Delta'] = 612;
  47945. t['thorn'] = 500;
  47946. t['twosuperior'] = 300;
  47947. t['Odieresis'] = 722;
  47948. t['mu'] = 576;
  47949. t['igrave'] = 278;
  47950. t['ohungarumlaut'] = 500;
  47951. t['Eogonek'] = 667;
  47952. t['dcroat'] = 500;
  47953. t['threequarters'] = 750;
  47954. t['Scedilla'] = 556;
  47955. t['lcaron'] = 382;
  47956. t['Kcommaaccent'] = 667;
  47957. t['Lacute'] = 611;
  47958. t['trademark'] = 1000;
  47959. t['edotaccent'] = 444;
  47960. t['Igrave'] = 389;
  47961. t['Imacron'] = 389;
  47962. t['Lcaron'] = 611;
  47963. t['onehalf'] = 750;
  47964. t['lessequal'] = 549;
  47965. t['ocircumflex'] = 500;
  47966. t['ntilde'] = 556;
  47967. t['Uhungarumlaut'] = 722;
  47968. t['Eacute'] = 667;
  47969. t['emacron'] = 444;
  47970. t['gbreve'] = 500;
  47971. t['onequarter'] = 750;
  47972. t['Scaron'] = 556;
  47973. t['Scommaaccent'] = 556;
  47974. t['Ohungarumlaut'] = 722;
  47975. t['degree'] = 400;
  47976. t['ograve'] = 500;
  47977. t['Ccaron'] = 667;
  47978. t['ugrave'] = 556;
  47979. t['radical'] = 549;
  47980. t['Dcaron'] = 722;
  47981. t['rcommaaccent'] = 389;
  47982. t['Ntilde'] = 722;
  47983. t['otilde'] = 500;
  47984. t['Rcommaaccent'] = 667;
  47985. t['Lcommaaccent'] = 611;
  47986. t['Atilde'] = 667;
  47987. t['Aogonek'] = 667;
  47988. t['Aring'] = 667;
  47989. t['Otilde'] = 722;
  47990. t['zdotaccent'] = 389;
  47991. t['Ecaron'] = 667;
  47992. t['Iogonek'] = 389;
  47993. t['kcommaaccent'] = 500;
  47994. t['minus'] = 606;
  47995. t['Icircumflex'] = 389;
  47996. t['ncaron'] = 556;
  47997. t['tcommaaccent'] = 278;
  47998. t['logicalnot'] = 606;
  47999. t['odieresis'] = 500;
  48000. t['udieresis'] = 556;
  48001. t['notequal'] = 549;
  48002. t['gcommaaccent'] = 500;
  48003. t['eth'] = 500;
  48004. t['zcaron'] = 389;
  48005. t['ncommaaccent'] = 556;
  48006. t['onesuperior'] = 300;
  48007. t['imacron'] = 278;
  48008. t['Euro'] = 500;
  48009. });
  48010. t['Times-Italic'] = getLookupTableFactory(function (t) {
  48011. t['space'] = 250;
  48012. t['exclam'] = 333;
  48013. t['quotedbl'] = 420;
  48014. t['numbersign'] = 500;
  48015. t['dollar'] = 500;
  48016. t['percent'] = 833;
  48017. t['ampersand'] = 778;
  48018. t['quoteright'] = 333;
  48019. t['parenleft'] = 333;
  48020. t['parenright'] = 333;
  48021. t['asterisk'] = 500;
  48022. t['plus'] = 675;
  48023. t['comma'] = 250;
  48024. t['hyphen'] = 333;
  48025. t['period'] = 250;
  48026. t['slash'] = 278;
  48027. t['zero'] = 500;
  48028. t['one'] = 500;
  48029. t['two'] = 500;
  48030. t['three'] = 500;
  48031. t['four'] = 500;
  48032. t['five'] = 500;
  48033. t['six'] = 500;
  48034. t['seven'] = 500;
  48035. t['eight'] = 500;
  48036. t['nine'] = 500;
  48037. t['colon'] = 333;
  48038. t['semicolon'] = 333;
  48039. t['less'] = 675;
  48040. t['equal'] = 675;
  48041. t['greater'] = 675;
  48042. t['question'] = 500;
  48043. t['at'] = 920;
  48044. t['A'] = 611;
  48045. t['B'] = 611;
  48046. t['C'] = 667;
  48047. t['D'] = 722;
  48048. t['E'] = 611;
  48049. t['F'] = 611;
  48050. t['G'] = 722;
  48051. t['H'] = 722;
  48052. t['I'] = 333;
  48053. t['J'] = 444;
  48054. t['K'] = 667;
  48055. t['L'] = 556;
  48056. t['M'] = 833;
  48057. t['N'] = 667;
  48058. t['O'] = 722;
  48059. t['P'] = 611;
  48060. t['Q'] = 722;
  48061. t['R'] = 611;
  48062. t['S'] = 500;
  48063. t['T'] = 556;
  48064. t['U'] = 722;
  48065. t['V'] = 611;
  48066. t['W'] = 833;
  48067. t['X'] = 611;
  48068. t['Y'] = 556;
  48069. t['Z'] = 556;
  48070. t['bracketleft'] = 389;
  48071. t['backslash'] = 278;
  48072. t['bracketright'] = 389;
  48073. t['asciicircum'] = 422;
  48074. t['underscore'] = 500;
  48075. t['quoteleft'] = 333;
  48076. t['a'] = 500;
  48077. t['b'] = 500;
  48078. t['c'] = 444;
  48079. t['d'] = 500;
  48080. t['e'] = 444;
  48081. t['f'] = 278;
  48082. t['g'] = 500;
  48083. t['h'] = 500;
  48084. t['i'] = 278;
  48085. t['j'] = 278;
  48086. t['k'] = 444;
  48087. t['l'] = 278;
  48088. t['m'] = 722;
  48089. t['n'] = 500;
  48090. t['o'] = 500;
  48091. t['p'] = 500;
  48092. t['q'] = 500;
  48093. t['r'] = 389;
  48094. t['s'] = 389;
  48095. t['t'] = 278;
  48096. t['u'] = 500;
  48097. t['v'] = 444;
  48098. t['w'] = 667;
  48099. t['x'] = 444;
  48100. t['y'] = 444;
  48101. t['z'] = 389;
  48102. t['braceleft'] = 400;
  48103. t['bar'] = 275;
  48104. t['braceright'] = 400;
  48105. t['asciitilde'] = 541;
  48106. t['exclamdown'] = 389;
  48107. t['cent'] = 500;
  48108. t['sterling'] = 500;
  48109. t['fraction'] = 167;
  48110. t['yen'] = 500;
  48111. t['florin'] = 500;
  48112. t['section'] = 500;
  48113. t['currency'] = 500;
  48114. t['quotesingle'] = 214;
  48115. t['quotedblleft'] = 556;
  48116. t['guillemotleft'] = 500;
  48117. t['guilsinglleft'] = 333;
  48118. t['guilsinglright'] = 333;
  48119. t['fi'] = 500;
  48120. t['fl'] = 500;
  48121. t['endash'] = 500;
  48122. t['dagger'] = 500;
  48123. t['daggerdbl'] = 500;
  48124. t['periodcentered'] = 250;
  48125. t['paragraph'] = 523;
  48126. t['bullet'] = 350;
  48127. t['quotesinglbase'] = 333;
  48128. t['quotedblbase'] = 556;
  48129. t['quotedblright'] = 556;
  48130. t['guillemotright'] = 500;
  48131. t['ellipsis'] = 889;
  48132. t['perthousand'] = 1000;
  48133. t['questiondown'] = 500;
  48134. t['grave'] = 333;
  48135. t['acute'] = 333;
  48136. t['circumflex'] = 333;
  48137. t['tilde'] = 333;
  48138. t['macron'] = 333;
  48139. t['breve'] = 333;
  48140. t['dotaccent'] = 333;
  48141. t['dieresis'] = 333;
  48142. t['ring'] = 333;
  48143. t['cedilla'] = 333;
  48144. t['hungarumlaut'] = 333;
  48145. t['ogonek'] = 333;
  48146. t['caron'] = 333;
  48147. t['emdash'] = 889;
  48148. t['AE'] = 889;
  48149. t['ordfeminine'] = 276;
  48150. t['Lslash'] = 556;
  48151. t['Oslash'] = 722;
  48152. t['OE'] = 944;
  48153. t['ordmasculine'] = 310;
  48154. t['ae'] = 667;
  48155. t['dotlessi'] = 278;
  48156. t['lslash'] = 278;
  48157. t['oslash'] = 500;
  48158. t['oe'] = 667;
  48159. t['germandbls'] = 500;
  48160. t['Idieresis'] = 333;
  48161. t['eacute'] = 444;
  48162. t['abreve'] = 500;
  48163. t['uhungarumlaut'] = 500;
  48164. t['ecaron'] = 444;
  48165. t['Ydieresis'] = 556;
  48166. t['divide'] = 675;
  48167. t['Yacute'] = 556;
  48168. t['Acircumflex'] = 611;
  48169. t['aacute'] = 500;
  48170. t['Ucircumflex'] = 722;
  48171. t['yacute'] = 444;
  48172. t['scommaaccent'] = 389;
  48173. t['ecircumflex'] = 444;
  48174. t['Uring'] = 722;
  48175. t['Udieresis'] = 722;
  48176. t['aogonek'] = 500;
  48177. t['Uacute'] = 722;
  48178. t['uogonek'] = 500;
  48179. t['Edieresis'] = 611;
  48180. t['Dcroat'] = 722;
  48181. t['commaaccent'] = 250;
  48182. t['copyright'] = 760;
  48183. t['Emacron'] = 611;
  48184. t['ccaron'] = 444;
  48185. t['aring'] = 500;
  48186. t['Ncommaaccent'] = 667;
  48187. t['lacute'] = 278;
  48188. t['agrave'] = 500;
  48189. t['Tcommaaccent'] = 556;
  48190. t['Cacute'] = 667;
  48191. t['atilde'] = 500;
  48192. t['Edotaccent'] = 611;
  48193. t['scaron'] = 389;
  48194. t['scedilla'] = 389;
  48195. t['iacute'] = 278;
  48196. t['lozenge'] = 471;
  48197. t['Rcaron'] = 611;
  48198. t['Gcommaaccent'] = 722;
  48199. t['ucircumflex'] = 500;
  48200. t['acircumflex'] = 500;
  48201. t['Amacron'] = 611;
  48202. t['rcaron'] = 389;
  48203. t['ccedilla'] = 444;
  48204. t['Zdotaccent'] = 556;
  48205. t['Thorn'] = 611;
  48206. t['Omacron'] = 722;
  48207. t['Racute'] = 611;
  48208. t['Sacute'] = 500;
  48209. t['dcaron'] = 544;
  48210. t['Umacron'] = 722;
  48211. t['uring'] = 500;
  48212. t['threesuperior'] = 300;
  48213. t['Ograve'] = 722;
  48214. t['Agrave'] = 611;
  48215. t['Abreve'] = 611;
  48216. t['multiply'] = 675;
  48217. t['uacute'] = 500;
  48218. t['Tcaron'] = 556;
  48219. t['partialdiff'] = 476;
  48220. t['ydieresis'] = 444;
  48221. t['Nacute'] = 667;
  48222. t['icircumflex'] = 278;
  48223. t['Ecircumflex'] = 611;
  48224. t['adieresis'] = 500;
  48225. t['edieresis'] = 444;
  48226. t['cacute'] = 444;
  48227. t['nacute'] = 500;
  48228. t['umacron'] = 500;
  48229. t['Ncaron'] = 667;
  48230. t['Iacute'] = 333;
  48231. t['plusminus'] = 675;
  48232. t['brokenbar'] = 275;
  48233. t['registered'] = 760;
  48234. t['Gbreve'] = 722;
  48235. t['Idotaccent'] = 333;
  48236. t['summation'] = 600;
  48237. t['Egrave'] = 611;
  48238. t['racute'] = 389;
  48239. t['omacron'] = 500;
  48240. t['Zacute'] = 556;
  48241. t['Zcaron'] = 556;
  48242. t['greaterequal'] = 549;
  48243. t['Eth'] = 722;
  48244. t['Ccedilla'] = 667;
  48245. t['lcommaaccent'] = 278;
  48246. t['tcaron'] = 300;
  48247. t['eogonek'] = 444;
  48248. t['Uogonek'] = 722;
  48249. t['Aacute'] = 611;
  48250. t['Adieresis'] = 611;
  48251. t['egrave'] = 444;
  48252. t['zacute'] = 389;
  48253. t['iogonek'] = 278;
  48254. t['Oacute'] = 722;
  48255. t['oacute'] = 500;
  48256. t['amacron'] = 500;
  48257. t['sacute'] = 389;
  48258. t['idieresis'] = 278;
  48259. t['Ocircumflex'] = 722;
  48260. t['Ugrave'] = 722;
  48261. t['Delta'] = 612;
  48262. t['thorn'] = 500;
  48263. t['twosuperior'] = 300;
  48264. t['Odieresis'] = 722;
  48265. t['mu'] = 500;
  48266. t['igrave'] = 278;
  48267. t['ohungarumlaut'] = 500;
  48268. t['Eogonek'] = 611;
  48269. t['dcroat'] = 500;
  48270. t['threequarters'] = 750;
  48271. t['Scedilla'] = 500;
  48272. t['lcaron'] = 300;
  48273. t['Kcommaaccent'] = 667;
  48274. t['Lacute'] = 556;
  48275. t['trademark'] = 980;
  48276. t['edotaccent'] = 444;
  48277. t['Igrave'] = 333;
  48278. t['Imacron'] = 333;
  48279. t['Lcaron'] = 611;
  48280. t['onehalf'] = 750;
  48281. t['lessequal'] = 549;
  48282. t['ocircumflex'] = 500;
  48283. t['ntilde'] = 500;
  48284. t['Uhungarumlaut'] = 722;
  48285. t['Eacute'] = 611;
  48286. t['emacron'] = 444;
  48287. t['gbreve'] = 500;
  48288. t['onequarter'] = 750;
  48289. t['Scaron'] = 500;
  48290. t['Scommaaccent'] = 500;
  48291. t['Ohungarumlaut'] = 722;
  48292. t['degree'] = 400;
  48293. t['ograve'] = 500;
  48294. t['Ccaron'] = 667;
  48295. t['ugrave'] = 500;
  48296. t['radical'] = 453;
  48297. t['Dcaron'] = 722;
  48298. t['rcommaaccent'] = 389;
  48299. t['Ntilde'] = 667;
  48300. t['otilde'] = 500;
  48301. t['Rcommaaccent'] = 611;
  48302. t['Lcommaaccent'] = 556;
  48303. t['Atilde'] = 611;
  48304. t['Aogonek'] = 611;
  48305. t['Aring'] = 611;
  48306. t['Otilde'] = 722;
  48307. t['zdotaccent'] = 389;
  48308. t['Ecaron'] = 611;
  48309. t['Iogonek'] = 333;
  48310. t['kcommaaccent'] = 444;
  48311. t['minus'] = 675;
  48312. t['Icircumflex'] = 333;
  48313. t['ncaron'] = 500;
  48314. t['tcommaaccent'] = 278;
  48315. t['logicalnot'] = 675;
  48316. t['odieresis'] = 500;
  48317. t['udieresis'] = 500;
  48318. t['notequal'] = 549;
  48319. t['gcommaaccent'] = 500;
  48320. t['eth'] = 500;
  48321. t['zcaron'] = 389;
  48322. t['ncommaaccent'] = 500;
  48323. t['onesuperior'] = 300;
  48324. t['imacron'] = 278;
  48325. t['Euro'] = 500;
  48326. });
  48327. t['ZapfDingbats'] = getLookupTableFactory(function (t) {
  48328. t['space'] = 278;
  48329. t['a1'] = 974;
  48330. t['a2'] = 961;
  48331. t['a202'] = 974;
  48332. t['a3'] = 980;
  48333. t['a4'] = 719;
  48334. t['a5'] = 789;
  48335. t['a119'] = 790;
  48336. t['a118'] = 791;
  48337. t['a117'] = 690;
  48338. t['a11'] = 960;
  48339. t['a12'] = 939;
  48340. t['a13'] = 549;
  48341. t['a14'] = 855;
  48342. t['a15'] = 911;
  48343. t['a16'] = 933;
  48344. t['a105'] = 911;
  48345. t['a17'] = 945;
  48346. t['a18'] = 974;
  48347. t['a19'] = 755;
  48348. t['a20'] = 846;
  48349. t['a21'] = 762;
  48350. t['a22'] = 761;
  48351. t['a23'] = 571;
  48352. t['a24'] = 677;
  48353. t['a25'] = 763;
  48354. t['a26'] = 760;
  48355. t['a27'] = 759;
  48356. t['a28'] = 754;
  48357. t['a6'] = 494;
  48358. t['a7'] = 552;
  48359. t['a8'] = 537;
  48360. t['a9'] = 577;
  48361. t['a10'] = 692;
  48362. t['a29'] = 786;
  48363. t['a30'] = 788;
  48364. t['a31'] = 788;
  48365. t['a32'] = 790;
  48366. t['a33'] = 793;
  48367. t['a34'] = 794;
  48368. t['a35'] = 816;
  48369. t['a36'] = 823;
  48370. t['a37'] = 789;
  48371. t['a38'] = 841;
  48372. t['a39'] = 823;
  48373. t['a40'] = 833;
  48374. t['a41'] = 816;
  48375. t['a42'] = 831;
  48376. t['a43'] = 923;
  48377. t['a44'] = 744;
  48378. t['a45'] = 723;
  48379. t['a46'] = 749;
  48380. t['a47'] = 790;
  48381. t['a48'] = 792;
  48382. t['a49'] = 695;
  48383. t['a50'] = 776;
  48384. t['a51'] = 768;
  48385. t['a52'] = 792;
  48386. t['a53'] = 759;
  48387. t['a54'] = 707;
  48388. t['a55'] = 708;
  48389. t['a56'] = 682;
  48390. t['a57'] = 701;
  48391. t['a58'] = 826;
  48392. t['a59'] = 815;
  48393. t['a60'] = 789;
  48394. t['a61'] = 789;
  48395. t['a62'] = 707;
  48396. t['a63'] = 687;
  48397. t['a64'] = 696;
  48398. t['a65'] = 689;
  48399. t['a66'] = 786;
  48400. t['a67'] = 787;
  48401. t['a68'] = 713;
  48402. t['a69'] = 791;
  48403. t['a70'] = 785;
  48404. t['a71'] = 791;
  48405. t['a72'] = 873;
  48406. t['a73'] = 761;
  48407. t['a74'] = 762;
  48408. t['a203'] = 762;
  48409. t['a75'] = 759;
  48410. t['a204'] = 759;
  48411. t['a76'] = 892;
  48412. t['a77'] = 892;
  48413. t['a78'] = 788;
  48414. t['a79'] = 784;
  48415. t['a81'] = 438;
  48416. t['a82'] = 138;
  48417. t['a83'] = 277;
  48418. t['a84'] = 415;
  48419. t['a97'] = 392;
  48420. t['a98'] = 392;
  48421. t['a99'] = 668;
  48422. t['a100'] = 668;
  48423. t['a89'] = 390;
  48424. t['a90'] = 390;
  48425. t['a93'] = 317;
  48426. t['a94'] = 317;
  48427. t['a91'] = 276;
  48428. t['a92'] = 276;
  48429. t['a205'] = 509;
  48430. t['a85'] = 509;
  48431. t['a206'] = 410;
  48432. t['a86'] = 410;
  48433. t['a87'] = 234;
  48434. t['a88'] = 234;
  48435. t['a95'] = 334;
  48436. t['a96'] = 334;
  48437. t['a101'] = 732;
  48438. t['a102'] = 544;
  48439. t['a103'] = 544;
  48440. t['a104'] = 910;
  48441. t['a106'] = 667;
  48442. t['a107'] = 760;
  48443. t['a108'] = 760;
  48444. t['a112'] = 776;
  48445. t['a111'] = 595;
  48446. t['a110'] = 694;
  48447. t['a109'] = 626;
  48448. t['a120'] = 788;
  48449. t['a121'] = 788;
  48450. t['a122'] = 788;
  48451. t['a123'] = 788;
  48452. t['a124'] = 788;
  48453. t['a125'] = 788;
  48454. t['a126'] = 788;
  48455. t['a127'] = 788;
  48456. t['a128'] = 788;
  48457. t['a129'] = 788;
  48458. t['a130'] = 788;
  48459. t['a131'] = 788;
  48460. t['a132'] = 788;
  48461. t['a133'] = 788;
  48462. t['a134'] = 788;
  48463. t['a135'] = 788;
  48464. t['a136'] = 788;
  48465. t['a137'] = 788;
  48466. t['a138'] = 788;
  48467. t['a139'] = 788;
  48468. t['a140'] = 788;
  48469. t['a141'] = 788;
  48470. t['a142'] = 788;
  48471. t['a143'] = 788;
  48472. t['a144'] = 788;
  48473. t['a145'] = 788;
  48474. t['a146'] = 788;
  48475. t['a147'] = 788;
  48476. t['a148'] = 788;
  48477. t['a149'] = 788;
  48478. t['a150'] = 788;
  48479. t['a151'] = 788;
  48480. t['a152'] = 788;
  48481. t['a153'] = 788;
  48482. t['a154'] = 788;
  48483. t['a155'] = 788;
  48484. t['a156'] = 788;
  48485. t['a157'] = 788;
  48486. t['a158'] = 788;
  48487. t['a159'] = 788;
  48488. t['a160'] = 894;
  48489. t['a161'] = 838;
  48490. t['a163'] = 1016;
  48491. t['a164'] = 458;
  48492. t['a196'] = 748;
  48493. t['a165'] = 924;
  48494. t['a192'] = 748;
  48495. t['a166'] = 918;
  48496. t['a167'] = 927;
  48497. t['a168'] = 928;
  48498. t['a169'] = 928;
  48499. t['a170'] = 834;
  48500. t['a171'] = 873;
  48501. t['a172'] = 828;
  48502. t['a173'] = 924;
  48503. t['a162'] = 924;
  48504. t['a174'] = 917;
  48505. t['a175'] = 930;
  48506. t['a176'] = 931;
  48507. t['a177'] = 463;
  48508. t['a178'] = 883;
  48509. t['a179'] = 836;
  48510. t['a193'] = 836;
  48511. t['a180'] = 867;
  48512. t['a199'] = 867;
  48513. t['a181'] = 696;
  48514. t['a200'] = 696;
  48515. t['a182'] = 874;
  48516. t['a201'] = 874;
  48517. t['a183'] = 760;
  48518. t['a184'] = 946;
  48519. t['a197'] = 771;
  48520. t['a185'] = 865;
  48521. t['a194'] = 771;
  48522. t['a198'] = 888;
  48523. t['a186'] = 967;
  48524. t['a195'] = 888;
  48525. t['a187'] = 831;
  48526. t['a188'] = 873;
  48527. t['a189'] = 927;
  48528. t['a190'] = 970;
  48529. t['a191'] = 918;
  48530. });
  48531. });
  48532. exports.getMetrics = getMetrics;
  48533. /***/ }),
  48534. /* 32 */
  48535. /***/ (function(module, exports, __w_pdfjs_require__) {
  48536. "use strict";
  48537. var sharedUtil = __w_pdfjs_require__(0);
  48538. var Uint32ArrayView = sharedUtil.Uint32ArrayView;
  48539. var MurmurHash3_64 = function MurmurHash3_64Closure(seed) {
  48540. var MASK_HIGH = 0xffff0000;
  48541. var MASK_LOW = 0xffff;
  48542. function MurmurHash3_64(seed) {
  48543. var SEED = 0xc3d2e1f0;
  48544. this.h1 = seed ? seed & 0xffffffff : SEED;
  48545. this.h2 = seed ? seed & 0xffffffff : SEED;
  48546. }
  48547. var alwaysUseUint32ArrayView = false;
  48548. try {
  48549. new Uint32Array(new Uint8Array(5).buffer, 0, 1);
  48550. } catch (e) {
  48551. alwaysUseUint32ArrayView = true;
  48552. }
  48553. MurmurHash3_64.prototype = {
  48554. update: function MurmurHash3_64_update(input) {
  48555. var useUint32ArrayView = alwaysUseUint32ArrayView;
  48556. var i;
  48557. if (typeof input === 'string') {
  48558. var data = new Uint8Array(input.length * 2);
  48559. var length = 0;
  48560. for (i = 0; i < input.length; i++) {
  48561. var code = input.charCodeAt(i);
  48562. if (code <= 0xff) {
  48563. data[length++] = code;
  48564. } else {
  48565. data[length++] = code >>> 8;
  48566. data[length++] = code & 0xff;
  48567. }
  48568. }
  48569. } else if (input instanceof Uint8Array) {
  48570. data = input;
  48571. length = data.length;
  48572. } else if (typeof input === 'object' && 'length' in input) {
  48573. data = input;
  48574. length = data.length;
  48575. useUint32ArrayView = true;
  48576. } else {
  48577. throw new Error('Wrong data format in MurmurHash3_64_update. ' + 'Input must be a string or array.');
  48578. }
  48579. var blockCounts = length >> 2;
  48580. var tailLength = length - blockCounts * 4;
  48581. var dataUint32 = useUint32ArrayView ? new Uint32ArrayView(data, blockCounts) : new Uint32Array(data.buffer, 0, blockCounts);
  48582. var k1 = 0;
  48583. var k2 = 0;
  48584. var h1 = this.h1;
  48585. var h2 = this.h2;
  48586. var C1 = 0xcc9e2d51;
  48587. var C2 = 0x1b873593;
  48588. var C1_LOW = C1 & MASK_LOW;
  48589. var C2_LOW = C2 & MASK_LOW;
  48590. for (i = 0; i < blockCounts; i++) {
  48591. if (i & 1) {
  48592. k1 = dataUint32[i];
  48593. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  48594. k1 = k1 << 15 | k1 >>> 17;
  48595. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  48596. h1 ^= k1;
  48597. h1 = h1 << 13 | h1 >>> 19;
  48598. h1 = h1 * 5 + 0xe6546b64;
  48599. } else {
  48600. k2 = dataUint32[i];
  48601. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  48602. k2 = k2 << 15 | k2 >>> 17;
  48603. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  48604. h2 ^= k2;
  48605. h2 = h2 << 13 | h2 >>> 19;
  48606. h2 = h2 * 5 + 0xe6546b64;
  48607. }
  48608. }
  48609. k1 = 0;
  48610. switch (tailLength) {
  48611. case 3:
  48612. k1 ^= data[blockCounts * 4 + 2] << 16;
  48613. case 2:
  48614. k1 ^= data[blockCounts * 4 + 1] << 8;
  48615. case 1:
  48616. k1 ^= data[blockCounts * 4];
  48617. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  48618. k1 = k1 << 15 | k1 >>> 17;
  48619. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  48620. if (blockCounts & 1) {
  48621. h1 ^= k1;
  48622. } else {
  48623. h2 ^= k1;
  48624. }
  48625. }
  48626. this.h1 = h1;
  48627. this.h2 = h2;
  48628. return this;
  48629. },
  48630. hexdigest: function MurmurHash3_64_hexdigest() {
  48631. var h1 = this.h1;
  48632. var h2 = this.h2;
  48633. h1 ^= h2 >>> 1;
  48634. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  48635. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  48636. h1 ^= h2 >>> 1;
  48637. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  48638. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  48639. h1 ^= h2 >>> 1;
  48640. for (var i = 0, arr = [
  48641. h1,
  48642. h2
  48643. ], str = ''; i < arr.length; i++) {
  48644. var hex = (arr[i] >>> 0).toString(16);
  48645. while (hex.length < 8) {
  48646. hex = '0' + hex;
  48647. }
  48648. str += hex;
  48649. }
  48650. return str;
  48651. }
  48652. };
  48653. return MurmurHash3_64;
  48654. }();
  48655. exports.MurmurHash3_64 = MurmurHash3_64;
  48656. /***/ }),
  48657. /* 33 */
  48658. /***/ (function(module, exports, __w_pdfjs_require__) {
  48659. "use strict";
  48660. var sharedUtil = __w_pdfjs_require__(0);
  48661. var corePrimitives = __w_pdfjs_require__(1);
  48662. var coreFunction = __w_pdfjs_require__(6);
  48663. var coreColorSpace = __w_pdfjs_require__(3);
  48664. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  48665. var MissingDataException = sharedUtil.MissingDataException;
  48666. var Util = sharedUtil.Util;
  48667. var assert = sharedUtil.assert;
  48668. var error = sharedUtil.error;
  48669. var info = sharedUtil.info;
  48670. var warn = sharedUtil.warn;
  48671. var isStream = corePrimitives.isStream;
  48672. var PDFFunction = coreFunction.PDFFunction;
  48673. var ColorSpace = coreColorSpace.ColorSpace;
  48674. var ShadingType = {
  48675. FUNCTION_BASED: 1,
  48676. AXIAL: 2,
  48677. RADIAL: 3,
  48678. FREE_FORM_MESH: 4,
  48679. LATTICE_FORM_MESH: 5,
  48680. COONS_PATCH_MESH: 6,
  48681. TENSOR_PATCH_MESH: 7
  48682. };
  48683. var Pattern = function PatternClosure() {
  48684. function Pattern() {
  48685. error('should not call Pattern constructor');
  48686. }
  48687. Pattern.prototype = {
  48688. getPattern: function Pattern_getPattern(ctx) {
  48689. error('Should not call Pattern.getStyle: ' + ctx);
  48690. }
  48691. };
  48692. Pattern.parseShading = function Pattern_parseShading(shading, matrix, xref, res, handler) {
  48693. var dict = isStream(shading) ? shading.dict : shading;
  48694. var type = dict.get('ShadingType');
  48695. try {
  48696. switch (type) {
  48697. case ShadingType.AXIAL:
  48698. case ShadingType.RADIAL:
  48699. return new Shadings.RadialAxial(dict, matrix, xref, res);
  48700. case ShadingType.FREE_FORM_MESH:
  48701. case ShadingType.LATTICE_FORM_MESH:
  48702. case ShadingType.COONS_PATCH_MESH:
  48703. case ShadingType.TENSOR_PATCH_MESH:
  48704. return new Shadings.Mesh(shading, matrix, xref, res);
  48705. default:
  48706. throw new Error('Unsupported ShadingType: ' + type);
  48707. }
  48708. } catch (ex) {
  48709. if (ex instanceof MissingDataException) {
  48710. throw ex;
  48711. }
  48712. handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.shadingPattern });
  48713. warn(ex);
  48714. return new Shadings.Dummy();
  48715. }
  48716. };
  48717. return Pattern;
  48718. }();
  48719. var Shadings = {};
  48720. Shadings.SMALL_NUMBER = 1e-6;
  48721. Shadings.RadialAxial = function RadialAxialClosure() {
  48722. function RadialAxial(dict, matrix, xref, res) {
  48723. this.matrix = matrix;
  48724. this.coordsArr = dict.getArray('Coords');
  48725. this.shadingType = dict.get('ShadingType');
  48726. this.type = 'Pattern';
  48727. var cs = dict.get('ColorSpace', 'CS');
  48728. cs = ColorSpace.parse(cs, xref, res);
  48729. this.cs = cs;
  48730. var t0 = 0.0, t1 = 1.0;
  48731. if (dict.has('Domain')) {
  48732. var domainArr = dict.getArray('Domain');
  48733. t0 = domainArr[0];
  48734. t1 = domainArr[1];
  48735. }
  48736. var extendStart = false, extendEnd = false;
  48737. if (dict.has('Extend')) {
  48738. var extendArr = dict.getArray('Extend');
  48739. extendStart = extendArr[0];
  48740. extendEnd = extendArr[1];
  48741. }
  48742. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  48743. var x1 = this.coordsArr[0];
  48744. var y1 = this.coordsArr[1];
  48745. var r1 = this.coordsArr[2];
  48746. var x2 = this.coordsArr[3];
  48747. var y2 = this.coordsArr[4];
  48748. var r2 = this.coordsArr[5];
  48749. var distance = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  48750. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  48751. warn('Unsupported radial gradient.');
  48752. }
  48753. }
  48754. this.extendStart = extendStart;
  48755. this.extendEnd = extendEnd;
  48756. var fnObj = dict.get('Function');
  48757. var fn = PDFFunction.parseArray(xref, fnObj);
  48758. var diff = t1 - t0;
  48759. var step = diff / 10;
  48760. var colorStops = this.colorStops = [];
  48761. if (t0 >= t1 || step <= 0) {
  48762. info('Bad shading domain.');
  48763. return;
  48764. }
  48765. var color = new Float32Array(cs.numComps), ratio = new Float32Array(1);
  48766. var rgbColor;
  48767. for (var i = t0; i <= t1; i += step) {
  48768. ratio[0] = i;
  48769. fn(ratio, 0, color, 0);
  48770. rgbColor = cs.getRgb(color, 0);
  48771. var cssColor = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  48772. colorStops.push([
  48773. (i - t0) / diff,
  48774. cssColor
  48775. ]);
  48776. }
  48777. var background = 'transparent';
  48778. if (dict.has('Background')) {
  48779. rgbColor = cs.getRgb(dict.get('Background'), 0);
  48780. background = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  48781. }
  48782. if (!extendStart) {
  48783. colorStops.unshift([
  48784. 0,
  48785. background
  48786. ]);
  48787. colorStops[1][0] += Shadings.SMALL_NUMBER;
  48788. }
  48789. if (!extendEnd) {
  48790. colorStops[colorStops.length - 1][0] -= Shadings.SMALL_NUMBER;
  48791. colorStops.push([
  48792. 1,
  48793. background
  48794. ]);
  48795. }
  48796. this.colorStops = colorStops;
  48797. }
  48798. RadialAxial.prototype = {
  48799. getIR: function RadialAxial_getIR() {
  48800. var coordsArr = this.coordsArr;
  48801. var shadingType = this.shadingType;
  48802. var type, p0, p1, r0, r1;
  48803. if (shadingType === ShadingType.AXIAL) {
  48804. p0 = [
  48805. coordsArr[0],
  48806. coordsArr[1]
  48807. ];
  48808. p1 = [
  48809. coordsArr[2],
  48810. coordsArr[3]
  48811. ];
  48812. r0 = null;
  48813. r1 = null;
  48814. type = 'axial';
  48815. } else if (shadingType === ShadingType.RADIAL) {
  48816. p0 = [
  48817. coordsArr[0],
  48818. coordsArr[1]
  48819. ];
  48820. p1 = [
  48821. coordsArr[3],
  48822. coordsArr[4]
  48823. ];
  48824. r0 = coordsArr[2];
  48825. r1 = coordsArr[5];
  48826. type = 'radial';
  48827. } else {
  48828. error('getPattern type unknown: ' + shadingType);
  48829. }
  48830. var matrix = this.matrix;
  48831. if (matrix) {
  48832. p0 = Util.applyTransform(p0, matrix);
  48833. p1 = Util.applyTransform(p1, matrix);
  48834. if (shadingType === ShadingType.RADIAL) {
  48835. var scale = Util.singularValueDecompose2dScale(matrix);
  48836. r0 *= scale[0];
  48837. r1 *= scale[1];
  48838. }
  48839. }
  48840. return [
  48841. 'RadialAxial',
  48842. type,
  48843. this.colorStops,
  48844. p0,
  48845. p1,
  48846. r0,
  48847. r1
  48848. ];
  48849. }
  48850. };
  48851. return RadialAxial;
  48852. }();
  48853. Shadings.Mesh = function MeshClosure() {
  48854. function MeshStreamReader(stream, context) {
  48855. this.stream = stream;
  48856. this.context = context;
  48857. this.buffer = 0;
  48858. this.bufferLength = 0;
  48859. var numComps = context.numComps;
  48860. this.tmpCompsBuf = new Float32Array(numComps);
  48861. var csNumComps = context.colorSpace.numComps;
  48862. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  48863. }
  48864. MeshStreamReader.prototype = {
  48865. get hasData() {
  48866. if (this.stream.end) {
  48867. return this.stream.pos < this.stream.end;
  48868. }
  48869. if (this.bufferLength > 0) {
  48870. return true;
  48871. }
  48872. var nextByte = this.stream.getByte();
  48873. if (nextByte < 0) {
  48874. return false;
  48875. }
  48876. this.buffer = nextByte;
  48877. this.bufferLength = 8;
  48878. return true;
  48879. },
  48880. readBits: function MeshStreamReader_readBits(n) {
  48881. var buffer = this.buffer;
  48882. var bufferLength = this.bufferLength;
  48883. if (n === 32) {
  48884. if (bufferLength === 0) {
  48885. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  48886. }
  48887. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  48888. var nextByte = this.stream.getByte();
  48889. this.buffer = nextByte & (1 << bufferLength) - 1;
  48890. return (buffer << 8 - bufferLength | (nextByte & 0xFF) >> bufferLength) >>> 0;
  48891. }
  48892. if (n === 8 && bufferLength === 0) {
  48893. return this.stream.getByte();
  48894. }
  48895. while (bufferLength < n) {
  48896. buffer = buffer << 8 | this.stream.getByte();
  48897. bufferLength += 8;
  48898. }
  48899. bufferLength -= n;
  48900. this.bufferLength = bufferLength;
  48901. this.buffer = buffer & (1 << bufferLength) - 1;
  48902. return buffer >> bufferLength;
  48903. },
  48904. align: function MeshStreamReader_align() {
  48905. this.buffer = 0;
  48906. this.bufferLength = 0;
  48907. },
  48908. readFlag: function MeshStreamReader_readFlag() {
  48909. return this.readBits(this.context.bitsPerFlag);
  48910. },
  48911. readCoordinate: function MeshStreamReader_readCoordinate() {
  48912. var bitsPerCoordinate = this.context.bitsPerCoordinate;
  48913. var xi = this.readBits(bitsPerCoordinate);
  48914. var yi = this.readBits(bitsPerCoordinate);
  48915. var decode = this.context.decode;
  48916. var scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  48917. return [
  48918. xi * scale * (decode[1] - decode[0]) + decode[0],
  48919. yi * scale * (decode[3] - decode[2]) + decode[2]
  48920. ];
  48921. },
  48922. readComponents: function MeshStreamReader_readComponents() {
  48923. var numComps = this.context.numComps;
  48924. var bitsPerComponent = this.context.bitsPerComponent;
  48925. var scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  48926. var decode = this.context.decode;
  48927. var components = this.tmpCompsBuf;
  48928. for (var i = 0, j = 4; i < numComps; i++, j += 2) {
  48929. var ci = this.readBits(bitsPerComponent);
  48930. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  48931. }
  48932. var color = this.tmpCsCompsBuf;
  48933. if (this.context.colorFn) {
  48934. this.context.colorFn(components, 0, color, 0);
  48935. }
  48936. return this.context.colorSpace.getRgb(color, 0);
  48937. }
  48938. };
  48939. function decodeType4Shading(mesh, reader) {
  48940. var coords = mesh.coords;
  48941. var colors = mesh.colors;
  48942. var operators = [];
  48943. var ps = [];
  48944. var verticesLeft = 0;
  48945. while (reader.hasData) {
  48946. var f = reader.readFlag();
  48947. var coord = reader.readCoordinate();
  48948. var color = reader.readComponents();
  48949. if (verticesLeft === 0) {
  48950. assert(0 <= f && f <= 2, 'Unknown type4 flag');
  48951. switch (f) {
  48952. case 0:
  48953. verticesLeft = 3;
  48954. break;
  48955. case 1:
  48956. ps.push(ps[ps.length - 2], ps[ps.length - 1]);
  48957. verticesLeft = 1;
  48958. break;
  48959. case 2:
  48960. ps.push(ps[ps.length - 3], ps[ps.length - 1]);
  48961. verticesLeft = 1;
  48962. break;
  48963. }
  48964. operators.push(f);
  48965. }
  48966. ps.push(coords.length);
  48967. coords.push(coord);
  48968. colors.push(color);
  48969. verticesLeft--;
  48970. reader.align();
  48971. }
  48972. mesh.figures.push({
  48973. type: 'triangles',
  48974. coords: new Int32Array(ps),
  48975. colors: new Int32Array(ps)
  48976. });
  48977. }
  48978. function decodeType5Shading(mesh, reader, verticesPerRow) {
  48979. var coords = mesh.coords;
  48980. var colors = mesh.colors;
  48981. var ps = [];
  48982. while (reader.hasData) {
  48983. var coord = reader.readCoordinate();
  48984. var color = reader.readComponents();
  48985. ps.push(coords.length);
  48986. coords.push(coord);
  48987. colors.push(color);
  48988. }
  48989. mesh.figures.push({
  48990. type: 'lattice',
  48991. coords: new Int32Array(ps),
  48992. colors: new Int32Array(ps),
  48993. verticesPerRow: verticesPerRow
  48994. });
  48995. }
  48996. var MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3;
  48997. var MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20;
  48998. var TRIANGLE_DENSITY = 20;
  48999. var getB = function getBClosure() {
  49000. function buildB(count) {
  49001. var lut = [];
  49002. for (var i = 0; i <= count; i++) {
  49003. var t = i / count, t_ = 1 - t;
  49004. lut.push(new Float32Array([
  49005. t_ * t_ * t_,
  49006. 3 * t * t_ * t_,
  49007. 3 * t * t * t_,
  49008. t * t * t
  49009. ]));
  49010. }
  49011. return lut;
  49012. }
  49013. var cache = [];
  49014. return function getB(count) {
  49015. if (!cache[count]) {
  49016. cache[count] = buildB(count);
  49017. }
  49018. return cache[count];
  49019. };
  49020. }();
  49021. function buildFigureFromPatch(mesh, index) {
  49022. var figure = mesh.figures[index];
  49023. assert(figure.type === 'patch', 'Unexpected patch mesh figure');
  49024. var coords = mesh.coords, colors = mesh.colors;
  49025. var pi = figure.coords;
  49026. var ci = figure.colors;
  49027. var figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  49028. var figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  49029. var figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  49030. var figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  49031. var splitXBy = Math.ceil((figureMaxX - figureMinX) * TRIANGLE_DENSITY / (mesh.bounds[2] - mesh.bounds[0]));
  49032. splitXBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  49033. var splitYBy = Math.ceil((figureMaxY - figureMinY) * TRIANGLE_DENSITY / (mesh.bounds[3] - mesh.bounds[1]));
  49034. splitYBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  49035. var verticesPerRow = splitXBy + 1;
  49036. var figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  49037. var figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  49038. var k = 0;
  49039. var cl = new Uint8Array(3), cr = new Uint8Array(3);
  49040. var c0 = colors[ci[0]], c1 = colors[ci[1]], c2 = colors[ci[2]], c3 = colors[ci[3]];
  49041. var bRow = getB(splitYBy), bCol = getB(splitXBy);
  49042. for (var row = 0; row <= splitYBy; row++) {
  49043. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  49044. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  49045. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  49046. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  49047. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  49048. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  49049. for (var col = 0; col <= splitXBy; col++, k++) {
  49050. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  49051. continue;
  49052. }
  49053. var x = 0, y = 0;
  49054. var q = 0;
  49055. for (var i = 0; i <= 3; i++) {
  49056. for (var j = 0; j <= 3; j++, q++) {
  49057. var m = bRow[row][i] * bCol[col][j];
  49058. x += coords[pi[q]][0] * m;
  49059. y += coords[pi[q]][1] * m;
  49060. }
  49061. }
  49062. figureCoords[k] = coords.length;
  49063. coords.push([
  49064. x,
  49065. y
  49066. ]);
  49067. figureColors[k] = colors.length;
  49068. var newColor = new Uint8Array(3);
  49069. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  49070. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  49071. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  49072. colors.push(newColor);
  49073. }
  49074. }
  49075. figureCoords[0] = pi[0];
  49076. figureColors[0] = ci[0];
  49077. figureCoords[splitXBy] = pi[3];
  49078. figureColors[splitXBy] = ci[1];
  49079. figureCoords[verticesPerRow * splitYBy] = pi[12];
  49080. figureColors[verticesPerRow * splitYBy] = ci[2];
  49081. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  49082. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  49083. mesh.figures[index] = {
  49084. type: 'lattice',
  49085. coords: figureCoords,
  49086. colors: figureColors,
  49087. verticesPerRow: verticesPerRow
  49088. };
  49089. }
  49090. function decodeType6Shading(mesh, reader) {
  49091. var coords = mesh.coords;
  49092. var colors = mesh.colors;
  49093. var ps = new Int32Array(16);
  49094. var cs = new Int32Array(4);
  49095. while (reader.hasData) {
  49096. var f = reader.readFlag();
  49097. assert(0 <= f && f <= 3, 'Unknown type6 flag');
  49098. var i, ii;
  49099. var pi = coords.length;
  49100. for (i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  49101. coords.push(reader.readCoordinate());
  49102. }
  49103. var ci = colors.length;
  49104. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  49105. colors.push(reader.readComponents());
  49106. }
  49107. var tmp1, tmp2, tmp3, tmp4;
  49108. switch (f) {
  49109. case 0:
  49110. ps[12] = pi + 3;
  49111. ps[13] = pi + 4;
  49112. ps[14] = pi + 5;
  49113. ps[15] = pi + 6;
  49114. ps[8] = pi + 2;
  49115. ps[11] = pi + 7;
  49116. ps[4] = pi + 1;
  49117. ps[7] = pi + 8;
  49118. ps[0] = pi;
  49119. ps[1] = pi + 11;
  49120. ps[2] = pi + 10;
  49121. ps[3] = pi + 9;
  49122. cs[2] = ci + 1;
  49123. cs[3] = ci + 2;
  49124. cs[0] = ci;
  49125. cs[1] = ci + 3;
  49126. break;
  49127. case 1:
  49128. tmp1 = ps[12];
  49129. tmp2 = ps[13];
  49130. tmp3 = ps[14];
  49131. tmp4 = ps[15];
  49132. ps[12] = tmp4;
  49133. ps[13] = pi + 0;
  49134. ps[14] = pi + 1;
  49135. ps[15] = pi + 2;
  49136. ps[8] = tmp3;
  49137. ps[11] = pi + 3;
  49138. ps[4] = tmp2;
  49139. ps[7] = pi + 4;
  49140. ps[0] = tmp1;
  49141. ps[1] = pi + 7;
  49142. ps[2] = pi + 6;
  49143. ps[3] = pi + 5;
  49144. tmp1 = cs[2];
  49145. tmp2 = cs[3];
  49146. cs[2] = tmp2;
  49147. cs[3] = ci;
  49148. cs[0] = tmp1;
  49149. cs[1] = ci + 1;
  49150. break;
  49151. case 2:
  49152. tmp1 = ps[15];
  49153. tmp2 = ps[11];
  49154. ps[12] = ps[3];
  49155. ps[13] = pi + 0;
  49156. ps[14] = pi + 1;
  49157. ps[15] = pi + 2;
  49158. ps[8] = ps[7];
  49159. ps[11] = pi + 3;
  49160. ps[4] = tmp2;
  49161. ps[7] = pi + 4;
  49162. ps[0] = tmp1;
  49163. ps[1] = pi + 7;
  49164. ps[2] = pi + 6;
  49165. ps[3] = pi + 5;
  49166. tmp1 = cs[3];
  49167. cs[2] = cs[1];
  49168. cs[3] = ci;
  49169. cs[0] = tmp1;
  49170. cs[1] = ci + 1;
  49171. break;
  49172. case 3:
  49173. ps[12] = ps[0];
  49174. ps[13] = pi + 0;
  49175. ps[14] = pi + 1;
  49176. ps[15] = pi + 2;
  49177. ps[8] = ps[1];
  49178. ps[11] = pi + 3;
  49179. ps[4] = ps[2];
  49180. ps[7] = pi + 4;
  49181. ps[0] = ps[3];
  49182. ps[1] = pi + 7;
  49183. ps[2] = pi + 6;
  49184. ps[3] = pi + 5;
  49185. cs[2] = cs[0];
  49186. cs[3] = ci;
  49187. cs[0] = cs[1];
  49188. cs[1] = ci + 1;
  49189. break;
  49190. }
  49191. ps[5] = coords.length;
  49192. coords.push([
  49193. (-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,
  49194. (-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
  49195. ]);
  49196. ps[6] = coords.length;
  49197. coords.push([
  49198. (-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,
  49199. (-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
  49200. ]);
  49201. ps[9] = coords.length;
  49202. coords.push([
  49203. (-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,
  49204. (-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
  49205. ]);
  49206. ps[10] = coords.length;
  49207. coords.push([
  49208. (-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,
  49209. (-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
  49210. ]);
  49211. mesh.figures.push({
  49212. type: 'patch',
  49213. coords: new Int32Array(ps),
  49214. colors: new Int32Array(cs)
  49215. });
  49216. }
  49217. }
  49218. function decodeType7Shading(mesh, reader) {
  49219. var coords = mesh.coords;
  49220. var colors = mesh.colors;
  49221. var ps = new Int32Array(16);
  49222. var cs = new Int32Array(4);
  49223. while (reader.hasData) {
  49224. var f = reader.readFlag();
  49225. assert(0 <= f && f <= 3, 'Unknown type7 flag');
  49226. var i, ii;
  49227. var pi = coords.length;
  49228. for (i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  49229. coords.push(reader.readCoordinate());
  49230. }
  49231. var ci = colors.length;
  49232. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  49233. colors.push(reader.readComponents());
  49234. }
  49235. var tmp1, tmp2, tmp3, tmp4;
  49236. switch (f) {
  49237. case 0:
  49238. ps[12] = pi + 3;
  49239. ps[13] = pi + 4;
  49240. ps[14] = pi + 5;
  49241. ps[15] = pi + 6;
  49242. ps[8] = pi + 2;
  49243. ps[9] = pi + 13;
  49244. ps[10] = pi + 14;
  49245. ps[11] = pi + 7;
  49246. ps[4] = pi + 1;
  49247. ps[5] = pi + 12;
  49248. ps[6] = pi + 15;
  49249. ps[7] = pi + 8;
  49250. ps[0] = pi;
  49251. ps[1] = pi + 11;
  49252. ps[2] = pi + 10;
  49253. ps[3] = pi + 9;
  49254. cs[2] = ci + 1;
  49255. cs[3] = ci + 2;
  49256. cs[0] = ci;
  49257. cs[1] = ci + 3;
  49258. break;
  49259. case 1:
  49260. tmp1 = ps[12];
  49261. tmp2 = ps[13];
  49262. tmp3 = ps[14];
  49263. tmp4 = ps[15];
  49264. ps[12] = tmp4;
  49265. ps[13] = pi + 0;
  49266. ps[14] = pi + 1;
  49267. ps[15] = pi + 2;
  49268. ps[8] = tmp3;
  49269. ps[9] = pi + 9;
  49270. ps[10] = pi + 10;
  49271. ps[11] = pi + 3;
  49272. ps[4] = tmp2;
  49273. ps[5] = pi + 8;
  49274. ps[6] = pi + 11;
  49275. ps[7] = pi + 4;
  49276. ps[0] = tmp1;
  49277. ps[1] = pi + 7;
  49278. ps[2] = pi + 6;
  49279. ps[3] = pi + 5;
  49280. tmp1 = cs[2];
  49281. tmp2 = cs[3];
  49282. cs[2] = tmp2;
  49283. cs[3] = ci;
  49284. cs[0] = tmp1;
  49285. cs[1] = ci + 1;
  49286. break;
  49287. case 2:
  49288. tmp1 = ps[15];
  49289. tmp2 = ps[11];
  49290. ps[12] = ps[3];
  49291. ps[13] = pi + 0;
  49292. ps[14] = pi + 1;
  49293. ps[15] = pi + 2;
  49294. ps[8] = ps[7];
  49295. ps[9] = pi + 9;
  49296. ps[10] = pi + 10;
  49297. ps[11] = pi + 3;
  49298. ps[4] = tmp2;
  49299. ps[5] = pi + 8;
  49300. ps[6] = pi + 11;
  49301. ps[7] = pi + 4;
  49302. ps[0] = tmp1;
  49303. ps[1] = pi + 7;
  49304. ps[2] = pi + 6;
  49305. ps[3] = pi + 5;
  49306. tmp1 = cs[3];
  49307. cs[2] = cs[1];
  49308. cs[3] = ci;
  49309. cs[0] = tmp1;
  49310. cs[1] = ci + 1;
  49311. break;
  49312. case 3:
  49313. ps[12] = ps[0];
  49314. ps[13] = pi + 0;
  49315. ps[14] = pi + 1;
  49316. ps[15] = pi + 2;
  49317. ps[8] = ps[1];
  49318. ps[9] = pi + 9;
  49319. ps[10] = pi + 10;
  49320. ps[11] = pi + 3;
  49321. ps[4] = ps[2];
  49322. ps[5] = pi + 8;
  49323. ps[6] = pi + 11;
  49324. ps[7] = pi + 4;
  49325. ps[0] = ps[3];
  49326. ps[1] = pi + 7;
  49327. ps[2] = pi + 6;
  49328. ps[3] = pi + 5;
  49329. cs[2] = cs[0];
  49330. cs[3] = ci;
  49331. cs[0] = cs[1];
  49332. cs[1] = ci + 1;
  49333. break;
  49334. }
  49335. mesh.figures.push({
  49336. type: 'patch',
  49337. coords: new Int32Array(ps),
  49338. colors: new Int32Array(cs)
  49339. });
  49340. }
  49341. }
  49342. function updateBounds(mesh) {
  49343. var minX = mesh.coords[0][0], minY = mesh.coords[0][1], maxX = minX, maxY = minY;
  49344. for (var i = 1, ii = mesh.coords.length; i < ii; i++) {
  49345. var x = mesh.coords[i][0], y = mesh.coords[i][1];
  49346. minX = minX > x ? x : minX;
  49347. minY = minY > y ? y : minY;
  49348. maxX = maxX < x ? x : maxX;
  49349. maxY = maxY < y ? y : maxY;
  49350. }
  49351. mesh.bounds = [
  49352. minX,
  49353. minY,
  49354. maxX,
  49355. maxY
  49356. ];
  49357. }
  49358. function packData(mesh) {
  49359. var i, ii, j, jj;
  49360. var coords = mesh.coords;
  49361. var coordsPacked = new Float32Array(coords.length * 2);
  49362. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  49363. var xy = coords[i];
  49364. coordsPacked[j++] = xy[0];
  49365. coordsPacked[j++] = xy[1];
  49366. }
  49367. mesh.coords = coordsPacked;
  49368. var colors = mesh.colors;
  49369. var colorsPacked = new Uint8Array(colors.length * 3);
  49370. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  49371. var c = colors[i];
  49372. colorsPacked[j++] = c[0];
  49373. colorsPacked[j++] = c[1];
  49374. colorsPacked[j++] = c[2];
  49375. }
  49376. mesh.colors = colorsPacked;
  49377. var figures = mesh.figures;
  49378. for (i = 0, ii = figures.length; i < ii; i++) {
  49379. var figure = figures[i], ps = figure.coords, cs = figure.colors;
  49380. for (j = 0, jj = ps.length; j < jj; j++) {
  49381. ps[j] *= 2;
  49382. cs[j] *= 3;
  49383. }
  49384. }
  49385. }
  49386. function Mesh(stream, matrix, xref, res) {
  49387. assert(isStream(stream), 'Mesh data is not a stream');
  49388. var dict = stream.dict;
  49389. this.matrix = matrix;
  49390. this.shadingType = dict.get('ShadingType');
  49391. this.type = 'Pattern';
  49392. this.bbox = dict.getArray('BBox');
  49393. var cs = dict.get('ColorSpace', 'CS');
  49394. cs = ColorSpace.parse(cs, xref, res);
  49395. this.cs = cs;
  49396. this.background = dict.has('Background') ? cs.getRgb(dict.get('Background'), 0) : null;
  49397. var fnObj = dict.get('Function');
  49398. var fn = fnObj ? PDFFunction.parseArray(xref, fnObj) : null;
  49399. this.coords = [];
  49400. this.colors = [];
  49401. this.figures = [];
  49402. var decodeContext = {
  49403. bitsPerCoordinate: dict.get('BitsPerCoordinate'),
  49404. bitsPerComponent: dict.get('BitsPerComponent'),
  49405. bitsPerFlag: dict.get('BitsPerFlag'),
  49406. decode: dict.getArray('Decode'),
  49407. colorFn: fn,
  49408. colorSpace: cs,
  49409. numComps: fn ? 1 : cs.numComps
  49410. };
  49411. var reader = new MeshStreamReader(stream, decodeContext);
  49412. var patchMesh = false;
  49413. switch (this.shadingType) {
  49414. case ShadingType.FREE_FORM_MESH:
  49415. decodeType4Shading(this, reader);
  49416. break;
  49417. case ShadingType.LATTICE_FORM_MESH:
  49418. var verticesPerRow = dict.get('VerticesPerRow') | 0;
  49419. assert(verticesPerRow >= 2, 'Invalid VerticesPerRow');
  49420. decodeType5Shading(this, reader, verticesPerRow);
  49421. break;
  49422. case ShadingType.COONS_PATCH_MESH:
  49423. decodeType6Shading(this, reader);
  49424. patchMesh = true;
  49425. break;
  49426. case ShadingType.TENSOR_PATCH_MESH:
  49427. decodeType7Shading(this, reader);
  49428. patchMesh = true;
  49429. break;
  49430. default:
  49431. error('Unsupported mesh type.');
  49432. break;
  49433. }
  49434. if (patchMesh) {
  49435. updateBounds(this);
  49436. for (var i = 0, ii = this.figures.length; i < ii; i++) {
  49437. buildFigureFromPatch(this, i);
  49438. }
  49439. }
  49440. updateBounds(this);
  49441. packData(this);
  49442. }
  49443. Mesh.prototype = {
  49444. getIR: function Mesh_getIR() {
  49445. return [
  49446. 'Mesh',
  49447. this.shadingType,
  49448. this.coords,
  49449. this.colors,
  49450. this.figures,
  49451. this.bounds,
  49452. this.matrix,
  49453. this.bbox,
  49454. this.background
  49455. ];
  49456. }
  49457. };
  49458. return Mesh;
  49459. }();
  49460. Shadings.Dummy = function DummyClosure() {
  49461. function Dummy() {
  49462. this.type = 'Pattern';
  49463. }
  49464. Dummy.prototype = {
  49465. getIR: function Dummy_getIR() {
  49466. return ['Dummy'];
  49467. }
  49468. };
  49469. return Dummy;
  49470. }();
  49471. function getTilingPatternIR(operatorList, dict, args) {
  49472. var matrix = dict.getArray('Matrix');
  49473. var bbox = dict.getArray('BBox');
  49474. var xstep = dict.get('XStep');
  49475. var ystep = dict.get('YStep');
  49476. var paintType = dict.get('PaintType');
  49477. var tilingType = dict.get('TilingType');
  49478. return [
  49479. 'TilingPattern',
  49480. args,
  49481. operatorList,
  49482. matrix,
  49483. bbox,
  49484. xstep,
  49485. ystep,
  49486. paintType,
  49487. tilingType
  49488. ];
  49489. }
  49490. exports.Pattern = Pattern;
  49491. exports.getTilingPatternIR = getTilingPatternIR;
  49492. /***/ }),
  49493. /* 34 */
  49494. /***/ (function(module, exports, __w_pdfjs_require__) {
  49495. "use strict";
  49496. var sharedUtil = __w_pdfjs_require__(0);
  49497. var coreStream = __w_pdfjs_require__(2);
  49498. var coreChunkedStream = __w_pdfjs_require__(11);
  49499. var coreDocument = __w_pdfjs_require__(25);
  49500. var warn = sharedUtil.warn;
  49501. var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
  49502. var shadow = sharedUtil.shadow;
  49503. var NotImplementedException = sharedUtil.NotImplementedException;
  49504. var MissingDataException = sharedUtil.MissingDataException;
  49505. var createPromiseCapability = sharedUtil.createPromiseCapability;
  49506. var Util = sharedUtil.Util;
  49507. var Stream = coreStream.Stream;
  49508. var ChunkedStreamManager = coreChunkedStream.ChunkedStreamManager;
  49509. var PDFDocument = coreDocument.PDFDocument;
  49510. var BasePdfManager = function BasePdfManagerClosure() {
  49511. function BasePdfManager() {
  49512. throw new Error('Cannot initialize BaseManagerManager');
  49513. }
  49514. BasePdfManager.prototype = {
  49515. get docId() {
  49516. return this._docId;
  49517. },
  49518. get password() {
  49519. return this._password;
  49520. },
  49521. get docBaseUrl() {
  49522. var docBaseUrl = null;
  49523. if (this._docBaseUrl) {
  49524. var absoluteUrl = createValidAbsoluteUrl(this._docBaseUrl);
  49525. if (absoluteUrl) {
  49526. docBaseUrl = absoluteUrl.href;
  49527. } else {
  49528. warn('Invalid absolute docBaseUrl: "' + this._docBaseUrl + '".');
  49529. }
  49530. }
  49531. return shadow(this, 'docBaseUrl', docBaseUrl);
  49532. },
  49533. onLoadedStream: function BasePdfManager_onLoadedStream() {
  49534. throw new NotImplementedException();
  49535. },
  49536. ensureDoc: function BasePdfManager_ensureDoc(prop, args) {
  49537. return this.ensure(this.pdfDocument, prop, args);
  49538. },
  49539. ensureXRef: function BasePdfManager_ensureXRef(prop, args) {
  49540. return this.ensure(this.pdfDocument.xref, prop, args);
  49541. },
  49542. ensureCatalog: function BasePdfManager_ensureCatalog(prop, args) {
  49543. return this.ensure(this.pdfDocument.catalog, prop, args);
  49544. },
  49545. getPage: function BasePdfManager_getPage(pageIndex) {
  49546. return this.pdfDocument.getPage(pageIndex);
  49547. },
  49548. cleanup: function BasePdfManager_cleanup() {
  49549. return this.pdfDocument.cleanup();
  49550. },
  49551. ensure: function BasePdfManager_ensure(obj, prop, args) {
  49552. return new NotImplementedException();
  49553. },
  49554. requestRange: function BasePdfManager_requestRange(begin, end) {
  49555. return new NotImplementedException();
  49556. },
  49557. requestLoadedStream: function BasePdfManager_requestLoadedStream() {
  49558. return new NotImplementedException();
  49559. },
  49560. sendProgressiveData: function BasePdfManager_sendProgressiveData(chunk) {
  49561. return new NotImplementedException();
  49562. },
  49563. updatePassword: function BasePdfManager_updatePassword(password) {
  49564. this._password = password;
  49565. },
  49566. terminate: function BasePdfManager_terminate() {
  49567. return new NotImplementedException();
  49568. }
  49569. };
  49570. return BasePdfManager;
  49571. }();
  49572. var LocalPdfManager = function LocalPdfManagerClosure() {
  49573. function LocalPdfManager(docId, data, password, evaluatorOptions, docBaseUrl) {
  49574. this._docId = docId;
  49575. this._password = password;
  49576. this._docBaseUrl = docBaseUrl;
  49577. this.evaluatorOptions = evaluatorOptions;
  49578. var stream = new Stream(data);
  49579. this.pdfDocument = new PDFDocument(this, stream);
  49580. this._loadedStreamCapability = createPromiseCapability();
  49581. this._loadedStreamCapability.resolve(stream);
  49582. }
  49583. Util.inherit(LocalPdfManager, BasePdfManager, {
  49584. ensure: function LocalPdfManager_ensure(obj, prop, args) {
  49585. return new Promise(function (resolve, reject) {
  49586. try {
  49587. var value = obj[prop];
  49588. var result;
  49589. if (typeof value === 'function') {
  49590. result = value.apply(obj, args);
  49591. } else {
  49592. result = value;
  49593. }
  49594. resolve(result);
  49595. } catch (e) {
  49596. reject(e);
  49597. }
  49598. });
  49599. },
  49600. requestRange: function LocalPdfManager_requestRange(begin, end) {
  49601. return Promise.resolve();
  49602. },
  49603. requestLoadedStream: function LocalPdfManager_requestLoadedStream() {
  49604. },
  49605. onLoadedStream: function LocalPdfManager_onLoadedStream() {
  49606. return this._loadedStreamCapability.promise;
  49607. },
  49608. terminate: function LocalPdfManager_terminate() {
  49609. }
  49610. });
  49611. return LocalPdfManager;
  49612. }();
  49613. var NetworkPdfManager = function NetworkPdfManagerClosure() {
  49614. function NetworkPdfManager(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {
  49615. this._docId = docId;
  49616. this._password = args.password;
  49617. this._docBaseUrl = docBaseUrl;
  49618. this.msgHandler = args.msgHandler;
  49619. this.evaluatorOptions = evaluatorOptions;
  49620. var params = {
  49621. msgHandler: args.msgHandler,
  49622. url: args.url,
  49623. length: args.length,
  49624. disableAutoFetch: args.disableAutoFetch,
  49625. rangeChunkSize: args.rangeChunkSize
  49626. };
  49627. this.streamManager = new ChunkedStreamManager(pdfNetworkStream, params);
  49628. this.pdfDocument = new PDFDocument(this, this.streamManager.getStream());
  49629. }
  49630. Util.inherit(NetworkPdfManager, BasePdfManager, {
  49631. ensure: function NetworkPdfManager_ensure(obj, prop, args) {
  49632. var pdfManager = this;
  49633. return new Promise(function (resolve, reject) {
  49634. function ensureHelper() {
  49635. try {
  49636. var result;
  49637. var value = obj[prop];
  49638. if (typeof value === 'function') {
  49639. result = value.apply(obj, args);
  49640. } else {
  49641. result = value;
  49642. }
  49643. resolve(result);
  49644. } catch (e) {
  49645. if (!(e instanceof MissingDataException)) {
  49646. reject(e);
  49647. return;
  49648. }
  49649. pdfManager.streamManager.requestRange(e.begin, e.end).then(ensureHelper, reject);
  49650. }
  49651. }
  49652. ensureHelper();
  49653. });
  49654. },
  49655. requestRange: function NetworkPdfManager_requestRange(begin, end) {
  49656. return this.streamManager.requestRange(begin, end);
  49657. },
  49658. requestLoadedStream: function NetworkPdfManager_requestLoadedStream() {
  49659. this.streamManager.requestAllChunks();
  49660. },
  49661. sendProgressiveData: function NetworkPdfManager_sendProgressiveData(chunk) {
  49662. this.streamManager.onReceiveData({ chunk: chunk });
  49663. },
  49664. onLoadedStream: function NetworkPdfManager_onLoadedStream() {
  49665. return this.streamManager.onLoadedStream();
  49666. },
  49667. terminate: function NetworkPdfManager_terminate() {
  49668. this.streamManager.abort();
  49669. }
  49670. });
  49671. return NetworkPdfManager;
  49672. }();
  49673. exports.LocalPdfManager = LocalPdfManager;
  49674. exports.NetworkPdfManager = NetworkPdfManager;
  49675. /***/ }),
  49676. /* 35 */
  49677. /***/ (function(module, exports, __w_pdfjs_require__) {
  49678. "use strict";
  49679. var sharedUtil = __w_pdfjs_require__(0);
  49680. var corePrimitives = __w_pdfjs_require__(1);
  49681. var error = sharedUtil.error;
  49682. var isSpace = sharedUtil.isSpace;
  49683. var EOF = corePrimitives.EOF;
  49684. var PostScriptParser = function PostScriptParserClosure() {
  49685. function PostScriptParser(lexer) {
  49686. this.lexer = lexer;
  49687. this.operators = [];
  49688. this.token = null;
  49689. this.prev = null;
  49690. }
  49691. PostScriptParser.prototype = {
  49692. nextToken: function PostScriptParser_nextToken() {
  49693. this.prev = this.token;
  49694. this.token = this.lexer.getToken();
  49695. },
  49696. accept: function PostScriptParser_accept(type) {
  49697. if (this.token.type === type) {
  49698. this.nextToken();
  49699. return true;
  49700. }
  49701. return false;
  49702. },
  49703. expect: function PostScriptParser_expect(type) {
  49704. if (this.accept(type)) {
  49705. return true;
  49706. }
  49707. error('Unexpected symbol: found ' + this.token.type + ' expected ' + type + '.');
  49708. },
  49709. parse: function PostScriptParser_parse() {
  49710. this.nextToken();
  49711. this.expect(PostScriptTokenTypes.LBRACE);
  49712. this.parseBlock();
  49713. this.expect(PostScriptTokenTypes.RBRACE);
  49714. return this.operators;
  49715. },
  49716. parseBlock: function PostScriptParser_parseBlock() {
  49717. while (true) {
  49718. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  49719. this.operators.push(this.prev.value);
  49720. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  49721. this.operators.push(this.prev.value);
  49722. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  49723. this.parseCondition();
  49724. } else {
  49725. return;
  49726. }
  49727. }
  49728. },
  49729. parseCondition: function PostScriptParser_parseCondition() {
  49730. var conditionLocation = this.operators.length;
  49731. this.operators.push(null, null);
  49732. this.parseBlock();
  49733. this.expect(PostScriptTokenTypes.RBRACE);
  49734. if (this.accept(PostScriptTokenTypes.IF)) {
  49735. this.operators[conditionLocation] = this.operators.length;
  49736. this.operators[conditionLocation + 1] = 'jz';
  49737. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  49738. var jumpLocation = this.operators.length;
  49739. this.operators.push(null, null);
  49740. var endOfTrue = this.operators.length;
  49741. this.parseBlock();
  49742. this.expect(PostScriptTokenTypes.RBRACE);
  49743. this.expect(PostScriptTokenTypes.IFELSE);
  49744. this.operators[jumpLocation] = this.operators.length;
  49745. this.operators[jumpLocation + 1] = 'j';
  49746. this.operators[conditionLocation] = endOfTrue;
  49747. this.operators[conditionLocation + 1] = 'jz';
  49748. } else {
  49749. error('PS Function: error parsing conditional.');
  49750. }
  49751. }
  49752. };
  49753. return PostScriptParser;
  49754. }();
  49755. var PostScriptTokenTypes = {
  49756. LBRACE: 0,
  49757. RBRACE: 1,
  49758. NUMBER: 2,
  49759. OPERATOR: 3,
  49760. IF: 4,
  49761. IFELSE: 5
  49762. };
  49763. var PostScriptToken = function PostScriptTokenClosure() {
  49764. function PostScriptToken(type, value) {
  49765. this.type = type;
  49766. this.value = value;
  49767. }
  49768. var opCache = Object.create(null);
  49769. PostScriptToken.getOperator = function PostScriptToken_getOperator(op) {
  49770. var opValue = opCache[op];
  49771. if (opValue) {
  49772. return opValue;
  49773. }
  49774. return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  49775. };
  49776. PostScriptToken.LBRACE = new PostScriptToken(PostScriptTokenTypes.LBRACE, '{');
  49777. PostScriptToken.RBRACE = new PostScriptToken(PostScriptTokenTypes.RBRACE, '}');
  49778. PostScriptToken.IF = new PostScriptToken(PostScriptTokenTypes.IF, 'IF');
  49779. PostScriptToken.IFELSE = new PostScriptToken(PostScriptTokenTypes.IFELSE, 'IFELSE');
  49780. return PostScriptToken;
  49781. }();
  49782. var PostScriptLexer = function PostScriptLexerClosure() {
  49783. function PostScriptLexer(stream) {
  49784. this.stream = stream;
  49785. this.nextChar();
  49786. this.strBuf = [];
  49787. }
  49788. PostScriptLexer.prototype = {
  49789. nextChar: function PostScriptLexer_nextChar() {
  49790. return this.currentChar = this.stream.getByte();
  49791. },
  49792. getToken: function PostScriptLexer_getToken() {
  49793. var comment = false;
  49794. var ch = this.currentChar;
  49795. while (true) {
  49796. if (ch < 0) {
  49797. return EOF;
  49798. }
  49799. if (comment) {
  49800. if (ch === 0x0A || ch === 0x0D) {
  49801. comment = false;
  49802. }
  49803. } else if (ch === 0x25) {
  49804. comment = true;
  49805. } else if (!isSpace(ch)) {
  49806. break;
  49807. }
  49808. ch = this.nextChar();
  49809. }
  49810. switch (ch | 0) {
  49811. case 0x30:
  49812. case 0x31:
  49813. case 0x32:
  49814. case 0x33:
  49815. case 0x34:
  49816. case 0x35:
  49817. case 0x36:
  49818. case 0x37:
  49819. case 0x38:
  49820. case 0x39:
  49821. case 0x2B:
  49822. case 0x2D:
  49823. case 0x2E:
  49824. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  49825. case 0x7B:
  49826. this.nextChar();
  49827. return PostScriptToken.LBRACE;
  49828. case 0x7D:
  49829. this.nextChar();
  49830. return PostScriptToken.RBRACE;
  49831. }
  49832. var strBuf = this.strBuf;
  49833. strBuf.length = 0;
  49834. strBuf[0] = String.fromCharCode(ch);
  49835. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5A || ch >= 0x61 && ch <= 0x7A)) {
  49836. strBuf.push(String.fromCharCode(ch));
  49837. }
  49838. var str = strBuf.join('');
  49839. switch (str.toLowerCase()) {
  49840. case 'if':
  49841. return PostScriptToken.IF;
  49842. case 'ifelse':
  49843. return PostScriptToken.IFELSE;
  49844. default:
  49845. return PostScriptToken.getOperator(str);
  49846. }
  49847. },
  49848. getNumber: function PostScriptLexer_getNumber() {
  49849. var ch = this.currentChar;
  49850. var strBuf = this.strBuf;
  49851. strBuf.length = 0;
  49852. strBuf[0] = String.fromCharCode(ch);
  49853. while ((ch = this.nextChar()) >= 0) {
  49854. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2D || ch === 0x2E) {
  49855. strBuf.push(String.fromCharCode(ch));
  49856. } else {
  49857. break;
  49858. }
  49859. }
  49860. var value = parseFloat(strBuf.join(''));
  49861. if (isNaN(value)) {
  49862. error('Invalid floating point number: ' + value);
  49863. }
  49864. return value;
  49865. }
  49866. };
  49867. return PostScriptLexer;
  49868. }();
  49869. exports.PostScriptLexer = PostScriptLexer;
  49870. exports.PostScriptParser = PostScriptParser;
  49871. /***/ }),
  49872. /* 36 */
  49873. /***/ (function(module, exports, __w_pdfjs_require__) {
  49874. "use strict";
  49875. var sharedUtil = __w_pdfjs_require__(0);
  49876. var coreStream = __w_pdfjs_require__(2);
  49877. var coreEncodings = __w_pdfjs_require__(4);
  49878. var warn = sharedUtil.warn;
  49879. var isSpace = sharedUtil.isSpace;
  49880. var Stream = coreStream.Stream;
  49881. var getEncoding = coreEncodings.getEncoding;
  49882. var HINTING_ENABLED = false;
  49883. var Type1CharString = function Type1CharStringClosure() {
  49884. var COMMAND_MAP = {
  49885. 'hstem': [1],
  49886. 'vstem': [3],
  49887. 'vmoveto': [4],
  49888. 'rlineto': [5],
  49889. 'hlineto': [6],
  49890. 'vlineto': [7],
  49891. 'rrcurveto': [8],
  49892. 'callsubr': [10],
  49893. 'flex': [
  49894. 12,
  49895. 35
  49896. ],
  49897. 'drop': [
  49898. 12,
  49899. 18
  49900. ],
  49901. 'endchar': [14],
  49902. 'rmoveto': [21],
  49903. 'hmoveto': [22],
  49904. 'vhcurveto': [30],
  49905. 'hvcurveto': [31]
  49906. };
  49907. function Type1CharString() {
  49908. this.width = 0;
  49909. this.lsb = 0;
  49910. this.flexing = false;
  49911. this.output = [];
  49912. this.stack = [];
  49913. }
  49914. Type1CharString.prototype = {
  49915. convert: function Type1CharString_convert(encoded, subrs, seacAnalysisEnabled) {
  49916. var count = encoded.length;
  49917. var error = false;
  49918. var wx, sbx, subrNumber;
  49919. for (var i = 0; i < count; i++) {
  49920. var value = encoded[i];
  49921. if (value < 32) {
  49922. if (value === 12) {
  49923. value = (value << 8) + encoded[++i];
  49924. }
  49925. switch (value) {
  49926. case 1:
  49927. if (!HINTING_ENABLED) {
  49928. this.stack = [];
  49929. break;
  49930. }
  49931. error = this.executeCommand(2, COMMAND_MAP.hstem);
  49932. break;
  49933. case 3:
  49934. if (!HINTING_ENABLED) {
  49935. this.stack = [];
  49936. break;
  49937. }
  49938. error = this.executeCommand(2, COMMAND_MAP.vstem);
  49939. break;
  49940. case 4:
  49941. if (this.flexing) {
  49942. if (this.stack.length < 1) {
  49943. error = true;
  49944. break;
  49945. }
  49946. var dy = this.stack.pop();
  49947. this.stack.push(0, dy);
  49948. break;
  49949. }
  49950. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  49951. break;
  49952. case 5:
  49953. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  49954. break;
  49955. case 6:
  49956. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  49957. break;
  49958. case 7:
  49959. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  49960. break;
  49961. case 8:
  49962. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  49963. break;
  49964. case 9:
  49965. this.stack = [];
  49966. break;
  49967. case 10:
  49968. if (this.stack.length < 1) {
  49969. error = true;
  49970. break;
  49971. }
  49972. subrNumber = this.stack.pop();
  49973. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  49974. break;
  49975. case 11:
  49976. return error;
  49977. case 13:
  49978. if (this.stack.length < 2) {
  49979. error = true;
  49980. break;
  49981. }
  49982. wx = this.stack.pop();
  49983. sbx = this.stack.pop();
  49984. this.lsb = sbx;
  49985. this.width = wx;
  49986. this.stack.push(wx, sbx);
  49987. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  49988. break;
  49989. case 14:
  49990. this.output.push(COMMAND_MAP.endchar[0]);
  49991. break;
  49992. case 21:
  49993. if (this.flexing) {
  49994. break;
  49995. }
  49996. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  49997. break;
  49998. case 22:
  49999. if (this.flexing) {
  50000. this.stack.push(0);
  50001. break;
  50002. }
  50003. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  50004. break;
  50005. case 30:
  50006. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  50007. break;
  50008. case 31:
  50009. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  50010. break;
  50011. case (12 << 8) + 0:
  50012. this.stack = [];
  50013. break;
  50014. case (12 << 8) + 1:
  50015. if (!HINTING_ENABLED) {
  50016. this.stack = [];
  50017. break;
  50018. }
  50019. error = this.executeCommand(2, COMMAND_MAP.vstem);
  50020. break;
  50021. case (12 << 8) + 2:
  50022. if (!HINTING_ENABLED) {
  50023. this.stack = [];
  50024. break;
  50025. }
  50026. error = this.executeCommand(2, COMMAND_MAP.hstem);
  50027. break;
  50028. case (12 << 8) + 6:
  50029. if (seacAnalysisEnabled) {
  50030. this.seac = this.stack.splice(-4, 4);
  50031. error = this.executeCommand(0, COMMAND_MAP.endchar);
  50032. } else {
  50033. error = this.executeCommand(4, COMMAND_MAP.endchar);
  50034. }
  50035. break;
  50036. case (12 << 8) + 7:
  50037. if (this.stack.length < 4) {
  50038. error = true;
  50039. break;
  50040. }
  50041. this.stack.pop();
  50042. wx = this.stack.pop();
  50043. var sby = this.stack.pop();
  50044. sbx = this.stack.pop();
  50045. this.lsb = sbx;
  50046. this.width = wx;
  50047. this.stack.push(wx, sbx, sby);
  50048. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  50049. break;
  50050. case (12 << 8) + 12:
  50051. if (this.stack.length < 2) {
  50052. error = true;
  50053. break;
  50054. }
  50055. var num2 = this.stack.pop();
  50056. var num1 = this.stack.pop();
  50057. this.stack.push(num1 / num2);
  50058. break;
  50059. case (12 << 8) + 16:
  50060. if (this.stack.length < 2) {
  50061. error = true;
  50062. break;
  50063. }
  50064. subrNumber = this.stack.pop();
  50065. var numArgs = this.stack.pop();
  50066. if (subrNumber === 0 && numArgs === 3) {
  50067. var flexArgs = this.stack.splice(this.stack.length - 17, 17);
  50068. 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]);
  50069. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  50070. this.flexing = false;
  50071. this.stack.push(flexArgs[15], flexArgs[16]);
  50072. } else if (subrNumber === 1 && numArgs === 0) {
  50073. this.flexing = true;
  50074. }
  50075. break;
  50076. case (12 << 8) + 17:
  50077. break;
  50078. case (12 << 8) + 33:
  50079. this.stack = [];
  50080. break;
  50081. default:
  50082. warn('Unknown type 1 charstring command of "' + value + '"');
  50083. break;
  50084. }
  50085. if (error) {
  50086. break;
  50087. }
  50088. continue;
  50089. } else if (value <= 246) {
  50090. value = value - 139;
  50091. } else if (value <= 250) {
  50092. value = (value - 247) * 256 + encoded[++i] + 108;
  50093. } else if (value <= 254) {
  50094. value = -((value - 251) * 256) - encoded[++i] - 108;
  50095. } else {
  50096. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  50097. }
  50098. this.stack.push(value);
  50099. }
  50100. return error;
  50101. },
  50102. executeCommand: function (howManyArgs, command, keepStack) {
  50103. var stackLength = this.stack.length;
  50104. if (howManyArgs > stackLength) {
  50105. return true;
  50106. }
  50107. var start = stackLength - howManyArgs;
  50108. for (var i = start; i < stackLength; i++) {
  50109. var value = this.stack[i];
  50110. if (value === (value | 0)) {
  50111. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  50112. } else {
  50113. value = 65536 * value | 0;
  50114. this.output.push(255, value >> 24 & 0xFF, value >> 16 & 0xFF, value >> 8 & 0xFF, value & 0xFF);
  50115. }
  50116. }
  50117. this.output.push.apply(this.output, command);
  50118. if (keepStack) {
  50119. this.stack.splice(start, howManyArgs);
  50120. } else {
  50121. this.stack.length = 0;
  50122. }
  50123. return false;
  50124. }
  50125. };
  50126. return Type1CharString;
  50127. }();
  50128. var Type1Parser = function Type1ParserClosure() {
  50129. var EEXEC_ENCRYPT_KEY = 55665;
  50130. var CHAR_STRS_ENCRYPT_KEY = 4330;
  50131. function isHexDigit(code) {
  50132. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  50133. }
  50134. function decrypt(data, key, discardNumber) {
  50135. if (discardNumber >= data.length) {
  50136. return new Uint8Array(0);
  50137. }
  50138. var r = key | 0, c1 = 52845, c2 = 22719, i, j;
  50139. for (i = 0; i < discardNumber; i++) {
  50140. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  50141. }
  50142. var count = data.length - discardNumber;
  50143. var decrypted = new Uint8Array(count);
  50144. for (i = discardNumber, j = 0; j < count; i++, j++) {
  50145. var value = data[i];
  50146. decrypted[j] = value ^ r >> 8;
  50147. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  50148. }
  50149. return decrypted;
  50150. }
  50151. function decryptAscii(data, key, discardNumber) {
  50152. var r = key | 0, c1 = 52845, c2 = 22719;
  50153. var count = data.length, maybeLength = count >>> 1;
  50154. var decrypted = new Uint8Array(maybeLength);
  50155. var i, j;
  50156. for (i = 0, j = 0; i < count; i++) {
  50157. var digit1 = data[i];
  50158. if (!isHexDigit(digit1)) {
  50159. continue;
  50160. }
  50161. i++;
  50162. var digit2;
  50163. while (i < count && !isHexDigit(digit2 = data[i])) {
  50164. i++;
  50165. }
  50166. if (i < count) {
  50167. var value = parseInt(String.fromCharCode(digit1, digit2), 16);
  50168. decrypted[j++] = value ^ r >> 8;
  50169. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  50170. }
  50171. }
  50172. return Array.prototype.slice.call(decrypted, discardNumber, j);
  50173. }
  50174. function isSpecial(c) {
  50175. return c === 0x2F || c === 0x5B || c === 0x5D || c === 0x7B || c === 0x7D || c === 0x28 || c === 0x29;
  50176. }
  50177. function Type1Parser(stream, encrypted, seacAnalysisEnabled) {
  50178. if (encrypted) {
  50179. var data = stream.getBytes();
  50180. var isBinary = !(isHexDigit(data[0]) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]));
  50181. stream = new Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  50182. }
  50183. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  50184. this.stream = stream;
  50185. this.nextChar();
  50186. }
  50187. Type1Parser.prototype = {
  50188. readNumberArray: function Type1Parser_readNumberArray() {
  50189. this.getToken();
  50190. var array = [];
  50191. while (true) {
  50192. var token = this.getToken();
  50193. if (token === null || token === ']' || token === '}') {
  50194. break;
  50195. }
  50196. array.push(parseFloat(token || 0));
  50197. }
  50198. return array;
  50199. },
  50200. readNumber: function Type1Parser_readNumber() {
  50201. var token = this.getToken();
  50202. return parseFloat(token || 0);
  50203. },
  50204. readInt: function Type1Parser_readInt() {
  50205. var token = this.getToken();
  50206. return parseInt(token || 0, 10) | 0;
  50207. },
  50208. readBoolean: function Type1Parser_readBoolean() {
  50209. var token = this.getToken();
  50210. return token === 'true' ? 1 : 0;
  50211. },
  50212. nextChar: function Type1_nextChar() {
  50213. return this.currentChar = this.stream.getByte();
  50214. },
  50215. getToken: function Type1Parser_getToken() {
  50216. var comment = false;
  50217. var ch = this.currentChar;
  50218. while (true) {
  50219. if (ch === -1) {
  50220. return null;
  50221. }
  50222. if (comment) {
  50223. if (ch === 0x0A || ch === 0x0D) {
  50224. comment = false;
  50225. }
  50226. } else if (ch === 0x25) {
  50227. comment = true;
  50228. } else if (!isSpace(ch)) {
  50229. break;
  50230. }
  50231. ch = this.nextChar();
  50232. }
  50233. if (isSpecial(ch)) {
  50234. this.nextChar();
  50235. return String.fromCharCode(ch);
  50236. }
  50237. var token = '';
  50238. do {
  50239. token += String.fromCharCode(ch);
  50240. ch = this.nextChar();
  50241. } while (ch >= 0 && !isSpace(ch) && !isSpecial(ch));
  50242. return token;
  50243. },
  50244. extractFontProgram: function Type1Parser_extractFontProgram() {
  50245. var stream = this.stream;
  50246. var subrs = [], charstrings = [];
  50247. var privateData = Object.create(null);
  50248. privateData['lenIV'] = 4;
  50249. var program = {
  50250. subrs: [],
  50251. charstrings: [],
  50252. properties: { 'privateData': privateData }
  50253. };
  50254. var token, length, data, lenIV, encoded;
  50255. while ((token = this.getToken()) !== null) {
  50256. if (token !== '/') {
  50257. continue;
  50258. }
  50259. token = this.getToken();
  50260. switch (token) {
  50261. case 'CharStrings':
  50262. this.getToken();
  50263. this.getToken();
  50264. this.getToken();
  50265. this.getToken();
  50266. while (true) {
  50267. token = this.getToken();
  50268. if (token === null || token === 'end') {
  50269. break;
  50270. }
  50271. if (token !== '/') {
  50272. continue;
  50273. }
  50274. var glyph = this.getToken();
  50275. length = this.readInt();
  50276. this.getToken();
  50277. data = stream.makeSubStream(stream.pos, length);
  50278. lenIV = program.properties.privateData['lenIV'];
  50279. encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV);
  50280. stream.skip(length);
  50281. this.nextChar();
  50282. token = this.getToken();
  50283. if (token === 'noaccess') {
  50284. this.getToken();
  50285. }
  50286. charstrings.push({
  50287. glyph: glyph,
  50288. encoded: encoded
  50289. });
  50290. }
  50291. break;
  50292. case 'Subrs':
  50293. this.readInt();
  50294. this.getToken();
  50295. while ((token = this.getToken()) === 'dup') {
  50296. var index = this.readInt();
  50297. length = this.readInt();
  50298. this.getToken();
  50299. data = stream.makeSubStream(stream.pos, length);
  50300. lenIV = program.properties.privateData['lenIV'];
  50301. encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV);
  50302. stream.skip(length);
  50303. this.nextChar();
  50304. token = this.getToken();
  50305. if (token === 'noaccess') {
  50306. this.getToken();
  50307. }
  50308. subrs[index] = encoded;
  50309. }
  50310. break;
  50311. case 'BlueValues':
  50312. case 'OtherBlues':
  50313. case 'FamilyBlues':
  50314. case 'FamilyOtherBlues':
  50315. var blueArray = this.readNumberArray();
  50316. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  50317. program.properties.privateData[token] = blueArray;
  50318. }
  50319. break;
  50320. case 'StemSnapH':
  50321. case 'StemSnapV':
  50322. program.properties.privateData[token] = this.readNumberArray();
  50323. break;
  50324. case 'StdHW':
  50325. case 'StdVW':
  50326. program.properties.privateData[token] = this.readNumberArray()[0];
  50327. break;
  50328. case 'BlueShift':
  50329. case 'lenIV':
  50330. case 'BlueFuzz':
  50331. case 'BlueScale':
  50332. case 'LanguageGroup':
  50333. case 'ExpansionFactor':
  50334. program.properties.privateData[token] = this.readNumber();
  50335. break;
  50336. case 'ForceBold':
  50337. program.properties.privateData[token] = this.readBoolean();
  50338. break;
  50339. }
  50340. }
  50341. for (var i = 0; i < charstrings.length; i++) {
  50342. glyph = charstrings[i].glyph;
  50343. encoded = charstrings[i].encoded;
  50344. var charString = new Type1CharString();
  50345. var error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  50346. var output = charString.output;
  50347. if (error) {
  50348. output = [14];
  50349. }
  50350. program.charstrings.push({
  50351. glyphName: glyph,
  50352. charstring: output,
  50353. width: charString.width,
  50354. lsb: charString.lsb,
  50355. seac: charString.seac
  50356. });
  50357. }
  50358. return program;
  50359. },
  50360. extractFontHeader: function Type1Parser_extractFontHeader(properties) {
  50361. var token;
  50362. while ((token = this.getToken()) !== null) {
  50363. if (token !== '/') {
  50364. continue;
  50365. }
  50366. token = this.getToken();
  50367. switch (token) {
  50368. case 'FontMatrix':
  50369. var matrix = this.readNumberArray();
  50370. properties.fontMatrix = matrix;
  50371. break;
  50372. case 'Encoding':
  50373. var encodingArg = this.getToken();
  50374. var encoding;
  50375. if (!/^\d+$/.test(encodingArg)) {
  50376. encoding = getEncoding(encodingArg);
  50377. } else {
  50378. encoding = [];
  50379. var size = parseInt(encodingArg, 10) | 0;
  50380. this.getToken();
  50381. for (var j = 0; j < size; j++) {
  50382. token = this.getToken();
  50383. while (token !== 'dup' && token !== 'def') {
  50384. token = this.getToken();
  50385. if (token === null) {
  50386. return;
  50387. }
  50388. }
  50389. if (token === 'def') {
  50390. break;
  50391. }
  50392. var index = this.readInt();
  50393. this.getToken();
  50394. var glyph = this.getToken();
  50395. encoding[index] = glyph;
  50396. this.getToken();
  50397. }
  50398. }
  50399. properties.builtInEncoding = encoding;
  50400. break;
  50401. case 'FontBBox':
  50402. var fontBBox = this.readNumberArray();
  50403. properties.ascent = fontBBox[3];
  50404. properties.descent = fontBBox[1];
  50405. properties.ascentScaled = true;
  50406. break;
  50407. }
  50408. }
  50409. }
  50410. };
  50411. return Type1Parser;
  50412. }();
  50413. exports.Type1Parser = Type1Parser;
  50414. /***/ }),
  50415. /* 37 */
  50416. /***/ (function(module, exports, __w_pdfjs_require__) {
  50417. "use strict";
  50418. var pdfjsVersion = '1.7.280';
  50419. var pdfjsBuild = '1549a46e';
  50420. var pdfjsCoreWorker = __w_pdfjs_require__(8);
  50421. {
  50422. __w_pdfjs_require__(18);
  50423. }
  50424. exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
  50425. /***/ })
  50426. /******/ ]);
  50427. });