pdf.worker.js 1.1 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081
  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 compatibility = __w_pdfjs_require__(36);
  84. var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this;
  85. var FONT_IDENTITY_MATRIX = [
  86. 0.001,
  87. 0,
  88. 0,
  89. 0.001,
  90. 0,
  91. 0
  92. ];
  93. var TextRenderingMode = {
  94. FILL: 0,
  95. STROKE: 1,
  96. FILL_STROKE: 2,
  97. INVISIBLE: 3,
  98. FILL_ADD_TO_PATH: 4,
  99. STROKE_ADD_TO_PATH: 5,
  100. FILL_STROKE_ADD_TO_PATH: 6,
  101. ADD_TO_PATH: 7,
  102. FILL_STROKE_MASK: 3,
  103. ADD_TO_PATH_FLAG: 4
  104. };
  105. var ImageKind = {
  106. GRAYSCALE_1BPP: 1,
  107. RGB_24BPP: 2,
  108. RGBA_32BPP: 3
  109. };
  110. var AnnotationType = {
  111. TEXT: 1,
  112. LINK: 2,
  113. FREETEXT: 3,
  114. LINE: 4,
  115. SQUARE: 5,
  116. CIRCLE: 6,
  117. POLYGON: 7,
  118. POLYLINE: 8,
  119. HIGHLIGHT: 9,
  120. UNDERLINE: 10,
  121. SQUIGGLY: 11,
  122. STRIKEOUT: 12,
  123. STAMP: 13,
  124. CARET: 14,
  125. INK: 15,
  126. POPUP: 16,
  127. FILEATTACHMENT: 17,
  128. SOUND: 18,
  129. MOVIE: 19,
  130. WIDGET: 20,
  131. SCREEN: 21,
  132. PRINTERMARK: 22,
  133. TRAPNET: 23,
  134. WATERMARK: 24,
  135. THREED: 25,
  136. REDACT: 26
  137. };
  138. var AnnotationFlag = {
  139. INVISIBLE: 0x01,
  140. HIDDEN: 0x02,
  141. PRINT: 0x04,
  142. NOZOOM: 0x08,
  143. NOROTATE: 0x10,
  144. NOVIEW: 0x20,
  145. READONLY: 0x40,
  146. LOCKED: 0x80,
  147. TOGGLENOVIEW: 0x100,
  148. LOCKEDCONTENTS: 0x200
  149. };
  150. var AnnotationFieldFlag = {
  151. READONLY: 0x0000001,
  152. REQUIRED: 0x0000002,
  153. NOEXPORT: 0x0000004,
  154. MULTILINE: 0x0001000,
  155. PASSWORD: 0x0002000,
  156. NOTOGGLETOOFF: 0x0004000,
  157. RADIO: 0x0008000,
  158. PUSHBUTTON: 0x0010000,
  159. COMBO: 0x0020000,
  160. EDIT: 0x0040000,
  161. SORT: 0x0080000,
  162. FILESELECT: 0x0100000,
  163. MULTISELECT: 0x0200000,
  164. DONOTSPELLCHECK: 0x0400000,
  165. DONOTSCROLL: 0x0800000,
  166. COMB: 0x1000000,
  167. RICHTEXT: 0x2000000,
  168. RADIOSINUNISON: 0x2000000,
  169. COMMITONSELCHANGE: 0x4000000
  170. };
  171. var AnnotationBorderStyleType = {
  172. SOLID: 1,
  173. DASHED: 2,
  174. BEVELED: 3,
  175. INSET: 4,
  176. UNDERLINE: 5
  177. };
  178. var StreamType = {
  179. UNKNOWN: 0,
  180. FLATE: 1,
  181. LZW: 2,
  182. DCT: 3,
  183. JPX: 4,
  184. JBIG: 5,
  185. A85: 6,
  186. AHX: 7,
  187. CCF: 8,
  188. RL: 9
  189. };
  190. var FontType = {
  191. UNKNOWN: 0,
  192. TYPE1: 1,
  193. TYPE1C: 2,
  194. CIDFONTTYPE0: 3,
  195. CIDFONTTYPE0C: 4,
  196. TRUETYPE: 5,
  197. CIDFONTTYPE2: 6,
  198. TYPE3: 7,
  199. OPENTYPE: 8,
  200. TYPE0: 9,
  201. MMTYPE1: 10
  202. };
  203. var VERBOSITY_LEVELS = {
  204. errors: 0,
  205. warnings: 1,
  206. infos: 5
  207. };
  208. var CMapCompressionType = {
  209. NONE: 0,
  210. BINARY: 1,
  211. STREAM: 2
  212. };
  213. var OPS = {
  214. dependency: 1,
  215. setLineWidth: 2,
  216. setLineCap: 3,
  217. setLineJoin: 4,
  218. setMiterLimit: 5,
  219. setDash: 6,
  220. setRenderingIntent: 7,
  221. setFlatness: 8,
  222. setGState: 9,
  223. save: 10,
  224. restore: 11,
  225. transform: 12,
  226. moveTo: 13,
  227. lineTo: 14,
  228. curveTo: 15,
  229. curveTo2: 16,
  230. curveTo3: 17,
  231. closePath: 18,
  232. rectangle: 19,
  233. stroke: 20,
  234. closeStroke: 21,
  235. fill: 22,
  236. eoFill: 23,
  237. fillStroke: 24,
  238. eoFillStroke: 25,
  239. closeFillStroke: 26,
  240. closeEOFillStroke: 27,
  241. endPath: 28,
  242. clip: 29,
  243. eoClip: 30,
  244. beginText: 31,
  245. endText: 32,
  246. setCharSpacing: 33,
  247. setWordSpacing: 34,
  248. setHScale: 35,
  249. setLeading: 36,
  250. setFont: 37,
  251. setTextRenderingMode: 38,
  252. setTextRise: 39,
  253. moveText: 40,
  254. setLeadingMoveText: 41,
  255. setTextMatrix: 42,
  256. nextLine: 43,
  257. showText: 44,
  258. showSpacedText: 45,
  259. nextLineShowText: 46,
  260. nextLineSetSpacingShowText: 47,
  261. setCharWidth: 48,
  262. setCharWidthAndBounds: 49,
  263. setStrokeColorSpace: 50,
  264. setFillColorSpace: 51,
  265. setStrokeColor: 52,
  266. setStrokeColorN: 53,
  267. setFillColor: 54,
  268. setFillColorN: 55,
  269. setStrokeGray: 56,
  270. setFillGray: 57,
  271. setStrokeRGBColor: 58,
  272. setFillRGBColor: 59,
  273. setStrokeCMYKColor: 60,
  274. setFillCMYKColor: 61,
  275. shadingFill: 62,
  276. beginInlineImage: 63,
  277. beginImageData: 64,
  278. endInlineImage: 65,
  279. paintXObject: 66,
  280. markPoint: 67,
  281. markPointProps: 68,
  282. beginMarkedContent: 69,
  283. beginMarkedContentProps: 70,
  284. endMarkedContent: 71,
  285. beginCompat: 72,
  286. endCompat: 73,
  287. paintFormXObjectBegin: 74,
  288. paintFormXObjectEnd: 75,
  289. beginGroup: 76,
  290. endGroup: 77,
  291. beginAnnotations: 78,
  292. endAnnotations: 79,
  293. beginAnnotation: 80,
  294. endAnnotation: 81,
  295. paintJpegXObject: 82,
  296. paintImageMaskXObject: 83,
  297. paintImageMaskXObjectGroup: 84,
  298. paintImageXObject: 85,
  299. paintInlineImageXObject: 86,
  300. paintInlineImageXObjectGroup: 87,
  301. paintImageXObjectRepeat: 88,
  302. paintImageMaskXObjectRepeat: 89,
  303. paintSolidColorImageMask: 90,
  304. constructPath: 91
  305. };
  306. var verbosity = VERBOSITY_LEVELS.warnings;
  307. function setVerbosityLevel(level) {
  308. verbosity = level;
  309. }
  310. function getVerbosityLevel() {
  311. return verbosity;
  312. }
  313. function info(msg) {
  314. if (verbosity >= VERBOSITY_LEVELS.infos) {
  315. console.log('Info: ' + msg);
  316. }
  317. }
  318. function warn(msg) {
  319. if (verbosity >= VERBOSITY_LEVELS.warnings) {
  320. console.log('Warning: ' + msg);
  321. }
  322. }
  323. function deprecated(details) {
  324. console.log('Deprecated API usage: ' + details);
  325. }
  326. function error(msg) {
  327. if (verbosity >= VERBOSITY_LEVELS.errors) {
  328. console.log('Error: ' + msg);
  329. console.log(backtrace());
  330. }
  331. throw new Error(msg);
  332. }
  333. function backtrace() {
  334. try {
  335. throw new Error();
  336. } catch (e) {
  337. return e.stack ? e.stack.split('\n').slice(2).join('\n') : '';
  338. }
  339. }
  340. function assert(cond, msg) {
  341. if (!cond) {
  342. error(msg);
  343. }
  344. }
  345. var UNSUPPORTED_FEATURES = {
  346. unknown: 'unknown',
  347. forms: 'forms',
  348. javaScript: 'javaScript',
  349. smask: 'smask',
  350. shadingPattern: 'shadingPattern',
  351. font: 'font'
  352. };
  353. function isSameOrigin(baseUrl, otherUrl) {
  354. try {
  355. var base = new URL(baseUrl);
  356. if (!base.origin || base.origin === 'null') {
  357. return false;
  358. }
  359. } catch (e) {
  360. return false;
  361. }
  362. var other = new URL(otherUrl, base);
  363. return base.origin === other.origin;
  364. }
  365. function isValidProtocol(url) {
  366. if (!url) {
  367. return false;
  368. }
  369. switch (url.protocol) {
  370. case 'http:':
  371. case 'https:':
  372. case 'ftp:':
  373. case 'mailto:':
  374. case 'tel:':
  375. return true;
  376. default:
  377. return false;
  378. }
  379. }
  380. function createValidAbsoluteUrl(url, baseUrl) {
  381. if (!url) {
  382. return null;
  383. }
  384. try {
  385. var absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  386. if (isValidProtocol(absoluteUrl)) {
  387. return absoluteUrl;
  388. }
  389. } catch (ex) {
  390. }
  391. return null;
  392. }
  393. function shadow(obj, prop, value) {
  394. Object.defineProperty(obj, prop, {
  395. value: value,
  396. enumerable: true,
  397. configurable: true,
  398. writable: false
  399. });
  400. return value;
  401. }
  402. function getLookupTableFactory(initializer) {
  403. var lookup;
  404. return function () {
  405. if (initializer) {
  406. lookup = Object.create(null);
  407. initializer(lookup);
  408. initializer = null;
  409. }
  410. return lookup;
  411. };
  412. }
  413. var PasswordResponses = {
  414. NEED_PASSWORD: 1,
  415. INCORRECT_PASSWORD: 2
  416. };
  417. var PasswordException = function PasswordExceptionClosure() {
  418. function PasswordException(msg, code) {
  419. this.name = 'PasswordException';
  420. this.message = msg;
  421. this.code = code;
  422. }
  423. PasswordException.prototype = new Error();
  424. PasswordException.constructor = PasswordException;
  425. return PasswordException;
  426. }();
  427. var UnknownErrorException = function UnknownErrorExceptionClosure() {
  428. function UnknownErrorException(msg, details) {
  429. this.name = 'UnknownErrorException';
  430. this.message = msg;
  431. this.details = details;
  432. }
  433. UnknownErrorException.prototype = new Error();
  434. UnknownErrorException.constructor = UnknownErrorException;
  435. return UnknownErrorException;
  436. }();
  437. var InvalidPDFException = function InvalidPDFExceptionClosure() {
  438. function InvalidPDFException(msg) {
  439. this.name = 'InvalidPDFException';
  440. this.message = msg;
  441. }
  442. InvalidPDFException.prototype = new Error();
  443. InvalidPDFException.constructor = InvalidPDFException;
  444. return InvalidPDFException;
  445. }();
  446. var MissingPDFException = function MissingPDFExceptionClosure() {
  447. function MissingPDFException(msg) {
  448. this.name = 'MissingPDFException';
  449. this.message = msg;
  450. }
  451. MissingPDFException.prototype = new Error();
  452. MissingPDFException.constructor = MissingPDFException;
  453. return MissingPDFException;
  454. }();
  455. var UnexpectedResponseException = function UnexpectedResponseExceptionClosure() {
  456. function UnexpectedResponseException(msg, status) {
  457. this.name = 'UnexpectedResponseException';
  458. this.message = msg;
  459. this.status = status;
  460. }
  461. UnexpectedResponseException.prototype = new Error();
  462. UnexpectedResponseException.constructor = UnexpectedResponseException;
  463. return UnexpectedResponseException;
  464. }();
  465. var NotImplementedException = function NotImplementedExceptionClosure() {
  466. function NotImplementedException(msg) {
  467. this.message = msg;
  468. }
  469. NotImplementedException.prototype = new Error();
  470. NotImplementedException.prototype.name = 'NotImplementedException';
  471. NotImplementedException.constructor = NotImplementedException;
  472. return NotImplementedException;
  473. }();
  474. var MissingDataException = function MissingDataExceptionClosure() {
  475. function MissingDataException(begin, end) {
  476. this.begin = begin;
  477. this.end = end;
  478. this.message = 'Missing data [' + begin + ', ' + end + ')';
  479. }
  480. MissingDataException.prototype = new Error();
  481. MissingDataException.prototype.name = 'MissingDataException';
  482. MissingDataException.constructor = MissingDataException;
  483. return MissingDataException;
  484. }();
  485. var XRefParseException = function XRefParseExceptionClosure() {
  486. function XRefParseException(msg) {
  487. this.message = msg;
  488. }
  489. XRefParseException.prototype = new Error();
  490. XRefParseException.prototype.name = 'XRefParseException';
  491. XRefParseException.constructor = XRefParseException;
  492. return XRefParseException;
  493. }();
  494. var NullCharactersRegExp = /\x00/g;
  495. function removeNullCharacters(str) {
  496. if (typeof str !== 'string') {
  497. warn('The argument for removeNullCharacters must be a string.');
  498. return str;
  499. }
  500. return str.replace(NullCharactersRegExp, '');
  501. }
  502. function bytesToString(bytes) {
  503. assert(bytes !== null && typeof bytes === 'object' && bytes.length !== undefined, 'Invalid argument for bytesToString');
  504. var length = bytes.length;
  505. var MAX_ARGUMENT_COUNT = 8192;
  506. if (length < MAX_ARGUMENT_COUNT) {
  507. return String.fromCharCode.apply(null, bytes);
  508. }
  509. var strBuf = [];
  510. for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  511. var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  512. var chunk = bytes.subarray(i, chunkEnd);
  513. strBuf.push(String.fromCharCode.apply(null, chunk));
  514. }
  515. return strBuf.join('');
  516. }
  517. function stringToBytes(str) {
  518. assert(typeof str === 'string', 'Invalid argument for stringToBytes');
  519. var length = str.length;
  520. var bytes = new Uint8Array(length);
  521. for (var i = 0; i < length; ++i) {
  522. bytes[i] = str.charCodeAt(i) & 0xFF;
  523. }
  524. return bytes;
  525. }
  526. function arrayByteLength(arr) {
  527. if (arr.length !== undefined) {
  528. return arr.length;
  529. }
  530. assert(arr.byteLength !== undefined);
  531. return arr.byteLength;
  532. }
  533. function arraysToBytes(arr) {
  534. if (arr.length === 1 && arr[0] instanceof Uint8Array) {
  535. return arr[0];
  536. }
  537. var resultLength = 0;
  538. var i, ii = arr.length;
  539. var item, itemLength;
  540. for (i = 0; i < ii; i++) {
  541. item = arr[i];
  542. itemLength = arrayByteLength(item);
  543. resultLength += itemLength;
  544. }
  545. var pos = 0;
  546. var data = new Uint8Array(resultLength);
  547. for (i = 0; i < ii; i++) {
  548. item = arr[i];
  549. if (!(item instanceof Uint8Array)) {
  550. if (typeof item === 'string') {
  551. item = stringToBytes(item);
  552. } else {
  553. item = new Uint8Array(item);
  554. }
  555. }
  556. itemLength = item.byteLength;
  557. data.set(item, pos);
  558. pos += itemLength;
  559. }
  560. return data;
  561. }
  562. function string32(value) {
  563. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  564. }
  565. function log2(x) {
  566. var n = 1, i = 0;
  567. while (x > n) {
  568. n <<= 1;
  569. i++;
  570. }
  571. return i;
  572. }
  573. function readInt8(data, start) {
  574. return data[start] << 24 >> 24;
  575. }
  576. function readUint16(data, offset) {
  577. return data[offset] << 8 | data[offset + 1];
  578. }
  579. function readUint32(data, offset) {
  580. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  581. }
  582. function isLittleEndian() {
  583. var buffer8 = new Uint8Array(2);
  584. buffer8[0] = 1;
  585. var buffer16 = new Uint16Array(buffer8.buffer);
  586. return buffer16[0] === 1;
  587. }
  588. function isEvalSupported() {
  589. try {
  590. new Function('');
  591. return true;
  592. } catch (e) {
  593. return false;
  594. }
  595. }
  596. var Uint32ArrayView = function Uint32ArrayViewClosure() {
  597. function Uint32ArrayView(buffer, length) {
  598. this.buffer = buffer;
  599. this.byteLength = buffer.length;
  600. this.length = length === undefined ? this.byteLength >> 2 : length;
  601. ensureUint32ArrayViewProps(this.length);
  602. }
  603. Uint32ArrayView.prototype = Object.create(null);
  604. var uint32ArrayViewSetters = 0;
  605. function createUint32ArrayProp(index) {
  606. return {
  607. get: function () {
  608. var buffer = this.buffer, offset = index << 2;
  609. return (buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24) >>> 0;
  610. },
  611. set: function (value) {
  612. var buffer = this.buffer, offset = index << 2;
  613. buffer[offset] = value & 255;
  614. buffer[offset + 1] = value >> 8 & 255;
  615. buffer[offset + 2] = value >> 16 & 255;
  616. buffer[offset + 3] = value >>> 24 & 255;
  617. }
  618. };
  619. }
  620. function ensureUint32ArrayViewProps(length) {
  621. while (uint32ArrayViewSetters < length) {
  622. Object.defineProperty(Uint32ArrayView.prototype, uint32ArrayViewSetters, createUint32ArrayProp(uint32ArrayViewSetters));
  623. uint32ArrayViewSetters++;
  624. }
  625. }
  626. return Uint32ArrayView;
  627. }();
  628. exports.Uint32ArrayView = Uint32ArrayView;
  629. var IDENTITY_MATRIX = [
  630. 1,
  631. 0,
  632. 0,
  633. 1,
  634. 0,
  635. 0
  636. ];
  637. var Util = function UtilClosure() {
  638. function Util() {
  639. }
  640. var rgbBuf = [
  641. 'rgb(',
  642. 0,
  643. ',',
  644. 0,
  645. ',',
  646. 0,
  647. ')'
  648. ];
  649. Util.makeCssRgb = function Util_makeCssRgb(r, g, b) {
  650. rgbBuf[1] = r;
  651. rgbBuf[3] = g;
  652. rgbBuf[5] = b;
  653. return rgbBuf.join('');
  654. };
  655. Util.transform = function Util_transform(m1, m2) {
  656. return [
  657. m1[0] * m2[0] + m1[2] * m2[1],
  658. m1[1] * m2[0] + m1[3] * m2[1],
  659. m1[0] * m2[2] + m1[2] * m2[3],
  660. m1[1] * m2[2] + m1[3] * m2[3],
  661. m1[0] * m2[4] + m1[2] * m2[5] + m1[4],
  662. m1[1] * m2[4] + m1[3] * m2[5] + m1[5]
  663. ];
  664. };
  665. Util.applyTransform = function Util_applyTransform(p, m) {
  666. var xt = p[0] * m[0] + p[1] * m[2] + m[4];
  667. var yt = p[0] * m[1] + p[1] * m[3] + m[5];
  668. return [
  669. xt,
  670. yt
  671. ];
  672. };
  673. Util.applyInverseTransform = function Util_applyInverseTransform(p, m) {
  674. var d = m[0] * m[3] - m[1] * m[2];
  675. var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  676. var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  677. return [
  678. xt,
  679. yt
  680. ];
  681. };
  682. Util.getAxialAlignedBoundingBox = function Util_getAxialAlignedBoundingBox(r, m) {
  683. var p1 = Util.applyTransform(r, m);
  684. var p2 = Util.applyTransform(r.slice(2, 4), m);
  685. var p3 = Util.applyTransform([
  686. r[0],
  687. r[3]
  688. ], m);
  689. var p4 = Util.applyTransform([
  690. r[2],
  691. r[1]
  692. ], m);
  693. return [
  694. Math.min(p1[0], p2[0], p3[0], p4[0]),
  695. Math.min(p1[1], p2[1], p3[1], p4[1]),
  696. Math.max(p1[0], p2[0], p3[0], p4[0]),
  697. Math.max(p1[1], p2[1], p3[1], p4[1])
  698. ];
  699. };
  700. Util.inverseTransform = function Util_inverseTransform(m) {
  701. var d = m[0] * m[3] - m[1] * m[2];
  702. return [
  703. m[3] / d,
  704. -m[1] / d,
  705. -m[2] / d,
  706. m[0] / d,
  707. (m[2] * m[5] - m[4] * m[3]) / d,
  708. (m[4] * m[1] - m[5] * m[0]) / d
  709. ];
  710. };
  711. Util.apply3dTransform = function Util_apply3dTransform(m, v) {
  712. return [
  713. m[0] * v[0] + m[1] * v[1] + m[2] * v[2],
  714. m[3] * v[0] + m[4] * v[1] + m[5] * v[2],
  715. m[6] * v[0] + m[7] * v[1] + m[8] * v[2]
  716. ];
  717. };
  718. Util.singularValueDecompose2dScale = function Util_singularValueDecompose2dScale(m) {
  719. var transpose = [
  720. m[0],
  721. m[2],
  722. m[1],
  723. m[3]
  724. ];
  725. var a = m[0] * transpose[0] + m[1] * transpose[2];
  726. var b = m[0] * transpose[1] + m[1] * transpose[3];
  727. var c = m[2] * transpose[0] + m[3] * transpose[2];
  728. var d = m[2] * transpose[1] + m[3] * transpose[3];
  729. var first = (a + d) / 2;
  730. var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
  731. var sx = first + second || 1;
  732. var sy = first - second || 1;
  733. return [
  734. Math.sqrt(sx),
  735. Math.sqrt(sy)
  736. ];
  737. };
  738. Util.normalizeRect = function Util_normalizeRect(rect) {
  739. var r = rect.slice(0);
  740. if (rect[0] > rect[2]) {
  741. r[0] = rect[2];
  742. r[2] = rect[0];
  743. }
  744. if (rect[1] > rect[3]) {
  745. r[1] = rect[3];
  746. r[3] = rect[1];
  747. }
  748. return r;
  749. };
  750. Util.intersect = function Util_intersect(rect1, rect2) {
  751. function compare(a, b) {
  752. return a - b;
  753. }
  754. var orderedX = [
  755. rect1[0],
  756. rect1[2],
  757. rect2[0],
  758. rect2[2]
  759. ].sort(compare), orderedY = [
  760. rect1[1],
  761. rect1[3],
  762. rect2[1],
  763. rect2[3]
  764. ].sort(compare), result = [];
  765. rect1 = Util.normalizeRect(rect1);
  766. rect2 = Util.normalizeRect(rect2);
  767. if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
  768. result[0] = orderedX[1];
  769. result[2] = orderedX[2];
  770. } else {
  771. return false;
  772. }
  773. if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
  774. result[1] = orderedY[1];
  775. result[3] = orderedY[2];
  776. } else {
  777. return false;
  778. }
  779. return result;
  780. };
  781. Util.sign = function Util_sign(num) {
  782. return num < 0 ? -1 : 1;
  783. };
  784. var ROMAN_NUMBER_MAP = [
  785. '',
  786. 'C',
  787. 'CC',
  788. 'CCC',
  789. 'CD',
  790. 'D',
  791. 'DC',
  792. 'DCC',
  793. 'DCCC',
  794. 'CM',
  795. '',
  796. 'X',
  797. 'XX',
  798. 'XXX',
  799. 'XL',
  800. 'L',
  801. 'LX',
  802. 'LXX',
  803. 'LXXX',
  804. 'XC',
  805. '',
  806. 'I',
  807. 'II',
  808. 'III',
  809. 'IV',
  810. 'V',
  811. 'VI',
  812. 'VII',
  813. 'VIII',
  814. 'IX'
  815. ];
  816. Util.toRoman = function Util_toRoman(number, lowerCase) {
  817. assert(isInt(number) && number > 0, 'The number should be a positive integer.');
  818. var pos, romanBuf = [];
  819. while (number >= 1000) {
  820. number -= 1000;
  821. romanBuf.push('M');
  822. }
  823. pos = number / 100 | 0;
  824. number %= 100;
  825. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  826. pos = number / 10 | 0;
  827. number %= 10;
  828. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  829. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  830. var romanStr = romanBuf.join('');
  831. return lowerCase ? romanStr.toLowerCase() : romanStr;
  832. };
  833. Util.appendToArray = function Util_appendToArray(arr1, arr2) {
  834. Array.prototype.push.apply(arr1, arr2);
  835. };
  836. Util.prependToArray = function Util_prependToArray(arr1, arr2) {
  837. Array.prototype.unshift.apply(arr1, arr2);
  838. };
  839. Util.extendObj = function extendObj(obj1, obj2) {
  840. for (var key in obj2) {
  841. obj1[key] = obj2[key];
  842. }
  843. };
  844. Util.getInheritableProperty = function Util_getInheritableProperty(dict, name, getArray) {
  845. while (dict && !dict.has(name)) {
  846. dict = dict.get('Parent');
  847. }
  848. if (!dict) {
  849. return null;
  850. }
  851. return getArray ? dict.getArray(name) : dict.get(name);
  852. };
  853. Util.inherit = function Util_inherit(sub, base, prototype) {
  854. sub.prototype = Object.create(base.prototype);
  855. sub.prototype.constructor = sub;
  856. for (var prop in prototype) {
  857. sub.prototype[prop] = prototype[prop];
  858. }
  859. };
  860. Util.loadScript = function Util_loadScript(src, callback) {
  861. var script = document.createElement('script');
  862. var loaded = false;
  863. script.setAttribute('src', src);
  864. if (callback) {
  865. script.onload = function () {
  866. if (!loaded) {
  867. callback();
  868. }
  869. loaded = true;
  870. };
  871. }
  872. document.getElementsByTagName('head')[0].appendChild(script);
  873. };
  874. return Util;
  875. }();
  876. var PageViewport = function PageViewportClosure() {
  877. function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) {
  878. this.viewBox = viewBox;
  879. this.scale = scale;
  880. this.rotation = rotation;
  881. this.offsetX = offsetX;
  882. this.offsetY = offsetY;
  883. var centerX = (viewBox[2] + viewBox[0]) / 2;
  884. var centerY = (viewBox[3] + viewBox[1]) / 2;
  885. var rotateA, rotateB, rotateC, rotateD;
  886. rotation = rotation % 360;
  887. rotation = rotation < 0 ? rotation + 360 : rotation;
  888. switch (rotation) {
  889. case 180:
  890. rotateA = -1;
  891. rotateB = 0;
  892. rotateC = 0;
  893. rotateD = 1;
  894. break;
  895. case 90:
  896. rotateA = 0;
  897. rotateB = 1;
  898. rotateC = 1;
  899. rotateD = 0;
  900. break;
  901. case 270:
  902. rotateA = 0;
  903. rotateB = -1;
  904. rotateC = -1;
  905. rotateD = 0;
  906. break;
  907. default:
  908. rotateA = 1;
  909. rotateB = 0;
  910. rotateC = 0;
  911. rotateD = -1;
  912. break;
  913. }
  914. if (dontFlip) {
  915. rotateC = -rotateC;
  916. rotateD = -rotateD;
  917. }
  918. var offsetCanvasX, offsetCanvasY;
  919. var width, height;
  920. if (rotateA === 0) {
  921. offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;
  922. offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;
  923. width = Math.abs(viewBox[3] - viewBox[1]) * scale;
  924. height = Math.abs(viewBox[2] - viewBox[0]) * scale;
  925. } else {
  926. offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;
  927. offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;
  928. width = Math.abs(viewBox[2] - viewBox[0]) * scale;
  929. height = Math.abs(viewBox[3] - viewBox[1]) * scale;
  930. }
  931. this.transform = [
  932. rotateA * scale,
  933. rotateB * scale,
  934. rotateC * scale,
  935. rotateD * scale,
  936. offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY,
  937. offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY
  938. ];
  939. this.width = width;
  940. this.height = height;
  941. this.fontScale = scale;
  942. }
  943. PageViewport.prototype = {
  944. clone: function PageViewPort_clone(args) {
  945. args = args || {};
  946. var scale = 'scale' in args ? args.scale : this.scale;
  947. var rotation = 'rotation' in args ? args.rotation : this.rotation;
  948. return new PageViewport(this.viewBox.slice(), scale, rotation, this.offsetX, this.offsetY, args.dontFlip);
  949. },
  950. convertToViewportPoint: function PageViewport_convertToViewportPoint(x, y) {
  951. return Util.applyTransform([
  952. x,
  953. y
  954. ], this.transform);
  955. },
  956. convertToViewportRectangle: function PageViewport_convertToViewportRectangle(rect) {
  957. var tl = Util.applyTransform([
  958. rect[0],
  959. rect[1]
  960. ], this.transform);
  961. var br = Util.applyTransform([
  962. rect[2],
  963. rect[3]
  964. ], this.transform);
  965. return [
  966. tl[0],
  967. tl[1],
  968. br[0],
  969. br[1]
  970. ];
  971. },
  972. convertToPdfPoint: function PageViewport_convertToPdfPoint(x, y) {
  973. return Util.applyInverseTransform([
  974. x,
  975. y
  976. ], this.transform);
  977. }
  978. };
  979. return PageViewport;
  980. }();
  981. var PDFStringTranslateTable = [
  982. 0,
  983. 0,
  984. 0,
  985. 0,
  986. 0,
  987. 0,
  988. 0,
  989. 0,
  990. 0,
  991. 0,
  992. 0,
  993. 0,
  994. 0,
  995. 0,
  996. 0,
  997. 0,
  998. 0,
  999. 0,
  1000. 0,
  1001. 0,
  1002. 0,
  1003. 0,
  1004. 0,
  1005. 0,
  1006. 0x2D8,
  1007. 0x2C7,
  1008. 0x2C6,
  1009. 0x2D9,
  1010. 0x2DD,
  1011. 0x2DB,
  1012. 0x2DA,
  1013. 0x2DC,
  1014. 0,
  1015. 0,
  1016. 0,
  1017. 0,
  1018. 0,
  1019. 0,
  1020. 0,
  1021. 0,
  1022. 0,
  1023. 0,
  1024. 0,
  1025. 0,
  1026. 0,
  1027. 0,
  1028. 0,
  1029. 0,
  1030. 0,
  1031. 0,
  1032. 0,
  1033. 0,
  1034. 0,
  1035. 0,
  1036. 0,
  1037. 0,
  1038. 0,
  1039. 0,
  1040. 0,
  1041. 0,
  1042. 0,
  1043. 0,
  1044. 0,
  1045. 0,
  1046. 0,
  1047. 0,
  1048. 0,
  1049. 0,
  1050. 0,
  1051. 0,
  1052. 0,
  1053. 0,
  1054. 0,
  1055. 0,
  1056. 0,
  1057. 0,
  1058. 0,
  1059. 0,
  1060. 0,
  1061. 0,
  1062. 0,
  1063. 0,
  1064. 0,
  1065. 0,
  1066. 0,
  1067. 0,
  1068. 0,
  1069. 0,
  1070. 0,
  1071. 0,
  1072. 0,
  1073. 0,
  1074. 0,
  1075. 0,
  1076. 0,
  1077. 0,
  1078. 0,
  1079. 0,
  1080. 0,
  1081. 0,
  1082. 0,
  1083. 0,
  1084. 0,
  1085. 0,
  1086. 0,
  1087. 0,
  1088. 0,
  1089. 0,
  1090. 0,
  1091. 0,
  1092. 0,
  1093. 0,
  1094. 0,
  1095. 0,
  1096. 0,
  1097. 0,
  1098. 0,
  1099. 0,
  1100. 0,
  1101. 0,
  1102. 0,
  1103. 0,
  1104. 0,
  1105. 0,
  1106. 0,
  1107. 0,
  1108. 0,
  1109. 0,
  1110. 0x2022,
  1111. 0x2020,
  1112. 0x2021,
  1113. 0x2026,
  1114. 0x2014,
  1115. 0x2013,
  1116. 0x192,
  1117. 0x2044,
  1118. 0x2039,
  1119. 0x203A,
  1120. 0x2212,
  1121. 0x2030,
  1122. 0x201E,
  1123. 0x201C,
  1124. 0x201D,
  1125. 0x2018,
  1126. 0x2019,
  1127. 0x201A,
  1128. 0x2122,
  1129. 0xFB01,
  1130. 0xFB02,
  1131. 0x141,
  1132. 0x152,
  1133. 0x160,
  1134. 0x178,
  1135. 0x17D,
  1136. 0x131,
  1137. 0x142,
  1138. 0x153,
  1139. 0x161,
  1140. 0x17E,
  1141. 0,
  1142. 0x20AC
  1143. ];
  1144. function stringToPDFString(str) {
  1145. var i, n = str.length, strBuf = [];
  1146. if (str[0] === '\xFE' && str[1] === '\xFF') {
  1147. for (i = 2; i < n; i += 2) {
  1148. strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
  1149. }
  1150. } else {
  1151. for (i = 0; i < n; ++i) {
  1152. var code = PDFStringTranslateTable[str.charCodeAt(i)];
  1153. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1154. }
  1155. }
  1156. return strBuf.join('');
  1157. }
  1158. function stringToUTF8String(str) {
  1159. return decodeURIComponent(escape(str));
  1160. }
  1161. function utf8StringToString(str) {
  1162. return unescape(encodeURIComponent(str));
  1163. }
  1164. function isEmptyObj(obj) {
  1165. for (var key in obj) {
  1166. return false;
  1167. }
  1168. return true;
  1169. }
  1170. function isBool(v) {
  1171. return typeof v === 'boolean';
  1172. }
  1173. function isInt(v) {
  1174. return typeof v === 'number' && (v | 0) === v;
  1175. }
  1176. function isNum(v) {
  1177. return typeof v === 'number';
  1178. }
  1179. function isString(v) {
  1180. return typeof v === 'string';
  1181. }
  1182. function isArray(v) {
  1183. return v instanceof Array;
  1184. }
  1185. function isArrayBuffer(v) {
  1186. return typeof v === 'object' && v !== null && v.byteLength !== undefined;
  1187. }
  1188. function isSpace(ch) {
  1189. return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A;
  1190. }
  1191. function isNodeJS() {
  1192. if (typeof __pdfjsdev_webpack__ === 'undefined') {
  1193. return typeof process === 'object' && process + '' === '[object process]';
  1194. }
  1195. return false;
  1196. }
  1197. function createPromiseCapability() {
  1198. var capability = {};
  1199. capability.promise = new Promise(function (resolve, reject) {
  1200. capability.resolve = resolve;
  1201. capability.reject = reject;
  1202. });
  1203. return capability;
  1204. }
  1205. var StatTimer = function StatTimerClosure() {
  1206. function rpad(str, pad, length) {
  1207. while (str.length < length) {
  1208. str += pad;
  1209. }
  1210. return str;
  1211. }
  1212. function StatTimer() {
  1213. this.started = Object.create(null);
  1214. this.times = [];
  1215. this.enabled = true;
  1216. }
  1217. StatTimer.prototype = {
  1218. time: function StatTimer_time(name) {
  1219. if (!this.enabled) {
  1220. return;
  1221. }
  1222. if (name in this.started) {
  1223. warn('Timer is already running for ' + name);
  1224. }
  1225. this.started[name] = Date.now();
  1226. },
  1227. timeEnd: function StatTimer_timeEnd(name) {
  1228. if (!this.enabled) {
  1229. return;
  1230. }
  1231. if (!(name in this.started)) {
  1232. warn('Timer has not been started for ' + name);
  1233. }
  1234. this.times.push({
  1235. 'name': name,
  1236. 'start': this.started[name],
  1237. 'end': Date.now()
  1238. });
  1239. delete this.started[name];
  1240. },
  1241. toString: function StatTimer_toString() {
  1242. var i, ii;
  1243. var times = this.times;
  1244. var out = '';
  1245. var longest = 0;
  1246. for (i = 0, ii = times.length; i < ii; ++i) {
  1247. var name = times[i]['name'];
  1248. if (name.length > longest) {
  1249. longest = name.length;
  1250. }
  1251. }
  1252. for (i = 0, ii = times.length; i < ii; ++i) {
  1253. var span = times[i];
  1254. var duration = span.end - span.start;
  1255. out += rpad(span['name'], ' ', longest) + ' ' + duration + 'ms\n';
  1256. }
  1257. return out;
  1258. }
  1259. };
  1260. return StatTimer;
  1261. }();
  1262. var createBlob = function createBlob(data, contentType) {
  1263. if (typeof Blob !== 'undefined') {
  1264. return new Blob([data], { type: contentType });
  1265. }
  1266. warn('The "Blob" constructor is not supported.');
  1267. };
  1268. var createObjectURL = function createObjectURLClosure() {
  1269. var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  1270. return function createObjectURL(data, contentType, forceDataSchema) {
  1271. if (!forceDataSchema && typeof URL !== 'undefined' && URL.createObjectURL) {
  1272. var blob = createBlob(data, contentType);
  1273. return URL.createObjectURL(blob);
  1274. }
  1275. var buffer = 'data:' + contentType + ';base64,';
  1276. for (var i = 0, ii = data.length; i < ii; i += 3) {
  1277. var b1 = data[i] & 0xFF;
  1278. var b2 = data[i + 1] & 0xFF;
  1279. var b3 = data[i + 2] & 0xFF;
  1280. var d1 = b1 >> 2, d2 = (b1 & 3) << 4 | b2 >> 4;
  1281. var d3 = i + 1 < ii ? (b2 & 0xF) << 2 | b3 >> 6 : 64;
  1282. var d4 = i + 2 < ii ? b3 & 0x3F : 64;
  1283. buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
  1284. }
  1285. return buffer;
  1286. };
  1287. }();
  1288. function MessageHandler(sourceName, targetName, comObj) {
  1289. this.sourceName = sourceName;
  1290. this.targetName = targetName;
  1291. this.comObj = comObj;
  1292. this.callbackIndex = 1;
  1293. this.postMessageTransfers = true;
  1294. var callbacksCapabilities = this.callbacksCapabilities = Object.create(null);
  1295. var ah = this.actionHandler = Object.create(null);
  1296. this._onComObjOnMessage = function messageHandlerComObjOnMessage(event) {
  1297. var data = event.data;
  1298. if (data.targetName !== this.sourceName) {
  1299. return;
  1300. }
  1301. if (data.isReply) {
  1302. var callbackId = data.callbackId;
  1303. if (data.callbackId in callbacksCapabilities) {
  1304. var callback = callbacksCapabilities[callbackId];
  1305. delete callbacksCapabilities[callbackId];
  1306. if ('error' in data) {
  1307. callback.reject(data.error);
  1308. } else {
  1309. callback.resolve(data.data);
  1310. }
  1311. } else {
  1312. error('Cannot resolve callback ' + callbackId);
  1313. }
  1314. } else if (data.action in ah) {
  1315. var action = ah[data.action];
  1316. if (data.callbackId) {
  1317. var sourceName = this.sourceName;
  1318. var targetName = data.sourceName;
  1319. Promise.resolve().then(function () {
  1320. return action[0].call(action[1], data.data);
  1321. }).then(function (result) {
  1322. comObj.postMessage({
  1323. sourceName: sourceName,
  1324. targetName: targetName,
  1325. isReply: true,
  1326. callbackId: data.callbackId,
  1327. data: result
  1328. });
  1329. }, function (reason) {
  1330. if (reason instanceof Error) {
  1331. reason = reason + '';
  1332. }
  1333. comObj.postMessage({
  1334. sourceName: sourceName,
  1335. targetName: targetName,
  1336. isReply: true,
  1337. callbackId: data.callbackId,
  1338. error: reason
  1339. });
  1340. });
  1341. } else {
  1342. action[0].call(action[1], data.data);
  1343. }
  1344. } else {
  1345. error('Unknown action from worker: ' + data.action);
  1346. }
  1347. }.bind(this);
  1348. comObj.addEventListener('message', this._onComObjOnMessage);
  1349. }
  1350. MessageHandler.prototype = {
  1351. on: function messageHandlerOn(actionName, handler, scope) {
  1352. var ah = this.actionHandler;
  1353. if (ah[actionName]) {
  1354. error('There is already an actionName called "' + actionName + '"');
  1355. }
  1356. ah[actionName] = [
  1357. handler,
  1358. scope
  1359. ];
  1360. },
  1361. send: function messageHandlerSend(actionName, data, transfers) {
  1362. var message = {
  1363. sourceName: this.sourceName,
  1364. targetName: this.targetName,
  1365. action: actionName,
  1366. data: data
  1367. };
  1368. this.postMessage(message, transfers);
  1369. },
  1370. sendWithPromise: function messageHandlerSendWithPromise(actionName, data, transfers) {
  1371. var callbackId = this.callbackIndex++;
  1372. var message = {
  1373. sourceName: this.sourceName,
  1374. targetName: this.targetName,
  1375. action: actionName,
  1376. data: data,
  1377. callbackId: callbackId
  1378. };
  1379. var capability = createPromiseCapability();
  1380. this.callbacksCapabilities[callbackId] = capability;
  1381. try {
  1382. this.postMessage(message, transfers);
  1383. } catch (e) {
  1384. capability.reject(e);
  1385. }
  1386. return capability.promise;
  1387. },
  1388. postMessage: function (message, transfers) {
  1389. if (transfers && this.postMessageTransfers) {
  1390. this.comObj.postMessage(message, transfers);
  1391. } else {
  1392. this.comObj.postMessage(message);
  1393. }
  1394. },
  1395. destroy: function () {
  1396. this.comObj.removeEventListener('message', this._onComObjOnMessage);
  1397. }
  1398. };
  1399. function loadJpegStream(id, imageUrl, objs) {
  1400. var img = new Image();
  1401. img.onload = function loadJpegStream_onloadClosure() {
  1402. objs.resolve(id, img);
  1403. };
  1404. img.onerror = function loadJpegStream_onerrorClosure() {
  1405. objs.resolve(id, null);
  1406. warn('Error during JPEG image loading');
  1407. };
  1408. img.src = imageUrl;
  1409. }
  1410. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  1411. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  1412. exports.OPS = OPS;
  1413. exports.VERBOSITY_LEVELS = VERBOSITY_LEVELS;
  1414. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  1415. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  1416. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  1417. exports.AnnotationFlag = AnnotationFlag;
  1418. exports.AnnotationType = AnnotationType;
  1419. exports.FontType = FontType;
  1420. exports.ImageKind = ImageKind;
  1421. exports.CMapCompressionType = CMapCompressionType;
  1422. exports.InvalidPDFException = InvalidPDFException;
  1423. exports.MessageHandler = MessageHandler;
  1424. exports.MissingDataException = MissingDataException;
  1425. exports.MissingPDFException = MissingPDFException;
  1426. exports.NotImplementedException = NotImplementedException;
  1427. exports.PageViewport = PageViewport;
  1428. exports.PasswordException = PasswordException;
  1429. exports.PasswordResponses = PasswordResponses;
  1430. exports.StatTimer = StatTimer;
  1431. exports.StreamType = StreamType;
  1432. exports.TextRenderingMode = TextRenderingMode;
  1433. exports.UnexpectedResponseException = UnexpectedResponseException;
  1434. exports.UnknownErrorException = UnknownErrorException;
  1435. exports.Util = Util;
  1436. exports.XRefParseException = XRefParseException;
  1437. exports.arrayByteLength = arrayByteLength;
  1438. exports.arraysToBytes = arraysToBytes;
  1439. exports.assert = assert;
  1440. exports.bytesToString = bytesToString;
  1441. exports.createBlob = createBlob;
  1442. exports.createPromiseCapability = createPromiseCapability;
  1443. exports.createObjectURL = createObjectURL;
  1444. exports.deprecated = deprecated;
  1445. exports.error = error;
  1446. exports.getLookupTableFactory = getLookupTableFactory;
  1447. exports.getVerbosityLevel = getVerbosityLevel;
  1448. exports.globalScope = globalScope;
  1449. exports.info = info;
  1450. exports.isArray = isArray;
  1451. exports.isArrayBuffer = isArrayBuffer;
  1452. exports.isBool = isBool;
  1453. exports.isEmptyObj = isEmptyObj;
  1454. exports.isInt = isInt;
  1455. exports.isNum = isNum;
  1456. exports.isString = isString;
  1457. exports.isSpace = isSpace;
  1458. exports.isNodeJS = isNodeJS;
  1459. exports.isSameOrigin = isSameOrigin;
  1460. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  1461. exports.isLittleEndian = isLittleEndian;
  1462. exports.isEvalSupported = isEvalSupported;
  1463. exports.loadJpegStream = loadJpegStream;
  1464. exports.log2 = log2;
  1465. exports.readInt8 = readInt8;
  1466. exports.readUint16 = readUint16;
  1467. exports.readUint32 = readUint32;
  1468. exports.removeNullCharacters = removeNullCharacters;
  1469. exports.setVerbosityLevel = setVerbosityLevel;
  1470. exports.shadow = shadow;
  1471. exports.string32 = string32;
  1472. exports.stringToBytes = stringToBytes;
  1473. exports.stringToPDFString = stringToPDFString;
  1474. exports.stringToUTF8String = stringToUTF8String;
  1475. exports.utf8StringToString = utf8StringToString;
  1476. exports.warn = warn;
  1477. /* WEBPACK VAR INJECTION */}.call(exports, __w_pdfjs_require__(9)))
  1478. /***/ }),
  1479. /* 1 */
  1480. /***/ (function(module, exports, __w_pdfjs_require__) {
  1481. "use strict";
  1482. var sharedUtil = __w_pdfjs_require__(0);
  1483. var isArray = sharedUtil.isArray;
  1484. var EOF = {};
  1485. var Name = function NameClosure() {
  1486. function Name(name) {
  1487. this.name = name;
  1488. }
  1489. Name.prototype = {};
  1490. var nameCache = Object.create(null);
  1491. Name.get = function Name_get(name) {
  1492. var nameValue = nameCache[name];
  1493. return nameValue ? nameValue : nameCache[name] = new Name(name);
  1494. };
  1495. return Name;
  1496. }();
  1497. var Cmd = function CmdClosure() {
  1498. function Cmd(cmd) {
  1499. this.cmd = cmd;
  1500. }
  1501. Cmd.prototype = {};
  1502. var cmdCache = Object.create(null);
  1503. Cmd.get = function Cmd_get(cmd) {
  1504. var cmdValue = cmdCache[cmd];
  1505. return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd);
  1506. };
  1507. return Cmd;
  1508. }();
  1509. var Dict = function DictClosure() {
  1510. var nonSerializable = function nonSerializableClosure() {
  1511. return nonSerializable;
  1512. };
  1513. function Dict(xref) {
  1514. this.map = Object.create(null);
  1515. this.xref = xref;
  1516. this.objId = null;
  1517. this.suppressEncryption = false;
  1518. this.__nonSerializable__ = nonSerializable;
  1519. }
  1520. Dict.prototype = {
  1521. assignXref: function Dict_assignXref(newXref) {
  1522. this.xref = newXref;
  1523. },
  1524. get: function Dict_get(key1, key2, key3) {
  1525. var value;
  1526. var xref = this.xref, suppressEncryption = this.suppressEncryption;
  1527. if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map || typeof key2 === 'undefined') {
  1528. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  1529. }
  1530. if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map || typeof key3 === 'undefined') {
  1531. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  1532. }
  1533. value = this.map[key3] || null;
  1534. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  1535. },
  1536. getAsync: function Dict_getAsync(key1, key2, key3) {
  1537. var value;
  1538. var xref = this.xref, suppressEncryption = this.suppressEncryption;
  1539. if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map || typeof key2 === 'undefined') {
  1540. if (xref) {
  1541. return xref.fetchIfRefAsync(value, suppressEncryption);
  1542. }
  1543. return Promise.resolve(value);
  1544. }
  1545. if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map || typeof key3 === 'undefined') {
  1546. if (xref) {
  1547. return xref.fetchIfRefAsync(value, suppressEncryption);
  1548. }
  1549. return Promise.resolve(value);
  1550. }
  1551. value = this.map[key3] || null;
  1552. if (xref) {
  1553. return xref.fetchIfRefAsync(value, suppressEncryption);
  1554. }
  1555. return Promise.resolve(value);
  1556. },
  1557. getArray: function Dict_getArray(key1, key2, key3) {
  1558. var value = this.get(key1, key2, key3);
  1559. var xref = this.xref, suppressEncryption = this.suppressEncryption;
  1560. if (!isArray(value) || !xref) {
  1561. return value;
  1562. }
  1563. value = value.slice();
  1564. for (var i = 0, ii = value.length; i < ii; i++) {
  1565. if (!isRef(value[i])) {
  1566. continue;
  1567. }
  1568. value[i] = xref.fetch(value[i], suppressEncryption);
  1569. }
  1570. return value;
  1571. },
  1572. getRaw: function Dict_getRaw(key) {
  1573. return this.map[key];
  1574. },
  1575. getKeys: function Dict_getKeys() {
  1576. return Object.keys(this.map);
  1577. },
  1578. set: function Dict_set(key, value) {
  1579. this.map[key] = value;
  1580. },
  1581. has: function Dict_has(key) {
  1582. return key in this.map;
  1583. },
  1584. forEach: function Dict_forEach(callback) {
  1585. for (var key in this.map) {
  1586. callback(key, this.get(key));
  1587. }
  1588. }
  1589. };
  1590. Dict.empty = new Dict(null);
  1591. Dict.merge = function Dict_merge(xref, dictArray) {
  1592. var mergedDict = new Dict(xref);
  1593. for (var i = 0, ii = dictArray.length; i < ii; i++) {
  1594. var dict = dictArray[i];
  1595. if (!isDict(dict)) {
  1596. continue;
  1597. }
  1598. for (var keyName in dict.map) {
  1599. if (mergedDict.map[keyName]) {
  1600. continue;
  1601. }
  1602. mergedDict.map[keyName] = dict.map[keyName];
  1603. }
  1604. }
  1605. return mergedDict;
  1606. };
  1607. return Dict;
  1608. }();
  1609. var Ref = function RefClosure() {
  1610. function Ref(num, gen) {
  1611. this.num = num;
  1612. this.gen = gen;
  1613. }
  1614. Ref.prototype = {
  1615. toString: function Ref_toString() {
  1616. var str = this.num + 'R';
  1617. if (this.gen !== 0) {
  1618. str += this.gen;
  1619. }
  1620. return str;
  1621. }
  1622. };
  1623. return Ref;
  1624. }();
  1625. var RefSet = function RefSetClosure() {
  1626. function RefSet() {
  1627. this.dict = Object.create(null);
  1628. }
  1629. RefSet.prototype = {
  1630. has: function RefSet_has(ref) {
  1631. return ref.toString() in this.dict;
  1632. },
  1633. put: function RefSet_put(ref) {
  1634. this.dict[ref.toString()] = true;
  1635. },
  1636. remove: function RefSet_remove(ref) {
  1637. delete this.dict[ref.toString()];
  1638. }
  1639. };
  1640. return RefSet;
  1641. }();
  1642. var RefSetCache = function RefSetCacheClosure() {
  1643. function RefSetCache() {
  1644. this.dict = Object.create(null);
  1645. }
  1646. RefSetCache.prototype = {
  1647. get: function RefSetCache_get(ref) {
  1648. return this.dict[ref.toString()];
  1649. },
  1650. has: function RefSetCache_has(ref) {
  1651. return ref.toString() in this.dict;
  1652. },
  1653. put: function RefSetCache_put(ref, obj) {
  1654. this.dict[ref.toString()] = obj;
  1655. },
  1656. putAlias: function RefSetCache_putAlias(ref, aliasRef) {
  1657. this.dict[ref.toString()] = this.get(aliasRef);
  1658. },
  1659. forEach: function RefSetCache_forEach(fn, thisArg) {
  1660. for (var i in this.dict) {
  1661. fn.call(thisArg, this.dict[i]);
  1662. }
  1663. },
  1664. clear: function RefSetCache_clear() {
  1665. this.dict = Object.create(null);
  1666. }
  1667. };
  1668. return RefSetCache;
  1669. }();
  1670. function isEOF(v) {
  1671. return v === EOF;
  1672. }
  1673. function isName(v, name) {
  1674. return v instanceof Name && (name === undefined || v.name === name);
  1675. }
  1676. function isCmd(v, cmd) {
  1677. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  1678. }
  1679. function isDict(v, type) {
  1680. return v instanceof Dict && (type === undefined || isName(v.get('Type'), type));
  1681. }
  1682. function isRef(v) {
  1683. return v instanceof Ref;
  1684. }
  1685. function isRefsEqual(v1, v2) {
  1686. return v1.num === v2.num && v1.gen === v2.gen;
  1687. }
  1688. function isStream(v) {
  1689. return typeof v === 'object' && v !== null && v.getBytes !== undefined;
  1690. }
  1691. exports.EOF = EOF;
  1692. exports.Cmd = Cmd;
  1693. exports.Dict = Dict;
  1694. exports.Name = Name;
  1695. exports.Ref = Ref;
  1696. exports.RefSet = RefSet;
  1697. exports.RefSetCache = RefSetCache;
  1698. exports.isEOF = isEOF;
  1699. exports.isCmd = isCmd;
  1700. exports.isDict = isDict;
  1701. exports.isName = isName;
  1702. exports.isRef = isRef;
  1703. exports.isRefsEqual = isRefsEqual;
  1704. exports.isStream = isStream;
  1705. /***/ }),
  1706. /* 2 */
  1707. /***/ (function(module, exports, __w_pdfjs_require__) {
  1708. "use strict";
  1709. var sharedUtil = __w_pdfjs_require__(0);
  1710. var corePrimitives = __w_pdfjs_require__(1);
  1711. var coreJbig2 = __w_pdfjs_require__(28);
  1712. var coreJpg = __w_pdfjs_require__(29);
  1713. var coreJpx = __w_pdfjs_require__(15);
  1714. var Util = sharedUtil.Util;
  1715. var error = sharedUtil.error;
  1716. var info = sharedUtil.info;
  1717. var isInt = sharedUtil.isInt;
  1718. var isArray = sharedUtil.isArray;
  1719. var createObjectURL = sharedUtil.createObjectURL;
  1720. var shadow = sharedUtil.shadow;
  1721. var isSpace = sharedUtil.isSpace;
  1722. var Dict = corePrimitives.Dict;
  1723. var isDict = corePrimitives.isDict;
  1724. var isStream = corePrimitives.isStream;
  1725. var Jbig2Image = coreJbig2.Jbig2Image;
  1726. var JpegImage = coreJpg.JpegImage;
  1727. var JpxImage = coreJpx.JpxImage;
  1728. var Stream = function StreamClosure() {
  1729. function Stream(arrayBuffer, start, length, dict) {
  1730. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  1731. this.start = start || 0;
  1732. this.pos = this.start;
  1733. this.end = start + length || this.bytes.length;
  1734. this.dict = dict;
  1735. }
  1736. Stream.prototype = {
  1737. get length() {
  1738. return this.end - this.start;
  1739. },
  1740. get isEmpty() {
  1741. return this.length === 0;
  1742. },
  1743. getByte: function Stream_getByte() {
  1744. if (this.pos >= this.end) {
  1745. return -1;
  1746. }
  1747. return this.bytes[this.pos++];
  1748. },
  1749. getUint16: function Stream_getUint16() {
  1750. var b0 = this.getByte();
  1751. var b1 = this.getByte();
  1752. if (b0 === -1 || b1 === -1) {
  1753. return -1;
  1754. }
  1755. return (b0 << 8) + b1;
  1756. },
  1757. getInt32: function Stream_getInt32() {
  1758. var b0 = this.getByte();
  1759. var b1 = this.getByte();
  1760. var b2 = this.getByte();
  1761. var b3 = this.getByte();
  1762. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  1763. },
  1764. getBytes: function Stream_getBytes(length) {
  1765. var bytes = this.bytes;
  1766. var pos = this.pos;
  1767. var strEnd = this.end;
  1768. if (!length) {
  1769. return bytes.subarray(pos, strEnd);
  1770. }
  1771. var end = pos + length;
  1772. if (end > strEnd) {
  1773. end = strEnd;
  1774. }
  1775. this.pos = end;
  1776. return bytes.subarray(pos, end);
  1777. },
  1778. peekByte: function Stream_peekByte() {
  1779. var peekedByte = this.getByte();
  1780. this.pos--;
  1781. return peekedByte;
  1782. },
  1783. peekBytes: function Stream_peekBytes(length) {
  1784. var bytes = this.getBytes(length);
  1785. this.pos -= bytes.length;
  1786. return bytes;
  1787. },
  1788. skip: function Stream_skip(n) {
  1789. if (!n) {
  1790. n = 1;
  1791. }
  1792. this.pos += n;
  1793. },
  1794. reset: function Stream_reset() {
  1795. this.pos = this.start;
  1796. },
  1797. moveStart: function Stream_moveStart() {
  1798. this.start = this.pos;
  1799. },
  1800. makeSubStream: function Stream_makeSubStream(start, length, dict) {
  1801. return new Stream(this.bytes.buffer, start, length, dict);
  1802. }
  1803. };
  1804. return Stream;
  1805. }();
  1806. var StringStream = function StringStreamClosure() {
  1807. function StringStream(str) {
  1808. var length = str.length;
  1809. var bytes = new Uint8Array(length);
  1810. for (var n = 0; n < length; ++n) {
  1811. bytes[n] = str.charCodeAt(n);
  1812. }
  1813. Stream.call(this, bytes);
  1814. }
  1815. StringStream.prototype = Stream.prototype;
  1816. return StringStream;
  1817. }();
  1818. var DecodeStream = function DecodeStreamClosure() {
  1819. var emptyBuffer = new Uint8Array(0);
  1820. function DecodeStream(maybeMinBufferLength) {
  1821. this.pos = 0;
  1822. this.bufferLength = 0;
  1823. this.eof = false;
  1824. this.buffer = emptyBuffer;
  1825. this.minBufferLength = 512;
  1826. if (maybeMinBufferLength) {
  1827. while (this.minBufferLength < maybeMinBufferLength) {
  1828. this.minBufferLength *= 2;
  1829. }
  1830. }
  1831. }
  1832. DecodeStream.prototype = {
  1833. get isEmpty() {
  1834. while (!this.eof && this.bufferLength === 0) {
  1835. this.readBlock();
  1836. }
  1837. return this.bufferLength === 0;
  1838. },
  1839. ensureBuffer: function DecodeStream_ensureBuffer(requested) {
  1840. var buffer = this.buffer;
  1841. if (requested <= buffer.byteLength) {
  1842. return buffer;
  1843. }
  1844. var size = this.minBufferLength;
  1845. while (size < requested) {
  1846. size *= 2;
  1847. }
  1848. var buffer2 = new Uint8Array(size);
  1849. buffer2.set(buffer);
  1850. return this.buffer = buffer2;
  1851. },
  1852. getByte: function DecodeStream_getByte() {
  1853. var pos = this.pos;
  1854. while (this.bufferLength <= pos) {
  1855. if (this.eof) {
  1856. return -1;
  1857. }
  1858. this.readBlock();
  1859. }
  1860. return this.buffer[this.pos++];
  1861. },
  1862. getUint16: function DecodeStream_getUint16() {
  1863. var b0 = this.getByte();
  1864. var b1 = this.getByte();
  1865. if (b0 === -1 || b1 === -1) {
  1866. return -1;
  1867. }
  1868. return (b0 << 8) + b1;
  1869. },
  1870. getInt32: function DecodeStream_getInt32() {
  1871. var b0 = this.getByte();
  1872. var b1 = this.getByte();
  1873. var b2 = this.getByte();
  1874. var b3 = this.getByte();
  1875. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  1876. },
  1877. getBytes: function DecodeStream_getBytes(length) {
  1878. var end, pos = this.pos;
  1879. if (length) {
  1880. this.ensureBuffer(pos + length);
  1881. end = pos + length;
  1882. while (!this.eof && this.bufferLength < end) {
  1883. this.readBlock();
  1884. }
  1885. var bufEnd = this.bufferLength;
  1886. if (end > bufEnd) {
  1887. end = bufEnd;
  1888. }
  1889. } else {
  1890. while (!this.eof) {
  1891. this.readBlock();
  1892. }
  1893. end = this.bufferLength;
  1894. }
  1895. this.pos = end;
  1896. return this.buffer.subarray(pos, end);
  1897. },
  1898. peekByte: function DecodeStream_peekByte() {
  1899. var peekedByte = this.getByte();
  1900. this.pos--;
  1901. return peekedByte;
  1902. },
  1903. peekBytes: function DecodeStream_peekBytes(length) {
  1904. var bytes = this.getBytes(length);
  1905. this.pos -= bytes.length;
  1906. return bytes;
  1907. },
  1908. makeSubStream: function DecodeStream_makeSubStream(start, length, dict) {
  1909. var end = start + length;
  1910. while (this.bufferLength <= end && !this.eof) {
  1911. this.readBlock();
  1912. }
  1913. return new Stream(this.buffer, start, length, dict);
  1914. },
  1915. skip: function DecodeStream_skip(n) {
  1916. if (!n) {
  1917. n = 1;
  1918. }
  1919. this.pos += n;
  1920. },
  1921. reset: function DecodeStream_reset() {
  1922. this.pos = 0;
  1923. },
  1924. getBaseStreams: function DecodeStream_getBaseStreams() {
  1925. if (this.str && this.str.getBaseStreams) {
  1926. return this.str.getBaseStreams();
  1927. }
  1928. return [];
  1929. }
  1930. };
  1931. return DecodeStream;
  1932. }();
  1933. var StreamsSequenceStream = function StreamsSequenceStreamClosure() {
  1934. function StreamsSequenceStream(streams) {
  1935. this.streams = streams;
  1936. DecodeStream.call(this, null);
  1937. }
  1938. StreamsSequenceStream.prototype = Object.create(DecodeStream.prototype);
  1939. StreamsSequenceStream.prototype.readBlock = function streamSequenceStreamReadBlock() {
  1940. var streams = this.streams;
  1941. if (streams.length === 0) {
  1942. this.eof = true;
  1943. return;
  1944. }
  1945. var stream = streams.shift();
  1946. var chunk = stream.getBytes();
  1947. var bufferLength = this.bufferLength;
  1948. var newLength = bufferLength + chunk.length;
  1949. var buffer = this.ensureBuffer(newLength);
  1950. buffer.set(chunk, bufferLength);
  1951. this.bufferLength = newLength;
  1952. };
  1953. StreamsSequenceStream.prototype.getBaseStreams = function StreamsSequenceStream_getBaseStreams() {
  1954. var baseStreams = [];
  1955. for (var i = 0, ii = this.streams.length; i < ii; i++) {
  1956. var stream = this.streams[i];
  1957. if (stream.getBaseStreams) {
  1958. Util.appendToArray(baseStreams, stream.getBaseStreams());
  1959. }
  1960. }
  1961. return baseStreams;
  1962. };
  1963. return StreamsSequenceStream;
  1964. }();
  1965. var FlateStream = function FlateStreamClosure() {
  1966. var codeLenCodeMap = new Int32Array([
  1967. 16,
  1968. 17,
  1969. 18,
  1970. 0,
  1971. 8,
  1972. 7,
  1973. 9,
  1974. 6,
  1975. 10,
  1976. 5,
  1977. 11,
  1978. 4,
  1979. 12,
  1980. 3,
  1981. 13,
  1982. 2,
  1983. 14,
  1984. 1,
  1985. 15
  1986. ]);
  1987. var lengthDecode = new Int32Array([
  1988. 0x00003,
  1989. 0x00004,
  1990. 0x00005,
  1991. 0x00006,
  1992. 0x00007,
  1993. 0x00008,
  1994. 0x00009,
  1995. 0x0000a,
  1996. 0x1000b,
  1997. 0x1000d,
  1998. 0x1000f,
  1999. 0x10011,
  2000. 0x20013,
  2001. 0x20017,
  2002. 0x2001b,
  2003. 0x2001f,
  2004. 0x30023,
  2005. 0x3002b,
  2006. 0x30033,
  2007. 0x3003b,
  2008. 0x40043,
  2009. 0x40053,
  2010. 0x40063,
  2011. 0x40073,
  2012. 0x50083,
  2013. 0x500a3,
  2014. 0x500c3,
  2015. 0x500e3,
  2016. 0x00102,
  2017. 0x00102,
  2018. 0x00102
  2019. ]);
  2020. var distDecode = new Int32Array([
  2021. 0x00001,
  2022. 0x00002,
  2023. 0x00003,
  2024. 0x00004,
  2025. 0x10005,
  2026. 0x10007,
  2027. 0x20009,
  2028. 0x2000d,
  2029. 0x30011,
  2030. 0x30019,
  2031. 0x40021,
  2032. 0x40031,
  2033. 0x50041,
  2034. 0x50061,
  2035. 0x60081,
  2036. 0x600c1,
  2037. 0x70101,
  2038. 0x70181,
  2039. 0x80201,
  2040. 0x80301,
  2041. 0x90401,
  2042. 0x90601,
  2043. 0xa0801,
  2044. 0xa0c01,
  2045. 0xb1001,
  2046. 0xb1801,
  2047. 0xc2001,
  2048. 0xc3001,
  2049. 0xd4001,
  2050. 0xd6001
  2051. ]);
  2052. var fixedLitCodeTab = [
  2053. new Int32Array([
  2054. 0x70100,
  2055. 0x80050,
  2056. 0x80010,
  2057. 0x80118,
  2058. 0x70110,
  2059. 0x80070,
  2060. 0x80030,
  2061. 0x900c0,
  2062. 0x70108,
  2063. 0x80060,
  2064. 0x80020,
  2065. 0x900a0,
  2066. 0x80000,
  2067. 0x80080,
  2068. 0x80040,
  2069. 0x900e0,
  2070. 0x70104,
  2071. 0x80058,
  2072. 0x80018,
  2073. 0x90090,
  2074. 0x70114,
  2075. 0x80078,
  2076. 0x80038,
  2077. 0x900d0,
  2078. 0x7010c,
  2079. 0x80068,
  2080. 0x80028,
  2081. 0x900b0,
  2082. 0x80008,
  2083. 0x80088,
  2084. 0x80048,
  2085. 0x900f0,
  2086. 0x70102,
  2087. 0x80054,
  2088. 0x80014,
  2089. 0x8011c,
  2090. 0x70112,
  2091. 0x80074,
  2092. 0x80034,
  2093. 0x900c8,
  2094. 0x7010a,
  2095. 0x80064,
  2096. 0x80024,
  2097. 0x900a8,
  2098. 0x80004,
  2099. 0x80084,
  2100. 0x80044,
  2101. 0x900e8,
  2102. 0x70106,
  2103. 0x8005c,
  2104. 0x8001c,
  2105. 0x90098,
  2106. 0x70116,
  2107. 0x8007c,
  2108. 0x8003c,
  2109. 0x900d8,
  2110. 0x7010e,
  2111. 0x8006c,
  2112. 0x8002c,
  2113. 0x900b8,
  2114. 0x8000c,
  2115. 0x8008c,
  2116. 0x8004c,
  2117. 0x900f8,
  2118. 0x70101,
  2119. 0x80052,
  2120. 0x80012,
  2121. 0x8011a,
  2122. 0x70111,
  2123. 0x80072,
  2124. 0x80032,
  2125. 0x900c4,
  2126. 0x70109,
  2127. 0x80062,
  2128. 0x80022,
  2129. 0x900a4,
  2130. 0x80002,
  2131. 0x80082,
  2132. 0x80042,
  2133. 0x900e4,
  2134. 0x70105,
  2135. 0x8005a,
  2136. 0x8001a,
  2137. 0x90094,
  2138. 0x70115,
  2139. 0x8007a,
  2140. 0x8003a,
  2141. 0x900d4,
  2142. 0x7010d,
  2143. 0x8006a,
  2144. 0x8002a,
  2145. 0x900b4,
  2146. 0x8000a,
  2147. 0x8008a,
  2148. 0x8004a,
  2149. 0x900f4,
  2150. 0x70103,
  2151. 0x80056,
  2152. 0x80016,
  2153. 0x8011e,
  2154. 0x70113,
  2155. 0x80076,
  2156. 0x80036,
  2157. 0x900cc,
  2158. 0x7010b,
  2159. 0x80066,
  2160. 0x80026,
  2161. 0x900ac,
  2162. 0x80006,
  2163. 0x80086,
  2164. 0x80046,
  2165. 0x900ec,
  2166. 0x70107,
  2167. 0x8005e,
  2168. 0x8001e,
  2169. 0x9009c,
  2170. 0x70117,
  2171. 0x8007e,
  2172. 0x8003e,
  2173. 0x900dc,
  2174. 0x7010f,
  2175. 0x8006e,
  2176. 0x8002e,
  2177. 0x900bc,
  2178. 0x8000e,
  2179. 0x8008e,
  2180. 0x8004e,
  2181. 0x900fc,
  2182. 0x70100,
  2183. 0x80051,
  2184. 0x80011,
  2185. 0x80119,
  2186. 0x70110,
  2187. 0x80071,
  2188. 0x80031,
  2189. 0x900c2,
  2190. 0x70108,
  2191. 0x80061,
  2192. 0x80021,
  2193. 0x900a2,
  2194. 0x80001,
  2195. 0x80081,
  2196. 0x80041,
  2197. 0x900e2,
  2198. 0x70104,
  2199. 0x80059,
  2200. 0x80019,
  2201. 0x90092,
  2202. 0x70114,
  2203. 0x80079,
  2204. 0x80039,
  2205. 0x900d2,
  2206. 0x7010c,
  2207. 0x80069,
  2208. 0x80029,
  2209. 0x900b2,
  2210. 0x80009,
  2211. 0x80089,
  2212. 0x80049,
  2213. 0x900f2,
  2214. 0x70102,
  2215. 0x80055,
  2216. 0x80015,
  2217. 0x8011d,
  2218. 0x70112,
  2219. 0x80075,
  2220. 0x80035,
  2221. 0x900ca,
  2222. 0x7010a,
  2223. 0x80065,
  2224. 0x80025,
  2225. 0x900aa,
  2226. 0x80005,
  2227. 0x80085,
  2228. 0x80045,
  2229. 0x900ea,
  2230. 0x70106,
  2231. 0x8005d,
  2232. 0x8001d,
  2233. 0x9009a,
  2234. 0x70116,
  2235. 0x8007d,
  2236. 0x8003d,
  2237. 0x900da,
  2238. 0x7010e,
  2239. 0x8006d,
  2240. 0x8002d,
  2241. 0x900ba,
  2242. 0x8000d,
  2243. 0x8008d,
  2244. 0x8004d,
  2245. 0x900fa,
  2246. 0x70101,
  2247. 0x80053,
  2248. 0x80013,
  2249. 0x8011b,
  2250. 0x70111,
  2251. 0x80073,
  2252. 0x80033,
  2253. 0x900c6,
  2254. 0x70109,
  2255. 0x80063,
  2256. 0x80023,
  2257. 0x900a6,
  2258. 0x80003,
  2259. 0x80083,
  2260. 0x80043,
  2261. 0x900e6,
  2262. 0x70105,
  2263. 0x8005b,
  2264. 0x8001b,
  2265. 0x90096,
  2266. 0x70115,
  2267. 0x8007b,
  2268. 0x8003b,
  2269. 0x900d6,
  2270. 0x7010d,
  2271. 0x8006b,
  2272. 0x8002b,
  2273. 0x900b6,
  2274. 0x8000b,
  2275. 0x8008b,
  2276. 0x8004b,
  2277. 0x900f6,
  2278. 0x70103,
  2279. 0x80057,
  2280. 0x80017,
  2281. 0x8011f,
  2282. 0x70113,
  2283. 0x80077,
  2284. 0x80037,
  2285. 0x900ce,
  2286. 0x7010b,
  2287. 0x80067,
  2288. 0x80027,
  2289. 0x900ae,
  2290. 0x80007,
  2291. 0x80087,
  2292. 0x80047,
  2293. 0x900ee,
  2294. 0x70107,
  2295. 0x8005f,
  2296. 0x8001f,
  2297. 0x9009e,
  2298. 0x70117,
  2299. 0x8007f,
  2300. 0x8003f,
  2301. 0x900de,
  2302. 0x7010f,
  2303. 0x8006f,
  2304. 0x8002f,
  2305. 0x900be,
  2306. 0x8000f,
  2307. 0x8008f,
  2308. 0x8004f,
  2309. 0x900fe,
  2310. 0x70100,
  2311. 0x80050,
  2312. 0x80010,
  2313. 0x80118,
  2314. 0x70110,
  2315. 0x80070,
  2316. 0x80030,
  2317. 0x900c1,
  2318. 0x70108,
  2319. 0x80060,
  2320. 0x80020,
  2321. 0x900a1,
  2322. 0x80000,
  2323. 0x80080,
  2324. 0x80040,
  2325. 0x900e1,
  2326. 0x70104,
  2327. 0x80058,
  2328. 0x80018,
  2329. 0x90091,
  2330. 0x70114,
  2331. 0x80078,
  2332. 0x80038,
  2333. 0x900d1,
  2334. 0x7010c,
  2335. 0x80068,
  2336. 0x80028,
  2337. 0x900b1,
  2338. 0x80008,
  2339. 0x80088,
  2340. 0x80048,
  2341. 0x900f1,
  2342. 0x70102,
  2343. 0x80054,
  2344. 0x80014,
  2345. 0x8011c,
  2346. 0x70112,
  2347. 0x80074,
  2348. 0x80034,
  2349. 0x900c9,
  2350. 0x7010a,
  2351. 0x80064,
  2352. 0x80024,
  2353. 0x900a9,
  2354. 0x80004,
  2355. 0x80084,
  2356. 0x80044,
  2357. 0x900e9,
  2358. 0x70106,
  2359. 0x8005c,
  2360. 0x8001c,
  2361. 0x90099,
  2362. 0x70116,
  2363. 0x8007c,
  2364. 0x8003c,
  2365. 0x900d9,
  2366. 0x7010e,
  2367. 0x8006c,
  2368. 0x8002c,
  2369. 0x900b9,
  2370. 0x8000c,
  2371. 0x8008c,
  2372. 0x8004c,
  2373. 0x900f9,
  2374. 0x70101,
  2375. 0x80052,
  2376. 0x80012,
  2377. 0x8011a,
  2378. 0x70111,
  2379. 0x80072,
  2380. 0x80032,
  2381. 0x900c5,
  2382. 0x70109,
  2383. 0x80062,
  2384. 0x80022,
  2385. 0x900a5,
  2386. 0x80002,
  2387. 0x80082,
  2388. 0x80042,
  2389. 0x900e5,
  2390. 0x70105,
  2391. 0x8005a,
  2392. 0x8001a,
  2393. 0x90095,
  2394. 0x70115,
  2395. 0x8007a,
  2396. 0x8003a,
  2397. 0x900d5,
  2398. 0x7010d,
  2399. 0x8006a,
  2400. 0x8002a,
  2401. 0x900b5,
  2402. 0x8000a,
  2403. 0x8008a,
  2404. 0x8004a,
  2405. 0x900f5,
  2406. 0x70103,
  2407. 0x80056,
  2408. 0x80016,
  2409. 0x8011e,
  2410. 0x70113,
  2411. 0x80076,
  2412. 0x80036,
  2413. 0x900cd,
  2414. 0x7010b,
  2415. 0x80066,
  2416. 0x80026,
  2417. 0x900ad,
  2418. 0x80006,
  2419. 0x80086,
  2420. 0x80046,
  2421. 0x900ed,
  2422. 0x70107,
  2423. 0x8005e,
  2424. 0x8001e,
  2425. 0x9009d,
  2426. 0x70117,
  2427. 0x8007e,
  2428. 0x8003e,
  2429. 0x900dd,
  2430. 0x7010f,
  2431. 0x8006e,
  2432. 0x8002e,
  2433. 0x900bd,
  2434. 0x8000e,
  2435. 0x8008e,
  2436. 0x8004e,
  2437. 0x900fd,
  2438. 0x70100,
  2439. 0x80051,
  2440. 0x80011,
  2441. 0x80119,
  2442. 0x70110,
  2443. 0x80071,
  2444. 0x80031,
  2445. 0x900c3,
  2446. 0x70108,
  2447. 0x80061,
  2448. 0x80021,
  2449. 0x900a3,
  2450. 0x80001,
  2451. 0x80081,
  2452. 0x80041,
  2453. 0x900e3,
  2454. 0x70104,
  2455. 0x80059,
  2456. 0x80019,
  2457. 0x90093,
  2458. 0x70114,
  2459. 0x80079,
  2460. 0x80039,
  2461. 0x900d3,
  2462. 0x7010c,
  2463. 0x80069,
  2464. 0x80029,
  2465. 0x900b3,
  2466. 0x80009,
  2467. 0x80089,
  2468. 0x80049,
  2469. 0x900f3,
  2470. 0x70102,
  2471. 0x80055,
  2472. 0x80015,
  2473. 0x8011d,
  2474. 0x70112,
  2475. 0x80075,
  2476. 0x80035,
  2477. 0x900cb,
  2478. 0x7010a,
  2479. 0x80065,
  2480. 0x80025,
  2481. 0x900ab,
  2482. 0x80005,
  2483. 0x80085,
  2484. 0x80045,
  2485. 0x900eb,
  2486. 0x70106,
  2487. 0x8005d,
  2488. 0x8001d,
  2489. 0x9009b,
  2490. 0x70116,
  2491. 0x8007d,
  2492. 0x8003d,
  2493. 0x900db,
  2494. 0x7010e,
  2495. 0x8006d,
  2496. 0x8002d,
  2497. 0x900bb,
  2498. 0x8000d,
  2499. 0x8008d,
  2500. 0x8004d,
  2501. 0x900fb,
  2502. 0x70101,
  2503. 0x80053,
  2504. 0x80013,
  2505. 0x8011b,
  2506. 0x70111,
  2507. 0x80073,
  2508. 0x80033,
  2509. 0x900c7,
  2510. 0x70109,
  2511. 0x80063,
  2512. 0x80023,
  2513. 0x900a7,
  2514. 0x80003,
  2515. 0x80083,
  2516. 0x80043,
  2517. 0x900e7,
  2518. 0x70105,
  2519. 0x8005b,
  2520. 0x8001b,
  2521. 0x90097,
  2522. 0x70115,
  2523. 0x8007b,
  2524. 0x8003b,
  2525. 0x900d7,
  2526. 0x7010d,
  2527. 0x8006b,
  2528. 0x8002b,
  2529. 0x900b7,
  2530. 0x8000b,
  2531. 0x8008b,
  2532. 0x8004b,
  2533. 0x900f7,
  2534. 0x70103,
  2535. 0x80057,
  2536. 0x80017,
  2537. 0x8011f,
  2538. 0x70113,
  2539. 0x80077,
  2540. 0x80037,
  2541. 0x900cf,
  2542. 0x7010b,
  2543. 0x80067,
  2544. 0x80027,
  2545. 0x900af,
  2546. 0x80007,
  2547. 0x80087,
  2548. 0x80047,
  2549. 0x900ef,
  2550. 0x70107,
  2551. 0x8005f,
  2552. 0x8001f,
  2553. 0x9009f,
  2554. 0x70117,
  2555. 0x8007f,
  2556. 0x8003f,
  2557. 0x900df,
  2558. 0x7010f,
  2559. 0x8006f,
  2560. 0x8002f,
  2561. 0x900bf,
  2562. 0x8000f,
  2563. 0x8008f,
  2564. 0x8004f,
  2565. 0x900ff
  2566. ]),
  2567. 9
  2568. ];
  2569. var fixedDistCodeTab = [
  2570. new Int32Array([
  2571. 0x50000,
  2572. 0x50010,
  2573. 0x50008,
  2574. 0x50018,
  2575. 0x50004,
  2576. 0x50014,
  2577. 0x5000c,
  2578. 0x5001c,
  2579. 0x50002,
  2580. 0x50012,
  2581. 0x5000a,
  2582. 0x5001a,
  2583. 0x50006,
  2584. 0x50016,
  2585. 0x5000e,
  2586. 0x00000,
  2587. 0x50001,
  2588. 0x50011,
  2589. 0x50009,
  2590. 0x50019,
  2591. 0x50005,
  2592. 0x50015,
  2593. 0x5000d,
  2594. 0x5001d,
  2595. 0x50003,
  2596. 0x50013,
  2597. 0x5000b,
  2598. 0x5001b,
  2599. 0x50007,
  2600. 0x50017,
  2601. 0x5000f,
  2602. 0x00000
  2603. ]),
  2604. 5
  2605. ];
  2606. function FlateStream(str, maybeLength) {
  2607. this.str = str;
  2608. this.dict = str.dict;
  2609. var cmf = str.getByte();
  2610. var flg = str.getByte();
  2611. if (cmf === -1 || flg === -1) {
  2612. error('Invalid header in flate stream: ' + cmf + ', ' + flg);
  2613. }
  2614. if ((cmf & 0x0f) !== 0x08) {
  2615. error('Unknown compression method in flate stream: ' + cmf + ', ' + flg);
  2616. }
  2617. if (((cmf << 8) + flg) % 31 !== 0) {
  2618. error('Bad FCHECK in flate stream: ' + cmf + ', ' + flg);
  2619. }
  2620. if (flg & 0x20) {
  2621. error('FDICT bit set in flate stream: ' + cmf + ', ' + flg);
  2622. }
  2623. this.codeSize = 0;
  2624. this.codeBuf = 0;
  2625. DecodeStream.call(this, maybeLength);
  2626. }
  2627. FlateStream.prototype = Object.create(DecodeStream.prototype);
  2628. FlateStream.prototype.getBits = function FlateStream_getBits(bits) {
  2629. var str = this.str;
  2630. var codeSize = this.codeSize;
  2631. var codeBuf = this.codeBuf;
  2632. var b;
  2633. while (codeSize < bits) {
  2634. if ((b = str.getByte()) === -1) {
  2635. error('Bad encoding in flate stream');
  2636. }
  2637. codeBuf |= b << codeSize;
  2638. codeSize += 8;
  2639. }
  2640. b = codeBuf & (1 << bits) - 1;
  2641. this.codeBuf = codeBuf >> bits;
  2642. this.codeSize = codeSize -= bits;
  2643. return b;
  2644. };
  2645. FlateStream.prototype.getCode = function FlateStream_getCode(table) {
  2646. var str = this.str;
  2647. var codes = table[0];
  2648. var maxLen = table[1];
  2649. var codeSize = this.codeSize;
  2650. var codeBuf = this.codeBuf;
  2651. var b;
  2652. while (codeSize < maxLen) {
  2653. if ((b = str.getByte()) === -1) {
  2654. break;
  2655. }
  2656. codeBuf |= b << codeSize;
  2657. codeSize += 8;
  2658. }
  2659. var code = codes[codeBuf & (1 << maxLen) - 1];
  2660. var codeLen = code >> 16;
  2661. var codeVal = code & 0xffff;
  2662. if (codeLen < 1 || codeSize < codeLen) {
  2663. error('Bad encoding in flate stream');
  2664. }
  2665. this.codeBuf = codeBuf >> codeLen;
  2666. this.codeSize = codeSize - codeLen;
  2667. return codeVal;
  2668. };
  2669. FlateStream.prototype.generateHuffmanTable = function flateStreamGenerateHuffmanTable(lengths) {
  2670. var n = lengths.length;
  2671. var maxLen = 0;
  2672. var i;
  2673. for (i = 0; i < n; ++i) {
  2674. if (lengths[i] > maxLen) {
  2675. maxLen = lengths[i];
  2676. }
  2677. }
  2678. var size = 1 << maxLen;
  2679. var codes = new Int32Array(size);
  2680. for (var len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  2681. for (var val = 0; val < n; ++val) {
  2682. if (lengths[val] === len) {
  2683. var code2 = 0;
  2684. var t = code;
  2685. for (i = 0; i < len; ++i) {
  2686. code2 = code2 << 1 | t & 1;
  2687. t >>= 1;
  2688. }
  2689. for (i = code2; i < size; i += skip) {
  2690. codes[i] = len << 16 | val;
  2691. }
  2692. ++code;
  2693. }
  2694. }
  2695. }
  2696. return [
  2697. codes,
  2698. maxLen
  2699. ];
  2700. };
  2701. FlateStream.prototype.readBlock = function FlateStream_readBlock() {
  2702. var buffer, len;
  2703. var str = this.str;
  2704. var hdr = this.getBits(3);
  2705. if (hdr & 1) {
  2706. this.eof = true;
  2707. }
  2708. hdr >>= 1;
  2709. if (hdr === 0) {
  2710. var b;
  2711. if ((b = str.getByte()) === -1) {
  2712. error('Bad block header in flate stream');
  2713. }
  2714. var blockLen = b;
  2715. if ((b = str.getByte()) === -1) {
  2716. error('Bad block header in flate stream');
  2717. }
  2718. blockLen |= b << 8;
  2719. if ((b = str.getByte()) === -1) {
  2720. error('Bad block header in flate stream');
  2721. }
  2722. var check = b;
  2723. if ((b = str.getByte()) === -1) {
  2724. error('Bad block header in flate stream');
  2725. }
  2726. check |= b << 8;
  2727. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  2728. error('Bad uncompressed block length in flate stream');
  2729. }
  2730. this.codeBuf = 0;
  2731. this.codeSize = 0;
  2732. var bufferLength = this.bufferLength;
  2733. buffer = this.ensureBuffer(bufferLength + blockLen);
  2734. var end = bufferLength + blockLen;
  2735. this.bufferLength = end;
  2736. if (blockLen === 0) {
  2737. if (str.peekByte() === -1) {
  2738. this.eof = true;
  2739. }
  2740. } else {
  2741. for (var n = bufferLength; n < end; ++n) {
  2742. if ((b = str.getByte()) === -1) {
  2743. this.eof = true;
  2744. break;
  2745. }
  2746. buffer[n] = b;
  2747. }
  2748. }
  2749. return;
  2750. }
  2751. var litCodeTable;
  2752. var distCodeTable;
  2753. if (hdr === 1) {
  2754. litCodeTable = fixedLitCodeTab;
  2755. distCodeTable = fixedDistCodeTab;
  2756. } else if (hdr === 2) {
  2757. var numLitCodes = this.getBits(5) + 257;
  2758. var numDistCodes = this.getBits(5) + 1;
  2759. var numCodeLenCodes = this.getBits(4) + 4;
  2760. var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  2761. var i;
  2762. for (i = 0; i < numCodeLenCodes; ++i) {
  2763. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  2764. }
  2765. var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  2766. len = 0;
  2767. i = 0;
  2768. var codes = numLitCodes + numDistCodes;
  2769. var codeLengths = new Uint8Array(codes);
  2770. var bitsLength, bitsOffset, what;
  2771. while (i < codes) {
  2772. var code = this.getCode(codeLenCodeTab);
  2773. if (code === 16) {
  2774. bitsLength = 2;
  2775. bitsOffset = 3;
  2776. what = len;
  2777. } else if (code === 17) {
  2778. bitsLength = 3;
  2779. bitsOffset = 3;
  2780. what = len = 0;
  2781. } else if (code === 18) {
  2782. bitsLength = 7;
  2783. bitsOffset = 11;
  2784. what = len = 0;
  2785. } else {
  2786. codeLengths[i++] = len = code;
  2787. continue;
  2788. }
  2789. var repeatLength = this.getBits(bitsLength) + bitsOffset;
  2790. while (repeatLength-- > 0) {
  2791. codeLengths[i++] = what;
  2792. }
  2793. }
  2794. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  2795. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  2796. } else {
  2797. error('Unknown block type in flate stream');
  2798. }
  2799. buffer = this.buffer;
  2800. var limit = buffer ? buffer.length : 0;
  2801. var pos = this.bufferLength;
  2802. while (true) {
  2803. var code1 = this.getCode(litCodeTable);
  2804. if (code1 < 256) {
  2805. if (pos + 1 >= limit) {
  2806. buffer = this.ensureBuffer(pos + 1);
  2807. limit = buffer.length;
  2808. }
  2809. buffer[pos++] = code1;
  2810. continue;
  2811. }
  2812. if (code1 === 256) {
  2813. this.bufferLength = pos;
  2814. return;
  2815. }
  2816. code1 -= 257;
  2817. code1 = lengthDecode[code1];
  2818. var code2 = code1 >> 16;
  2819. if (code2 > 0) {
  2820. code2 = this.getBits(code2);
  2821. }
  2822. len = (code1 & 0xffff) + code2;
  2823. code1 = this.getCode(distCodeTable);
  2824. code1 = distDecode[code1];
  2825. code2 = code1 >> 16;
  2826. if (code2 > 0) {
  2827. code2 = this.getBits(code2);
  2828. }
  2829. var dist = (code1 & 0xffff) + code2;
  2830. if (pos + len >= limit) {
  2831. buffer = this.ensureBuffer(pos + len);
  2832. limit = buffer.length;
  2833. }
  2834. for (var k = 0; k < len; ++k, ++pos) {
  2835. buffer[pos] = buffer[pos - dist];
  2836. }
  2837. }
  2838. };
  2839. return FlateStream;
  2840. }();
  2841. var PredictorStream = function PredictorStreamClosure() {
  2842. function PredictorStream(str, maybeLength, params) {
  2843. if (!isDict(params)) {
  2844. return str;
  2845. }
  2846. var predictor = this.predictor = params.get('Predictor') || 1;
  2847. if (predictor <= 1) {
  2848. return str;
  2849. }
  2850. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  2851. error('Unsupported predictor: ' + predictor);
  2852. }
  2853. if (predictor === 2) {
  2854. this.readBlock = this.readBlockTiff;
  2855. } else {
  2856. this.readBlock = this.readBlockPng;
  2857. }
  2858. this.str = str;
  2859. this.dict = str.dict;
  2860. var colors = this.colors = params.get('Colors') || 1;
  2861. var bits = this.bits = params.get('BitsPerComponent') || 8;
  2862. var columns = this.columns = params.get('Columns') || 1;
  2863. this.pixBytes = colors * bits + 7 >> 3;
  2864. this.rowBytes = columns * colors * bits + 7 >> 3;
  2865. DecodeStream.call(this, maybeLength);
  2866. return this;
  2867. }
  2868. PredictorStream.prototype = Object.create(DecodeStream.prototype);
  2869. PredictorStream.prototype.readBlockTiff = function predictorStreamReadBlockTiff() {
  2870. var rowBytes = this.rowBytes;
  2871. var bufferLength = this.bufferLength;
  2872. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  2873. var bits = this.bits;
  2874. var colors = this.colors;
  2875. var rawBytes = this.str.getBytes(rowBytes);
  2876. this.eof = !rawBytes.length;
  2877. if (this.eof) {
  2878. return;
  2879. }
  2880. var inbuf = 0, outbuf = 0;
  2881. var inbits = 0, outbits = 0;
  2882. var pos = bufferLength;
  2883. var i;
  2884. if (bits === 1 && colors === 1) {
  2885. for (i = 0; i < rowBytes; ++i) {
  2886. var c = rawBytes[i] ^ inbuf;
  2887. c ^= c >> 1;
  2888. c ^= c >> 2;
  2889. c ^= c >> 4;
  2890. inbuf = (c & 1) << 7;
  2891. buffer[pos++] = c;
  2892. }
  2893. } else if (bits === 8) {
  2894. for (i = 0; i < colors; ++i) {
  2895. buffer[pos++] = rawBytes[i];
  2896. }
  2897. for (; i < rowBytes; ++i) {
  2898. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  2899. pos++;
  2900. }
  2901. } else {
  2902. var compArray = new Uint8Array(colors + 1);
  2903. var bitMask = (1 << bits) - 1;
  2904. var j = 0, k = bufferLength;
  2905. var columns = this.columns;
  2906. for (i = 0; i < columns; ++i) {
  2907. for (var kk = 0; kk < colors; ++kk) {
  2908. if (inbits < bits) {
  2909. inbuf = inbuf << 8 | rawBytes[j++] & 0xFF;
  2910. inbits += 8;
  2911. }
  2912. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  2913. inbits -= bits;
  2914. outbuf = outbuf << bits | compArray[kk];
  2915. outbits += bits;
  2916. if (outbits >= 8) {
  2917. buffer[k++] = outbuf >> outbits - 8 & 0xFF;
  2918. outbits -= 8;
  2919. }
  2920. }
  2921. }
  2922. if (outbits > 0) {
  2923. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  2924. }
  2925. }
  2926. this.bufferLength += rowBytes;
  2927. };
  2928. PredictorStream.prototype.readBlockPng = function predictorStreamReadBlockPng() {
  2929. var rowBytes = this.rowBytes;
  2930. var pixBytes = this.pixBytes;
  2931. var predictor = this.str.getByte();
  2932. var rawBytes = this.str.getBytes(rowBytes);
  2933. this.eof = !rawBytes.length;
  2934. if (this.eof) {
  2935. return;
  2936. }
  2937. var bufferLength = this.bufferLength;
  2938. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  2939. var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  2940. if (prevRow.length === 0) {
  2941. prevRow = new Uint8Array(rowBytes);
  2942. }
  2943. var i, j = bufferLength, up, c;
  2944. switch (predictor) {
  2945. case 0:
  2946. for (i = 0; i < rowBytes; ++i) {
  2947. buffer[j++] = rawBytes[i];
  2948. }
  2949. break;
  2950. case 1:
  2951. for (i = 0; i < pixBytes; ++i) {
  2952. buffer[j++] = rawBytes[i];
  2953. }
  2954. for (; i < rowBytes; ++i) {
  2955. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xFF;
  2956. j++;
  2957. }
  2958. break;
  2959. case 2:
  2960. for (i = 0; i < rowBytes; ++i) {
  2961. buffer[j++] = prevRow[i] + rawBytes[i] & 0xFF;
  2962. }
  2963. break;
  2964. case 3:
  2965. for (i = 0; i < pixBytes; ++i) {
  2966. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  2967. }
  2968. for (; i < rowBytes; ++i) {
  2969. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xFF;
  2970. j++;
  2971. }
  2972. break;
  2973. case 4:
  2974. for (i = 0; i < pixBytes; ++i) {
  2975. up = prevRow[i];
  2976. c = rawBytes[i];
  2977. buffer[j++] = up + c;
  2978. }
  2979. for (; i < rowBytes; ++i) {
  2980. up = prevRow[i];
  2981. var upLeft = prevRow[i - pixBytes];
  2982. var left = buffer[j - pixBytes];
  2983. var p = left + up - upLeft;
  2984. var pa = p - left;
  2985. if (pa < 0) {
  2986. pa = -pa;
  2987. }
  2988. var pb = p - up;
  2989. if (pb < 0) {
  2990. pb = -pb;
  2991. }
  2992. var pc = p - upLeft;
  2993. if (pc < 0) {
  2994. pc = -pc;
  2995. }
  2996. c = rawBytes[i];
  2997. if (pa <= pb && pa <= pc) {
  2998. buffer[j++] = left + c;
  2999. } else if (pb <= pc) {
  3000. buffer[j++] = up + c;
  3001. } else {
  3002. buffer[j++] = upLeft + c;
  3003. }
  3004. }
  3005. break;
  3006. default:
  3007. error('Unsupported predictor: ' + predictor);
  3008. }
  3009. this.bufferLength += rowBytes;
  3010. };
  3011. return PredictorStream;
  3012. }();
  3013. var JpegStream = function JpegStreamClosure() {
  3014. function JpegStream(stream, maybeLength, dict, params) {
  3015. var ch;
  3016. while ((ch = stream.getByte()) !== -1) {
  3017. if (ch === 0xFF) {
  3018. stream.skip(-1);
  3019. break;
  3020. }
  3021. }
  3022. this.stream = stream;
  3023. this.maybeLength = maybeLength;
  3024. this.dict = dict;
  3025. this.params = params;
  3026. DecodeStream.call(this, maybeLength);
  3027. }
  3028. JpegStream.prototype = Object.create(DecodeStream.prototype);
  3029. Object.defineProperty(JpegStream.prototype, 'bytes', {
  3030. get: function JpegStream_bytes() {
  3031. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  3032. },
  3033. configurable: true
  3034. });
  3035. JpegStream.prototype.ensureBuffer = function JpegStream_ensureBuffer(req) {
  3036. if (this.bufferLength) {
  3037. return;
  3038. }
  3039. var jpegImage = new JpegImage();
  3040. var decodeArr = this.dict.getArray('Decode', 'D');
  3041. if (this.forceRGB && isArray(decodeArr)) {
  3042. var bitsPerComponent = this.dict.get('BitsPerComponent') || 8;
  3043. var decodeArrLength = decodeArr.length;
  3044. var transform = new Int32Array(decodeArrLength);
  3045. var transformNeeded = false;
  3046. var maxValue = (1 << bitsPerComponent) - 1;
  3047. for (var i = 0; i < decodeArrLength; i += 2) {
  3048. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  3049. transform[i + 1] = decodeArr[i] * maxValue | 0;
  3050. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  3051. transformNeeded = true;
  3052. }
  3053. }
  3054. if (transformNeeded) {
  3055. jpegImage.decodeTransform = transform;
  3056. }
  3057. }
  3058. if (isDict(this.params)) {
  3059. var colorTransform = this.params.get('ColorTransform');
  3060. if (isInt(colorTransform)) {
  3061. jpegImage.colorTransform = colorTransform;
  3062. }
  3063. }
  3064. jpegImage.parse(this.bytes);
  3065. var data = jpegImage.getData(this.drawWidth, this.drawHeight, this.forceRGB);
  3066. this.buffer = data;
  3067. this.bufferLength = data.length;
  3068. this.eof = true;
  3069. };
  3070. JpegStream.prototype.getBytes = function JpegStream_getBytes(length) {
  3071. this.ensureBuffer();
  3072. return this.buffer;
  3073. };
  3074. JpegStream.prototype.getIR = function JpegStream_getIR(forceDataSchema) {
  3075. return createObjectURL(this.bytes, 'image/jpeg', forceDataSchema);
  3076. };
  3077. return JpegStream;
  3078. }();
  3079. var JpxStream = function JpxStreamClosure() {
  3080. function JpxStream(stream, maybeLength, dict, params) {
  3081. this.stream = stream;
  3082. this.maybeLength = maybeLength;
  3083. this.dict = dict;
  3084. this.params = params;
  3085. DecodeStream.call(this, maybeLength);
  3086. }
  3087. JpxStream.prototype = Object.create(DecodeStream.prototype);
  3088. Object.defineProperty(JpxStream.prototype, 'bytes', {
  3089. get: function JpxStream_bytes() {
  3090. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  3091. },
  3092. configurable: true
  3093. });
  3094. JpxStream.prototype.ensureBuffer = function JpxStream_ensureBuffer(req) {
  3095. if (this.bufferLength) {
  3096. return;
  3097. }
  3098. var jpxImage = new JpxImage();
  3099. jpxImage.parse(this.bytes);
  3100. var width = jpxImage.width;
  3101. var height = jpxImage.height;
  3102. var componentsCount = jpxImage.componentsCount;
  3103. var tileCount = jpxImage.tiles.length;
  3104. if (tileCount === 1) {
  3105. this.buffer = jpxImage.tiles[0].items;
  3106. } else {
  3107. var data = new Uint8Array(width * height * componentsCount);
  3108. for (var k = 0; k < tileCount; k++) {
  3109. var tileComponents = jpxImage.tiles[k];
  3110. var tileWidth = tileComponents.width;
  3111. var tileHeight = tileComponents.height;
  3112. var tileLeft = tileComponents.left;
  3113. var tileTop = tileComponents.top;
  3114. var src = tileComponents.items;
  3115. var srcPosition = 0;
  3116. var dataPosition = (width * tileTop + tileLeft) * componentsCount;
  3117. var imgRowSize = width * componentsCount;
  3118. var tileRowSize = tileWidth * componentsCount;
  3119. for (var j = 0; j < tileHeight; j++) {
  3120. var rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  3121. data.set(rowBytes, dataPosition);
  3122. srcPosition += tileRowSize;
  3123. dataPosition += imgRowSize;
  3124. }
  3125. }
  3126. this.buffer = data;
  3127. }
  3128. this.bufferLength = this.buffer.length;
  3129. this.eof = true;
  3130. };
  3131. return JpxStream;
  3132. }();
  3133. var Jbig2Stream = function Jbig2StreamClosure() {
  3134. function Jbig2Stream(stream, maybeLength, dict, params) {
  3135. this.stream = stream;
  3136. this.maybeLength = maybeLength;
  3137. this.dict = dict;
  3138. this.params = params;
  3139. DecodeStream.call(this, maybeLength);
  3140. }
  3141. Jbig2Stream.prototype = Object.create(DecodeStream.prototype);
  3142. Object.defineProperty(Jbig2Stream.prototype, 'bytes', {
  3143. get: function Jbig2Stream_bytes() {
  3144. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  3145. },
  3146. configurable: true
  3147. });
  3148. Jbig2Stream.prototype.ensureBuffer = function Jbig2Stream_ensureBuffer(req) {
  3149. if (this.bufferLength) {
  3150. return;
  3151. }
  3152. var jbig2Image = new Jbig2Image();
  3153. var chunks = [];
  3154. if (isDict(this.params)) {
  3155. var globalsStream = this.params.get('JBIG2Globals');
  3156. if (isStream(globalsStream)) {
  3157. var globals = globalsStream.getBytes();
  3158. chunks.push({
  3159. data: globals,
  3160. start: 0,
  3161. end: globals.length
  3162. });
  3163. }
  3164. }
  3165. chunks.push({
  3166. data: this.bytes,
  3167. start: 0,
  3168. end: this.bytes.length
  3169. });
  3170. var data = jbig2Image.parseChunks(chunks);
  3171. var dataLength = data.length;
  3172. for (var i = 0; i < dataLength; i++) {
  3173. data[i] ^= 0xFF;
  3174. }
  3175. this.buffer = data;
  3176. this.bufferLength = dataLength;
  3177. this.eof = true;
  3178. };
  3179. return Jbig2Stream;
  3180. }();
  3181. var DecryptStream = function DecryptStreamClosure() {
  3182. function DecryptStream(str, maybeLength, decrypt) {
  3183. this.str = str;
  3184. this.dict = str.dict;
  3185. this.decrypt = decrypt;
  3186. this.nextChunk = null;
  3187. this.initialized = false;
  3188. DecodeStream.call(this, maybeLength);
  3189. }
  3190. var chunkSize = 512;
  3191. DecryptStream.prototype = Object.create(DecodeStream.prototype);
  3192. DecryptStream.prototype.readBlock = function DecryptStream_readBlock() {
  3193. var chunk;
  3194. if (this.initialized) {
  3195. chunk = this.nextChunk;
  3196. } else {
  3197. chunk = this.str.getBytes(chunkSize);
  3198. this.initialized = true;
  3199. }
  3200. if (!chunk || chunk.length === 0) {
  3201. this.eof = true;
  3202. return;
  3203. }
  3204. this.nextChunk = this.str.getBytes(chunkSize);
  3205. var hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  3206. var decrypt = this.decrypt;
  3207. chunk = decrypt(chunk, !hasMoreData);
  3208. var bufferLength = this.bufferLength;
  3209. var i, n = chunk.length;
  3210. var buffer = this.ensureBuffer(bufferLength + n);
  3211. for (i = 0; i < n; i++) {
  3212. buffer[bufferLength++] = chunk[i];
  3213. }
  3214. this.bufferLength = bufferLength;
  3215. };
  3216. return DecryptStream;
  3217. }();
  3218. var Ascii85Stream = function Ascii85StreamClosure() {
  3219. function Ascii85Stream(str, maybeLength) {
  3220. this.str = str;
  3221. this.dict = str.dict;
  3222. this.input = new Uint8Array(5);
  3223. if (maybeLength) {
  3224. maybeLength = 0.8 * maybeLength;
  3225. }
  3226. DecodeStream.call(this, maybeLength);
  3227. }
  3228. Ascii85Stream.prototype = Object.create(DecodeStream.prototype);
  3229. Ascii85Stream.prototype.readBlock = function Ascii85Stream_readBlock() {
  3230. var TILDA_CHAR = 0x7E;
  3231. var Z_LOWER_CHAR = 0x7A;
  3232. var EOF = -1;
  3233. var str = this.str;
  3234. var c = str.getByte();
  3235. while (isSpace(c)) {
  3236. c = str.getByte();
  3237. }
  3238. if (c === EOF || c === TILDA_CHAR) {
  3239. this.eof = true;
  3240. return;
  3241. }
  3242. var bufferLength = this.bufferLength, buffer;
  3243. var i;
  3244. if (c === Z_LOWER_CHAR) {
  3245. buffer = this.ensureBuffer(bufferLength + 4);
  3246. for (i = 0; i < 4; ++i) {
  3247. buffer[bufferLength + i] = 0;
  3248. }
  3249. this.bufferLength += 4;
  3250. } else {
  3251. var input = this.input;
  3252. input[0] = c;
  3253. for (i = 1; i < 5; ++i) {
  3254. c = str.getByte();
  3255. while (isSpace(c)) {
  3256. c = str.getByte();
  3257. }
  3258. input[i] = c;
  3259. if (c === EOF || c === TILDA_CHAR) {
  3260. break;
  3261. }
  3262. }
  3263. buffer = this.ensureBuffer(bufferLength + i - 1);
  3264. this.bufferLength += i - 1;
  3265. if (i < 5) {
  3266. for (; i < 5; ++i) {
  3267. input[i] = 0x21 + 84;
  3268. }
  3269. this.eof = true;
  3270. }
  3271. var t = 0;
  3272. for (i = 0; i < 5; ++i) {
  3273. t = t * 85 + (input[i] - 0x21);
  3274. }
  3275. for (i = 3; i >= 0; --i) {
  3276. buffer[bufferLength + i] = t & 0xFF;
  3277. t >>= 8;
  3278. }
  3279. }
  3280. };
  3281. return Ascii85Stream;
  3282. }();
  3283. var AsciiHexStream = function AsciiHexStreamClosure() {
  3284. function AsciiHexStream(str, maybeLength) {
  3285. this.str = str;
  3286. this.dict = str.dict;
  3287. this.firstDigit = -1;
  3288. if (maybeLength) {
  3289. maybeLength = 0.5 * maybeLength;
  3290. }
  3291. DecodeStream.call(this, maybeLength);
  3292. }
  3293. AsciiHexStream.prototype = Object.create(DecodeStream.prototype);
  3294. AsciiHexStream.prototype.readBlock = function AsciiHexStream_readBlock() {
  3295. var UPSTREAM_BLOCK_SIZE = 8000;
  3296. var bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  3297. if (!bytes.length) {
  3298. this.eof = true;
  3299. return;
  3300. }
  3301. var maxDecodeLength = bytes.length + 1 >> 1;
  3302. var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  3303. var bufferLength = this.bufferLength;
  3304. var firstDigit = this.firstDigit;
  3305. for (var i = 0, ii = bytes.length; i < ii; i++) {
  3306. var ch = bytes[i], digit;
  3307. if (ch >= 0x30 && ch <= 0x39) {
  3308. digit = ch & 0x0F;
  3309. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  3310. digit = (ch & 0x0F) + 9;
  3311. } else if (ch === 0x3E) {
  3312. this.eof = true;
  3313. break;
  3314. } else {
  3315. continue;
  3316. }
  3317. if (firstDigit < 0) {
  3318. firstDigit = digit;
  3319. } else {
  3320. buffer[bufferLength++] = firstDigit << 4 | digit;
  3321. firstDigit = -1;
  3322. }
  3323. }
  3324. if (firstDigit >= 0 && this.eof) {
  3325. buffer[bufferLength++] = firstDigit << 4;
  3326. firstDigit = -1;
  3327. }
  3328. this.firstDigit = firstDigit;
  3329. this.bufferLength = bufferLength;
  3330. };
  3331. return AsciiHexStream;
  3332. }();
  3333. var RunLengthStream = function RunLengthStreamClosure() {
  3334. function RunLengthStream(str, maybeLength) {
  3335. this.str = str;
  3336. this.dict = str.dict;
  3337. DecodeStream.call(this, maybeLength);
  3338. }
  3339. RunLengthStream.prototype = Object.create(DecodeStream.prototype);
  3340. RunLengthStream.prototype.readBlock = function RunLengthStream_readBlock() {
  3341. var repeatHeader = this.str.getBytes(2);
  3342. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  3343. this.eof = true;
  3344. return;
  3345. }
  3346. var buffer;
  3347. var bufferLength = this.bufferLength;
  3348. var n = repeatHeader[0];
  3349. if (n < 128) {
  3350. buffer = this.ensureBuffer(bufferLength + n + 1);
  3351. buffer[bufferLength++] = repeatHeader[1];
  3352. if (n > 0) {
  3353. var source = this.str.getBytes(n);
  3354. buffer.set(source, bufferLength);
  3355. bufferLength += n;
  3356. }
  3357. } else {
  3358. n = 257 - n;
  3359. var b = repeatHeader[1];
  3360. buffer = this.ensureBuffer(bufferLength + n + 1);
  3361. for (var i = 0; i < n; i++) {
  3362. buffer[bufferLength++] = b;
  3363. }
  3364. }
  3365. this.bufferLength = bufferLength;
  3366. };
  3367. return RunLengthStream;
  3368. }();
  3369. var CCITTFaxStream = function CCITTFaxStreamClosure() {
  3370. var ccittEOL = -2;
  3371. var ccittEOF = -1;
  3372. var twoDimPass = 0;
  3373. var twoDimHoriz = 1;
  3374. var twoDimVert0 = 2;
  3375. var twoDimVertR1 = 3;
  3376. var twoDimVertL1 = 4;
  3377. var twoDimVertR2 = 5;
  3378. var twoDimVertL2 = 6;
  3379. var twoDimVertR3 = 7;
  3380. var twoDimVertL3 = 8;
  3381. var twoDimTable = [
  3382. [
  3383. -1,
  3384. -1
  3385. ],
  3386. [
  3387. -1,
  3388. -1
  3389. ],
  3390. [
  3391. 7,
  3392. twoDimVertL3
  3393. ],
  3394. [
  3395. 7,
  3396. twoDimVertR3
  3397. ],
  3398. [
  3399. 6,
  3400. twoDimVertL2
  3401. ],
  3402. [
  3403. 6,
  3404. twoDimVertL2
  3405. ],
  3406. [
  3407. 6,
  3408. twoDimVertR2
  3409. ],
  3410. [
  3411. 6,
  3412. twoDimVertR2
  3413. ],
  3414. [
  3415. 4,
  3416. twoDimPass
  3417. ],
  3418. [
  3419. 4,
  3420. twoDimPass
  3421. ],
  3422. [
  3423. 4,
  3424. twoDimPass
  3425. ],
  3426. [
  3427. 4,
  3428. twoDimPass
  3429. ],
  3430. [
  3431. 4,
  3432. twoDimPass
  3433. ],
  3434. [
  3435. 4,
  3436. twoDimPass
  3437. ],
  3438. [
  3439. 4,
  3440. twoDimPass
  3441. ],
  3442. [
  3443. 4,
  3444. twoDimPass
  3445. ],
  3446. [
  3447. 3,
  3448. twoDimHoriz
  3449. ],
  3450. [
  3451. 3,
  3452. twoDimHoriz
  3453. ],
  3454. [
  3455. 3,
  3456. twoDimHoriz
  3457. ],
  3458. [
  3459. 3,
  3460. twoDimHoriz
  3461. ],
  3462. [
  3463. 3,
  3464. twoDimHoriz
  3465. ],
  3466. [
  3467. 3,
  3468. twoDimHoriz
  3469. ],
  3470. [
  3471. 3,
  3472. twoDimHoriz
  3473. ],
  3474. [
  3475. 3,
  3476. twoDimHoriz
  3477. ],
  3478. [
  3479. 3,
  3480. twoDimHoriz
  3481. ],
  3482. [
  3483. 3,
  3484. twoDimHoriz
  3485. ],
  3486. [
  3487. 3,
  3488. twoDimHoriz
  3489. ],
  3490. [
  3491. 3,
  3492. twoDimHoriz
  3493. ],
  3494. [
  3495. 3,
  3496. twoDimHoriz
  3497. ],
  3498. [
  3499. 3,
  3500. twoDimHoriz
  3501. ],
  3502. [
  3503. 3,
  3504. twoDimHoriz
  3505. ],
  3506. [
  3507. 3,
  3508. twoDimHoriz
  3509. ],
  3510. [
  3511. 3,
  3512. twoDimVertL1
  3513. ],
  3514. [
  3515. 3,
  3516. twoDimVertL1
  3517. ],
  3518. [
  3519. 3,
  3520. twoDimVertL1
  3521. ],
  3522. [
  3523. 3,
  3524. twoDimVertL1
  3525. ],
  3526. [
  3527. 3,
  3528. twoDimVertL1
  3529. ],
  3530. [
  3531. 3,
  3532. twoDimVertL1
  3533. ],
  3534. [
  3535. 3,
  3536. twoDimVertL1
  3537. ],
  3538. [
  3539. 3,
  3540. twoDimVertL1
  3541. ],
  3542. [
  3543. 3,
  3544. twoDimVertL1
  3545. ],
  3546. [
  3547. 3,
  3548. twoDimVertL1
  3549. ],
  3550. [
  3551. 3,
  3552. twoDimVertL1
  3553. ],
  3554. [
  3555. 3,
  3556. twoDimVertL1
  3557. ],
  3558. [
  3559. 3,
  3560. twoDimVertL1
  3561. ],
  3562. [
  3563. 3,
  3564. twoDimVertL1
  3565. ],
  3566. [
  3567. 3,
  3568. twoDimVertL1
  3569. ],
  3570. [
  3571. 3,
  3572. twoDimVertL1
  3573. ],
  3574. [
  3575. 3,
  3576. twoDimVertR1
  3577. ],
  3578. [
  3579. 3,
  3580. twoDimVertR1
  3581. ],
  3582. [
  3583. 3,
  3584. twoDimVertR1
  3585. ],
  3586. [
  3587. 3,
  3588. twoDimVertR1
  3589. ],
  3590. [
  3591. 3,
  3592. twoDimVertR1
  3593. ],
  3594. [
  3595. 3,
  3596. twoDimVertR1
  3597. ],
  3598. [
  3599. 3,
  3600. twoDimVertR1
  3601. ],
  3602. [
  3603. 3,
  3604. twoDimVertR1
  3605. ],
  3606. [
  3607. 3,
  3608. twoDimVertR1
  3609. ],
  3610. [
  3611. 3,
  3612. twoDimVertR1
  3613. ],
  3614. [
  3615. 3,
  3616. twoDimVertR1
  3617. ],
  3618. [
  3619. 3,
  3620. twoDimVertR1
  3621. ],
  3622. [
  3623. 3,
  3624. twoDimVertR1
  3625. ],
  3626. [
  3627. 3,
  3628. twoDimVertR1
  3629. ],
  3630. [
  3631. 3,
  3632. twoDimVertR1
  3633. ],
  3634. [
  3635. 3,
  3636. twoDimVertR1
  3637. ],
  3638. [
  3639. 1,
  3640. twoDimVert0
  3641. ],
  3642. [
  3643. 1,
  3644. twoDimVert0
  3645. ],
  3646. [
  3647. 1,
  3648. twoDimVert0
  3649. ],
  3650. [
  3651. 1,
  3652. twoDimVert0
  3653. ],
  3654. [
  3655. 1,
  3656. twoDimVert0
  3657. ],
  3658. [
  3659. 1,
  3660. twoDimVert0
  3661. ],
  3662. [
  3663. 1,
  3664. twoDimVert0
  3665. ],
  3666. [
  3667. 1,
  3668. twoDimVert0
  3669. ],
  3670. [
  3671. 1,
  3672. twoDimVert0
  3673. ],
  3674. [
  3675. 1,
  3676. twoDimVert0
  3677. ],
  3678. [
  3679. 1,
  3680. twoDimVert0
  3681. ],
  3682. [
  3683. 1,
  3684. twoDimVert0
  3685. ],
  3686. [
  3687. 1,
  3688. twoDimVert0
  3689. ],
  3690. [
  3691. 1,
  3692. twoDimVert0
  3693. ],
  3694. [
  3695. 1,
  3696. twoDimVert0
  3697. ],
  3698. [
  3699. 1,
  3700. twoDimVert0
  3701. ],
  3702. [
  3703. 1,
  3704. twoDimVert0
  3705. ],
  3706. [
  3707. 1,
  3708. twoDimVert0
  3709. ],
  3710. [
  3711. 1,
  3712. twoDimVert0
  3713. ],
  3714. [
  3715. 1,
  3716. twoDimVert0
  3717. ],
  3718. [
  3719. 1,
  3720. twoDimVert0
  3721. ],
  3722. [
  3723. 1,
  3724. twoDimVert0
  3725. ],
  3726. [
  3727. 1,
  3728. twoDimVert0
  3729. ],
  3730. [
  3731. 1,
  3732. twoDimVert0
  3733. ],
  3734. [
  3735. 1,
  3736. twoDimVert0
  3737. ],
  3738. [
  3739. 1,
  3740. twoDimVert0
  3741. ],
  3742. [
  3743. 1,
  3744. twoDimVert0
  3745. ],
  3746. [
  3747. 1,
  3748. twoDimVert0
  3749. ],
  3750. [
  3751. 1,
  3752. twoDimVert0
  3753. ],
  3754. [
  3755. 1,
  3756. twoDimVert0
  3757. ],
  3758. [
  3759. 1,
  3760. twoDimVert0
  3761. ],
  3762. [
  3763. 1,
  3764. twoDimVert0
  3765. ],
  3766. [
  3767. 1,
  3768. twoDimVert0
  3769. ],
  3770. [
  3771. 1,
  3772. twoDimVert0
  3773. ],
  3774. [
  3775. 1,
  3776. twoDimVert0
  3777. ],
  3778. [
  3779. 1,
  3780. twoDimVert0
  3781. ],
  3782. [
  3783. 1,
  3784. twoDimVert0
  3785. ],
  3786. [
  3787. 1,
  3788. twoDimVert0
  3789. ],
  3790. [
  3791. 1,
  3792. twoDimVert0
  3793. ],
  3794. [
  3795. 1,
  3796. twoDimVert0
  3797. ],
  3798. [
  3799. 1,
  3800. twoDimVert0
  3801. ],
  3802. [
  3803. 1,
  3804. twoDimVert0
  3805. ],
  3806. [
  3807. 1,
  3808. twoDimVert0
  3809. ],
  3810. [
  3811. 1,
  3812. twoDimVert0
  3813. ],
  3814. [
  3815. 1,
  3816. twoDimVert0
  3817. ],
  3818. [
  3819. 1,
  3820. twoDimVert0
  3821. ],
  3822. [
  3823. 1,
  3824. twoDimVert0
  3825. ],
  3826. [
  3827. 1,
  3828. twoDimVert0
  3829. ],
  3830. [
  3831. 1,
  3832. twoDimVert0
  3833. ],
  3834. [
  3835. 1,
  3836. twoDimVert0
  3837. ],
  3838. [
  3839. 1,
  3840. twoDimVert0
  3841. ],
  3842. [
  3843. 1,
  3844. twoDimVert0
  3845. ],
  3846. [
  3847. 1,
  3848. twoDimVert0
  3849. ],
  3850. [
  3851. 1,
  3852. twoDimVert0
  3853. ],
  3854. [
  3855. 1,
  3856. twoDimVert0
  3857. ],
  3858. [
  3859. 1,
  3860. twoDimVert0
  3861. ],
  3862. [
  3863. 1,
  3864. twoDimVert0
  3865. ],
  3866. [
  3867. 1,
  3868. twoDimVert0
  3869. ],
  3870. [
  3871. 1,
  3872. twoDimVert0
  3873. ],
  3874. [
  3875. 1,
  3876. twoDimVert0
  3877. ],
  3878. [
  3879. 1,
  3880. twoDimVert0
  3881. ],
  3882. [
  3883. 1,
  3884. twoDimVert0
  3885. ],
  3886. [
  3887. 1,
  3888. twoDimVert0
  3889. ],
  3890. [
  3891. 1,
  3892. twoDimVert0
  3893. ]
  3894. ];
  3895. var whiteTable1 = [
  3896. [
  3897. -1,
  3898. -1
  3899. ],
  3900. [
  3901. 12,
  3902. ccittEOL
  3903. ],
  3904. [
  3905. -1,
  3906. -1
  3907. ],
  3908. [
  3909. -1,
  3910. -1
  3911. ],
  3912. [
  3913. -1,
  3914. -1
  3915. ],
  3916. [
  3917. -1,
  3918. -1
  3919. ],
  3920. [
  3921. -1,
  3922. -1
  3923. ],
  3924. [
  3925. -1,
  3926. -1
  3927. ],
  3928. [
  3929. -1,
  3930. -1
  3931. ],
  3932. [
  3933. -1,
  3934. -1
  3935. ],
  3936. [
  3937. -1,
  3938. -1
  3939. ],
  3940. [
  3941. -1,
  3942. -1
  3943. ],
  3944. [
  3945. -1,
  3946. -1
  3947. ],
  3948. [
  3949. -1,
  3950. -1
  3951. ],
  3952. [
  3953. -1,
  3954. -1
  3955. ],
  3956. [
  3957. -1,
  3958. -1
  3959. ],
  3960. [
  3961. 11,
  3962. 1792
  3963. ],
  3964. [
  3965. 11,
  3966. 1792
  3967. ],
  3968. [
  3969. 12,
  3970. 1984
  3971. ],
  3972. [
  3973. 12,
  3974. 2048
  3975. ],
  3976. [
  3977. 12,
  3978. 2112
  3979. ],
  3980. [
  3981. 12,
  3982. 2176
  3983. ],
  3984. [
  3985. 12,
  3986. 2240
  3987. ],
  3988. [
  3989. 12,
  3990. 2304
  3991. ],
  3992. [
  3993. 11,
  3994. 1856
  3995. ],
  3996. [
  3997. 11,
  3998. 1856
  3999. ],
  4000. [
  4001. 11,
  4002. 1920
  4003. ],
  4004. [
  4005. 11,
  4006. 1920
  4007. ],
  4008. [
  4009. 12,
  4010. 2368
  4011. ],
  4012. [
  4013. 12,
  4014. 2432
  4015. ],
  4016. [
  4017. 12,
  4018. 2496
  4019. ],
  4020. [
  4021. 12,
  4022. 2560
  4023. ]
  4024. ];
  4025. var whiteTable2 = [
  4026. [
  4027. -1,
  4028. -1
  4029. ],
  4030. [
  4031. -1,
  4032. -1
  4033. ],
  4034. [
  4035. -1,
  4036. -1
  4037. ],
  4038. [
  4039. -1,
  4040. -1
  4041. ],
  4042. [
  4043. 8,
  4044. 29
  4045. ],
  4046. [
  4047. 8,
  4048. 29
  4049. ],
  4050. [
  4051. 8,
  4052. 30
  4053. ],
  4054. [
  4055. 8,
  4056. 30
  4057. ],
  4058. [
  4059. 8,
  4060. 45
  4061. ],
  4062. [
  4063. 8,
  4064. 45
  4065. ],
  4066. [
  4067. 8,
  4068. 46
  4069. ],
  4070. [
  4071. 8,
  4072. 46
  4073. ],
  4074. [
  4075. 7,
  4076. 22
  4077. ],
  4078. [
  4079. 7,
  4080. 22
  4081. ],
  4082. [
  4083. 7,
  4084. 22
  4085. ],
  4086. [
  4087. 7,
  4088. 22
  4089. ],
  4090. [
  4091. 7,
  4092. 23
  4093. ],
  4094. [
  4095. 7,
  4096. 23
  4097. ],
  4098. [
  4099. 7,
  4100. 23
  4101. ],
  4102. [
  4103. 7,
  4104. 23
  4105. ],
  4106. [
  4107. 8,
  4108. 47
  4109. ],
  4110. [
  4111. 8,
  4112. 47
  4113. ],
  4114. [
  4115. 8,
  4116. 48
  4117. ],
  4118. [
  4119. 8,
  4120. 48
  4121. ],
  4122. [
  4123. 6,
  4124. 13
  4125. ],
  4126. [
  4127. 6,
  4128. 13
  4129. ],
  4130. [
  4131. 6,
  4132. 13
  4133. ],
  4134. [
  4135. 6,
  4136. 13
  4137. ],
  4138. [
  4139. 6,
  4140. 13
  4141. ],
  4142. [
  4143. 6,
  4144. 13
  4145. ],
  4146. [
  4147. 6,
  4148. 13
  4149. ],
  4150. [
  4151. 6,
  4152. 13
  4153. ],
  4154. [
  4155. 7,
  4156. 20
  4157. ],
  4158. [
  4159. 7,
  4160. 20
  4161. ],
  4162. [
  4163. 7,
  4164. 20
  4165. ],
  4166. [
  4167. 7,
  4168. 20
  4169. ],
  4170. [
  4171. 8,
  4172. 33
  4173. ],
  4174. [
  4175. 8,
  4176. 33
  4177. ],
  4178. [
  4179. 8,
  4180. 34
  4181. ],
  4182. [
  4183. 8,
  4184. 34
  4185. ],
  4186. [
  4187. 8,
  4188. 35
  4189. ],
  4190. [
  4191. 8,
  4192. 35
  4193. ],
  4194. [
  4195. 8,
  4196. 36
  4197. ],
  4198. [
  4199. 8,
  4200. 36
  4201. ],
  4202. [
  4203. 8,
  4204. 37
  4205. ],
  4206. [
  4207. 8,
  4208. 37
  4209. ],
  4210. [
  4211. 8,
  4212. 38
  4213. ],
  4214. [
  4215. 8,
  4216. 38
  4217. ],
  4218. [
  4219. 7,
  4220. 19
  4221. ],
  4222. [
  4223. 7,
  4224. 19
  4225. ],
  4226. [
  4227. 7,
  4228. 19
  4229. ],
  4230. [
  4231. 7,
  4232. 19
  4233. ],
  4234. [
  4235. 8,
  4236. 31
  4237. ],
  4238. [
  4239. 8,
  4240. 31
  4241. ],
  4242. [
  4243. 8,
  4244. 32
  4245. ],
  4246. [
  4247. 8,
  4248. 32
  4249. ],
  4250. [
  4251. 6,
  4252. 1
  4253. ],
  4254. [
  4255. 6,
  4256. 1
  4257. ],
  4258. [
  4259. 6,
  4260. 1
  4261. ],
  4262. [
  4263. 6,
  4264. 1
  4265. ],
  4266. [
  4267. 6,
  4268. 1
  4269. ],
  4270. [
  4271. 6,
  4272. 1
  4273. ],
  4274. [
  4275. 6,
  4276. 1
  4277. ],
  4278. [
  4279. 6,
  4280. 1
  4281. ],
  4282. [
  4283. 6,
  4284. 12
  4285. ],
  4286. [
  4287. 6,
  4288. 12
  4289. ],
  4290. [
  4291. 6,
  4292. 12
  4293. ],
  4294. [
  4295. 6,
  4296. 12
  4297. ],
  4298. [
  4299. 6,
  4300. 12
  4301. ],
  4302. [
  4303. 6,
  4304. 12
  4305. ],
  4306. [
  4307. 6,
  4308. 12
  4309. ],
  4310. [
  4311. 6,
  4312. 12
  4313. ],
  4314. [
  4315. 8,
  4316. 53
  4317. ],
  4318. [
  4319. 8,
  4320. 53
  4321. ],
  4322. [
  4323. 8,
  4324. 54
  4325. ],
  4326. [
  4327. 8,
  4328. 54
  4329. ],
  4330. [
  4331. 7,
  4332. 26
  4333. ],
  4334. [
  4335. 7,
  4336. 26
  4337. ],
  4338. [
  4339. 7,
  4340. 26
  4341. ],
  4342. [
  4343. 7,
  4344. 26
  4345. ],
  4346. [
  4347. 8,
  4348. 39
  4349. ],
  4350. [
  4351. 8,
  4352. 39
  4353. ],
  4354. [
  4355. 8,
  4356. 40
  4357. ],
  4358. [
  4359. 8,
  4360. 40
  4361. ],
  4362. [
  4363. 8,
  4364. 41
  4365. ],
  4366. [
  4367. 8,
  4368. 41
  4369. ],
  4370. [
  4371. 8,
  4372. 42
  4373. ],
  4374. [
  4375. 8,
  4376. 42
  4377. ],
  4378. [
  4379. 8,
  4380. 43
  4381. ],
  4382. [
  4383. 8,
  4384. 43
  4385. ],
  4386. [
  4387. 8,
  4388. 44
  4389. ],
  4390. [
  4391. 8,
  4392. 44
  4393. ],
  4394. [
  4395. 7,
  4396. 21
  4397. ],
  4398. [
  4399. 7,
  4400. 21
  4401. ],
  4402. [
  4403. 7,
  4404. 21
  4405. ],
  4406. [
  4407. 7,
  4408. 21
  4409. ],
  4410. [
  4411. 7,
  4412. 28
  4413. ],
  4414. [
  4415. 7,
  4416. 28
  4417. ],
  4418. [
  4419. 7,
  4420. 28
  4421. ],
  4422. [
  4423. 7,
  4424. 28
  4425. ],
  4426. [
  4427. 8,
  4428. 61
  4429. ],
  4430. [
  4431. 8,
  4432. 61
  4433. ],
  4434. [
  4435. 8,
  4436. 62
  4437. ],
  4438. [
  4439. 8,
  4440. 62
  4441. ],
  4442. [
  4443. 8,
  4444. 63
  4445. ],
  4446. [
  4447. 8,
  4448. 63
  4449. ],
  4450. [
  4451. 8,
  4452. 0
  4453. ],
  4454. [
  4455. 8,
  4456. 0
  4457. ],
  4458. [
  4459. 8,
  4460. 320
  4461. ],
  4462. [
  4463. 8,
  4464. 320
  4465. ],
  4466. [
  4467. 8,
  4468. 384
  4469. ],
  4470. [
  4471. 8,
  4472. 384
  4473. ],
  4474. [
  4475. 5,
  4476. 10
  4477. ],
  4478. [
  4479. 5,
  4480. 10
  4481. ],
  4482. [
  4483. 5,
  4484. 10
  4485. ],
  4486. [
  4487. 5,
  4488. 10
  4489. ],
  4490. [
  4491. 5,
  4492. 10
  4493. ],
  4494. [
  4495. 5,
  4496. 10
  4497. ],
  4498. [
  4499. 5,
  4500. 10
  4501. ],
  4502. [
  4503. 5,
  4504. 10
  4505. ],
  4506. [
  4507. 5,
  4508. 10
  4509. ],
  4510. [
  4511. 5,
  4512. 10
  4513. ],
  4514. [
  4515. 5,
  4516. 10
  4517. ],
  4518. [
  4519. 5,
  4520. 10
  4521. ],
  4522. [
  4523. 5,
  4524. 10
  4525. ],
  4526. [
  4527. 5,
  4528. 10
  4529. ],
  4530. [
  4531. 5,
  4532. 10
  4533. ],
  4534. [
  4535. 5,
  4536. 10
  4537. ],
  4538. [
  4539. 5,
  4540. 11
  4541. ],
  4542. [
  4543. 5,
  4544. 11
  4545. ],
  4546. [
  4547. 5,
  4548. 11
  4549. ],
  4550. [
  4551. 5,
  4552. 11
  4553. ],
  4554. [
  4555. 5,
  4556. 11
  4557. ],
  4558. [
  4559. 5,
  4560. 11
  4561. ],
  4562. [
  4563. 5,
  4564. 11
  4565. ],
  4566. [
  4567. 5,
  4568. 11
  4569. ],
  4570. [
  4571. 5,
  4572. 11
  4573. ],
  4574. [
  4575. 5,
  4576. 11
  4577. ],
  4578. [
  4579. 5,
  4580. 11
  4581. ],
  4582. [
  4583. 5,
  4584. 11
  4585. ],
  4586. [
  4587. 5,
  4588. 11
  4589. ],
  4590. [
  4591. 5,
  4592. 11
  4593. ],
  4594. [
  4595. 5,
  4596. 11
  4597. ],
  4598. [
  4599. 5,
  4600. 11
  4601. ],
  4602. [
  4603. 7,
  4604. 27
  4605. ],
  4606. [
  4607. 7,
  4608. 27
  4609. ],
  4610. [
  4611. 7,
  4612. 27
  4613. ],
  4614. [
  4615. 7,
  4616. 27
  4617. ],
  4618. [
  4619. 8,
  4620. 59
  4621. ],
  4622. [
  4623. 8,
  4624. 59
  4625. ],
  4626. [
  4627. 8,
  4628. 60
  4629. ],
  4630. [
  4631. 8,
  4632. 60
  4633. ],
  4634. [
  4635. 9,
  4636. 1472
  4637. ],
  4638. [
  4639. 9,
  4640. 1536
  4641. ],
  4642. [
  4643. 9,
  4644. 1600
  4645. ],
  4646. [
  4647. 9,
  4648. 1728
  4649. ],
  4650. [
  4651. 7,
  4652. 18
  4653. ],
  4654. [
  4655. 7,
  4656. 18
  4657. ],
  4658. [
  4659. 7,
  4660. 18
  4661. ],
  4662. [
  4663. 7,
  4664. 18
  4665. ],
  4666. [
  4667. 7,
  4668. 24
  4669. ],
  4670. [
  4671. 7,
  4672. 24
  4673. ],
  4674. [
  4675. 7,
  4676. 24
  4677. ],
  4678. [
  4679. 7,
  4680. 24
  4681. ],
  4682. [
  4683. 8,
  4684. 49
  4685. ],
  4686. [
  4687. 8,
  4688. 49
  4689. ],
  4690. [
  4691. 8,
  4692. 50
  4693. ],
  4694. [
  4695. 8,
  4696. 50
  4697. ],
  4698. [
  4699. 8,
  4700. 51
  4701. ],
  4702. [
  4703. 8,
  4704. 51
  4705. ],
  4706. [
  4707. 8,
  4708. 52
  4709. ],
  4710. [
  4711. 8,
  4712. 52
  4713. ],
  4714. [
  4715. 7,
  4716. 25
  4717. ],
  4718. [
  4719. 7,
  4720. 25
  4721. ],
  4722. [
  4723. 7,
  4724. 25
  4725. ],
  4726. [
  4727. 7,
  4728. 25
  4729. ],
  4730. [
  4731. 8,
  4732. 55
  4733. ],
  4734. [
  4735. 8,
  4736. 55
  4737. ],
  4738. [
  4739. 8,
  4740. 56
  4741. ],
  4742. [
  4743. 8,
  4744. 56
  4745. ],
  4746. [
  4747. 8,
  4748. 57
  4749. ],
  4750. [
  4751. 8,
  4752. 57
  4753. ],
  4754. [
  4755. 8,
  4756. 58
  4757. ],
  4758. [
  4759. 8,
  4760. 58
  4761. ],
  4762. [
  4763. 6,
  4764. 192
  4765. ],
  4766. [
  4767. 6,
  4768. 192
  4769. ],
  4770. [
  4771. 6,
  4772. 192
  4773. ],
  4774. [
  4775. 6,
  4776. 192
  4777. ],
  4778. [
  4779. 6,
  4780. 192
  4781. ],
  4782. [
  4783. 6,
  4784. 192
  4785. ],
  4786. [
  4787. 6,
  4788. 192
  4789. ],
  4790. [
  4791. 6,
  4792. 192
  4793. ],
  4794. [
  4795. 6,
  4796. 1664
  4797. ],
  4798. [
  4799. 6,
  4800. 1664
  4801. ],
  4802. [
  4803. 6,
  4804. 1664
  4805. ],
  4806. [
  4807. 6,
  4808. 1664
  4809. ],
  4810. [
  4811. 6,
  4812. 1664
  4813. ],
  4814. [
  4815. 6,
  4816. 1664
  4817. ],
  4818. [
  4819. 6,
  4820. 1664
  4821. ],
  4822. [
  4823. 6,
  4824. 1664
  4825. ],
  4826. [
  4827. 8,
  4828. 448
  4829. ],
  4830. [
  4831. 8,
  4832. 448
  4833. ],
  4834. [
  4835. 8,
  4836. 512
  4837. ],
  4838. [
  4839. 8,
  4840. 512
  4841. ],
  4842. [
  4843. 9,
  4844. 704
  4845. ],
  4846. [
  4847. 9,
  4848. 768
  4849. ],
  4850. [
  4851. 8,
  4852. 640
  4853. ],
  4854. [
  4855. 8,
  4856. 640
  4857. ],
  4858. [
  4859. 8,
  4860. 576
  4861. ],
  4862. [
  4863. 8,
  4864. 576
  4865. ],
  4866. [
  4867. 9,
  4868. 832
  4869. ],
  4870. [
  4871. 9,
  4872. 896
  4873. ],
  4874. [
  4875. 9,
  4876. 960
  4877. ],
  4878. [
  4879. 9,
  4880. 1024
  4881. ],
  4882. [
  4883. 9,
  4884. 1088
  4885. ],
  4886. [
  4887. 9,
  4888. 1152
  4889. ],
  4890. [
  4891. 9,
  4892. 1216
  4893. ],
  4894. [
  4895. 9,
  4896. 1280
  4897. ],
  4898. [
  4899. 9,
  4900. 1344
  4901. ],
  4902. [
  4903. 9,
  4904. 1408
  4905. ],
  4906. [
  4907. 7,
  4908. 256
  4909. ],
  4910. [
  4911. 7,
  4912. 256
  4913. ],
  4914. [
  4915. 7,
  4916. 256
  4917. ],
  4918. [
  4919. 7,
  4920. 256
  4921. ],
  4922. [
  4923. 4,
  4924. 2
  4925. ],
  4926. [
  4927. 4,
  4928. 2
  4929. ],
  4930. [
  4931. 4,
  4932. 2
  4933. ],
  4934. [
  4935. 4,
  4936. 2
  4937. ],
  4938. [
  4939. 4,
  4940. 2
  4941. ],
  4942. [
  4943. 4,
  4944. 2
  4945. ],
  4946. [
  4947. 4,
  4948. 2
  4949. ],
  4950. [
  4951. 4,
  4952. 2
  4953. ],
  4954. [
  4955. 4,
  4956. 2
  4957. ],
  4958. [
  4959. 4,
  4960. 2
  4961. ],
  4962. [
  4963. 4,
  4964. 2
  4965. ],
  4966. [
  4967. 4,
  4968. 2
  4969. ],
  4970. [
  4971. 4,
  4972. 2
  4973. ],
  4974. [
  4975. 4,
  4976. 2
  4977. ],
  4978. [
  4979. 4,
  4980. 2
  4981. ],
  4982. [
  4983. 4,
  4984. 2
  4985. ],
  4986. [
  4987. 4,
  4988. 2
  4989. ],
  4990. [
  4991. 4,
  4992. 2
  4993. ],
  4994. [
  4995. 4,
  4996. 2
  4997. ],
  4998. [
  4999. 4,
  5000. 2
  5001. ],
  5002. [
  5003. 4,
  5004. 2
  5005. ],
  5006. [
  5007. 4,
  5008. 2
  5009. ],
  5010. [
  5011. 4,
  5012. 2
  5013. ],
  5014. [
  5015. 4,
  5016. 2
  5017. ],
  5018. [
  5019. 4,
  5020. 2
  5021. ],
  5022. [
  5023. 4,
  5024. 2
  5025. ],
  5026. [
  5027. 4,
  5028. 2
  5029. ],
  5030. [
  5031. 4,
  5032. 2
  5033. ],
  5034. [
  5035. 4,
  5036. 2
  5037. ],
  5038. [
  5039. 4,
  5040. 2
  5041. ],
  5042. [
  5043. 4,
  5044. 2
  5045. ],
  5046. [
  5047. 4,
  5048. 2
  5049. ],
  5050. [
  5051. 4,
  5052. 3
  5053. ],
  5054. [
  5055. 4,
  5056. 3
  5057. ],
  5058. [
  5059. 4,
  5060. 3
  5061. ],
  5062. [
  5063. 4,
  5064. 3
  5065. ],
  5066. [
  5067. 4,
  5068. 3
  5069. ],
  5070. [
  5071. 4,
  5072. 3
  5073. ],
  5074. [
  5075. 4,
  5076. 3
  5077. ],
  5078. [
  5079. 4,
  5080. 3
  5081. ],
  5082. [
  5083. 4,
  5084. 3
  5085. ],
  5086. [
  5087. 4,
  5088. 3
  5089. ],
  5090. [
  5091. 4,
  5092. 3
  5093. ],
  5094. [
  5095. 4,
  5096. 3
  5097. ],
  5098. [
  5099. 4,
  5100. 3
  5101. ],
  5102. [
  5103. 4,
  5104. 3
  5105. ],
  5106. [
  5107. 4,
  5108. 3
  5109. ],
  5110. [
  5111. 4,
  5112. 3
  5113. ],
  5114. [
  5115. 4,
  5116. 3
  5117. ],
  5118. [
  5119. 4,
  5120. 3
  5121. ],
  5122. [
  5123. 4,
  5124. 3
  5125. ],
  5126. [
  5127. 4,
  5128. 3
  5129. ],
  5130. [
  5131. 4,
  5132. 3
  5133. ],
  5134. [
  5135. 4,
  5136. 3
  5137. ],
  5138. [
  5139. 4,
  5140. 3
  5141. ],
  5142. [
  5143. 4,
  5144. 3
  5145. ],
  5146. [
  5147. 4,
  5148. 3
  5149. ],
  5150. [
  5151. 4,
  5152. 3
  5153. ],
  5154. [
  5155. 4,
  5156. 3
  5157. ],
  5158. [
  5159. 4,
  5160. 3
  5161. ],
  5162. [
  5163. 4,
  5164. 3
  5165. ],
  5166. [
  5167. 4,
  5168. 3
  5169. ],
  5170. [
  5171. 4,
  5172. 3
  5173. ],
  5174. [
  5175. 4,
  5176. 3
  5177. ],
  5178. [
  5179. 5,
  5180. 128
  5181. ],
  5182. [
  5183. 5,
  5184. 128
  5185. ],
  5186. [
  5187. 5,
  5188. 128
  5189. ],
  5190. [
  5191. 5,
  5192. 128
  5193. ],
  5194. [
  5195. 5,
  5196. 128
  5197. ],
  5198. [
  5199. 5,
  5200. 128
  5201. ],
  5202. [
  5203. 5,
  5204. 128
  5205. ],
  5206. [
  5207. 5,
  5208. 128
  5209. ],
  5210. [
  5211. 5,
  5212. 128
  5213. ],
  5214. [
  5215. 5,
  5216. 128
  5217. ],
  5218. [
  5219. 5,
  5220. 128
  5221. ],
  5222. [
  5223. 5,
  5224. 128
  5225. ],
  5226. [
  5227. 5,
  5228. 128
  5229. ],
  5230. [
  5231. 5,
  5232. 128
  5233. ],
  5234. [
  5235. 5,
  5236. 128
  5237. ],
  5238. [
  5239. 5,
  5240. 128
  5241. ],
  5242. [
  5243. 5,
  5244. 8
  5245. ],
  5246. [
  5247. 5,
  5248. 8
  5249. ],
  5250. [
  5251. 5,
  5252. 8
  5253. ],
  5254. [
  5255. 5,
  5256. 8
  5257. ],
  5258. [
  5259. 5,
  5260. 8
  5261. ],
  5262. [
  5263. 5,
  5264. 8
  5265. ],
  5266. [
  5267. 5,
  5268. 8
  5269. ],
  5270. [
  5271. 5,
  5272. 8
  5273. ],
  5274. [
  5275. 5,
  5276. 8
  5277. ],
  5278. [
  5279. 5,
  5280. 8
  5281. ],
  5282. [
  5283. 5,
  5284. 8
  5285. ],
  5286. [
  5287. 5,
  5288. 8
  5289. ],
  5290. [
  5291. 5,
  5292. 8
  5293. ],
  5294. [
  5295. 5,
  5296. 8
  5297. ],
  5298. [
  5299. 5,
  5300. 8
  5301. ],
  5302. [
  5303. 5,
  5304. 8
  5305. ],
  5306. [
  5307. 5,
  5308. 9
  5309. ],
  5310. [
  5311. 5,
  5312. 9
  5313. ],
  5314. [
  5315. 5,
  5316. 9
  5317. ],
  5318. [
  5319. 5,
  5320. 9
  5321. ],
  5322. [
  5323. 5,
  5324. 9
  5325. ],
  5326. [
  5327. 5,
  5328. 9
  5329. ],
  5330. [
  5331. 5,
  5332. 9
  5333. ],
  5334. [
  5335. 5,
  5336. 9
  5337. ],
  5338. [
  5339. 5,
  5340. 9
  5341. ],
  5342. [
  5343. 5,
  5344. 9
  5345. ],
  5346. [
  5347. 5,
  5348. 9
  5349. ],
  5350. [
  5351. 5,
  5352. 9
  5353. ],
  5354. [
  5355. 5,
  5356. 9
  5357. ],
  5358. [
  5359. 5,
  5360. 9
  5361. ],
  5362. [
  5363. 5,
  5364. 9
  5365. ],
  5366. [
  5367. 5,
  5368. 9
  5369. ],
  5370. [
  5371. 6,
  5372. 16
  5373. ],
  5374. [
  5375. 6,
  5376. 16
  5377. ],
  5378. [
  5379. 6,
  5380. 16
  5381. ],
  5382. [
  5383. 6,
  5384. 16
  5385. ],
  5386. [
  5387. 6,
  5388. 16
  5389. ],
  5390. [
  5391. 6,
  5392. 16
  5393. ],
  5394. [
  5395. 6,
  5396. 16
  5397. ],
  5398. [
  5399. 6,
  5400. 16
  5401. ],
  5402. [
  5403. 6,
  5404. 17
  5405. ],
  5406. [
  5407. 6,
  5408. 17
  5409. ],
  5410. [
  5411. 6,
  5412. 17
  5413. ],
  5414. [
  5415. 6,
  5416. 17
  5417. ],
  5418. [
  5419. 6,
  5420. 17
  5421. ],
  5422. [
  5423. 6,
  5424. 17
  5425. ],
  5426. [
  5427. 6,
  5428. 17
  5429. ],
  5430. [
  5431. 6,
  5432. 17
  5433. ],
  5434. [
  5435. 4,
  5436. 4
  5437. ],
  5438. [
  5439. 4,
  5440. 4
  5441. ],
  5442. [
  5443. 4,
  5444. 4
  5445. ],
  5446. [
  5447. 4,
  5448. 4
  5449. ],
  5450. [
  5451. 4,
  5452. 4
  5453. ],
  5454. [
  5455. 4,
  5456. 4
  5457. ],
  5458. [
  5459. 4,
  5460. 4
  5461. ],
  5462. [
  5463. 4,
  5464. 4
  5465. ],
  5466. [
  5467. 4,
  5468. 4
  5469. ],
  5470. [
  5471. 4,
  5472. 4
  5473. ],
  5474. [
  5475. 4,
  5476. 4
  5477. ],
  5478. [
  5479. 4,
  5480. 4
  5481. ],
  5482. [
  5483. 4,
  5484. 4
  5485. ],
  5486. [
  5487. 4,
  5488. 4
  5489. ],
  5490. [
  5491. 4,
  5492. 4
  5493. ],
  5494. [
  5495. 4,
  5496. 4
  5497. ],
  5498. [
  5499. 4,
  5500. 4
  5501. ],
  5502. [
  5503. 4,
  5504. 4
  5505. ],
  5506. [
  5507. 4,
  5508. 4
  5509. ],
  5510. [
  5511. 4,
  5512. 4
  5513. ],
  5514. [
  5515. 4,
  5516. 4
  5517. ],
  5518. [
  5519. 4,
  5520. 4
  5521. ],
  5522. [
  5523. 4,
  5524. 4
  5525. ],
  5526. [
  5527. 4,
  5528. 4
  5529. ],
  5530. [
  5531. 4,
  5532. 4
  5533. ],
  5534. [
  5535. 4,
  5536. 4
  5537. ],
  5538. [
  5539. 4,
  5540. 4
  5541. ],
  5542. [
  5543. 4,
  5544. 4
  5545. ],
  5546. [
  5547. 4,
  5548. 4
  5549. ],
  5550. [
  5551. 4,
  5552. 4
  5553. ],
  5554. [
  5555. 4,
  5556. 4
  5557. ],
  5558. [
  5559. 4,
  5560. 4
  5561. ],
  5562. [
  5563. 4,
  5564. 5
  5565. ],
  5566. [
  5567. 4,
  5568. 5
  5569. ],
  5570. [
  5571. 4,
  5572. 5
  5573. ],
  5574. [
  5575. 4,
  5576. 5
  5577. ],
  5578. [
  5579. 4,
  5580. 5
  5581. ],
  5582. [
  5583. 4,
  5584. 5
  5585. ],
  5586. [
  5587. 4,
  5588. 5
  5589. ],
  5590. [
  5591. 4,
  5592. 5
  5593. ],
  5594. [
  5595. 4,
  5596. 5
  5597. ],
  5598. [
  5599. 4,
  5600. 5
  5601. ],
  5602. [
  5603. 4,
  5604. 5
  5605. ],
  5606. [
  5607. 4,
  5608. 5
  5609. ],
  5610. [
  5611. 4,
  5612. 5
  5613. ],
  5614. [
  5615. 4,
  5616. 5
  5617. ],
  5618. [
  5619. 4,
  5620. 5
  5621. ],
  5622. [
  5623. 4,
  5624. 5
  5625. ],
  5626. [
  5627. 4,
  5628. 5
  5629. ],
  5630. [
  5631. 4,
  5632. 5
  5633. ],
  5634. [
  5635. 4,
  5636. 5
  5637. ],
  5638. [
  5639. 4,
  5640. 5
  5641. ],
  5642. [
  5643. 4,
  5644. 5
  5645. ],
  5646. [
  5647. 4,
  5648. 5
  5649. ],
  5650. [
  5651. 4,
  5652. 5
  5653. ],
  5654. [
  5655. 4,
  5656. 5
  5657. ],
  5658. [
  5659. 4,
  5660. 5
  5661. ],
  5662. [
  5663. 4,
  5664. 5
  5665. ],
  5666. [
  5667. 4,
  5668. 5
  5669. ],
  5670. [
  5671. 4,
  5672. 5
  5673. ],
  5674. [
  5675. 4,
  5676. 5
  5677. ],
  5678. [
  5679. 4,
  5680. 5
  5681. ],
  5682. [
  5683. 4,
  5684. 5
  5685. ],
  5686. [
  5687. 4,
  5688. 5
  5689. ],
  5690. [
  5691. 6,
  5692. 14
  5693. ],
  5694. [
  5695. 6,
  5696. 14
  5697. ],
  5698. [
  5699. 6,
  5700. 14
  5701. ],
  5702. [
  5703. 6,
  5704. 14
  5705. ],
  5706. [
  5707. 6,
  5708. 14
  5709. ],
  5710. [
  5711. 6,
  5712. 14
  5713. ],
  5714. [
  5715. 6,
  5716. 14
  5717. ],
  5718. [
  5719. 6,
  5720. 14
  5721. ],
  5722. [
  5723. 6,
  5724. 15
  5725. ],
  5726. [
  5727. 6,
  5728. 15
  5729. ],
  5730. [
  5731. 6,
  5732. 15
  5733. ],
  5734. [
  5735. 6,
  5736. 15
  5737. ],
  5738. [
  5739. 6,
  5740. 15
  5741. ],
  5742. [
  5743. 6,
  5744. 15
  5745. ],
  5746. [
  5747. 6,
  5748. 15
  5749. ],
  5750. [
  5751. 6,
  5752. 15
  5753. ],
  5754. [
  5755. 5,
  5756. 64
  5757. ],
  5758. [
  5759. 5,
  5760. 64
  5761. ],
  5762. [
  5763. 5,
  5764. 64
  5765. ],
  5766. [
  5767. 5,
  5768. 64
  5769. ],
  5770. [
  5771. 5,
  5772. 64
  5773. ],
  5774. [
  5775. 5,
  5776. 64
  5777. ],
  5778. [
  5779. 5,
  5780. 64
  5781. ],
  5782. [
  5783. 5,
  5784. 64
  5785. ],
  5786. [
  5787. 5,
  5788. 64
  5789. ],
  5790. [
  5791. 5,
  5792. 64
  5793. ],
  5794. [
  5795. 5,
  5796. 64
  5797. ],
  5798. [
  5799. 5,
  5800. 64
  5801. ],
  5802. [
  5803. 5,
  5804. 64
  5805. ],
  5806. [
  5807. 5,
  5808. 64
  5809. ],
  5810. [
  5811. 5,
  5812. 64
  5813. ],
  5814. [
  5815. 5,
  5816. 64
  5817. ],
  5818. [
  5819. 4,
  5820. 6
  5821. ],
  5822. [
  5823. 4,
  5824. 6
  5825. ],
  5826. [
  5827. 4,
  5828. 6
  5829. ],
  5830. [
  5831. 4,
  5832. 6
  5833. ],
  5834. [
  5835. 4,
  5836. 6
  5837. ],
  5838. [
  5839. 4,
  5840. 6
  5841. ],
  5842. [
  5843. 4,
  5844. 6
  5845. ],
  5846. [
  5847. 4,
  5848. 6
  5849. ],
  5850. [
  5851. 4,
  5852. 6
  5853. ],
  5854. [
  5855. 4,
  5856. 6
  5857. ],
  5858. [
  5859. 4,
  5860. 6
  5861. ],
  5862. [
  5863. 4,
  5864. 6
  5865. ],
  5866. [
  5867. 4,
  5868. 6
  5869. ],
  5870. [
  5871. 4,
  5872. 6
  5873. ],
  5874. [
  5875. 4,
  5876. 6
  5877. ],
  5878. [
  5879. 4,
  5880. 6
  5881. ],
  5882. [
  5883. 4,
  5884. 6
  5885. ],
  5886. [
  5887. 4,
  5888. 6
  5889. ],
  5890. [
  5891. 4,
  5892. 6
  5893. ],
  5894. [
  5895. 4,
  5896. 6
  5897. ],
  5898. [
  5899. 4,
  5900. 6
  5901. ],
  5902. [
  5903. 4,
  5904. 6
  5905. ],
  5906. [
  5907. 4,
  5908. 6
  5909. ],
  5910. [
  5911. 4,
  5912. 6
  5913. ],
  5914. [
  5915. 4,
  5916. 6
  5917. ],
  5918. [
  5919. 4,
  5920. 6
  5921. ],
  5922. [
  5923. 4,
  5924. 6
  5925. ],
  5926. [
  5927. 4,
  5928. 6
  5929. ],
  5930. [
  5931. 4,
  5932. 6
  5933. ],
  5934. [
  5935. 4,
  5936. 6
  5937. ],
  5938. [
  5939. 4,
  5940. 6
  5941. ],
  5942. [
  5943. 4,
  5944. 6
  5945. ],
  5946. [
  5947. 4,
  5948. 7
  5949. ],
  5950. [
  5951. 4,
  5952. 7
  5953. ],
  5954. [
  5955. 4,
  5956. 7
  5957. ],
  5958. [
  5959. 4,
  5960. 7
  5961. ],
  5962. [
  5963. 4,
  5964. 7
  5965. ],
  5966. [
  5967. 4,
  5968. 7
  5969. ],
  5970. [
  5971. 4,
  5972. 7
  5973. ],
  5974. [
  5975. 4,
  5976. 7
  5977. ],
  5978. [
  5979. 4,
  5980. 7
  5981. ],
  5982. [
  5983. 4,
  5984. 7
  5985. ],
  5986. [
  5987. 4,
  5988. 7
  5989. ],
  5990. [
  5991. 4,
  5992. 7
  5993. ],
  5994. [
  5995. 4,
  5996. 7
  5997. ],
  5998. [
  5999. 4,
  6000. 7
  6001. ],
  6002. [
  6003. 4,
  6004. 7
  6005. ],
  6006. [
  6007. 4,
  6008. 7
  6009. ],
  6010. [
  6011. 4,
  6012. 7
  6013. ],
  6014. [
  6015. 4,
  6016. 7
  6017. ],
  6018. [
  6019. 4,
  6020. 7
  6021. ],
  6022. [
  6023. 4,
  6024. 7
  6025. ],
  6026. [
  6027. 4,
  6028. 7
  6029. ],
  6030. [
  6031. 4,
  6032. 7
  6033. ],
  6034. [
  6035. 4,
  6036. 7
  6037. ],
  6038. [
  6039. 4,
  6040. 7
  6041. ],
  6042. [
  6043. 4,
  6044. 7
  6045. ],
  6046. [
  6047. 4,
  6048. 7
  6049. ],
  6050. [
  6051. 4,
  6052. 7
  6053. ],
  6054. [
  6055. 4,
  6056. 7
  6057. ],
  6058. [
  6059. 4,
  6060. 7
  6061. ],
  6062. [
  6063. 4,
  6064. 7
  6065. ],
  6066. [
  6067. 4,
  6068. 7
  6069. ],
  6070. [
  6071. 4,
  6072. 7
  6073. ]
  6074. ];
  6075. var blackTable1 = [
  6076. [
  6077. -1,
  6078. -1
  6079. ],
  6080. [
  6081. -1,
  6082. -1
  6083. ],
  6084. [
  6085. 12,
  6086. ccittEOL
  6087. ],
  6088. [
  6089. 12,
  6090. ccittEOL
  6091. ],
  6092. [
  6093. -1,
  6094. -1
  6095. ],
  6096. [
  6097. -1,
  6098. -1
  6099. ],
  6100. [
  6101. -1,
  6102. -1
  6103. ],
  6104. [
  6105. -1,
  6106. -1
  6107. ],
  6108. [
  6109. -1,
  6110. -1
  6111. ],
  6112. [
  6113. -1,
  6114. -1
  6115. ],
  6116. [
  6117. -1,
  6118. -1
  6119. ],
  6120. [
  6121. -1,
  6122. -1
  6123. ],
  6124. [
  6125. -1,
  6126. -1
  6127. ],
  6128. [
  6129. -1,
  6130. -1
  6131. ],
  6132. [
  6133. -1,
  6134. -1
  6135. ],
  6136. [
  6137. -1,
  6138. -1
  6139. ],
  6140. [
  6141. -1,
  6142. -1
  6143. ],
  6144. [
  6145. -1,
  6146. -1
  6147. ],
  6148. [
  6149. -1,
  6150. -1
  6151. ],
  6152. [
  6153. -1,
  6154. -1
  6155. ],
  6156. [
  6157. -1,
  6158. -1
  6159. ],
  6160. [
  6161. -1,
  6162. -1
  6163. ],
  6164. [
  6165. -1,
  6166. -1
  6167. ],
  6168. [
  6169. -1,
  6170. -1
  6171. ],
  6172. [
  6173. -1,
  6174. -1
  6175. ],
  6176. [
  6177. -1,
  6178. -1
  6179. ],
  6180. [
  6181. -1,
  6182. -1
  6183. ],
  6184. [
  6185. -1,
  6186. -1
  6187. ],
  6188. [
  6189. -1,
  6190. -1
  6191. ],
  6192. [
  6193. -1,
  6194. -1
  6195. ],
  6196. [
  6197. -1,
  6198. -1
  6199. ],
  6200. [
  6201. -1,
  6202. -1
  6203. ],
  6204. [
  6205. 11,
  6206. 1792
  6207. ],
  6208. [
  6209. 11,
  6210. 1792
  6211. ],
  6212. [
  6213. 11,
  6214. 1792
  6215. ],
  6216. [
  6217. 11,
  6218. 1792
  6219. ],
  6220. [
  6221. 12,
  6222. 1984
  6223. ],
  6224. [
  6225. 12,
  6226. 1984
  6227. ],
  6228. [
  6229. 12,
  6230. 2048
  6231. ],
  6232. [
  6233. 12,
  6234. 2048
  6235. ],
  6236. [
  6237. 12,
  6238. 2112
  6239. ],
  6240. [
  6241. 12,
  6242. 2112
  6243. ],
  6244. [
  6245. 12,
  6246. 2176
  6247. ],
  6248. [
  6249. 12,
  6250. 2176
  6251. ],
  6252. [
  6253. 12,
  6254. 2240
  6255. ],
  6256. [
  6257. 12,
  6258. 2240
  6259. ],
  6260. [
  6261. 12,
  6262. 2304
  6263. ],
  6264. [
  6265. 12,
  6266. 2304
  6267. ],
  6268. [
  6269. 11,
  6270. 1856
  6271. ],
  6272. [
  6273. 11,
  6274. 1856
  6275. ],
  6276. [
  6277. 11,
  6278. 1856
  6279. ],
  6280. [
  6281. 11,
  6282. 1856
  6283. ],
  6284. [
  6285. 11,
  6286. 1920
  6287. ],
  6288. [
  6289. 11,
  6290. 1920
  6291. ],
  6292. [
  6293. 11,
  6294. 1920
  6295. ],
  6296. [
  6297. 11,
  6298. 1920
  6299. ],
  6300. [
  6301. 12,
  6302. 2368
  6303. ],
  6304. [
  6305. 12,
  6306. 2368
  6307. ],
  6308. [
  6309. 12,
  6310. 2432
  6311. ],
  6312. [
  6313. 12,
  6314. 2432
  6315. ],
  6316. [
  6317. 12,
  6318. 2496
  6319. ],
  6320. [
  6321. 12,
  6322. 2496
  6323. ],
  6324. [
  6325. 12,
  6326. 2560
  6327. ],
  6328. [
  6329. 12,
  6330. 2560
  6331. ],
  6332. [
  6333. 10,
  6334. 18
  6335. ],
  6336. [
  6337. 10,
  6338. 18
  6339. ],
  6340. [
  6341. 10,
  6342. 18
  6343. ],
  6344. [
  6345. 10,
  6346. 18
  6347. ],
  6348. [
  6349. 10,
  6350. 18
  6351. ],
  6352. [
  6353. 10,
  6354. 18
  6355. ],
  6356. [
  6357. 10,
  6358. 18
  6359. ],
  6360. [
  6361. 10,
  6362. 18
  6363. ],
  6364. [
  6365. 12,
  6366. 52
  6367. ],
  6368. [
  6369. 12,
  6370. 52
  6371. ],
  6372. [
  6373. 13,
  6374. 640
  6375. ],
  6376. [
  6377. 13,
  6378. 704
  6379. ],
  6380. [
  6381. 13,
  6382. 768
  6383. ],
  6384. [
  6385. 13,
  6386. 832
  6387. ],
  6388. [
  6389. 12,
  6390. 55
  6391. ],
  6392. [
  6393. 12,
  6394. 55
  6395. ],
  6396. [
  6397. 12,
  6398. 56
  6399. ],
  6400. [
  6401. 12,
  6402. 56
  6403. ],
  6404. [
  6405. 13,
  6406. 1280
  6407. ],
  6408. [
  6409. 13,
  6410. 1344
  6411. ],
  6412. [
  6413. 13,
  6414. 1408
  6415. ],
  6416. [
  6417. 13,
  6418. 1472
  6419. ],
  6420. [
  6421. 12,
  6422. 59
  6423. ],
  6424. [
  6425. 12,
  6426. 59
  6427. ],
  6428. [
  6429. 12,
  6430. 60
  6431. ],
  6432. [
  6433. 12,
  6434. 60
  6435. ],
  6436. [
  6437. 13,
  6438. 1536
  6439. ],
  6440. [
  6441. 13,
  6442. 1600
  6443. ],
  6444. [
  6445. 11,
  6446. 24
  6447. ],
  6448. [
  6449. 11,
  6450. 24
  6451. ],
  6452. [
  6453. 11,
  6454. 24
  6455. ],
  6456. [
  6457. 11,
  6458. 24
  6459. ],
  6460. [
  6461. 11,
  6462. 25
  6463. ],
  6464. [
  6465. 11,
  6466. 25
  6467. ],
  6468. [
  6469. 11,
  6470. 25
  6471. ],
  6472. [
  6473. 11,
  6474. 25
  6475. ],
  6476. [
  6477. 13,
  6478. 1664
  6479. ],
  6480. [
  6481. 13,
  6482. 1728
  6483. ],
  6484. [
  6485. 12,
  6486. 320
  6487. ],
  6488. [
  6489. 12,
  6490. 320
  6491. ],
  6492. [
  6493. 12,
  6494. 384
  6495. ],
  6496. [
  6497. 12,
  6498. 384
  6499. ],
  6500. [
  6501. 12,
  6502. 448
  6503. ],
  6504. [
  6505. 12,
  6506. 448
  6507. ],
  6508. [
  6509. 13,
  6510. 512
  6511. ],
  6512. [
  6513. 13,
  6514. 576
  6515. ],
  6516. [
  6517. 12,
  6518. 53
  6519. ],
  6520. [
  6521. 12,
  6522. 53
  6523. ],
  6524. [
  6525. 12,
  6526. 54
  6527. ],
  6528. [
  6529. 12,
  6530. 54
  6531. ],
  6532. [
  6533. 13,
  6534. 896
  6535. ],
  6536. [
  6537. 13,
  6538. 960
  6539. ],
  6540. [
  6541. 13,
  6542. 1024
  6543. ],
  6544. [
  6545. 13,
  6546. 1088
  6547. ],
  6548. [
  6549. 13,
  6550. 1152
  6551. ],
  6552. [
  6553. 13,
  6554. 1216
  6555. ],
  6556. [
  6557. 10,
  6558. 64
  6559. ],
  6560. [
  6561. 10,
  6562. 64
  6563. ],
  6564. [
  6565. 10,
  6566. 64
  6567. ],
  6568. [
  6569. 10,
  6570. 64
  6571. ],
  6572. [
  6573. 10,
  6574. 64
  6575. ],
  6576. [
  6577. 10,
  6578. 64
  6579. ],
  6580. [
  6581. 10,
  6582. 64
  6583. ],
  6584. [
  6585. 10,
  6586. 64
  6587. ]
  6588. ];
  6589. var blackTable2 = [
  6590. [
  6591. 8,
  6592. 13
  6593. ],
  6594. [
  6595. 8,
  6596. 13
  6597. ],
  6598. [
  6599. 8,
  6600. 13
  6601. ],
  6602. [
  6603. 8,
  6604. 13
  6605. ],
  6606. [
  6607. 8,
  6608. 13
  6609. ],
  6610. [
  6611. 8,
  6612. 13
  6613. ],
  6614. [
  6615. 8,
  6616. 13
  6617. ],
  6618. [
  6619. 8,
  6620. 13
  6621. ],
  6622. [
  6623. 8,
  6624. 13
  6625. ],
  6626. [
  6627. 8,
  6628. 13
  6629. ],
  6630. [
  6631. 8,
  6632. 13
  6633. ],
  6634. [
  6635. 8,
  6636. 13
  6637. ],
  6638. [
  6639. 8,
  6640. 13
  6641. ],
  6642. [
  6643. 8,
  6644. 13
  6645. ],
  6646. [
  6647. 8,
  6648. 13
  6649. ],
  6650. [
  6651. 8,
  6652. 13
  6653. ],
  6654. [
  6655. 11,
  6656. 23
  6657. ],
  6658. [
  6659. 11,
  6660. 23
  6661. ],
  6662. [
  6663. 12,
  6664. 50
  6665. ],
  6666. [
  6667. 12,
  6668. 51
  6669. ],
  6670. [
  6671. 12,
  6672. 44
  6673. ],
  6674. [
  6675. 12,
  6676. 45
  6677. ],
  6678. [
  6679. 12,
  6680. 46
  6681. ],
  6682. [
  6683. 12,
  6684. 47
  6685. ],
  6686. [
  6687. 12,
  6688. 57
  6689. ],
  6690. [
  6691. 12,
  6692. 58
  6693. ],
  6694. [
  6695. 12,
  6696. 61
  6697. ],
  6698. [
  6699. 12,
  6700. 256
  6701. ],
  6702. [
  6703. 10,
  6704. 16
  6705. ],
  6706. [
  6707. 10,
  6708. 16
  6709. ],
  6710. [
  6711. 10,
  6712. 16
  6713. ],
  6714. [
  6715. 10,
  6716. 16
  6717. ],
  6718. [
  6719. 10,
  6720. 17
  6721. ],
  6722. [
  6723. 10,
  6724. 17
  6725. ],
  6726. [
  6727. 10,
  6728. 17
  6729. ],
  6730. [
  6731. 10,
  6732. 17
  6733. ],
  6734. [
  6735. 12,
  6736. 48
  6737. ],
  6738. [
  6739. 12,
  6740. 49
  6741. ],
  6742. [
  6743. 12,
  6744. 62
  6745. ],
  6746. [
  6747. 12,
  6748. 63
  6749. ],
  6750. [
  6751. 12,
  6752. 30
  6753. ],
  6754. [
  6755. 12,
  6756. 31
  6757. ],
  6758. [
  6759. 12,
  6760. 32
  6761. ],
  6762. [
  6763. 12,
  6764. 33
  6765. ],
  6766. [
  6767. 12,
  6768. 40
  6769. ],
  6770. [
  6771. 12,
  6772. 41
  6773. ],
  6774. [
  6775. 11,
  6776. 22
  6777. ],
  6778. [
  6779. 11,
  6780. 22
  6781. ],
  6782. [
  6783. 8,
  6784. 14
  6785. ],
  6786. [
  6787. 8,
  6788. 14
  6789. ],
  6790. [
  6791. 8,
  6792. 14
  6793. ],
  6794. [
  6795. 8,
  6796. 14
  6797. ],
  6798. [
  6799. 8,
  6800. 14
  6801. ],
  6802. [
  6803. 8,
  6804. 14
  6805. ],
  6806. [
  6807. 8,
  6808. 14
  6809. ],
  6810. [
  6811. 8,
  6812. 14
  6813. ],
  6814. [
  6815. 8,
  6816. 14
  6817. ],
  6818. [
  6819. 8,
  6820. 14
  6821. ],
  6822. [
  6823. 8,
  6824. 14
  6825. ],
  6826. [
  6827. 8,
  6828. 14
  6829. ],
  6830. [
  6831. 8,
  6832. 14
  6833. ],
  6834. [
  6835. 8,
  6836. 14
  6837. ],
  6838. [
  6839. 8,
  6840. 14
  6841. ],
  6842. [
  6843. 8,
  6844. 14
  6845. ],
  6846. [
  6847. 7,
  6848. 10
  6849. ],
  6850. [
  6851. 7,
  6852. 10
  6853. ],
  6854. [
  6855. 7,
  6856. 10
  6857. ],
  6858. [
  6859. 7,
  6860. 10
  6861. ],
  6862. [
  6863. 7,
  6864. 10
  6865. ],
  6866. [
  6867. 7,
  6868. 10
  6869. ],
  6870. [
  6871. 7,
  6872. 10
  6873. ],
  6874. [
  6875. 7,
  6876. 10
  6877. ],
  6878. [
  6879. 7,
  6880. 10
  6881. ],
  6882. [
  6883. 7,
  6884. 10
  6885. ],
  6886. [
  6887. 7,
  6888. 10
  6889. ],
  6890. [
  6891. 7,
  6892. 10
  6893. ],
  6894. [
  6895. 7,
  6896. 10
  6897. ],
  6898. [
  6899. 7,
  6900. 10
  6901. ],
  6902. [
  6903. 7,
  6904. 10
  6905. ],
  6906. [
  6907. 7,
  6908. 10
  6909. ],
  6910. [
  6911. 7,
  6912. 10
  6913. ],
  6914. [
  6915. 7,
  6916. 10
  6917. ],
  6918. [
  6919. 7,
  6920. 10
  6921. ],
  6922. [
  6923. 7,
  6924. 10
  6925. ],
  6926. [
  6927. 7,
  6928. 10
  6929. ],
  6930. [
  6931. 7,
  6932. 10
  6933. ],
  6934. [
  6935. 7,
  6936. 10
  6937. ],
  6938. [
  6939. 7,
  6940. 10
  6941. ],
  6942. [
  6943. 7,
  6944. 10
  6945. ],
  6946. [
  6947. 7,
  6948. 10
  6949. ],
  6950. [
  6951. 7,
  6952. 10
  6953. ],
  6954. [
  6955. 7,
  6956. 10
  6957. ],
  6958. [
  6959. 7,
  6960. 10
  6961. ],
  6962. [
  6963. 7,
  6964. 10
  6965. ],
  6966. [
  6967. 7,
  6968. 10
  6969. ],
  6970. [
  6971. 7,
  6972. 10
  6973. ],
  6974. [
  6975. 7,
  6976. 11
  6977. ],
  6978. [
  6979. 7,
  6980. 11
  6981. ],
  6982. [
  6983. 7,
  6984. 11
  6985. ],
  6986. [
  6987. 7,
  6988. 11
  6989. ],
  6990. [
  6991. 7,
  6992. 11
  6993. ],
  6994. [
  6995. 7,
  6996. 11
  6997. ],
  6998. [
  6999. 7,
  7000. 11
  7001. ],
  7002. [
  7003. 7,
  7004. 11
  7005. ],
  7006. [
  7007. 7,
  7008. 11
  7009. ],
  7010. [
  7011. 7,
  7012. 11
  7013. ],
  7014. [
  7015. 7,
  7016. 11
  7017. ],
  7018. [
  7019. 7,
  7020. 11
  7021. ],
  7022. [
  7023. 7,
  7024. 11
  7025. ],
  7026. [
  7027. 7,
  7028. 11
  7029. ],
  7030. [
  7031. 7,
  7032. 11
  7033. ],
  7034. [
  7035. 7,
  7036. 11
  7037. ],
  7038. [
  7039. 7,
  7040. 11
  7041. ],
  7042. [
  7043. 7,
  7044. 11
  7045. ],
  7046. [
  7047. 7,
  7048. 11
  7049. ],
  7050. [
  7051. 7,
  7052. 11
  7053. ],
  7054. [
  7055. 7,
  7056. 11
  7057. ],
  7058. [
  7059. 7,
  7060. 11
  7061. ],
  7062. [
  7063. 7,
  7064. 11
  7065. ],
  7066. [
  7067. 7,
  7068. 11
  7069. ],
  7070. [
  7071. 7,
  7072. 11
  7073. ],
  7074. [
  7075. 7,
  7076. 11
  7077. ],
  7078. [
  7079. 7,
  7080. 11
  7081. ],
  7082. [
  7083. 7,
  7084. 11
  7085. ],
  7086. [
  7087. 7,
  7088. 11
  7089. ],
  7090. [
  7091. 7,
  7092. 11
  7093. ],
  7094. [
  7095. 7,
  7096. 11
  7097. ],
  7098. [
  7099. 7,
  7100. 11
  7101. ],
  7102. [
  7103. 9,
  7104. 15
  7105. ],
  7106. [
  7107. 9,
  7108. 15
  7109. ],
  7110. [
  7111. 9,
  7112. 15
  7113. ],
  7114. [
  7115. 9,
  7116. 15
  7117. ],
  7118. [
  7119. 9,
  7120. 15
  7121. ],
  7122. [
  7123. 9,
  7124. 15
  7125. ],
  7126. [
  7127. 9,
  7128. 15
  7129. ],
  7130. [
  7131. 9,
  7132. 15
  7133. ],
  7134. [
  7135. 12,
  7136. 128
  7137. ],
  7138. [
  7139. 12,
  7140. 192
  7141. ],
  7142. [
  7143. 12,
  7144. 26
  7145. ],
  7146. [
  7147. 12,
  7148. 27
  7149. ],
  7150. [
  7151. 12,
  7152. 28
  7153. ],
  7154. [
  7155. 12,
  7156. 29
  7157. ],
  7158. [
  7159. 11,
  7160. 19
  7161. ],
  7162. [
  7163. 11,
  7164. 19
  7165. ],
  7166. [
  7167. 11,
  7168. 20
  7169. ],
  7170. [
  7171. 11,
  7172. 20
  7173. ],
  7174. [
  7175. 12,
  7176. 34
  7177. ],
  7178. [
  7179. 12,
  7180. 35
  7181. ],
  7182. [
  7183. 12,
  7184. 36
  7185. ],
  7186. [
  7187. 12,
  7188. 37
  7189. ],
  7190. [
  7191. 12,
  7192. 38
  7193. ],
  7194. [
  7195. 12,
  7196. 39
  7197. ],
  7198. [
  7199. 11,
  7200. 21
  7201. ],
  7202. [
  7203. 11,
  7204. 21
  7205. ],
  7206. [
  7207. 12,
  7208. 42
  7209. ],
  7210. [
  7211. 12,
  7212. 43
  7213. ],
  7214. [
  7215. 10,
  7216. 0
  7217. ],
  7218. [
  7219. 10,
  7220. 0
  7221. ],
  7222. [
  7223. 10,
  7224. 0
  7225. ],
  7226. [
  7227. 10,
  7228. 0
  7229. ],
  7230. [
  7231. 7,
  7232. 12
  7233. ],
  7234. [
  7235. 7,
  7236. 12
  7237. ],
  7238. [
  7239. 7,
  7240. 12
  7241. ],
  7242. [
  7243. 7,
  7244. 12
  7245. ],
  7246. [
  7247. 7,
  7248. 12
  7249. ],
  7250. [
  7251. 7,
  7252. 12
  7253. ],
  7254. [
  7255. 7,
  7256. 12
  7257. ],
  7258. [
  7259. 7,
  7260. 12
  7261. ],
  7262. [
  7263. 7,
  7264. 12
  7265. ],
  7266. [
  7267. 7,
  7268. 12
  7269. ],
  7270. [
  7271. 7,
  7272. 12
  7273. ],
  7274. [
  7275. 7,
  7276. 12
  7277. ],
  7278. [
  7279. 7,
  7280. 12
  7281. ],
  7282. [
  7283. 7,
  7284. 12
  7285. ],
  7286. [
  7287. 7,
  7288. 12
  7289. ],
  7290. [
  7291. 7,
  7292. 12
  7293. ],
  7294. [
  7295. 7,
  7296. 12
  7297. ],
  7298. [
  7299. 7,
  7300. 12
  7301. ],
  7302. [
  7303. 7,
  7304. 12
  7305. ],
  7306. [
  7307. 7,
  7308. 12
  7309. ],
  7310. [
  7311. 7,
  7312. 12
  7313. ],
  7314. [
  7315. 7,
  7316. 12
  7317. ],
  7318. [
  7319. 7,
  7320. 12
  7321. ],
  7322. [
  7323. 7,
  7324. 12
  7325. ],
  7326. [
  7327. 7,
  7328. 12
  7329. ],
  7330. [
  7331. 7,
  7332. 12
  7333. ],
  7334. [
  7335. 7,
  7336. 12
  7337. ],
  7338. [
  7339. 7,
  7340. 12
  7341. ],
  7342. [
  7343. 7,
  7344. 12
  7345. ],
  7346. [
  7347. 7,
  7348. 12
  7349. ],
  7350. [
  7351. 7,
  7352. 12
  7353. ],
  7354. [
  7355. 7,
  7356. 12
  7357. ]
  7358. ];
  7359. var blackTable3 = [
  7360. [
  7361. -1,
  7362. -1
  7363. ],
  7364. [
  7365. -1,
  7366. -1
  7367. ],
  7368. [
  7369. -1,
  7370. -1
  7371. ],
  7372. [
  7373. -1,
  7374. -1
  7375. ],
  7376. [
  7377. 6,
  7378. 9
  7379. ],
  7380. [
  7381. 6,
  7382. 8
  7383. ],
  7384. [
  7385. 5,
  7386. 7
  7387. ],
  7388. [
  7389. 5,
  7390. 7
  7391. ],
  7392. [
  7393. 4,
  7394. 6
  7395. ],
  7396. [
  7397. 4,
  7398. 6
  7399. ],
  7400. [
  7401. 4,
  7402. 6
  7403. ],
  7404. [
  7405. 4,
  7406. 6
  7407. ],
  7408. [
  7409. 4,
  7410. 5
  7411. ],
  7412. [
  7413. 4,
  7414. 5
  7415. ],
  7416. [
  7417. 4,
  7418. 5
  7419. ],
  7420. [
  7421. 4,
  7422. 5
  7423. ],
  7424. [
  7425. 3,
  7426. 1
  7427. ],
  7428. [
  7429. 3,
  7430. 1
  7431. ],
  7432. [
  7433. 3,
  7434. 1
  7435. ],
  7436. [
  7437. 3,
  7438. 1
  7439. ],
  7440. [
  7441. 3,
  7442. 1
  7443. ],
  7444. [
  7445. 3,
  7446. 1
  7447. ],
  7448. [
  7449. 3,
  7450. 1
  7451. ],
  7452. [
  7453. 3,
  7454. 1
  7455. ],
  7456. [
  7457. 3,
  7458. 4
  7459. ],
  7460. [
  7461. 3,
  7462. 4
  7463. ],
  7464. [
  7465. 3,
  7466. 4
  7467. ],
  7468. [
  7469. 3,
  7470. 4
  7471. ],
  7472. [
  7473. 3,
  7474. 4
  7475. ],
  7476. [
  7477. 3,
  7478. 4
  7479. ],
  7480. [
  7481. 3,
  7482. 4
  7483. ],
  7484. [
  7485. 3,
  7486. 4
  7487. ],
  7488. [
  7489. 2,
  7490. 3
  7491. ],
  7492. [
  7493. 2,
  7494. 3
  7495. ],
  7496. [
  7497. 2,
  7498. 3
  7499. ],
  7500. [
  7501. 2,
  7502. 3
  7503. ],
  7504. [
  7505. 2,
  7506. 3
  7507. ],
  7508. [
  7509. 2,
  7510. 3
  7511. ],
  7512. [
  7513. 2,
  7514. 3
  7515. ],
  7516. [
  7517. 2,
  7518. 3
  7519. ],
  7520. [
  7521. 2,
  7522. 3
  7523. ],
  7524. [
  7525. 2,
  7526. 3
  7527. ],
  7528. [
  7529. 2,
  7530. 3
  7531. ],
  7532. [
  7533. 2,
  7534. 3
  7535. ],
  7536. [
  7537. 2,
  7538. 3
  7539. ],
  7540. [
  7541. 2,
  7542. 3
  7543. ],
  7544. [
  7545. 2,
  7546. 3
  7547. ],
  7548. [
  7549. 2,
  7550. 3
  7551. ],
  7552. [
  7553. 2,
  7554. 2
  7555. ],
  7556. [
  7557. 2,
  7558. 2
  7559. ],
  7560. [
  7561. 2,
  7562. 2
  7563. ],
  7564. [
  7565. 2,
  7566. 2
  7567. ],
  7568. [
  7569. 2,
  7570. 2
  7571. ],
  7572. [
  7573. 2,
  7574. 2
  7575. ],
  7576. [
  7577. 2,
  7578. 2
  7579. ],
  7580. [
  7581. 2,
  7582. 2
  7583. ],
  7584. [
  7585. 2,
  7586. 2
  7587. ],
  7588. [
  7589. 2,
  7590. 2
  7591. ],
  7592. [
  7593. 2,
  7594. 2
  7595. ],
  7596. [
  7597. 2,
  7598. 2
  7599. ],
  7600. [
  7601. 2,
  7602. 2
  7603. ],
  7604. [
  7605. 2,
  7606. 2
  7607. ],
  7608. [
  7609. 2,
  7610. 2
  7611. ],
  7612. [
  7613. 2,
  7614. 2
  7615. ]
  7616. ];
  7617. function CCITTFaxStream(str, maybeLength, params) {
  7618. this.str = str;
  7619. this.dict = str.dict;
  7620. params = params || Dict.empty;
  7621. this.encoding = params.get('K') || 0;
  7622. this.eoline = params.get('EndOfLine') || false;
  7623. this.byteAlign = params.get('EncodedByteAlign') || false;
  7624. this.columns = params.get('Columns') || 1728;
  7625. this.rows = params.get('Rows') || 0;
  7626. var eoblock = params.get('EndOfBlock');
  7627. if (eoblock === null || eoblock === undefined) {
  7628. eoblock = true;
  7629. }
  7630. this.eoblock = eoblock;
  7631. this.black = params.get('BlackIs1') || false;
  7632. this.codingLine = new Uint32Array(this.columns + 1);
  7633. this.refLine = new Uint32Array(this.columns + 2);
  7634. this.codingLine[0] = this.columns;
  7635. this.codingPos = 0;
  7636. this.row = 0;
  7637. this.nextLine2D = this.encoding < 0;
  7638. this.inputBits = 0;
  7639. this.inputBuf = 0;
  7640. this.outputBits = 0;
  7641. var code1;
  7642. while ((code1 = this.lookBits(12)) === 0) {
  7643. this.eatBits(1);
  7644. }
  7645. if (code1 === 1) {
  7646. this.eatBits(12);
  7647. }
  7648. if (this.encoding > 0) {
  7649. this.nextLine2D = !this.lookBits(1);
  7650. this.eatBits(1);
  7651. }
  7652. DecodeStream.call(this, maybeLength);
  7653. }
  7654. CCITTFaxStream.prototype = Object.create(DecodeStream.prototype);
  7655. CCITTFaxStream.prototype.readBlock = function CCITTFaxStream_readBlock() {
  7656. while (!this.eof) {
  7657. var c = this.lookChar();
  7658. this.ensureBuffer(this.bufferLength + 1);
  7659. this.buffer[this.bufferLength++] = c;
  7660. }
  7661. };
  7662. CCITTFaxStream.prototype.addPixels = function ccittFaxStreamAddPixels(a1, blackPixels) {
  7663. var codingLine = this.codingLine;
  7664. var codingPos = this.codingPos;
  7665. if (a1 > codingLine[codingPos]) {
  7666. if (a1 > this.columns) {
  7667. info('row is wrong length');
  7668. this.err = true;
  7669. a1 = this.columns;
  7670. }
  7671. if (codingPos & 1 ^ blackPixels) {
  7672. ++codingPos;
  7673. }
  7674. codingLine[codingPos] = a1;
  7675. }
  7676. this.codingPos = codingPos;
  7677. };
  7678. CCITTFaxStream.prototype.addPixelsNeg = function ccittFaxStreamAddPixelsNeg(a1, blackPixels) {
  7679. var codingLine = this.codingLine;
  7680. var codingPos = this.codingPos;
  7681. if (a1 > codingLine[codingPos]) {
  7682. if (a1 > this.columns) {
  7683. info('row is wrong length');
  7684. this.err = true;
  7685. a1 = this.columns;
  7686. }
  7687. if (codingPos & 1 ^ blackPixels) {
  7688. ++codingPos;
  7689. }
  7690. codingLine[codingPos] = a1;
  7691. } else if (a1 < codingLine[codingPos]) {
  7692. if (a1 < 0) {
  7693. info('invalid code');
  7694. this.err = true;
  7695. a1 = 0;
  7696. }
  7697. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  7698. --codingPos;
  7699. }
  7700. codingLine[codingPos] = a1;
  7701. }
  7702. this.codingPos = codingPos;
  7703. };
  7704. CCITTFaxStream.prototype.lookChar = function CCITTFaxStream_lookChar() {
  7705. var refLine = this.refLine;
  7706. var codingLine = this.codingLine;
  7707. var columns = this.columns;
  7708. var refPos, blackPixels, bits, i;
  7709. if (this.outputBits === 0) {
  7710. if (this.eof) {
  7711. return null;
  7712. }
  7713. this.err = false;
  7714. var code1, code2, code3;
  7715. if (this.nextLine2D) {
  7716. for (i = 0; codingLine[i] < columns; ++i) {
  7717. refLine[i] = codingLine[i];
  7718. }
  7719. refLine[i++] = columns;
  7720. refLine[i] = columns;
  7721. codingLine[0] = 0;
  7722. this.codingPos = 0;
  7723. refPos = 0;
  7724. blackPixels = 0;
  7725. while (codingLine[this.codingPos] < columns) {
  7726. code1 = this.getTwoDimCode();
  7727. switch (code1) {
  7728. case twoDimPass:
  7729. this.addPixels(refLine[refPos + 1], blackPixels);
  7730. if (refLine[refPos + 1] < columns) {
  7731. refPos += 2;
  7732. }
  7733. break;
  7734. case twoDimHoriz:
  7735. code1 = code2 = 0;
  7736. if (blackPixels) {
  7737. do {
  7738. code1 += code3 = this.getBlackCode();
  7739. } while (code3 >= 64);
  7740. do {
  7741. code2 += code3 = this.getWhiteCode();
  7742. } while (code3 >= 64);
  7743. } else {
  7744. do {
  7745. code1 += code3 = this.getWhiteCode();
  7746. } while (code3 >= 64);
  7747. do {
  7748. code2 += code3 = this.getBlackCode();
  7749. } while (code3 >= 64);
  7750. }
  7751. this.addPixels(codingLine[this.codingPos] + code1, blackPixels);
  7752. if (codingLine[this.codingPos] < columns) {
  7753. this.addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  7754. }
  7755. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7756. refPos += 2;
  7757. }
  7758. break;
  7759. case twoDimVertR3:
  7760. this.addPixels(refLine[refPos] + 3, blackPixels);
  7761. blackPixels ^= 1;
  7762. if (codingLine[this.codingPos] < columns) {
  7763. ++refPos;
  7764. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7765. refPos += 2;
  7766. }
  7767. }
  7768. break;
  7769. case twoDimVertR2:
  7770. this.addPixels(refLine[refPos] + 2, blackPixels);
  7771. blackPixels ^= 1;
  7772. if (codingLine[this.codingPos] < columns) {
  7773. ++refPos;
  7774. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7775. refPos += 2;
  7776. }
  7777. }
  7778. break;
  7779. case twoDimVertR1:
  7780. this.addPixels(refLine[refPos] + 1, blackPixels);
  7781. blackPixels ^= 1;
  7782. if (codingLine[this.codingPos] < columns) {
  7783. ++refPos;
  7784. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7785. refPos += 2;
  7786. }
  7787. }
  7788. break;
  7789. case twoDimVert0:
  7790. this.addPixels(refLine[refPos], blackPixels);
  7791. blackPixels ^= 1;
  7792. if (codingLine[this.codingPos] < columns) {
  7793. ++refPos;
  7794. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7795. refPos += 2;
  7796. }
  7797. }
  7798. break;
  7799. case twoDimVertL3:
  7800. this.addPixelsNeg(refLine[refPos] - 3, blackPixels);
  7801. blackPixels ^= 1;
  7802. if (codingLine[this.codingPos] < columns) {
  7803. if (refPos > 0) {
  7804. --refPos;
  7805. } else {
  7806. ++refPos;
  7807. }
  7808. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7809. refPos += 2;
  7810. }
  7811. }
  7812. break;
  7813. case twoDimVertL2:
  7814. this.addPixelsNeg(refLine[refPos] - 2, blackPixels);
  7815. blackPixels ^= 1;
  7816. if (codingLine[this.codingPos] < columns) {
  7817. if (refPos > 0) {
  7818. --refPos;
  7819. } else {
  7820. ++refPos;
  7821. }
  7822. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7823. refPos += 2;
  7824. }
  7825. }
  7826. break;
  7827. case twoDimVertL1:
  7828. this.addPixelsNeg(refLine[refPos] - 1, blackPixels);
  7829. blackPixels ^= 1;
  7830. if (codingLine[this.codingPos] < columns) {
  7831. if (refPos > 0) {
  7832. --refPos;
  7833. } else {
  7834. ++refPos;
  7835. }
  7836. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7837. refPos += 2;
  7838. }
  7839. }
  7840. break;
  7841. case ccittEOF:
  7842. this.addPixels(columns, 0);
  7843. this.eof = true;
  7844. break;
  7845. default:
  7846. info('bad 2d code');
  7847. this.addPixels(columns, 0);
  7848. this.err = true;
  7849. }
  7850. }
  7851. } else {
  7852. codingLine[0] = 0;
  7853. this.codingPos = 0;
  7854. blackPixels = 0;
  7855. while (codingLine[this.codingPos] < columns) {
  7856. code1 = 0;
  7857. if (blackPixels) {
  7858. do {
  7859. code1 += code3 = this.getBlackCode();
  7860. } while (code3 >= 64);
  7861. } else {
  7862. do {
  7863. code1 += code3 = this.getWhiteCode();
  7864. } while (code3 >= 64);
  7865. }
  7866. this.addPixels(codingLine[this.codingPos] + code1, blackPixels);
  7867. blackPixels ^= 1;
  7868. }
  7869. }
  7870. var gotEOL = false;
  7871. if (this.byteAlign) {
  7872. this.inputBits &= ~7;
  7873. }
  7874. if (!this.eoblock && this.row === this.rows - 1) {
  7875. this.eof = true;
  7876. } else {
  7877. code1 = this.lookBits(12);
  7878. if (this.eoline) {
  7879. while (code1 !== ccittEOF && code1 !== 1) {
  7880. this.eatBits(1);
  7881. code1 = this.lookBits(12);
  7882. }
  7883. } else {
  7884. while (code1 === 0) {
  7885. this.eatBits(1);
  7886. code1 = this.lookBits(12);
  7887. }
  7888. }
  7889. if (code1 === 1) {
  7890. this.eatBits(12);
  7891. gotEOL = true;
  7892. } else if (code1 === ccittEOF) {
  7893. this.eof = true;
  7894. }
  7895. }
  7896. if (!this.eof && this.encoding > 0) {
  7897. this.nextLine2D = !this.lookBits(1);
  7898. this.eatBits(1);
  7899. }
  7900. if (this.eoblock && gotEOL && this.byteAlign) {
  7901. code1 = this.lookBits(12);
  7902. if (code1 === 1) {
  7903. this.eatBits(12);
  7904. if (this.encoding > 0) {
  7905. this.lookBits(1);
  7906. this.eatBits(1);
  7907. }
  7908. if (this.encoding >= 0) {
  7909. for (i = 0; i < 4; ++i) {
  7910. code1 = this.lookBits(12);
  7911. if (code1 !== 1) {
  7912. info('bad rtc code: ' + code1);
  7913. }
  7914. this.eatBits(12);
  7915. if (this.encoding > 0) {
  7916. this.lookBits(1);
  7917. this.eatBits(1);
  7918. }
  7919. }
  7920. }
  7921. this.eof = true;
  7922. }
  7923. } else if (this.err && this.eoline) {
  7924. while (true) {
  7925. code1 = this.lookBits(13);
  7926. if (code1 === ccittEOF) {
  7927. this.eof = true;
  7928. return null;
  7929. }
  7930. if (code1 >> 1 === 1) {
  7931. break;
  7932. }
  7933. this.eatBits(1);
  7934. }
  7935. this.eatBits(12);
  7936. if (this.encoding > 0) {
  7937. this.eatBits(1);
  7938. this.nextLine2D = !(code1 & 1);
  7939. }
  7940. }
  7941. if (codingLine[0] > 0) {
  7942. this.outputBits = codingLine[this.codingPos = 0];
  7943. } else {
  7944. this.outputBits = codingLine[this.codingPos = 1];
  7945. }
  7946. this.row++;
  7947. }
  7948. var c;
  7949. if (this.outputBits >= 8) {
  7950. c = this.codingPos & 1 ? 0 : 0xFF;
  7951. this.outputBits -= 8;
  7952. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  7953. this.codingPos++;
  7954. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  7955. }
  7956. } else {
  7957. bits = 8;
  7958. c = 0;
  7959. do {
  7960. if (this.outputBits > bits) {
  7961. c <<= bits;
  7962. if (!(this.codingPos & 1)) {
  7963. c |= 0xFF >> 8 - bits;
  7964. }
  7965. this.outputBits -= bits;
  7966. bits = 0;
  7967. } else {
  7968. c <<= this.outputBits;
  7969. if (!(this.codingPos & 1)) {
  7970. c |= 0xFF >> 8 - this.outputBits;
  7971. }
  7972. bits -= this.outputBits;
  7973. this.outputBits = 0;
  7974. if (codingLine[this.codingPos] < columns) {
  7975. this.codingPos++;
  7976. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  7977. } else if (bits > 0) {
  7978. c <<= bits;
  7979. bits = 0;
  7980. }
  7981. }
  7982. } while (bits);
  7983. }
  7984. if (this.black) {
  7985. c ^= 0xFF;
  7986. }
  7987. return c;
  7988. };
  7989. CCITTFaxStream.prototype.findTableCode = function ccittFaxStreamFindTableCode(start, end, table, limit) {
  7990. var limitValue = limit || 0;
  7991. for (var i = start; i <= end; ++i) {
  7992. var code = this.lookBits(i);
  7993. if (code === ccittEOF) {
  7994. return [
  7995. true,
  7996. 1,
  7997. false
  7998. ];
  7999. }
  8000. if (i < end) {
  8001. code <<= end - i;
  8002. }
  8003. if (!limitValue || code >= limitValue) {
  8004. var p = table[code - limitValue];
  8005. if (p[0] === i) {
  8006. this.eatBits(i);
  8007. return [
  8008. true,
  8009. p[1],
  8010. true
  8011. ];
  8012. }
  8013. }
  8014. }
  8015. return [
  8016. false,
  8017. 0,
  8018. false
  8019. ];
  8020. };
  8021. CCITTFaxStream.prototype.getTwoDimCode = function ccittFaxStreamGetTwoDimCode() {
  8022. var code = 0;
  8023. var p;
  8024. if (this.eoblock) {
  8025. code = this.lookBits(7);
  8026. p = twoDimTable[code];
  8027. if (p && p[0] > 0) {
  8028. this.eatBits(p[0]);
  8029. return p[1];
  8030. }
  8031. } else {
  8032. var result = this.findTableCode(1, 7, twoDimTable);
  8033. if (result[0] && result[2]) {
  8034. return result[1];
  8035. }
  8036. }
  8037. info('Bad two dim code');
  8038. return ccittEOF;
  8039. };
  8040. CCITTFaxStream.prototype.getWhiteCode = function ccittFaxStreamGetWhiteCode() {
  8041. var code = 0;
  8042. var p;
  8043. if (this.eoblock) {
  8044. code = this.lookBits(12);
  8045. if (code === ccittEOF) {
  8046. return 1;
  8047. }
  8048. if (code >> 5 === 0) {
  8049. p = whiteTable1[code];
  8050. } else {
  8051. p = whiteTable2[code >> 3];
  8052. }
  8053. if (p[0] > 0) {
  8054. this.eatBits(p[0]);
  8055. return p[1];
  8056. }
  8057. } else {
  8058. var result = this.findTableCode(1, 9, whiteTable2);
  8059. if (result[0]) {
  8060. return result[1];
  8061. }
  8062. result = this.findTableCode(11, 12, whiteTable1);
  8063. if (result[0]) {
  8064. return result[1];
  8065. }
  8066. }
  8067. info('bad white code');
  8068. this.eatBits(1);
  8069. return 1;
  8070. };
  8071. CCITTFaxStream.prototype.getBlackCode = function ccittFaxStreamGetBlackCode() {
  8072. var code, p;
  8073. if (this.eoblock) {
  8074. code = this.lookBits(13);
  8075. if (code === ccittEOF) {
  8076. return 1;
  8077. }
  8078. if (code >> 7 === 0) {
  8079. p = blackTable1[code];
  8080. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  8081. p = blackTable2[(code >> 1) - 64];
  8082. } else {
  8083. p = blackTable3[code >> 7];
  8084. }
  8085. if (p[0] > 0) {
  8086. this.eatBits(p[0]);
  8087. return p[1];
  8088. }
  8089. } else {
  8090. var result = this.findTableCode(2, 6, blackTable3);
  8091. if (result[0]) {
  8092. return result[1];
  8093. }
  8094. result = this.findTableCode(7, 12, blackTable2, 64);
  8095. if (result[0]) {
  8096. return result[1];
  8097. }
  8098. result = this.findTableCode(10, 13, blackTable1);
  8099. if (result[0]) {
  8100. return result[1];
  8101. }
  8102. }
  8103. info('bad black code');
  8104. this.eatBits(1);
  8105. return 1;
  8106. };
  8107. CCITTFaxStream.prototype.lookBits = function CCITTFaxStream_lookBits(n) {
  8108. var c;
  8109. while (this.inputBits < n) {
  8110. if ((c = this.str.getByte()) === -1) {
  8111. if (this.inputBits === 0) {
  8112. return ccittEOF;
  8113. }
  8114. return this.inputBuf << n - this.inputBits & 0xFFFF >> 16 - n;
  8115. }
  8116. this.inputBuf = this.inputBuf << 8 | c;
  8117. this.inputBits += 8;
  8118. }
  8119. return this.inputBuf >> this.inputBits - n & 0xFFFF >> 16 - n;
  8120. };
  8121. CCITTFaxStream.prototype.eatBits = function CCITTFaxStream_eatBits(n) {
  8122. if ((this.inputBits -= n) < 0) {
  8123. this.inputBits = 0;
  8124. }
  8125. };
  8126. return CCITTFaxStream;
  8127. }();
  8128. var LZWStream = function LZWStreamClosure() {
  8129. function LZWStream(str, maybeLength, earlyChange) {
  8130. this.str = str;
  8131. this.dict = str.dict;
  8132. this.cachedData = 0;
  8133. this.bitsCached = 0;
  8134. var maxLzwDictionarySize = 4096;
  8135. var lzwState = {
  8136. earlyChange: earlyChange,
  8137. codeLength: 9,
  8138. nextCode: 258,
  8139. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  8140. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  8141. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  8142. currentSequence: new Uint8Array(maxLzwDictionarySize),
  8143. currentSequenceLength: 0
  8144. };
  8145. for (var i = 0; i < 256; ++i) {
  8146. lzwState.dictionaryValues[i] = i;
  8147. lzwState.dictionaryLengths[i] = 1;
  8148. }
  8149. this.lzwState = lzwState;
  8150. DecodeStream.call(this, maybeLength);
  8151. }
  8152. LZWStream.prototype = Object.create(DecodeStream.prototype);
  8153. LZWStream.prototype.readBits = function LZWStream_readBits(n) {
  8154. var bitsCached = this.bitsCached;
  8155. var cachedData = this.cachedData;
  8156. while (bitsCached < n) {
  8157. var c = this.str.getByte();
  8158. if (c === -1) {
  8159. this.eof = true;
  8160. return null;
  8161. }
  8162. cachedData = cachedData << 8 | c;
  8163. bitsCached += 8;
  8164. }
  8165. this.bitsCached = bitsCached -= n;
  8166. this.cachedData = cachedData;
  8167. this.lastCode = null;
  8168. return cachedData >>> bitsCached & (1 << n) - 1;
  8169. };
  8170. LZWStream.prototype.readBlock = function LZWStream_readBlock() {
  8171. var blockSize = 512;
  8172. var estimatedDecodedSize = blockSize * 2, decodedSizeDelta = blockSize;
  8173. var i, j, q;
  8174. var lzwState = this.lzwState;
  8175. if (!lzwState) {
  8176. return;
  8177. }
  8178. var earlyChange = lzwState.earlyChange;
  8179. var nextCode = lzwState.nextCode;
  8180. var dictionaryValues = lzwState.dictionaryValues;
  8181. var dictionaryLengths = lzwState.dictionaryLengths;
  8182. var dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  8183. var codeLength = lzwState.codeLength;
  8184. var prevCode = lzwState.prevCode;
  8185. var currentSequence = lzwState.currentSequence;
  8186. var currentSequenceLength = lzwState.currentSequenceLength;
  8187. var decodedLength = 0;
  8188. var currentBufferLength = this.bufferLength;
  8189. var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  8190. for (i = 0; i < blockSize; i++) {
  8191. var code = this.readBits(codeLength);
  8192. var hasPrev = currentSequenceLength > 0;
  8193. if (code < 256) {
  8194. currentSequence[0] = code;
  8195. currentSequenceLength = 1;
  8196. } else if (code >= 258) {
  8197. if (code < nextCode) {
  8198. currentSequenceLength = dictionaryLengths[code];
  8199. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  8200. currentSequence[j] = dictionaryValues[q];
  8201. q = dictionaryPrevCodes[q];
  8202. }
  8203. } else {
  8204. currentSequence[currentSequenceLength++] = currentSequence[0];
  8205. }
  8206. } else if (code === 256) {
  8207. codeLength = 9;
  8208. nextCode = 258;
  8209. currentSequenceLength = 0;
  8210. continue;
  8211. } else {
  8212. this.eof = true;
  8213. delete this.lzwState;
  8214. break;
  8215. }
  8216. if (hasPrev) {
  8217. dictionaryPrevCodes[nextCode] = prevCode;
  8218. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  8219. dictionaryValues[nextCode] = currentSequence[0];
  8220. nextCode++;
  8221. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  8222. }
  8223. prevCode = code;
  8224. decodedLength += currentSequenceLength;
  8225. if (estimatedDecodedSize < decodedLength) {
  8226. do {
  8227. estimatedDecodedSize += decodedSizeDelta;
  8228. } while (estimatedDecodedSize < decodedLength);
  8229. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  8230. }
  8231. for (j = 0; j < currentSequenceLength; j++) {
  8232. buffer[currentBufferLength++] = currentSequence[j];
  8233. }
  8234. }
  8235. lzwState.nextCode = nextCode;
  8236. lzwState.codeLength = codeLength;
  8237. lzwState.prevCode = prevCode;
  8238. lzwState.currentSequenceLength = currentSequenceLength;
  8239. this.bufferLength = currentBufferLength;
  8240. };
  8241. return LZWStream;
  8242. }();
  8243. var NullStream = function NullStreamClosure() {
  8244. function NullStream() {
  8245. Stream.call(this, new Uint8Array(0));
  8246. }
  8247. NullStream.prototype = Stream.prototype;
  8248. return NullStream;
  8249. }();
  8250. exports.Ascii85Stream = Ascii85Stream;
  8251. exports.AsciiHexStream = AsciiHexStream;
  8252. exports.CCITTFaxStream = CCITTFaxStream;
  8253. exports.DecryptStream = DecryptStream;
  8254. exports.DecodeStream = DecodeStream;
  8255. exports.FlateStream = FlateStream;
  8256. exports.Jbig2Stream = Jbig2Stream;
  8257. exports.JpegStream = JpegStream;
  8258. exports.JpxStream = JpxStream;
  8259. exports.NullStream = NullStream;
  8260. exports.PredictorStream = PredictorStream;
  8261. exports.RunLengthStream = RunLengthStream;
  8262. exports.Stream = Stream;
  8263. exports.StreamsSequenceStream = StreamsSequenceStream;
  8264. exports.StringStream = StringStream;
  8265. exports.LZWStream = LZWStream;
  8266. /***/ }),
  8267. /* 3 */
  8268. /***/ (function(module, exports, __w_pdfjs_require__) {
  8269. "use strict";
  8270. var sharedUtil = __w_pdfjs_require__(0);
  8271. var corePrimitives = __w_pdfjs_require__(1);
  8272. var coreFunction = __w_pdfjs_require__(6);
  8273. var error = sharedUtil.error;
  8274. var info = sharedUtil.info;
  8275. var isArray = sharedUtil.isArray;
  8276. var isString = sharedUtil.isString;
  8277. var shadow = sharedUtil.shadow;
  8278. var warn = sharedUtil.warn;
  8279. var isDict = corePrimitives.isDict;
  8280. var isName = corePrimitives.isName;
  8281. var isStream = corePrimitives.isStream;
  8282. var PDFFunction = coreFunction.PDFFunction;
  8283. var ColorSpace = function ColorSpaceClosure() {
  8284. function resizeRgbImage(src, bpc, w1, h1, w2, h2, alpha01, dest) {
  8285. var COMPONENTS = 3;
  8286. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  8287. var xRatio = w1 / w2;
  8288. var yRatio = h1 / h2;
  8289. var i, j, py, newIndex = 0, oldIndex;
  8290. var xScaled = new Uint16Array(w2);
  8291. var w1Scanline = w1 * COMPONENTS;
  8292. for (i = 0; i < w2; i++) {
  8293. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  8294. }
  8295. for (i = 0; i < h2; i++) {
  8296. py = Math.floor(i * yRatio) * w1Scanline;
  8297. for (j = 0; j < w2; j++) {
  8298. oldIndex = py + xScaled[j];
  8299. dest[newIndex++] = src[oldIndex++];
  8300. dest[newIndex++] = src[oldIndex++];
  8301. dest[newIndex++] = src[oldIndex++];
  8302. newIndex += alpha01;
  8303. }
  8304. }
  8305. }
  8306. function ColorSpace() {
  8307. error('should not call ColorSpace constructor');
  8308. }
  8309. ColorSpace.prototype = {
  8310. getRgb: function ColorSpace_getRgb(src, srcOffset) {
  8311. var rgb = new Uint8Array(3);
  8312. this.getRgbItem(src, srcOffset, rgb, 0);
  8313. return rgb;
  8314. },
  8315. getRgbItem: function ColorSpace_getRgbItem(src, srcOffset, dest, destOffset) {
  8316. error('Should not call ColorSpace.getRgbItem');
  8317. },
  8318. getRgbBuffer: function ColorSpace_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8319. error('Should not call ColorSpace.getRgbBuffer');
  8320. },
  8321. getOutputLength: function ColorSpace_getOutputLength(inputLength, alpha01) {
  8322. error('Should not call ColorSpace.getOutputLength');
  8323. },
  8324. isPassthrough: function ColorSpace_isPassthrough(bits) {
  8325. return false;
  8326. },
  8327. fillRgb: function ColorSpace_fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  8328. var count = originalWidth * originalHeight;
  8329. var rgbBuf = null;
  8330. var numComponentColors = 1 << bpc;
  8331. var needsResizing = originalHeight !== height || originalWidth !== width;
  8332. var i, ii;
  8333. if (this.isPassthrough(bpc)) {
  8334. rgbBuf = comps;
  8335. } else if (this.numComps === 1 && count > numComponentColors && this.name !== 'DeviceGray' && this.name !== 'DeviceRGB') {
  8336. var allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  8337. var key;
  8338. for (i = 0; i < numComponentColors; i++) {
  8339. allColors[i] = i;
  8340. }
  8341. var colorMap = new Uint8Array(numComponentColors * 3);
  8342. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  8343. var destPos, rgbPos;
  8344. if (!needsResizing) {
  8345. destPos = 0;
  8346. for (i = 0; i < count; ++i) {
  8347. key = comps[i] * 3;
  8348. dest[destPos++] = colorMap[key];
  8349. dest[destPos++] = colorMap[key + 1];
  8350. dest[destPos++] = colorMap[key + 2];
  8351. destPos += alpha01;
  8352. }
  8353. } else {
  8354. rgbBuf = new Uint8Array(count * 3);
  8355. rgbPos = 0;
  8356. for (i = 0; i < count; ++i) {
  8357. key = comps[i] * 3;
  8358. rgbBuf[rgbPos++] = colorMap[key];
  8359. rgbBuf[rgbPos++] = colorMap[key + 1];
  8360. rgbBuf[rgbPos++] = colorMap[key + 2];
  8361. }
  8362. }
  8363. } else {
  8364. if (!needsResizing) {
  8365. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  8366. } else {
  8367. rgbBuf = new Uint8Array(count * 3);
  8368. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  8369. }
  8370. }
  8371. if (rgbBuf) {
  8372. if (needsResizing) {
  8373. resizeRgbImage(rgbBuf, bpc, originalWidth, originalHeight, width, height, alpha01, dest);
  8374. } else {
  8375. rgbPos = 0;
  8376. destPos = 0;
  8377. for (i = 0, ii = width * actualHeight; i < ii; i++) {
  8378. dest[destPos++] = rgbBuf[rgbPos++];
  8379. dest[destPos++] = rgbBuf[rgbPos++];
  8380. dest[destPos++] = rgbBuf[rgbPos++];
  8381. destPos += alpha01;
  8382. }
  8383. }
  8384. }
  8385. },
  8386. usesZeroToOneRange: true
  8387. };
  8388. ColorSpace.parse = function ColorSpace_parse(cs, xref, res) {
  8389. var IR = ColorSpace.parseToIR(cs, xref, res);
  8390. if (IR instanceof AlternateCS) {
  8391. return IR;
  8392. }
  8393. return ColorSpace.fromIR(IR);
  8394. };
  8395. ColorSpace.fromIR = function ColorSpace_fromIR(IR) {
  8396. var name = isArray(IR) ? IR[0] : IR;
  8397. var whitePoint, blackPoint, gamma;
  8398. switch (name) {
  8399. case 'DeviceGrayCS':
  8400. return this.singletons.gray;
  8401. case 'DeviceRgbCS':
  8402. return this.singletons.rgb;
  8403. case 'DeviceCmykCS':
  8404. return this.singletons.cmyk;
  8405. case 'CalGrayCS':
  8406. whitePoint = IR[1];
  8407. blackPoint = IR[2];
  8408. gamma = IR[3];
  8409. return new CalGrayCS(whitePoint, blackPoint, gamma);
  8410. case 'CalRGBCS':
  8411. whitePoint = IR[1];
  8412. blackPoint = IR[2];
  8413. gamma = IR[3];
  8414. var matrix = IR[4];
  8415. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  8416. case 'PatternCS':
  8417. var basePatternCS = IR[1];
  8418. if (basePatternCS) {
  8419. basePatternCS = ColorSpace.fromIR(basePatternCS);
  8420. }
  8421. return new PatternCS(basePatternCS);
  8422. case 'IndexedCS':
  8423. var baseIndexedCS = IR[1];
  8424. var hiVal = IR[2];
  8425. var lookup = IR[3];
  8426. return new IndexedCS(ColorSpace.fromIR(baseIndexedCS), hiVal, lookup);
  8427. case 'AlternateCS':
  8428. var numComps = IR[1];
  8429. var alt = IR[2];
  8430. var tintFnIR = IR[3];
  8431. return new AlternateCS(numComps, ColorSpace.fromIR(alt), PDFFunction.fromIR(tintFnIR));
  8432. case 'LabCS':
  8433. whitePoint = IR[1];
  8434. blackPoint = IR[2];
  8435. var range = IR[3];
  8436. return new LabCS(whitePoint, blackPoint, range);
  8437. default:
  8438. error('Unknown name ' + name);
  8439. }
  8440. return null;
  8441. };
  8442. ColorSpace.parseToIR = function ColorSpace_parseToIR(cs, xref, res) {
  8443. if (isName(cs)) {
  8444. var colorSpaces = res.get('ColorSpace');
  8445. if (isDict(colorSpaces)) {
  8446. var refcs = colorSpaces.get(cs.name);
  8447. if (refcs) {
  8448. cs = refcs;
  8449. }
  8450. }
  8451. }
  8452. cs = xref.fetchIfRef(cs);
  8453. if (isName(cs)) {
  8454. switch (cs.name) {
  8455. case 'DeviceGray':
  8456. case 'G':
  8457. return 'DeviceGrayCS';
  8458. case 'DeviceRGB':
  8459. case 'RGB':
  8460. return 'DeviceRgbCS';
  8461. case 'DeviceCMYK':
  8462. case 'CMYK':
  8463. return 'DeviceCmykCS';
  8464. case 'Pattern':
  8465. return [
  8466. 'PatternCS',
  8467. null
  8468. ];
  8469. default:
  8470. error('unrecognized colorspace ' + cs.name);
  8471. }
  8472. } else if (isArray(cs)) {
  8473. var mode = xref.fetchIfRef(cs[0]).name;
  8474. var numComps, params, alt, whitePoint, blackPoint, gamma;
  8475. switch (mode) {
  8476. case 'DeviceGray':
  8477. case 'G':
  8478. return 'DeviceGrayCS';
  8479. case 'DeviceRGB':
  8480. case 'RGB':
  8481. return 'DeviceRgbCS';
  8482. case 'DeviceCMYK':
  8483. case 'CMYK':
  8484. return 'DeviceCmykCS';
  8485. case 'CalGray':
  8486. params = xref.fetchIfRef(cs[1]);
  8487. whitePoint = params.getArray('WhitePoint');
  8488. blackPoint = params.getArray('BlackPoint');
  8489. gamma = params.get('Gamma');
  8490. return [
  8491. 'CalGrayCS',
  8492. whitePoint,
  8493. blackPoint,
  8494. gamma
  8495. ];
  8496. case 'CalRGB':
  8497. params = xref.fetchIfRef(cs[1]);
  8498. whitePoint = params.getArray('WhitePoint');
  8499. blackPoint = params.getArray('BlackPoint');
  8500. gamma = params.getArray('Gamma');
  8501. var matrix = params.getArray('Matrix');
  8502. return [
  8503. 'CalRGBCS',
  8504. whitePoint,
  8505. blackPoint,
  8506. gamma,
  8507. matrix
  8508. ];
  8509. case 'ICCBased':
  8510. var stream = xref.fetchIfRef(cs[1]);
  8511. var dict = stream.dict;
  8512. numComps = dict.get('N');
  8513. alt = dict.get('Alternate');
  8514. if (alt) {
  8515. var altIR = ColorSpace.parseToIR(alt, xref, res);
  8516. var altCS = ColorSpace.fromIR(altIR);
  8517. if (altCS.numComps === numComps) {
  8518. return altIR;
  8519. }
  8520. warn('ICCBased color space: Ignoring incorrect /Alternate entry.');
  8521. }
  8522. if (numComps === 1) {
  8523. return 'DeviceGrayCS';
  8524. } else if (numComps === 3) {
  8525. return 'DeviceRgbCS';
  8526. } else if (numComps === 4) {
  8527. return 'DeviceCmykCS';
  8528. }
  8529. break;
  8530. case 'Pattern':
  8531. var basePatternCS = cs[1] || null;
  8532. if (basePatternCS) {
  8533. basePatternCS = ColorSpace.parseToIR(basePatternCS, xref, res);
  8534. }
  8535. return [
  8536. 'PatternCS',
  8537. basePatternCS
  8538. ];
  8539. case 'Indexed':
  8540. case 'I':
  8541. var baseIndexedCS = ColorSpace.parseToIR(cs[1], xref, res);
  8542. var hiVal = xref.fetchIfRef(cs[2]) + 1;
  8543. var lookup = xref.fetchIfRef(cs[3]);
  8544. if (isStream(lookup)) {
  8545. lookup = lookup.getBytes();
  8546. }
  8547. return [
  8548. 'IndexedCS',
  8549. baseIndexedCS,
  8550. hiVal,
  8551. lookup
  8552. ];
  8553. case 'Separation':
  8554. case 'DeviceN':
  8555. var name = xref.fetchIfRef(cs[1]);
  8556. numComps = isArray(name) ? name.length : 1;
  8557. alt = ColorSpace.parseToIR(cs[2], xref, res);
  8558. var tintFnIR = PDFFunction.getIR(xref, xref.fetchIfRef(cs[3]));
  8559. return [
  8560. 'AlternateCS',
  8561. numComps,
  8562. alt,
  8563. tintFnIR
  8564. ];
  8565. case 'Lab':
  8566. params = xref.fetchIfRef(cs[1]);
  8567. whitePoint = params.getArray('WhitePoint');
  8568. blackPoint = params.getArray('BlackPoint');
  8569. var range = params.getArray('Range');
  8570. return [
  8571. 'LabCS',
  8572. whitePoint,
  8573. blackPoint,
  8574. range
  8575. ];
  8576. default:
  8577. error('unimplemented color space object "' + mode + '"');
  8578. }
  8579. } else {
  8580. error('unrecognized color space object: "' + cs + '"');
  8581. }
  8582. return null;
  8583. };
  8584. ColorSpace.isDefaultDecode = function ColorSpace_isDefaultDecode(decode, n) {
  8585. if (!isArray(decode)) {
  8586. return true;
  8587. }
  8588. if (n * 2 !== decode.length) {
  8589. warn('The decode map is not the correct length');
  8590. return true;
  8591. }
  8592. for (var i = 0, ii = decode.length; i < ii; i += 2) {
  8593. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  8594. return false;
  8595. }
  8596. }
  8597. return true;
  8598. };
  8599. ColorSpace.singletons = {
  8600. get gray() {
  8601. return shadow(this, 'gray', new DeviceGrayCS());
  8602. },
  8603. get rgb() {
  8604. return shadow(this, 'rgb', new DeviceRgbCS());
  8605. },
  8606. get cmyk() {
  8607. return shadow(this, 'cmyk', new DeviceCmykCS());
  8608. }
  8609. };
  8610. return ColorSpace;
  8611. }();
  8612. var AlternateCS = function AlternateCSClosure() {
  8613. function AlternateCS(numComps, base, tintFn) {
  8614. this.name = 'Alternate';
  8615. this.numComps = numComps;
  8616. this.defaultColor = new Float32Array(numComps);
  8617. for (var i = 0; i < numComps; ++i) {
  8618. this.defaultColor[i] = 1;
  8619. }
  8620. this.base = base;
  8621. this.tintFn = tintFn;
  8622. this.tmpBuf = new Float32Array(base.numComps);
  8623. }
  8624. AlternateCS.prototype = {
  8625. getRgb: ColorSpace.prototype.getRgb,
  8626. getRgbItem: function AlternateCS_getRgbItem(src, srcOffset, dest, destOffset) {
  8627. var tmpBuf = this.tmpBuf;
  8628. this.tintFn(src, srcOffset, tmpBuf, 0);
  8629. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  8630. },
  8631. getRgbBuffer: function AlternateCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8632. var tintFn = this.tintFn;
  8633. var base = this.base;
  8634. var scale = 1 / ((1 << bits) - 1);
  8635. var baseNumComps = base.numComps;
  8636. var usesZeroToOneRange = base.usesZeroToOneRange;
  8637. var isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  8638. var pos = isPassthrough ? destOffset : 0;
  8639. var baseBuf = isPassthrough ? dest : new Uint8Array(baseNumComps * count);
  8640. var numComps = this.numComps;
  8641. var scaled = new Float32Array(numComps);
  8642. var tinted = new Float32Array(baseNumComps);
  8643. var i, j;
  8644. for (i = 0; i < count; i++) {
  8645. for (j = 0; j < numComps; j++) {
  8646. scaled[j] = src[srcOffset++] * scale;
  8647. }
  8648. tintFn(scaled, 0, tinted, 0);
  8649. if (usesZeroToOneRange) {
  8650. for (j = 0; j < baseNumComps; j++) {
  8651. baseBuf[pos++] = tinted[j] * 255;
  8652. }
  8653. } else {
  8654. base.getRgbItem(tinted, 0, baseBuf, pos);
  8655. pos += baseNumComps;
  8656. }
  8657. }
  8658. if (!isPassthrough) {
  8659. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  8660. }
  8661. },
  8662. getOutputLength: function AlternateCS_getOutputLength(inputLength, alpha01) {
  8663. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  8664. },
  8665. isPassthrough: ColorSpace.prototype.isPassthrough,
  8666. fillRgb: ColorSpace.prototype.fillRgb,
  8667. isDefaultDecode: function AlternateCS_isDefaultDecode(decodeMap) {
  8668. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  8669. },
  8670. usesZeroToOneRange: true
  8671. };
  8672. return AlternateCS;
  8673. }();
  8674. var PatternCS = function PatternCSClosure() {
  8675. function PatternCS(baseCS) {
  8676. this.name = 'Pattern';
  8677. this.base = baseCS;
  8678. }
  8679. PatternCS.prototype = {};
  8680. return PatternCS;
  8681. }();
  8682. var IndexedCS = function IndexedCSClosure() {
  8683. function IndexedCS(base, highVal, lookup) {
  8684. this.name = 'Indexed';
  8685. this.numComps = 1;
  8686. this.defaultColor = new Uint8Array(this.numComps);
  8687. this.base = base;
  8688. this.highVal = highVal;
  8689. var baseNumComps = base.numComps;
  8690. var length = baseNumComps * highVal;
  8691. if (isStream(lookup)) {
  8692. this.lookup = new Uint8Array(length);
  8693. var bytes = lookup.getBytes(length);
  8694. this.lookup.set(bytes);
  8695. } else if (isString(lookup)) {
  8696. this.lookup = new Uint8Array(length);
  8697. for (var i = 0; i < length; ++i) {
  8698. this.lookup[i] = lookup.charCodeAt(i);
  8699. }
  8700. } else if (lookup instanceof Uint8Array || lookup instanceof Array) {
  8701. this.lookup = lookup;
  8702. } else {
  8703. error('Unrecognized lookup table: ' + lookup);
  8704. }
  8705. }
  8706. IndexedCS.prototype = {
  8707. getRgb: ColorSpace.prototype.getRgb,
  8708. getRgbItem: function IndexedCS_getRgbItem(src, srcOffset, dest, destOffset) {
  8709. var numComps = this.base.numComps;
  8710. var start = src[srcOffset] * numComps;
  8711. this.base.getRgbItem(this.lookup, start, dest, destOffset);
  8712. },
  8713. getRgbBuffer: function IndexedCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8714. var base = this.base;
  8715. var numComps = base.numComps;
  8716. var outputDelta = base.getOutputLength(numComps, alpha01);
  8717. var lookup = this.lookup;
  8718. for (var i = 0; i < count; ++i) {
  8719. var lookupPos = src[srcOffset++] * numComps;
  8720. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  8721. destOffset += outputDelta;
  8722. }
  8723. },
  8724. getOutputLength: function IndexedCS_getOutputLength(inputLength, alpha01) {
  8725. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  8726. },
  8727. isPassthrough: ColorSpace.prototype.isPassthrough,
  8728. fillRgb: ColorSpace.prototype.fillRgb,
  8729. isDefaultDecode: function IndexedCS_isDefaultDecode(decodeMap) {
  8730. return true;
  8731. },
  8732. usesZeroToOneRange: true
  8733. };
  8734. return IndexedCS;
  8735. }();
  8736. var DeviceGrayCS = function DeviceGrayCSClosure() {
  8737. function DeviceGrayCS() {
  8738. this.name = 'DeviceGray';
  8739. this.numComps = 1;
  8740. this.defaultColor = new Float32Array(this.numComps);
  8741. }
  8742. DeviceGrayCS.prototype = {
  8743. getRgb: ColorSpace.prototype.getRgb,
  8744. getRgbItem: function DeviceGrayCS_getRgbItem(src, srcOffset, dest, destOffset) {
  8745. var c = src[srcOffset] * 255 | 0;
  8746. c = c < 0 ? 0 : c > 255 ? 255 : c;
  8747. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  8748. },
  8749. getRgbBuffer: function DeviceGrayCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8750. var scale = 255 / ((1 << bits) - 1);
  8751. var j = srcOffset, q = destOffset;
  8752. for (var i = 0; i < count; ++i) {
  8753. var c = scale * src[j++] | 0;
  8754. dest[q++] = c;
  8755. dest[q++] = c;
  8756. dest[q++] = c;
  8757. q += alpha01;
  8758. }
  8759. },
  8760. getOutputLength: function DeviceGrayCS_getOutputLength(inputLength, alpha01) {
  8761. return inputLength * (3 + alpha01);
  8762. },
  8763. isPassthrough: ColorSpace.prototype.isPassthrough,
  8764. fillRgb: ColorSpace.prototype.fillRgb,
  8765. isDefaultDecode: function DeviceGrayCS_isDefaultDecode(decodeMap) {
  8766. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  8767. },
  8768. usesZeroToOneRange: true
  8769. };
  8770. return DeviceGrayCS;
  8771. }();
  8772. var DeviceRgbCS = function DeviceRgbCSClosure() {
  8773. function DeviceRgbCS() {
  8774. this.name = 'DeviceRGB';
  8775. this.numComps = 3;
  8776. this.defaultColor = new Float32Array(this.numComps);
  8777. }
  8778. DeviceRgbCS.prototype = {
  8779. getRgb: ColorSpace.prototype.getRgb,
  8780. getRgbItem: function DeviceRgbCS_getRgbItem(src, srcOffset, dest, destOffset) {
  8781. var r = src[srcOffset] * 255 | 0;
  8782. var g = src[srcOffset + 1] * 255 | 0;
  8783. var b = src[srcOffset + 2] * 255 | 0;
  8784. dest[destOffset] = r < 0 ? 0 : r > 255 ? 255 : r;
  8785. dest[destOffset + 1] = g < 0 ? 0 : g > 255 ? 255 : g;
  8786. dest[destOffset + 2] = b < 0 ? 0 : b > 255 ? 255 : b;
  8787. },
  8788. getRgbBuffer: function DeviceRgbCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8789. if (bits === 8 && alpha01 === 0) {
  8790. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  8791. return;
  8792. }
  8793. var scale = 255 / ((1 << bits) - 1);
  8794. var j = srcOffset, q = destOffset;
  8795. for (var i = 0; i < count; ++i) {
  8796. dest[q++] = scale * src[j++] | 0;
  8797. dest[q++] = scale * src[j++] | 0;
  8798. dest[q++] = scale * src[j++] | 0;
  8799. q += alpha01;
  8800. }
  8801. },
  8802. getOutputLength: function DeviceRgbCS_getOutputLength(inputLength, alpha01) {
  8803. return inputLength * (3 + alpha01) / 3 | 0;
  8804. },
  8805. isPassthrough: function DeviceRgbCS_isPassthrough(bits) {
  8806. return bits === 8;
  8807. },
  8808. fillRgb: ColorSpace.prototype.fillRgb,
  8809. isDefaultDecode: function DeviceRgbCS_isDefaultDecode(decodeMap) {
  8810. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  8811. },
  8812. usesZeroToOneRange: true
  8813. };
  8814. return DeviceRgbCS;
  8815. }();
  8816. var DeviceCmykCS = function DeviceCmykCSClosure() {
  8817. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  8818. var c = src[srcOffset + 0] * srcScale;
  8819. var m = src[srcOffset + 1] * srcScale;
  8820. var y = src[srcOffset + 2] * srcScale;
  8821. var k = src[srcOffset + 3] * srcScale;
  8822. 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;
  8823. 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;
  8824. 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;
  8825. dest[destOffset] = r > 255 ? 255 : r < 0 ? 0 : r;
  8826. dest[destOffset + 1] = g > 255 ? 255 : g < 0 ? 0 : g;
  8827. dest[destOffset + 2] = b > 255 ? 255 : b < 0 ? 0 : b;
  8828. }
  8829. function DeviceCmykCS() {
  8830. this.name = 'DeviceCMYK';
  8831. this.numComps = 4;
  8832. this.defaultColor = new Float32Array(this.numComps);
  8833. this.defaultColor[3] = 1;
  8834. }
  8835. DeviceCmykCS.prototype = {
  8836. getRgb: ColorSpace.prototype.getRgb,
  8837. getRgbItem: function DeviceCmykCS_getRgbItem(src, srcOffset, dest, destOffset) {
  8838. convertToRgb(src, srcOffset, 1, dest, destOffset);
  8839. },
  8840. getRgbBuffer: function DeviceCmykCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8841. var scale = 1 / ((1 << bits) - 1);
  8842. for (var i = 0; i < count; i++) {
  8843. convertToRgb(src, srcOffset, scale, dest, destOffset);
  8844. srcOffset += 4;
  8845. destOffset += 3 + alpha01;
  8846. }
  8847. },
  8848. getOutputLength: function DeviceCmykCS_getOutputLength(inputLength, alpha01) {
  8849. return inputLength / 4 * (3 + alpha01) | 0;
  8850. },
  8851. isPassthrough: ColorSpace.prototype.isPassthrough,
  8852. fillRgb: ColorSpace.prototype.fillRgb,
  8853. isDefaultDecode: function DeviceCmykCS_isDefaultDecode(decodeMap) {
  8854. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  8855. },
  8856. usesZeroToOneRange: true
  8857. };
  8858. return DeviceCmykCS;
  8859. }();
  8860. var CalGrayCS = function CalGrayCSClosure() {
  8861. function CalGrayCS(whitePoint, blackPoint, gamma) {
  8862. this.name = 'CalGray';
  8863. this.numComps = 1;
  8864. this.defaultColor = new Float32Array(this.numComps);
  8865. if (!whitePoint) {
  8866. error('WhitePoint missing - required for color space CalGray');
  8867. }
  8868. blackPoint = blackPoint || [
  8869. 0,
  8870. 0,
  8871. 0
  8872. ];
  8873. gamma = gamma || 1;
  8874. this.XW = whitePoint[0];
  8875. this.YW = whitePoint[1];
  8876. this.ZW = whitePoint[2];
  8877. this.XB = blackPoint[0];
  8878. this.YB = blackPoint[1];
  8879. this.ZB = blackPoint[2];
  8880. this.G = gamma;
  8881. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  8882. error('Invalid WhitePoint components for ' + this.name + ', no fallback available');
  8883. }
  8884. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  8885. info('Invalid BlackPoint for ' + this.name + ', falling back to default');
  8886. this.XB = this.YB = this.ZB = 0;
  8887. }
  8888. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  8889. warn(this.name + ', BlackPoint: XB: ' + this.XB + ', YB: ' + this.YB + ', ZB: ' + this.ZB + ', only default values are supported.');
  8890. }
  8891. if (this.G < 1) {
  8892. info('Invalid Gamma: ' + this.G + ' for ' + this.name + ', falling back to default');
  8893. this.G = 1;
  8894. }
  8895. }
  8896. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  8897. var A = src[srcOffset] * scale;
  8898. var AG = Math.pow(A, cs.G);
  8899. var L = cs.YW * AG;
  8900. var val = Math.max(295.8 * Math.pow(L, 0.333333333333333333) - 40.8, 0) | 0;
  8901. dest[destOffset] = val;
  8902. dest[destOffset + 1] = val;
  8903. dest[destOffset + 2] = val;
  8904. }
  8905. CalGrayCS.prototype = {
  8906. getRgb: ColorSpace.prototype.getRgb,
  8907. getRgbItem: function CalGrayCS_getRgbItem(src, srcOffset, dest, destOffset) {
  8908. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  8909. },
  8910. getRgbBuffer: function CalGrayCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8911. var scale = 1 / ((1 << bits) - 1);
  8912. for (var i = 0; i < count; ++i) {
  8913. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  8914. srcOffset += 1;
  8915. destOffset += 3 + alpha01;
  8916. }
  8917. },
  8918. getOutputLength: function CalGrayCS_getOutputLength(inputLength, alpha01) {
  8919. return inputLength * (3 + alpha01);
  8920. },
  8921. isPassthrough: ColorSpace.prototype.isPassthrough,
  8922. fillRgb: ColorSpace.prototype.fillRgb,
  8923. isDefaultDecode: function CalGrayCS_isDefaultDecode(decodeMap) {
  8924. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  8925. },
  8926. usesZeroToOneRange: true
  8927. };
  8928. return CalGrayCS;
  8929. }();
  8930. var CalRGBCS = function CalRGBCSClosure() {
  8931. var BRADFORD_SCALE_MATRIX = new Float32Array([
  8932. 0.8951,
  8933. 0.2664,
  8934. -0.1614,
  8935. -0.7502,
  8936. 1.7135,
  8937. 0.0367,
  8938. 0.0389,
  8939. -0.0685,
  8940. 1.0296
  8941. ]);
  8942. var BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([
  8943. 0.9869929,
  8944. -0.1470543,
  8945. 0.1599627,
  8946. 0.4323053,
  8947. 0.5183603,
  8948. 0.0492912,
  8949. -0.0085287,
  8950. 0.0400428,
  8951. 0.9684867
  8952. ]);
  8953. var SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([
  8954. 3.2404542,
  8955. -1.5371385,
  8956. -0.4985314,
  8957. -0.9692660,
  8958. 1.8760108,
  8959. 0.0415560,
  8960. 0.0556434,
  8961. -0.2040259,
  8962. 1.0572252
  8963. ]);
  8964. var FLAT_WHITEPOINT_MATRIX = new Float32Array([
  8965. 1,
  8966. 1,
  8967. 1
  8968. ]);
  8969. var tempNormalizeMatrix = new Float32Array(3);
  8970. var tempConvertMatrix1 = new Float32Array(3);
  8971. var tempConvertMatrix2 = new Float32Array(3);
  8972. var DECODE_L_CONSTANT = Math.pow((8 + 16) / 116, 3) / 8.0;
  8973. function CalRGBCS(whitePoint, blackPoint, gamma, matrix) {
  8974. this.name = 'CalRGB';
  8975. this.numComps = 3;
  8976. this.defaultColor = new Float32Array(this.numComps);
  8977. if (!whitePoint) {
  8978. error('WhitePoint missing - required for color space CalRGB');
  8979. }
  8980. blackPoint = blackPoint || new Float32Array(3);
  8981. gamma = gamma || new Float32Array([
  8982. 1,
  8983. 1,
  8984. 1
  8985. ]);
  8986. matrix = matrix || new Float32Array([
  8987. 1,
  8988. 0,
  8989. 0,
  8990. 0,
  8991. 1,
  8992. 0,
  8993. 0,
  8994. 0,
  8995. 1
  8996. ]);
  8997. var XW = whitePoint[0];
  8998. var YW = whitePoint[1];
  8999. var ZW = whitePoint[2];
  9000. this.whitePoint = whitePoint;
  9001. var XB = blackPoint[0];
  9002. var YB = blackPoint[1];
  9003. var ZB = blackPoint[2];
  9004. this.blackPoint = blackPoint;
  9005. this.GR = gamma[0];
  9006. this.GG = gamma[1];
  9007. this.GB = gamma[2];
  9008. this.MXA = matrix[0];
  9009. this.MYA = matrix[1];
  9010. this.MZA = matrix[2];
  9011. this.MXB = matrix[3];
  9012. this.MYB = matrix[4];
  9013. this.MZB = matrix[5];
  9014. this.MXC = matrix[6];
  9015. this.MYC = matrix[7];
  9016. this.MZC = matrix[8];
  9017. if (XW < 0 || ZW < 0 || YW !== 1) {
  9018. error('Invalid WhitePoint components for ' + this.name + ', no fallback available');
  9019. }
  9020. if (XB < 0 || YB < 0 || ZB < 0) {
  9021. info('Invalid BlackPoint for ' + this.name + ' [' + XB + ', ' + YB + ', ' + ZB + '], falling back to default');
  9022. this.blackPoint = new Float32Array(3);
  9023. }
  9024. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  9025. info('Invalid Gamma [' + this.GR + ', ' + this.GG + ', ' + this.GB + '] for ' + this.name + ', falling back to default');
  9026. this.GR = this.GG = this.GB = 1;
  9027. }
  9028. 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) {
  9029. 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');
  9030. this.MXA = this.MYB = this.MZC = 1;
  9031. this.MXB = this.MYA = this.MZA = this.MXC = this.MYC = this.MZB = 0;
  9032. }
  9033. }
  9034. function matrixProduct(a, b, result) {
  9035. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  9036. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  9037. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  9038. }
  9039. function convertToFlat(sourceWhitePoint, LMS, result) {
  9040. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  9041. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  9042. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  9043. }
  9044. function convertToD65(sourceWhitePoint, LMS, result) {
  9045. var D65X = 0.95047;
  9046. var D65Y = 1;
  9047. var D65Z = 1.08883;
  9048. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  9049. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  9050. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  9051. }
  9052. function sRGBTransferFunction(color) {
  9053. if (color <= 0.0031308) {
  9054. return adjustToRange(0, 1, 12.92 * color);
  9055. }
  9056. return adjustToRange(0, 1, (1 + 0.055) * Math.pow(color, 1 / 2.4) - 0.055);
  9057. }
  9058. function adjustToRange(min, max, value) {
  9059. return Math.max(min, Math.min(max, value));
  9060. }
  9061. function decodeL(L) {
  9062. if (L < 0) {
  9063. return -decodeL(-L);
  9064. }
  9065. if (L > 8.0) {
  9066. return Math.pow((L + 16) / 116, 3);
  9067. }
  9068. return L * DECODE_L_CONSTANT;
  9069. }
  9070. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  9071. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  9072. result[0] = XYZ_Flat[0];
  9073. result[1] = XYZ_Flat[1];
  9074. result[2] = XYZ_Flat[2];
  9075. return;
  9076. }
  9077. var zeroDecodeL = decodeL(0);
  9078. var X_DST = zeroDecodeL;
  9079. var X_SRC = decodeL(sourceBlackPoint[0]);
  9080. var Y_DST = zeroDecodeL;
  9081. var Y_SRC = decodeL(sourceBlackPoint[1]);
  9082. var Z_DST = zeroDecodeL;
  9083. var Z_SRC = decodeL(sourceBlackPoint[2]);
  9084. var X_Scale = (1 - X_DST) / (1 - X_SRC);
  9085. var X_Offset = 1 - X_Scale;
  9086. var Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  9087. var Y_Offset = 1 - Y_Scale;
  9088. var Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  9089. var Z_Offset = 1 - Z_Scale;
  9090. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  9091. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  9092. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  9093. }
  9094. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  9095. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  9096. result[0] = XYZ_In[0];
  9097. result[1] = XYZ_In[1];
  9098. result[2] = XYZ_In[2];
  9099. return;
  9100. }
  9101. var LMS = result;
  9102. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  9103. var LMS_Flat = tempNormalizeMatrix;
  9104. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  9105. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  9106. }
  9107. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  9108. var LMS = result;
  9109. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  9110. var LMS_D65 = tempNormalizeMatrix;
  9111. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  9112. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  9113. }
  9114. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  9115. var A = adjustToRange(0, 1, src[srcOffset] * scale);
  9116. var B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  9117. var C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  9118. var AGR = Math.pow(A, cs.GR);
  9119. var BGG = Math.pow(B, cs.GG);
  9120. var CGB = Math.pow(C, cs.GB);
  9121. var X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  9122. var Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  9123. var Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  9124. var XYZ = tempConvertMatrix1;
  9125. XYZ[0] = X;
  9126. XYZ[1] = Y;
  9127. XYZ[2] = Z;
  9128. var XYZ_Flat = tempConvertMatrix2;
  9129. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  9130. var XYZ_Black = tempConvertMatrix1;
  9131. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  9132. var XYZ_D65 = tempConvertMatrix2;
  9133. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  9134. var SRGB = tempConvertMatrix1;
  9135. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  9136. var sR = sRGBTransferFunction(SRGB[0]);
  9137. var sG = sRGBTransferFunction(SRGB[1]);
  9138. var sB = sRGBTransferFunction(SRGB[2]);
  9139. dest[destOffset] = Math.round(sR * 255);
  9140. dest[destOffset + 1] = Math.round(sG * 255);
  9141. dest[destOffset + 2] = Math.round(sB * 255);
  9142. }
  9143. CalRGBCS.prototype = {
  9144. getRgb: function CalRGBCS_getRgb(src, srcOffset) {
  9145. var rgb = new Uint8Array(3);
  9146. this.getRgbItem(src, srcOffset, rgb, 0);
  9147. return rgb;
  9148. },
  9149. getRgbItem: function CalRGBCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9150. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  9151. },
  9152. getRgbBuffer: function CalRGBCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9153. var scale = 1 / ((1 << bits) - 1);
  9154. for (var i = 0; i < count; ++i) {
  9155. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  9156. srcOffset += 3;
  9157. destOffset += 3 + alpha01;
  9158. }
  9159. },
  9160. getOutputLength: function CalRGBCS_getOutputLength(inputLength, alpha01) {
  9161. return inputLength * (3 + alpha01) / 3 | 0;
  9162. },
  9163. isPassthrough: ColorSpace.prototype.isPassthrough,
  9164. fillRgb: ColorSpace.prototype.fillRgb,
  9165. isDefaultDecode: function CalRGBCS_isDefaultDecode(decodeMap) {
  9166. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9167. },
  9168. usesZeroToOneRange: true
  9169. };
  9170. return CalRGBCS;
  9171. }();
  9172. var LabCS = function LabCSClosure() {
  9173. function LabCS(whitePoint, blackPoint, range) {
  9174. this.name = 'Lab';
  9175. this.numComps = 3;
  9176. this.defaultColor = new Float32Array(this.numComps);
  9177. if (!whitePoint) {
  9178. error('WhitePoint missing - required for color space Lab');
  9179. }
  9180. blackPoint = blackPoint || [
  9181. 0,
  9182. 0,
  9183. 0
  9184. ];
  9185. range = range || [
  9186. -100,
  9187. 100,
  9188. -100,
  9189. 100
  9190. ];
  9191. this.XW = whitePoint[0];
  9192. this.YW = whitePoint[1];
  9193. this.ZW = whitePoint[2];
  9194. this.amin = range[0];
  9195. this.amax = range[1];
  9196. this.bmin = range[2];
  9197. this.bmax = range[3];
  9198. this.XB = blackPoint[0];
  9199. this.YB = blackPoint[1];
  9200. this.ZB = blackPoint[2];
  9201. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  9202. error('Invalid WhitePoint components, no fallback available');
  9203. }
  9204. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  9205. info('Invalid BlackPoint, falling back to default');
  9206. this.XB = this.YB = this.ZB = 0;
  9207. }
  9208. if (this.amin > this.amax || this.bmin > this.bmax) {
  9209. info('Invalid Range, falling back to defaults');
  9210. this.amin = -100;
  9211. this.amax = 100;
  9212. this.bmin = -100;
  9213. this.bmax = 100;
  9214. }
  9215. }
  9216. function fn_g(x) {
  9217. var result;
  9218. if (x >= 6 / 29) {
  9219. result = x * x * x;
  9220. } else {
  9221. result = 108 / 841 * (x - 4 / 29);
  9222. }
  9223. return result;
  9224. }
  9225. function decode(value, high1, low2, high2) {
  9226. return low2 + value * (high2 - low2) / high1;
  9227. }
  9228. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  9229. var Ls = src[srcOffset];
  9230. var as = src[srcOffset + 1];
  9231. var bs = src[srcOffset + 2];
  9232. if (maxVal !== false) {
  9233. Ls = decode(Ls, maxVal, 0, 100);
  9234. as = decode(as, maxVal, cs.amin, cs.amax);
  9235. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  9236. }
  9237. as = as > cs.amax ? cs.amax : as < cs.amin ? cs.amin : as;
  9238. bs = bs > cs.bmax ? cs.bmax : bs < cs.bmin ? cs.bmin : bs;
  9239. var M = (Ls + 16) / 116;
  9240. var L = M + as / 500;
  9241. var N = M - bs / 200;
  9242. var X = cs.XW * fn_g(L);
  9243. var Y = cs.YW * fn_g(M);
  9244. var Z = cs.ZW * fn_g(N);
  9245. var r, g, b;
  9246. if (cs.ZW < 1) {
  9247. r = X * 3.1339 + Y * -1.6170 + Z * -0.4906;
  9248. g = X * -0.9785 + Y * 1.9160 + Z * 0.0333;
  9249. b = X * 0.0720 + Y * -0.2290 + Z * 1.4057;
  9250. } else {
  9251. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  9252. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  9253. b = X * 0.0557 + Y * -0.2040 + Z * 1.0570;
  9254. }
  9255. dest[destOffset] = r <= 0 ? 0 : r >= 1 ? 255 : Math.sqrt(r) * 255 | 0;
  9256. dest[destOffset + 1] = g <= 0 ? 0 : g >= 1 ? 255 : Math.sqrt(g) * 255 | 0;
  9257. dest[destOffset + 2] = b <= 0 ? 0 : b >= 1 ? 255 : Math.sqrt(b) * 255 | 0;
  9258. }
  9259. LabCS.prototype = {
  9260. getRgb: ColorSpace.prototype.getRgb,
  9261. getRgbItem: function LabCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9262. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  9263. },
  9264. getRgbBuffer: function LabCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9265. var maxVal = (1 << bits) - 1;
  9266. for (var i = 0; i < count; i++) {
  9267. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  9268. srcOffset += 3;
  9269. destOffset += 3 + alpha01;
  9270. }
  9271. },
  9272. getOutputLength: function LabCS_getOutputLength(inputLength, alpha01) {
  9273. return inputLength * (3 + alpha01) / 3 | 0;
  9274. },
  9275. isPassthrough: ColorSpace.prototype.isPassthrough,
  9276. fillRgb: ColorSpace.prototype.fillRgb,
  9277. isDefaultDecode: function LabCS_isDefaultDecode(decodeMap) {
  9278. return true;
  9279. },
  9280. usesZeroToOneRange: false
  9281. };
  9282. return LabCS;
  9283. }();
  9284. exports.ColorSpace = ColorSpace;
  9285. /***/ }),
  9286. /* 4 */
  9287. /***/ (function(module, exports, __w_pdfjs_require__) {
  9288. "use strict";
  9289. var ExpertEncoding = [
  9290. '',
  9291. '',
  9292. '',
  9293. '',
  9294. '',
  9295. '',
  9296. '',
  9297. '',
  9298. '',
  9299. '',
  9300. '',
  9301. '',
  9302. '',
  9303. '',
  9304. '',
  9305. '',
  9306. '',
  9307. '',
  9308. '',
  9309. '',
  9310. '',
  9311. '',
  9312. '',
  9313. '',
  9314. '',
  9315. '',
  9316. '',
  9317. '',
  9318. '',
  9319. '',
  9320. '',
  9321. '',
  9322. 'space',
  9323. 'exclamsmall',
  9324. 'Hungarumlautsmall',
  9325. '',
  9326. 'dollaroldstyle',
  9327. 'dollarsuperior',
  9328. 'ampersandsmall',
  9329. 'Acutesmall',
  9330. 'parenleftsuperior',
  9331. 'parenrightsuperior',
  9332. 'twodotenleader',
  9333. 'onedotenleader',
  9334. 'comma',
  9335. 'hyphen',
  9336. 'period',
  9337. 'fraction',
  9338. 'zerooldstyle',
  9339. 'oneoldstyle',
  9340. 'twooldstyle',
  9341. 'threeoldstyle',
  9342. 'fouroldstyle',
  9343. 'fiveoldstyle',
  9344. 'sixoldstyle',
  9345. 'sevenoldstyle',
  9346. 'eightoldstyle',
  9347. 'nineoldstyle',
  9348. 'colon',
  9349. 'semicolon',
  9350. 'commasuperior',
  9351. 'threequartersemdash',
  9352. 'periodsuperior',
  9353. 'questionsmall',
  9354. '',
  9355. 'asuperior',
  9356. 'bsuperior',
  9357. 'centsuperior',
  9358. 'dsuperior',
  9359. 'esuperior',
  9360. '',
  9361. '',
  9362. 'isuperior',
  9363. '',
  9364. '',
  9365. 'lsuperior',
  9366. 'msuperior',
  9367. 'nsuperior',
  9368. 'osuperior',
  9369. '',
  9370. '',
  9371. 'rsuperior',
  9372. 'ssuperior',
  9373. 'tsuperior',
  9374. '',
  9375. 'ff',
  9376. 'fi',
  9377. 'fl',
  9378. 'ffi',
  9379. 'ffl',
  9380. 'parenleftinferior',
  9381. '',
  9382. 'parenrightinferior',
  9383. 'Circumflexsmall',
  9384. 'hyphensuperior',
  9385. 'Gravesmall',
  9386. 'Asmall',
  9387. 'Bsmall',
  9388. 'Csmall',
  9389. 'Dsmall',
  9390. 'Esmall',
  9391. 'Fsmall',
  9392. 'Gsmall',
  9393. 'Hsmall',
  9394. 'Ismall',
  9395. 'Jsmall',
  9396. 'Ksmall',
  9397. 'Lsmall',
  9398. 'Msmall',
  9399. 'Nsmall',
  9400. 'Osmall',
  9401. 'Psmall',
  9402. 'Qsmall',
  9403. 'Rsmall',
  9404. 'Ssmall',
  9405. 'Tsmall',
  9406. 'Usmall',
  9407. 'Vsmall',
  9408. 'Wsmall',
  9409. 'Xsmall',
  9410. 'Ysmall',
  9411. 'Zsmall',
  9412. 'colonmonetary',
  9413. 'onefitted',
  9414. 'rupiah',
  9415. 'Tildesmall',
  9416. '',
  9417. '',
  9418. '',
  9419. '',
  9420. '',
  9421. '',
  9422. '',
  9423. '',
  9424. '',
  9425. '',
  9426. '',
  9427. '',
  9428. '',
  9429. '',
  9430. '',
  9431. '',
  9432. '',
  9433. '',
  9434. '',
  9435. '',
  9436. '',
  9437. '',
  9438. '',
  9439. '',
  9440. '',
  9441. '',
  9442. '',
  9443. '',
  9444. '',
  9445. '',
  9446. '',
  9447. '',
  9448. '',
  9449. '',
  9450. 'exclamdownsmall',
  9451. 'centoldstyle',
  9452. 'Lslashsmall',
  9453. '',
  9454. '',
  9455. 'Scaronsmall',
  9456. 'Zcaronsmall',
  9457. 'Dieresissmall',
  9458. 'Brevesmall',
  9459. 'Caronsmall',
  9460. '',
  9461. 'Dotaccentsmall',
  9462. '',
  9463. '',
  9464. 'Macronsmall',
  9465. '',
  9466. '',
  9467. 'figuredash',
  9468. 'hypheninferior',
  9469. '',
  9470. '',
  9471. 'Ogoneksmall',
  9472. 'Ringsmall',
  9473. 'Cedillasmall',
  9474. '',
  9475. '',
  9476. '',
  9477. 'onequarter',
  9478. 'onehalf',
  9479. 'threequarters',
  9480. 'questiondownsmall',
  9481. 'oneeighth',
  9482. 'threeeighths',
  9483. 'fiveeighths',
  9484. 'seveneighths',
  9485. 'onethird',
  9486. 'twothirds',
  9487. '',
  9488. '',
  9489. 'zerosuperior',
  9490. 'onesuperior',
  9491. 'twosuperior',
  9492. 'threesuperior',
  9493. 'foursuperior',
  9494. 'fivesuperior',
  9495. 'sixsuperior',
  9496. 'sevensuperior',
  9497. 'eightsuperior',
  9498. 'ninesuperior',
  9499. 'zeroinferior',
  9500. 'oneinferior',
  9501. 'twoinferior',
  9502. 'threeinferior',
  9503. 'fourinferior',
  9504. 'fiveinferior',
  9505. 'sixinferior',
  9506. 'seveninferior',
  9507. 'eightinferior',
  9508. 'nineinferior',
  9509. 'centinferior',
  9510. 'dollarinferior',
  9511. 'periodinferior',
  9512. 'commainferior',
  9513. 'Agravesmall',
  9514. 'Aacutesmall',
  9515. 'Acircumflexsmall',
  9516. 'Atildesmall',
  9517. 'Adieresissmall',
  9518. 'Aringsmall',
  9519. 'AEsmall',
  9520. 'Ccedillasmall',
  9521. 'Egravesmall',
  9522. 'Eacutesmall',
  9523. 'Ecircumflexsmall',
  9524. 'Edieresissmall',
  9525. 'Igravesmall',
  9526. 'Iacutesmall',
  9527. 'Icircumflexsmall',
  9528. 'Idieresissmall',
  9529. 'Ethsmall',
  9530. 'Ntildesmall',
  9531. 'Ogravesmall',
  9532. 'Oacutesmall',
  9533. 'Ocircumflexsmall',
  9534. 'Otildesmall',
  9535. 'Odieresissmall',
  9536. 'OEsmall',
  9537. 'Oslashsmall',
  9538. 'Ugravesmall',
  9539. 'Uacutesmall',
  9540. 'Ucircumflexsmall',
  9541. 'Udieresissmall',
  9542. 'Yacutesmall',
  9543. 'Thornsmall',
  9544. 'Ydieresissmall'
  9545. ];
  9546. var MacExpertEncoding = [
  9547. '',
  9548. '',
  9549. '',
  9550. '',
  9551. '',
  9552. '',
  9553. '',
  9554. '',
  9555. '',
  9556. '',
  9557. '',
  9558. '',
  9559. '',
  9560. '',
  9561. '',
  9562. '',
  9563. '',
  9564. '',
  9565. '',
  9566. '',
  9567. '',
  9568. '',
  9569. '',
  9570. '',
  9571. '',
  9572. '',
  9573. '',
  9574. '',
  9575. '',
  9576. '',
  9577. '',
  9578. '',
  9579. 'space',
  9580. 'exclamsmall',
  9581. 'Hungarumlautsmall',
  9582. 'centoldstyle',
  9583. 'dollaroldstyle',
  9584. 'dollarsuperior',
  9585. 'ampersandsmall',
  9586. 'Acutesmall',
  9587. 'parenleftsuperior',
  9588. 'parenrightsuperior',
  9589. 'twodotenleader',
  9590. 'onedotenleader',
  9591. 'comma',
  9592. 'hyphen',
  9593. 'period',
  9594. 'fraction',
  9595. 'zerooldstyle',
  9596. 'oneoldstyle',
  9597. 'twooldstyle',
  9598. 'threeoldstyle',
  9599. 'fouroldstyle',
  9600. 'fiveoldstyle',
  9601. 'sixoldstyle',
  9602. 'sevenoldstyle',
  9603. 'eightoldstyle',
  9604. 'nineoldstyle',
  9605. 'colon',
  9606. 'semicolon',
  9607. '',
  9608. 'threequartersemdash',
  9609. '',
  9610. 'questionsmall',
  9611. '',
  9612. '',
  9613. '',
  9614. '',
  9615. 'Ethsmall',
  9616. '',
  9617. '',
  9618. 'onequarter',
  9619. 'onehalf',
  9620. 'threequarters',
  9621. 'oneeighth',
  9622. 'threeeighths',
  9623. 'fiveeighths',
  9624. 'seveneighths',
  9625. 'onethird',
  9626. 'twothirds',
  9627. '',
  9628. '',
  9629. '',
  9630. '',
  9631. '',
  9632. '',
  9633. 'ff',
  9634. 'fi',
  9635. 'fl',
  9636. 'ffi',
  9637. 'ffl',
  9638. 'parenleftinferior',
  9639. '',
  9640. 'parenrightinferior',
  9641. 'Circumflexsmall',
  9642. 'hypheninferior',
  9643. 'Gravesmall',
  9644. 'Asmall',
  9645. 'Bsmall',
  9646. 'Csmall',
  9647. 'Dsmall',
  9648. 'Esmall',
  9649. 'Fsmall',
  9650. 'Gsmall',
  9651. 'Hsmall',
  9652. 'Ismall',
  9653. 'Jsmall',
  9654. 'Ksmall',
  9655. 'Lsmall',
  9656. 'Msmall',
  9657. 'Nsmall',
  9658. 'Osmall',
  9659. 'Psmall',
  9660. 'Qsmall',
  9661. 'Rsmall',
  9662. 'Ssmall',
  9663. 'Tsmall',
  9664. 'Usmall',
  9665. 'Vsmall',
  9666. 'Wsmall',
  9667. 'Xsmall',
  9668. 'Ysmall',
  9669. 'Zsmall',
  9670. 'colonmonetary',
  9671. 'onefitted',
  9672. 'rupiah',
  9673. 'Tildesmall',
  9674. '',
  9675. '',
  9676. 'asuperior',
  9677. 'centsuperior',
  9678. '',
  9679. '',
  9680. '',
  9681. '',
  9682. 'Aacutesmall',
  9683. 'Agravesmall',
  9684. 'Acircumflexsmall',
  9685. 'Adieresissmall',
  9686. 'Atildesmall',
  9687. 'Aringsmall',
  9688. 'Ccedillasmall',
  9689. 'Eacutesmall',
  9690. 'Egravesmall',
  9691. 'Ecircumflexsmall',
  9692. 'Edieresissmall',
  9693. 'Iacutesmall',
  9694. 'Igravesmall',
  9695. 'Icircumflexsmall',
  9696. 'Idieresissmall',
  9697. 'Ntildesmall',
  9698. 'Oacutesmall',
  9699. 'Ogravesmall',
  9700. 'Ocircumflexsmall',
  9701. 'Odieresissmall',
  9702. 'Otildesmall',
  9703. 'Uacutesmall',
  9704. 'Ugravesmall',
  9705. 'Ucircumflexsmall',
  9706. 'Udieresissmall',
  9707. '',
  9708. 'eightsuperior',
  9709. 'fourinferior',
  9710. 'threeinferior',
  9711. 'sixinferior',
  9712. 'eightinferior',
  9713. 'seveninferior',
  9714. 'Scaronsmall',
  9715. '',
  9716. 'centinferior',
  9717. 'twoinferior',
  9718. '',
  9719. 'Dieresissmall',
  9720. '',
  9721. 'Caronsmall',
  9722. 'osuperior',
  9723. 'fiveinferior',
  9724. '',
  9725. 'commainferior',
  9726. 'periodinferior',
  9727. 'Yacutesmall',
  9728. '',
  9729. 'dollarinferior',
  9730. '',
  9731. 'Thornsmall',
  9732. '',
  9733. 'nineinferior',
  9734. 'zeroinferior',
  9735. 'Zcaronsmall',
  9736. 'AEsmall',
  9737. 'Oslashsmall',
  9738. 'questiondownsmall',
  9739. 'oneinferior',
  9740. 'Lslashsmall',
  9741. '',
  9742. '',
  9743. '',
  9744. '',
  9745. '',
  9746. '',
  9747. 'Cedillasmall',
  9748. '',
  9749. '',
  9750. '',
  9751. '',
  9752. '',
  9753. 'OEsmall',
  9754. 'figuredash',
  9755. 'hyphensuperior',
  9756. '',
  9757. '',
  9758. '',
  9759. '',
  9760. 'exclamdownsmall',
  9761. '',
  9762. 'Ydieresissmall',
  9763. '',
  9764. 'onesuperior',
  9765. 'twosuperior',
  9766. 'threesuperior',
  9767. 'foursuperior',
  9768. 'fivesuperior',
  9769. 'sixsuperior',
  9770. 'sevensuperior',
  9771. 'ninesuperior',
  9772. 'zerosuperior',
  9773. '',
  9774. 'esuperior',
  9775. 'rsuperior',
  9776. 'tsuperior',
  9777. '',
  9778. '',
  9779. 'isuperior',
  9780. 'ssuperior',
  9781. 'dsuperior',
  9782. '',
  9783. '',
  9784. '',
  9785. '',
  9786. '',
  9787. 'lsuperior',
  9788. 'Ogoneksmall',
  9789. 'Brevesmall',
  9790. 'Macronsmall',
  9791. 'bsuperior',
  9792. 'nsuperior',
  9793. 'msuperior',
  9794. 'commasuperior',
  9795. 'periodsuperior',
  9796. 'Dotaccentsmall',
  9797. 'Ringsmall'
  9798. ];
  9799. var MacRomanEncoding = [
  9800. '',
  9801. '',
  9802. '',
  9803. '',
  9804. '',
  9805. '',
  9806. '',
  9807. '',
  9808. '',
  9809. '',
  9810. '',
  9811. '',
  9812. '',
  9813. '',
  9814. '',
  9815. '',
  9816. '',
  9817. '',
  9818. '',
  9819. '',
  9820. '',
  9821. '',
  9822. '',
  9823. '',
  9824. '',
  9825. '',
  9826. '',
  9827. '',
  9828. '',
  9829. '',
  9830. '',
  9831. '',
  9832. 'space',
  9833. 'exclam',
  9834. 'quotedbl',
  9835. 'numbersign',
  9836. 'dollar',
  9837. 'percent',
  9838. 'ampersand',
  9839. 'quotesingle',
  9840. 'parenleft',
  9841. 'parenright',
  9842. 'asterisk',
  9843. 'plus',
  9844. 'comma',
  9845. 'hyphen',
  9846. 'period',
  9847. 'slash',
  9848. 'zero',
  9849. 'one',
  9850. 'two',
  9851. 'three',
  9852. 'four',
  9853. 'five',
  9854. 'six',
  9855. 'seven',
  9856. 'eight',
  9857. 'nine',
  9858. 'colon',
  9859. 'semicolon',
  9860. 'less',
  9861. 'equal',
  9862. 'greater',
  9863. 'question',
  9864. 'at',
  9865. 'A',
  9866. 'B',
  9867. 'C',
  9868. 'D',
  9869. 'E',
  9870. 'F',
  9871. 'G',
  9872. 'H',
  9873. 'I',
  9874. 'J',
  9875. 'K',
  9876. 'L',
  9877. 'M',
  9878. 'N',
  9879. 'O',
  9880. 'P',
  9881. 'Q',
  9882. 'R',
  9883. 'S',
  9884. 'T',
  9885. 'U',
  9886. 'V',
  9887. 'W',
  9888. 'X',
  9889. 'Y',
  9890. 'Z',
  9891. 'bracketleft',
  9892. 'backslash',
  9893. 'bracketright',
  9894. 'asciicircum',
  9895. 'underscore',
  9896. 'grave',
  9897. 'a',
  9898. 'b',
  9899. 'c',
  9900. 'd',
  9901. 'e',
  9902. 'f',
  9903. 'g',
  9904. 'h',
  9905. 'i',
  9906. 'j',
  9907. 'k',
  9908. 'l',
  9909. 'm',
  9910. 'n',
  9911. 'o',
  9912. 'p',
  9913. 'q',
  9914. 'r',
  9915. 's',
  9916. 't',
  9917. 'u',
  9918. 'v',
  9919. 'w',
  9920. 'x',
  9921. 'y',
  9922. 'z',
  9923. 'braceleft',
  9924. 'bar',
  9925. 'braceright',
  9926. 'asciitilde',
  9927. '',
  9928. 'Adieresis',
  9929. 'Aring',
  9930. 'Ccedilla',
  9931. 'Eacute',
  9932. 'Ntilde',
  9933. 'Odieresis',
  9934. 'Udieresis',
  9935. 'aacute',
  9936. 'agrave',
  9937. 'acircumflex',
  9938. 'adieresis',
  9939. 'atilde',
  9940. 'aring',
  9941. 'ccedilla',
  9942. 'eacute',
  9943. 'egrave',
  9944. 'ecircumflex',
  9945. 'edieresis',
  9946. 'iacute',
  9947. 'igrave',
  9948. 'icircumflex',
  9949. 'idieresis',
  9950. 'ntilde',
  9951. 'oacute',
  9952. 'ograve',
  9953. 'ocircumflex',
  9954. 'odieresis',
  9955. 'otilde',
  9956. 'uacute',
  9957. 'ugrave',
  9958. 'ucircumflex',
  9959. 'udieresis',
  9960. 'dagger',
  9961. 'degree',
  9962. 'cent',
  9963. 'sterling',
  9964. 'section',
  9965. 'bullet',
  9966. 'paragraph',
  9967. 'germandbls',
  9968. 'registered',
  9969. 'copyright',
  9970. 'trademark',
  9971. 'acute',
  9972. 'dieresis',
  9973. 'notequal',
  9974. 'AE',
  9975. 'Oslash',
  9976. 'infinity',
  9977. 'plusminus',
  9978. 'lessequal',
  9979. 'greaterequal',
  9980. 'yen',
  9981. 'mu',
  9982. 'partialdiff',
  9983. 'summation',
  9984. 'product',
  9985. 'pi',
  9986. 'integral',
  9987. 'ordfeminine',
  9988. 'ordmasculine',
  9989. 'Omega',
  9990. 'ae',
  9991. 'oslash',
  9992. 'questiondown',
  9993. 'exclamdown',
  9994. 'logicalnot',
  9995. 'radical',
  9996. 'florin',
  9997. 'approxequal',
  9998. 'Delta',
  9999. 'guillemotleft',
  10000. 'guillemotright',
  10001. 'ellipsis',
  10002. 'space',
  10003. 'Agrave',
  10004. 'Atilde',
  10005. 'Otilde',
  10006. 'OE',
  10007. 'oe',
  10008. 'endash',
  10009. 'emdash',
  10010. 'quotedblleft',
  10011. 'quotedblright',
  10012. 'quoteleft',
  10013. 'quoteright',
  10014. 'divide',
  10015. 'lozenge',
  10016. 'ydieresis',
  10017. 'Ydieresis',
  10018. 'fraction',
  10019. 'currency',
  10020. 'guilsinglleft',
  10021. 'guilsinglright',
  10022. 'fi',
  10023. 'fl',
  10024. 'daggerdbl',
  10025. 'periodcentered',
  10026. 'quotesinglbase',
  10027. 'quotedblbase',
  10028. 'perthousand',
  10029. 'Acircumflex',
  10030. 'Ecircumflex',
  10031. 'Aacute',
  10032. 'Edieresis',
  10033. 'Egrave',
  10034. 'Iacute',
  10035. 'Icircumflex',
  10036. 'Idieresis',
  10037. 'Igrave',
  10038. 'Oacute',
  10039. 'Ocircumflex',
  10040. 'apple',
  10041. 'Ograve',
  10042. 'Uacute',
  10043. 'Ucircumflex',
  10044. 'Ugrave',
  10045. 'dotlessi',
  10046. 'circumflex',
  10047. 'tilde',
  10048. 'macron',
  10049. 'breve',
  10050. 'dotaccent',
  10051. 'ring',
  10052. 'cedilla',
  10053. 'hungarumlaut',
  10054. 'ogonek',
  10055. 'caron'
  10056. ];
  10057. var StandardEncoding = [
  10058. '',
  10059. '',
  10060. '',
  10061. '',
  10062. '',
  10063. '',
  10064. '',
  10065. '',
  10066. '',
  10067. '',
  10068. '',
  10069. '',
  10070. '',
  10071. '',
  10072. '',
  10073. '',
  10074. '',
  10075. '',
  10076. '',
  10077. '',
  10078. '',
  10079. '',
  10080. '',
  10081. '',
  10082. '',
  10083. '',
  10084. '',
  10085. '',
  10086. '',
  10087. '',
  10088. '',
  10089. '',
  10090. 'space',
  10091. 'exclam',
  10092. 'quotedbl',
  10093. 'numbersign',
  10094. 'dollar',
  10095. 'percent',
  10096. 'ampersand',
  10097. 'quoteright',
  10098. 'parenleft',
  10099. 'parenright',
  10100. 'asterisk',
  10101. 'plus',
  10102. 'comma',
  10103. 'hyphen',
  10104. 'period',
  10105. 'slash',
  10106. 'zero',
  10107. 'one',
  10108. 'two',
  10109. 'three',
  10110. 'four',
  10111. 'five',
  10112. 'six',
  10113. 'seven',
  10114. 'eight',
  10115. 'nine',
  10116. 'colon',
  10117. 'semicolon',
  10118. 'less',
  10119. 'equal',
  10120. 'greater',
  10121. 'question',
  10122. 'at',
  10123. 'A',
  10124. 'B',
  10125. 'C',
  10126. 'D',
  10127. 'E',
  10128. 'F',
  10129. 'G',
  10130. 'H',
  10131. 'I',
  10132. 'J',
  10133. 'K',
  10134. 'L',
  10135. 'M',
  10136. 'N',
  10137. 'O',
  10138. 'P',
  10139. 'Q',
  10140. 'R',
  10141. 'S',
  10142. 'T',
  10143. 'U',
  10144. 'V',
  10145. 'W',
  10146. 'X',
  10147. 'Y',
  10148. 'Z',
  10149. 'bracketleft',
  10150. 'backslash',
  10151. 'bracketright',
  10152. 'asciicircum',
  10153. 'underscore',
  10154. 'quoteleft',
  10155. 'a',
  10156. 'b',
  10157. 'c',
  10158. 'd',
  10159. 'e',
  10160. 'f',
  10161. 'g',
  10162. 'h',
  10163. 'i',
  10164. 'j',
  10165. 'k',
  10166. 'l',
  10167. 'm',
  10168. 'n',
  10169. 'o',
  10170. 'p',
  10171. 'q',
  10172. 'r',
  10173. 's',
  10174. 't',
  10175. 'u',
  10176. 'v',
  10177. 'w',
  10178. 'x',
  10179. 'y',
  10180. 'z',
  10181. 'braceleft',
  10182. 'bar',
  10183. 'braceright',
  10184. 'asciitilde',
  10185. '',
  10186. '',
  10187. '',
  10188. '',
  10189. '',
  10190. '',
  10191. '',
  10192. '',
  10193. '',
  10194. '',
  10195. '',
  10196. '',
  10197. '',
  10198. '',
  10199. '',
  10200. '',
  10201. '',
  10202. '',
  10203. '',
  10204. '',
  10205. '',
  10206. '',
  10207. '',
  10208. '',
  10209. '',
  10210. '',
  10211. '',
  10212. '',
  10213. '',
  10214. '',
  10215. '',
  10216. '',
  10217. '',
  10218. '',
  10219. 'exclamdown',
  10220. 'cent',
  10221. 'sterling',
  10222. 'fraction',
  10223. 'yen',
  10224. 'florin',
  10225. 'section',
  10226. 'currency',
  10227. 'quotesingle',
  10228. 'quotedblleft',
  10229. 'guillemotleft',
  10230. 'guilsinglleft',
  10231. 'guilsinglright',
  10232. 'fi',
  10233. 'fl',
  10234. '',
  10235. 'endash',
  10236. 'dagger',
  10237. 'daggerdbl',
  10238. 'periodcentered',
  10239. '',
  10240. 'paragraph',
  10241. 'bullet',
  10242. 'quotesinglbase',
  10243. 'quotedblbase',
  10244. 'quotedblright',
  10245. 'guillemotright',
  10246. 'ellipsis',
  10247. 'perthousand',
  10248. '',
  10249. 'questiondown',
  10250. '',
  10251. 'grave',
  10252. 'acute',
  10253. 'circumflex',
  10254. 'tilde',
  10255. 'macron',
  10256. 'breve',
  10257. 'dotaccent',
  10258. 'dieresis',
  10259. '',
  10260. 'ring',
  10261. 'cedilla',
  10262. '',
  10263. 'hungarumlaut',
  10264. 'ogonek',
  10265. 'caron',
  10266. 'emdash',
  10267. '',
  10268. '',
  10269. '',
  10270. '',
  10271. '',
  10272. '',
  10273. '',
  10274. '',
  10275. '',
  10276. '',
  10277. '',
  10278. '',
  10279. '',
  10280. '',
  10281. '',
  10282. '',
  10283. 'AE',
  10284. '',
  10285. 'ordfeminine',
  10286. '',
  10287. '',
  10288. '',
  10289. '',
  10290. 'Lslash',
  10291. 'Oslash',
  10292. 'OE',
  10293. 'ordmasculine',
  10294. '',
  10295. '',
  10296. '',
  10297. '',
  10298. '',
  10299. 'ae',
  10300. '',
  10301. '',
  10302. '',
  10303. 'dotlessi',
  10304. '',
  10305. '',
  10306. 'lslash',
  10307. 'oslash',
  10308. 'oe',
  10309. 'germandbls'
  10310. ];
  10311. var WinAnsiEncoding = [
  10312. '',
  10313. '',
  10314. '',
  10315. '',
  10316. '',
  10317. '',
  10318. '',
  10319. '',
  10320. '',
  10321. '',
  10322. '',
  10323. '',
  10324. '',
  10325. '',
  10326. '',
  10327. '',
  10328. '',
  10329. '',
  10330. '',
  10331. '',
  10332. '',
  10333. '',
  10334. '',
  10335. '',
  10336. '',
  10337. '',
  10338. '',
  10339. '',
  10340. '',
  10341. '',
  10342. '',
  10343. '',
  10344. 'space',
  10345. 'exclam',
  10346. 'quotedbl',
  10347. 'numbersign',
  10348. 'dollar',
  10349. 'percent',
  10350. 'ampersand',
  10351. 'quotesingle',
  10352. 'parenleft',
  10353. 'parenright',
  10354. 'asterisk',
  10355. 'plus',
  10356. 'comma',
  10357. 'hyphen',
  10358. 'period',
  10359. 'slash',
  10360. 'zero',
  10361. 'one',
  10362. 'two',
  10363. 'three',
  10364. 'four',
  10365. 'five',
  10366. 'six',
  10367. 'seven',
  10368. 'eight',
  10369. 'nine',
  10370. 'colon',
  10371. 'semicolon',
  10372. 'less',
  10373. 'equal',
  10374. 'greater',
  10375. 'question',
  10376. 'at',
  10377. 'A',
  10378. 'B',
  10379. 'C',
  10380. 'D',
  10381. 'E',
  10382. 'F',
  10383. 'G',
  10384. 'H',
  10385. 'I',
  10386. 'J',
  10387. 'K',
  10388. 'L',
  10389. 'M',
  10390. 'N',
  10391. 'O',
  10392. 'P',
  10393. 'Q',
  10394. 'R',
  10395. 'S',
  10396. 'T',
  10397. 'U',
  10398. 'V',
  10399. 'W',
  10400. 'X',
  10401. 'Y',
  10402. 'Z',
  10403. 'bracketleft',
  10404. 'backslash',
  10405. 'bracketright',
  10406. 'asciicircum',
  10407. 'underscore',
  10408. 'grave',
  10409. 'a',
  10410. 'b',
  10411. 'c',
  10412. 'd',
  10413. 'e',
  10414. 'f',
  10415. 'g',
  10416. 'h',
  10417. 'i',
  10418. 'j',
  10419. 'k',
  10420. 'l',
  10421. 'm',
  10422. 'n',
  10423. 'o',
  10424. 'p',
  10425. 'q',
  10426. 'r',
  10427. 's',
  10428. 't',
  10429. 'u',
  10430. 'v',
  10431. 'w',
  10432. 'x',
  10433. 'y',
  10434. 'z',
  10435. 'braceleft',
  10436. 'bar',
  10437. 'braceright',
  10438. 'asciitilde',
  10439. 'bullet',
  10440. 'Euro',
  10441. 'bullet',
  10442. 'quotesinglbase',
  10443. 'florin',
  10444. 'quotedblbase',
  10445. 'ellipsis',
  10446. 'dagger',
  10447. 'daggerdbl',
  10448. 'circumflex',
  10449. 'perthousand',
  10450. 'Scaron',
  10451. 'guilsinglleft',
  10452. 'OE',
  10453. 'bullet',
  10454. 'Zcaron',
  10455. 'bullet',
  10456. 'bullet',
  10457. 'quoteleft',
  10458. 'quoteright',
  10459. 'quotedblleft',
  10460. 'quotedblright',
  10461. 'bullet',
  10462. 'endash',
  10463. 'emdash',
  10464. 'tilde',
  10465. 'trademark',
  10466. 'scaron',
  10467. 'guilsinglright',
  10468. 'oe',
  10469. 'bullet',
  10470. 'zcaron',
  10471. 'Ydieresis',
  10472. 'space',
  10473. 'exclamdown',
  10474. 'cent',
  10475. 'sterling',
  10476. 'currency',
  10477. 'yen',
  10478. 'brokenbar',
  10479. 'section',
  10480. 'dieresis',
  10481. 'copyright',
  10482. 'ordfeminine',
  10483. 'guillemotleft',
  10484. 'logicalnot',
  10485. 'hyphen',
  10486. 'registered',
  10487. 'macron',
  10488. 'degree',
  10489. 'plusminus',
  10490. 'twosuperior',
  10491. 'threesuperior',
  10492. 'acute',
  10493. 'mu',
  10494. 'paragraph',
  10495. 'periodcentered',
  10496. 'cedilla',
  10497. 'onesuperior',
  10498. 'ordmasculine',
  10499. 'guillemotright',
  10500. 'onequarter',
  10501. 'onehalf',
  10502. 'threequarters',
  10503. 'questiondown',
  10504. 'Agrave',
  10505. 'Aacute',
  10506. 'Acircumflex',
  10507. 'Atilde',
  10508. 'Adieresis',
  10509. 'Aring',
  10510. 'AE',
  10511. 'Ccedilla',
  10512. 'Egrave',
  10513. 'Eacute',
  10514. 'Ecircumflex',
  10515. 'Edieresis',
  10516. 'Igrave',
  10517. 'Iacute',
  10518. 'Icircumflex',
  10519. 'Idieresis',
  10520. 'Eth',
  10521. 'Ntilde',
  10522. 'Ograve',
  10523. 'Oacute',
  10524. 'Ocircumflex',
  10525. 'Otilde',
  10526. 'Odieresis',
  10527. 'multiply',
  10528. 'Oslash',
  10529. 'Ugrave',
  10530. 'Uacute',
  10531. 'Ucircumflex',
  10532. 'Udieresis',
  10533. 'Yacute',
  10534. 'Thorn',
  10535. 'germandbls',
  10536. 'agrave',
  10537. 'aacute',
  10538. 'acircumflex',
  10539. 'atilde',
  10540. 'adieresis',
  10541. 'aring',
  10542. 'ae',
  10543. 'ccedilla',
  10544. 'egrave',
  10545. 'eacute',
  10546. 'ecircumflex',
  10547. 'edieresis',
  10548. 'igrave',
  10549. 'iacute',
  10550. 'icircumflex',
  10551. 'idieresis',
  10552. 'eth',
  10553. 'ntilde',
  10554. 'ograve',
  10555. 'oacute',
  10556. 'ocircumflex',
  10557. 'otilde',
  10558. 'odieresis',
  10559. 'divide',
  10560. 'oslash',
  10561. 'ugrave',
  10562. 'uacute',
  10563. 'ucircumflex',
  10564. 'udieresis',
  10565. 'yacute',
  10566. 'thorn',
  10567. 'ydieresis'
  10568. ];
  10569. var SymbolSetEncoding = [
  10570. '',
  10571. '',
  10572. '',
  10573. '',
  10574. '',
  10575. '',
  10576. '',
  10577. '',
  10578. '',
  10579. '',
  10580. '',
  10581. '',
  10582. '',
  10583. '',
  10584. '',
  10585. '',
  10586. '',
  10587. '',
  10588. '',
  10589. '',
  10590. '',
  10591. '',
  10592. '',
  10593. '',
  10594. '',
  10595. '',
  10596. '',
  10597. '',
  10598. '',
  10599. '',
  10600. '',
  10601. '',
  10602. 'space',
  10603. 'exclam',
  10604. 'universal',
  10605. 'numbersign',
  10606. 'existential',
  10607. 'percent',
  10608. 'ampersand',
  10609. 'suchthat',
  10610. 'parenleft',
  10611. 'parenright',
  10612. 'asteriskmath',
  10613. 'plus',
  10614. 'comma',
  10615. 'minus',
  10616. 'period',
  10617. 'slash',
  10618. 'zero',
  10619. 'one',
  10620. 'two',
  10621. 'three',
  10622. 'four',
  10623. 'five',
  10624. 'six',
  10625. 'seven',
  10626. 'eight',
  10627. 'nine',
  10628. 'colon',
  10629. 'semicolon',
  10630. 'less',
  10631. 'equal',
  10632. 'greater',
  10633. 'question',
  10634. 'congruent',
  10635. 'Alpha',
  10636. 'Beta',
  10637. 'Chi',
  10638. 'Delta',
  10639. 'Epsilon',
  10640. 'Phi',
  10641. 'Gamma',
  10642. 'Eta',
  10643. 'Iota',
  10644. 'theta1',
  10645. 'Kappa',
  10646. 'Lambda',
  10647. 'Mu',
  10648. 'Nu',
  10649. 'Omicron',
  10650. 'Pi',
  10651. 'Theta',
  10652. 'Rho',
  10653. 'Sigma',
  10654. 'Tau',
  10655. 'Upsilon',
  10656. 'sigma1',
  10657. 'Omega',
  10658. 'Xi',
  10659. 'Psi',
  10660. 'Zeta',
  10661. 'bracketleft',
  10662. 'therefore',
  10663. 'bracketright',
  10664. 'perpendicular',
  10665. 'underscore',
  10666. 'radicalex',
  10667. 'alpha',
  10668. 'beta',
  10669. 'chi',
  10670. 'delta',
  10671. 'epsilon',
  10672. 'phi',
  10673. 'gamma',
  10674. 'eta',
  10675. 'iota',
  10676. 'phi1',
  10677. 'kappa',
  10678. 'lambda',
  10679. 'mu',
  10680. 'nu',
  10681. 'omicron',
  10682. 'pi',
  10683. 'theta',
  10684. 'rho',
  10685. 'sigma',
  10686. 'tau',
  10687. 'upsilon',
  10688. 'omega1',
  10689. 'omega',
  10690. 'xi',
  10691. 'psi',
  10692. 'zeta',
  10693. 'braceleft',
  10694. 'bar',
  10695. 'braceright',
  10696. 'similar',
  10697. '',
  10698. '',
  10699. '',
  10700. '',
  10701. '',
  10702. '',
  10703. '',
  10704. '',
  10705. '',
  10706. '',
  10707. '',
  10708. '',
  10709. '',
  10710. '',
  10711. '',
  10712. '',
  10713. '',
  10714. '',
  10715. '',
  10716. '',
  10717. '',
  10718. '',
  10719. '',
  10720. '',
  10721. '',
  10722. '',
  10723. '',
  10724. '',
  10725. '',
  10726. '',
  10727. '',
  10728. '',
  10729. '',
  10730. 'Euro',
  10731. 'Upsilon1',
  10732. 'minute',
  10733. 'lessequal',
  10734. 'fraction',
  10735. 'infinity',
  10736. 'florin',
  10737. 'club',
  10738. 'diamond',
  10739. 'heart',
  10740. 'spade',
  10741. 'arrowboth',
  10742. 'arrowleft',
  10743. 'arrowup',
  10744. 'arrowright',
  10745. 'arrowdown',
  10746. 'degree',
  10747. 'plusminus',
  10748. 'second',
  10749. 'greaterequal',
  10750. 'multiply',
  10751. 'proportional',
  10752. 'partialdiff',
  10753. 'bullet',
  10754. 'divide',
  10755. 'notequal',
  10756. 'equivalence',
  10757. 'approxequal',
  10758. 'ellipsis',
  10759. 'arrowvertex',
  10760. 'arrowhorizex',
  10761. 'carriagereturn',
  10762. 'aleph',
  10763. 'Ifraktur',
  10764. 'Rfraktur',
  10765. 'weierstrass',
  10766. 'circlemultiply',
  10767. 'circleplus',
  10768. 'emptyset',
  10769. 'intersection',
  10770. 'union',
  10771. 'propersuperset',
  10772. 'reflexsuperset',
  10773. 'notsubset',
  10774. 'propersubset',
  10775. 'reflexsubset',
  10776. 'element',
  10777. 'notelement',
  10778. 'angle',
  10779. 'gradient',
  10780. 'registerserif',
  10781. 'copyrightserif',
  10782. 'trademarkserif',
  10783. 'product',
  10784. 'radical',
  10785. 'dotmath',
  10786. 'logicalnot',
  10787. 'logicaland',
  10788. 'logicalor',
  10789. 'arrowdblboth',
  10790. 'arrowdblleft',
  10791. 'arrowdblup',
  10792. 'arrowdblright',
  10793. 'arrowdbldown',
  10794. 'lozenge',
  10795. 'angleleft',
  10796. 'registersans',
  10797. 'copyrightsans',
  10798. 'trademarksans',
  10799. 'summation',
  10800. 'parenlefttp',
  10801. 'parenleftex',
  10802. 'parenleftbt',
  10803. 'bracketlefttp',
  10804. 'bracketleftex',
  10805. 'bracketleftbt',
  10806. 'bracelefttp',
  10807. 'braceleftmid',
  10808. 'braceleftbt',
  10809. 'braceex',
  10810. '',
  10811. 'angleright',
  10812. 'integral',
  10813. 'integraltp',
  10814. 'integralex',
  10815. 'integralbt',
  10816. 'parenrighttp',
  10817. 'parenrightex',
  10818. 'parenrightbt',
  10819. 'bracketrighttp',
  10820. 'bracketrightex',
  10821. 'bracketrightbt',
  10822. 'bracerighttp',
  10823. 'bracerightmid',
  10824. 'bracerightbt'
  10825. ];
  10826. var ZapfDingbatsEncoding = [
  10827. '',
  10828. '',
  10829. '',
  10830. '',
  10831. '',
  10832. '',
  10833. '',
  10834. '',
  10835. '',
  10836. '',
  10837. '',
  10838. '',
  10839. '',
  10840. '',
  10841. '',
  10842. '',
  10843. '',
  10844. '',
  10845. '',
  10846. '',
  10847. '',
  10848. '',
  10849. '',
  10850. '',
  10851. '',
  10852. '',
  10853. '',
  10854. '',
  10855. '',
  10856. '',
  10857. '',
  10858. '',
  10859. 'space',
  10860. 'a1',
  10861. 'a2',
  10862. 'a202',
  10863. 'a3',
  10864. 'a4',
  10865. 'a5',
  10866. 'a119',
  10867. 'a118',
  10868. 'a117',
  10869. 'a11',
  10870. 'a12',
  10871. 'a13',
  10872. 'a14',
  10873. 'a15',
  10874. 'a16',
  10875. 'a105',
  10876. 'a17',
  10877. 'a18',
  10878. 'a19',
  10879. 'a20',
  10880. 'a21',
  10881. 'a22',
  10882. 'a23',
  10883. 'a24',
  10884. 'a25',
  10885. 'a26',
  10886. 'a27',
  10887. 'a28',
  10888. 'a6',
  10889. 'a7',
  10890. 'a8',
  10891. 'a9',
  10892. 'a10',
  10893. 'a29',
  10894. 'a30',
  10895. 'a31',
  10896. 'a32',
  10897. 'a33',
  10898. 'a34',
  10899. 'a35',
  10900. 'a36',
  10901. 'a37',
  10902. 'a38',
  10903. 'a39',
  10904. 'a40',
  10905. 'a41',
  10906. 'a42',
  10907. 'a43',
  10908. 'a44',
  10909. 'a45',
  10910. 'a46',
  10911. 'a47',
  10912. 'a48',
  10913. 'a49',
  10914. 'a50',
  10915. 'a51',
  10916. 'a52',
  10917. 'a53',
  10918. 'a54',
  10919. 'a55',
  10920. 'a56',
  10921. 'a57',
  10922. 'a58',
  10923. 'a59',
  10924. 'a60',
  10925. 'a61',
  10926. 'a62',
  10927. 'a63',
  10928. 'a64',
  10929. 'a65',
  10930. 'a66',
  10931. 'a67',
  10932. 'a68',
  10933. 'a69',
  10934. 'a70',
  10935. 'a71',
  10936. 'a72',
  10937. 'a73',
  10938. 'a74',
  10939. 'a203',
  10940. 'a75',
  10941. 'a204',
  10942. 'a76',
  10943. 'a77',
  10944. 'a78',
  10945. 'a79',
  10946. 'a81',
  10947. 'a82',
  10948. 'a83',
  10949. 'a84',
  10950. 'a97',
  10951. 'a98',
  10952. 'a99',
  10953. 'a100',
  10954. '',
  10955. 'a89',
  10956. 'a90',
  10957. 'a93',
  10958. 'a94',
  10959. 'a91',
  10960. 'a92',
  10961. 'a205',
  10962. 'a85',
  10963. 'a206',
  10964. 'a86',
  10965. 'a87',
  10966. 'a88',
  10967. 'a95',
  10968. 'a96',
  10969. '',
  10970. '',
  10971. '',
  10972. '',
  10973. '',
  10974. '',
  10975. '',
  10976. '',
  10977. '',
  10978. '',
  10979. '',
  10980. '',
  10981. '',
  10982. '',
  10983. '',
  10984. '',
  10985. '',
  10986. '',
  10987. '',
  10988. 'a101',
  10989. 'a102',
  10990. 'a103',
  10991. 'a104',
  10992. 'a106',
  10993. 'a107',
  10994. 'a108',
  10995. 'a112',
  10996. 'a111',
  10997. 'a110',
  10998. 'a109',
  10999. 'a120',
  11000. 'a121',
  11001. 'a122',
  11002. 'a123',
  11003. 'a124',
  11004. 'a125',
  11005. 'a126',
  11006. 'a127',
  11007. 'a128',
  11008. 'a129',
  11009. 'a130',
  11010. 'a131',
  11011. 'a132',
  11012. 'a133',
  11013. 'a134',
  11014. 'a135',
  11015. 'a136',
  11016. 'a137',
  11017. 'a138',
  11018. 'a139',
  11019. 'a140',
  11020. 'a141',
  11021. 'a142',
  11022. 'a143',
  11023. 'a144',
  11024. 'a145',
  11025. 'a146',
  11026. 'a147',
  11027. 'a148',
  11028. 'a149',
  11029. 'a150',
  11030. 'a151',
  11031. 'a152',
  11032. 'a153',
  11033. 'a154',
  11034. 'a155',
  11035. 'a156',
  11036. 'a157',
  11037. 'a158',
  11038. 'a159',
  11039. 'a160',
  11040. 'a161',
  11041. 'a163',
  11042. 'a164',
  11043. 'a196',
  11044. 'a165',
  11045. 'a192',
  11046. 'a166',
  11047. 'a167',
  11048. 'a168',
  11049. 'a169',
  11050. 'a170',
  11051. 'a171',
  11052. 'a172',
  11053. 'a173',
  11054. 'a162',
  11055. 'a174',
  11056. 'a175',
  11057. 'a176',
  11058. 'a177',
  11059. 'a178',
  11060. 'a179',
  11061. 'a193',
  11062. 'a180',
  11063. 'a199',
  11064. 'a181',
  11065. 'a200',
  11066. 'a182',
  11067. '',
  11068. 'a201',
  11069. 'a183',
  11070. 'a184',
  11071. 'a197',
  11072. 'a185',
  11073. 'a194',
  11074. 'a198',
  11075. 'a186',
  11076. 'a195',
  11077. 'a187',
  11078. 'a188',
  11079. 'a189',
  11080. 'a190',
  11081. 'a191'
  11082. ];
  11083. function getEncoding(encodingName) {
  11084. switch (encodingName) {
  11085. case 'WinAnsiEncoding':
  11086. return WinAnsiEncoding;
  11087. case 'StandardEncoding':
  11088. return StandardEncoding;
  11089. case 'MacRomanEncoding':
  11090. return MacRomanEncoding;
  11091. case 'SymbolSetEncoding':
  11092. return SymbolSetEncoding;
  11093. case 'ZapfDingbatsEncoding':
  11094. return ZapfDingbatsEncoding;
  11095. case 'ExpertEncoding':
  11096. return ExpertEncoding;
  11097. case 'MacExpertEncoding':
  11098. return MacExpertEncoding;
  11099. default:
  11100. return null;
  11101. }
  11102. }
  11103. exports.WinAnsiEncoding = WinAnsiEncoding;
  11104. exports.StandardEncoding = StandardEncoding;
  11105. exports.MacRomanEncoding = MacRomanEncoding;
  11106. exports.SymbolSetEncoding = SymbolSetEncoding;
  11107. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  11108. exports.ExpertEncoding = ExpertEncoding;
  11109. exports.getEncoding = getEncoding;
  11110. /***/ }),
  11111. /* 5 */
  11112. /***/ (function(module, exports, __w_pdfjs_require__) {
  11113. "use strict";
  11114. var sharedUtil = __w_pdfjs_require__(0);
  11115. var corePrimitives = __w_pdfjs_require__(1);
  11116. var coreStream = __w_pdfjs_require__(2);
  11117. var MissingDataException = sharedUtil.MissingDataException;
  11118. var StreamType = sharedUtil.StreamType;
  11119. var assert = sharedUtil.assert;
  11120. var error = sharedUtil.error;
  11121. var info = sharedUtil.info;
  11122. var isArray = sharedUtil.isArray;
  11123. var isInt = sharedUtil.isInt;
  11124. var isNum = sharedUtil.isNum;
  11125. var isString = sharedUtil.isString;
  11126. var warn = sharedUtil.warn;
  11127. var EOF = corePrimitives.EOF;
  11128. var Cmd = corePrimitives.Cmd;
  11129. var Dict = corePrimitives.Dict;
  11130. var Name = corePrimitives.Name;
  11131. var Ref = corePrimitives.Ref;
  11132. var isEOF = corePrimitives.isEOF;
  11133. var isCmd = corePrimitives.isCmd;
  11134. var isDict = corePrimitives.isDict;
  11135. var isName = corePrimitives.isName;
  11136. var Ascii85Stream = coreStream.Ascii85Stream;
  11137. var AsciiHexStream = coreStream.AsciiHexStream;
  11138. var CCITTFaxStream = coreStream.CCITTFaxStream;
  11139. var FlateStream = coreStream.FlateStream;
  11140. var Jbig2Stream = coreStream.Jbig2Stream;
  11141. var JpegStream = coreStream.JpegStream;
  11142. var JpxStream = coreStream.JpxStream;
  11143. var LZWStream = coreStream.LZWStream;
  11144. var NullStream = coreStream.NullStream;
  11145. var PredictorStream = coreStream.PredictorStream;
  11146. var RunLengthStream = coreStream.RunLengthStream;
  11147. var MAX_LENGTH_TO_CACHE = 1000;
  11148. var Parser = function ParserClosure() {
  11149. function Parser(lexer, allowStreams, xref, recoveryMode) {
  11150. this.lexer = lexer;
  11151. this.allowStreams = allowStreams;
  11152. this.xref = xref;
  11153. this.recoveryMode = recoveryMode || false;
  11154. this.imageCache = Object.create(null);
  11155. this.refill();
  11156. }
  11157. Parser.prototype = {
  11158. refill: function Parser_refill() {
  11159. this.buf1 = this.lexer.getObj();
  11160. this.buf2 = this.lexer.getObj();
  11161. },
  11162. shift: function Parser_shift() {
  11163. if (isCmd(this.buf2, 'ID')) {
  11164. this.buf1 = this.buf2;
  11165. this.buf2 = null;
  11166. } else {
  11167. this.buf1 = this.buf2;
  11168. this.buf2 = this.lexer.getObj();
  11169. }
  11170. },
  11171. tryShift: function Parser_tryShift() {
  11172. try {
  11173. this.shift();
  11174. return true;
  11175. } catch (e) {
  11176. if (e instanceof MissingDataException) {
  11177. throw e;
  11178. }
  11179. return false;
  11180. }
  11181. },
  11182. getObj: function Parser_getObj(cipherTransform) {
  11183. var buf1 = this.buf1;
  11184. this.shift();
  11185. if (buf1 instanceof Cmd) {
  11186. switch (buf1.cmd) {
  11187. case 'BI':
  11188. return this.makeInlineImage(cipherTransform);
  11189. case '[':
  11190. var array = [];
  11191. while (!isCmd(this.buf1, ']') && !isEOF(this.buf1)) {
  11192. array.push(this.getObj(cipherTransform));
  11193. }
  11194. if (isEOF(this.buf1)) {
  11195. if (!this.recoveryMode) {
  11196. error('End of file inside array');
  11197. }
  11198. return array;
  11199. }
  11200. this.shift();
  11201. return array;
  11202. case '<<':
  11203. var dict = new Dict(this.xref);
  11204. while (!isCmd(this.buf1, '>>') && !isEOF(this.buf1)) {
  11205. if (!isName(this.buf1)) {
  11206. info('Malformed dictionary: key must be a name object');
  11207. this.shift();
  11208. continue;
  11209. }
  11210. var key = this.buf1.name;
  11211. this.shift();
  11212. if (isEOF(this.buf1)) {
  11213. break;
  11214. }
  11215. dict.set(key, this.getObj(cipherTransform));
  11216. }
  11217. if (isEOF(this.buf1)) {
  11218. if (!this.recoveryMode) {
  11219. error('End of file inside dictionary');
  11220. }
  11221. return dict;
  11222. }
  11223. if (isCmd(this.buf2, 'stream')) {
  11224. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  11225. }
  11226. this.shift();
  11227. return dict;
  11228. default:
  11229. return buf1;
  11230. }
  11231. }
  11232. if (isInt(buf1)) {
  11233. var num = buf1;
  11234. if (isInt(this.buf1) && isCmd(this.buf2, 'R')) {
  11235. var ref = new Ref(num, this.buf1);
  11236. this.shift();
  11237. this.shift();
  11238. return ref;
  11239. }
  11240. return num;
  11241. }
  11242. if (isString(buf1)) {
  11243. var str = buf1;
  11244. if (cipherTransform) {
  11245. str = cipherTransform.decryptString(str);
  11246. }
  11247. return str;
  11248. }
  11249. return buf1;
  11250. },
  11251. findDefaultInlineStreamEnd: function Parser_findDefaultInlineStreamEnd(stream) {
  11252. var E = 0x45, I = 0x49, SPACE = 0x20, LF = 0xA, CR = 0xD;
  11253. var startPos = stream.pos, state = 0, ch, i, n, followingBytes;
  11254. while ((ch = stream.getByte()) !== -1) {
  11255. if (state === 0) {
  11256. state = ch === E ? 1 : 0;
  11257. } else if (state === 1) {
  11258. state = ch === I ? 2 : 0;
  11259. } else {
  11260. assert(state === 2);
  11261. if (ch === SPACE || ch === LF || ch === CR) {
  11262. n = 5;
  11263. followingBytes = stream.peekBytes(n);
  11264. for (i = 0; i < n; i++) {
  11265. ch = followingBytes[i];
  11266. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7F)) {
  11267. state = 0;
  11268. break;
  11269. }
  11270. }
  11271. if (state === 2) {
  11272. break;
  11273. }
  11274. } else {
  11275. state = 0;
  11276. }
  11277. }
  11278. }
  11279. return stream.pos - 4 - startPos;
  11280. },
  11281. findDCTDecodeInlineStreamEnd: function Parser_findDCTDecodeInlineStreamEnd(stream) {
  11282. var startPos = stream.pos, foundEOI = false, b, markerLength, length;
  11283. while ((b = stream.getByte()) !== -1) {
  11284. if (b !== 0xFF) {
  11285. continue;
  11286. }
  11287. switch (stream.getByte()) {
  11288. case 0x00:
  11289. break;
  11290. case 0xFF:
  11291. stream.skip(-1);
  11292. break;
  11293. case 0xD9:
  11294. foundEOI = true;
  11295. break;
  11296. case 0xC0:
  11297. case 0xC1:
  11298. case 0xC2:
  11299. case 0xC3:
  11300. case 0xC5:
  11301. case 0xC6:
  11302. case 0xC7:
  11303. case 0xC9:
  11304. case 0xCA:
  11305. case 0xCB:
  11306. case 0xCD:
  11307. case 0xCE:
  11308. case 0xCF:
  11309. case 0xC4:
  11310. case 0xCC:
  11311. case 0xDA:
  11312. case 0xDB:
  11313. case 0xDC:
  11314. case 0xDD:
  11315. case 0xDE:
  11316. case 0xDF:
  11317. case 0xE0:
  11318. case 0xE1:
  11319. case 0xE2:
  11320. case 0xE3:
  11321. case 0xE4:
  11322. case 0xE5:
  11323. case 0xE6:
  11324. case 0xE7:
  11325. case 0xE8:
  11326. case 0xE9:
  11327. case 0xEA:
  11328. case 0xEB:
  11329. case 0xEC:
  11330. case 0xED:
  11331. case 0xEE:
  11332. case 0xEF:
  11333. case 0xFE:
  11334. markerLength = stream.getUint16();
  11335. if (markerLength > 2) {
  11336. stream.skip(markerLength - 2);
  11337. } else {
  11338. stream.skip(-2);
  11339. }
  11340. break;
  11341. }
  11342. if (foundEOI) {
  11343. break;
  11344. }
  11345. }
  11346. length = stream.pos - startPos;
  11347. if (b === -1) {
  11348. warn('Inline DCTDecode image stream: ' + 'EOI marker not found, searching for /EI/ instead.');
  11349. stream.skip(-length);
  11350. return this.findDefaultInlineStreamEnd(stream);
  11351. }
  11352. this.inlineStreamSkipEI(stream);
  11353. return length;
  11354. },
  11355. findASCII85DecodeInlineStreamEnd: function Parser_findASCII85DecodeInlineStreamEnd(stream) {
  11356. var TILDE = 0x7E, GT = 0x3E;
  11357. var startPos = stream.pos, ch, length;
  11358. while ((ch = stream.getByte()) !== -1) {
  11359. if (ch === TILDE && stream.peekByte() === GT) {
  11360. stream.skip();
  11361. break;
  11362. }
  11363. }
  11364. length = stream.pos - startPos;
  11365. if (ch === -1) {
  11366. warn('Inline ASCII85Decode image stream: ' + 'EOD marker not found, searching for /EI/ instead.');
  11367. stream.skip(-length);
  11368. return this.findDefaultInlineStreamEnd(stream);
  11369. }
  11370. this.inlineStreamSkipEI(stream);
  11371. return length;
  11372. },
  11373. findASCIIHexDecodeInlineStreamEnd: function Parser_findASCIIHexDecodeInlineStreamEnd(stream) {
  11374. var GT = 0x3E;
  11375. var startPos = stream.pos, ch, length;
  11376. while ((ch = stream.getByte()) !== -1) {
  11377. if (ch === GT) {
  11378. break;
  11379. }
  11380. }
  11381. length = stream.pos - startPos;
  11382. if (ch === -1) {
  11383. warn('Inline ASCIIHexDecode image stream: ' + 'EOD marker not found, searching for /EI/ instead.');
  11384. stream.skip(-length);
  11385. return this.findDefaultInlineStreamEnd(stream);
  11386. }
  11387. this.inlineStreamSkipEI(stream);
  11388. return length;
  11389. },
  11390. inlineStreamSkipEI: function Parser_inlineStreamSkipEI(stream) {
  11391. var E = 0x45, I = 0x49;
  11392. var state = 0, ch;
  11393. while ((ch = stream.getByte()) !== -1) {
  11394. if (state === 0) {
  11395. state = ch === E ? 1 : 0;
  11396. } else if (state === 1) {
  11397. state = ch === I ? 2 : 0;
  11398. } else if (state === 2) {
  11399. break;
  11400. }
  11401. }
  11402. },
  11403. makeInlineImage: function Parser_makeInlineImage(cipherTransform) {
  11404. var lexer = this.lexer;
  11405. var stream = lexer.stream;
  11406. var dict = new Dict(this.xref);
  11407. while (!isCmd(this.buf1, 'ID') && !isEOF(this.buf1)) {
  11408. if (!isName(this.buf1)) {
  11409. error('Dictionary key must be a name object');
  11410. }
  11411. var key = this.buf1.name;
  11412. this.shift();
  11413. if (isEOF(this.buf1)) {
  11414. break;
  11415. }
  11416. dict.set(key, this.getObj(cipherTransform));
  11417. }
  11418. var filter = dict.get('Filter', 'F'), filterName;
  11419. if (isName(filter)) {
  11420. filterName = filter.name;
  11421. } else if (isArray(filter)) {
  11422. var filterZero = this.xref.fetchIfRef(filter[0]);
  11423. if (isName(filterZero)) {
  11424. filterName = filterZero.name;
  11425. }
  11426. }
  11427. var startPos = stream.pos, length, i, ii;
  11428. if (filterName === 'DCTDecode' || filterName === 'DCT') {
  11429. length = this.findDCTDecodeInlineStreamEnd(stream);
  11430. } else if (filterName === 'ASCII85Decide' || filterName === 'A85') {
  11431. length = this.findASCII85DecodeInlineStreamEnd(stream);
  11432. } else if (filterName === 'ASCIIHexDecode' || filterName === 'AHx') {
  11433. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  11434. } else {
  11435. length = this.findDefaultInlineStreamEnd(stream);
  11436. }
  11437. var imageStream = stream.makeSubStream(startPos, length, dict);
  11438. var adler32;
  11439. if (length < MAX_LENGTH_TO_CACHE) {
  11440. var imageBytes = imageStream.getBytes();
  11441. imageStream.reset();
  11442. var a = 1;
  11443. var b = 0;
  11444. for (i = 0, ii = imageBytes.length; i < ii; ++i) {
  11445. a += imageBytes[i] & 0xff;
  11446. b += a;
  11447. }
  11448. adler32 = b % 65521 << 16 | a % 65521;
  11449. if (this.imageCache.adler32 === adler32) {
  11450. this.buf2 = Cmd.get('EI');
  11451. this.shift();
  11452. this.imageCache[adler32].reset();
  11453. return this.imageCache[adler32];
  11454. }
  11455. }
  11456. if (cipherTransform) {
  11457. imageStream = cipherTransform.createStream(imageStream, length);
  11458. }
  11459. imageStream = this.filter(imageStream, dict, length);
  11460. imageStream.dict = dict;
  11461. if (adler32 !== undefined) {
  11462. imageStream.cacheKey = 'inline_' + length + '_' + adler32;
  11463. this.imageCache[adler32] = imageStream;
  11464. }
  11465. this.buf2 = Cmd.get('EI');
  11466. this.shift();
  11467. return imageStream;
  11468. },
  11469. makeStream: function Parser_makeStream(dict, cipherTransform) {
  11470. var lexer = this.lexer;
  11471. var stream = lexer.stream;
  11472. lexer.skipToNextLine();
  11473. var pos = stream.pos - 1;
  11474. var length = dict.get('Length');
  11475. if (!isInt(length)) {
  11476. info('Bad ' + length + ' attribute in stream');
  11477. length = 0;
  11478. }
  11479. stream.pos = pos + length;
  11480. lexer.nextChar();
  11481. if (this.tryShift() && isCmd(this.buf2, 'endstream')) {
  11482. this.shift();
  11483. } else {
  11484. stream.pos = pos;
  11485. var SCAN_BLOCK_SIZE = 2048;
  11486. var ENDSTREAM_SIGNATURE_LENGTH = 9;
  11487. var ENDSTREAM_SIGNATURE = [
  11488. 0x65,
  11489. 0x6E,
  11490. 0x64,
  11491. 0x73,
  11492. 0x74,
  11493. 0x72,
  11494. 0x65,
  11495. 0x61,
  11496. 0x6D
  11497. ];
  11498. var skipped = 0, found = false, i, j;
  11499. while (stream.pos < stream.end) {
  11500. var scanBytes = stream.peekBytes(SCAN_BLOCK_SIZE);
  11501. var scanLength = scanBytes.length - ENDSTREAM_SIGNATURE_LENGTH;
  11502. if (scanLength <= 0) {
  11503. break;
  11504. }
  11505. found = false;
  11506. i = 0;
  11507. while (i < scanLength) {
  11508. j = 0;
  11509. while (j < ENDSTREAM_SIGNATURE_LENGTH && scanBytes[i + j] === ENDSTREAM_SIGNATURE[j]) {
  11510. j++;
  11511. }
  11512. if (j >= ENDSTREAM_SIGNATURE_LENGTH) {
  11513. found = true;
  11514. break;
  11515. }
  11516. i++;
  11517. }
  11518. if (found) {
  11519. skipped += i;
  11520. stream.pos += i;
  11521. break;
  11522. }
  11523. skipped += scanLength;
  11524. stream.pos += scanLength;
  11525. }
  11526. if (!found) {
  11527. error('Missing endstream');
  11528. }
  11529. length = skipped;
  11530. lexer.nextChar();
  11531. this.shift();
  11532. this.shift();
  11533. }
  11534. this.shift();
  11535. stream = stream.makeSubStream(pos, length, dict);
  11536. if (cipherTransform) {
  11537. stream = cipherTransform.createStream(stream, length);
  11538. }
  11539. stream = this.filter(stream, dict, length);
  11540. stream.dict = dict;
  11541. return stream;
  11542. },
  11543. filter: function Parser_filter(stream, dict, length) {
  11544. var filter = dict.get('Filter', 'F');
  11545. var params = dict.get('DecodeParms', 'DP');
  11546. if (isName(filter)) {
  11547. if (isArray(params)) {
  11548. params = this.xref.fetchIfRef(params[0]);
  11549. }
  11550. return this.makeFilter(stream, filter.name, length, params);
  11551. }
  11552. var maybeLength = length;
  11553. if (isArray(filter)) {
  11554. var filterArray = filter;
  11555. var paramsArray = params;
  11556. for (var i = 0, ii = filterArray.length; i < ii; ++i) {
  11557. filter = this.xref.fetchIfRef(filterArray[i]);
  11558. if (!isName(filter)) {
  11559. error('Bad filter name: ' + filter);
  11560. }
  11561. params = null;
  11562. if (isArray(paramsArray) && i in paramsArray) {
  11563. params = this.xref.fetchIfRef(paramsArray[i]);
  11564. }
  11565. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  11566. maybeLength = null;
  11567. }
  11568. }
  11569. return stream;
  11570. },
  11571. makeFilter: function Parser_makeFilter(stream, name, maybeLength, params) {
  11572. if (maybeLength === 0) {
  11573. warn('Empty "' + name + '" stream.');
  11574. return new NullStream(stream);
  11575. }
  11576. try {
  11577. var xrefStreamStats = this.xref.stats.streamTypes;
  11578. if (name === 'FlateDecode' || name === 'Fl') {
  11579. xrefStreamStats[StreamType.FLATE] = true;
  11580. if (params) {
  11581. return new PredictorStream(new FlateStream(stream, maybeLength), maybeLength, params);
  11582. }
  11583. return new FlateStream(stream, maybeLength);
  11584. }
  11585. if (name === 'LZWDecode' || name === 'LZW') {
  11586. xrefStreamStats[StreamType.LZW] = true;
  11587. var earlyChange = 1;
  11588. if (params) {
  11589. if (params.has('EarlyChange')) {
  11590. earlyChange = params.get('EarlyChange');
  11591. }
  11592. return new PredictorStream(new LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  11593. }
  11594. return new LZWStream(stream, maybeLength, earlyChange);
  11595. }
  11596. if (name === 'DCTDecode' || name === 'DCT') {
  11597. xrefStreamStats[StreamType.DCT] = true;
  11598. return new JpegStream(stream, maybeLength, stream.dict, params);
  11599. }
  11600. if (name === 'JPXDecode' || name === 'JPX') {
  11601. xrefStreamStats[StreamType.JPX] = true;
  11602. return new JpxStream(stream, maybeLength, stream.dict, params);
  11603. }
  11604. if (name === 'ASCII85Decode' || name === 'A85') {
  11605. xrefStreamStats[StreamType.A85] = true;
  11606. return new Ascii85Stream(stream, maybeLength);
  11607. }
  11608. if (name === 'ASCIIHexDecode' || name === 'AHx') {
  11609. xrefStreamStats[StreamType.AHX] = true;
  11610. return new AsciiHexStream(stream, maybeLength);
  11611. }
  11612. if (name === 'CCITTFaxDecode' || name === 'CCF') {
  11613. xrefStreamStats[StreamType.CCF] = true;
  11614. return new CCITTFaxStream(stream, maybeLength, params);
  11615. }
  11616. if (name === 'RunLengthDecode' || name === 'RL') {
  11617. xrefStreamStats[StreamType.RL] = true;
  11618. return new RunLengthStream(stream, maybeLength);
  11619. }
  11620. if (name === 'JBIG2Decode') {
  11621. xrefStreamStats[StreamType.JBIG] = true;
  11622. return new Jbig2Stream(stream, maybeLength, stream.dict, params);
  11623. }
  11624. warn('filter "' + name + '" not supported yet');
  11625. return stream;
  11626. } catch (ex) {
  11627. if (ex instanceof MissingDataException) {
  11628. throw ex;
  11629. }
  11630. warn('Invalid stream: \"' + ex + '\"');
  11631. return new NullStream(stream);
  11632. }
  11633. }
  11634. };
  11635. return Parser;
  11636. }();
  11637. var Lexer = function LexerClosure() {
  11638. function Lexer(stream, knownCommands) {
  11639. this.stream = stream;
  11640. this.nextChar();
  11641. this.strBuf = [];
  11642. this.knownCommands = knownCommands;
  11643. }
  11644. var specialChars = [
  11645. 1,
  11646. 0,
  11647. 0,
  11648. 0,
  11649. 0,
  11650. 0,
  11651. 0,
  11652. 0,
  11653. 0,
  11654. 1,
  11655. 1,
  11656. 0,
  11657. 1,
  11658. 1,
  11659. 0,
  11660. 0,
  11661. 0,
  11662. 0,
  11663. 0,
  11664. 0,
  11665. 0,
  11666. 0,
  11667. 0,
  11668. 0,
  11669. 0,
  11670. 0,
  11671. 0,
  11672. 0,
  11673. 0,
  11674. 0,
  11675. 0,
  11676. 0,
  11677. 1,
  11678. 0,
  11679. 0,
  11680. 0,
  11681. 0,
  11682. 2,
  11683. 0,
  11684. 0,
  11685. 2,
  11686. 2,
  11687. 0,
  11688. 0,
  11689. 0,
  11690. 0,
  11691. 0,
  11692. 2,
  11693. 0,
  11694. 0,
  11695. 0,
  11696. 0,
  11697. 0,
  11698. 0,
  11699. 0,
  11700. 0,
  11701. 0,
  11702. 0,
  11703. 0,
  11704. 0,
  11705. 2,
  11706. 0,
  11707. 2,
  11708. 0,
  11709. 0,
  11710. 0,
  11711. 0,
  11712. 0,
  11713. 0,
  11714. 0,
  11715. 0,
  11716. 0,
  11717. 0,
  11718. 0,
  11719. 0,
  11720. 0,
  11721. 0,
  11722. 0,
  11723. 0,
  11724. 0,
  11725. 0,
  11726. 0,
  11727. 0,
  11728. 0,
  11729. 0,
  11730. 0,
  11731. 0,
  11732. 0,
  11733. 0,
  11734. 0,
  11735. 0,
  11736. 2,
  11737. 0,
  11738. 2,
  11739. 0,
  11740. 0,
  11741. 0,
  11742. 0,
  11743. 0,
  11744. 0,
  11745. 0,
  11746. 0,
  11747. 0,
  11748. 0,
  11749. 0,
  11750. 0,
  11751. 0,
  11752. 0,
  11753. 0,
  11754. 0,
  11755. 0,
  11756. 0,
  11757. 0,
  11758. 0,
  11759. 0,
  11760. 0,
  11761. 0,
  11762. 0,
  11763. 0,
  11764. 0,
  11765. 0,
  11766. 0,
  11767. 0,
  11768. 2,
  11769. 0,
  11770. 2,
  11771. 0,
  11772. 0,
  11773. 0,
  11774. 0,
  11775. 0,
  11776. 0,
  11777. 0,
  11778. 0,
  11779. 0,
  11780. 0,
  11781. 0,
  11782. 0,
  11783. 0,
  11784. 0,
  11785. 0,
  11786. 0,
  11787. 0,
  11788. 0,
  11789. 0,
  11790. 0,
  11791. 0,
  11792. 0,
  11793. 0,
  11794. 0,
  11795. 0,
  11796. 0,
  11797. 0,
  11798. 0,
  11799. 0,
  11800. 0,
  11801. 0,
  11802. 0,
  11803. 0,
  11804. 0,
  11805. 0,
  11806. 0,
  11807. 0,
  11808. 0,
  11809. 0,
  11810. 0,
  11811. 0,
  11812. 0,
  11813. 0,
  11814. 0,
  11815. 0,
  11816. 0,
  11817. 0,
  11818. 0,
  11819. 0,
  11820. 0,
  11821. 0,
  11822. 0,
  11823. 0,
  11824. 0,
  11825. 0,
  11826. 0,
  11827. 0,
  11828. 0,
  11829. 0,
  11830. 0,
  11831. 0,
  11832. 0,
  11833. 0,
  11834. 0,
  11835. 0,
  11836. 0,
  11837. 0,
  11838. 0,
  11839. 0,
  11840. 0,
  11841. 0,
  11842. 0,
  11843. 0,
  11844. 0,
  11845. 0,
  11846. 0,
  11847. 0,
  11848. 0,
  11849. 0,
  11850. 0,
  11851. 0,
  11852. 0,
  11853. 0,
  11854. 0,
  11855. 0,
  11856. 0,
  11857. 0,
  11858. 0,
  11859. 0,
  11860. 0,
  11861. 0,
  11862. 0,
  11863. 0,
  11864. 0,
  11865. 0,
  11866. 0,
  11867. 0,
  11868. 0,
  11869. 0,
  11870. 0,
  11871. 0,
  11872. 0,
  11873. 0,
  11874. 0,
  11875. 0,
  11876. 0,
  11877. 0,
  11878. 0,
  11879. 0,
  11880. 0,
  11881. 0,
  11882. 0,
  11883. 0,
  11884. 0,
  11885. 0,
  11886. 0,
  11887. 0,
  11888. 0,
  11889. 0,
  11890. 0,
  11891. 0,
  11892. 0,
  11893. 0,
  11894. 0,
  11895. 0,
  11896. 0,
  11897. 0,
  11898. 0,
  11899. 0,
  11900. 0
  11901. ];
  11902. function toHexDigit(ch) {
  11903. if (ch >= 0x30 && ch <= 0x39) {
  11904. return ch & 0x0F;
  11905. }
  11906. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  11907. return (ch & 0x0F) + 9;
  11908. }
  11909. return -1;
  11910. }
  11911. Lexer.prototype = {
  11912. nextChar: function Lexer_nextChar() {
  11913. return this.currentChar = this.stream.getByte();
  11914. },
  11915. peekChar: function Lexer_peekChar() {
  11916. return this.stream.peekByte();
  11917. },
  11918. getNumber: function Lexer_getNumber() {
  11919. var ch = this.currentChar;
  11920. var eNotation = false;
  11921. var divideBy = 0;
  11922. var sign = 1;
  11923. if (ch === 0x2D) {
  11924. sign = -1;
  11925. ch = this.nextChar();
  11926. if (ch === 0x2D) {
  11927. ch = this.nextChar();
  11928. }
  11929. } else if (ch === 0x2B) {
  11930. ch = this.nextChar();
  11931. }
  11932. if (ch === 0x2E) {
  11933. divideBy = 10;
  11934. ch = this.nextChar();
  11935. }
  11936. if (ch < 0x30 || ch > 0x39) {
  11937. error('Invalid number: ' + String.fromCharCode(ch));
  11938. return 0;
  11939. }
  11940. var baseValue = ch - 0x30;
  11941. var powerValue = 0;
  11942. var powerValueSign = 1;
  11943. while ((ch = this.nextChar()) >= 0) {
  11944. if (0x30 <= ch && ch <= 0x39) {
  11945. var currentDigit = ch - 0x30;
  11946. if (eNotation) {
  11947. powerValue = powerValue * 10 + currentDigit;
  11948. } else {
  11949. if (divideBy !== 0) {
  11950. divideBy *= 10;
  11951. }
  11952. baseValue = baseValue * 10 + currentDigit;
  11953. }
  11954. } else if (ch === 0x2E) {
  11955. if (divideBy === 0) {
  11956. divideBy = 1;
  11957. } else {
  11958. break;
  11959. }
  11960. } else if (ch === 0x2D) {
  11961. warn('Badly formatted number');
  11962. } else if (ch === 0x45 || ch === 0x65) {
  11963. ch = this.peekChar();
  11964. if (ch === 0x2B || ch === 0x2D) {
  11965. powerValueSign = ch === 0x2D ? -1 : 1;
  11966. this.nextChar();
  11967. } else if (ch < 0x30 || ch > 0x39) {
  11968. break;
  11969. }
  11970. eNotation = true;
  11971. } else {
  11972. break;
  11973. }
  11974. }
  11975. if (divideBy !== 0) {
  11976. baseValue /= divideBy;
  11977. }
  11978. if (eNotation) {
  11979. baseValue *= Math.pow(10, powerValueSign * powerValue);
  11980. }
  11981. return sign * baseValue;
  11982. },
  11983. getString: function Lexer_getString() {
  11984. var numParen = 1;
  11985. var done = false;
  11986. var strBuf = this.strBuf;
  11987. strBuf.length = 0;
  11988. var ch = this.nextChar();
  11989. while (true) {
  11990. var charBuffered = false;
  11991. switch (ch | 0) {
  11992. case -1:
  11993. warn('Unterminated string');
  11994. done = true;
  11995. break;
  11996. case 0x28:
  11997. ++numParen;
  11998. strBuf.push('(');
  11999. break;
  12000. case 0x29:
  12001. if (--numParen === 0) {
  12002. this.nextChar();
  12003. done = true;
  12004. } else {
  12005. strBuf.push(')');
  12006. }
  12007. break;
  12008. case 0x5C:
  12009. ch = this.nextChar();
  12010. switch (ch) {
  12011. case -1:
  12012. warn('Unterminated string');
  12013. done = true;
  12014. break;
  12015. case 0x6E:
  12016. strBuf.push('\n');
  12017. break;
  12018. case 0x72:
  12019. strBuf.push('\r');
  12020. break;
  12021. case 0x74:
  12022. strBuf.push('\t');
  12023. break;
  12024. case 0x62:
  12025. strBuf.push('\b');
  12026. break;
  12027. case 0x66:
  12028. strBuf.push('\f');
  12029. break;
  12030. case 0x5C:
  12031. case 0x28:
  12032. case 0x29:
  12033. strBuf.push(String.fromCharCode(ch));
  12034. break;
  12035. case 0x30:
  12036. case 0x31:
  12037. case 0x32:
  12038. case 0x33:
  12039. case 0x34:
  12040. case 0x35:
  12041. case 0x36:
  12042. case 0x37:
  12043. var x = ch & 0x0F;
  12044. ch = this.nextChar();
  12045. charBuffered = true;
  12046. if (ch >= 0x30 && ch <= 0x37) {
  12047. x = (x << 3) + (ch & 0x0F);
  12048. ch = this.nextChar();
  12049. if (ch >= 0x30 && ch <= 0x37) {
  12050. charBuffered = false;
  12051. x = (x << 3) + (ch & 0x0F);
  12052. }
  12053. }
  12054. strBuf.push(String.fromCharCode(x));
  12055. break;
  12056. case 0x0D:
  12057. if (this.peekChar() === 0x0A) {
  12058. this.nextChar();
  12059. }
  12060. break;
  12061. case 0x0A:
  12062. break;
  12063. default:
  12064. strBuf.push(String.fromCharCode(ch));
  12065. break;
  12066. }
  12067. break;
  12068. default:
  12069. strBuf.push(String.fromCharCode(ch));
  12070. break;
  12071. }
  12072. if (done) {
  12073. break;
  12074. }
  12075. if (!charBuffered) {
  12076. ch = this.nextChar();
  12077. }
  12078. }
  12079. return strBuf.join('');
  12080. },
  12081. getName: function Lexer_getName() {
  12082. var ch, previousCh;
  12083. var strBuf = this.strBuf;
  12084. strBuf.length = 0;
  12085. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  12086. if (ch === 0x23) {
  12087. ch = this.nextChar();
  12088. if (specialChars[ch]) {
  12089. warn('Lexer_getName: ' + 'NUMBER SIGN (#) should be followed by a hexadecimal number.');
  12090. strBuf.push('#');
  12091. break;
  12092. }
  12093. var x = toHexDigit(ch);
  12094. if (x !== -1) {
  12095. previousCh = ch;
  12096. ch = this.nextChar();
  12097. var x2 = toHexDigit(ch);
  12098. if (x2 === -1) {
  12099. warn('Lexer_getName: Illegal digit (' + String.fromCharCode(ch) + ') in hexadecimal number.');
  12100. strBuf.push('#', String.fromCharCode(previousCh));
  12101. if (specialChars[ch]) {
  12102. break;
  12103. }
  12104. strBuf.push(String.fromCharCode(ch));
  12105. continue;
  12106. }
  12107. strBuf.push(String.fromCharCode(x << 4 | x2));
  12108. } else {
  12109. strBuf.push('#', String.fromCharCode(ch));
  12110. }
  12111. } else {
  12112. strBuf.push(String.fromCharCode(ch));
  12113. }
  12114. }
  12115. if (strBuf.length > 127) {
  12116. warn('name token is longer than allowed by the spec: ' + strBuf.length);
  12117. }
  12118. return Name.get(strBuf.join(''));
  12119. },
  12120. getHexString: function Lexer_getHexString() {
  12121. var strBuf = this.strBuf;
  12122. strBuf.length = 0;
  12123. var ch = this.currentChar;
  12124. var isFirstHex = true;
  12125. var firstDigit;
  12126. var secondDigit;
  12127. while (true) {
  12128. if (ch < 0) {
  12129. warn('Unterminated hex string');
  12130. break;
  12131. } else if (ch === 0x3E) {
  12132. this.nextChar();
  12133. break;
  12134. } else if (specialChars[ch] === 1) {
  12135. ch = this.nextChar();
  12136. continue;
  12137. } else {
  12138. if (isFirstHex) {
  12139. firstDigit = toHexDigit(ch);
  12140. if (firstDigit === -1) {
  12141. warn('Ignoring invalid character "' + ch + '" in hex string');
  12142. ch = this.nextChar();
  12143. continue;
  12144. }
  12145. } else {
  12146. secondDigit = toHexDigit(ch);
  12147. if (secondDigit === -1) {
  12148. warn('Ignoring invalid character "' + ch + '" in hex string');
  12149. ch = this.nextChar();
  12150. continue;
  12151. }
  12152. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  12153. }
  12154. isFirstHex = !isFirstHex;
  12155. ch = this.nextChar();
  12156. }
  12157. }
  12158. return strBuf.join('');
  12159. },
  12160. getObj: function Lexer_getObj() {
  12161. var comment = false;
  12162. var ch = this.currentChar;
  12163. while (true) {
  12164. if (ch < 0) {
  12165. return EOF;
  12166. }
  12167. if (comment) {
  12168. if (ch === 0x0A || ch === 0x0D) {
  12169. comment = false;
  12170. }
  12171. } else if (ch === 0x25) {
  12172. comment = true;
  12173. } else if (specialChars[ch] !== 1) {
  12174. break;
  12175. }
  12176. ch = this.nextChar();
  12177. }
  12178. switch (ch | 0) {
  12179. case 0x30:
  12180. case 0x31:
  12181. case 0x32:
  12182. case 0x33:
  12183. case 0x34:
  12184. case 0x35:
  12185. case 0x36:
  12186. case 0x37:
  12187. case 0x38:
  12188. case 0x39:
  12189. case 0x2B:
  12190. case 0x2D:
  12191. case 0x2E:
  12192. return this.getNumber();
  12193. case 0x28:
  12194. return this.getString();
  12195. case 0x2F:
  12196. return this.getName();
  12197. case 0x5B:
  12198. this.nextChar();
  12199. return Cmd.get('[');
  12200. case 0x5D:
  12201. this.nextChar();
  12202. return Cmd.get(']');
  12203. case 0x3C:
  12204. ch = this.nextChar();
  12205. if (ch === 0x3C) {
  12206. this.nextChar();
  12207. return Cmd.get('<<');
  12208. }
  12209. return this.getHexString();
  12210. case 0x3E:
  12211. ch = this.nextChar();
  12212. if (ch === 0x3E) {
  12213. this.nextChar();
  12214. return Cmd.get('>>');
  12215. }
  12216. return Cmd.get('>');
  12217. case 0x7B:
  12218. this.nextChar();
  12219. return Cmd.get('{');
  12220. case 0x7D:
  12221. this.nextChar();
  12222. return Cmd.get('}');
  12223. case 0x29:
  12224. this.nextChar();
  12225. error('Illegal character: ' + ch);
  12226. break;
  12227. }
  12228. var str = String.fromCharCode(ch);
  12229. var knownCommands = this.knownCommands;
  12230. var knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  12231. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  12232. var possibleCommand = str + String.fromCharCode(ch);
  12233. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  12234. break;
  12235. }
  12236. if (str.length === 128) {
  12237. error('Command token too long: ' + str.length);
  12238. }
  12239. str = possibleCommand;
  12240. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  12241. }
  12242. if (str === 'true') {
  12243. return true;
  12244. }
  12245. if (str === 'false') {
  12246. return false;
  12247. }
  12248. if (str === 'null') {
  12249. return null;
  12250. }
  12251. return Cmd.get(str);
  12252. },
  12253. skipToNextLine: function Lexer_skipToNextLine() {
  12254. var ch = this.currentChar;
  12255. while (ch >= 0) {
  12256. if (ch === 0x0D) {
  12257. ch = this.nextChar();
  12258. if (ch === 0x0A) {
  12259. this.nextChar();
  12260. }
  12261. break;
  12262. } else if (ch === 0x0A) {
  12263. this.nextChar();
  12264. break;
  12265. }
  12266. ch = this.nextChar();
  12267. }
  12268. }
  12269. };
  12270. return Lexer;
  12271. }();
  12272. var Linearization = {
  12273. create: function LinearizationCreate(stream) {
  12274. function getInt(name, allowZeroValue) {
  12275. var obj = linDict.get(name);
  12276. if (isInt(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  12277. return obj;
  12278. }
  12279. throw new Error('The "' + name + '" parameter in the linearization ' + 'dictionary is invalid.');
  12280. }
  12281. function getHints() {
  12282. var hints = linDict.get('H'), hintsLength, item;
  12283. if (isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  12284. for (var index = 0; index < hintsLength; index++) {
  12285. if (!(isInt(item = hints[index]) && item > 0)) {
  12286. throw new Error('Hint (' + index + ') in the linearization dictionary is invalid.');
  12287. }
  12288. }
  12289. return hints;
  12290. }
  12291. throw new Error('Hint array in the linearization dictionary is invalid.');
  12292. }
  12293. var parser = new Parser(new Lexer(stream), false, null);
  12294. var obj1 = parser.getObj();
  12295. var obj2 = parser.getObj();
  12296. var obj3 = parser.getObj();
  12297. var linDict = parser.getObj();
  12298. var obj, length;
  12299. if (!(isInt(obj1) && isInt(obj2) && isCmd(obj3, 'obj') && isDict(linDict) && isNum(obj = linDict.get('Linearized')) && obj > 0)) {
  12300. return null;
  12301. } else if ((length = getInt('L')) !== stream.length) {
  12302. throw new Error('The "L" parameter in the linearization dictionary ' + 'does not equal the stream length.');
  12303. }
  12304. return {
  12305. length: length,
  12306. hints: getHints(),
  12307. objectNumberFirst: getInt('O'),
  12308. endFirst: getInt('E'),
  12309. numPages: getInt('N'),
  12310. mainXRefEntriesOffset: getInt('T'),
  12311. pageFirst: linDict.has('P') ? getInt('P', true) : 0
  12312. };
  12313. }
  12314. };
  12315. exports.Lexer = Lexer;
  12316. exports.Linearization = Linearization;
  12317. exports.Parser = Parser;
  12318. /***/ }),
  12319. /* 6 */
  12320. /***/ (function(module, exports, __w_pdfjs_require__) {
  12321. "use strict";
  12322. var sharedUtil = __w_pdfjs_require__(0);
  12323. var corePrimitives = __w_pdfjs_require__(1);
  12324. var corePsParser = __w_pdfjs_require__(34);
  12325. var error = sharedUtil.error;
  12326. var info = sharedUtil.info;
  12327. var isArray = sharedUtil.isArray;
  12328. var isBool = sharedUtil.isBool;
  12329. var isDict = corePrimitives.isDict;
  12330. var isStream = corePrimitives.isStream;
  12331. var PostScriptLexer = corePsParser.PostScriptLexer;
  12332. var PostScriptParser = corePsParser.PostScriptParser;
  12333. var PDFFunction = function PDFFunctionClosure() {
  12334. var CONSTRUCT_SAMPLED = 0;
  12335. var CONSTRUCT_INTERPOLATED = 2;
  12336. var CONSTRUCT_STICHED = 3;
  12337. var CONSTRUCT_POSTSCRIPT = 4;
  12338. return {
  12339. getSampleArray: function PDFFunction_getSampleArray(size, outputSize, bps, str) {
  12340. var i, ii;
  12341. var length = 1;
  12342. for (i = 0, ii = size.length; i < ii; i++) {
  12343. length *= size[i];
  12344. }
  12345. length *= outputSize;
  12346. var array = new Array(length);
  12347. var codeSize = 0;
  12348. var codeBuf = 0;
  12349. var sampleMul = 1.0 / (Math.pow(2.0, bps) - 1);
  12350. var strBytes = str.getBytes((length * bps + 7) / 8);
  12351. var strIdx = 0;
  12352. for (i = 0; i < length; i++) {
  12353. while (codeSize < bps) {
  12354. codeBuf <<= 8;
  12355. codeBuf |= strBytes[strIdx++];
  12356. codeSize += 8;
  12357. }
  12358. codeSize -= bps;
  12359. array[i] = (codeBuf >> codeSize) * sampleMul;
  12360. codeBuf &= (1 << codeSize) - 1;
  12361. }
  12362. return array;
  12363. },
  12364. getIR: function PDFFunction_getIR(xref, fn) {
  12365. var dict = fn.dict;
  12366. if (!dict) {
  12367. dict = fn;
  12368. }
  12369. var types = [
  12370. this.constructSampled,
  12371. null,
  12372. this.constructInterpolated,
  12373. this.constructStiched,
  12374. this.constructPostScript
  12375. ];
  12376. var typeNum = dict.get('FunctionType');
  12377. var typeFn = types[typeNum];
  12378. if (!typeFn) {
  12379. error('Unknown type of function');
  12380. }
  12381. return typeFn.call(this, fn, dict, xref);
  12382. },
  12383. fromIR: function PDFFunction_fromIR(IR) {
  12384. var type = IR[0];
  12385. switch (type) {
  12386. case CONSTRUCT_SAMPLED:
  12387. return this.constructSampledFromIR(IR);
  12388. case CONSTRUCT_INTERPOLATED:
  12389. return this.constructInterpolatedFromIR(IR);
  12390. case CONSTRUCT_STICHED:
  12391. return this.constructStichedFromIR(IR);
  12392. default:
  12393. return this.constructPostScriptFromIR(IR);
  12394. }
  12395. },
  12396. parse: function PDFFunction_parse(xref, fn) {
  12397. var IR = this.getIR(xref, fn);
  12398. return this.fromIR(IR);
  12399. },
  12400. parseArray: function PDFFunction_parseArray(xref, fnObj) {
  12401. if (!isArray(fnObj)) {
  12402. return this.parse(xref, fnObj);
  12403. }
  12404. var fnArray = [];
  12405. for (var j = 0, jj = fnObj.length; j < jj; j++) {
  12406. var obj = xref.fetchIfRef(fnObj[j]);
  12407. fnArray.push(PDFFunction.parse(xref, obj));
  12408. }
  12409. return function (src, srcOffset, dest, destOffset) {
  12410. for (var i = 0, ii = fnArray.length; i < ii; i++) {
  12411. fnArray[i](src, srcOffset, dest, destOffset + i);
  12412. }
  12413. };
  12414. },
  12415. constructSampled: function PDFFunction_constructSampled(str, dict) {
  12416. function toMultiArray(arr) {
  12417. var inputLength = arr.length;
  12418. var out = [];
  12419. var index = 0;
  12420. for (var i = 0; i < inputLength; i += 2) {
  12421. out[index] = [
  12422. arr[i],
  12423. arr[i + 1]
  12424. ];
  12425. ++index;
  12426. }
  12427. return out;
  12428. }
  12429. var domain = dict.getArray('Domain');
  12430. var range = dict.getArray('Range');
  12431. if (!domain || !range) {
  12432. error('No domain or range');
  12433. }
  12434. var inputSize = domain.length / 2;
  12435. var outputSize = range.length / 2;
  12436. domain = toMultiArray(domain);
  12437. range = toMultiArray(range);
  12438. var size = dict.get('Size');
  12439. var bps = dict.get('BitsPerSample');
  12440. var order = dict.get('Order') || 1;
  12441. if (order !== 1) {
  12442. info('No support for cubic spline interpolation: ' + order);
  12443. }
  12444. var encode = dict.getArray('Encode');
  12445. if (!encode) {
  12446. encode = [];
  12447. for (var i = 0; i < inputSize; ++i) {
  12448. encode.push(0);
  12449. encode.push(size[i] - 1);
  12450. }
  12451. }
  12452. encode = toMultiArray(encode);
  12453. var decode = dict.getArray('Decode');
  12454. if (!decode) {
  12455. decode = range;
  12456. } else {
  12457. decode = toMultiArray(decode);
  12458. }
  12459. var samples = this.getSampleArray(size, outputSize, bps, str);
  12460. return [
  12461. CONSTRUCT_SAMPLED,
  12462. inputSize,
  12463. domain,
  12464. encode,
  12465. decode,
  12466. samples,
  12467. size,
  12468. outputSize,
  12469. Math.pow(2, bps) - 1,
  12470. range
  12471. ];
  12472. },
  12473. constructSampledFromIR: function PDFFunction_constructSampledFromIR(IR) {
  12474. function interpolate(x, xmin, xmax, ymin, ymax) {
  12475. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  12476. }
  12477. return function constructSampledFromIRResult(src, srcOffset, dest, destOffset) {
  12478. var m = IR[1];
  12479. var domain = IR[2];
  12480. var encode = IR[3];
  12481. var decode = IR[4];
  12482. var samples = IR[5];
  12483. var size = IR[6];
  12484. var n = IR[7];
  12485. var range = IR[9];
  12486. var cubeVertices = 1 << m;
  12487. var cubeN = new Float64Array(cubeVertices);
  12488. var cubeVertex = new Uint32Array(cubeVertices);
  12489. var i, j;
  12490. for (j = 0; j < cubeVertices; j++) {
  12491. cubeN[j] = 1;
  12492. }
  12493. var k = n, pos = 1;
  12494. for (i = 0; i < m; ++i) {
  12495. var domain_2i = domain[i][0];
  12496. var domain_2i_1 = domain[i][1];
  12497. var xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  12498. var e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  12499. var size_i = size[i];
  12500. e = Math.min(Math.max(e, 0), size_i - 1);
  12501. var e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  12502. var n0 = e0 + 1 - e;
  12503. var n1 = e - e0;
  12504. var offset0 = e0 * k;
  12505. var offset1 = offset0 + k;
  12506. for (j = 0; j < cubeVertices; j++) {
  12507. if (j & pos) {
  12508. cubeN[j] *= n1;
  12509. cubeVertex[j] += offset1;
  12510. } else {
  12511. cubeN[j] *= n0;
  12512. cubeVertex[j] += offset0;
  12513. }
  12514. }
  12515. k *= size_i;
  12516. pos <<= 1;
  12517. }
  12518. for (j = 0; j < n; ++j) {
  12519. var rj = 0;
  12520. for (i = 0; i < cubeVertices; i++) {
  12521. rj += samples[cubeVertex[i] + j] * cubeN[i];
  12522. }
  12523. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  12524. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  12525. }
  12526. };
  12527. },
  12528. constructInterpolated: function PDFFunction_constructInterpolated(str, dict) {
  12529. var c0 = dict.getArray('C0') || [0];
  12530. var c1 = dict.getArray('C1') || [1];
  12531. var n = dict.get('N');
  12532. if (!isArray(c0) || !isArray(c1)) {
  12533. error('Illegal dictionary for interpolated function');
  12534. }
  12535. var length = c0.length;
  12536. var diff = [];
  12537. for (var i = 0; i < length; ++i) {
  12538. diff.push(c1[i] - c0[i]);
  12539. }
  12540. return [
  12541. CONSTRUCT_INTERPOLATED,
  12542. c0,
  12543. diff,
  12544. n
  12545. ];
  12546. },
  12547. constructInterpolatedFromIR: function PDFFunction_constructInterpolatedFromIR(IR) {
  12548. var c0 = IR[1];
  12549. var diff = IR[2];
  12550. var n = IR[3];
  12551. var length = diff.length;
  12552. return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOffset) {
  12553. var x = n === 1 ? src[srcOffset] : Math.pow(src[srcOffset], n);
  12554. for (var j = 0; j < length; ++j) {
  12555. dest[destOffset + j] = c0[j] + x * diff[j];
  12556. }
  12557. };
  12558. },
  12559. constructStiched: function PDFFunction_constructStiched(fn, dict, xref) {
  12560. var domain = dict.getArray('Domain');
  12561. if (!domain) {
  12562. error('No domain');
  12563. }
  12564. var inputSize = domain.length / 2;
  12565. if (inputSize !== 1) {
  12566. error('Bad domain for stiched function');
  12567. }
  12568. var fnRefs = dict.get('Functions');
  12569. var fns = [];
  12570. for (var i = 0, ii = fnRefs.length; i < ii; ++i) {
  12571. fns.push(PDFFunction.getIR(xref, xref.fetchIfRef(fnRefs[i])));
  12572. }
  12573. var bounds = dict.getArray('Bounds');
  12574. var encode = dict.getArray('Encode');
  12575. return [
  12576. CONSTRUCT_STICHED,
  12577. domain,
  12578. bounds,
  12579. encode,
  12580. fns
  12581. ];
  12582. },
  12583. constructStichedFromIR: function PDFFunction_constructStichedFromIR(IR) {
  12584. var domain = IR[1];
  12585. var bounds = IR[2];
  12586. var encode = IR[3];
  12587. var fnsIR = IR[4];
  12588. var fns = [];
  12589. var tmpBuf = new Float32Array(1);
  12590. for (var i = 0, ii = fnsIR.length; i < ii; i++) {
  12591. fns.push(PDFFunction.fromIR(fnsIR[i]));
  12592. }
  12593. return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) {
  12594. var clip = function constructStichedFromIRClip(v, min, max) {
  12595. if (v > max) {
  12596. v = max;
  12597. } else if (v < min) {
  12598. v = min;
  12599. }
  12600. return v;
  12601. };
  12602. var v = clip(src[srcOffset], domain[0], domain[1]);
  12603. for (var i = 0, ii = bounds.length; i < ii; ++i) {
  12604. if (v < bounds[i]) {
  12605. break;
  12606. }
  12607. }
  12608. var dmin = domain[0];
  12609. if (i > 0) {
  12610. dmin = bounds[i - 1];
  12611. }
  12612. var dmax = domain[1];
  12613. if (i < bounds.length) {
  12614. dmax = bounds[i];
  12615. }
  12616. var rmin = encode[2 * i];
  12617. var rmax = encode[2 * i + 1];
  12618. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  12619. fns[i](tmpBuf, 0, dest, destOffset);
  12620. };
  12621. },
  12622. constructPostScript: function PDFFunction_constructPostScript(fn, dict, xref) {
  12623. var domain = dict.getArray('Domain');
  12624. var range = dict.getArray('Range');
  12625. if (!domain) {
  12626. error('No domain.');
  12627. }
  12628. if (!range) {
  12629. error('No range.');
  12630. }
  12631. var lexer = new PostScriptLexer(fn);
  12632. var parser = new PostScriptParser(lexer);
  12633. var code = parser.parse();
  12634. return [
  12635. CONSTRUCT_POSTSCRIPT,
  12636. domain,
  12637. range,
  12638. code
  12639. ];
  12640. },
  12641. constructPostScriptFromIR: function PDFFunction_constructPostScriptFromIR(IR) {
  12642. var domain = IR[1];
  12643. var range = IR[2];
  12644. var code = IR[3];
  12645. var compiled = new PostScriptCompiler().compile(code, domain, range);
  12646. if (compiled) {
  12647. return new Function('src', 'srcOffset', 'dest', 'destOffset', compiled);
  12648. }
  12649. info('Unable to compile PS function');
  12650. var numOutputs = range.length >> 1;
  12651. var numInputs = domain.length >> 1;
  12652. var evaluator = new PostScriptEvaluator(code);
  12653. var cache = Object.create(null);
  12654. var MAX_CACHE_SIZE = 2048 * 4;
  12655. var cache_available = MAX_CACHE_SIZE;
  12656. var tmpBuf = new Float32Array(numInputs);
  12657. return function constructPostScriptFromIRResult(src, srcOffset, dest, destOffset) {
  12658. var i, value;
  12659. var key = '';
  12660. var input = tmpBuf;
  12661. for (i = 0; i < numInputs; i++) {
  12662. value = src[srcOffset + i];
  12663. input[i] = value;
  12664. key += value + '_';
  12665. }
  12666. var cachedValue = cache[key];
  12667. if (cachedValue !== undefined) {
  12668. dest.set(cachedValue, destOffset);
  12669. return;
  12670. }
  12671. var output = new Float32Array(numOutputs);
  12672. var stack = evaluator.execute(input);
  12673. var stackIndex = stack.length - numOutputs;
  12674. for (i = 0; i < numOutputs; i++) {
  12675. value = stack[stackIndex + i];
  12676. var bound = range[i * 2];
  12677. if (value < bound) {
  12678. value = bound;
  12679. } else {
  12680. bound = range[i * 2 + 1];
  12681. if (value > bound) {
  12682. value = bound;
  12683. }
  12684. }
  12685. output[i] = value;
  12686. }
  12687. if (cache_available > 0) {
  12688. cache_available--;
  12689. cache[key] = output;
  12690. }
  12691. dest.set(output, destOffset);
  12692. };
  12693. }
  12694. };
  12695. }();
  12696. function isPDFFunction(v) {
  12697. var fnDict;
  12698. if (typeof v !== 'object') {
  12699. return false;
  12700. } else if (isDict(v)) {
  12701. fnDict = v;
  12702. } else if (isStream(v)) {
  12703. fnDict = v.dict;
  12704. } else {
  12705. return false;
  12706. }
  12707. return fnDict.has('FunctionType');
  12708. }
  12709. var PostScriptStack = function PostScriptStackClosure() {
  12710. var MAX_STACK_SIZE = 100;
  12711. function PostScriptStack(initialStack) {
  12712. this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
  12713. }
  12714. PostScriptStack.prototype = {
  12715. push: function PostScriptStack_push(value) {
  12716. if (this.stack.length >= MAX_STACK_SIZE) {
  12717. error('PostScript function stack overflow.');
  12718. }
  12719. this.stack.push(value);
  12720. },
  12721. pop: function PostScriptStack_pop() {
  12722. if (this.stack.length <= 0) {
  12723. error('PostScript function stack underflow.');
  12724. }
  12725. return this.stack.pop();
  12726. },
  12727. copy: function PostScriptStack_copy(n) {
  12728. if (this.stack.length + n >= MAX_STACK_SIZE) {
  12729. error('PostScript function stack overflow.');
  12730. }
  12731. var stack = this.stack;
  12732. for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  12733. stack.push(stack[i]);
  12734. }
  12735. },
  12736. index: function PostScriptStack_index(n) {
  12737. this.push(this.stack[this.stack.length - n - 1]);
  12738. },
  12739. roll: function PostScriptStack_roll(n, p) {
  12740. var stack = this.stack;
  12741. var l = stack.length - n;
  12742. var r = stack.length - 1, c = l + (p - Math.floor(p / n) * n), i, j, t;
  12743. for (i = l, j = r; i < j; i++, j--) {
  12744. t = stack[i];
  12745. stack[i] = stack[j];
  12746. stack[j] = t;
  12747. }
  12748. for (i = l, j = c - 1; i < j; i++, j--) {
  12749. t = stack[i];
  12750. stack[i] = stack[j];
  12751. stack[j] = t;
  12752. }
  12753. for (i = c, j = r; i < j; i++, j--) {
  12754. t = stack[i];
  12755. stack[i] = stack[j];
  12756. stack[j] = t;
  12757. }
  12758. }
  12759. };
  12760. return PostScriptStack;
  12761. }();
  12762. var PostScriptEvaluator = function PostScriptEvaluatorClosure() {
  12763. function PostScriptEvaluator(operators) {
  12764. this.operators = operators;
  12765. }
  12766. PostScriptEvaluator.prototype = {
  12767. execute: function PostScriptEvaluator_execute(initialStack) {
  12768. var stack = new PostScriptStack(initialStack);
  12769. var counter = 0;
  12770. var operators = this.operators;
  12771. var length = operators.length;
  12772. var operator, a, b;
  12773. while (counter < length) {
  12774. operator = operators[counter++];
  12775. if (typeof operator === 'number') {
  12776. stack.push(operator);
  12777. continue;
  12778. }
  12779. switch (operator) {
  12780. case 'jz':
  12781. b = stack.pop();
  12782. a = stack.pop();
  12783. if (!a) {
  12784. counter = b;
  12785. }
  12786. break;
  12787. case 'j':
  12788. a = stack.pop();
  12789. counter = a;
  12790. break;
  12791. case 'abs':
  12792. a = stack.pop();
  12793. stack.push(Math.abs(a));
  12794. break;
  12795. case 'add':
  12796. b = stack.pop();
  12797. a = stack.pop();
  12798. stack.push(a + b);
  12799. break;
  12800. case 'and':
  12801. b = stack.pop();
  12802. a = stack.pop();
  12803. if (isBool(a) && isBool(b)) {
  12804. stack.push(a && b);
  12805. } else {
  12806. stack.push(a & b);
  12807. }
  12808. break;
  12809. case 'atan':
  12810. a = stack.pop();
  12811. stack.push(Math.atan(a));
  12812. break;
  12813. case 'bitshift':
  12814. b = stack.pop();
  12815. a = stack.pop();
  12816. if (a > 0) {
  12817. stack.push(a << b);
  12818. } else {
  12819. stack.push(a >> b);
  12820. }
  12821. break;
  12822. case 'ceiling':
  12823. a = stack.pop();
  12824. stack.push(Math.ceil(a));
  12825. break;
  12826. case 'copy':
  12827. a = stack.pop();
  12828. stack.copy(a);
  12829. break;
  12830. case 'cos':
  12831. a = stack.pop();
  12832. stack.push(Math.cos(a));
  12833. break;
  12834. case 'cvi':
  12835. a = stack.pop() | 0;
  12836. stack.push(a);
  12837. break;
  12838. case 'cvr':
  12839. break;
  12840. case 'div':
  12841. b = stack.pop();
  12842. a = stack.pop();
  12843. stack.push(a / b);
  12844. break;
  12845. case 'dup':
  12846. stack.copy(1);
  12847. break;
  12848. case 'eq':
  12849. b = stack.pop();
  12850. a = stack.pop();
  12851. stack.push(a === b);
  12852. break;
  12853. case 'exch':
  12854. stack.roll(2, 1);
  12855. break;
  12856. case 'exp':
  12857. b = stack.pop();
  12858. a = stack.pop();
  12859. stack.push(Math.pow(a, b));
  12860. break;
  12861. case 'false':
  12862. stack.push(false);
  12863. break;
  12864. case 'floor':
  12865. a = stack.pop();
  12866. stack.push(Math.floor(a));
  12867. break;
  12868. case 'ge':
  12869. b = stack.pop();
  12870. a = stack.pop();
  12871. stack.push(a >= b);
  12872. break;
  12873. case 'gt':
  12874. b = stack.pop();
  12875. a = stack.pop();
  12876. stack.push(a > b);
  12877. break;
  12878. case 'idiv':
  12879. b = stack.pop();
  12880. a = stack.pop();
  12881. stack.push(a / b | 0);
  12882. break;
  12883. case 'index':
  12884. a = stack.pop();
  12885. stack.index(a);
  12886. break;
  12887. case 'le':
  12888. b = stack.pop();
  12889. a = stack.pop();
  12890. stack.push(a <= b);
  12891. break;
  12892. case 'ln':
  12893. a = stack.pop();
  12894. stack.push(Math.log(a));
  12895. break;
  12896. case 'log':
  12897. a = stack.pop();
  12898. stack.push(Math.log(a) / Math.LN10);
  12899. break;
  12900. case 'lt':
  12901. b = stack.pop();
  12902. a = stack.pop();
  12903. stack.push(a < b);
  12904. break;
  12905. case 'mod':
  12906. b = stack.pop();
  12907. a = stack.pop();
  12908. stack.push(a % b);
  12909. break;
  12910. case 'mul':
  12911. b = stack.pop();
  12912. a = stack.pop();
  12913. stack.push(a * b);
  12914. break;
  12915. case 'ne':
  12916. b = stack.pop();
  12917. a = stack.pop();
  12918. stack.push(a !== b);
  12919. break;
  12920. case 'neg':
  12921. a = stack.pop();
  12922. stack.push(-a);
  12923. break;
  12924. case 'not':
  12925. a = stack.pop();
  12926. if (isBool(a)) {
  12927. stack.push(!a);
  12928. } else {
  12929. stack.push(~a);
  12930. }
  12931. break;
  12932. case 'or':
  12933. b = stack.pop();
  12934. a = stack.pop();
  12935. if (isBool(a) && isBool(b)) {
  12936. stack.push(a || b);
  12937. } else {
  12938. stack.push(a | b);
  12939. }
  12940. break;
  12941. case 'pop':
  12942. stack.pop();
  12943. break;
  12944. case 'roll':
  12945. b = stack.pop();
  12946. a = stack.pop();
  12947. stack.roll(a, b);
  12948. break;
  12949. case 'round':
  12950. a = stack.pop();
  12951. stack.push(Math.round(a));
  12952. break;
  12953. case 'sin':
  12954. a = stack.pop();
  12955. stack.push(Math.sin(a));
  12956. break;
  12957. case 'sqrt':
  12958. a = stack.pop();
  12959. stack.push(Math.sqrt(a));
  12960. break;
  12961. case 'sub':
  12962. b = stack.pop();
  12963. a = stack.pop();
  12964. stack.push(a - b);
  12965. break;
  12966. case 'true':
  12967. stack.push(true);
  12968. break;
  12969. case 'truncate':
  12970. a = stack.pop();
  12971. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  12972. stack.push(a);
  12973. break;
  12974. case 'xor':
  12975. b = stack.pop();
  12976. a = stack.pop();
  12977. if (isBool(a) && isBool(b)) {
  12978. stack.push(a !== b);
  12979. } else {
  12980. stack.push(a ^ b);
  12981. }
  12982. break;
  12983. default:
  12984. error('Unknown operator ' + operator);
  12985. break;
  12986. }
  12987. }
  12988. return stack.stack;
  12989. }
  12990. };
  12991. return PostScriptEvaluator;
  12992. }();
  12993. var PostScriptCompiler = function PostScriptCompilerClosure() {
  12994. function AstNode(type) {
  12995. this.type = type;
  12996. }
  12997. AstNode.prototype.visit = function (visitor) {
  12998. throw new Error('abstract method');
  12999. };
  13000. function AstArgument(index, min, max) {
  13001. AstNode.call(this, 'args');
  13002. this.index = index;
  13003. this.min = min;
  13004. this.max = max;
  13005. }
  13006. AstArgument.prototype = Object.create(AstNode.prototype);
  13007. AstArgument.prototype.visit = function (visitor) {
  13008. visitor.visitArgument(this);
  13009. };
  13010. function AstLiteral(number) {
  13011. AstNode.call(this, 'literal');
  13012. this.number = number;
  13013. this.min = number;
  13014. this.max = number;
  13015. }
  13016. AstLiteral.prototype = Object.create(AstNode.prototype);
  13017. AstLiteral.prototype.visit = function (visitor) {
  13018. visitor.visitLiteral(this);
  13019. };
  13020. function AstBinaryOperation(op, arg1, arg2, min, max) {
  13021. AstNode.call(this, 'binary');
  13022. this.op = op;
  13023. this.arg1 = arg1;
  13024. this.arg2 = arg2;
  13025. this.min = min;
  13026. this.max = max;
  13027. }
  13028. AstBinaryOperation.prototype = Object.create(AstNode.prototype);
  13029. AstBinaryOperation.prototype.visit = function (visitor) {
  13030. visitor.visitBinaryOperation(this);
  13031. };
  13032. function AstMin(arg, max) {
  13033. AstNode.call(this, 'max');
  13034. this.arg = arg;
  13035. this.min = arg.min;
  13036. this.max = max;
  13037. }
  13038. AstMin.prototype = Object.create(AstNode.prototype);
  13039. AstMin.prototype.visit = function (visitor) {
  13040. visitor.visitMin(this);
  13041. };
  13042. function AstVariable(index, min, max) {
  13043. AstNode.call(this, 'var');
  13044. this.index = index;
  13045. this.min = min;
  13046. this.max = max;
  13047. }
  13048. AstVariable.prototype = Object.create(AstNode.prototype);
  13049. AstVariable.prototype.visit = function (visitor) {
  13050. visitor.visitVariable(this);
  13051. };
  13052. function AstVariableDefinition(variable, arg) {
  13053. AstNode.call(this, 'definition');
  13054. this.variable = variable;
  13055. this.arg = arg;
  13056. }
  13057. AstVariableDefinition.prototype = Object.create(AstNode.prototype);
  13058. AstVariableDefinition.prototype.visit = function (visitor) {
  13059. visitor.visitVariableDefinition(this);
  13060. };
  13061. function ExpressionBuilderVisitor() {
  13062. this.parts = [];
  13063. }
  13064. ExpressionBuilderVisitor.prototype = {
  13065. visitArgument: function (arg) {
  13066. this.parts.push('Math.max(', arg.min, ', Math.min(', arg.max, ', src[srcOffset + ', arg.index, ']))');
  13067. },
  13068. visitVariable: function (variable) {
  13069. this.parts.push('v', variable.index);
  13070. },
  13071. visitLiteral: function (literal) {
  13072. this.parts.push(literal.number);
  13073. },
  13074. visitBinaryOperation: function (operation) {
  13075. this.parts.push('(');
  13076. operation.arg1.visit(this);
  13077. this.parts.push(' ', operation.op, ' ');
  13078. operation.arg2.visit(this);
  13079. this.parts.push(')');
  13080. },
  13081. visitVariableDefinition: function (definition) {
  13082. this.parts.push('var ');
  13083. definition.variable.visit(this);
  13084. this.parts.push(' = ');
  13085. definition.arg.visit(this);
  13086. this.parts.push(';');
  13087. },
  13088. visitMin: function (max) {
  13089. this.parts.push('Math.min(');
  13090. max.arg.visit(this);
  13091. this.parts.push(', ', max.max, ')');
  13092. },
  13093. toString: function () {
  13094. return this.parts.join('');
  13095. }
  13096. };
  13097. function buildAddOperation(num1, num2) {
  13098. if (num2.type === 'literal' && num2.number === 0) {
  13099. return num1;
  13100. }
  13101. if (num1.type === 'literal' && num1.number === 0) {
  13102. return num2;
  13103. }
  13104. if (num2.type === 'literal' && num1.type === 'literal') {
  13105. return new AstLiteral(num1.number + num2.number);
  13106. }
  13107. return new AstBinaryOperation('+', num1, num2, num1.min + num2.min, num1.max + num2.max);
  13108. }
  13109. function buildMulOperation(num1, num2) {
  13110. if (num2.type === 'literal') {
  13111. if (num2.number === 0) {
  13112. return new AstLiteral(0);
  13113. } else if (num2.number === 1) {
  13114. return num1;
  13115. } else if (num1.type === 'literal') {
  13116. return new AstLiteral(num1.number * num2.number);
  13117. }
  13118. }
  13119. if (num1.type === 'literal') {
  13120. if (num1.number === 0) {
  13121. return new AstLiteral(0);
  13122. } else if (num1.number === 1) {
  13123. return num2;
  13124. }
  13125. }
  13126. var min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  13127. var max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  13128. return new AstBinaryOperation('*', num1, num2, min, max);
  13129. }
  13130. function buildSubOperation(num1, num2) {
  13131. if (num2.type === 'literal') {
  13132. if (num2.number === 0) {
  13133. return num1;
  13134. } else if (num1.type === 'literal') {
  13135. return new AstLiteral(num1.number - num2.number);
  13136. }
  13137. }
  13138. if (num2.type === 'binary' && num2.op === '-' && num1.type === 'literal' && num1.number === 1 && num2.arg1.type === 'literal' && num2.arg1.number === 1) {
  13139. return num2.arg2;
  13140. }
  13141. return new AstBinaryOperation('-', num1, num2, num1.min - num2.max, num1.max - num2.min);
  13142. }
  13143. function buildMinOperation(num1, max) {
  13144. if (num1.min >= max) {
  13145. return new AstLiteral(max);
  13146. } else if (num1.max <= max) {
  13147. return num1;
  13148. }
  13149. return new AstMin(num1, max);
  13150. }
  13151. function PostScriptCompiler() {
  13152. }
  13153. PostScriptCompiler.prototype = {
  13154. compile: function PostScriptCompiler_compile(code, domain, range) {
  13155. var stack = [];
  13156. var i, ii;
  13157. var instructions = [];
  13158. var inputSize = domain.length >> 1, outputSize = range.length >> 1;
  13159. var lastRegister = 0;
  13160. var n, j;
  13161. var num1, num2, ast1, ast2, tmpVar, item;
  13162. for (i = 0; i < inputSize; i++) {
  13163. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  13164. }
  13165. for (i = 0, ii = code.length; i < ii; i++) {
  13166. item = code[i];
  13167. if (typeof item === 'number') {
  13168. stack.push(new AstLiteral(item));
  13169. continue;
  13170. }
  13171. switch (item) {
  13172. case 'add':
  13173. if (stack.length < 2) {
  13174. return null;
  13175. }
  13176. num2 = stack.pop();
  13177. num1 = stack.pop();
  13178. stack.push(buildAddOperation(num1, num2));
  13179. break;
  13180. case 'cvr':
  13181. if (stack.length < 1) {
  13182. return null;
  13183. }
  13184. break;
  13185. case 'mul':
  13186. if (stack.length < 2) {
  13187. return null;
  13188. }
  13189. num2 = stack.pop();
  13190. num1 = stack.pop();
  13191. stack.push(buildMulOperation(num1, num2));
  13192. break;
  13193. case 'sub':
  13194. if (stack.length < 2) {
  13195. return null;
  13196. }
  13197. num2 = stack.pop();
  13198. num1 = stack.pop();
  13199. stack.push(buildSubOperation(num1, num2));
  13200. break;
  13201. case 'exch':
  13202. if (stack.length < 2) {
  13203. return null;
  13204. }
  13205. ast1 = stack.pop();
  13206. ast2 = stack.pop();
  13207. stack.push(ast1, ast2);
  13208. break;
  13209. case 'pop':
  13210. if (stack.length < 1) {
  13211. return null;
  13212. }
  13213. stack.pop();
  13214. break;
  13215. case 'index':
  13216. if (stack.length < 1) {
  13217. return null;
  13218. }
  13219. num1 = stack.pop();
  13220. if (num1.type !== 'literal') {
  13221. return null;
  13222. }
  13223. n = num1.number;
  13224. if (n < 0 || (n | 0) !== n || stack.length < n) {
  13225. return null;
  13226. }
  13227. ast1 = stack[stack.length - n - 1];
  13228. if (ast1.type === 'literal' || ast1.type === 'var') {
  13229. stack.push(ast1);
  13230. break;
  13231. }
  13232. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  13233. stack[stack.length - n - 1] = tmpVar;
  13234. stack.push(tmpVar);
  13235. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  13236. break;
  13237. case 'dup':
  13238. if (stack.length < 1) {
  13239. return null;
  13240. }
  13241. 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]) {
  13242. num1 = stack.pop();
  13243. stack.push(buildMinOperation(num1, code[i + 1]));
  13244. i += 6;
  13245. break;
  13246. }
  13247. ast1 = stack[stack.length - 1];
  13248. if (ast1.type === 'literal' || ast1.type === 'var') {
  13249. stack.push(ast1);
  13250. break;
  13251. }
  13252. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  13253. stack[stack.length - 1] = tmpVar;
  13254. stack.push(tmpVar);
  13255. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  13256. break;
  13257. case 'roll':
  13258. if (stack.length < 2) {
  13259. return null;
  13260. }
  13261. num2 = stack.pop();
  13262. num1 = stack.pop();
  13263. if (num2.type !== 'literal' || num1.type !== 'literal') {
  13264. return null;
  13265. }
  13266. j = num2.number;
  13267. n = num1.number;
  13268. if (n <= 0 || (n | 0) !== n || (j | 0) !== j || stack.length < n) {
  13269. return null;
  13270. }
  13271. j = (j % n + n) % n;
  13272. if (j === 0) {
  13273. break;
  13274. }
  13275. Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
  13276. break;
  13277. default:
  13278. return null;
  13279. }
  13280. }
  13281. if (stack.length !== outputSize) {
  13282. return null;
  13283. }
  13284. var result = [];
  13285. instructions.forEach(function (instruction) {
  13286. var statementBuilder = new ExpressionBuilderVisitor();
  13287. instruction.visit(statementBuilder);
  13288. result.push(statementBuilder.toString());
  13289. });
  13290. stack.forEach(function (expr, i) {
  13291. var statementBuilder = new ExpressionBuilderVisitor();
  13292. expr.visit(statementBuilder);
  13293. var min = range[i * 2], max = range[i * 2 + 1];
  13294. var out = [statementBuilder.toString()];
  13295. if (min > expr.min) {
  13296. out.unshift('Math.max(', min, ', ');
  13297. out.push(')');
  13298. }
  13299. if (max < expr.max) {
  13300. out.unshift('Math.min(', max, ', ');
  13301. out.push(')');
  13302. }
  13303. out.unshift('dest[destOffset + ', i, '] = ');
  13304. out.push(';');
  13305. result.push(out.join(''));
  13306. });
  13307. return result.join('\n');
  13308. }
  13309. };
  13310. return PostScriptCompiler;
  13311. }();
  13312. exports.isPDFFunction = isPDFFunction;
  13313. exports.PDFFunction = PDFFunction;
  13314. exports.PostScriptEvaluator = PostScriptEvaluator;
  13315. exports.PostScriptCompiler = PostScriptCompiler;
  13316. /***/ }),
  13317. /* 7 */
  13318. /***/ (function(module, exports, __w_pdfjs_require__) {
  13319. "use strict";
  13320. var sharedUtil = __w_pdfjs_require__(0);
  13321. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  13322. var getGlyphsUnicode = getLookupTableFactory(function (t) {
  13323. t['A'] = 0x0041;
  13324. t['AE'] = 0x00C6;
  13325. t['AEacute'] = 0x01FC;
  13326. t['AEmacron'] = 0x01E2;
  13327. t['AEsmall'] = 0xF7E6;
  13328. t['Aacute'] = 0x00C1;
  13329. t['Aacutesmall'] = 0xF7E1;
  13330. t['Abreve'] = 0x0102;
  13331. t['Abreveacute'] = 0x1EAE;
  13332. t['Abrevecyrillic'] = 0x04D0;
  13333. t['Abrevedotbelow'] = 0x1EB6;
  13334. t['Abrevegrave'] = 0x1EB0;
  13335. t['Abrevehookabove'] = 0x1EB2;
  13336. t['Abrevetilde'] = 0x1EB4;
  13337. t['Acaron'] = 0x01CD;
  13338. t['Acircle'] = 0x24B6;
  13339. t['Acircumflex'] = 0x00C2;
  13340. t['Acircumflexacute'] = 0x1EA4;
  13341. t['Acircumflexdotbelow'] = 0x1EAC;
  13342. t['Acircumflexgrave'] = 0x1EA6;
  13343. t['Acircumflexhookabove'] = 0x1EA8;
  13344. t['Acircumflexsmall'] = 0xF7E2;
  13345. t['Acircumflextilde'] = 0x1EAA;
  13346. t['Acute'] = 0xF6C9;
  13347. t['Acutesmall'] = 0xF7B4;
  13348. t['Acyrillic'] = 0x0410;
  13349. t['Adblgrave'] = 0x0200;
  13350. t['Adieresis'] = 0x00C4;
  13351. t['Adieresiscyrillic'] = 0x04D2;
  13352. t['Adieresismacron'] = 0x01DE;
  13353. t['Adieresissmall'] = 0xF7E4;
  13354. t['Adotbelow'] = 0x1EA0;
  13355. t['Adotmacron'] = 0x01E0;
  13356. t['Agrave'] = 0x00C0;
  13357. t['Agravesmall'] = 0xF7E0;
  13358. t['Ahookabove'] = 0x1EA2;
  13359. t['Aiecyrillic'] = 0x04D4;
  13360. t['Ainvertedbreve'] = 0x0202;
  13361. t['Alpha'] = 0x0391;
  13362. t['Alphatonos'] = 0x0386;
  13363. t['Amacron'] = 0x0100;
  13364. t['Amonospace'] = 0xFF21;
  13365. t['Aogonek'] = 0x0104;
  13366. t['Aring'] = 0x00C5;
  13367. t['Aringacute'] = 0x01FA;
  13368. t['Aringbelow'] = 0x1E00;
  13369. t['Aringsmall'] = 0xF7E5;
  13370. t['Asmall'] = 0xF761;
  13371. t['Atilde'] = 0x00C3;
  13372. t['Atildesmall'] = 0xF7E3;
  13373. t['Aybarmenian'] = 0x0531;
  13374. t['B'] = 0x0042;
  13375. t['Bcircle'] = 0x24B7;
  13376. t['Bdotaccent'] = 0x1E02;
  13377. t['Bdotbelow'] = 0x1E04;
  13378. t['Becyrillic'] = 0x0411;
  13379. t['Benarmenian'] = 0x0532;
  13380. t['Beta'] = 0x0392;
  13381. t['Bhook'] = 0x0181;
  13382. t['Blinebelow'] = 0x1E06;
  13383. t['Bmonospace'] = 0xFF22;
  13384. t['Brevesmall'] = 0xF6F4;
  13385. t['Bsmall'] = 0xF762;
  13386. t['Btopbar'] = 0x0182;
  13387. t['C'] = 0x0043;
  13388. t['Caarmenian'] = 0x053E;
  13389. t['Cacute'] = 0x0106;
  13390. t['Caron'] = 0xF6CA;
  13391. t['Caronsmall'] = 0xF6F5;
  13392. t['Ccaron'] = 0x010C;
  13393. t['Ccedilla'] = 0x00C7;
  13394. t['Ccedillaacute'] = 0x1E08;
  13395. t['Ccedillasmall'] = 0xF7E7;
  13396. t['Ccircle'] = 0x24B8;
  13397. t['Ccircumflex'] = 0x0108;
  13398. t['Cdot'] = 0x010A;
  13399. t['Cdotaccent'] = 0x010A;
  13400. t['Cedillasmall'] = 0xF7B8;
  13401. t['Chaarmenian'] = 0x0549;
  13402. t['Cheabkhasiancyrillic'] = 0x04BC;
  13403. t['Checyrillic'] = 0x0427;
  13404. t['Chedescenderabkhasiancyrillic'] = 0x04BE;
  13405. t['Chedescendercyrillic'] = 0x04B6;
  13406. t['Chedieresiscyrillic'] = 0x04F4;
  13407. t['Cheharmenian'] = 0x0543;
  13408. t['Chekhakassiancyrillic'] = 0x04CB;
  13409. t['Cheverticalstrokecyrillic'] = 0x04B8;
  13410. t['Chi'] = 0x03A7;
  13411. t['Chook'] = 0x0187;
  13412. t['Circumflexsmall'] = 0xF6F6;
  13413. t['Cmonospace'] = 0xFF23;
  13414. t['Coarmenian'] = 0x0551;
  13415. t['Csmall'] = 0xF763;
  13416. t['D'] = 0x0044;
  13417. t['DZ'] = 0x01F1;
  13418. t['DZcaron'] = 0x01C4;
  13419. t['Daarmenian'] = 0x0534;
  13420. t['Dafrican'] = 0x0189;
  13421. t['Dcaron'] = 0x010E;
  13422. t['Dcedilla'] = 0x1E10;
  13423. t['Dcircle'] = 0x24B9;
  13424. t['Dcircumflexbelow'] = 0x1E12;
  13425. t['Dcroat'] = 0x0110;
  13426. t['Ddotaccent'] = 0x1E0A;
  13427. t['Ddotbelow'] = 0x1E0C;
  13428. t['Decyrillic'] = 0x0414;
  13429. t['Deicoptic'] = 0x03EE;
  13430. t['Delta'] = 0x2206;
  13431. t['Deltagreek'] = 0x0394;
  13432. t['Dhook'] = 0x018A;
  13433. t['Dieresis'] = 0xF6CB;
  13434. t['DieresisAcute'] = 0xF6CC;
  13435. t['DieresisGrave'] = 0xF6CD;
  13436. t['Dieresissmall'] = 0xF7A8;
  13437. t['Digammagreek'] = 0x03DC;
  13438. t['Djecyrillic'] = 0x0402;
  13439. t['Dlinebelow'] = 0x1E0E;
  13440. t['Dmonospace'] = 0xFF24;
  13441. t['Dotaccentsmall'] = 0xF6F7;
  13442. t['Dslash'] = 0x0110;
  13443. t['Dsmall'] = 0xF764;
  13444. t['Dtopbar'] = 0x018B;
  13445. t['Dz'] = 0x01F2;
  13446. t['Dzcaron'] = 0x01C5;
  13447. t['Dzeabkhasiancyrillic'] = 0x04E0;
  13448. t['Dzecyrillic'] = 0x0405;
  13449. t['Dzhecyrillic'] = 0x040F;
  13450. t['E'] = 0x0045;
  13451. t['Eacute'] = 0x00C9;
  13452. t['Eacutesmall'] = 0xF7E9;
  13453. t['Ebreve'] = 0x0114;
  13454. t['Ecaron'] = 0x011A;
  13455. t['Ecedillabreve'] = 0x1E1C;
  13456. t['Echarmenian'] = 0x0535;
  13457. t['Ecircle'] = 0x24BA;
  13458. t['Ecircumflex'] = 0x00CA;
  13459. t['Ecircumflexacute'] = 0x1EBE;
  13460. t['Ecircumflexbelow'] = 0x1E18;
  13461. t['Ecircumflexdotbelow'] = 0x1EC6;
  13462. t['Ecircumflexgrave'] = 0x1EC0;
  13463. t['Ecircumflexhookabove'] = 0x1EC2;
  13464. t['Ecircumflexsmall'] = 0xF7EA;
  13465. t['Ecircumflextilde'] = 0x1EC4;
  13466. t['Ecyrillic'] = 0x0404;
  13467. t['Edblgrave'] = 0x0204;
  13468. t['Edieresis'] = 0x00CB;
  13469. t['Edieresissmall'] = 0xF7EB;
  13470. t['Edot'] = 0x0116;
  13471. t['Edotaccent'] = 0x0116;
  13472. t['Edotbelow'] = 0x1EB8;
  13473. t['Efcyrillic'] = 0x0424;
  13474. t['Egrave'] = 0x00C8;
  13475. t['Egravesmall'] = 0xF7E8;
  13476. t['Eharmenian'] = 0x0537;
  13477. t['Ehookabove'] = 0x1EBA;
  13478. t['Eightroman'] = 0x2167;
  13479. t['Einvertedbreve'] = 0x0206;
  13480. t['Eiotifiedcyrillic'] = 0x0464;
  13481. t['Elcyrillic'] = 0x041B;
  13482. t['Elevenroman'] = 0x216A;
  13483. t['Emacron'] = 0x0112;
  13484. t['Emacronacute'] = 0x1E16;
  13485. t['Emacrongrave'] = 0x1E14;
  13486. t['Emcyrillic'] = 0x041C;
  13487. t['Emonospace'] = 0xFF25;
  13488. t['Encyrillic'] = 0x041D;
  13489. t['Endescendercyrillic'] = 0x04A2;
  13490. t['Eng'] = 0x014A;
  13491. t['Enghecyrillic'] = 0x04A4;
  13492. t['Enhookcyrillic'] = 0x04C7;
  13493. t['Eogonek'] = 0x0118;
  13494. t['Eopen'] = 0x0190;
  13495. t['Epsilon'] = 0x0395;
  13496. t['Epsilontonos'] = 0x0388;
  13497. t['Ercyrillic'] = 0x0420;
  13498. t['Ereversed'] = 0x018E;
  13499. t['Ereversedcyrillic'] = 0x042D;
  13500. t['Escyrillic'] = 0x0421;
  13501. t['Esdescendercyrillic'] = 0x04AA;
  13502. t['Esh'] = 0x01A9;
  13503. t['Esmall'] = 0xF765;
  13504. t['Eta'] = 0x0397;
  13505. t['Etarmenian'] = 0x0538;
  13506. t['Etatonos'] = 0x0389;
  13507. t['Eth'] = 0x00D0;
  13508. t['Ethsmall'] = 0xF7F0;
  13509. t['Etilde'] = 0x1EBC;
  13510. t['Etildebelow'] = 0x1E1A;
  13511. t['Euro'] = 0x20AC;
  13512. t['Ezh'] = 0x01B7;
  13513. t['Ezhcaron'] = 0x01EE;
  13514. t['Ezhreversed'] = 0x01B8;
  13515. t['F'] = 0x0046;
  13516. t['Fcircle'] = 0x24BB;
  13517. t['Fdotaccent'] = 0x1E1E;
  13518. t['Feharmenian'] = 0x0556;
  13519. t['Feicoptic'] = 0x03E4;
  13520. t['Fhook'] = 0x0191;
  13521. t['Fitacyrillic'] = 0x0472;
  13522. t['Fiveroman'] = 0x2164;
  13523. t['Fmonospace'] = 0xFF26;
  13524. t['Fourroman'] = 0x2163;
  13525. t['Fsmall'] = 0xF766;
  13526. t['G'] = 0x0047;
  13527. t['GBsquare'] = 0x3387;
  13528. t['Gacute'] = 0x01F4;
  13529. t['Gamma'] = 0x0393;
  13530. t['Gammaafrican'] = 0x0194;
  13531. t['Gangiacoptic'] = 0x03EA;
  13532. t['Gbreve'] = 0x011E;
  13533. t['Gcaron'] = 0x01E6;
  13534. t['Gcedilla'] = 0x0122;
  13535. t['Gcircle'] = 0x24BC;
  13536. t['Gcircumflex'] = 0x011C;
  13537. t['Gcommaaccent'] = 0x0122;
  13538. t['Gdot'] = 0x0120;
  13539. t['Gdotaccent'] = 0x0120;
  13540. t['Gecyrillic'] = 0x0413;
  13541. t['Ghadarmenian'] = 0x0542;
  13542. t['Ghemiddlehookcyrillic'] = 0x0494;
  13543. t['Ghestrokecyrillic'] = 0x0492;
  13544. t['Gheupturncyrillic'] = 0x0490;
  13545. t['Ghook'] = 0x0193;
  13546. t['Gimarmenian'] = 0x0533;
  13547. t['Gjecyrillic'] = 0x0403;
  13548. t['Gmacron'] = 0x1E20;
  13549. t['Gmonospace'] = 0xFF27;
  13550. t['Grave'] = 0xF6CE;
  13551. t['Gravesmall'] = 0xF760;
  13552. t['Gsmall'] = 0xF767;
  13553. t['Gsmallhook'] = 0x029B;
  13554. t['Gstroke'] = 0x01E4;
  13555. t['H'] = 0x0048;
  13556. t['H18533'] = 0x25CF;
  13557. t['H18543'] = 0x25AA;
  13558. t['H18551'] = 0x25AB;
  13559. t['H22073'] = 0x25A1;
  13560. t['HPsquare'] = 0x33CB;
  13561. t['Haabkhasiancyrillic'] = 0x04A8;
  13562. t['Hadescendercyrillic'] = 0x04B2;
  13563. t['Hardsigncyrillic'] = 0x042A;
  13564. t['Hbar'] = 0x0126;
  13565. t['Hbrevebelow'] = 0x1E2A;
  13566. t['Hcedilla'] = 0x1E28;
  13567. t['Hcircle'] = 0x24BD;
  13568. t['Hcircumflex'] = 0x0124;
  13569. t['Hdieresis'] = 0x1E26;
  13570. t['Hdotaccent'] = 0x1E22;
  13571. t['Hdotbelow'] = 0x1E24;
  13572. t['Hmonospace'] = 0xFF28;
  13573. t['Hoarmenian'] = 0x0540;
  13574. t['Horicoptic'] = 0x03E8;
  13575. t['Hsmall'] = 0xF768;
  13576. t['Hungarumlaut'] = 0xF6CF;
  13577. t['Hungarumlautsmall'] = 0xF6F8;
  13578. t['Hzsquare'] = 0x3390;
  13579. t['I'] = 0x0049;
  13580. t['IAcyrillic'] = 0x042F;
  13581. t['IJ'] = 0x0132;
  13582. t['IUcyrillic'] = 0x042E;
  13583. t['Iacute'] = 0x00CD;
  13584. t['Iacutesmall'] = 0xF7ED;
  13585. t['Ibreve'] = 0x012C;
  13586. t['Icaron'] = 0x01CF;
  13587. t['Icircle'] = 0x24BE;
  13588. t['Icircumflex'] = 0x00CE;
  13589. t['Icircumflexsmall'] = 0xF7EE;
  13590. t['Icyrillic'] = 0x0406;
  13591. t['Idblgrave'] = 0x0208;
  13592. t['Idieresis'] = 0x00CF;
  13593. t['Idieresisacute'] = 0x1E2E;
  13594. t['Idieresiscyrillic'] = 0x04E4;
  13595. t['Idieresissmall'] = 0xF7EF;
  13596. t['Idot'] = 0x0130;
  13597. t['Idotaccent'] = 0x0130;
  13598. t['Idotbelow'] = 0x1ECA;
  13599. t['Iebrevecyrillic'] = 0x04D6;
  13600. t['Iecyrillic'] = 0x0415;
  13601. t['Ifraktur'] = 0x2111;
  13602. t['Igrave'] = 0x00CC;
  13603. t['Igravesmall'] = 0xF7EC;
  13604. t['Ihookabove'] = 0x1EC8;
  13605. t['Iicyrillic'] = 0x0418;
  13606. t['Iinvertedbreve'] = 0x020A;
  13607. t['Iishortcyrillic'] = 0x0419;
  13608. t['Imacron'] = 0x012A;
  13609. t['Imacroncyrillic'] = 0x04E2;
  13610. t['Imonospace'] = 0xFF29;
  13611. t['Iniarmenian'] = 0x053B;
  13612. t['Iocyrillic'] = 0x0401;
  13613. t['Iogonek'] = 0x012E;
  13614. t['Iota'] = 0x0399;
  13615. t['Iotaafrican'] = 0x0196;
  13616. t['Iotadieresis'] = 0x03AA;
  13617. t['Iotatonos'] = 0x038A;
  13618. t['Ismall'] = 0xF769;
  13619. t['Istroke'] = 0x0197;
  13620. t['Itilde'] = 0x0128;
  13621. t['Itildebelow'] = 0x1E2C;
  13622. t['Izhitsacyrillic'] = 0x0474;
  13623. t['Izhitsadblgravecyrillic'] = 0x0476;
  13624. t['J'] = 0x004A;
  13625. t['Jaarmenian'] = 0x0541;
  13626. t['Jcircle'] = 0x24BF;
  13627. t['Jcircumflex'] = 0x0134;
  13628. t['Jecyrillic'] = 0x0408;
  13629. t['Jheharmenian'] = 0x054B;
  13630. t['Jmonospace'] = 0xFF2A;
  13631. t['Jsmall'] = 0xF76A;
  13632. t['K'] = 0x004B;
  13633. t['KBsquare'] = 0x3385;
  13634. t['KKsquare'] = 0x33CD;
  13635. t['Kabashkircyrillic'] = 0x04A0;
  13636. t['Kacute'] = 0x1E30;
  13637. t['Kacyrillic'] = 0x041A;
  13638. t['Kadescendercyrillic'] = 0x049A;
  13639. t['Kahookcyrillic'] = 0x04C3;
  13640. t['Kappa'] = 0x039A;
  13641. t['Kastrokecyrillic'] = 0x049E;
  13642. t['Kaverticalstrokecyrillic'] = 0x049C;
  13643. t['Kcaron'] = 0x01E8;
  13644. t['Kcedilla'] = 0x0136;
  13645. t['Kcircle'] = 0x24C0;
  13646. t['Kcommaaccent'] = 0x0136;
  13647. t['Kdotbelow'] = 0x1E32;
  13648. t['Keharmenian'] = 0x0554;
  13649. t['Kenarmenian'] = 0x053F;
  13650. t['Khacyrillic'] = 0x0425;
  13651. t['Kheicoptic'] = 0x03E6;
  13652. t['Khook'] = 0x0198;
  13653. t['Kjecyrillic'] = 0x040C;
  13654. t['Klinebelow'] = 0x1E34;
  13655. t['Kmonospace'] = 0xFF2B;
  13656. t['Koppacyrillic'] = 0x0480;
  13657. t['Koppagreek'] = 0x03DE;
  13658. t['Ksicyrillic'] = 0x046E;
  13659. t['Ksmall'] = 0xF76B;
  13660. t['L'] = 0x004C;
  13661. t['LJ'] = 0x01C7;
  13662. t['LL'] = 0xF6BF;
  13663. t['Lacute'] = 0x0139;
  13664. t['Lambda'] = 0x039B;
  13665. t['Lcaron'] = 0x013D;
  13666. t['Lcedilla'] = 0x013B;
  13667. t['Lcircle'] = 0x24C1;
  13668. t['Lcircumflexbelow'] = 0x1E3C;
  13669. t['Lcommaaccent'] = 0x013B;
  13670. t['Ldot'] = 0x013F;
  13671. t['Ldotaccent'] = 0x013F;
  13672. t['Ldotbelow'] = 0x1E36;
  13673. t['Ldotbelowmacron'] = 0x1E38;
  13674. t['Liwnarmenian'] = 0x053C;
  13675. t['Lj'] = 0x01C8;
  13676. t['Ljecyrillic'] = 0x0409;
  13677. t['Llinebelow'] = 0x1E3A;
  13678. t['Lmonospace'] = 0xFF2C;
  13679. t['Lslash'] = 0x0141;
  13680. t['Lslashsmall'] = 0xF6F9;
  13681. t['Lsmall'] = 0xF76C;
  13682. t['M'] = 0x004D;
  13683. t['MBsquare'] = 0x3386;
  13684. t['Macron'] = 0xF6D0;
  13685. t['Macronsmall'] = 0xF7AF;
  13686. t['Macute'] = 0x1E3E;
  13687. t['Mcircle'] = 0x24C2;
  13688. t['Mdotaccent'] = 0x1E40;
  13689. t['Mdotbelow'] = 0x1E42;
  13690. t['Menarmenian'] = 0x0544;
  13691. t['Mmonospace'] = 0xFF2D;
  13692. t['Msmall'] = 0xF76D;
  13693. t['Mturned'] = 0x019C;
  13694. t['Mu'] = 0x039C;
  13695. t['N'] = 0x004E;
  13696. t['NJ'] = 0x01CA;
  13697. t['Nacute'] = 0x0143;
  13698. t['Ncaron'] = 0x0147;
  13699. t['Ncedilla'] = 0x0145;
  13700. t['Ncircle'] = 0x24C3;
  13701. t['Ncircumflexbelow'] = 0x1E4A;
  13702. t['Ncommaaccent'] = 0x0145;
  13703. t['Ndotaccent'] = 0x1E44;
  13704. t['Ndotbelow'] = 0x1E46;
  13705. t['Nhookleft'] = 0x019D;
  13706. t['Nineroman'] = 0x2168;
  13707. t['Nj'] = 0x01CB;
  13708. t['Njecyrillic'] = 0x040A;
  13709. t['Nlinebelow'] = 0x1E48;
  13710. t['Nmonospace'] = 0xFF2E;
  13711. t['Nowarmenian'] = 0x0546;
  13712. t['Nsmall'] = 0xF76E;
  13713. t['Ntilde'] = 0x00D1;
  13714. t['Ntildesmall'] = 0xF7F1;
  13715. t['Nu'] = 0x039D;
  13716. t['O'] = 0x004F;
  13717. t['OE'] = 0x0152;
  13718. t['OEsmall'] = 0xF6FA;
  13719. t['Oacute'] = 0x00D3;
  13720. t['Oacutesmall'] = 0xF7F3;
  13721. t['Obarredcyrillic'] = 0x04E8;
  13722. t['Obarreddieresiscyrillic'] = 0x04EA;
  13723. t['Obreve'] = 0x014E;
  13724. t['Ocaron'] = 0x01D1;
  13725. t['Ocenteredtilde'] = 0x019F;
  13726. t['Ocircle'] = 0x24C4;
  13727. t['Ocircumflex'] = 0x00D4;
  13728. t['Ocircumflexacute'] = 0x1ED0;
  13729. t['Ocircumflexdotbelow'] = 0x1ED8;
  13730. t['Ocircumflexgrave'] = 0x1ED2;
  13731. t['Ocircumflexhookabove'] = 0x1ED4;
  13732. t['Ocircumflexsmall'] = 0xF7F4;
  13733. t['Ocircumflextilde'] = 0x1ED6;
  13734. t['Ocyrillic'] = 0x041E;
  13735. t['Odblacute'] = 0x0150;
  13736. t['Odblgrave'] = 0x020C;
  13737. t['Odieresis'] = 0x00D6;
  13738. t['Odieresiscyrillic'] = 0x04E6;
  13739. t['Odieresissmall'] = 0xF7F6;
  13740. t['Odotbelow'] = 0x1ECC;
  13741. t['Ogoneksmall'] = 0xF6FB;
  13742. t['Ograve'] = 0x00D2;
  13743. t['Ogravesmall'] = 0xF7F2;
  13744. t['Oharmenian'] = 0x0555;
  13745. t['Ohm'] = 0x2126;
  13746. t['Ohookabove'] = 0x1ECE;
  13747. t['Ohorn'] = 0x01A0;
  13748. t['Ohornacute'] = 0x1EDA;
  13749. t['Ohorndotbelow'] = 0x1EE2;
  13750. t['Ohorngrave'] = 0x1EDC;
  13751. t['Ohornhookabove'] = 0x1EDE;
  13752. t['Ohorntilde'] = 0x1EE0;
  13753. t['Ohungarumlaut'] = 0x0150;
  13754. t['Oi'] = 0x01A2;
  13755. t['Oinvertedbreve'] = 0x020E;
  13756. t['Omacron'] = 0x014C;
  13757. t['Omacronacute'] = 0x1E52;
  13758. t['Omacrongrave'] = 0x1E50;
  13759. t['Omega'] = 0x2126;
  13760. t['Omegacyrillic'] = 0x0460;
  13761. t['Omegagreek'] = 0x03A9;
  13762. t['Omegaroundcyrillic'] = 0x047A;
  13763. t['Omegatitlocyrillic'] = 0x047C;
  13764. t['Omegatonos'] = 0x038F;
  13765. t['Omicron'] = 0x039F;
  13766. t['Omicrontonos'] = 0x038C;
  13767. t['Omonospace'] = 0xFF2F;
  13768. t['Oneroman'] = 0x2160;
  13769. t['Oogonek'] = 0x01EA;
  13770. t['Oogonekmacron'] = 0x01EC;
  13771. t['Oopen'] = 0x0186;
  13772. t['Oslash'] = 0x00D8;
  13773. t['Oslashacute'] = 0x01FE;
  13774. t['Oslashsmall'] = 0xF7F8;
  13775. t['Osmall'] = 0xF76F;
  13776. t['Ostrokeacute'] = 0x01FE;
  13777. t['Otcyrillic'] = 0x047E;
  13778. t['Otilde'] = 0x00D5;
  13779. t['Otildeacute'] = 0x1E4C;
  13780. t['Otildedieresis'] = 0x1E4E;
  13781. t['Otildesmall'] = 0xF7F5;
  13782. t['P'] = 0x0050;
  13783. t['Pacute'] = 0x1E54;
  13784. t['Pcircle'] = 0x24C5;
  13785. t['Pdotaccent'] = 0x1E56;
  13786. t['Pecyrillic'] = 0x041F;
  13787. t['Peharmenian'] = 0x054A;
  13788. t['Pemiddlehookcyrillic'] = 0x04A6;
  13789. t['Phi'] = 0x03A6;
  13790. t['Phook'] = 0x01A4;
  13791. t['Pi'] = 0x03A0;
  13792. t['Piwrarmenian'] = 0x0553;
  13793. t['Pmonospace'] = 0xFF30;
  13794. t['Psi'] = 0x03A8;
  13795. t['Psicyrillic'] = 0x0470;
  13796. t['Psmall'] = 0xF770;
  13797. t['Q'] = 0x0051;
  13798. t['Qcircle'] = 0x24C6;
  13799. t['Qmonospace'] = 0xFF31;
  13800. t['Qsmall'] = 0xF771;
  13801. t['R'] = 0x0052;
  13802. t['Raarmenian'] = 0x054C;
  13803. t['Racute'] = 0x0154;
  13804. t['Rcaron'] = 0x0158;
  13805. t['Rcedilla'] = 0x0156;
  13806. t['Rcircle'] = 0x24C7;
  13807. t['Rcommaaccent'] = 0x0156;
  13808. t['Rdblgrave'] = 0x0210;
  13809. t['Rdotaccent'] = 0x1E58;
  13810. t['Rdotbelow'] = 0x1E5A;
  13811. t['Rdotbelowmacron'] = 0x1E5C;
  13812. t['Reharmenian'] = 0x0550;
  13813. t['Rfraktur'] = 0x211C;
  13814. t['Rho'] = 0x03A1;
  13815. t['Ringsmall'] = 0xF6FC;
  13816. t['Rinvertedbreve'] = 0x0212;
  13817. t['Rlinebelow'] = 0x1E5E;
  13818. t['Rmonospace'] = 0xFF32;
  13819. t['Rsmall'] = 0xF772;
  13820. t['Rsmallinverted'] = 0x0281;
  13821. t['Rsmallinvertedsuperior'] = 0x02B6;
  13822. t['S'] = 0x0053;
  13823. t['SF010000'] = 0x250C;
  13824. t['SF020000'] = 0x2514;
  13825. t['SF030000'] = 0x2510;
  13826. t['SF040000'] = 0x2518;
  13827. t['SF050000'] = 0x253C;
  13828. t['SF060000'] = 0x252C;
  13829. t['SF070000'] = 0x2534;
  13830. t['SF080000'] = 0x251C;
  13831. t['SF090000'] = 0x2524;
  13832. t['SF100000'] = 0x2500;
  13833. t['SF110000'] = 0x2502;
  13834. t['SF190000'] = 0x2561;
  13835. t['SF200000'] = 0x2562;
  13836. t['SF210000'] = 0x2556;
  13837. t['SF220000'] = 0x2555;
  13838. t['SF230000'] = 0x2563;
  13839. t['SF240000'] = 0x2551;
  13840. t['SF250000'] = 0x2557;
  13841. t['SF260000'] = 0x255D;
  13842. t['SF270000'] = 0x255C;
  13843. t['SF280000'] = 0x255B;
  13844. t['SF360000'] = 0x255E;
  13845. t['SF370000'] = 0x255F;
  13846. t['SF380000'] = 0x255A;
  13847. t['SF390000'] = 0x2554;
  13848. t['SF400000'] = 0x2569;
  13849. t['SF410000'] = 0x2566;
  13850. t['SF420000'] = 0x2560;
  13851. t['SF430000'] = 0x2550;
  13852. t['SF440000'] = 0x256C;
  13853. t['SF450000'] = 0x2567;
  13854. t['SF460000'] = 0x2568;
  13855. t['SF470000'] = 0x2564;
  13856. t['SF480000'] = 0x2565;
  13857. t['SF490000'] = 0x2559;
  13858. t['SF500000'] = 0x2558;
  13859. t['SF510000'] = 0x2552;
  13860. t['SF520000'] = 0x2553;
  13861. t['SF530000'] = 0x256B;
  13862. t['SF540000'] = 0x256A;
  13863. t['Sacute'] = 0x015A;
  13864. t['Sacutedotaccent'] = 0x1E64;
  13865. t['Sampigreek'] = 0x03E0;
  13866. t['Scaron'] = 0x0160;
  13867. t['Scarondotaccent'] = 0x1E66;
  13868. t['Scaronsmall'] = 0xF6FD;
  13869. t['Scedilla'] = 0x015E;
  13870. t['Schwa'] = 0x018F;
  13871. t['Schwacyrillic'] = 0x04D8;
  13872. t['Schwadieresiscyrillic'] = 0x04DA;
  13873. t['Scircle'] = 0x24C8;
  13874. t['Scircumflex'] = 0x015C;
  13875. t['Scommaaccent'] = 0x0218;
  13876. t['Sdotaccent'] = 0x1E60;
  13877. t['Sdotbelow'] = 0x1E62;
  13878. t['Sdotbelowdotaccent'] = 0x1E68;
  13879. t['Seharmenian'] = 0x054D;
  13880. t['Sevenroman'] = 0x2166;
  13881. t['Shaarmenian'] = 0x0547;
  13882. t['Shacyrillic'] = 0x0428;
  13883. t['Shchacyrillic'] = 0x0429;
  13884. t['Sheicoptic'] = 0x03E2;
  13885. t['Shhacyrillic'] = 0x04BA;
  13886. t['Shimacoptic'] = 0x03EC;
  13887. t['Sigma'] = 0x03A3;
  13888. t['Sixroman'] = 0x2165;
  13889. t['Smonospace'] = 0xFF33;
  13890. t['Softsigncyrillic'] = 0x042C;
  13891. t['Ssmall'] = 0xF773;
  13892. t['Stigmagreek'] = 0x03DA;
  13893. t['T'] = 0x0054;
  13894. t['Tau'] = 0x03A4;
  13895. t['Tbar'] = 0x0166;
  13896. t['Tcaron'] = 0x0164;
  13897. t['Tcedilla'] = 0x0162;
  13898. t['Tcircle'] = 0x24C9;
  13899. t['Tcircumflexbelow'] = 0x1E70;
  13900. t['Tcommaaccent'] = 0x0162;
  13901. t['Tdotaccent'] = 0x1E6A;
  13902. t['Tdotbelow'] = 0x1E6C;
  13903. t['Tecyrillic'] = 0x0422;
  13904. t['Tedescendercyrillic'] = 0x04AC;
  13905. t['Tenroman'] = 0x2169;
  13906. t['Tetsecyrillic'] = 0x04B4;
  13907. t['Theta'] = 0x0398;
  13908. t['Thook'] = 0x01AC;
  13909. t['Thorn'] = 0x00DE;
  13910. t['Thornsmall'] = 0xF7FE;
  13911. t['Threeroman'] = 0x2162;
  13912. t['Tildesmall'] = 0xF6FE;
  13913. t['Tiwnarmenian'] = 0x054F;
  13914. t['Tlinebelow'] = 0x1E6E;
  13915. t['Tmonospace'] = 0xFF34;
  13916. t['Toarmenian'] = 0x0539;
  13917. t['Tonefive'] = 0x01BC;
  13918. t['Tonesix'] = 0x0184;
  13919. t['Tonetwo'] = 0x01A7;
  13920. t['Tretroflexhook'] = 0x01AE;
  13921. t['Tsecyrillic'] = 0x0426;
  13922. t['Tshecyrillic'] = 0x040B;
  13923. t['Tsmall'] = 0xF774;
  13924. t['Twelveroman'] = 0x216B;
  13925. t['Tworoman'] = 0x2161;
  13926. t['U'] = 0x0055;
  13927. t['Uacute'] = 0x00DA;
  13928. t['Uacutesmall'] = 0xF7FA;
  13929. t['Ubreve'] = 0x016C;
  13930. t['Ucaron'] = 0x01D3;
  13931. t['Ucircle'] = 0x24CA;
  13932. t['Ucircumflex'] = 0x00DB;
  13933. t['Ucircumflexbelow'] = 0x1E76;
  13934. t['Ucircumflexsmall'] = 0xF7FB;
  13935. t['Ucyrillic'] = 0x0423;
  13936. t['Udblacute'] = 0x0170;
  13937. t['Udblgrave'] = 0x0214;
  13938. t['Udieresis'] = 0x00DC;
  13939. t['Udieresisacute'] = 0x01D7;
  13940. t['Udieresisbelow'] = 0x1E72;
  13941. t['Udieresiscaron'] = 0x01D9;
  13942. t['Udieresiscyrillic'] = 0x04F0;
  13943. t['Udieresisgrave'] = 0x01DB;
  13944. t['Udieresismacron'] = 0x01D5;
  13945. t['Udieresissmall'] = 0xF7FC;
  13946. t['Udotbelow'] = 0x1EE4;
  13947. t['Ugrave'] = 0x00D9;
  13948. t['Ugravesmall'] = 0xF7F9;
  13949. t['Uhookabove'] = 0x1EE6;
  13950. t['Uhorn'] = 0x01AF;
  13951. t['Uhornacute'] = 0x1EE8;
  13952. t['Uhorndotbelow'] = 0x1EF0;
  13953. t['Uhorngrave'] = 0x1EEA;
  13954. t['Uhornhookabove'] = 0x1EEC;
  13955. t['Uhorntilde'] = 0x1EEE;
  13956. t['Uhungarumlaut'] = 0x0170;
  13957. t['Uhungarumlautcyrillic'] = 0x04F2;
  13958. t['Uinvertedbreve'] = 0x0216;
  13959. t['Ukcyrillic'] = 0x0478;
  13960. t['Umacron'] = 0x016A;
  13961. t['Umacroncyrillic'] = 0x04EE;
  13962. t['Umacrondieresis'] = 0x1E7A;
  13963. t['Umonospace'] = 0xFF35;
  13964. t['Uogonek'] = 0x0172;
  13965. t['Upsilon'] = 0x03A5;
  13966. t['Upsilon1'] = 0x03D2;
  13967. t['Upsilonacutehooksymbolgreek'] = 0x03D3;
  13968. t['Upsilonafrican'] = 0x01B1;
  13969. t['Upsilondieresis'] = 0x03AB;
  13970. t['Upsilondieresishooksymbolgreek'] = 0x03D4;
  13971. t['Upsilonhooksymbol'] = 0x03D2;
  13972. t['Upsilontonos'] = 0x038E;
  13973. t['Uring'] = 0x016E;
  13974. t['Ushortcyrillic'] = 0x040E;
  13975. t['Usmall'] = 0xF775;
  13976. t['Ustraightcyrillic'] = 0x04AE;
  13977. t['Ustraightstrokecyrillic'] = 0x04B0;
  13978. t['Utilde'] = 0x0168;
  13979. t['Utildeacute'] = 0x1E78;
  13980. t['Utildebelow'] = 0x1E74;
  13981. t['V'] = 0x0056;
  13982. t['Vcircle'] = 0x24CB;
  13983. t['Vdotbelow'] = 0x1E7E;
  13984. t['Vecyrillic'] = 0x0412;
  13985. t['Vewarmenian'] = 0x054E;
  13986. t['Vhook'] = 0x01B2;
  13987. t['Vmonospace'] = 0xFF36;
  13988. t['Voarmenian'] = 0x0548;
  13989. t['Vsmall'] = 0xF776;
  13990. t['Vtilde'] = 0x1E7C;
  13991. t['W'] = 0x0057;
  13992. t['Wacute'] = 0x1E82;
  13993. t['Wcircle'] = 0x24CC;
  13994. t['Wcircumflex'] = 0x0174;
  13995. t['Wdieresis'] = 0x1E84;
  13996. t['Wdotaccent'] = 0x1E86;
  13997. t['Wdotbelow'] = 0x1E88;
  13998. t['Wgrave'] = 0x1E80;
  13999. t['Wmonospace'] = 0xFF37;
  14000. t['Wsmall'] = 0xF777;
  14001. t['X'] = 0x0058;
  14002. t['Xcircle'] = 0x24CD;
  14003. t['Xdieresis'] = 0x1E8C;
  14004. t['Xdotaccent'] = 0x1E8A;
  14005. t['Xeharmenian'] = 0x053D;
  14006. t['Xi'] = 0x039E;
  14007. t['Xmonospace'] = 0xFF38;
  14008. t['Xsmall'] = 0xF778;
  14009. t['Y'] = 0x0059;
  14010. t['Yacute'] = 0x00DD;
  14011. t['Yacutesmall'] = 0xF7FD;
  14012. t['Yatcyrillic'] = 0x0462;
  14013. t['Ycircle'] = 0x24CE;
  14014. t['Ycircumflex'] = 0x0176;
  14015. t['Ydieresis'] = 0x0178;
  14016. t['Ydieresissmall'] = 0xF7FF;
  14017. t['Ydotaccent'] = 0x1E8E;
  14018. t['Ydotbelow'] = 0x1EF4;
  14019. t['Yericyrillic'] = 0x042B;
  14020. t['Yerudieresiscyrillic'] = 0x04F8;
  14021. t['Ygrave'] = 0x1EF2;
  14022. t['Yhook'] = 0x01B3;
  14023. t['Yhookabove'] = 0x1EF6;
  14024. t['Yiarmenian'] = 0x0545;
  14025. t['Yicyrillic'] = 0x0407;
  14026. t['Yiwnarmenian'] = 0x0552;
  14027. t['Ymonospace'] = 0xFF39;
  14028. t['Ysmall'] = 0xF779;
  14029. t['Ytilde'] = 0x1EF8;
  14030. t['Yusbigcyrillic'] = 0x046A;
  14031. t['Yusbigiotifiedcyrillic'] = 0x046C;
  14032. t['Yuslittlecyrillic'] = 0x0466;
  14033. t['Yuslittleiotifiedcyrillic'] = 0x0468;
  14034. t['Z'] = 0x005A;
  14035. t['Zaarmenian'] = 0x0536;
  14036. t['Zacute'] = 0x0179;
  14037. t['Zcaron'] = 0x017D;
  14038. t['Zcaronsmall'] = 0xF6FF;
  14039. t['Zcircle'] = 0x24CF;
  14040. t['Zcircumflex'] = 0x1E90;
  14041. t['Zdot'] = 0x017B;
  14042. t['Zdotaccent'] = 0x017B;
  14043. t['Zdotbelow'] = 0x1E92;
  14044. t['Zecyrillic'] = 0x0417;
  14045. t['Zedescendercyrillic'] = 0x0498;
  14046. t['Zedieresiscyrillic'] = 0x04DE;
  14047. t['Zeta'] = 0x0396;
  14048. t['Zhearmenian'] = 0x053A;
  14049. t['Zhebrevecyrillic'] = 0x04C1;
  14050. t['Zhecyrillic'] = 0x0416;
  14051. t['Zhedescendercyrillic'] = 0x0496;
  14052. t['Zhedieresiscyrillic'] = 0x04DC;
  14053. t['Zlinebelow'] = 0x1E94;
  14054. t['Zmonospace'] = 0xFF3A;
  14055. t['Zsmall'] = 0xF77A;
  14056. t['Zstroke'] = 0x01B5;
  14057. t['a'] = 0x0061;
  14058. t['aabengali'] = 0x0986;
  14059. t['aacute'] = 0x00E1;
  14060. t['aadeva'] = 0x0906;
  14061. t['aagujarati'] = 0x0A86;
  14062. t['aagurmukhi'] = 0x0A06;
  14063. t['aamatragurmukhi'] = 0x0A3E;
  14064. t['aarusquare'] = 0x3303;
  14065. t['aavowelsignbengali'] = 0x09BE;
  14066. t['aavowelsigndeva'] = 0x093E;
  14067. t['aavowelsigngujarati'] = 0x0ABE;
  14068. t['abbreviationmarkarmenian'] = 0x055F;
  14069. t['abbreviationsigndeva'] = 0x0970;
  14070. t['abengali'] = 0x0985;
  14071. t['abopomofo'] = 0x311A;
  14072. t['abreve'] = 0x0103;
  14073. t['abreveacute'] = 0x1EAF;
  14074. t['abrevecyrillic'] = 0x04D1;
  14075. t['abrevedotbelow'] = 0x1EB7;
  14076. t['abrevegrave'] = 0x1EB1;
  14077. t['abrevehookabove'] = 0x1EB3;
  14078. t['abrevetilde'] = 0x1EB5;
  14079. t['acaron'] = 0x01CE;
  14080. t['acircle'] = 0x24D0;
  14081. t['acircumflex'] = 0x00E2;
  14082. t['acircumflexacute'] = 0x1EA5;
  14083. t['acircumflexdotbelow'] = 0x1EAD;
  14084. t['acircumflexgrave'] = 0x1EA7;
  14085. t['acircumflexhookabove'] = 0x1EA9;
  14086. t['acircumflextilde'] = 0x1EAB;
  14087. t['acute'] = 0x00B4;
  14088. t['acutebelowcmb'] = 0x0317;
  14089. t['acutecmb'] = 0x0301;
  14090. t['acutecomb'] = 0x0301;
  14091. t['acutedeva'] = 0x0954;
  14092. t['acutelowmod'] = 0x02CF;
  14093. t['acutetonecmb'] = 0x0341;
  14094. t['acyrillic'] = 0x0430;
  14095. t['adblgrave'] = 0x0201;
  14096. t['addakgurmukhi'] = 0x0A71;
  14097. t['adeva'] = 0x0905;
  14098. t['adieresis'] = 0x00E4;
  14099. t['adieresiscyrillic'] = 0x04D3;
  14100. t['adieresismacron'] = 0x01DF;
  14101. t['adotbelow'] = 0x1EA1;
  14102. t['adotmacron'] = 0x01E1;
  14103. t['ae'] = 0x00E6;
  14104. t['aeacute'] = 0x01FD;
  14105. t['aekorean'] = 0x3150;
  14106. t['aemacron'] = 0x01E3;
  14107. t['afii00208'] = 0x2015;
  14108. t['afii08941'] = 0x20A4;
  14109. t['afii10017'] = 0x0410;
  14110. t['afii10018'] = 0x0411;
  14111. t['afii10019'] = 0x0412;
  14112. t['afii10020'] = 0x0413;
  14113. t['afii10021'] = 0x0414;
  14114. t['afii10022'] = 0x0415;
  14115. t['afii10023'] = 0x0401;
  14116. t['afii10024'] = 0x0416;
  14117. t['afii10025'] = 0x0417;
  14118. t['afii10026'] = 0x0418;
  14119. t['afii10027'] = 0x0419;
  14120. t['afii10028'] = 0x041A;
  14121. t['afii10029'] = 0x041B;
  14122. t['afii10030'] = 0x041C;
  14123. t['afii10031'] = 0x041D;
  14124. t['afii10032'] = 0x041E;
  14125. t['afii10033'] = 0x041F;
  14126. t['afii10034'] = 0x0420;
  14127. t['afii10035'] = 0x0421;
  14128. t['afii10036'] = 0x0422;
  14129. t['afii10037'] = 0x0423;
  14130. t['afii10038'] = 0x0424;
  14131. t['afii10039'] = 0x0425;
  14132. t['afii10040'] = 0x0426;
  14133. t['afii10041'] = 0x0427;
  14134. t['afii10042'] = 0x0428;
  14135. t['afii10043'] = 0x0429;
  14136. t['afii10044'] = 0x042A;
  14137. t['afii10045'] = 0x042B;
  14138. t['afii10046'] = 0x042C;
  14139. t['afii10047'] = 0x042D;
  14140. t['afii10048'] = 0x042E;
  14141. t['afii10049'] = 0x042F;
  14142. t['afii10050'] = 0x0490;
  14143. t['afii10051'] = 0x0402;
  14144. t['afii10052'] = 0x0403;
  14145. t['afii10053'] = 0x0404;
  14146. t['afii10054'] = 0x0405;
  14147. t['afii10055'] = 0x0406;
  14148. t['afii10056'] = 0x0407;
  14149. t['afii10057'] = 0x0408;
  14150. t['afii10058'] = 0x0409;
  14151. t['afii10059'] = 0x040A;
  14152. t['afii10060'] = 0x040B;
  14153. t['afii10061'] = 0x040C;
  14154. t['afii10062'] = 0x040E;
  14155. t['afii10063'] = 0xF6C4;
  14156. t['afii10064'] = 0xF6C5;
  14157. t['afii10065'] = 0x0430;
  14158. t['afii10066'] = 0x0431;
  14159. t['afii10067'] = 0x0432;
  14160. t['afii10068'] = 0x0433;
  14161. t['afii10069'] = 0x0434;
  14162. t['afii10070'] = 0x0435;
  14163. t['afii10071'] = 0x0451;
  14164. t['afii10072'] = 0x0436;
  14165. t['afii10073'] = 0x0437;
  14166. t['afii10074'] = 0x0438;
  14167. t['afii10075'] = 0x0439;
  14168. t['afii10076'] = 0x043A;
  14169. t['afii10077'] = 0x043B;
  14170. t['afii10078'] = 0x043C;
  14171. t['afii10079'] = 0x043D;
  14172. t['afii10080'] = 0x043E;
  14173. t['afii10081'] = 0x043F;
  14174. t['afii10082'] = 0x0440;
  14175. t['afii10083'] = 0x0441;
  14176. t['afii10084'] = 0x0442;
  14177. t['afii10085'] = 0x0443;
  14178. t['afii10086'] = 0x0444;
  14179. t['afii10087'] = 0x0445;
  14180. t['afii10088'] = 0x0446;
  14181. t['afii10089'] = 0x0447;
  14182. t['afii10090'] = 0x0448;
  14183. t['afii10091'] = 0x0449;
  14184. t['afii10092'] = 0x044A;
  14185. t['afii10093'] = 0x044B;
  14186. t['afii10094'] = 0x044C;
  14187. t['afii10095'] = 0x044D;
  14188. t['afii10096'] = 0x044E;
  14189. t['afii10097'] = 0x044F;
  14190. t['afii10098'] = 0x0491;
  14191. t['afii10099'] = 0x0452;
  14192. t['afii10100'] = 0x0453;
  14193. t['afii10101'] = 0x0454;
  14194. t['afii10102'] = 0x0455;
  14195. t['afii10103'] = 0x0456;
  14196. t['afii10104'] = 0x0457;
  14197. t['afii10105'] = 0x0458;
  14198. t['afii10106'] = 0x0459;
  14199. t['afii10107'] = 0x045A;
  14200. t['afii10108'] = 0x045B;
  14201. t['afii10109'] = 0x045C;
  14202. t['afii10110'] = 0x045E;
  14203. t['afii10145'] = 0x040F;
  14204. t['afii10146'] = 0x0462;
  14205. t['afii10147'] = 0x0472;
  14206. t['afii10148'] = 0x0474;
  14207. t['afii10192'] = 0xF6C6;
  14208. t['afii10193'] = 0x045F;
  14209. t['afii10194'] = 0x0463;
  14210. t['afii10195'] = 0x0473;
  14211. t['afii10196'] = 0x0475;
  14212. t['afii10831'] = 0xF6C7;
  14213. t['afii10832'] = 0xF6C8;
  14214. t['afii10846'] = 0x04D9;
  14215. t['afii299'] = 0x200E;
  14216. t['afii300'] = 0x200F;
  14217. t['afii301'] = 0x200D;
  14218. t['afii57381'] = 0x066A;
  14219. t['afii57388'] = 0x060C;
  14220. t['afii57392'] = 0x0660;
  14221. t['afii57393'] = 0x0661;
  14222. t['afii57394'] = 0x0662;
  14223. t['afii57395'] = 0x0663;
  14224. t['afii57396'] = 0x0664;
  14225. t['afii57397'] = 0x0665;
  14226. t['afii57398'] = 0x0666;
  14227. t['afii57399'] = 0x0667;
  14228. t['afii57400'] = 0x0668;
  14229. t['afii57401'] = 0x0669;
  14230. t['afii57403'] = 0x061B;
  14231. t['afii57407'] = 0x061F;
  14232. t['afii57409'] = 0x0621;
  14233. t['afii57410'] = 0x0622;
  14234. t['afii57411'] = 0x0623;
  14235. t['afii57412'] = 0x0624;
  14236. t['afii57413'] = 0x0625;
  14237. t['afii57414'] = 0x0626;
  14238. t['afii57415'] = 0x0627;
  14239. t['afii57416'] = 0x0628;
  14240. t['afii57417'] = 0x0629;
  14241. t['afii57418'] = 0x062A;
  14242. t['afii57419'] = 0x062B;
  14243. t['afii57420'] = 0x062C;
  14244. t['afii57421'] = 0x062D;
  14245. t['afii57422'] = 0x062E;
  14246. t['afii57423'] = 0x062F;
  14247. t['afii57424'] = 0x0630;
  14248. t['afii57425'] = 0x0631;
  14249. t['afii57426'] = 0x0632;
  14250. t['afii57427'] = 0x0633;
  14251. t['afii57428'] = 0x0634;
  14252. t['afii57429'] = 0x0635;
  14253. t['afii57430'] = 0x0636;
  14254. t['afii57431'] = 0x0637;
  14255. t['afii57432'] = 0x0638;
  14256. t['afii57433'] = 0x0639;
  14257. t['afii57434'] = 0x063A;
  14258. t['afii57440'] = 0x0640;
  14259. t['afii57441'] = 0x0641;
  14260. t['afii57442'] = 0x0642;
  14261. t['afii57443'] = 0x0643;
  14262. t['afii57444'] = 0x0644;
  14263. t['afii57445'] = 0x0645;
  14264. t['afii57446'] = 0x0646;
  14265. t['afii57448'] = 0x0648;
  14266. t['afii57449'] = 0x0649;
  14267. t['afii57450'] = 0x064A;
  14268. t['afii57451'] = 0x064B;
  14269. t['afii57452'] = 0x064C;
  14270. t['afii57453'] = 0x064D;
  14271. t['afii57454'] = 0x064E;
  14272. t['afii57455'] = 0x064F;
  14273. t['afii57456'] = 0x0650;
  14274. t['afii57457'] = 0x0651;
  14275. t['afii57458'] = 0x0652;
  14276. t['afii57470'] = 0x0647;
  14277. t['afii57505'] = 0x06A4;
  14278. t['afii57506'] = 0x067E;
  14279. t['afii57507'] = 0x0686;
  14280. t['afii57508'] = 0x0698;
  14281. t['afii57509'] = 0x06AF;
  14282. t['afii57511'] = 0x0679;
  14283. t['afii57512'] = 0x0688;
  14284. t['afii57513'] = 0x0691;
  14285. t['afii57514'] = 0x06BA;
  14286. t['afii57519'] = 0x06D2;
  14287. t['afii57534'] = 0x06D5;
  14288. t['afii57636'] = 0x20AA;
  14289. t['afii57645'] = 0x05BE;
  14290. t['afii57658'] = 0x05C3;
  14291. t['afii57664'] = 0x05D0;
  14292. t['afii57665'] = 0x05D1;
  14293. t['afii57666'] = 0x05D2;
  14294. t['afii57667'] = 0x05D3;
  14295. t['afii57668'] = 0x05D4;
  14296. t['afii57669'] = 0x05D5;
  14297. t['afii57670'] = 0x05D6;
  14298. t['afii57671'] = 0x05D7;
  14299. t['afii57672'] = 0x05D8;
  14300. t['afii57673'] = 0x05D9;
  14301. t['afii57674'] = 0x05DA;
  14302. t['afii57675'] = 0x05DB;
  14303. t['afii57676'] = 0x05DC;
  14304. t['afii57677'] = 0x05DD;
  14305. t['afii57678'] = 0x05DE;
  14306. t['afii57679'] = 0x05DF;
  14307. t['afii57680'] = 0x05E0;
  14308. t['afii57681'] = 0x05E1;
  14309. t['afii57682'] = 0x05E2;
  14310. t['afii57683'] = 0x05E3;
  14311. t['afii57684'] = 0x05E4;
  14312. t['afii57685'] = 0x05E5;
  14313. t['afii57686'] = 0x05E6;
  14314. t['afii57687'] = 0x05E7;
  14315. t['afii57688'] = 0x05E8;
  14316. t['afii57689'] = 0x05E9;
  14317. t['afii57690'] = 0x05EA;
  14318. t['afii57694'] = 0xFB2A;
  14319. t['afii57695'] = 0xFB2B;
  14320. t['afii57700'] = 0xFB4B;
  14321. t['afii57705'] = 0xFB1F;
  14322. t['afii57716'] = 0x05F0;
  14323. t['afii57717'] = 0x05F1;
  14324. t['afii57718'] = 0x05F2;
  14325. t['afii57723'] = 0xFB35;
  14326. t['afii57793'] = 0x05B4;
  14327. t['afii57794'] = 0x05B5;
  14328. t['afii57795'] = 0x05B6;
  14329. t['afii57796'] = 0x05BB;
  14330. t['afii57797'] = 0x05B8;
  14331. t['afii57798'] = 0x05B7;
  14332. t['afii57799'] = 0x05B0;
  14333. t['afii57800'] = 0x05B2;
  14334. t['afii57801'] = 0x05B1;
  14335. t['afii57802'] = 0x05B3;
  14336. t['afii57803'] = 0x05C2;
  14337. t['afii57804'] = 0x05C1;
  14338. t['afii57806'] = 0x05B9;
  14339. t['afii57807'] = 0x05BC;
  14340. t['afii57839'] = 0x05BD;
  14341. t['afii57841'] = 0x05BF;
  14342. t['afii57842'] = 0x05C0;
  14343. t['afii57929'] = 0x02BC;
  14344. t['afii61248'] = 0x2105;
  14345. t['afii61289'] = 0x2113;
  14346. t['afii61352'] = 0x2116;
  14347. t['afii61573'] = 0x202C;
  14348. t['afii61574'] = 0x202D;
  14349. t['afii61575'] = 0x202E;
  14350. t['afii61664'] = 0x200C;
  14351. t['afii63167'] = 0x066D;
  14352. t['afii64937'] = 0x02BD;
  14353. t['agrave'] = 0x00E0;
  14354. t['agujarati'] = 0x0A85;
  14355. t['agurmukhi'] = 0x0A05;
  14356. t['ahiragana'] = 0x3042;
  14357. t['ahookabove'] = 0x1EA3;
  14358. t['aibengali'] = 0x0990;
  14359. t['aibopomofo'] = 0x311E;
  14360. t['aideva'] = 0x0910;
  14361. t['aiecyrillic'] = 0x04D5;
  14362. t['aigujarati'] = 0x0A90;
  14363. t['aigurmukhi'] = 0x0A10;
  14364. t['aimatragurmukhi'] = 0x0A48;
  14365. t['ainarabic'] = 0x0639;
  14366. t['ainfinalarabic'] = 0xFECA;
  14367. t['aininitialarabic'] = 0xFECB;
  14368. t['ainmedialarabic'] = 0xFECC;
  14369. t['ainvertedbreve'] = 0x0203;
  14370. t['aivowelsignbengali'] = 0x09C8;
  14371. t['aivowelsigndeva'] = 0x0948;
  14372. t['aivowelsigngujarati'] = 0x0AC8;
  14373. t['akatakana'] = 0x30A2;
  14374. t['akatakanahalfwidth'] = 0xFF71;
  14375. t['akorean'] = 0x314F;
  14376. t['alef'] = 0x05D0;
  14377. t['alefarabic'] = 0x0627;
  14378. t['alefdageshhebrew'] = 0xFB30;
  14379. t['aleffinalarabic'] = 0xFE8E;
  14380. t['alefhamzaabovearabic'] = 0x0623;
  14381. t['alefhamzaabovefinalarabic'] = 0xFE84;
  14382. t['alefhamzabelowarabic'] = 0x0625;
  14383. t['alefhamzabelowfinalarabic'] = 0xFE88;
  14384. t['alefhebrew'] = 0x05D0;
  14385. t['aleflamedhebrew'] = 0xFB4F;
  14386. t['alefmaddaabovearabic'] = 0x0622;
  14387. t['alefmaddaabovefinalarabic'] = 0xFE82;
  14388. t['alefmaksuraarabic'] = 0x0649;
  14389. t['alefmaksurafinalarabic'] = 0xFEF0;
  14390. t['alefmaksurainitialarabic'] = 0xFEF3;
  14391. t['alefmaksuramedialarabic'] = 0xFEF4;
  14392. t['alefpatahhebrew'] = 0xFB2E;
  14393. t['alefqamatshebrew'] = 0xFB2F;
  14394. t['aleph'] = 0x2135;
  14395. t['allequal'] = 0x224C;
  14396. t['alpha'] = 0x03B1;
  14397. t['alphatonos'] = 0x03AC;
  14398. t['amacron'] = 0x0101;
  14399. t['amonospace'] = 0xFF41;
  14400. t['ampersand'] = 0x0026;
  14401. t['ampersandmonospace'] = 0xFF06;
  14402. t['ampersandsmall'] = 0xF726;
  14403. t['amsquare'] = 0x33C2;
  14404. t['anbopomofo'] = 0x3122;
  14405. t['angbopomofo'] = 0x3124;
  14406. t['angbracketleft'] = 0x3008;
  14407. t['angbracketright'] = 0x3009;
  14408. t['angkhankhuthai'] = 0x0E5A;
  14409. t['angle'] = 0x2220;
  14410. t['anglebracketleft'] = 0x3008;
  14411. t['anglebracketleftvertical'] = 0xFE3F;
  14412. t['anglebracketright'] = 0x3009;
  14413. t['anglebracketrightvertical'] = 0xFE40;
  14414. t['angleleft'] = 0x2329;
  14415. t['angleright'] = 0x232A;
  14416. t['angstrom'] = 0x212B;
  14417. t['anoteleia'] = 0x0387;
  14418. t['anudattadeva'] = 0x0952;
  14419. t['anusvarabengali'] = 0x0982;
  14420. t['anusvaradeva'] = 0x0902;
  14421. t['anusvaragujarati'] = 0x0A82;
  14422. t['aogonek'] = 0x0105;
  14423. t['apaatosquare'] = 0x3300;
  14424. t['aparen'] = 0x249C;
  14425. t['apostrophearmenian'] = 0x055A;
  14426. t['apostrophemod'] = 0x02BC;
  14427. t['apple'] = 0xF8FF;
  14428. t['approaches'] = 0x2250;
  14429. t['approxequal'] = 0x2248;
  14430. t['approxequalorimage'] = 0x2252;
  14431. t['approximatelyequal'] = 0x2245;
  14432. t['araeaekorean'] = 0x318E;
  14433. t['araeakorean'] = 0x318D;
  14434. t['arc'] = 0x2312;
  14435. t['arighthalfring'] = 0x1E9A;
  14436. t['aring'] = 0x00E5;
  14437. t['aringacute'] = 0x01FB;
  14438. t['aringbelow'] = 0x1E01;
  14439. t['arrowboth'] = 0x2194;
  14440. t['arrowdashdown'] = 0x21E3;
  14441. t['arrowdashleft'] = 0x21E0;
  14442. t['arrowdashright'] = 0x21E2;
  14443. t['arrowdashup'] = 0x21E1;
  14444. t['arrowdblboth'] = 0x21D4;
  14445. t['arrowdbldown'] = 0x21D3;
  14446. t['arrowdblleft'] = 0x21D0;
  14447. t['arrowdblright'] = 0x21D2;
  14448. t['arrowdblup'] = 0x21D1;
  14449. t['arrowdown'] = 0x2193;
  14450. t['arrowdownleft'] = 0x2199;
  14451. t['arrowdownright'] = 0x2198;
  14452. t['arrowdownwhite'] = 0x21E9;
  14453. t['arrowheaddownmod'] = 0x02C5;
  14454. t['arrowheadleftmod'] = 0x02C2;
  14455. t['arrowheadrightmod'] = 0x02C3;
  14456. t['arrowheadupmod'] = 0x02C4;
  14457. t['arrowhorizex'] = 0xF8E7;
  14458. t['arrowleft'] = 0x2190;
  14459. t['arrowleftdbl'] = 0x21D0;
  14460. t['arrowleftdblstroke'] = 0x21CD;
  14461. t['arrowleftoverright'] = 0x21C6;
  14462. t['arrowleftwhite'] = 0x21E6;
  14463. t['arrowright'] = 0x2192;
  14464. t['arrowrightdblstroke'] = 0x21CF;
  14465. t['arrowrightheavy'] = 0x279E;
  14466. t['arrowrightoverleft'] = 0x21C4;
  14467. t['arrowrightwhite'] = 0x21E8;
  14468. t['arrowtableft'] = 0x21E4;
  14469. t['arrowtabright'] = 0x21E5;
  14470. t['arrowup'] = 0x2191;
  14471. t['arrowupdn'] = 0x2195;
  14472. t['arrowupdnbse'] = 0x21A8;
  14473. t['arrowupdownbase'] = 0x21A8;
  14474. t['arrowupleft'] = 0x2196;
  14475. t['arrowupleftofdown'] = 0x21C5;
  14476. t['arrowupright'] = 0x2197;
  14477. t['arrowupwhite'] = 0x21E7;
  14478. t['arrowvertex'] = 0xF8E6;
  14479. t['asciicircum'] = 0x005E;
  14480. t['asciicircummonospace'] = 0xFF3E;
  14481. t['asciitilde'] = 0x007E;
  14482. t['asciitildemonospace'] = 0xFF5E;
  14483. t['ascript'] = 0x0251;
  14484. t['ascriptturned'] = 0x0252;
  14485. t['asmallhiragana'] = 0x3041;
  14486. t['asmallkatakana'] = 0x30A1;
  14487. t['asmallkatakanahalfwidth'] = 0xFF67;
  14488. t['asterisk'] = 0x002A;
  14489. t['asteriskaltonearabic'] = 0x066D;
  14490. t['asteriskarabic'] = 0x066D;
  14491. t['asteriskmath'] = 0x2217;
  14492. t['asteriskmonospace'] = 0xFF0A;
  14493. t['asterisksmall'] = 0xFE61;
  14494. t['asterism'] = 0x2042;
  14495. t['asuperior'] = 0xF6E9;
  14496. t['asymptoticallyequal'] = 0x2243;
  14497. t['at'] = 0x0040;
  14498. t['atilde'] = 0x00E3;
  14499. t['atmonospace'] = 0xFF20;
  14500. t['atsmall'] = 0xFE6B;
  14501. t['aturned'] = 0x0250;
  14502. t['aubengali'] = 0x0994;
  14503. t['aubopomofo'] = 0x3120;
  14504. t['audeva'] = 0x0914;
  14505. t['augujarati'] = 0x0A94;
  14506. t['augurmukhi'] = 0x0A14;
  14507. t['aulengthmarkbengali'] = 0x09D7;
  14508. t['aumatragurmukhi'] = 0x0A4C;
  14509. t['auvowelsignbengali'] = 0x09CC;
  14510. t['auvowelsigndeva'] = 0x094C;
  14511. t['auvowelsigngujarati'] = 0x0ACC;
  14512. t['avagrahadeva'] = 0x093D;
  14513. t['aybarmenian'] = 0x0561;
  14514. t['ayin'] = 0x05E2;
  14515. t['ayinaltonehebrew'] = 0xFB20;
  14516. t['ayinhebrew'] = 0x05E2;
  14517. t['b'] = 0x0062;
  14518. t['babengali'] = 0x09AC;
  14519. t['backslash'] = 0x005C;
  14520. t['backslashmonospace'] = 0xFF3C;
  14521. t['badeva'] = 0x092C;
  14522. t['bagujarati'] = 0x0AAC;
  14523. t['bagurmukhi'] = 0x0A2C;
  14524. t['bahiragana'] = 0x3070;
  14525. t['bahtthai'] = 0x0E3F;
  14526. t['bakatakana'] = 0x30D0;
  14527. t['bar'] = 0x007C;
  14528. t['barmonospace'] = 0xFF5C;
  14529. t['bbopomofo'] = 0x3105;
  14530. t['bcircle'] = 0x24D1;
  14531. t['bdotaccent'] = 0x1E03;
  14532. t['bdotbelow'] = 0x1E05;
  14533. t['beamedsixteenthnotes'] = 0x266C;
  14534. t['because'] = 0x2235;
  14535. t['becyrillic'] = 0x0431;
  14536. t['beharabic'] = 0x0628;
  14537. t['behfinalarabic'] = 0xFE90;
  14538. t['behinitialarabic'] = 0xFE91;
  14539. t['behiragana'] = 0x3079;
  14540. t['behmedialarabic'] = 0xFE92;
  14541. t['behmeeminitialarabic'] = 0xFC9F;
  14542. t['behmeemisolatedarabic'] = 0xFC08;
  14543. t['behnoonfinalarabic'] = 0xFC6D;
  14544. t['bekatakana'] = 0x30D9;
  14545. t['benarmenian'] = 0x0562;
  14546. t['bet'] = 0x05D1;
  14547. t['beta'] = 0x03B2;
  14548. t['betasymbolgreek'] = 0x03D0;
  14549. t['betdagesh'] = 0xFB31;
  14550. t['betdageshhebrew'] = 0xFB31;
  14551. t['bethebrew'] = 0x05D1;
  14552. t['betrafehebrew'] = 0xFB4C;
  14553. t['bhabengali'] = 0x09AD;
  14554. t['bhadeva'] = 0x092D;
  14555. t['bhagujarati'] = 0x0AAD;
  14556. t['bhagurmukhi'] = 0x0A2D;
  14557. t['bhook'] = 0x0253;
  14558. t['bihiragana'] = 0x3073;
  14559. t['bikatakana'] = 0x30D3;
  14560. t['bilabialclick'] = 0x0298;
  14561. t['bindigurmukhi'] = 0x0A02;
  14562. t['birusquare'] = 0x3331;
  14563. t['blackcircle'] = 0x25CF;
  14564. t['blackdiamond'] = 0x25C6;
  14565. t['blackdownpointingtriangle'] = 0x25BC;
  14566. t['blackleftpointingpointer'] = 0x25C4;
  14567. t['blackleftpointingtriangle'] = 0x25C0;
  14568. t['blacklenticularbracketleft'] = 0x3010;
  14569. t['blacklenticularbracketleftvertical'] = 0xFE3B;
  14570. t['blacklenticularbracketright'] = 0x3011;
  14571. t['blacklenticularbracketrightvertical'] = 0xFE3C;
  14572. t['blacklowerlefttriangle'] = 0x25E3;
  14573. t['blacklowerrighttriangle'] = 0x25E2;
  14574. t['blackrectangle'] = 0x25AC;
  14575. t['blackrightpointingpointer'] = 0x25BA;
  14576. t['blackrightpointingtriangle'] = 0x25B6;
  14577. t['blacksmallsquare'] = 0x25AA;
  14578. t['blacksmilingface'] = 0x263B;
  14579. t['blacksquare'] = 0x25A0;
  14580. t['blackstar'] = 0x2605;
  14581. t['blackupperlefttriangle'] = 0x25E4;
  14582. t['blackupperrighttriangle'] = 0x25E5;
  14583. t['blackuppointingsmalltriangle'] = 0x25B4;
  14584. t['blackuppointingtriangle'] = 0x25B2;
  14585. t['blank'] = 0x2423;
  14586. t['blinebelow'] = 0x1E07;
  14587. t['block'] = 0x2588;
  14588. t['bmonospace'] = 0xFF42;
  14589. t['bobaimaithai'] = 0x0E1A;
  14590. t['bohiragana'] = 0x307C;
  14591. t['bokatakana'] = 0x30DC;
  14592. t['bparen'] = 0x249D;
  14593. t['bqsquare'] = 0x33C3;
  14594. t['braceex'] = 0xF8F4;
  14595. t['braceleft'] = 0x007B;
  14596. t['braceleftbt'] = 0xF8F3;
  14597. t['braceleftmid'] = 0xF8F2;
  14598. t['braceleftmonospace'] = 0xFF5B;
  14599. t['braceleftsmall'] = 0xFE5B;
  14600. t['bracelefttp'] = 0xF8F1;
  14601. t['braceleftvertical'] = 0xFE37;
  14602. t['braceright'] = 0x007D;
  14603. t['bracerightbt'] = 0xF8FE;
  14604. t['bracerightmid'] = 0xF8FD;
  14605. t['bracerightmonospace'] = 0xFF5D;
  14606. t['bracerightsmall'] = 0xFE5C;
  14607. t['bracerighttp'] = 0xF8FC;
  14608. t['bracerightvertical'] = 0xFE38;
  14609. t['bracketleft'] = 0x005B;
  14610. t['bracketleftbt'] = 0xF8F0;
  14611. t['bracketleftex'] = 0xF8EF;
  14612. t['bracketleftmonospace'] = 0xFF3B;
  14613. t['bracketlefttp'] = 0xF8EE;
  14614. t['bracketright'] = 0x005D;
  14615. t['bracketrightbt'] = 0xF8FB;
  14616. t['bracketrightex'] = 0xF8FA;
  14617. t['bracketrightmonospace'] = 0xFF3D;
  14618. t['bracketrighttp'] = 0xF8F9;
  14619. t['breve'] = 0x02D8;
  14620. t['brevebelowcmb'] = 0x032E;
  14621. t['brevecmb'] = 0x0306;
  14622. t['breveinvertedbelowcmb'] = 0x032F;
  14623. t['breveinvertedcmb'] = 0x0311;
  14624. t['breveinverteddoublecmb'] = 0x0361;
  14625. t['bridgebelowcmb'] = 0x032A;
  14626. t['bridgeinvertedbelowcmb'] = 0x033A;
  14627. t['brokenbar'] = 0x00A6;
  14628. t['bstroke'] = 0x0180;
  14629. t['bsuperior'] = 0xF6EA;
  14630. t['btopbar'] = 0x0183;
  14631. t['buhiragana'] = 0x3076;
  14632. t['bukatakana'] = 0x30D6;
  14633. t['bullet'] = 0x2022;
  14634. t['bulletinverse'] = 0x25D8;
  14635. t['bulletoperator'] = 0x2219;
  14636. t['bullseye'] = 0x25CE;
  14637. t['c'] = 0x0063;
  14638. t['caarmenian'] = 0x056E;
  14639. t['cabengali'] = 0x099A;
  14640. t['cacute'] = 0x0107;
  14641. t['cadeva'] = 0x091A;
  14642. t['cagujarati'] = 0x0A9A;
  14643. t['cagurmukhi'] = 0x0A1A;
  14644. t['calsquare'] = 0x3388;
  14645. t['candrabindubengali'] = 0x0981;
  14646. t['candrabinducmb'] = 0x0310;
  14647. t['candrabindudeva'] = 0x0901;
  14648. t['candrabindugujarati'] = 0x0A81;
  14649. t['capslock'] = 0x21EA;
  14650. t['careof'] = 0x2105;
  14651. t['caron'] = 0x02C7;
  14652. t['caronbelowcmb'] = 0x032C;
  14653. t['caroncmb'] = 0x030C;
  14654. t['carriagereturn'] = 0x21B5;
  14655. t['cbopomofo'] = 0x3118;
  14656. t['ccaron'] = 0x010D;
  14657. t['ccedilla'] = 0x00E7;
  14658. t['ccedillaacute'] = 0x1E09;
  14659. t['ccircle'] = 0x24D2;
  14660. t['ccircumflex'] = 0x0109;
  14661. t['ccurl'] = 0x0255;
  14662. t['cdot'] = 0x010B;
  14663. t['cdotaccent'] = 0x010B;
  14664. t['cdsquare'] = 0x33C5;
  14665. t['cedilla'] = 0x00B8;
  14666. t['cedillacmb'] = 0x0327;
  14667. t['cent'] = 0x00A2;
  14668. t['centigrade'] = 0x2103;
  14669. t['centinferior'] = 0xF6DF;
  14670. t['centmonospace'] = 0xFFE0;
  14671. t['centoldstyle'] = 0xF7A2;
  14672. t['centsuperior'] = 0xF6E0;
  14673. t['chaarmenian'] = 0x0579;
  14674. t['chabengali'] = 0x099B;
  14675. t['chadeva'] = 0x091B;
  14676. t['chagujarati'] = 0x0A9B;
  14677. t['chagurmukhi'] = 0x0A1B;
  14678. t['chbopomofo'] = 0x3114;
  14679. t['cheabkhasiancyrillic'] = 0x04BD;
  14680. t['checkmark'] = 0x2713;
  14681. t['checyrillic'] = 0x0447;
  14682. t['chedescenderabkhasiancyrillic'] = 0x04BF;
  14683. t['chedescendercyrillic'] = 0x04B7;
  14684. t['chedieresiscyrillic'] = 0x04F5;
  14685. t['cheharmenian'] = 0x0573;
  14686. t['chekhakassiancyrillic'] = 0x04CC;
  14687. t['cheverticalstrokecyrillic'] = 0x04B9;
  14688. t['chi'] = 0x03C7;
  14689. t['chieuchacirclekorean'] = 0x3277;
  14690. t['chieuchaparenkorean'] = 0x3217;
  14691. t['chieuchcirclekorean'] = 0x3269;
  14692. t['chieuchkorean'] = 0x314A;
  14693. t['chieuchparenkorean'] = 0x3209;
  14694. t['chochangthai'] = 0x0E0A;
  14695. t['chochanthai'] = 0x0E08;
  14696. t['chochingthai'] = 0x0E09;
  14697. t['chochoethai'] = 0x0E0C;
  14698. t['chook'] = 0x0188;
  14699. t['cieucacirclekorean'] = 0x3276;
  14700. t['cieucaparenkorean'] = 0x3216;
  14701. t['cieuccirclekorean'] = 0x3268;
  14702. t['cieuckorean'] = 0x3148;
  14703. t['cieucparenkorean'] = 0x3208;
  14704. t['cieucuparenkorean'] = 0x321C;
  14705. t['circle'] = 0x25CB;
  14706. t['circlecopyrt'] = 0x00A9;
  14707. t['circlemultiply'] = 0x2297;
  14708. t['circleot'] = 0x2299;
  14709. t['circleplus'] = 0x2295;
  14710. t['circlepostalmark'] = 0x3036;
  14711. t['circlewithlefthalfblack'] = 0x25D0;
  14712. t['circlewithrighthalfblack'] = 0x25D1;
  14713. t['circumflex'] = 0x02C6;
  14714. t['circumflexbelowcmb'] = 0x032D;
  14715. t['circumflexcmb'] = 0x0302;
  14716. t['clear'] = 0x2327;
  14717. t['clickalveolar'] = 0x01C2;
  14718. t['clickdental'] = 0x01C0;
  14719. t['clicklateral'] = 0x01C1;
  14720. t['clickretroflex'] = 0x01C3;
  14721. t['club'] = 0x2663;
  14722. t['clubsuitblack'] = 0x2663;
  14723. t['clubsuitwhite'] = 0x2667;
  14724. t['cmcubedsquare'] = 0x33A4;
  14725. t['cmonospace'] = 0xFF43;
  14726. t['cmsquaredsquare'] = 0x33A0;
  14727. t['coarmenian'] = 0x0581;
  14728. t['colon'] = 0x003A;
  14729. t['colonmonetary'] = 0x20A1;
  14730. t['colonmonospace'] = 0xFF1A;
  14731. t['colonsign'] = 0x20A1;
  14732. t['colonsmall'] = 0xFE55;
  14733. t['colontriangularhalfmod'] = 0x02D1;
  14734. t['colontriangularmod'] = 0x02D0;
  14735. t['comma'] = 0x002C;
  14736. t['commaabovecmb'] = 0x0313;
  14737. t['commaaboverightcmb'] = 0x0315;
  14738. t['commaaccent'] = 0xF6C3;
  14739. t['commaarabic'] = 0x060C;
  14740. t['commaarmenian'] = 0x055D;
  14741. t['commainferior'] = 0xF6E1;
  14742. t['commamonospace'] = 0xFF0C;
  14743. t['commareversedabovecmb'] = 0x0314;
  14744. t['commareversedmod'] = 0x02BD;
  14745. t['commasmall'] = 0xFE50;
  14746. t['commasuperior'] = 0xF6E2;
  14747. t['commaturnedabovecmb'] = 0x0312;
  14748. t['commaturnedmod'] = 0x02BB;
  14749. t['compass'] = 0x263C;
  14750. t['congruent'] = 0x2245;
  14751. t['contourintegral'] = 0x222E;
  14752. t['control'] = 0x2303;
  14753. t['controlACK'] = 0x0006;
  14754. t['controlBEL'] = 0x0007;
  14755. t['controlBS'] = 0x0008;
  14756. t['controlCAN'] = 0x0018;
  14757. t['controlCR'] = 0x000D;
  14758. t['controlDC1'] = 0x0011;
  14759. t['controlDC2'] = 0x0012;
  14760. t['controlDC3'] = 0x0013;
  14761. t['controlDC4'] = 0x0014;
  14762. t['controlDEL'] = 0x007F;
  14763. t['controlDLE'] = 0x0010;
  14764. t['controlEM'] = 0x0019;
  14765. t['controlENQ'] = 0x0005;
  14766. t['controlEOT'] = 0x0004;
  14767. t['controlESC'] = 0x001B;
  14768. t['controlETB'] = 0x0017;
  14769. t['controlETX'] = 0x0003;
  14770. t['controlFF'] = 0x000C;
  14771. t['controlFS'] = 0x001C;
  14772. t['controlGS'] = 0x001D;
  14773. t['controlHT'] = 0x0009;
  14774. t['controlLF'] = 0x000A;
  14775. t['controlNAK'] = 0x0015;
  14776. t['controlNULL'] = 0x0000;
  14777. t['controlRS'] = 0x001E;
  14778. t['controlSI'] = 0x000F;
  14779. t['controlSO'] = 0x000E;
  14780. t['controlSOT'] = 0x0002;
  14781. t['controlSTX'] = 0x0001;
  14782. t['controlSUB'] = 0x001A;
  14783. t['controlSYN'] = 0x0016;
  14784. t['controlUS'] = 0x001F;
  14785. t['controlVT'] = 0x000B;
  14786. t['copyright'] = 0x00A9;
  14787. t['copyrightsans'] = 0xF8E9;
  14788. t['copyrightserif'] = 0xF6D9;
  14789. t['cornerbracketleft'] = 0x300C;
  14790. t['cornerbracketlefthalfwidth'] = 0xFF62;
  14791. t['cornerbracketleftvertical'] = 0xFE41;
  14792. t['cornerbracketright'] = 0x300D;
  14793. t['cornerbracketrighthalfwidth'] = 0xFF63;
  14794. t['cornerbracketrightvertical'] = 0xFE42;
  14795. t['corporationsquare'] = 0x337F;
  14796. t['cosquare'] = 0x33C7;
  14797. t['coverkgsquare'] = 0x33C6;
  14798. t['cparen'] = 0x249E;
  14799. t['cruzeiro'] = 0x20A2;
  14800. t['cstretched'] = 0x0297;
  14801. t['curlyand'] = 0x22CF;
  14802. t['curlyor'] = 0x22CE;
  14803. t['currency'] = 0x00A4;
  14804. t['cyrBreve'] = 0xF6D1;
  14805. t['cyrFlex'] = 0xF6D2;
  14806. t['cyrbreve'] = 0xF6D4;
  14807. t['cyrflex'] = 0xF6D5;
  14808. t['d'] = 0x0064;
  14809. t['daarmenian'] = 0x0564;
  14810. t['dabengali'] = 0x09A6;
  14811. t['dadarabic'] = 0x0636;
  14812. t['dadeva'] = 0x0926;
  14813. t['dadfinalarabic'] = 0xFEBE;
  14814. t['dadinitialarabic'] = 0xFEBF;
  14815. t['dadmedialarabic'] = 0xFEC0;
  14816. t['dagesh'] = 0x05BC;
  14817. t['dageshhebrew'] = 0x05BC;
  14818. t['dagger'] = 0x2020;
  14819. t['daggerdbl'] = 0x2021;
  14820. t['dagujarati'] = 0x0AA6;
  14821. t['dagurmukhi'] = 0x0A26;
  14822. t['dahiragana'] = 0x3060;
  14823. t['dakatakana'] = 0x30C0;
  14824. t['dalarabic'] = 0x062F;
  14825. t['dalet'] = 0x05D3;
  14826. t['daletdagesh'] = 0xFB33;
  14827. t['daletdageshhebrew'] = 0xFB33;
  14828. t['dalethebrew'] = 0x05D3;
  14829. t['dalfinalarabic'] = 0xFEAA;
  14830. t['dammaarabic'] = 0x064F;
  14831. t['dammalowarabic'] = 0x064F;
  14832. t['dammatanaltonearabic'] = 0x064C;
  14833. t['dammatanarabic'] = 0x064C;
  14834. t['danda'] = 0x0964;
  14835. t['dargahebrew'] = 0x05A7;
  14836. t['dargalefthebrew'] = 0x05A7;
  14837. t['dasiapneumatacyrilliccmb'] = 0x0485;
  14838. t['dblGrave'] = 0xF6D3;
  14839. t['dblanglebracketleft'] = 0x300A;
  14840. t['dblanglebracketleftvertical'] = 0xFE3D;
  14841. t['dblanglebracketright'] = 0x300B;
  14842. t['dblanglebracketrightvertical'] = 0xFE3E;
  14843. t['dblarchinvertedbelowcmb'] = 0x032B;
  14844. t['dblarrowleft'] = 0x21D4;
  14845. t['dblarrowright'] = 0x21D2;
  14846. t['dbldanda'] = 0x0965;
  14847. t['dblgrave'] = 0xF6D6;
  14848. t['dblgravecmb'] = 0x030F;
  14849. t['dblintegral'] = 0x222C;
  14850. t['dbllowline'] = 0x2017;
  14851. t['dbllowlinecmb'] = 0x0333;
  14852. t['dbloverlinecmb'] = 0x033F;
  14853. t['dblprimemod'] = 0x02BA;
  14854. t['dblverticalbar'] = 0x2016;
  14855. t['dblverticallineabovecmb'] = 0x030E;
  14856. t['dbopomofo'] = 0x3109;
  14857. t['dbsquare'] = 0x33C8;
  14858. t['dcaron'] = 0x010F;
  14859. t['dcedilla'] = 0x1E11;
  14860. t['dcircle'] = 0x24D3;
  14861. t['dcircumflexbelow'] = 0x1E13;
  14862. t['dcroat'] = 0x0111;
  14863. t['ddabengali'] = 0x09A1;
  14864. t['ddadeva'] = 0x0921;
  14865. t['ddagujarati'] = 0x0AA1;
  14866. t['ddagurmukhi'] = 0x0A21;
  14867. t['ddalarabic'] = 0x0688;
  14868. t['ddalfinalarabic'] = 0xFB89;
  14869. t['dddhadeva'] = 0x095C;
  14870. t['ddhabengali'] = 0x09A2;
  14871. t['ddhadeva'] = 0x0922;
  14872. t['ddhagujarati'] = 0x0AA2;
  14873. t['ddhagurmukhi'] = 0x0A22;
  14874. t['ddotaccent'] = 0x1E0B;
  14875. t['ddotbelow'] = 0x1E0D;
  14876. t['decimalseparatorarabic'] = 0x066B;
  14877. t['decimalseparatorpersian'] = 0x066B;
  14878. t['decyrillic'] = 0x0434;
  14879. t['degree'] = 0x00B0;
  14880. t['dehihebrew'] = 0x05AD;
  14881. t['dehiragana'] = 0x3067;
  14882. t['deicoptic'] = 0x03EF;
  14883. t['dekatakana'] = 0x30C7;
  14884. t['deleteleft'] = 0x232B;
  14885. t['deleteright'] = 0x2326;
  14886. t['delta'] = 0x03B4;
  14887. t['deltaturned'] = 0x018D;
  14888. t['denominatorminusonenumeratorbengali'] = 0x09F8;
  14889. t['dezh'] = 0x02A4;
  14890. t['dhabengali'] = 0x09A7;
  14891. t['dhadeva'] = 0x0927;
  14892. t['dhagujarati'] = 0x0AA7;
  14893. t['dhagurmukhi'] = 0x0A27;
  14894. t['dhook'] = 0x0257;
  14895. t['dialytikatonos'] = 0x0385;
  14896. t['dialytikatonoscmb'] = 0x0344;
  14897. t['diamond'] = 0x2666;
  14898. t['diamondsuitwhite'] = 0x2662;
  14899. t['dieresis'] = 0x00A8;
  14900. t['dieresisacute'] = 0xF6D7;
  14901. t['dieresisbelowcmb'] = 0x0324;
  14902. t['dieresiscmb'] = 0x0308;
  14903. t['dieresisgrave'] = 0xF6D8;
  14904. t['dieresistonos'] = 0x0385;
  14905. t['dihiragana'] = 0x3062;
  14906. t['dikatakana'] = 0x30C2;
  14907. t['dittomark'] = 0x3003;
  14908. t['divide'] = 0x00F7;
  14909. t['divides'] = 0x2223;
  14910. t['divisionslash'] = 0x2215;
  14911. t['djecyrillic'] = 0x0452;
  14912. t['dkshade'] = 0x2593;
  14913. t['dlinebelow'] = 0x1E0F;
  14914. t['dlsquare'] = 0x3397;
  14915. t['dmacron'] = 0x0111;
  14916. t['dmonospace'] = 0xFF44;
  14917. t['dnblock'] = 0x2584;
  14918. t['dochadathai'] = 0x0E0E;
  14919. t['dodekthai'] = 0x0E14;
  14920. t['dohiragana'] = 0x3069;
  14921. t['dokatakana'] = 0x30C9;
  14922. t['dollar'] = 0x0024;
  14923. t['dollarinferior'] = 0xF6E3;
  14924. t['dollarmonospace'] = 0xFF04;
  14925. t['dollaroldstyle'] = 0xF724;
  14926. t['dollarsmall'] = 0xFE69;
  14927. t['dollarsuperior'] = 0xF6E4;
  14928. t['dong'] = 0x20AB;
  14929. t['dorusquare'] = 0x3326;
  14930. t['dotaccent'] = 0x02D9;
  14931. t['dotaccentcmb'] = 0x0307;
  14932. t['dotbelowcmb'] = 0x0323;
  14933. t['dotbelowcomb'] = 0x0323;
  14934. t['dotkatakana'] = 0x30FB;
  14935. t['dotlessi'] = 0x0131;
  14936. t['dotlessj'] = 0xF6BE;
  14937. t['dotlessjstrokehook'] = 0x0284;
  14938. t['dotmath'] = 0x22C5;
  14939. t['dottedcircle'] = 0x25CC;
  14940. t['doubleyodpatah'] = 0xFB1F;
  14941. t['doubleyodpatahhebrew'] = 0xFB1F;
  14942. t['downtackbelowcmb'] = 0x031E;
  14943. t['downtackmod'] = 0x02D5;
  14944. t['dparen'] = 0x249F;
  14945. t['dsuperior'] = 0xF6EB;
  14946. t['dtail'] = 0x0256;
  14947. t['dtopbar'] = 0x018C;
  14948. t['duhiragana'] = 0x3065;
  14949. t['dukatakana'] = 0x30C5;
  14950. t['dz'] = 0x01F3;
  14951. t['dzaltone'] = 0x02A3;
  14952. t['dzcaron'] = 0x01C6;
  14953. t['dzcurl'] = 0x02A5;
  14954. t['dzeabkhasiancyrillic'] = 0x04E1;
  14955. t['dzecyrillic'] = 0x0455;
  14956. t['dzhecyrillic'] = 0x045F;
  14957. t['e'] = 0x0065;
  14958. t['eacute'] = 0x00E9;
  14959. t['earth'] = 0x2641;
  14960. t['ebengali'] = 0x098F;
  14961. t['ebopomofo'] = 0x311C;
  14962. t['ebreve'] = 0x0115;
  14963. t['ecandradeva'] = 0x090D;
  14964. t['ecandragujarati'] = 0x0A8D;
  14965. t['ecandravowelsigndeva'] = 0x0945;
  14966. t['ecandravowelsigngujarati'] = 0x0AC5;
  14967. t['ecaron'] = 0x011B;
  14968. t['ecedillabreve'] = 0x1E1D;
  14969. t['echarmenian'] = 0x0565;
  14970. t['echyiwnarmenian'] = 0x0587;
  14971. t['ecircle'] = 0x24D4;
  14972. t['ecircumflex'] = 0x00EA;
  14973. t['ecircumflexacute'] = 0x1EBF;
  14974. t['ecircumflexbelow'] = 0x1E19;
  14975. t['ecircumflexdotbelow'] = 0x1EC7;
  14976. t['ecircumflexgrave'] = 0x1EC1;
  14977. t['ecircumflexhookabove'] = 0x1EC3;
  14978. t['ecircumflextilde'] = 0x1EC5;
  14979. t['ecyrillic'] = 0x0454;
  14980. t['edblgrave'] = 0x0205;
  14981. t['edeva'] = 0x090F;
  14982. t['edieresis'] = 0x00EB;
  14983. t['edot'] = 0x0117;
  14984. t['edotaccent'] = 0x0117;
  14985. t['edotbelow'] = 0x1EB9;
  14986. t['eegurmukhi'] = 0x0A0F;
  14987. t['eematragurmukhi'] = 0x0A47;
  14988. t['efcyrillic'] = 0x0444;
  14989. t['egrave'] = 0x00E8;
  14990. t['egujarati'] = 0x0A8F;
  14991. t['eharmenian'] = 0x0567;
  14992. t['ehbopomofo'] = 0x311D;
  14993. t['ehiragana'] = 0x3048;
  14994. t['ehookabove'] = 0x1EBB;
  14995. t['eibopomofo'] = 0x311F;
  14996. t['eight'] = 0x0038;
  14997. t['eightarabic'] = 0x0668;
  14998. t['eightbengali'] = 0x09EE;
  14999. t['eightcircle'] = 0x2467;
  15000. t['eightcircleinversesansserif'] = 0x2791;
  15001. t['eightdeva'] = 0x096E;
  15002. t['eighteencircle'] = 0x2471;
  15003. t['eighteenparen'] = 0x2485;
  15004. t['eighteenperiod'] = 0x2499;
  15005. t['eightgujarati'] = 0x0AEE;
  15006. t['eightgurmukhi'] = 0x0A6E;
  15007. t['eighthackarabic'] = 0x0668;
  15008. t['eighthangzhou'] = 0x3028;
  15009. t['eighthnotebeamed'] = 0x266B;
  15010. t['eightideographicparen'] = 0x3227;
  15011. t['eightinferior'] = 0x2088;
  15012. t['eightmonospace'] = 0xFF18;
  15013. t['eightoldstyle'] = 0xF738;
  15014. t['eightparen'] = 0x247B;
  15015. t['eightperiod'] = 0x248F;
  15016. t['eightpersian'] = 0x06F8;
  15017. t['eightroman'] = 0x2177;
  15018. t['eightsuperior'] = 0x2078;
  15019. t['eightthai'] = 0x0E58;
  15020. t['einvertedbreve'] = 0x0207;
  15021. t['eiotifiedcyrillic'] = 0x0465;
  15022. t['ekatakana'] = 0x30A8;
  15023. t['ekatakanahalfwidth'] = 0xFF74;
  15024. t['ekonkargurmukhi'] = 0x0A74;
  15025. t['ekorean'] = 0x3154;
  15026. t['elcyrillic'] = 0x043B;
  15027. t['element'] = 0x2208;
  15028. t['elevencircle'] = 0x246A;
  15029. t['elevenparen'] = 0x247E;
  15030. t['elevenperiod'] = 0x2492;
  15031. t['elevenroman'] = 0x217A;
  15032. t['ellipsis'] = 0x2026;
  15033. t['ellipsisvertical'] = 0x22EE;
  15034. t['emacron'] = 0x0113;
  15035. t['emacronacute'] = 0x1E17;
  15036. t['emacrongrave'] = 0x1E15;
  15037. t['emcyrillic'] = 0x043C;
  15038. t['emdash'] = 0x2014;
  15039. t['emdashvertical'] = 0xFE31;
  15040. t['emonospace'] = 0xFF45;
  15041. t['emphasismarkarmenian'] = 0x055B;
  15042. t['emptyset'] = 0x2205;
  15043. t['enbopomofo'] = 0x3123;
  15044. t['encyrillic'] = 0x043D;
  15045. t['endash'] = 0x2013;
  15046. t['endashvertical'] = 0xFE32;
  15047. t['endescendercyrillic'] = 0x04A3;
  15048. t['eng'] = 0x014B;
  15049. t['engbopomofo'] = 0x3125;
  15050. t['enghecyrillic'] = 0x04A5;
  15051. t['enhookcyrillic'] = 0x04C8;
  15052. t['enspace'] = 0x2002;
  15053. t['eogonek'] = 0x0119;
  15054. t['eokorean'] = 0x3153;
  15055. t['eopen'] = 0x025B;
  15056. t['eopenclosed'] = 0x029A;
  15057. t['eopenreversed'] = 0x025C;
  15058. t['eopenreversedclosed'] = 0x025E;
  15059. t['eopenreversedhook'] = 0x025D;
  15060. t['eparen'] = 0x24A0;
  15061. t['epsilon'] = 0x03B5;
  15062. t['epsilontonos'] = 0x03AD;
  15063. t['equal'] = 0x003D;
  15064. t['equalmonospace'] = 0xFF1D;
  15065. t['equalsmall'] = 0xFE66;
  15066. t['equalsuperior'] = 0x207C;
  15067. t['equivalence'] = 0x2261;
  15068. t['erbopomofo'] = 0x3126;
  15069. t['ercyrillic'] = 0x0440;
  15070. t['ereversed'] = 0x0258;
  15071. t['ereversedcyrillic'] = 0x044D;
  15072. t['escyrillic'] = 0x0441;
  15073. t['esdescendercyrillic'] = 0x04AB;
  15074. t['esh'] = 0x0283;
  15075. t['eshcurl'] = 0x0286;
  15076. t['eshortdeva'] = 0x090E;
  15077. t['eshortvowelsigndeva'] = 0x0946;
  15078. t['eshreversedloop'] = 0x01AA;
  15079. t['eshsquatreversed'] = 0x0285;
  15080. t['esmallhiragana'] = 0x3047;
  15081. t['esmallkatakana'] = 0x30A7;
  15082. t['esmallkatakanahalfwidth'] = 0xFF6A;
  15083. t['estimated'] = 0x212E;
  15084. t['esuperior'] = 0xF6EC;
  15085. t['eta'] = 0x03B7;
  15086. t['etarmenian'] = 0x0568;
  15087. t['etatonos'] = 0x03AE;
  15088. t['eth'] = 0x00F0;
  15089. t['etilde'] = 0x1EBD;
  15090. t['etildebelow'] = 0x1E1B;
  15091. t['etnahtafoukhhebrew'] = 0x0591;
  15092. t['etnahtafoukhlefthebrew'] = 0x0591;
  15093. t['etnahtahebrew'] = 0x0591;
  15094. t['etnahtalefthebrew'] = 0x0591;
  15095. t['eturned'] = 0x01DD;
  15096. t['eukorean'] = 0x3161;
  15097. t['euro'] = 0x20AC;
  15098. t['evowelsignbengali'] = 0x09C7;
  15099. t['evowelsigndeva'] = 0x0947;
  15100. t['evowelsigngujarati'] = 0x0AC7;
  15101. t['exclam'] = 0x0021;
  15102. t['exclamarmenian'] = 0x055C;
  15103. t['exclamdbl'] = 0x203C;
  15104. t['exclamdown'] = 0x00A1;
  15105. t['exclamdownsmall'] = 0xF7A1;
  15106. t['exclammonospace'] = 0xFF01;
  15107. t['exclamsmall'] = 0xF721;
  15108. t['existential'] = 0x2203;
  15109. t['ezh'] = 0x0292;
  15110. t['ezhcaron'] = 0x01EF;
  15111. t['ezhcurl'] = 0x0293;
  15112. t['ezhreversed'] = 0x01B9;
  15113. t['ezhtail'] = 0x01BA;
  15114. t['f'] = 0x0066;
  15115. t['fadeva'] = 0x095E;
  15116. t['fagurmukhi'] = 0x0A5E;
  15117. t['fahrenheit'] = 0x2109;
  15118. t['fathaarabic'] = 0x064E;
  15119. t['fathalowarabic'] = 0x064E;
  15120. t['fathatanarabic'] = 0x064B;
  15121. t['fbopomofo'] = 0x3108;
  15122. t['fcircle'] = 0x24D5;
  15123. t['fdotaccent'] = 0x1E1F;
  15124. t['feharabic'] = 0x0641;
  15125. t['feharmenian'] = 0x0586;
  15126. t['fehfinalarabic'] = 0xFED2;
  15127. t['fehinitialarabic'] = 0xFED3;
  15128. t['fehmedialarabic'] = 0xFED4;
  15129. t['feicoptic'] = 0x03E5;
  15130. t['female'] = 0x2640;
  15131. t['ff'] = 0xFB00;
  15132. t['ffi'] = 0xFB03;
  15133. t['ffl'] = 0xFB04;
  15134. t['fi'] = 0xFB01;
  15135. t['fifteencircle'] = 0x246E;
  15136. t['fifteenparen'] = 0x2482;
  15137. t['fifteenperiod'] = 0x2496;
  15138. t['figuredash'] = 0x2012;
  15139. t['filledbox'] = 0x25A0;
  15140. t['filledrect'] = 0x25AC;
  15141. t['finalkaf'] = 0x05DA;
  15142. t['finalkafdagesh'] = 0xFB3A;
  15143. t['finalkafdageshhebrew'] = 0xFB3A;
  15144. t['finalkafhebrew'] = 0x05DA;
  15145. t['finalmem'] = 0x05DD;
  15146. t['finalmemhebrew'] = 0x05DD;
  15147. t['finalnun'] = 0x05DF;
  15148. t['finalnunhebrew'] = 0x05DF;
  15149. t['finalpe'] = 0x05E3;
  15150. t['finalpehebrew'] = 0x05E3;
  15151. t['finaltsadi'] = 0x05E5;
  15152. t['finaltsadihebrew'] = 0x05E5;
  15153. t['firsttonechinese'] = 0x02C9;
  15154. t['fisheye'] = 0x25C9;
  15155. t['fitacyrillic'] = 0x0473;
  15156. t['five'] = 0x0035;
  15157. t['fivearabic'] = 0x0665;
  15158. t['fivebengali'] = 0x09EB;
  15159. t['fivecircle'] = 0x2464;
  15160. t['fivecircleinversesansserif'] = 0x278E;
  15161. t['fivedeva'] = 0x096B;
  15162. t['fiveeighths'] = 0x215D;
  15163. t['fivegujarati'] = 0x0AEB;
  15164. t['fivegurmukhi'] = 0x0A6B;
  15165. t['fivehackarabic'] = 0x0665;
  15166. t['fivehangzhou'] = 0x3025;
  15167. t['fiveideographicparen'] = 0x3224;
  15168. t['fiveinferior'] = 0x2085;
  15169. t['fivemonospace'] = 0xFF15;
  15170. t['fiveoldstyle'] = 0xF735;
  15171. t['fiveparen'] = 0x2478;
  15172. t['fiveperiod'] = 0x248C;
  15173. t['fivepersian'] = 0x06F5;
  15174. t['fiveroman'] = 0x2174;
  15175. t['fivesuperior'] = 0x2075;
  15176. t['fivethai'] = 0x0E55;
  15177. t['fl'] = 0xFB02;
  15178. t['florin'] = 0x0192;
  15179. t['fmonospace'] = 0xFF46;
  15180. t['fmsquare'] = 0x3399;
  15181. t['fofanthai'] = 0x0E1F;
  15182. t['fofathai'] = 0x0E1D;
  15183. t['fongmanthai'] = 0x0E4F;
  15184. t['forall'] = 0x2200;
  15185. t['four'] = 0x0034;
  15186. t['fourarabic'] = 0x0664;
  15187. t['fourbengali'] = 0x09EA;
  15188. t['fourcircle'] = 0x2463;
  15189. t['fourcircleinversesansserif'] = 0x278D;
  15190. t['fourdeva'] = 0x096A;
  15191. t['fourgujarati'] = 0x0AEA;
  15192. t['fourgurmukhi'] = 0x0A6A;
  15193. t['fourhackarabic'] = 0x0664;
  15194. t['fourhangzhou'] = 0x3024;
  15195. t['fourideographicparen'] = 0x3223;
  15196. t['fourinferior'] = 0x2084;
  15197. t['fourmonospace'] = 0xFF14;
  15198. t['fournumeratorbengali'] = 0x09F7;
  15199. t['fouroldstyle'] = 0xF734;
  15200. t['fourparen'] = 0x2477;
  15201. t['fourperiod'] = 0x248B;
  15202. t['fourpersian'] = 0x06F4;
  15203. t['fourroman'] = 0x2173;
  15204. t['foursuperior'] = 0x2074;
  15205. t['fourteencircle'] = 0x246D;
  15206. t['fourteenparen'] = 0x2481;
  15207. t['fourteenperiod'] = 0x2495;
  15208. t['fourthai'] = 0x0E54;
  15209. t['fourthtonechinese'] = 0x02CB;
  15210. t['fparen'] = 0x24A1;
  15211. t['fraction'] = 0x2044;
  15212. t['franc'] = 0x20A3;
  15213. t['g'] = 0x0067;
  15214. t['gabengali'] = 0x0997;
  15215. t['gacute'] = 0x01F5;
  15216. t['gadeva'] = 0x0917;
  15217. t['gafarabic'] = 0x06AF;
  15218. t['gaffinalarabic'] = 0xFB93;
  15219. t['gafinitialarabic'] = 0xFB94;
  15220. t['gafmedialarabic'] = 0xFB95;
  15221. t['gagujarati'] = 0x0A97;
  15222. t['gagurmukhi'] = 0x0A17;
  15223. t['gahiragana'] = 0x304C;
  15224. t['gakatakana'] = 0x30AC;
  15225. t['gamma'] = 0x03B3;
  15226. t['gammalatinsmall'] = 0x0263;
  15227. t['gammasuperior'] = 0x02E0;
  15228. t['gangiacoptic'] = 0x03EB;
  15229. t['gbopomofo'] = 0x310D;
  15230. t['gbreve'] = 0x011F;
  15231. t['gcaron'] = 0x01E7;
  15232. t['gcedilla'] = 0x0123;
  15233. t['gcircle'] = 0x24D6;
  15234. t['gcircumflex'] = 0x011D;
  15235. t['gcommaaccent'] = 0x0123;
  15236. t['gdot'] = 0x0121;
  15237. t['gdotaccent'] = 0x0121;
  15238. t['gecyrillic'] = 0x0433;
  15239. t['gehiragana'] = 0x3052;
  15240. t['gekatakana'] = 0x30B2;
  15241. t['geometricallyequal'] = 0x2251;
  15242. t['gereshaccenthebrew'] = 0x059C;
  15243. t['gereshhebrew'] = 0x05F3;
  15244. t['gereshmuqdamhebrew'] = 0x059D;
  15245. t['germandbls'] = 0x00DF;
  15246. t['gershayimaccenthebrew'] = 0x059E;
  15247. t['gershayimhebrew'] = 0x05F4;
  15248. t['getamark'] = 0x3013;
  15249. t['ghabengali'] = 0x0998;
  15250. t['ghadarmenian'] = 0x0572;
  15251. t['ghadeva'] = 0x0918;
  15252. t['ghagujarati'] = 0x0A98;
  15253. t['ghagurmukhi'] = 0x0A18;
  15254. t['ghainarabic'] = 0x063A;
  15255. t['ghainfinalarabic'] = 0xFECE;
  15256. t['ghaininitialarabic'] = 0xFECF;
  15257. t['ghainmedialarabic'] = 0xFED0;
  15258. t['ghemiddlehookcyrillic'] = 0x0495;
  15259. t['ghestrokecyrillic'] = 0x0493;
  15260. t['gheupturncyrillic'] = 0x0491;
  15261. t['ghhadeva'] = 0x095A;
  15262. t['ghhagurmukhi'] = 0x0A5A;
  15263. t['ghook'] = 0x0260;
  15264. t['ghzsquare'] = 0x3393;
  15265. t['gihiragana'] = 0x304E;
  15266. t['gikatakana'] = 0x30AE;
  15267. t['gimarmenian'] = 0x0563;
  15268. t['gimel'] = 0x05D2;
  15269. t['gimeldagesh'] = 0xFB32;
  15270. t['gimeldageshhebrew'] = 0xFB32;
  15271. t['gimelhebrew'] = 0x05D2;
  15272. t['gjecyrillic'] = 0x0453;
  15273. t['glottalinvertedstroke'] = 0x01BE;
  15274. t['glottalstop'] = 0x0294;
  15275. t['glottalstopinverted'] = 0x0296;
  15276. t['glottalstopmod'] = 0x02C0;
  15277. t['glottalstopreversed'] = 0x0295;
  15278. t['glottalstopreversedmod'] = 0x02C1;
  15279. t['glottalstopreversedsuperior'] = 0x02E4;
  15280. t['glottalstopstroke'] = 0x02A1;
  15281. t['glottalstopstrokereversed'] = 0x02A2;
  15282. t['gmacron'] = 0x1E21;
  15283. t['gmonospace'] = 0xFF47;
  15284. t['gohiragana'] = 0x3054;
  15285. t['gokatakana'] = 0x30B4;
  15286. t['gparen'] = 0x24A2;
  15287. t['gpasquare'] = 0x33AC;
  15288. t['gradient'] = 0x2207;
  15289. t['grave'] = 0x0060;
  15290. t['gravebelowcmb'] = 0x0316;
  15291. t['gravecmb'] = 0x0300;
  15292. t['gravecomb'] = 0x0300;
  15293. t['gravedeva'] = 0x0953;
  15294. t['gravelowmod'] = 0x02CE;
  15295. t['gravemonospace'] = 0xFF40;
  15296. t['gravetonecmb'] = 0x0340;
  15297. t['greater'] = 0x003E;
  15298. t['greaterequal'] = 0x2265;
  15299. t['greaterequalorless'] = 0x22DB;
  15300. t['greatermonospace'] = 0xFF1E;
  15301. t['greaterorequivalent'] = 0x2273;
  15302. t['greaterorless'] = 0x2277;
  15303. t['greateroverequal'] = 0x2267;
  15304. t['greatersmall'] = 0xFE65;
  15305. t['gscript'] = 0x0261;
  15306. t['gstroke'] = 0x01E5;
  15307. t['guhiragana'] = 0x3050;
  15308. t['guillemotleft'] = 0x00AB;
  15309. t['guillemotright'] = 0x00BB;
  15310. t['guilsinglleft'] = 0x2039;
  15311. t['guilsinglright'] = 0x203A;
  15312. t['gukatakana'] = 0x30B0;
  15313. t['guramusquare'] = 0x3318;
  15314. t['gysquare'] = 0x33C9;
  15315. t['h'] = 0x0068;
  15316. t['haabkhasiancyrillic'] = 0x04A9;
  15317. t['haaltonearabic'] = 0x06C1;
  15318. t['habengali'] = 0x09B9;
  15319. t['hadescendercyrillic'] = 0x04B3;
  15320. t['hadeva'] = 0x0939;
  15321. t['hagujarati'] = 0x0AB9;
  15322. t['hagurmukhi'] = 0x0A39;
  15323. t['haharabic'] = 0x062D;
  15324. t['hahfinalarabic'] = 0xFEA2;
  15325. t['hahinitialarabic'] = 0xFEA3;
  15326. t['hahiragana'] = 0x306F;
  15327. t['hahmedialarabic'] = 0xFEA4;
  15328. t['haitusquare'] = 0x332A;
  15329. t['hakatakana'] = 0x30CF;
  15330. t['hakatakanahalfwidth'] = 0xFF8A;
  15331. t['halantgurmukhi'] = 0x0A4D;
  15332. t['hamzaarabic'] = 0x0621;
  15333. t['hamzalowarabic'] = 0x0621;
  15334. t['hangulfiller'] = 0x3164;
  15335. t['hardsigncyrillic'] = 0x044A;
  15336. t['harpoonleftbarbup'] = 0x21BC;
  15337. t['harpoonrightbarbup'] = 0x21C0;
  15338. t['hasquare'] = 0x33CA;
  15339. t['hatafpatah'] = 0x05B2;
  15340. t['hatafpatah16'] = 0x05B2;
  15341. t['hatafpatah23'] = 0x05B2;
  15342. t['hatafpatah2f'] = 0x05B2;
  15343. t['hatafpatahhebrew'] = 0x05B2;
  15344. t['hatafpatahnarrowhebrew'] = 0x05B2;
  15345. t['hatafpatahquarterhebrew'] = 0x05B2;
  15346. t['hatafpatahwidehebrew'] = 0x05B2;
  15347. t['hatafqamats'] = 0x05B3;
  15348. t['hatafqamats1b'] = 0x05B3;
  15349. t['hatafqamats28'] = 0x05B3;
  15350. t['hatafqamats34'] = 0x05B3;
  15351. t['hatafqamatshebrew'] = 0x05B3;
  15352. t['hatafqamatsnarrowhebrew'] = 0x05B3;
  15353. t['hatafqamatsquarterhebrew'] = 0x05B3;
  15354. t['hatafqamatswidehebrew'] = 0x05B3;
  15355. t['hatafsegol'] = 0x05B1;
  15356. t['hatafsegol17'] = 0x05B1;
  15357. t['hatafsegol24'] = 0x05B1;
  15358. t['hatafsegol30'] = 0x05B1;
  15359. t['hatafsegolhebrew'] = 0x05B1;
  15360. t['hatafsegolnarrowhebrew'] = 0x05B1;
  15361. t['hatafsegolquarterhebrew'] = 0x05B1;
  15362. t['hatafsegolwidehebrew'] = 0x05B1;
  15363. t['hbar'] = 0x0127;
  15364. t['hbopomofo'] = 0x310F;
  15365. t['hbrevebelow'] = 0x1E2B;
  15366. t['hcedilla'] = 0x1E29;
  15367. t['hcircle'] = 0x24D7;
  15368. t['hcircumflex'] = 0x0125;
  15369. t['hdieresis'] = 0x1E27;
  15370. t['hdotaccent'] = 0x1E23;
  15371. t['hdotbelow'] = 0x1E25;
  15372. t['he'] = 0x05D4;
  15373. t['heart'] = 0x2665;
  15374. t['heartsuitblack'] = 0x2665;
  15375. t['heartsuitwhite'] = 0x2661;
  15376. t['hedagesh'] = 0xFB34;
  15377. t['hedageshhebrew'] = 0xFB34;
  15378. t['hehaltonearabic'] = 0x06C1;
  15379. t['heharabic'] = 0x0647;
  15380. t['hehebrew'] = 0x05D4;
  15381. t['hehfinalaltonearabic'] = 0xFBA7;
  15382. t['hehfinalalttwoarabic'] = 0xFEEA;
  15383. t['hehfinalarabic'] = 0xFEEA;
  15384. t['hehhamzaabovefinalarabic'] = 0xFBA5;
  15385. t['hehhamzaaboveisolatedarabic'] = 0xFBA4;
  15386. t['hehinitialaltonearabic'] = 0xFBA8;
  15387. t['hehinitialarabic'] = 0xFEEB;
  15388. t['hehiragana'] = 0x3078;
  15389. t['hehmedialaltonearabic'] = 0xFBA9;
  15390. t['hehmedialarabic'] = 0xFEEC;
  15391. t['heiseierasquare'] = 0x337B;
  15392. t['hekatakana'] = 0x30D8;
  15393. t['hekatakanahalfwidth'] = 0xFF8D;
  15394. t['hekutaarusquare'] = 0x3336;
  15395. t['henghook'] = 0x0267;
  15396. t['herutusquare'] = 0x3339;
  15397. t['het'] = 0x05D7;
  15398. t['hethebrew'] = 0x05D7;
  15399. t['hhook'] = 0x0266;
  15400. t['hhooksuperior'] = 0x02B1;
  15401. t['hieuhacirclekorean'] = 0x327B;
  15402. t['hieuhaparenkorean'] = 0x321B;
  15403. t['hieuhcirclekorean'] = 0x326D;
  15404. t['hieuhkorean'] = 0x314E;
  15405. t['hieuhparenkorean'] = 0x320D;
  15406. t['hihiragana'] = 0x3072;
  15407. t['hikatakana'] = 0x30D2;
  15408. t['hikatakanahalfwidth'] = 0xFF8B;
  15409. t['hiriq'] = 0x05B4;
  15410. t['hiriq14'] = 0x05B4;
  15411. t['hiriq21'] = 0x05B4;
  15412. t['hiriq2d'] = 0x05B4;
  15413. t['hiriqhebrew'] = 0x05B4;
  15414. t['hiriqnarrowhebrew'] = 0x05B4;
  15415. t['hiriqquarterhebrew'] = 0x05B4;
  15416. t['hiriqwidehebrew'] = 0x05B4;
  15417. t['hlinebelow'] = 0x1E96;
  15418. t['hmonospace'] = 0xFF48;
  15419. t['hoarmenian'] = 0x0570;
  15420. t['hohipthai'] = 0x0E2B;
  15421. t['hohiragana'] = 0x307B;
  15422. t['hokatakana'] = 0x30DB;
  15423. t['hokatakanahalfwidth'] = 0xFF8E;
  15424. t['holam'] = 0x05B9;
  15425. t['holam19'] = 0x05B9;
  15426. t['holam26'] = 0x05B9;
  15427. t['holam32'] = 0x05B9;
  15428. t['holamhebrew'] = 0x05B9;
  15429. t['holamnarrowhebrew'] = 0x05B9;
  15430. t['holamquarterhebrew'] = 0x05B9;
  15431. t['holamwidehebrew'] = 0x05B9;
  15432. t['honokhukthai'] = 0x0E2E;
  15433. t['hookabovecomb'] = 0x0309;
  15434. t['hookcmb'] = 0x0309;
  15435. t['hookpalatalizedbelowcmb'] = 0x0321;
  15436. t['hookretroflexbelowcmb'] = 0x0322;
  15437. t['hoonsquare'] = 0x3342;
  15438. t['horicoptic'] = 0x03E9;
  15439. t['horizontalbar'] = 0x2015;
  15440. t['horncmb'] = 0x031B;
  15441. t['hotsprings'] = 0x2668;
  15442. t['house'] = 0x2302;
  15443. t['hparen'] = 0x24A3;
  15444. t['hsuperior'] = 0x02B0;
  15445. t['hturned'] = 0x0265;
  15446. t['huhiragana'] = 0x3075;
  15447. t['huiitosquare'] = 0x3333;
  15448. t['hukatakana'] = 0x30D5;
  15449. t['hukatakanahalfwidth'] = 0xFF8C;
  15450. t['hungarumlaut'] = 0x02DD;
  15451. t['hungarumlautcmb'] = 0x030B;
  15452. t['hv'] = 0x0195;
  15453. t['hyphen'] = 0x002D;
  15454. t['hypheninferior'] = 0xF6E5;
  15455. t['hyphenmonospace'] = 0xFF0D;
  15456. t['hyphensmall'] = 0xFE63;
  15457. t['hyphensuperior'] = 0xF6E6;
  15458. t['hyphentwo'] = 0x2010;
  15459. t['i'] = 0x0069;
  15460. t['iacute'] = 0x00ED;
  15461. t['iacyrillic'] = 0x044F;
  15462. t['ibengali'] = 0x0987;
  15463. t['ibopomofo'] = 0x3127;
  15464. t['ibreve'] = 0x012D;
  15465. t['icaron'] = 0x01D0;
  15466. t['icircle'] = 0x24D8;
  15467. t['icircumflex'] = 0x00EE;
  15468. t['icyrillic'] = 0x0456;
  15469. t['idblgrave'] = 0x0209;
  15470. t['ideographearthcircle'] = 0x328F;
  15471. t['ideographfirecircle'] = 0x328B;
  15472. t['ideographicallianceparen'] = 0x323F;
  15473. t['ideographiccallparen'] = 0x323A;
  15474. t['ideographiccentrecircle'] = 0x32A5;
  15475. t['ideographicclose'] = 0x3006;
  15476. t['ideographiccomma'] = 0x3001;
  15477. t['ideographiccommaleft'] = 0xFF64;
  15478. t['ideographiccongratulationparen'] = 0x3237;
  15479. t['ideographiccorrectcircle'] = 0x32A3;
  15480. t['ideographicearthparen'] = 0x322F;
  15481. t['ideographicenterpriseparen'] = 0x323D;
  15482. t['ideographicexcellentcircle'] = 0x329D;
  15483. t['ideographicfestivalparen'] = 0x3240;
  15484. t['ideographicfinancialcircle'] = 0x3296;
  15485. t['ideographicfinancialparen'] = 0x3236;
  15486. t['ideographicfireparen'] = 0x322B;
  15487. t['ideographichaveparen'] = 0x3232;
  15488. t['ideographichighcircle'] = 0x32A4;
  15489. t['ideographiciterationmark'] = 0x3005;
  15490. t['ideographiclaborcircle'] = 0x3298;
  15491. t['ideographiclaborparen'] = 0x3238;
  15492. t['ideographicleftcircle'] = 0x32A7;
  15493. t['ideographiclowcircle'] = 0x32A6;
  15494. t['ideographicmedicinecircle'] = 0x32A9;
  15495. t['ideographicmetalparen'] = 0x322E;
  15496. t['ideographicmoonparen'] = 0x322A;
  15497. t['ideographicnameparen'] = 0x3234;
  15498. t['ideographicperiod'] = 0x3002;
  15499. t['ideographicprintcircle'] = 0x329E;
  15500. t['ideographicreachparen'] = 0x3243;
  15501. t['ideographicrepresentparen'] = 0x3239;
  15502. t['ideographicresourceparen'] = 0x323E;
  15503. t['ideographicrightcircle'] = 0x32A8;
  15504. t['ideographicsecretcircle'] = 0x3299;
  15505. t['ideographicselfparen'] = 0x3242;
  15506. t['ideographicsocietyparen'] = 0x3233;
  15507. t['ideographicspace'] = 0x3000;
  15508. t['ideographicspecialparen'] = 0x3235;
  15509. t['ideographicstockparen'] = 0x3231;
  15510. t['ideographicstudyparen'] = 0x323B;
  15511. t['ideographicsunparen'] = 0x3230;
  15512. t['ideographicsuperviseparen'] = 0x323C;
  15513. t['ideographicwaterparen'] = 0x322C;
  15514. t['ideographicwoodparen'] = 0x322D;
  15515. t['ideographiczero'] = 0x3007;
  15516. t['ideographmetalcircle'] = 0x328E;
  15517. t['ideographmooncircle'] = 0x328A;
  15518. t['ideographnamecircle'] = 0x3294;
  15519. t['ideographsuncircle'] = 0x3290;
  15520. t['ideographwatercircle'] = 0x328C;
  15521. t['ideographwoodcircle'] = 0x328D;
  15522. t['ideva'] = 0x0907;
  15523. t['idieresis'] = 0x00EF;
  15524. t['idieresisacute'] = 0x1E2F;
  15525. t['idieresiscyrillic'] = 0x04E5;
  15526. t['idotbelow'] = 0x1ECB;
  15527. t['iebrevecyrillic'] = 0x04D7;
  15528. t['iecyrillic'] = 0x0435;
  15529. t['ieungacirclekorean'] = 0x3275;
  15530. t['ieungaparenkorean'] = 0x3215;
  15531. t['ieungcirclekorean'] = 0x3267;
  15532. t['ieungkorean'] = 0x3147;
  15533. t['ieungparenkorean'] = 0x3207;
  15534. t['igrave'] = 0x00EC;
  15535. t['igujarati'] = 0x0A87;
  15536. t['igurmukhi'] = 0x0A07;
  15537. t['ihiragana'] = 0x3044;
  15538. t['ihookabove'] = 0x1EC9;
  15539. t['iibengali'] = 0x0988;
  15540. t['iicyrillic'] = 0x0438;
  15541. t['iideva'] = 0x0908;
  15542. t['iigujarati'] = 0x0A88;
  15543. t['iigurmukhi'] = 0x0A08;
  15544. t['iimatragurmukhi'] = 0x0A40;
  15545. t['iinvertedbreve'] = 0x020B;
  15546. t['iishortcyrillic'] = 0x0439;
  15547. t['iivowelsignbengali'] = 0x09C0;
  15548. t['iivowelsigndeva'] = 0x0940;
  15549. t['iivowelsigngujarati'] = 0x0AC0;
  15550. t['ij'] = 0x0133;
  15551. t['ikatakana'] = 0x30A4;
  15552. t['ikatakanahalfwidth'] = 0xFF72;
  15553. t['ikorean'] = 0x3163;
  15554. t['ilde'] = 0x02DC;
  15555. t['iluyhebrew'] = 0x05AC;
  15556. t['imacron'] = 0x012B;
  15557. t['imacroncyrillic'] = 0x04E3;
  15558. t['imageorapproximatelyequal'] = 0x2253;
  15559. t['imatragurmukhi'] = 0x0A3F;
  15560. t['imonospace'] = 0xFF49;
  15561. t['increment'] = 0x2206;
  15562. t['infinity'] = 0x221E;
  15563. t['iniarmenian'] = 0x056B;
  15564. t['integral'] = 0x222B;
  15565. t['integralbottom'] = 0x2321;
  15566. t['integralbt'] = 0x2321;
  15567. t['integralex'] = 0xF8F5;
  15568. t['integraltop'] = 0x2320;
  15569. t['integraltp'] = 0x2320;
  15570. t['intersection'] = 0x2229;
  15571. t['intisquare'] = 0x3305;
  15572. t['invbullet'] = 0x25D8;
  15573. t['invcircle'] = 0x25D9;
  15574. t['invsmileface'] = 0x263B;
  15575. t['iocyrillic'] = 0x0451;
  15576. t['iogonek'] = 0x012F;
  15577. t['iota'] = 0x03B9;
  15578. t['iotadieresis'] = 0x03CA;
  15579. t['iotadieresistonos'] = 0x0390;
  15580. t['iotalatin'] = 0x0269;
  15581. t['iotatonos'] = 0x03AF;
  15582. t['iparen'] = 0x24A4;
  15583. t['irigurmukhi'] = 0x0A72;
  15584. t['ismallhiragana'] = 0x3043;
  15585. t['ismallkatakana'] = 0x30A3;
  15586. t['ismallkatakanahalfwidth'] = 0xFF68;
  15587. t['issharbengali'] = 0x09FA;
  15588. t['istroke'] = 0x0268;
  15589. t['isuperior'] = 0xF6ED;
  15590. t['iterationhiragana'] = 0x309D;
  15591. t['iterationkatakana'] = 0x30FD;
  15592. t['itilde'] = 0x0129;
  15593. t['itildebelow'] = 0x1E2D;
  15594. t['iubopomofo'] = 0x3129;
  15595. t['iucyrillic'] = 0x044E;
  15596. t['ivowelsignbengali'] = 0x09BF;
  15597. t['ivowelsigndeva'] = 0x093F;
  15598. t['ivowelsigngujarati'] = 0x0ABF;
  15599. t['izhitsacyrillic'] = 0x0475;
  15600. t['izhitsadblgravecyrillic'] = 0x0477;
  15601. t['j'] = 0x006A;
  15602. t['jaarmenian'] = 0x0571;
  15603. t['jabengali'] = 0x099C;
  15604. t['jadeva'] = 0x091C;
  15605. t['jagujarati'] = 0x0A9C;
  15606. t['jagurmukhi'] = 0x0A1C;
  15607. t['jbopomofo'] = 0x3110;
  15608. t['jcaron'] = 0x01F0;
  15609. t['jcircle'] = 0x24D9;
  15610. t['jcircumflex'] = 0x0135;
  15611. t['jcrossedtail'] = 0x029D;
  15612. t['jdotlessstroke'] = 0x025F;
  15613. t['jecyrillic'] = 0x0458;
  15614. t['jeemarabic'] = 0x062C;
  15615. t['jeemfinalarabic'] = 0xFE9E;
  15616. t['jeeminitialarabic'] = 0xFE9F;
  15617. t['jeemmedialarabic'] = 0xFEA0;
  15618. t['jeharabic'] = 0x0698;
  15619. t['jehfinalarabic'] = 0xFB8B;
  15620. t['jhabengali'] = 0x099D;
  15621. t['jhadeva'] = 0x091D;
  15622. t['jhagujarati'] = 0x0A9D;
  15623. t['jhagurmukhi'] = 0x0A1D;
  15624. t['jheharmenian'] = 0x057B;
  15625. t['jis'] = 0x3004;
  15626. t['jmonospace'] = 0xFF4A;
  15627. t['jparen'] = 0x24A5;
  15628. t['jsuperior'] = 0x02B2;
  15629. t['k'] = 0x006B;
  15630. t['kabashkircyrillic'] = 0x04A1;
  15631. t['kabengali'] = 0x0995;
  15632. t['kacute'] = 0x1E31;
  15633. t['kacyrillic'] = 0x043A;
  15634. t['kadescendercyrillic'] = 0x049B;
  15635. t['kadeva'] = 0x0915;
  15636. t['kaf'] = 0x05DB;
  15637. t['kafarabic'] = 0x0643;
  15638. t['kafdagesh'] = 0xFB3B;
  15639. t['kafdageshhebrew'] = 0xFB3B;
  15640. t['kaffinalarabic'] = 0xFEDA;
  15641. t['kafhebrew'] = 0x05DB;
  15642. t['kafinitialarabic'] = 0xFEDB;
  15643. t['kafmedialarabic'] = 0xFEDC;
  15644. t['kafrafehebrew'] = 0xFB4D;
  15645. t['kagujarati'] = 0x0A95;
  15646. t['kagurmukhi'] = 0x0A15;
  15647. t['kahiragana'] = 0x304B;
  15648. t['kahookcyrillic'] = 0x04C4;
  15649. t['kakatakana'] = 0x30AB;
  15650. t['kakatakanahalfwidth'] = 0xFF76;
  15651. t['kappa'] = 0x03BA;
  15652. t['kappasymbolgreek'] = 0x03F0;
  15653. t['kapyeounmieumkorean'] = 0x3171;
  15654. t['kapyeounphieuphkorean'] = 0x3184;
  15655. t['kapyeounpieupkorean'] = 0x3178;
  15656. t['kapyeounssangpieupkorean'] = 0x3179;
  15657. t['karoriisquare'] = 0x330D;
  15658. t['kashidaautoarabic'] = 0x0640;
  15659. t['kashidaautonosidebearingarabic'] = 0x0640;
  15660. t['kasmallkatakana'] = 0x30F5;
  15661. t['kasquare'] = 0x3384;
  15662. t['kasraarabic'] = 0x0650;
  15663. t['kasratanarabic'] = 0x064D;
  15664. t['kastrokecyrillic'] = 0x049F;
  15665. t['katahiraprolongmarkhalfwidth'] = 0xFF70;
  15666. t['kaverticalstrokecyrillic'] = 0x049D;
  15667. t['kbopomofo'] = 0x310E;
  15668. t['kcalsquare'] = 0x3389;
  15669. t['kcaron'] = 0x01E9;
  15670. t['kcedilla'] = 0x0137;
  15671. t['kcircle'] = 0x24DA;
  15672. t['kcommaaccent'] = 0x0137;
  15673. t['kdotbelow'] = 0x1E33;
  15674. t['keharmenian'] = 0x0584;
  15675. t['kehiragana'] = 0x3051;
  15676. t['kekatakana'] = 0x30B1;
  15677. t['kekatakanahalfwidth'] = 0xFF79;
  15678. t['kenarmenian'] = 0x056F;
  15679. t['kesmallkatakana'] = 0x30F6;
  15680. t['kgreenlandic'] = 0x0138;
  15681. t['khabengali'] = 0x0996;
  15682. t['khacyrillic'] = 0x0445;
  15683. t['khadeva'] = 0x0916;
  15684. t['khagujarati'] = 0x0A96;
  15685. t['khagurmukhi'] = 0x0A16;
  15686. t['khaharabic'] = 0x062E;
  15687. t['khahfinalarabic'] = 0xFEA6;
  15688. t['khahinitialarabic'] = 0xFEA7;
  15689. t['khahmedialarabic'] = 0xFEA8;
  15690. t['kheicoptic'] = 0x03E7;
  15691. t['khhadeva'] = 0x0959;
  15692. t['khhagurmukhi'] = 0x0A59;
  15693. t['khieukhacirclekorean'] = 0x3278;
  15694. t['khieukhaparenkorean'] = 0x3218;
  15695. t['khieukhcirclekorean'] = 0x326A;
  15696. t['khieukhkorean'] = 0x314B;
  15697. t['khieukhparenkorean'] = 0x320A;
  15698. t['khokhaithai'] = 0x0E02;
  15699. t['khokhonthai'] = 0x0E05;
  15700. t['khokhuatthai'] = 0x0E03;
  15701. t['khokhwaithai'] = 0x0E04;
  15702. t['khomutthai'] = 0x0E5B;
  15703. t['khook'] = 0x0199;
  15704. t['khorakhangthai'] = 0x0E06;
  15705. t['khzsquare'] = 0x3391;
  15706. t['kihiragana'] = 0x304D;
  15707. t['kikatakana'] = 0x30AD;
  15708. t['kikatakanahalfwidth'] = 0xFF77;
  15709. t['kiroguramusquare'] = 0x3315;
  15710. t['kiromeetorusquare'] = 0x3316;
  15711. t['kirosquare'] = 0x3314;
  15712. t['kiyeokacirclekorean'] = 0x326E;
  15713. t['kiyeokaparenkorean'] = 0x320E;
  15714. t['kiyeokcirclekorean'] = 0x3260;
  15715. t['kiyeokkorean'] = 0x3131;
  15716. t['kiyeokparenkorean'] = 0x3200;
  15717. t['kiyeoksioskorean'] = 0x3133;
  15718. t['kjecyrillic'] = 0x045C;
  15719. t['klinebelow'] = 0x1E35;
  15720. t['klsquare'] = 0x3398;
  15721. t['kmcubedsquare'] = 0x33A6;
  15722. t['kmonospace'] = 0xFF4B;
  15723. t['kmsquaredsquare'] = 0x33A2;
  15724. t['kohiragana'] = 0x3053;
  15725. t['kohmsquare'] = 0x33C0;
  15726. t['kokaithai'] = 0x0E01;
  15727. t['kokatakana'] = 0x30B3;
  15728. t['kokatakanahalfwidth'] = 0xFF7A;
  15729. t['kooposquare'] = 0x331E;
  15730. t['koppacyrillic'] = 0x0481;
  15731. t['koreanstandardsymbol'] = 0x327F;
  15732. t['koroniscmb'] = 0x0343;
  15733. t['kparen'] = 0x24A6;
  15734. t['kpasquare'] = 0x33AA;
  15735. t['ksicyrillic'] = 0x046F;
  15736. t['ktsquare'] = 0x33CF;
  15737. t['kturned'] = 0x029E;
  15738. t['kuhiragana'] = 0x304F;
  15739. t['kukatakana'] = 0x30AF;
  15740. t['kukatakanahalfwidth'] = 0xFF78;
  15741. t['kvsquare'] = 0x33B8;
  15742. t['kwsquare'] = 0x33BE;
  15743. t['l'] = 0x006C;
  15744. t['labengali'] = 0x09B2;
  15745. t['lacute'] = 0x013A;
  15746. t['ladeva'] = 0x0932;
  15747. t['lagujarati'] = 0x0AB2;
  15748. t['lagurmukhi'] = 0x0A32;
  15749. t['lakkhangyaothai'] = 0x0E45;
  15750. t['lamaleffinalarabic'] = 0xFEFC;
  15751. t['lamalefhamzaabovefinalarabic'] = 0xFEF8;
  15752. t['lamalefhamzaaboveisolatedarabic'] = 0xFEF7;
  15753. t['lamalefhamzabelowfinalarabic'] = 0xFEFA;
  15754. t['lamalefhamzabelowisolatedarabic'] = 0xFEF9;
  15755. t['lamalefisolatedarabic'] = 0xFEFB;
  15756. t['lamalefmaddaabovefinalarabic'] = 0xFEF6;
  15757. t['lamalefmaddaaboveisolatedarabic'] = 0xFEF5;
  15758. t['lamarabic'] = 0x0644;
  15759. t['lambda'] = 0x03BB;
  15760. t['lambdastroke'] = 0x019B;
  15761. t['lamed'] = 0x05DC;
  15762. t['lameddagesh'] = 0xFB3C;
  15763. t['lameddageshhebrew'] = 0xFB3C;
  15764. t['lamedhebrew'] = 0x05DC;
  15765. t['lamfinalarabic'] = 0xFEDE;
  15766. t['lamhahinitialarabic'] = 0xFCCA;
  15767. t['laminitialarabic'] = 0xFEDF;
  15768. t['lamjeeminitialarabic'] = 0xFCC9;
  15769. t['lamkhahinitialarabic'] = 0xFCCB;
  15770. t['lamlamhehisolatedarabic'] = 0xFDF2;
  15771. t['lammedialarabic'] = 0xFEE0;
  15772. t['lammeemhahinitialarabic'] = 0xFD88;
  15773. t['lammeeminitialarabic'] = 0xFCCC;
  15774. t['largecircle'] = 0x25EF;
  15775. t['lbar'] = 0x019A;
  15776. t['lbelt'] = 0x026C;
  15777. t['lbopomofo'] = 0x310C;
  15778. t['lcaron'] = 0x013E;
  15779. t['lcedilla'] = 0x013C;
  15780. t['lcircle'] = 0x24DB;
  15781. t['lcircumflexbelow'] = 0x1E3D;
  15782. t['lcommaaccent'] = 0x013C;
  15783. t['ldot'] = 0x0140;
  15784. t['ldotaccent'] = 0x0140;
  15785. t['ldotbelow'] = 0x1E37;
  15786. t['ldotbelowmacron'] = 0x1E39;
  15787. t['leftangleabovecmb'] = 0x031A;
  15788. t['lefttackbelowcmb'] = 0x0318;
  15789. t['less'] = 0x003C;
  15790. t['lessequal'] = 0x2264;
  15791. t['lessequalorgreater'] = 0x22DA;
  15792. t['lessmonospace'] = 0xFF1C;
  15793. t['lessorequivalent'] = 0x2272;
  15794. t['lessorgreater'] = 0x2276;
  15795. t['lessoverequal'] = 0x2266;
  15796. t['lesssmall'] = 0xFE64;
  15797. t['lezh'] = 0x026E;
  15798. t['lfblock'] = 0x258C;
  15799. t['lhookretroflex'] = 0x026D;
  15800. t['lira'] = 0x20A4;
  15801. t['liwnarmenian'] = 0x056C;
  15802. t['lj'] = 0x01C9;
  15803. t['ljecyrillic'] = 0x0459;
  15804. t['ll'] = 0xF6C0;
  15805. t['lladeva'] = 0x0933;
  15806. t['llagujarati'] = 0x0AB3;
  15807. t['llinebelow'] = 0x1E3B;
  15808. t['llladeva'] = 0x0934;
  15809. t['llvocalicbengali'] = 0x09E1;
  15810. t['llvocalicdeva'] = 0x0961;
  15811. t['llvocalicvowelsignbengali'] = 0x09E3;
  15812. t['llvocalicvowelsigndeva'] = 0x0963;
  15813. t['lmiddletilde'] = 0x026B;
  15814. t['lmonospace'] = 0xFF4C;
  15815. t['lmsquare'] = 0x33D0;
  15816. t['lochulathai'] = 0x0E2C;
  15817. t['logicaland'] = 0x2227;
  15818. t['logicalnot'] = 0x00AC;
  15819. t['logicalnotreversed'] = 0x2310;
  15820. t['logicalor'] = 0x2228;
  15821. t['lolingthai'] = 0x0E25;
  15822. t['longs'] = 0x017F;
  15823. t['lowlinecenterline'] = 0xFE4E;
  15824. t['lowlinecmb'] = 0x0332;
  15825. t['lowlinedashed'] = 0xFE4D;
  15826. t['lozenge'] = 0x25CA;
  15827. t['lparen'] = 0x24A7;
  15828. t['lslash'] = 0x0142;
  15829. t['lsquare'] = 0x2113;
  15830. t['lsuperior'] = 0xF6EE;
  15831. t['ltshade'] = 0x2591;
  15832. t['luthai'] = 0x0E26;
  15833. t['lvocalicbengali'] = 0x098C;
  15834. t['lvocalicdeva'] = 0x090C;
  15835. t['lvocalicvowelsignbengali'] = 0x09E2;
  15836. t['lvocalicvowelsigndeva'] = 0x0962;
  15837. t['lxsquare'] = 0x33D3;
  15838. t['m'] = 0x006D;
  15839. t['mabengali'] = 0x09AE;
  15840. t['macron'] = 0x00AF;
  15841. t['macronbelowcmb'] = 0x0331;
  15842. t['macroncmb'] = 0x0304;
  15843. t['macronlowmod'] = 0x02CD;
  15844. t['macronmonospace'] = 0xFFE3;
  15845. t['macute'] = 0x1E3F;
  15846. t['madeva'] = 0x092E;
  15847. t['magujarati'] = 0x0AAE;
  15848. t['magurmukhi'] = 0x0A2E;
  15849. t['mahapakhhebrew'] = 0x05A4;
  15850. t['mahapakhlefthebrew'] = 0x05A4;
  15851. t['mahiragana'] = 0x307E;
  15852. t['maichattawalowleftthai'] = 0xF895;
  15853. t['maichattawalowrightthai'] = 0xF894;
  15854. t['maichattawathai'] = 0x0E4B;
  15855. t['maichattawaupperleftthai'] = 0xF893;
  15856. t['maieklowleftthai'] = 0xF88C;
  15857. t['maieklowrightthai'] = 0xF88B;
  15858. t['maiekthai'] = 0x0E48;
  15859. t['maiekupperleftthai'] = 0xF88A;
  15860. t['maihanakatleftthai'] = 0xF884;
  15861. t['maihanakatthai'] = 0x0E31;
  15862. t['maitaikhuleftthai'] = 0xF889;
  15863. t['maitaikhuthai'] = 0x0E47;
  15864. t['maitholowleftthai'] = 0xF88F;
  15865. t['maitholowrightthai'] = 0xF88E;
  15866. t['maithothai'] = 0x0E49;
  15867. t['maithoupperleftthai'] = 0xF88D;
  15868. t['maitrilowleftthai'] = 0xF892;
  15869. t['maitrilowrightthai'] = 0xF891;
  15870. t['maitrithai'] = 0x0E4A;
  15871. t['maitriupperleftthai'] = 0xF890;
  15872. t['maiyamokthai'] = 0x0E46;
  15873. t['makatakana'] = 0x30DE;
  15874. t['makatakanahalfwidth'] = 0xFF8F;
  15875. t['male'] = 0x2642;
  15876. t['mansyonsquare'] = 0x3347;
  15877. t['maqafhebrew'] = 0x05BE;
  15878. t['mars'] = 0x2642;
  15879. t['masoracirclehebrew'] = 0x05AF;
  15880. t['masquare'] = 0x3383;
  15881. t['mbopomofo'] = 0x3107;
  15882. t['mbsquare'] = 0x33D4;
  15883. t['mcircle'] = 0x24DC;
  15884. t['mcubedsquare'] = 0x33A5;
  15885. t['mdotaccent'] = 0x1E41;
  15886. t['mdotbelow'] = 0x1E43;
  15887. t['meemarabic'] = 0x0645;
  15888. t['meemfinalarabic'] = 0xFEE2;
  15889. t['meeminitialarabic'] = 0xFEE3;
  15890. t['meemmedialarabic'] = 0xFEE4;
  15891. t['meemmeeminitialarabic'] = 0xFCD1;
  15892. t['meemmeemisolatedarabic'] = 0xFC48;
  15893. t['meetorusquare'] = 0x334D;
  15894. t['mehiragana'] = 0x3081;
  15895. t['meizierasquare'] = 0x337E;
  15896. t['mekatakana'] = 0x30E1;
  15897. t['mekatakanahalfwidth'] = 0xFF92;
  15898. t['mem'] = 0x05DE;
  15899. t['memdagesh'] = 0xFB3E;
  15900. t['memdageshhebrew'] = 0xFB3E;
  15901. t['memhebrew'] = 0x05DE;
  15902. t['menarmenian'] = 0x0574;
  15903. t['merkhahebrew'] = 0x05A5;
  15904. t['merkhakefulahebrew'] = 0x05A6;
  15905. t['merkhakefulalefthebrew'] = 0x05A6;
  15906. t['merkhalefthebrew'] = 0x05A5;
  15907. t['mhook'] = 0x0271;
  15908. t['mhzsquare'] = 0x3392;
  15909. t['middledotkatakanahalfwidth'] = 0xFF65;
  15910. t['middot'] = 0x00B7;
  15911. t['mieumacirclekorean'] = 0x3272;
  15912. t['mieumaparenkorean'] = 0x3212;
  15913. t['mieumcirclekorean'] = 0x3264;
  15914. t['mieumkorean'] = 0x3141;
  15915. t['mieumpansioskorean'] = 0x3170;
  15916. t['mieumparenkorean'] = 0x3204;
  15917. t['mieumpieupkorean'] = 0x316E;
  15918. t['mieumsioskorean'] = 0x316F;
  15919. t['mihiragana'] = 0x307F;
  15920. t['mikatakana'] = 0x30DF;
  15921. t['mikatakanahalfwidth'] = 0xFF90;
  15922. t['minus'] = 0x2212;
  15923. t['minusbelowcmb'] = 0x0320;
  15924. t['minuscircle'] = 0x2296;
  15925. t['minusmod'] = 0x02D7;
  15926. t['minusplus'] = 0x2213;
  15927. t['minute'] = 0x2032;
  15928. t['miribaarusquare'] = 0x334A;
  15929. t['mirisquare'] = 0x3349;
  15930. t['mlonglegturned'] = 0x0270;
  15931. t['mlsquare'] = 0x3396;
  15932. t['mmcubedsquare'] = 0x33A3;
  15933. t['mmonospace'] = 0xFF4D;
  15934. t['mmsquaredsquare'] = 0x339F;
  15935. t['mohiragana'] = 0x3082;
  15936. t['mohmsquare'] = 0x33C1;
  15937. t['mokatakana'] = 0x30E2;
  15938. t['mokatakanahalfwidth'] = 0xFF93;
  15939. t['molsquare'] = 0x33D6;
  15940. t['momathai'] = 0x0E21;
  15941. t['moverssquare'] = 0x33A7;
  15942. t['moverssquaredsquare'] = 0x33A8;
  15943. t['mparen'] = 0x24A8;
  15944. t['mpasquare'] = 0x33AB;
  15945. t['mssquare'] = 0x33B3;
  15946. t['msuperior'] = 0xF6EF;
  15947. t['mturned'] = 0x026F;
  15948. t['mu'] = 0x00B5;
  15949. t['mu1'] = 0x00B5;
  15950. t['muasquare'] = 0x3382;
  15951. t['muchgreater'] = 0x226B;
  15952. t['muchless'] = 0x226A;
  15953. t['mufsquare'] = 0x338C;
  15954. t['mugreek'] = 0x03BC;
  15955. t['mugsquare'] = 0x338D;
  15956. t['muhiragana'] = 0x3080;
  15957. t['mukatakana'] = 0x30E0;
  15958. t['mukatakanahalfwidth'] = 0xFF91;
  15959. t['mulsquare'] = 0x3395;
  15960. t['multiply'] = 0x00D7;
  15961. t['mumsquare'] = 0x339B;
  15962. t['munahhebrew'] = 0x05A3;
  15963. t['munahlefthebrew'] = 0x05A3;
  15964. t['musicalnote'] = 0x266A;
  15965. t['musicalnotedbl'] = 0x266B;
  15966. t['musicflatsign'] = 0x266D;
  15967. t['musicsharpsign'] = 0x266F;
  15968. t['mussquare'] = 0x33B2;
  15969. t['muvsquare'] = 0x33B6;
  15970. t['muwsquare'] = 0x33BC;
  15971. t['mvmegasquare'] = 0x33B9;
  15972. t['mvsquare'] = 0x33B7;
  15973. t['mwmegasquare'] = 0x33BF;
  15974. t['mwsquare'] = 0x33BD;
  15975. t['n'] = 0x006E;
  15976. t['nabengali'] = 0x09A8;
  15977. t['nabla'] = 0x2207;
  15978. t['nacute'] = 0x0144;
  15979. t['nadeva'] = 0x0928;
  15980. t['nagujarati'] = 0x0AA8;
  15981. t['nagurmukhi'] = 0x0A28;
  15982. t['nahiragana'] = 0x306A;
  15983. t['nakatakana'] = 0x30CA;
  15984. t['nakatakanahalfwidth'] = 0xFF85;
  15985. t['napostrophe'] = 0x0149;
  15986. t['nasquare'] = 0x3381;
  15987. t['nbopomofo'] = 0x310B;
  15988. t['nbspace'] = 0x00A0;
  15989. t['ncaron'] = 0x0148;
  15990. t['ncedilla'] = 0x0146;
  15991. t['ncircle'] = 0x24DD;
  15992. t['ncircumflexbelow'] = 0x1E4B;
  15993. t['ncommaaccent'] = 0x0146;
  15994. t['ndotaccent'] = 0x1E45;
  15995. t['ndotbelow'] = 0x1E47;
  15996. t['nehiragana'] = 0x306D;
  15997. t['nekatakana'] = 0x30CD;
  15998. t['nekatakanahalfwidth'] = 0xFF88;
  15999. t['newsheqelsign'] = 0x20AA;
  16000. t['nfsquare'] = 0x338B;
  16001. t['ngabengali'] = 0x0999;
  16002. t['ngadeva'] = 0x0919;
  16003. t['ngagujarati'] = 0x0A99;
  16004. t['ngagurmukhi'] = 0x0A19;
  16005. t['ngonguthai'] = 0x0E07;
  16006. t['nhiragana'] = 0x3093;
  16007. t['nhookleft'] = 0x0272;
  16008. t['nhookretroflex'] = 0x0273;
  16009. t['nieunacirclekorean'] = 0x326F;
  16010. t['nieunaparenkorean'] = 0x320F;
  16011. t['nieuncieuckorean'] = 0x3135;
  16012. t['nieuncirclekorean'] = 0x3261;
  16013. t['nieunhieuhkorean'] = 0x3136;
  16014. t['nieunkorean'] = 0x3134;
  16015. t['nieunpansioskorean'] = 0x3168;
  16016. t['nieunparenkorean'] = 0x3201;
  16017. t['nieunsioskorean'] = 0x3167;
  16018. t['nieuntikeutkorean'] = 0x3166;
  16019. t['nihiragana'] = 0x306B;
  16020. t['nikatakana'] = 0x30CB;
  16021. t['nikatakanahalfwidth'] = 0xFF86;
  16022. t['nikhahitleftthai'] = 0xF899;
  16023. t['nikhahitthai'] = 0x0E4D;
  16024. t['nine'] = 0x0039;
  16025. t['ninearabic'] = 0x0669;
  16026. t['ninebengali'] = 0x09EF;
  16027. t['ninecircle'] = 0x2468;
  16028. t['ninecircleinversesansserif'] = 0x2792;
  16029. t['ninedeva'] = 0x096F;
  16030. t['ninegujarati'] = 0x0AEF;
  16031. t['ninegurmukhi'] = 0x0A6F;
  16032. t['ninehackarabic'] = 0x0669;
  16033. t['ninehangzhou'] = 0x3029;
  16034. t['nineideographicparen'] = 0x3228;
  16035. t['nineinferior'] = 0x2089;
  16036. t['ninemonospace'] = 0xFF19;
  16037. t['nineoldstyle'] = 0xF739;
  16038. t['nineparen'] = 0x247C;
  16039. t['nineperiod'] = 0x2490;
  16040. t['ninepersian'] = 0x06F9;
  16041. t['nineroman'] = 0x2178;
  16042. t['ninesuperior'] = 0x2079;
  16043. t['nineteencircle'] = 0x2472;
  16044. t['nineteenparen'] = 0x2486;
  16045. t['nineteenperiod'] = 0x249A;
  16046. t['ninethai'] = 0x0E59;
  16047. t['nj'] = 0x01CC;
  16048. t['njecyrillic'] = 0x045A;
  16049. t['nkatakana'] = 0x30F3;
  16050. t['nkatakanahalfwidth'] = 0xFF9D;
  16051. t['nlegrightlong'] = 0x019E;
  16052. t['nlinebelow'] = 0x1E49;
  16053. t['nmonospace'] = 0xFF4E;
  16054. t['nmsquare'] = 0x339A;
  16055. t['nnabengali'] = 0x09A3;
  16056. t['nnadeva'] = 0x0923;
  16057. t['nnagujarati'] = 0x0AA3;
  16058. t['nnagurmukhi'] = 0x0A23;
  16059. t['nnnadeva'] = 0x0929;
  16060. t['nohiragana'] = 0x306E;
  16061. t['nokatakana'] = 0x30CE;
  16062. t['nokatakanahalfwidth'] = 0xFF89;
  16063. t['nonbreakingspace'] = 0x00A0;
  16064. t['nonenthai'] = 0x0E13;
  16065. t['nonuthai'] = 0x0E19;
  16066. t['noonarabic'] = 0x0646;
  16067. t['noonfinalarabic'] = 0xFEE6;
  16068. t['noonghunnaarabic'] = 0x06BA;
  16069. t['noonghunnafinalarabic'] = 0xFB9F;
  16070. t['nooninitialarabic'] = 0xFEE7;
  16071. t['noonjeeminitialarabic'] = 0xFCD2;
  16072. t['noonjeemisolatedarabic'] = 0xFC4B;
  16073. t['noonmedialarabic'] = 0xFEE8;
  16074. t['noonmeeminitialarabic'] = 0xFCD5;
  16075. t['noonmeemisolatedarabic'] = 0xFC4E;
  16076. t['noonnoonfinalarabic'] = 0xFC8D;
  16077. t['notcontains'] = 0x220C;
  16078. t['notelement'] = 0x2209;
  16079. t['notelementof'] = 0x2209;
  16080. t['notequal'] = 0x2260;
  16081. t['notgreater'] = 0x226F;
  16082. t['notgreaternorequal'] = 0x2271;
  16083. t['notgreaternorless'] = 0x2279;
  16084. t['notidentical'] = 0x2262;
  16085. t['notless'] = 0x226E;
  16086. t['notlessnorequal'] = 0x2270;
  16087. t['notparallel'] = 0x2226;
  16088. t['notprecedes'] = 0x2280;
  16089. t['notsubset'] = 0x2284;
  16090. t['notsucceeds'] = 0x2281;
  16091. t['notsuperset'] = 0x2285;
  16092. t['nowarmenian'] = 0x0576;
  16093. t['nparen'] = 0x24A9;
  16094. t['nssquare'] = 0x33B1;
  16095. t['nsuperior'] = 0x207F;
  16096. t['ntilde'] = 0x00F1;
  16097. t['nu'] = 0x03BD;
  16098. t['nuhiragana'] = 0x306C;
  16099. t['nukatakana'] = 0x30CC;
  16100. t['nukatakanahalfwidth'] = 0xFF87;
  16101. t['nuktabengali'] = 0x09BC;
  16102. t['nuktadeva'] = 0x093C;
  16103. t['nuktagujarati'] = 0x0ABC;
  16104. t['nuktagurmukhi'] = 0x0A3C;
  16105. t['numbersign'] = 0x0023;
  16106. t['numbersignmonospace'] = 0xFF03;
  16107. t['numbersignsmall'] = 0xFE5F;
  16108. t['numeralsigngreek'] = 0x0374;
  16109. t['numeralsignlowergreek'] = 0x0375;
  16110. t['numero'] = 0x2116;
  16111. t['nun'] = 0x05E0;
  16112. t['nundagesh'] = 0xFB40;
  16113. t['nundageshhebrew'] = 0xFB40;
  16114. t['nunhebrew'] = 0x05E0;
  16115. t['nvsquare'] = 0x33B5;
  16116. t['nwsquare'] = 0x33BB;
  16117. t['nyabengali'] = 0x099E;
  16118. t['nyadeva'] = 0x091E;
  16119. t['nyagujarati'] = 0x0A9E;
  16120. t['nyagurmukhi'] = 0x0A1E;
  16121. t['o'] = 0x006F;
  16122. t['oacute'] = 0x00F3;
  16123. t['oangthai'] = 0x0E2D;
  16124. t['obarred'] = 0x0275;
  16125. t['obarredcyrillic'] = 0x04E9;
  16126. t['obarreddieresiscyrillic'] = 0x04EB;
  16127. t['obengali'] = 0x0993;
  16128. t['obopomofo'] = 0x311B;
  16129. t['obreve'] = 0x014F;
  16130. t['ocandradeva'] = 0x0911;
  16131. t['ocandragujarati'] = 0x0A91;
  16132. t['ocandravowelsigndeva'] = 0x0949;
  16133. t['ocandravowelsigngujarati'] = 0x0AC9;
  16134. t['ocaron'] = 0x01D2;
  16135. t['ocircle'] = 0x24DE;
  16136. t['ocircumflex'] = 0x00F4;
  16137. t['ocircumflexacute'] = 0x1ED1;
  16138. t['ocircumflexdotbelow'] = 0x1ED9;
  16139. t['ocircumflexgrave'] = 0x1ED3;
  16140. t['ocircumflexhookabove'] = 0x1ED5;
  16141. t['ocircumflextilde'] = 0x1ED7;
  16142. t['ocyrillic'] = 0x043E;
  16143. t['odblacute'] = 0x0151;
  16144. t['odblgrave'] = 0x020D;
  16145. t['odeva'] = 0x0913;
  16146. t['odieresis'] = 0x00F6;
  16147. t['odieresiscyrillic'] = 0x04E7;
  16148. t['odotbelow'] = 0x1ECD;
  16149. t['oe'] = 0x0153;
  16150. t['oekorean'] = 0x315A;
  16151. t['ogonek'] = 0x02DB;
  16152. t['ogonekcmb'] = 0x0328;
  16153. t['ograve'] = 0x00F2;
  16154. t['ogujarati'] = 0x0A93;
  16155. t['oharmenian'] = 0x0585;
  16156. t['ohiragana'] = 0x304A;
  16157. t['ohookabove'] = 0x1ECF;
  16158. t['ohorn'] = 0x01A1;
  16159. t['ohornacute'] = 0x1EDB;
  16160. t['ohorndotbelow'] = 0x1EE3;
  16161. t['ohorngrave'] = 0x1EDD;
  16162. t['ohornhookabove'] = 0x1EDF;
  16163. t['ohorntilde'] = 0x1EE1;
  16164. t['ohungarumlaut'] = 0x0151;
  16165. t['oi'] = 0x01A3;
  16166. t['oinvertedbreve'] = 0x020F;
  16167. t['okatakana'] = 0x30AA;
  16168. t['okatakanahalfwidth'] = 0xFF75;
  16169. t['okorean'] = 0x3157;
  16170. t['olehebrew'] = 0x05AB;
  16171. t['omacron'] = 0x014D;
  16172. t['omacronacute'] = 0x1E53;
  16173. t['omacrongrave'] = 0x1E51;
  16174. t['omdeva'] = 0x0950;
  16175. t['omega'] = 0x03C9;
  16176. t['omega1'] = 0x03D6;
  16177. t['omegacyrillic'] = 0x0461;
  16178. t['omegalatinclosed'] = 0x0277;
  16179. t['omegaroundcyrillic'] = 0x047B;
  16180. t['omegatitlocyrillic'] = 0x047D;
  16181. t['omegatonos'] = 0x03CE;
  16182. t['omgujarati'] = 0x0AD0;
  16183. t['omicron'] = 0x03BF;
  16184. t['omicrontonos'] = 0x03CC;
  16185. t['omonospace'] = 0xFF4F;
  16186. t['one'] = 0x0031;
  16187. t['onearabic'] = 0x0661;
  16188. t['onebengali'] = 0x09E7;
  16189. t['onecircle'] = 0x2460;
  16190. t['onecircleinversesansserif'] = 0x278A;
  16191. t['onedeva'] = 0x0967;
  16192. t['onedotenleader'] = 0x2024;
  16193. t['oneeighth'] = 0x215B;
  16194. t['onefitted'] = 0xF6DC;
  16195. t['onegujarati'] = 0x0AE7;
  16196. t['onegurmukhi'] = 0x0A67;
  16197. t['onehackarabic'] = 0x0661;
  16198. t['onehalf'] = 0x00BD;
  16199. t['onehangzhou'] = 0x3021;
  16200. t['oneideographicparen'] = 0x3220;
  16201. t['oneinferior'] = 0x2081;
  16202. t['onemonospace'] = 0xFF11;
  16203. t['onenumeratorbengali'] = 0x09F4;
  16204. t['oneoldstyle'] = 0xF731;
  16205. t['oneparen'] = 0x2474;
  16206. t['oneperiod'] = 0x2488;
  16207. t['onepersian'] = 0x06F1;
  16208. t['onequarter'] = 0x00BC;
  16209. t['oneroman'] = 0x2170;
  16210. t['onesuperior'] = 0x00B9;
  16211. t['onethai'] = 0x0E51;
  16212. t['onethird'] = 0x2153;
  16213. t['oogonek'] = 0x01EB;
  16214. t['oogonekmacron'] = 0x01ED;
  16215. t['oogurmukhi'] = 0x0A13;
  16216. t['oomatragurmukhi'] = 0x0A4B;
  16217. t['oopen'] = 0x0254;
  16218. t['oparen'] = 0x24AA;
  16219. t['openbullet'] = 0x25E6;
  16220. t['option'] = 0x2325;
  16221. t['ordfeminine'] = 0x00AA;
  16222. t['ordmasculine'] = 0x00BA;
  16223. t['orthogonal'] = 0x221F;
  16224. t['oshortdeva'] = 0x0912;
  16225. t['oshortvowelsigndeva'] = 0x094A;
  16226. t['oslash'] = 0x00F8;
  16227. t['oslashacute'] = 0x01FF;
  16228. t['osmallhiragana'] = 0x3049;
  16229. t['osmallkatakana'] = 0x30A9;
  16230. t['osmallkatakanahalfwidth'] = 0xFF6B;
  16231. t['ostrokeacute'] = 0x01FF;
  16232. t['osuperior'] = 0xF6F0;
  16233. t['otcyrillic'] = 0x047F;
  16234. t['otilde'] = 0x00F5;
  16235. t['otildeacute'] = 0x1E4D;
  16236. t['otildedieresis'] = 0x1E4F;
  16237. t['oubopomofo'] = 0x3121;
  16238. t['overline'] = 0x203E;
  16239. t['overlinecenterline'] = 0xFE4A;
  16240. t['overlinecmb'] = 0x0305;
  16241. t['overlinedashed'] = 0xFE49;
  16242. t['overlinedblwavy'] = 0xFE4C;
  16243. t['overlinewavy'] = 0xFE4B;
  16244. t['overscore'] = 0x00AF;
  16245. t['ovowelsignbengali'] = 0x09CB;
  16246. t['ovowelsigndeva'] = 0x094B;
  16247. t['ovowelsigngujarati'] = 0x0ACB;
  16248. t['p'] = 0x0070;
  16249. t['paampssquare'] = 0x3380;
  16250. t['paasentosquare'] = 0x332B;
  16251. t['pabengali'] = 0x09AA;
  16252. t['pacute'] = 0x1E55;
  16253. t['padeva'] = 0x092A;
  16254. t['pagedown'] = 0x21DF;
  16255. t['pageup'] = 0x21DE;
  16256. t['pagujarati'] = 0x0AAA;
  16257. t['pagurmukhi'] = 0x0A2A;
  16258. t['pahiragana'] = 0x3071;
  16259. t['paiyannoithai'] = 0x0E2F;
  16260. t['pakatakana'] = 0x30D1;
  16261. t['palatalizationcyrilliccmb'] = 0x0484;
  16262. t['palochkacyrillic'] = 0x04C0;
  16263. t['pansioskorean'] = 0x317F;
  16264. t['paragraph'] = 0x00B6;
  16265. t['parallel'] = 0x2225;
  16266. t['parenleft'] = 0x0028;
  16267. t['parenleftaltonearabic'] = 0xFD3E;
  16268. t['parenleftbt'] = 0xF8ED;
  16269. t['parenleftex'] = 0xF8EC;
  16270. t['parenleftinferior'] = 0x208D;
  16271. t['parenleftmonospace'] = 0xFF08;
  16272. t['parenleftsmall'] = 0xFE59;
  16273. t['parenleftsuperior'] = 0x207D;
  16274. t['parenlefttp'] = 0xF8EB;
  16275. t['parenleftvertical'] = 0xFE35;
  16276. t['parenright'] = 0x0029;
  16277. t['parenrightaltonearabic'] = 0xFD3F;
  16278. t['parenrightbt'] = 0xF8F8;
  16279. t['parenrightex'] = 0xF8F7;
  16280. t['parenrightinferior'] = 0x208E;
  16281. t['parenrightmonospace'] = 0xFF09;
  16282. t['parenrightsmall'] = 0xFE5A;
  16283. t['parenrightsuperior'] = 0x207E;
  16284. t['parenrighttp'] = 0xF8F6;
  16285. t['parenrightvertical'] = 0xFE36;
  16286. t['partialdiff'] = 0x2202;
  16287. t['paseqhebrew'] = 0x05C0;
  16288. t['pashtahebrew'] = 0x0599;
  16289. t['pasquare'] = 0x33A9;
  16290. t['patah'] = 0x05B7;
  16291. t['patah11'] = 0x05B7;
  16292. t['patah1d'] = 0x05B7;
  16293. t['patah2a'] = 0x05B7;
  16294. t['patahhebrew'] = 0x05B7;
  16295. t['patahnarrowhebrew'] = 0x05B7;
  16296. t['patahquarterhebrew'] = 0x05B7;
  16297. t['patahwidehebrew'] = 0x05B7;
  16298. t['pazerhebrew'] = 0x05A1;
  16299. t['pbopomofo'] = 0x3106;
  16300. t['pcircle'] = 0x24DF;
  16301. t['pdotaccent'] = 0x1E57;
  16302. t['pe'] = 0x05E4;
  16303. t['pecyrillic'] = 0x043F;
  16304. t['pedagesh'] = 0xFB44;
  16305. t['pedageshhebrew'] = 0xFB44;
  16306. t['peezisquare'] = 0x333B;
  16307. t['pefinaldageshhebrew'] = 0xFB43;
  16308. t['peharabic'] = 0x067E;
  16309. t['peharmenian'] = 0x057A;
  16310. t['pehebrew'] = 0x05E4;
  16311. t['pehfinalarabic'] = 0xFB57;
  16312. t['pehinitialarabic'] = 0xFB58;
  16313. t['pehiragana'] = 0x307A;
  16314. t['pehmedialarabic'] = 0xFB59;
  16315. t['pekatakana'] = 0x30DA;
  16316. t['pemiddlehookcyrillic'] = 0x04A7;
  16317. t['perafehebrew'] = 0xFB4E;
  16318. t['percent'] = 0x0025;
  16319. t['percentarabic'] = 0x066A;
  16320. t['percentmonospace'] = 0xFF05;
  16321. t['percentsmall'] = 0xFE6A;
  16322. t['period'] = 0x002E;
  16323. t['periodarmenian'] = 0x0589;
  16324. t['periodcentered'] = 0x00B7;
  16325. t['periodhalfwidth'] = 0xFF61;
  16326. t['periodinferior'] = 0xF6E7;
  16327. t['periodmonospace'] = 0xFF0E;
  16328. t['periodsmall'] = 0xFE52;
  16329. t['periodsuperior'] = 0xF6E8;
  16330. t['perispomenigreekcmb'] = 0x0342;
  16331. t['perpendicular'] = 0x22A5;
  16332. t['perthousand'] = 0x2030;
  16333. t['peseta'] = 0x20A7;
  16334. t['pfsquare'] = 0x338A;
  16335. t['phabengali'] = 0x09AB;
  16336. t['phadeva'] = 0x092B;
  16337. t['phagujarati'] = 0x0AAB;
  16338. t['phagurmukhi'] = 0x0A2B;
  16339. t['phi'] = 0x03C6;
  16340. t['phi1'] = 0x03D5;
  16341. t['phieuphacirclekorean'] = 0x327A;
  16342. t['phieuphaparenkorean'] = 0x321A;
  16343. t['phieuphcirclekorean'] = 0x326C;
  16344. t['phieuphkorean'] = 0x314D;
  16345. t['phieuphparenkorean'] = 0x320C;
  16346. t['philatin'] = 0x0278;
  16347. t['phinthuthai'] = 0x0E3A;
  16348. t['phisymbolgreek'] = 0x03D5;
  16349. t['phook'] = 0x01A5;
  16350. t['phophanthai'] = 0x0E1E;
  16351. t['phophungthai'] = 0x0E1C;
  16352. t['phosamphaothai'] = 0x0E20;
  16353. t['pi'] = 0x03C0;
  16354. t['pieupacirclekorean'] = 0x3273;
  16355. t['pieupaparenkorean'] = 0x3213;
  16356. t['pieupcieuckorean'] = 0x3176;
  16357. t['pieupcirclekorean'] = 0x3265;
  16358. t['pieupkiyeokkorean'] = 0x3172;
  16359. t['pieupkorean'] = 0x3142;
  16360. t['pieupparenkorean'] = 0x3205;
  16361. t['pieupsioskiyeokkorean'] = 0x3174;
  16362. t['pieupsioskorean'] = 0x3144;
  16363. t['pieupsiostikeutkorean'] = 0x3175;
  16364. t['pieupthieuthkorean'] = 0x3177;
  16365. t['pieuptikeutkorean'] = 0x3173;
  16366. t['pihiragana'] = 0x3074;
  16367. t['pikatakana'] = 0x30D4;
  16368. t['pisymbolgreek'] = 0x03D6;
  16369. t['piwrarmenian'] = 0x0583;
  16370. t['plus'] = 0x002B;
  16371. t['plusbelowcmb'] = 0x031F;
  16372. t['pluscircle'] = 0x2295;
  16373. t['plusminus'] = 0x00B1;
  16374. t['plusmod'] = 0x02D6;
  16375. t['plusmonospace'] = 0xFF0B;
  16376. t['plussmall'] = 0xFE62;
  16377. t['plussuperior'] = 0x207A;
  16378. t['pmonospace'] = 0xFF50;
  16379. t['pmsquare'] = 0x33D8;
  16380. t['pohiragana'] = 0x307D;
  16381. t['pointingindexdownwhite'] = 0x261F;
  16382. t['pointingindexleftwhite'] = 0x261C;
  16383. t['pointingindexrightwhite'] = 0x261E;
  16384. t['pointingindexupwhite'] = 0x261D;
  16385. t['pokatakana'] = 0x30DD;
  16386. t['poplathai'] = 0x0E1B;
  16387. t['postalmark'] = 0x3012;
  16388. t['postalmarkface'] = 0x3020;
  16389. t['pparen'] = 0x24AB;
  16390. t['precedes'] = 0x227A;
  16391. t['prescription'] = 0x211E;
  16392. t['primemod'] = 0x02B9;
  16393. t['primereversed'] = 0x2035;
  16394. t['product'] = 0x220F;
  16395. t['projective'] = 0x2305;
  16396. t['prolongedkana'] = 0x30FC;
  16397. t['propellor'] = 0x2318;
  16398. t['propersubset'] = 0x2282;
  16399. t['propersuperset'] = 0x2283;
  16400. t['proportion'] = 0x2237;
  16401. t['proportional'] = 0x221D;
  16402. t['psi'] = 0x03C8;
  16403. t['psicyrillic'] = 0x0471;
  16404. t['psilipneumatacyrilliccmb'] = 0x0486;
  16405. t['pssquare'] = 0x33B0;
  16406. t['puhiragana'] = 0x3077;
  16407. t['pukatakana'] = 0x30D7;
  16408. t['pvsquare'] = 0x33B4;
  16409. t['pwsquare'] = 0x33BA;
  16410. t['q'] = 0x0071;
  16411. t['qadeva'] = 0x0958;
  16412. t['qadmahebrew'] = 0x05A8;
  16413. t['qafarabic'] = 0x0642;
  16414. t['qaffinalarabic'] = 0xFED6;
  16415. t['qafinitialarabic'] = 0xFED7;
  16416. t['qafmedialarabic'] = 0xFED8;
  16417. t['qamats'] = 0x05B8;
  16418. t['qamats10'] = 0x05B8;
  16419. t['qamats1a'] = 0x05B8;
  16420. t['qamats1c'] = 0x05B8;
  16421. t['qamats27'] = 0x05B8;
  16422. t['qamats29'] = 0x05B8;
  16423. t['qamats33'] = 0x05B8;
  16424. t['qamatsde'] = 0x05B8;
  16425. t['qamatshebrew'] = 0x05B8;
  16426. t['qamatsnarrowhebrew'] = 0x05B8;
  16427. t['qamatsqatanhebrew'] = 0x05B8;
  16428. t['qamatsqatannarrowhebrew'] = 0x05B8;
  16429. t['qamatsqatanquarterhebrew'] = 0x05B8;
  16430. t['qamatsqatanwidehebrew'] = 0x05B8;
  16431. t['qamatsquarterhebrew'] = 0x05B8;
  16432. t['qamatswidehebrew'] = 0x05B8;
  16433. t['qarneyparahebrew'] = 0x059F;
  16434. t['qbopomofo'] = 0x3111;
  16435. t['qcircle'] = 0x24E0;
  16436. t['qhook'] = 0x02A0;
  16437. t['qmonospace'] = 0xFF51;
  16438. t['qof'] = 0x05E7;
  16439. t['qofdagesh'] = 0xFB47;
  16440. t['qofdageshhebrew'] = 0xFB47;
  16441. t['qofhebrew'] = 0x05E7;
  16442. t['qparen'] = 0x24AC;
  16443. t['quarternote'] = 0x2669;
  16444. t['qubuts'] = 0x05BB;
  16445. t['qubuts18'] = 0x05BB;
  16446. t['qubuts25'] = 0x05BB;
  16447. t['qubuts31'] = 0x05BB;
  16448. t['qubutshebrew'] = 0x05BB;
  16449. t['qubutsnarrowhebrew'] = 0x05BB;
  16450. t['qubutsquarterhebrew'] = 0x05BB;
  16451. t['qubutswidehebrew'] = 0x05BB;
  16452. t['question'] = 0x003F;
  16453. t['questionarabic'] = 0x061F;
  16454. t['questionarmenian'] = 0x055E;
  16455. t['questiondown'] = 0x00BF;
  16456. t['questiondownsmall'] = 0xF7BF;
  16457. t['questiongreek'] = 0x037E;
  16458. t['questionmonospace'] = 0xFF1F;
  16459. t['questionsmall'] = 0xF73F;
  16460. t['quotedbl'] = 0x0022;
  16461. t['quotedblbase'] = 0x201E;
  16462. t['quotedblleft'] = 0x201C;
  16463. t['quotedblmonospace'] = 0xFF02;
  16464. t['quotedblprime'] = 0x301E;
  16465. t['quotedblprimereversed'] = 0x301D;
  16466. t['quotedblright'] = 0x201D;
  16467. t['quoteleft'] = 0x2018;
  16468. t['quoteleftreversed'] = 0x201B;
  16469. t['quotereversed'] = 0x201B;
  16470. t['quoteright'] = 0x2019;
  16471. t['quoterightn'] = 0x0149;
  16472. t['quotesinglbase'] = 0x201A;
  16473. t['quotesingle'] = 0x0027;
  16474. t['quotesinglemonospace'] = 0xFF07;
  16475. t['r'] = 0x0072;
  16476. t['raarmenian'] = 0x057C;
  16477. t['rabengali'] = 0x09B0;
  16478. t['racute'] = 0x0155;
  16479. t['radeva'] = 0x0930;
  16480. t['radical'] = 0x221A;
  16481. t['radicalex'] = 0xF8E5;
  16482. t['radoverssquare'] = 0x33AE;
  16483. t['radoverssquaredsquare'] = 0x33AF;
  16484. t['radsquare'] = 0x33AD;
  16485. t['rafe'] = 0x05BF;
  16486. t['rafehebrew'] = 0x05BF;
  16487. t['ragujarati'] = 0x0AB0;
  16488. t['ragurmukhi'] = 0x0A30;
  16489. t['rahiragana'] = 0x3089;
  16490. t['rakatakana'] = 0x30E9;
  16491. t['rakatakanahalfwidth'] = 0xFF97;
  16492. t['ralowerdiagonalbengali'] = 0x09F1;
  16493. t['ramiddlediagonalbengali'] = 0x09F0;
  16494. t['ramshorn'] = 0x0264;
  16495. t['ratio'] = 0x2236;
  16496. t['rbopomofo'] = 0x3116;
  16497. t['rcaron'] = 0x0159;
  16498. t['rcedilla'] = 0x0157;
  16499. t['rcircle'] = 0x24E1;
  16500. t['rcommaaccent'] = 0x0157;
  16501. t['rdblgrave'] = 0x0211;
  16502. t['rdotaccent'] = 0x1E59;
  16503. t['rdotbelow'] = 0x1E5B;
  16504. t['rdotbelowmacron'] = 0x1E5D;
  16505. t['referencemark'] = 0x203B;
  16506. t['reflexsubset'] = 0x2286;
  16507. t['reflexsuperset'] = 0x2287;
  16508. t['registered'] = 0x00AE;
  16509. t['registersans'] = 0xF8E8;
  16510. t['registerserif'] = 0xF6DA;
  16511. t['reharabic'] = 0x0631;
  16512. t['reharmenian'] = 0x0580;
  16513. t['rehfinalarabic'] = 0xFEAE;
  16514. t['rehiragana'] = 0x308C;
  16515. t['rekatakana'] = 0x30EC;
  16516. t['rekatakanahalfwidth'] = 0xFF9A;
  16517. t['resh'] = 0x05E8;
  16518. t['reshdageshhebrew'] = 0xFB48;
  16519. t['reshhebrew'] = 0x05E8;
  16520. t['reversedtilde'] = 0x223D;
  16521. t['reviahebrew'] = 0x0597;
  16522. t['reviamugrashhebrew'] = 0x0597;
  16523. t['revlogicalnot'] = 0x2310;
  16524. t['rfishhook'] = 0x027E;
  16525. t['rfishhookreversed'] = 0x027F;
  16526. t['rhabengali'] = 0x09DD;
  16527. t['rhadeva'] = 0x095D;
  16528. t['rho'] = 0x03C1;
  16529. t['rhook'] = 0x027D;
  16530. t['rhookturned'] = 0x027B;
  16531. t['rhookturnedsuperior'] = 0x02B5;
  16532. t['rhosymbolgreek'] = 0x03F1;
  16533. t['rhotichookmod'] = 0x02DE;
  16534. t['rieulacirclekorean'] = 0x3271;
  16535. t['rieulaparenkorean'] = 0x3211;
  16536. t['rieulcirclekorean'] = 0x3263;
  16537. t['rieulhieuhkorean'] = 0x3140;
  16538. t['rieulkiyeokkorean'] = 0x313A;
  16539. t['rieulkiyeoksioskorean'] = 0x3169;
  16540. t['rieulkorean'] = 0x3139;
  16541. t['rieulmieumkorean'] = 0x313B;
  16542. t['rieulpansioskorean'] = 0x316C;
  16543. t['rieulparenkorean'] = 0x3203;
  16544. t['rieulphieuphkorean'] = 0x313F;
  16545. t['rieulpieupkorean'] = 0x313C;
  16546. t['rieulpieupsioskorean'] = 0x316B;
  16547. t['rieulsioskorean'] = 0x313D;
  16548. t['rieulthieuthkorean'] = 0x313E;
  16549. t['rieultikeutkorean'] = 0x316A;
  16550. t['rieulyeorinhieuhkorean'] = 0x316D;
  16551. t['rightangle'] = 0x221F;
  16552. t['righttackbelowcmb'] = 0x0319;
  16553. t['righttriangle'] = 0x22BF;
  16554. t['rihiragana'] = 0x308A;
  16555. t['rikatakana'] = 0x30EA;
  16556. t['rikatakanahalfwidth'] = 0xFF98;
  16557. t['ring'] = 0x02DA;
  16558. t['ringbelowcmb'] = 0x0325;
  16559. t['ringcmb'] = 0x030A;
  16560. t['ringhalfleft'] = 0x02BF;
  16561. t['ringhalfleftarmenian'] = 0x0559;
  16562. t['ringhalfleftbelowcmb'] = 0x031C;
  16563. t['ringhalfleftcentered'] = 0x02D3;
  16564. t['ringhalfright'] = 0x02BE;
  16565. t['ringhalfrightbelowcmb'] = 0x0339;
  16566. t['ringhalfrightcentered'] = 0x02D2;
  16567. t['rinvertedbreve'] = 0x0213;
  16568. t['rittorusquare'] = 0x3351;
  16569. t['rlinebelow'] = 0x1E5F;
  16570. t['rlongleg'] = 0x027C;
  16571. t['rlonglegturned'] = 0x027A;
  16572. t['rmonospace'] = 0xFF52;
  16573. t['rohiragana'] = 0x308D;
  16574. t['rokatakana'] = 0x30ED;
  16575. t['rokatakanahalfwidth'] = 0xFF9B;
  16576. t['roruathai'] = 0x0E23;
  16577. t['rparen'] = 0x24AD;
  16578. t['rrabengali'] = 0x09DC;
  16579. t['rradeva'] = 0x0931;
  16580. t['rragurmukhi'] = 0x0A5C;
  16581. t['rreharabic'] = 0x0691;
  16582. t['rrehfinalarabic'] = 0xFB8D;
  16583. t['rrvocalicbengali'] = 0x09E0;
  16584. t['rrvocalicdeva'] = 0x0960;
  16585. t['rrvocalicgujarati'] = 0x0AE0;
  16586. t['rrvocalicvowelsignbengali'] = 0x09C4;
  16587. t['rrvocalicvowelsigndeva'] = 0x0944;
  16588. t['rrvocalicvowelsigngujarati'] = 0x0AC4;
  16589. t['rsuperior'] = 0xF6F1;
  16590. t['rtblock'] = 0x2590;
  16591. t['rturned'] = 0x0279;
  16592. t['rturnedsuperior'] = 0x02B4;
  16593. t['ruhiragana'] = 0x308B;
  16594. t['rukatakana'] = 0x30EB;
  16595. t['rukatakanahalfwidth'] = 0xFF99;
  16596. t['rupeemarkbengali'] = 0x09F2;
  16597. t['rupeesignbengali'] = 0x09F3;
  16598. t['rupiah'] = 0xF6DD;
  16599. t['ruthai'] = 0x0E24;
  16600. t['rvocalicbengali'] = 0x098B;
  16601. t['rvocalicdeva'] = 0x090B;
  16602. t['rvocalicgujarati'] = 0x0A8B;
  16603. t['rvocalicvowelsignbengali'] = 0x09C3;
  16604. t['rvocalicvowelsigndeva'] = 0x0943;
  16605. t['rvocalicvowelsigngujarati'] = 0x0AC3;
  16606. t['s'] = 0x0073;
  16607. t['sabengali'] = 0x09B8;
  16608. t['sacute'] = 0x015B;
  16609. t['sacutedotaccent'] = 0x1E65;
  16610. t['sadarabic'] = 0x0635;
  16611. t['sadeva'] = 0x0938;
  16612. t['sadfinalarabic'] = 0xFEBA;
  16613. t['sadinitialarabic'] = 0xFEBB;
  16614. t['sadmedialarabic'] = 0xFEBC;
  16615. t['sagujarati'] = 0x0AB8;
  16616. t['sagurmukhi'] = 0x0A38;
  16617. t['sahiragana'] = 0x3055;
  16618. t['sakatakana'] = 0x30B5;
  16619. t['sakatakanahalfwidth'] = 0xFF7B;
  16620. t['sallallahoualayhewasallamarabic'] = 0xFDFA;
  16621. t['samekh'] = 0x05E1;
  16622. t['samekhdagesh'] = 0xFB41;
  16623. t['samekhdageshhebrew'] = 0xFB41;
  16624. t['samekhhebrew'] = 0x05E1;
  16625. t['saraaathai'] = 0x0E32;
  16626. t['saraaethai'] = 0x0E41;
  16627. t['saraaimaimalaithai'] = 0x0E44;
  16628. t['saraaimaimuanthai'] = 0x0E43;
  16629. t['saraamthai'] = 0x0E33;
  16630. t['saraathai'] = 0x0E30;
  16631. t['saraethai'] = 0x0E40;
  16632. t['saraiileftthai'] = 0xF886;
  16633. t['saraiithai'] = 0x0E35;
  16634. t['saraileftthai'] = 0xF885;
  16635. t['saraithai'] = 0x0E34;
  16636. t['saraothai'] = 0x0E42;
  16637. t['saraueeleftthai'] = 0xF888;
  16638. t['saraueethai'] = 0x0E37;
  16639. t['saraueleftthai'] = 0xF887;
  16640. t['sarauethai'] = 0x0E36;
  16641. t['sarauthai'] = 0x0E38;
  16642. t['sarauuthai'] = 0x0E39;
  16643. t['sbopomofo'] = 0x3119;
  16644. t['scaron'] = 0x0161;
  16645. t['scarondotaccent'] = 0x1E67;
  16646. t['scedilla'] = 0x015F;
  16647. t['schwa'] = 0x0259;
  16648. t['schwacyrillic'] = 0x04D9;
  16649. t['schwadieresiscyrillic'] = 0x04DB;
  16650. t['schwahook'] = 0x025A;
  16651. t['scircle'] = 0x24E2;
  16652. t['scircumflex'] = 0x015D;
  16653. t['scommaaccent'] = 0x0219;
  16654. t['sdotaccent'] = 0x1E61;
  16655. t['sdotbelow'] = 0x1E63;
  16656. t['sdotbelowdotaccent'] = 0x1E69;
  16657. t['seagullbelowcmb'] = 0x033C;
  16658. t['second'] = 0x2033;
  16659. t['secondtonechinese'] = 0x02CA;
  16660. t['section'] = 0x00A7;
  16661. t['seenarabic'] = 0x0633;
  16662. t['seenfinalarabic'] = 0xFEB2;
  16663. t['seeninitialarabic'] = 0xFEB3;
  16664. t['seenmedialarabic'] = 0xFEB4;
  16665. t['segol'] = 0x05B6;
  16666. t['segol13'] = 0x05B6;
  16667. t['segol1f'] = 0x05B6;
  16668. t['segol2c'] = 0x05B6;
  16669. t['segolhebrew'] = 0x05B6;
  16670. t['segolnarrowhebrew'] = 0x05B6;
  16671. t['segolquarterhebrew'] = 0x05B6;
  16672. t['segoltahebrew'] = 0x0592;
  16673. t['segolwidehebrew'] = 0x05B6;
  16674. t['seharmenian'] = 0x057D;
  16675. t['sehiragana'] = 0x305B;
  16676. t['sekatakana'] = 0x30BB;
  16677. t['sekatakanahalfwidth'] = 0xFF7E;
  16678. t['semicolon'] = 0x003B;
  16679. t['semicolonarabic'] = 0x061B;
  16680. t['semicolonmonospace'] = 0xFF1B;
  16681. t['semicolonsmall'] = 0xFE54;
  16682. t['semivoicedmarkkana'] = 0x309C;
  16683. t['semivoicedmarkkanahalfwidth'] = 0xFF9F;
  16684. t['sentisquare'] = 0x3322;
  16685. t['sentosquare'] = 0x3323;
  16686. t['seven'] = 0x0037;
  16687. t['sevenarabic'] = 0x0667;
  16688. t['sevenbengali'] = 0x09ED;
  16689. t['sevencircle'] = 0x2466;
  16690. t['sevencircleinversesansserif'] = 0x2790;
  16691. t['sevendeva'] = 0x096D;
  16692. t['seveneighths'] = 0x215E;
  16693. t['sevengujarati'] = 0x0AED;
  16694. t['sevengurmukhi'] = 0x0A6D;
  16695. t['sevenhackarabic'] = 0x0667;
  16696. t['sevenhangzhou'] = 0x3027;
  16697. t['sevenideographicparen'] = 0x3226;
  16698. t['seveninferior'] = 0x2087;
  16699. t['sevenmonospace'] = 0xFF17;
  16700. t['sevenoldstyle'] = 0xF737;
  16701. t['sevenparen'] = 0x247A;
  16702. t['sevenperiod'] = 0x248E;
  16703. t['sevenpersian'] = 0x06F7;
  16704. t['sevenroman'] = 0x2176;
  16705. t['sevensuperior'] = 0x2077;
  16706. t['seventeencircle'] = 0x2470;
  16707. t['seventeenparen'] = 0x2484;
  16708. t['seventeenperiod'] = 0x2498;
  16709. t['seventhai'] = 0x0E57;
  16710. t['sfthyphen'] = 0x00AD;
  16711. t['shaarmenian'] = 0x0577;
  16712. t['shabengali'] = 0x09B6;
  16713. t['shacyrillic'] = 0x0448;
  16714. t['shaddaarabic'] = 0x0651;
  16715. t['shaddadammaarabic'] = 0xFC61;
  16716. t['shaddadammatanarabic'] = 0xFC5E;
  16717. t['shaddafathaarabic'] = 0xFC60;
  16718. t['shaddakasraarabic'] = 0xFC62;
  16719. t['shaddakasratanarabic'] = 0xFC5F;
  16720. t['shade'] = 0x2592;
  16721. t['shadedark'] = 0x2593;
  16722. t['shadelight'] = 0x2591;
  16723. t['shademedium'] = 0x2592;
  16724. t['shadeva'] = 0x0936;
  16725. t['shagujarati'] = 0x0AB6;
  16726. t['shagurmukhi'] = 0x0A36;
  16727. t['shalshelethebrew'] = 0x0593;
  16728. t['shbopomofo'] = 0x3115;
  16729. t['shchacyrillic'] = 0x0449;
  16730. t['sheenarabic'] = 0x0634;
  16731. t['sheenfinalarabic'] = 0xFEB6;
  16732. t['sheeninitialarabic'] = 0xFEB7;
  16733. t['sheenmedialarabic'] = 0xFEB8;
  16734. t['sheicoptic'] = 0x03E3;
  16735. t['sheqel'] = 0x20AA;
  16736. t['sheqelhebrew'] = 0x20AA;
  16737. t['sheva'] = 0x05B0;
  16738. t['sheva115'] = 0x05B0;
  16739. t['sheva15'] = 0x05B0;
  16740. t['sheva22'] = 0x05B0;
  16741. t['sheva2e'] = 0x05B0;
  16742. t['shevahebrew'] = 0x05B0;
  16743. t['shevanarrowhebrew'] = 0x05B0;
  16744. t['shevaquarterhebrew'] = 0x05B0;
  16745. t['shevawidehebrew'] = 0x05B0;
  16746. t['shhacyrillic'] = 0x04BB;
  16747. t['shimacoptic'] = 0x03ED;
  16748. t['shin'] = 0x05E9;
  16749. t['shindagesh'] = 0xFB49;
  16750. t['shindageshhebrew'] = 0xFB49;
  16751. t['shindageshshindot'] = 0xFB2C;
  16752. t['shindageshshindothebrew'] = 0xFB2C;
  16753. t['shindageshsindot'] = 0xFB2D;
  16754. t['shindageshsindothebrew'] = 0xFB2D;
  16755. t['shindothebrew'] = 0x05C1;
  16756. t['shinhebrew'] = 0x05E9;
  16757. t['shinshindot'] = 0xFB2A;
  16758. t['shinshindothebrew'] = 0xFB2A;
  16759. t['shinsindot'] = 0xFB2B;
  16760. t['shinsindothebrew'] = 0xFB2B;
  16761. t['shook'] = 0x0282;
  16762. t['sigma'] = 0x03C3;
  16763. t['sigma1'] = 0x03C2;
  16764. t['sigmafinal'] = 0x03C2;
  16765. t['sigmalunatesymbolgreek'] = 0x03F2;
  16766. t['sihiragana'] = 0x3057;
  16767. t['sikatakana'] = 0x30B7;
  16768. t['sikatakanahalfwidth'] = 0xFF7C;
  16769. t['siluqhebrew'] = 0x05BD;
  16770. t['siluqlefthebrew'] = 0x05BD;
  16771. t['similar'] = 0x223C;
  16772. t['sindothebrew'] = 0x05C2;
  16773. t['siosacirclekorean'] = 0x3274;
  16774. t['siosaparenkorean'] = 0x3214;
  16775. t['sioscieuckorean'] = 0x317E;
  16776. t['sioscirclekorean'] = 0x3266;
  16777. t['sioskiyeokkorean'] = 0x317A;
  16778. t['sioskorean'] = 0x3145;
  16779. t['siosnieunkorean'] = 0x317B;
  16780. t['siosparenkorean'] = 0x3206;
  16781. t['siospieupkorean'] = 0x317D;
  16782. t['siostikeutkorean'] = 0x317C;
  16783. t['six'] = 0x0036;
  16784. t['sixarabic'] = 0x0666;
  16785. t['sixbengali'] = 0x09EC;
  16786. t['sixcircle'] = 0x2465;
  16787. t['sixcircleinversesansserif'] = 0x278F;
  16788. t['sixdeva'] = 0x096C;
  16789. t['sixgujarati'] = 0x0AEC;
  16790. t['sixgurmukhi'] = 0x0A6C;
  16791. t['sixhackarabic'] = 0x0666;
  16792. t['sixhangzhou'] = 0x3026;
  16793. t['sixideographicparen'] = 0x3225;
  16794. t['sixinferior'] = 0x2086;
  16795. t['sixmonospace'] = 0xFF16;
  16796. t['sixoldstyle'] = 0xF736;
  16797. t['sixparen'] = 0x2479;
  16798. t['sixperiod'] = 0x248D;
  16799. t['sixpersian'] = 0x06F6;
  16800. t['sixroman'] = 0x2175;
  16801. t['sixsuperior'] = 0x2076;
  16802. t['sixteencircle'] = 0x246F;
  16803. t['sixteencurrencydenominatorbengali'] = 0x09F9;
  16804. t['sixteenparen'] = 0x2483;
  16805. t['sixteenperiod'] = 0x2497;
  16806. t['sixthai'] = 0x0E56;
  16807. t['slash'] = 0x002F;
  16808. t['slashmonospace'] = 0xFF0F;
  16809. t['slong'] = 0x017F;
  16810. t['slongdotaccent'] = 0x1E9B;
  16811. t['smileface'] = 0x263A;
  16812. t['smonospace'] = 0xFF53;
  16813. t['sofpasuqhebrew'] = 0x05C3;
  16814. t['softhyphen'] = 0x00AD;
  16815. t['softsigncyrillic'] = 0x044C;
  16816. t['sohiragana'] = 0x305D;
  16817. t['sokatakana'] = 0x30BD;
  16818. t['sokatakanahalfwidth'] = 0xFF7F;
  16819. t['soliduslongoverlaycmb'] = 0x0338;
  16820. t['solidusshortoverlaycmb'] = 0x0337;
  16821. t['sorusithai'] = 0x0E29;
  16822. t['sosalathai'] = 0x0E28;
  16823. t['sosothai'] = 0x0E0B;
  16824. t['sosuathai'] = 0x0E2A;
  16825. t['space'] = 0x0020;
  16826. t['spacehackarabic'] = 0x0020;
  16827. t['spade'] = 0x2660;
  16828. t['spadesuitblack'] = 0x2660;
  16829. t['spadesuitwhite'] = 0x2664;
  16830. t['sparen'] = 0x24AE;
  16831. t['squarebelowcmb'] = 0x033B;
  16832. t['squarecc'] = 0x33C4;
  16833. t['squarecm'] = 0x339D;
  16834. t['squarediagonalcrosshatchfill'] = 0x25A9;
  16835. t['squarehorizontalfill'] = 0x25A4;
  16836. t['squarekg'] = 0x338F;
  16837. t['squarekm'] = 0x339E;
  16838. t['squarekmcapital'] = 0x33CE;
  16839. t['squareln'] = 0x33D1;
  16840. t['squarelog'] = 0x33D2;
  16841. t['squaremg'] = 0x338E;
  16842. t['squaremil'] = 0x33D5;
  16843. t['squaremm'] = 0x339C;
  16844. t['squaremsquared'] = 0x33A1;
  16845. t['squareorthogonalcrosshatchfill'] = 0x25A6;
  16846. t['squareupperlefttolowerrightfill'] = 0x25A7;
  16847. t['squareupperrighttolowerleftfill'] = 0x25A8;
  16848. t['squareverticalfill'] = 0x25A5;
  16849. t['squarewhitewithsmallblack'] = 0x25A3;
  16850. t['srsquare'] = 0x33DB;
  16851. t['ssabengali'] = 0x09B7;
  16852. t['ssadeva'] = 0x0937;
  16853. t['ssagujarati'] = 0x0AB7;
  16854. t['ssangcieuckorean'] = 0x3149;
  16855. t['ssanghieuhkorean'] = 0x3185;
  16856. t['ssangieungkorean'] = 0x3180;
  16857. t['ssangkiyeokkorean'] = 0x3132;
  16858. t['ssangnieunkorean'] = 0x3165;
  16859. t['ssangpieupkorean'] = 0x3143;
  16860. t['ssangsioskorean'] = 0x3146;
  16861. t['ssangtikeutkorean'] = 0x3138;
  16862. t['ssuperior'] = 0xF6F2;
  16863. t['sterling'] = 0x00A3;
  16864. t['sterlingmonospace'] = 0xFFE1;
  16865. t['strokelongoverlaycmb'] = 0x0336;
  16866. t['strokeshortoverlaycmb'] = 0x0335;
  16867. t['subset'] = 0x2282;
  16868. t['subsetnotequal'] = 0x228A;
  16869. t['subsetorequal'] = 0x2286;
  16870. t['succeeds'] = 0x227B;
  16871. t['suchthat'] = 0x220B;
  16872. t['suhiragana'] = 0x3059;
  16873. t['sukatakana'] = 0x30B9;
  16874. t['sukatakanahalfwidth'] = 0xFF7D;
  16875. t['sukunarabic'] = 0x0652;
  16876. t['summation'] = 0x2211;
  16877. t['sun'] = 0x263C;
  16878. t['superset'] = 0x2283;
  16879. t['supersetnotequal'] = 0x228B;
  16880. t['supersetorequal'] = 0x2287;
  16881. t['svsquare'] = 0x33DC;
  16882. t['syouwaerasquare'] = 0x337C;
  16883. t['t'] = 0x0074;
  16884. t['tabengali'] = 0x09A4;
  16885. t['tackdown'] = 0x22A4;
  16886. t['tackleft'] = 0x22A3;
  16887. t['tadeva'] = 0x0924;
  16888. t['tagujarati'] = 0x0AA4;
  16889. t['tagurmukhi'] = 0x0A24;
  16890. t['taharabic'] = 0x0637;
  16891. t['tahfinalarabic'] = 0xFEC2;
  16892. t['tahinitialarabic'] = 0xFEC3;
  16893. t['tahiragana'] = 0x305F;
  16894. t['tahmedialarabic'] = 0xFEC4;
  16895. t['taisyouerasquare'] = 0x337D;
  16896. t['takatakana'] = 0x30BF;
  16897. t['takatakanahalfwidth'] = 0xFF80;
  16898. t['tatweelarabic'] = 0x0640;
  16899. t['tau'] = 0x03C4;
  16900. t['tav'] = 0x05EA;
  16901. t['tavdages'] = 0xFB4A;
  16902. t['tavdagesh'] = 0xFB4A;
  16903. t['tavdageshhebrew'] = 0xFB4A;
  16904. t['tavhebrew'] = 0x05EA;
  16905. t['tbar'] = 0x0167;
  16906. t['tbopomofo'] = 0x310A;
  16907. t['tcaron'] = 0x0165;
  16908. t['tccurl'] = 0x02A8;
  16909. t['tcedilla'] = 0x0163;
  16910. t['tcheharabic'] = 0x0686;
  16911. t['tchehfinalarabic'] = 0xFB7B;
  16912. t['tchehinitialarabic'] = 0xFB7C;
  16913. t['tchehmedialarabic'] = 0xFB7D;
  16914. t['tcircle'] = 0x24E3;
  16915. t['tcircumflexbelow'] = 0x1E71;
  16916. t['tcommaaccent'] = 0x0163;
  16917. t['tdieresis'] = 0x1E97;
  16918. t['tdotaccent'] = 0x1E6B;
  16919. t['tdotbelow'] = 0x1E6D;
  16920. t['tecyrillic'] = 0x0442;
  16921. t['tedescendercyrillic'] = 0x04AD;
  16922. t['teharabic'] = 0x062A;
  16923. t['tehfinalarabic'] = 0xFE96;
  16924. t['tehhahinitialarabic'] = 0xFCA2;
  16925. t['tehhahisolatedarabic'] = 0xFC0C;
  16926. t['tehinitialarabic'] = 0xFE97;
  16927. t['tehiragana'] = 0x3066;
  16928. t['tehjeeminitialarabic'] = 0xFCA1;
  16929. t['tehjeemisolatedarabic'] = 0xFC0B;
  16930. t['tehmarbutaarabic'] = 0x0629;
  16931. t['tehmarbutafinalarabic'] = 0xFE94;
  16932. t['tehmedialarabic'] = 0xFE98;
  16933. t['tehmeeminitialarabic'] = 0xFCA4;
  16934. t['tehmeemisolatedarabic'] = 0xFC0E;
  16935. t['tehnoonfinalarabic'] = 0xFC73;
  16936. t['tekatakana'] = 0x30C6;
  16937. t['tekatakanahalfwidth'] = 0xFF83;
  16938. t['telephone'] = 0x2121;
  16939. t['telephoneblack'] = 0x260E;
  16940. t['telishagedolahebrew'] = 0x05A0;
  16941. t['telishaqetanahebrew'] = 0x05A9;
  16942. t['tencircle'] = 0x2469;
  16943. t['tenideographicparen'] = 0x3229;
  16944. t['tenparen'] = 0x247D;
  16945. t['tenperiod'] = 0x2491;
  16946. t['tenroman'] = 0x2179;
  16947. t['tesh'] = 0x02A7;
  16948. t['tet'] = 0x05D8;
  16949. t['tetdagesh'] = 0xFB38;
  16950. t['tetdageshhebrew'] = 0xFB38;
  16951. t['tethebrew'] = 0x05D8;
  16952. t['tetsecyrillic'] = 0x04B5;
  16953. t['tevirhebrew'] = 0x059B;
  16954. t['tevirlefthebrew'] = 0x059B;
  16955. t['thabengali'] = 0x09A5;
  16956. t['thadeva'] = 0x0925;
  16957. t['thagujarati'] = 0x0AA5;
  16958. t['thagurmukhi'] = 0x0A25;
  16959. t['thalarabic'] = 0x0630;
  16960. t['thalfinalarabic'] = 0xFEAC;
  16961. t['thanthakhatlowleftthai'] = 0xF898;
  16962. t['thanthakhatlowrightthai'] = 0xF897;
  16963. t['thanthakhatthai'] = 0x0E4C;
  16964. t['thanthakhatupperleftthai'] = 0xF896;
  16965. t['theharabic'] = 0x062B;
  16966. t['thehfinalarabic'] = 0xFE9A;
  16967. t['thehinitialarabic'] = 0xFE9B;
  16968. t['thehmedialarabic'] = 0xFE9C;
  16969. t['thereexists'] = 0x2203;
  16970. t['therefore'] = 0x2234;
  16971. t['theta'] = 0x03B8;
  16972. t['theta1'] = 0x03D1;
  16973. t['thetasymbolgreek'] = 0x03D1;
  16974. t['thieuthacirclekorean'] = 0x3279;
  16975. t['thieuthaparenkorean'] = 0x3219;
  16976. t['thieuthcirclekorean'] = 0x326B;
  16977. t['thieuthkorean'] = 0x314C;
  16978. t['thieuthparenkorean'] = 0x320B;
  16979. t['thirteencircle'] = 0x246C;
  16980. t['thirteenparen'] = 0x2480;
  16981. t['thirteenperiod'] = 0x2494;
  16982. t['thonangmonthothai'] = 0x0E11;
  16983. t['thook'] = 0x01AD;
  16984. t['thophuthaothai'] = 0x0E12;
  16985. t['thorn'] = 0x00FE;
  16986. t['thothahanthai'] = 0x0E17;
  16987. t['thothanthai'] = 0x0E10;
  16988. t['thothongthai'] = 0x0E18;
  16989. t['thothungthai'] = 0x0E16;
  16990. t['thousandcyrillic'] = 0x0482;
  16991. t['thousandsseparatorarabic'] = 0x066C;
  16992. t['thousandsseparatorpersian'] = 0x066C;
  16993. t['three'] = 0x0033;
  16994. t['threearabic'] = 0x0663;
  16995. t['threebengali'] = 0x09E9;
  16996. t['threecircle'] = 0x2462;
  16997. t['threecircleinversesansserif'] = 0x278C;
  16998. t['threedeva'] = 0x0969;
  16999. t['threeeighths'] = 0x215C;
  17000. t['threegujarati'] = 0x0AE9;
  17001. t['threegurmukhi'] = 0x0A69;
  17002. t['threehackarabic'] = 0x0663;
  17003. t['threehangzhou'] = 0x3023;
  17004. t['threeideographicparen'] = 0x3222;
  17005. t['threeinferior'] = 0x2083;
  17006. t['threemonospace'] = 0xFF13;
  17007. t['threenumeratorbengali'] = 0x09F6;
  17008. t['threeoldstyle'] = 0xF733;
  17009. t['threeparen'] = 0x2476;
  17010. t['threeperiod'] = 0x248A;
  17011. t['threepersian'] = 0x06F3;
  17012. t['threequarters'] = 0x00BE;
  17013. t['threequartersemdash'] = 0xF6DE;
  17014. t['threeroman'] = 0x2172;
  17015. t['threesuperior'] = 0x00B3;
  17016. t['threethai'] = 0x0E53;
  17017. t['thzsquare'] = 0x3394;
  17018. t['tihiragana'] = 0x3061;
  17019. t['tikatakana'] = 0x30C1;
  17020. t['tikatakanahalfwidth'] = 0xFF81;
  17021. t['tikeutacirclekorean'] = 0x3270;
  17022. t['tikeutaparenkorean'] = 0x3210;
  17023. t['tikeutcirclekorean'] = 0x3262;
  17024. t['tikeutkorean'] = 0x3137;
  17025. t['tikeutparenkorean'] = 0x3202;
  17026. t['tilde'] = 0x02DC;
  17027. t['tildebelowcmb'] = 0x0330;
  17028. t['tildecmb'] = 0x0303;
  17029. t['tildecomb'] = 0x0303;
  17030. t['tildedoublecmb'] = 0x0360;
  17031. t['tildeoperator'] = 0x223C;
  17032. t['tildeoverlaycmb'] = 0x0334;
  17033. t['tildeverticalcmb'] = 0x033E;
  17034. t['timescircle'] = 0x2297;
  17035. t['tipehahebrew'] = 0x0596;
  17036. t['tipehalefthebrew'] = 0x0596;
  17037. t['tippigurmukhi'] = 0x0A70;
  17038. t['titlocyrilliccmb'] = 0x0483;
  17039. t['tiwnarmenian'] = 0x057F;
  17040. t['tlinebelow'] = 0x1E6F;
  17041. t['tmonospace'] = 0xFF54;
  17042. t['toarmenian'] = 0x0569;
  17043. t['tohiragana'] = 0x3068;
  17044. t['tokatakana'] = 0x30C8;
  17045. t['tokatakanahalfwidth'] = 0xFF84;
  17046. t['tonebarextrahighmod'] = 0x02E5;
  17047. t['tonebarextralowmod'] = 0x02E9;
  17048. t['tonebarhighmod'] = 0x02E6;
  17049. t['tonebarlowmod'] = 0x02E8;
  17050. t['tonebarmidmod'] = 0x02E7;
  17051. t['tonefive'] = 0x01BD;
  17052. t['tonesix'] = 0x0185;
  17053. t['tonetwo'] = 0x01A8;
  17054. t['tonos'] = 0x0384;
  17055. t['tonsquare'] = 0x3327;
  17056. t['topatakthai'] = 0x0E0F;
  17057. t['tortoiseshellbracketleft'] = 0x3014;
  17058. t['tortoiseshellbracketleftsmall'] = 0xFE5D;
  17059. t['tortoiseshellbracketleftvertical'] = 0xFE39;
  17060. t['tortoiseshellbracketright'] = 0x3015;
  17061. t['tortoiseshellbracketrightsmall'] = 0xFE5E;
  17062. t['tortoiseshellbracketrightvertical'] = 0xFE3A;
  17063. t['totaothai'] = 0x0E15;
  17064. t['tpalatalhook'] = 0x01AB;
  17065. t['tparen'] = 0x24AF;
  17066. t['trademark'] = 0x2122;
  17067. t['trademarksans'] = 0xF8EA;
  17068. t['trademarkserif'] = 0xF6DB;
  17069. t['tretroflexhook'] = 0x0288;
  17070. t['triagdn'] = 0x25BC;
  17071. t['triaglf'] = 0x25C4;
  17072. t['triagrt'] = 0x25BA;
  17073. t['triagup'] = 0x25B2;
  17074. t['ts'] = 0x02A6;
  17075. t['tsadi'] = 0x05E6;
  17076. t['tsadidagesh'] = 0xFB46;
  17077. t['tsadidageshhebrew'] = 0xFB46;
  17078. t['tsadihebrew'] = 0x05E6;
  17079. t['tsecyrillic'] = 0x0446;
  17080. t['tsere'] = 0x05B5;
  17081. t['tsere12'] = 0x05B5;
  17082. t['tsere1e'] = 0x05B5;
  17083. t['tsere2b'] = 0x05B5;
  17084. t['tserehebrew'] = 0x05B5;
  17085. t['tserenarrowhebrew'] = 0x05B5;
  17086. t['tserequarterhebrew'] = 0x05B5;
  17087. t['tserewidehebrew'] = 0x05B5;
  17088. t['tshecyrillic'] = 0x045B;
  17089. t['tsuperior'] = 0xF6F3;
  17090. t['ttabengali'] = 0x099F;
  17091. t['ttadeva'] = 0x091F;
  17092. t['ttagujarati'] = 0x0A9F;
  17093. t['ttagurmukhi'] = 0x0A1F;
  17094. t['tteharabic'] = 0x0679;
  17095. t['ttehfinalarabic'] = 0xFB67;
  17096. t['ttehinitialarabic'] = 0xFB68;
  17097. t['ttehmedialarabic'] = 0xFB69;
  17098. t['tthabengali'] = 0x09A0;
  17099. t['tthadeva'] = 0x0920;
  17100. t['tthagujarati'] = 0x0AA0;
  17101. t['tthagurmukhi'] = 0x0A20;
  17102. t['tturned'] = 0x0287;
  17103. t['tuhiragana'] = 0x3064;
  17104. t['tukatakana'] = 0x30C4;
  17105. t['tukatakanahalfwidth'] = 0xFF82;
  17106. t['tusmallhiragana'] = 0x3063;
  17107. t['tusmallkatakana'] = 0x30C3;
  17108. t['tusmallkatakanahalfwidth'] = 0xFF6F;
  17109. t['twelvecircle'] = 0x246B;
  17110. t['twelveparen'] = 0x247F;
  17111. t['twelveperiod'] = 0x2493;
  17112. t['twelveroman'] = 0x217B;
  17113. t['twentycircle'] = 0x2473;
  17114. t['twentyhangzhou'] = 0x5344;
  17115. t['twentyparen'] = 0x2487;
  17116. t['twentyperiod'] = 0x249B;
  17117. t['two'] = 0x0032;
  17118. t['twoarabic'] = 0x0662;
  17119. t['twobengali'] = 0x09E8;
  17120. t['twocircle'] = 0x2461;
  17121. t['twocircleinversesansserif'] = 0x278B;
  17122. t['twodeva'] = 0x0968;
  17123. t['twodotenleader'] = 0x2025;
  17124. t['twodotleader'] = 0x2025;
  17125. t['twodotleadervertical'] = 0xFE30;
  17126. t['twogujarati'] = 0x0AE8;
  17127. t['twogurmukhi'] = 0x0A68;
  17128. t['twohackarabic'] = 0x0662;
  17129. t['twohangzhou'] = 0x3022;
  17130. t['twoideographicparen'] = 0x3221;
  17131. t['twoinferior'] = 0x2082;
  17132. t['twomonospace'] = 0xFF12;
  17133. t['twonumeratorbengali'] = 0x09F5;
  17134. t['twooldstyle'] = 0xF732;
  17135. t['twoparen'] = 0x2475;
  17136. t['twoperiod'] = 0x2489;
  17137. t['twopersian'] = 0x06F2;
  17138. t['tworoman'] = 0x2171;
  17139. t['twostroke'] = 0x01BB;
  17140. t['twosuperior'] = 0x00B2;
  17141. t['twothai'] = 0x0E52;
  17142. t['twothirds'] = 0x2154;
  17143. t['u'] = 0x0075;
  17144. t['uacute'] = 0x00FA;
  17145. t['ubar'] = 0x0289;
  17146. t['ubengali'] = 0x0989;
  17147. t['ubopomofo'] = 0x3128;
  17148. t['ubreve'] = 0x016D;
  17149. t['ucaron'] = 0x01D4;
  17150. t['ucircle'] = 0x24E4;
  17151. t['ucircumflex'] = 0x00FB;
  17152. t['ucircumflexbelow'] = 0x1E77;
  17153. t['ucyrillic'] = 0x0443;
  17154. t['udattadeva'] = 0x0951;
  17155. t['udblacute'] = 0x0171;
  17156. t['udblgrave'] = 0x0215;
  17157. t['udeva'] = 0x0909;
  17158. t['udieresis'] = 0x00FC;
  17159. t['udieresisacute'] = 0x01D8;
  17160. t['udieresisbelow'] = 0x1E73;
  17161. t['udieresiscaron'] = 0x01DA;
  17162. t['udieresiscyrillic'] = 0x04F1;
  17163. t['udieresisgrave'] = 0x01DC;
  17164. t['udieresismacron'] = 0x01D6;
  17165. t['udotbelow'] = 0x1EE5;
  17166. t['ugrave'] = 0x00F9;
  17167. t['ugujarati'] = 0x0A89;
  17168. t['ugurmukhi'] = 0x0A09;
  17169. t['uhiragana'] = 0x3046;
  17170. t['uhookabove'] = 0x1EE7;
  17171. t['uhorn'] = 0x01B0;
  17172. t['uhornacute'] = 0x1EE9;
  17173. t['uhorndotbelow'] = 0x1EF1;
  17174. t['uhorngrave'] = 0x1EEB;
  17175. t['uhornhookabove'] = 0x1EED;
  17176. t['uhorntilde'] = 0x1EEF;
  17177. t['uhungarumlaut'] = 0x0171;
  17178. t['uhungarumlautcyrillic'] = 0x04F3;
  17179. t['uinvertedbreve'] = 0x0217;
  17180. t['ukatakana'] = 0x30A6;
  17181. t['ukatakanahalfwidth'] = 0xFF73;
  17182. t['ukcyrillic'] = 0x0479;
  17183. t['ukorean'] = 0x315C;
  17184. t['umacron'] = 0x016B;
  17185. t['umacroncyrillic'] = 0x04EF;
  17186. t['umacrondieresis'] = 0x1E7B;
  17187. t['umatragurmukhi'] = 0x0A41;
  17188. t['umonospace'] = 0xFF55;
  17189. t['underscore'] = 0x005F;
  17190. t['underscoredbl'] = 0x2017;
  17191. t['underscoremonospace'] = 0xFF3F;
  17192. t['underscorevertical'] = 0xFE33;
  17193. t['underscorewavy'] = 0xFE4F;
  17194. t['union'] = 0x222A;
  17195. t['universal'] = 0x2200;
  17196. t['uogonek'] = 0x0173;
  17197. t['uparen'] = 0x24B0;
  17198. t['upblock'] = 0x2580;
  17199. t['upperdothebrew'] = 0x05C4;
  17200. t['upsilon'] = 0x03C5;
  17201. t['upsilondieresis'] = 0x03CB;
  17202. t['upsilondieresistonos'] = 0x03B0;
  17203. t['upsilonlatin'] = 0x028A;
  17204. t['upsilontonos'] = 0x03CD;
  17205. t['uptackbelowcmb'] = 0x031D;
  17206. t['uptackmod'] = 0x02D4;
  17207. t['uragurmukhi'] = 0x0A73;
  17208. t['uring'] = 0x016F;
  17209. t['ushortcyrillic'] = 0x045E;
  17210. t['usmallhiragana'] = 0x3045;
  17211. t['usmallkatakana'] = 0x30A5;
  17212. t['usmallkatakanahalfwidth'] = 0xFF69;
  17213. t['ustraightcyrillic'] = 0x04AF;
  17214. t['ustraightstrokecyrillic'] = 0x04B1;
  17215. t['utilde'] = 0x0169;
  17216. t['utildeacute'] = 0x1E79;
  17217. t['utildebelow'] = 0x1E75;
  17218. t['uubengali'] = 0x098A;
  17219. t['uudeva'] = 0x090A;
  17220. t['uugujarati'] = 0x0A8A;
  17221. t['uugurmukhi'] = 0x0A0A;
  17222. t['uumatragurmukhi'] = 0x0A42;
  17223. t['uuvowelsignbengali'] = 0x09C2;
  17224. t['uuvowelsigndeva'] = 0x0942;
  17225. t['uuvowelsigngujarati'] = 0x0AC2;
  17226. t['uvowelsignbengali'] = 0x09C1;
  17227. t['uvowelsigndeva'] = 0x0941;
  17228. t['uvowelsigngujarati'] = 0x0AC1;
  17229. t['v'] = 0x0076;
  17230. t['vadeva'] = 0x0935;
  17231. t['vagujarati'] = 0x0AB5;
  17232. t['vagurmukhi'] = 0x0A35;
  17233. t['vakatakana'] = 0x30F7;
  17234. t['vav'] = 0x05D5;
  17235. t['vavdagesh'] = 0xFB35;
  17236. t['vavdagesh65'] = 0xFB35;
  17237. t['vavdageshhebrew'] = 0xFB35;
  17238. t['vavhebrew'] = 0x05D5;
  17239. t['vavholam'] = 0xFB4B;
  17240. t['vavholamhebrew'] = 0xFB4B;
  17241. t['vavvavhebrew'] = 0x05F0;
  17242. t['vavyodhebrew'] = 0x05F1;
  17243. t['vcircle'] = 0x24E5;
  17244. t['vdotbelow'] = 0x1E7F;
  17245. t['vecyrillic'] = 0x0432;
  17246. t['veharabic'] = 0x06A4;
  17247. t['vehfinalarabic'] = 0xFB6B;
  17248. t['vehinitialarabic'] = 0xFB6C;
  17249. t['vehmedialarabic'] = 0xFB6D;
  17250. t['vekatakana'] = 0x30F9;
  17251. t['venus'] = 0x2640;
  17252. t['verticalbar'] = 0x007C;
  17253. t['verticallineabovecmb'] = 0x030D;
  17254. t['verticallinebelowcmb'] = 0x0329;
  17255. t['verticallinelowmod'] = 0x02CC;
  17256. t['verticallinemod'] = 0x02C8;
  17257. t['vewarmenian'] = 0x057E;
  17258. t['vhook'] = 0x028B;
  17259. t['vikatakana'] = 0x30F8;
  17260. t['viramabengali'] = 0x09CD;
  17261. t['viramadeva'] = 0x094D;
  17262. t['viramagujarati'] = 0x0ACD;
  17263. t['visargabengali'] = 0x0983;
  17264. t['visargadeva'] = 0x0903;
  17265. t['visargagujarati'] = 0x0A83;
  17266. t['vmonospace'] = 0xFF56;
  17267. t['voarmenian'] = 0x0578;
  17268. t['voicediterationhiragana'] = 0x309E;
  17269. t['voicediterationkatakana'] = 0x30FE;
  17270. t['voicedmarkkana'] = 0x309B;
  17271. t['voicedmarkkanahalfwidth'] = 0xFF9E;
  17272. t['vokatakana'] = 0x30FA;
  17273. t['vparen'] = 0x24B1;
  17274. t['vtilde'] = 0x1E7D;
  17275. t['vturned'] = 0x028C;
  17276. t['vuhiragana'] = 0x3094;
  17277. t['vukatakana'] = 0x30F4;
  17278. t['w'] = 0x0077;
  17279. t['wacute'] = 0x1E83;
  17280. t['waekorean'] = 0x3159;
  17281. t['wahiragana'] = 0x308F;
  17282. t['wakatakana'] = 0x30EF;
  17283. t['wakatakanahalfwidth'] = 0xFF9C;
  17284. t['wakorean'] = 0x3158;
  17285. t['wasmallhiragana'] = 0x308E;
  17286. t['wasmallkatakana'] = 0x30EE;
  17287. t['wattosquare'] = 0x3357;
  17288. t['wavedash'] = 0x301C;
  17289. t['wavyunderscorevertical'] = 0xFE34;
  17290. t['wawarabic'] = 0x0648;
  17291. t['wawfinalarabic'] = 0xFEEE;
  17292. t['wawhamzaabovearabic'] = 0x0624;
  17293. t['wawhamzaabovefinalarabic'] = 0xFE86;
  17294. t['wbsquare'] = 0x33DD;
  17295. t['wcircle'] = 0x24E6;
  17296. t['wcircumflex'] = 0x0175;
  17297. t['wdieresis'] = 0x1E85;
  17298. t['wdotaccent'] = 0x1E87;
  17299. t['wdotbelow'] = 0x1E89;
  17300. t['wehiragana'] = 0x3091;
  17301. t['weierstrass'] = 0x2118;
  17302. t['wekatakana'] = 0x30F1;
  17303. t['wekorean'] = 0x315E;
  17304. t['weokorean'] = 0x315D;
  17305. t['wgrave'] = 0x1E81;
  17306. t['whitebullet'] = 0x25E6;
  17307. t['whitecircle'] = 0x25CB;
  17308. t['whitecircleinverse'] = 0x25D9;
  17309. t['whitecornerbracketleft'] = 0x300E;
  17310. t['whitecornerbracketleftvertical'] = 0xFE43;
  17311. t['whitecornerbracketright'] = 0x300F;
  17312. t['whitecornerbracketrightvertical'] = 0xFE44;
  17313. t['whitediamond'] = 0x25C7;
  17314. t['whitediamondcontainingblacksmalldiamond'] = 0x25C8;
  17315. t['whitedownpointingsmalltriangle'] = 0x25BF;
  17316. t['whitedownpointingtriangle'] = 0x25BD;
  17317. t['whiteleftpointingsmalltriangle'] = 0x25C3;
  17318. t['whiteleftpointingtriangle'] = 0x25C1;
  17319. t['whitelenticularbracketleft'] = 0x3016;
  17320. t['whitelenticularbracketright'] = 0x3017;
  17321. t['whiterightpointingsmalltriangle'] = 0x25B9;
  17322. t['whiterightpointingtriangle'] = 0x25B7;
  17323. t['whitesmallsquare'] = 0x25AB;
  17324. t['whitesmilingface'] = 0x263A;
  17325. t['whitesquare'] = 0x25A1;
  17326. t['whitestar'] = 0x2606;
  17327. t['whitetelephone'] = 0x260F;
  17328. t['whitetortoiseshellbracketleft'] = 0x3018;
  17329. t['whitetortoiseshellbracketright'] = 0x3019;
  17330. t['whiteuppointingsmalltriangle'] = 0x25B5;
  17331. t['whiteuppointingtriangle'] = 0x25B3;
  17332. t['wihiragana'] = 0x3090;
  17333. t['wikatakana'] = 0x30F0;
  17334. t['wikorean'] = 0x315F;
  17335. t['wmonospace'] = 0xFF57;
  17336. t['wohiragana'] = 0x3092;
  17337. t['wokatakana'] = 0x30F2;
  17338. t['wokatakanahalfwidth'] = 0xFF66;
  17339. t['won'] = 0x20A9;
  17340. t['wonmonospace'] = 0xFFE6;
  17341. t['wowaenthai'] = 0x0E27;
  17342. t['wparen'] = 0x24B2;
  17343. t['wring'] = 0x1E98;
  17344. t['wsuperior'] = 0x02B7;
  17345. t['wturned'] = 0x028D;
  17346. t['wynn'] = 0x01BF;
  17347. t['x'] = 0x0078;
  17348. t['xabovecmb'] = 0x033D;
  17349. t['xbopomofo'] = 0x3112;
  17350. t['xcircle'] = 0x24E7;
  17351. t['xdieresis'] = 0x1E8D;
  17352. t['xdotaccent'] = 0x1E8B;
  17353. t['xeharmenian'] = 0x056D;
  17354. t['xi'] = 0x03BE;
  17355. t['xmonospace'] = 0xFF58;
  17356. t['xparen'] = 0x24B3;
  17357. t['xsuperior'] = 0x02E3;
  17358. t['y'] = 0x0079;
  17359. t['yaadosquare'] = 0x334E;
  17360. t['yabengali'] = 0x09AF;
  17361. t['yacute'] = 0x00FD;
  17362. t['yadeva'] = 0x092F;
  17363. t['yaekorean'] = 0x3152;
  17364. t['yagujarati'] = 0x0AAF;
  17365. t['yagurmukhi'] = 0x0A2F;
  17366. t['yahiragana'] = 0x3084;
  17367. t['yakatakana'] = 0x30E4;
  17368. t['yakatakanahalfwidth'] = 0xFF94;
  17369. t['yakorean'] = 0x3151;
  17370. t['yamakkanthai'] = 0x0E4E;
  17371. t['yasmallhiragana'] = 0x3083;
  17372. t['yasmallkatakana'] = 0x30E3;
  17373. t['yasmallkatakanahalfwidth'] = 0xFF6C;
  17374. t['yatcyrillic'] = 0x0463;
  17375. t['ycircle'] = 0x24E8;
  17376. t['ycircumflex'] = 0x0177;
  17377. t['ydieresis'] = 0x00FF;
  17378. t['ydotaccent'] = 0x1E8F;
  17379. t['ydotbelow'] = 0x1EF5;
  17380. t['yeharabic'] = 0x064A;
  17381. t['yehbarreearabic'] = 0x06D2;
  17382. t['yehbarreefinalarabic'] = 0xFBAF;
  17383. t['yehfinalarabic'] = 0xFEF2;
  17384. t['yehhamzaabovearabic'] = 0x0626;
  17385. t['yehhamzaabovefinalarabic'] = 0xFE8A;
  17386. t['yehhamzaaboveinitialarabic'] = 0xFE8B;
  17387. t['yehhamzaabovemedialarabic'] = 0xFE8C;
  17388. t['yehinitialarabic'] = 0xFEF3;
  17389. t['yehmedialarabic'] = 0xFEF4;
  17390. t['yehmeeminitialarabic'] = 0xFCDD;
  17391. t['yehmeemisolatedarabic'] = 0xFC58;
  17392. t['yehnoonfinalarabic'] = 0xFC94;
  17393. t['yehthreedotsbelowarabic'] = 0x06D1;
  17394. t['yekorean'] = 0x3156;
  17395. t['yen'] = 0x00A5;
  17396. t['yenmonospace'] = 0xFFE5;
  17397. t['yeokorean'] = 0x3155;
  17398. t['yeorinhieuhkorean'] = 0x3186;
  17399. t['yerahbenyomohebrew'] = 0x05AA;
  17400. t['yerahbenyomolefthebrew'] = 0x05AA;
  17401. t['yericyrillic'] = 0x044B;
  17402. t['yerudieresiscyrillic'] = 0x04F9;
  17403. t['yesieungkorean'] = 0x3181;
  17404. t['yesieungpansioskorean'] = 0x3183;
  17405. t['yesieungsioskorean'] = 0x3182;
  17406. t['yetivhebrew'] = 0x059A;
  17407. t['ygrave'] = 0x1EF3;
  17408. t['yhook'] = 0x01B4;
  17409. t['yhookabove'] = 0x1EF7;
  17410. t['yiarmenian'] = 0x0575;
  17411. t['yicyrillic'] = 0x0457;
  17412. t['yikorean'] = 0x3162;
  17413. t['yinyang'] = 0x262F;
  17414. t['yiwnarmenian'] = 0x0582;
  17415. t['ymonospace'] = 0xFF59;
  17416. t['yod'] = 0x05D9;
  17417. t['yoddagesh'] = 0xFB39;
  17418. t['yoddageshhebrew'] = 0xFB39;
  17419. t['yodhebrew'] = 0x05D9;
  17420. t['yodyodhebrew'] = 0x05F2;
  17421. t['yodyodpatahhebrew'] = 0xFB1F;
  17422. t['yohiragana'] = 0x3088;
  17423. t['yoikorean'] = 0x3189;
  17424. t['yokatakana'] = 0x30E8;
  17425. t['yokatakanahalfwidth'] = 0xFF96;
  17426. t['yokorean'] = 0x315B;
  17427. t['yosmallhiragana'] = 0x3087;
  17428. t['yosmallkatakana'] = 0x30E7;
  17429. t['yosmallkatakanahalfwidth'] = 0xFF6E;
  17430. t['yotgreek'] = 0x03F3;
  17431. t['yoyaekorean'] = 0x3188;
  17432. t['yoyakorean'] = 0x3187;
  17433. t['yoyakthai'] = 0x0E22;
  17434. t['yoyingthai'] = 0x0E0D;
  17435. t['yparen'] = 0x24B4;
  17436. t['ypogegrammeni'] = 0x037A;
  17437. t['ypogegrammenigreekcmb'] = 0x0345;
  17438. t['yr'] = 0x01A6;
  17439. t['yring'] = 0x1E99;
  17440. t['ysuperior'] = 0x02B8;
  17441. t['ytilde'] = 0x1EF9;
  17442. t['yturned'] = 0x028E;
  17443. t['yuhiragana'] = 0x3086;
  17444. t['yuikorean'] = 0x318C;
  17445. t['yukatakana'] = 0x30E6;
  17446. t['yukatakanahalfwidth'] = 0xFF95;
  17447. t['yukorean'] = 0x3160;
  17448. t['yusbigcyrillic'] = 0x046B;
  17449. t['yusbigiotifiedcyrillic'] = 0x046D;
  17450. t['yuslittlecyrillic'] = 0x0467;
  17451. t['yuslittleiotifiedcyrillic'] = 0x0469;
  17452. t['yusmallhiragana'] = 0x3085;
  17453. t['yusmallkatakana'] = 0x30E5;
  17454. t['yusmallkatakanahalfwidth'] = 0xFF6D;
  17455. t['yuyekorean'] = 0x318B;
  17456. t['yuyeokorean'] = 0x318A;
  17457. t['yyabengali'] = 0x09DF;
  17458. t['yyadeva'] = 0x095F;
  17459. t['z'] = 0x007A;
  17460. t['zaarmenian'] = 0x0566;
  17461. t['zacute'] = 0x017A;
  17462. t['zadeva'] = 0x095B;
  17463. t['zagurmukhi'] = 0x0A5B;
  17464. t['zaharabic'] = 0x0638;
  17465. t['zahfinalarabic'] = 0xFEC6;
  17466. t['zahinitialarabic'] = 0xFEC7;
  17467. t['zahiragana'] = 0x3056;
  17468. t['zahmedialarabic'] = 0xFEC8;
  17469. t['zainarabic'] = 0x0632;
  17470. t['zainfinalarabic'] = 0xFEB0;
  17471. t['zakatakana'] = 0x30B6;
  17472. t['zaqefgadolhebrew'] = 0x0595;
  17473. t['zaqefqatanhebrew'] = 0x0594;
  17474. t['zarqahebrew'] = 0x0598;
  17475. t['zayin'] = 0x05D6;
  17476. t['zayindagesh'] = 0xFB36;
  17477. t['zayindageshhebrew'] = 0xFB36;
  17478. t['zayinhebrew'] = 0x05D6;
  17479. t['zbopomofo'] = 0x3117;
  17480. t['zcaron'] = 0x017E;
  17481. t['zcircle'] = 0x24E9;
  17482. t['zcircumflex'] = 0x1E91;
  17483. t['zcurl'] = 0x0291;
  17484. t['zdot'] = 0x017C;
  17485. t['zdotaccent'] = 0x017C;
  17486. t['zdotbelow'] = 0x1E93;
  17487. t['zecyrillic'] = 0x0437;
  17488. t['zedescendercyrillic'] = 0x0499;
  17489. t['zedieresiscyrillic'] = 0x04DF;
  17490. t['zehiragana'] = 0x305C;
  17491. t['zekatakana'] = 0x30BC;
  17492. t['zero'] = 0x0030;
  17493. t['zeroarabic'] = 0x0660;
  17494. t['zerobengali'] = 0x09E6;
  17495. t['zerodeva'] = 0x0966;
  17496. t['zerogujarati'] = 0x0AE6;
  17497. t['zerogurmukhi'] = 0x0A66;
  17498. t['zerohackarabic'] = 0x0660;
  17499. t['zeroinferior'] = 0x2080;
  17500. t['zeromonospace'] = 0xFF10;
  17501. t['zerooldstyle'] = 0xF730;
  17502. t['zeropersian'] = 0x06F0;
  17503. t['zerosuperior'] = 0x2070;
  17504. t['zerothai'] = 0x0E50;
  17505. t['zerowidthjoiner'] = 0xFEFF;
  17506. t['zerowidthnonjoiner'] = 0x200C;
  17507. t['zerowidthspace'] = 0x200B;
  17508. t['zeta'] = 0x03B6;
  17509. t['zhbopomofo'] = 0x3113;
  17510. t['zhearmenian'] = 0x056A;
  17511. t['zhebrevecyrillic'] = 0x04C2;
  17512. t['zhecyrillic'] = 0x0436;
  17513. t['zhedescendercyrillic'] = 0x0497;
  17514. t['zhedieresiscyrillic'] = 0x04DD;
  17515. t['zihiragana'] = 0x3058;
  17516. t['zikatakana'] = 0x30B8;
  17517. t['zinorhebrew'] = 0x05AE;
  17518. t['zlinebelow'] = 0x1E95;
  17519. t['zmonospace'] = 0xFF5A;
  17520. t['zohiragana'] = 0x305E;
  17521. t['zokatakana'] = 0x30BE;
  17522. t['zparen'] = 0x24B5;
  17523. t['zretroflexhook'] = 0x0290;
  17524. t['zstroke'] = 0x01B6;
  17525. t['zuhiragana'] = 0x305A;
  17526. t['zukatakana'] = 0x30BA;
  17527. t['.notdef'] = 0x0000;
  17528. t['angbracketleftbig'] = 0x2329;
  17529. t['angbracketleftBig'] = 0x2329;
  17530. t['angbracketleftbigg'] = 0x2329;
  17531. t['angbracketleftBigg'] = 0x2329;
  17532. t['angbracketrightBig'] = 0x232A;
  17533. t['angbracketrightbig'] = 0x232A;
  17534. t['angbracketrightBigg'] = 0x232A;
  17535. t['angbracketrightbigg'] = 0x232A;
  17536. t['arrowhookleft'] = 0x21AA;
  17537. t['arrowhookright'] = 0x21A9;
  17538. t['arrowlefttophalf'] = 0x21BC;
  17539. t['arrowleftbothalf'] = 0x21BD;
  17540. t['arrownortheast'] = 0x2197;
  17541. t['arrownorthwest'] = 0x2196;
  17542. t['arrowrighttophalf'] = 0x21C0;
  17543. t['arrowrightbothalf'] = 0x21C1;
  17544. t['arrowsoutheast'] = 0x2198;
  17545. t['arrowsouthwest'] = 0x2199;
  17546. t['backslashbig'] = 0x2216;
  17547. t['backslashBig'] = 0x2216;
  17548. t['backslashBigg'] = 0x2216;
  17549. t['backslashbigg'] = 0x2216;
  17550. t['bardbl'] = 0x2016;
  17551. t['bracehtipdownleft'] = 0xFE37;
  17552. t['bracehtipdownright'] = 0xFE37;
  17553. t['bracehtipupleft'] = 0xFE38;
  17554. t['bracehtipupright'] = 0xFE38;
  17555. t['braceleftBig'] = 0x007B;
  17556. t['braceleftbig'] = 0x007B;
  17557. t['braceleftbigg'] = 0x007B;
  17558. t['braceleftBigg'] = 0x007B;
  17559. t['bracerightBig'] = 0x007D;
  17560. t['bracerightbig'] = 0x007D;
  17561. t['bracerightbigg'] = 0x007D;
  17562. t['bracerightBigg'] = 0x007D;
  17563. t['bracketleftbig'] = 0x005B;
  17564. t['bracketleftBig'] = 0x005B;
  17565. t['bracketleftbigg'] = 0x005B;
  17566. t['bracketleftBigg'] = 0x005B;
  17567. t['bracketrightBig'] = 0x005D;
  17568. t['bracketrightbig'] = 0x005D;
  17569. t['bracketrightbigg'] = 0x005D;
  17570. t['bracketrightBigg'] = 0x005D;
  17571. t['ceilingleftbig'] = 0x2308;
  17572. t['ceilingleftBig'] = 0x2308;
  17573. t['ceilingleftBigg'] = 0x2308;
  17574. t['ceilingleftbigg'] = 0x2308;
  17575. t['ceilingrightbig'] = 0x2309;
  17576. t['ceilingrightBig'] = 0x2309;
  17577. t['ceilingrightbigg'] = 0x2309;
  17578. t['ceilingrightBigg'] = 0x2309;
  17579. t['circledotdisplay'] = 0x2299;
  17580. t['circledottext'] = 0x2299;
  17581. t['circlemultiplydisplay'] = 0x2297;
  17582. t['circlemultiplytext'] = 0x2297;
  17583. t['circleplusdisplay'] = 0x2295;
  17584. t['circleplustext'] = 0x2295;
  17585. t['contintegraldisplay'] = 0x222E;
  17586. t['contintegraltext'] = 0x222E;
  17587. t['coproductdisplay'] = 0x2210;
  17588. t['coproducttext'] = 0x2210;
  17589. t['floorleftBig'] = 0x230A;
  17590. t['floorleftbig'] = 0x230A;
  17591. t['floorleftbigg'] = 0x230A;
  17592. t['floorleftBigg'] = 0x230A;
  17593. t['floorrightbig'] = 0x230B;
  17594. t['floorrightBig'] = 0x230B;
  17595. t['floorrightBigg'] = 0x230B;
  17596. t['floorrightbigg'] = 0x230B;
  17597. t['hatwide'] = 0x0302;
  17598. t['hatwider'] = 0x0302;
  17599. t['hatwidest'] = 0x0302;
  17600. t['intercal'] = 0x1D40;
  17601. t['integraldisplay'] = 0x222B;
  17602. t['integraltext'] = 0x222B;
  17603. t['intersectiondisplay'] = 0x22C2;
  17604. t['intersectiontext'] = 0x22C2;
  17605. t['logicalanddisplay'] = 0x2227;
  17606. t['logicalandtext'] = 0x2227;
  17607. t['logicalordisplay'] = 0x2228;
  17608. t['logicalortext'] = 0x2228;
  17609. t['parenleftBig'] = 0x0028;
  17610. t['parenleftbig'] = 0x0028;
  17611. t['parenleftBigg'] = 0x0028;
  17612. t['parenleftbigg'] = 0x0028;
  17613. t['parenrightBig'] = 0x0029;
  17614. t['parenrightbig'] = 0x0029;
  17615. t['parenrightBigg'] = 0x0029;
  17616. t['parenrightbigg'] = 0x0029;
  17617. t['prime'] = 0x2032;
  17618. t['productdisplay'] = 0x220F;
  17619. t['producttext'] = 0x220F;
  17620. t['radicalbig'] = 0x221A;
  17621. t['radicalBig'] = 0x221A;
  17622. t['radicalBigg'] = 0x221A;
  17623. t['radicalbigg'] = 0x221A;
  17624. t['radicalbt'] = 0x221A;
  17625. t['radicaltp'] = 0x221A;
  17626. t['radicalvertex'] = 0x221A;
  17627. t['slashbig'] = 0x002F;
  17628. t['slashBig'] = 0x002F;
  17629. t['slashBigg'] = 0x002F;
  17630. t['slashbigg'] = 0x002F;
  17631. t['summationdisplay'] = 0x2211;
  17632. t['summationtext'] = 0x2211;
  17633. t['tildewide'] = 0x02DC;
  17634. t['tildewider'] = 0x02DC;
  17635. t['tildewidest'] = 0x02DC;
  17636. t['uniondisplay'] = 0x22C3;
  17637. t['unionmultidisplay'] = 0x228E;
  17638. t['unionmultitext'] = 0x228E;
  17639. t['unionsqdisplay'] = 0x2294;
  17640. t['unionsqtext'] = 0x2294;
  17641. t['uniontext'] = 0x22C3;
  17642. t['vextenddouble'] = 0x2225;
  17643. t['vextendsingle'] = 0x2223;
  17644. });
  17645. var getDingbatsGlyphsUnicode = getLookupTableFactory(function (t) {
  17646. t['space'] = 0x0020;
  17647. t['a1'] = 0x2701;
  17648. t['a2'] = 0x2702;
  17649. t['a202'] = 0x2703;
  17650. t['a3'] = 0x2704;
  17651. t['a4'] = 0x260E;
  17652. t['a5'] = 0x2706;
  17653. t['a119'] = 0x2707;
  17654. t['a118'] = 0x2708;
  17655. t['a117'] = 0x2709;
  17656. t['a11'] = 0x261B;
  17657. t['a12'] = 0x261E;
  17658. t['a13'] = 0x270C;
  17659. t['a14'] = 0x270D;
  17660. t['a15'] = 0x270E;
  17661. t['a16'] = 0x270F;
  17662. t['a105'] = 0x2710;
  17663. t['a17'] = 0x2711;
  17664. t['a18'] = 0x2712;
  17665. t['a19'] = 0x2713;
  17666. t['a20'] = 0x2714;
  17667. t['a21'] = 0x2715;
  17668. t['a22'] = 0x2716;
  17669. t['a23'] = 0x2717;
  17670. t['a24'] = 0x2718;
  17671. t['a25'] = 0x2719;
  17672. t['a26'] = 0x271A;
  17673. t['a27'] = 0x271B;
  17674. t['a28'] = 0x271C;
  17675. t['a6'] = 0x271D;
  17676. t['a7'] = 0x271E;
  17677. t['a8'] = 0x271F;
  17678. t['a9'] = 0x2720;
  17679. t['a10'] = 0x2721;
  17680. t['a29'] = 0x2722;
  17681. t['a30'] = 0x2723;
  17682. t['a31'] = 0x2724;
  17683. t['a32'] = 0x2725;
  17684. t['a33'] = 0x2726;
  17685. t['a34'] = 0x2727;
  17686. t['a35'] = 0x2605;
  17687. t['a36'] = 0x2729;
  17688. t['a37'] = 0x272A;
  17689. t['a38'] = 0x272B;
  17690. t['a39'] = 0x272C;
  17691. t['a40'] = 0x272D;
  17692. t['a41'] = 0x272E;
  17693. t['a42'] = 0x272F;
  17694. t['a43'] = 0x2730;
  17695. t['a44'] = 0x2731;
  17696. t['a45'] = 0x2732;
  17697. t['a46'] = 0x2733;
  17698. t['a47'] = 0x2734;
  17699. t['a48'] = 0x2735;
  17700. t['a49'] = 0x2736;
  17701. t['a50'] = 0x2737;
  17702. t['a51'] = 0x2738;
  17703. t['a52'] = 0x2739;
  17704. t['a53'] = 0x273A;
  17705. t['a54'] = 0x273B;
  17706. t['a55'] = 0x273C;
  17707. t['a56'] = 0x273D;
  17708. t['a57'] = 0x273E;
  17709. t['a58'] = 0x273F;
  17710. t['a59'] = 0x2740;
  17711. t['a60'] = 0x2741;
  17712. t['a61'] = 0x2742;
  17713. t['a62'] = 0x2743;
  17714. t['a63'] = 0x2744;
  17715. t['a64'] = 0x2745;
  17716. t['a65'] = 0x2746;
  17717. t['a66'] = 0x2747;
  17718. t['a67'] = 0x2748;
  17719. t['a68'] = 0x2749;
  17720. t['a69'] = 0x274A;
  17721. t['a70'] = 0x274B;
  17722. t['a71'] = 0x25CF;
  17723. t['a72'] = 0x274D;
  17724. t['a73'] = 0x25A0;
  17725. t['a74'] = 0x274F;
  17726. t['a203'] = 0x2750;
  17727. t['a75'] = 0x2751;
  17728. t['a204'] = 0x2752;
  17729. t['a76'] = 0x25B2;
  17730. t['a77'] = 0x25BC;
  17731. t['a78'] = 0x25C6;
  17732. t['a79'] = 0x2756;
  17733. t['a81'] = 0x25D7;
  17734. t['a82'] = 0x2758;
  17735. t['a83'] = 0x2759;
  17736. t['a84'] = 0x275A;
  17737. t['a97'] = 0x275B;
  17738. t['a98'] = 0x275C;
  17739. t['a99'] = 0x275D;
  17740. t['a100'] = 0x275E;
  17741. t['a101'] = 0x2761;
  17742. t['a102'] = 0x2762;
  17743. t['a103'] = 0x2763;
  17744. t['a104'] = 0x2764;
  17745. t['a106'] = 0x2765;
  17746. t['a107'] = 0x2766;
  17747. t['a108'] = 0x2767;
  17748. t['a112'] = 0x2663;
  17749. t['a111'] = 0x2666;
  17750. t['a110'] = 0x2665;
  17751. t['a109'] = 0x2660;
  17752. t['a120'] = 0x2460;
  17753. t['a121'] = 0x2461;
  17754. t['a122'] = 0x2462;
  17755. t['a123'] = 0x2463;
  17756. t['a124'] = 0x2464;
  17757. t['a125'] = 0x2465;
  17758. t['a126'] = 0x2466;
  17759. t['a127'] = 0x2467;
  17760. t['a128'] = 0x2468;
  17761. t['a129'] = 0x2469;
  17762. t['a130'] = 0x2776;
  17763. t['a131'] = 0x2777;
  17764. t['a132'] = 0x2778;
  17765. t['a133'] = 0x2779;
  17766. t['a134'] = 0x277A;
  17767. t['a135'] = 0x277B;
  17768. t['a136'] = 0x277C;
  17769. t['a137'] = 0x277D;
  17770. t['a138'] = 0x277E;
  17771. t['a139'] = 0x277F;
  17772. t['a140'] = 0x2780;
  17773. t['a141'] = 0x2781;
  17774. t['a142'] = 0x2782;
  17775. t['a143'] = 0x2783;
  17776. t['a144'] = 0x2784;
  17777. t['a145'] = 0x2785;
  17778. t['a146'] = 0x2786;
  17779. t['a147'] = 0x2787;
  17780. t['a148'] = 0x2788;
  17781. t['a149'] = 0x2789;
  17782. t['a150'] = 0x278A;
  17783. t['a151'] = 0x278B;
  17784. t['a152'] = 0x278C;
  17785. t['a153'] = 0x278D;
  17786. t['a154'] = 0x278E;
  17787. t['a155'] = 0x278F;
  17788. t['a156'] = 0x2790;
  17789. t['a157'] = 0x2791;
  17790. t['a158'] = 0x2792;
  17791. t['a159'] = 0x2793;
  17792. t['a160'] = 0x2794;
  17793. t['a161'] = 0x2192;
  17794. t['a163'] = 0x2194;
  17795. t['a164'] = 0x2195;
  17796. t['a196'] = 0x2798;
  17797. t['a165'] = 0x2799;
  17798. t['a192'] = 0x279A;
  17799. t['a166'] = 0x279B;
  17800. t['a167'] = 0x279C;
  17801. t['a168'] = 0x279D;
  17802. t['a169'] = 0x279E;
  17803. t['a170'] = 0x279F;
  17804. t['a171'] = 0x27A0;
  17805. t['a172'] = 0x27A1;
  17806. t['a173'] = 0x27A2;
  17807. t['a162'] = 0x27A3;
  17808. t['a174'] = 0x27A4;
  17809. t['a175'] = 0x27A5;
  17810. t['a176'] = 0x27A6;
  17811. t['a177'] = 0x27A7;
  17812. t['a178'] = 0x27A8;
  17813. t['a179'] = 0x27A9;
  17814. t['a193'] = 0x27AA;
  17815. t['a180'] = 0x27AB;
  17816. t['a199'] = 0x27AC;
  17817. t['a181'] = 0x27AD;
  17818. t['a200'] = 0x27AE;
  17819. t['a182'] = 0x27AF;
  17820. t['a201'] = 0x27B1;
  17821. t['a183'] = 0x27B2;
  17822. t['a184'] = 0x27B3;
  17823. t['a197'] = 0x27B4;
  17824. t['a185'] = 0x27B5;
  17825. t['a194'] = 0x27B6;
  17826. t['a198'] = 0x27B7;
  17827. t['a186'] = 0x27B8;
  17828. t['a195'] = 0x27B9;
  17829. t['a187'] = 0x27BA;
  17830. t['a188'] = 0x27BB;
  17831. t['a189'] = 0x27BC;
  17832. t['a190'] = 0x27BD;
  17833. t['a191'] = 0x27BE;
  17834. t['a89'] = 0x2768;
  17835. t['a90'] = 0x2769;
  17836. t['a93'] = 0x276A;
  17837. t['a94'] = 0x276B;
  17838. t['a91'] = 0x276C;
  17839. t['a92'] = 0x276D;
  17840. t['a205'] = 0x276E;
  17841. t['a85'] = 0x276F;
  17842. t['a206'] = 0x2770;
  17843. t['a86'] = 0x2771;
  17844. t['a87'] = 0x2772;
  17845. t['a88'] = 0x2773;
  17846. t['a95'] = 0x2774;
  17847. t['a96'] = 0x2775;
  17848. t['.notdef'] = 0x0000;
  17849. });
  17850. exports.getGlyphsUnicode = getGlyphsUnicode;
  17851. exports.getDingbatsGlyphsUnicode = getDingbatsGlyphsUnicode;
  17852. /***/ }),
  17853. /* 8 */
  17854. /***/ (function(module, exports, __w_pdfjs_require__) {
  17855. "use strict";
  17856. var sharedUtil = __w_pdfjs_require__(0);
  17857. var corePrimitives = __w_pdfjs_require__(1);
  17858. var corePdfManager = __w_pdfjs_require__(33);
  17859. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  17860. var InvalidPDFException = sharedUtil.InvalidPDFException;
  17861. var MessageHandler = sharedUtil.MessageHandler;
  17862. var MissingPDFException = sharedUtil.MissingPDFException;
  17863. var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
  17864. var PasswordException = sharedUtil.PasswordException;
  17865. var UnknownErrorException = sharedUtil.UnknownErrorException;
  17866. var XRefParseException = sharedUtil.XRefParseException;
  17867. var arrayByteLength = sharedUtil.arrayByteLength;
  17868. var arraysToBytes = sharedUtil.arraysToBytes;
  17869. var assert = sharedUtil.assert;
  17870. var createPromiseCapability = sharedUtil.createPromiseCapability;
  17871. var info = sharedUtil.info;
  17872. var warn = sharedUtil.warn;
  17873. var setVerbosityLevel = sharedUtil.setVerbosityLevel;
  17874. var isNodeJS = sharedUtil.isNodeJS;
  17875. var Ref = corePrimitives.Ref;
  17876. var LocalPdfManager = corePdfManager.LocalPdfManager;
  17877. var NetworkPdfManager = corePdfManager.NetworkPdfManager;
  17878. var WorkerTask = function WorkerTaskClosure() {
  17879. function WorkerTask(name) {
  17880. this.name = name;
  17881. this.terminated = false;
  17882. this._capability = createPromiseCapability();
  17883. }
  17884. WorkerTask.prototype = {
  17885. get finished() {
  17886. return this._capability.promise;
  17887. },
  17888. finish: function () {
  17889. this._capability.resolve();
  17890. },
  17891. terminate: function () {
  17892. this.terminated = true;
  17893. },
  17894. ensureNotTerminated: function () {
  17895. if (this.terminated) {
  17896. throw new Error('Worker task was terminated');
  17897. }
  17898. }
  17899. };
  17900. return WorkerTask;
  17901. }();
  17902. var PDFWorkerStream = function PDFWorkerStreamClosure() {
  17903. function PDFWorkerStream(params, msgHandler) {
  17904. this._queuedChunks = [];
  17905. var initialData = params.initialData;
  17906. if (initialData && initialData.length > 0) {
  17907. this._queuedChunks.push(initialData);
  17908. }
  17909. this._msgHandler = msgHandler;
  17910. this._isRangeSupported = !params.disableRange;
  17911. this._isStreamingSupported = !params.disableStream;
  17912. this._contentLength = params.length;
  17913. this._fullRequestReader = null;
  17914. this._rangeReaders = [];
  17915. msgHandler.on('OnDataRange', this._onReceiveData.bind(this));
  17916. msgHandler.on('OnDataProgress', this._onProgress.bind(this));
  17917. }
  17918. PDFWorkerStream.prototype = {
  17919. _onReceiveData: function PDFWorkerStream_onReceiveData(args) {
  17920. if (args.begin === undefined) {
  17921. if (this._fullRequestReader) {
  17922. this._fullRequestReader._enqueue(args.chunk);
  17923. } else {
  17924. this._queuedChunks.push(args.chunk);
  17925. }
  17926. } else {
  17927. var found = this._rangeReaders.some(function (rangeReader) {
  17928. if (rangeReader._begin !== args.begin) {
  17929. return false;
  17930. }
  17931. rangeReader._enqueue(args.chunk);
  17932. return true;
  17933. });
  17934. assert(found);
  17935. }
  17936. },
  17937. _onProgress: function PDFWorkerStream_onProgress(evt) {
  17938. if (this._rangeReaders.length > 0) {
  17939. var firstReader = this._rangeReaders[0];
  17940. if (firstReader.onProgress) {
  17941. firstReader.onProgress({ loaded: evt.loaded });
  17942. }
  17943. }
  17944. },
  17945. _removeRangeReader: function PDFWorkerStream_removeRangeReader(reader) {
  17946. var i = this._rangeReaders.indexOf(reader);
  17947. if (i >= 0) {
  17948. this._rangeReaders.splice(i, 1);
  17949. }
  17950. },
  17951. getFullReader: function PDFWorkerStream_getFullReader() {
  17952. assert(!this._fullRequestReader);
  17953. var queuedChunks = this._queuedChunks;
  17954. this._queuedChunks = null;
  17955. return new PDFWorkerStreamReader(this, queuedChunks);
  17956. },
  17957. getRangeReader: function PDFWorkerStream_getRangeReader(begin, end) {
  17958. var reader = new PDFWorkerStreamRangeReader(this, begin, end);
  17959. this._msgHandler.send('RequestDataRange', {
  17960. begin: begin,
  17961. end: end
  17962. });
  17963. this._rangeReaders.push(reader);
  17964. return reader;
  17965. },
  17966. cancelAllRequests: function PDFWorkerStream_cancelAllRequests(reason) {
  17967. if (this._fullRequestReader) {
  17968. this._fullRequestReader.cancel(reason);
  17969. }
  17970. var readers = this._rangeReaders.slice(0);
  17971. readers.forEach(function (rangeReader) {
  17972. rangeReader.cancel(reason);
  17973. });
  17974. }
  17975. };
  17976. function PDFWorkerStreamReader(stream, queuedChunks) {
  17977. this._stream = stream;
  17978. this._done = false;
  17979. this._queuedChunks = queuedChunks || [];
  17980. this._requests = [];
  17981. this._headersReady = Promise.resolve();
  17982. stream._fullRequestReader = this;
  17983. this.onProgress = null;
  17984. }
  17985. PDFWorkerStreamReader.prototype = {
  17986. _enqueue: function PDFWorkerStreamReader_enqueue(chunk) {
  17987. if (this._done) {
  17988. return;
  17989. }
  17990. if (this._requests.length > 0) {
  17991. var requestCapability = this._requests.shift();
  17992. requestCapability.resolve({
  17993. value: chunk,
  17994. done: false
  17995. });
  17996. return;
  17997. }
  17998. this._queuedChunks.push(chunk);
  17999. },
  18000. get headersReady() {
  18001. return this._headersReady;
  18002. },
  18003. get isRangeSupported() {
  18004. return this._stream._isRangeSupported;
  18005. },
  18006. get isStreamingSupported() {
  18007. return this._stream._isStreamingSupported;
  18008. },
  18009. get contentLength() {
  18010. return this._stream._contentLength;
  18011. },
  18012. read: function PDFWorkerStreamReader_read() {
  18013. if (this._queuedChunks.length > 0) {
  18014. var chunk = this._queuedChunks.shift();
  18015. return Promise.resolve({
  18016. value: chunk,
  18017. done: false
  18018. });
  18019. }
  18020. if (this._done) {
  18021. return Promise.resolve({
  18022. value: undefined,
  18023. done: true
  18024. });
  18025. }
  18026. var requestCapability = createPromiseCapability();
  18027. this._requests.push(requestCapability);
  18028. return requestCapability.promise;
  18029. },
  18030. cancel: function PDFWorkerStreamReader_cancel(reason) {
  18031. this._done = true;
  18032. this._requests.forEach(function (requestCapability) {
  18033. requestCapability.resolve({
  18034. value: undefined,
  18035. done: true
  18036. });
  18037. });
  18038. this._requests = [];
  18039. }
  18040. };
  18041. function PDFWorkerStreamRangeReader(stream, begin, end) {
  18042. this._stream = stream;
  18043. this._begin = begin;
  18044. this._end = end;
  18045. this._queuedChunk = null;
  18046. this._requests = [];
  18047. this._done = false;
  18048. this.onProgress = null;
  18049. }
  18050. PDFWorkerStreamRangeReader.prototype = {
  18051. _enqueue: function PDFWorkerStreamRangeReader_enqueue(chunk) {
  18052. if (this._done) {
  18053. return;
  18054. }
  18055. if (this._requests.length === 0) {
  18056. this._queuedChunk = chunk;
  18057. } else {
  18058. var requestsCapability = this._requests.shift();
  18059. requestsCapability.resolve({
  18060. value: chunk,
  18061. done: false
  18062. });
  18063. this._requests.forEach(function (requestCapability) {
  18064. requestCapability.resolve({
  18065. value: undefined,
  18066. done: true
  18067. });
  18068. });
  18069. this._requests = [];
  18070. }
  18071. this._done = true;
  18072. this._stream._removeRangeReader(this);
  18073. },
  18074. get isStreamingSupported() {
  18075. return false;
  18076. },
  18077. read: function PDFWorkerStreamRangeReader_read() {
  18078. if (this._queuedChunk) {
  18079. return Promise.resolve({
  18080. value: this._queuedChunk,
  18081. done: false
  18082. });
  18083. }
  18084. if (this._done) {
  18085. return Promise.resolve({
  18086. value: undefined,
  18087. done: true
  18088. });
  18089. }
  18090. var requestCapability = createPromiseCapability();
  18091. this._requests.push(requestCapability);
  18092. return requestCapability.promise;
  18093. },
  18094. cancel: function PDFWorkerStreamRangeReader_cancel(reason) {
  18095. this._done = true;
  18096. this._requests.forEach(function (requestCapability) {
  18097. requestCapability.resolve({
  18098. value: undefined,
  18099. done: true
  18100. });
  18101. });
  18102. this._requests = [];
  18103. this._stream._removeRangeReader(this);
  18104. }
  18105. };
  18106. return PDFWorkerStream;
  18107. }();
  18108. var PDFNetworkStream;
  18109. function setPDFNetworkStreamClass(cls) {
  18110. PDFNetworkStream = cls;
  18111. }
  18112. var WorkerMessageHandler = {
  18113. setup: function wphSetup(handler, port) {
  18114. var testMessageProcessed = false;
  18115. handler.on('test', function wphSetupTest(data) {
  18116. if (testMessageProcessed) {
  18117. return;
  18118. }
  18119. testMessageProcessed = true;
  18120. if (!(data instanceof Uint8Array)) {
  18121. handler.send('test', 'main', false);
  18122. return;
  18123. }
  18124. var supportTransfers = data[0] === 255;
  18125. handler.postMessageTransfers = supportTransfers;
  18126. var xhr = new XMLHttpRequest();
  18127. var responseExists = 'response' in xhr;
  18128. try {
  18129. xhr.responseType;
  18130. } catch (e) {
  18131. responseExists = false;
  18132. }
  18133. if (!responseExists) {
  18134. handler.send('test', false);
  18135. return;
  18136. }
  18137. handler.send('test', {
  18138. supportTypedArray: true,
  18139. supportTransfers: supportTransfers
  18140. });
  18141. });
  18142. handler.on('configure', function wphConfigure(data) {
  18143. setVerbosityLevel(data.verbosity);
  18144. });
  18145. handler.on('GetDocRequest', function wphSetupDoc(data) {
  18146. return WorkerMessageHandler.createDocumentHandler(data, port);
  18147. });
  18148. },
  18149. createDocumentHandler: function wphCreateDocumentHandler(docParams, port) {
  18150. var pdfManager;
  18151. var terminated = false;
  18152. var cancelXHRs = null;
  18153. var WorkerTasks = [];
  18154. var docId = docParams.docId;
  18155. var docBaseUrl = docParams.docBaseUrl;
  18156. var workerHandlerName = docParams.docId + '_worker';
  18157. var handler = new MessageHandler(workerHandlerName, docId, port);
  18158. handler.postMessageTransfers = docParams.postMessageTransfers;
  18159. function ensureNotTerminated() {
  18160. if (terminated) {
  18161. throw new Error('Worker was terminated');
  18162. }
  18163. }
  18164. function startWorkerTask(task) {
  18165. WorkerTasks.push(task);
  18166. }
  18167. function finishWorkerTask(task) {
  18168. task.finish();
  18169. var i = WorkerTasks.indexOf(task);
  18170. WorkerTasks.splice(i, 1);
  18171. }
  18172. function loadDocument(recoveryMode) {
  18173. var loadDocumentCapability = createPromiseCapability();
  18174. var parseSuccess = function parseSuccess() {
  18175. var numPagesPromise = pdfManager.ensureDoc('numPages');
  18176. var fingerprintPromise = pdfManager.ensureDoc('fingerprint');
  18177. var encryptedPromise = pdfManager.ensureXRef('encrypt');
  18178. Promise.all([
  18179. numPagesPromise,
  18180. fingerprintPromise,
  18181. encryptedPromise
  18182. ]).then(function onDocReady(results) {
  18183. var doc = {
  18184. numPages: results[0],
  18185. fingerprint: results[1],
  18186. encrypted: !!results[2]
  18187. };
  18188. loadDocumentCapability.resolve(doc);
  18189. }, parseFailure);
  18190. };
  18191. var parseFailure = function parseFailure(e) {
  18192. loadDocumentCapability.reject(e);
  18193. };
  18194. pdfManager.ensureDoc('checkHeader', []).then(function () {
  18195. pdfManager.ensureDoc('parseStartXRef', []).then(function () {
  18196. pdfManager.ensureDoc('parse', [recoveryMode]).then(parseSuccess, parseFailure);
  18197. }, parseFailure);
  18198. }, parseFailure);
  18199. return loadDocumentCapability.promise;
  18200. }
  18201. function getPdfManager(data, evaluatorOptions) {
  18202. var pdfManagerCapability = createPromiseCapability();
  18203. var pdfManager;
  18204. var source = data.source;
  18205. if (source.data) {
  18206. try {
  18207. pdfManager = new LocalPdfManager(docId, source.data, source.password, evaluatorOptions, docBaseUrl);
  18208. pdfManagerCapability.resolve(pdfManager);
  18209. } catch (ex) {
  18210. pdfManagerCapability.reject(ex);
  18211. }
  18212. return pdfManagerCapability.promise;
  18213. }
  18214. var pdfStream;
  18215. try {
  18216. if (source.chunkedViewerLoading) {
  18217. pdfStream = new PDFWorkerStream(source, handler);
  18218. } else {
  18219. assert(PDFNetworkStream, 'pdfjs/core/network module is not loaded');
  18220. pdfStream = new PDFNetworkStream(data);
  18221. }
  18222. } catch (ex) {
  18223. pdfManagerCapability.reject(ex);
  18224. return pdfManagerCapability.promise;
  18225. }
  18226. var fullRequest = pdfStream.getFullReader();
  18227. fullRequest.headersReady.then(function () {
  18228. if (!fullRequest.isStreamingSupported || !fullRequest.isRangeSupported) {
  18229. fullRequest.onProgress = function (evt) {
  18230. handler.send('DocProgress', {
  18231. loaded: evt.loaded,
  18232. total: evt.total
  18233. });
  18234. };
  18235. }
  18236. if (!fullRequest.isRangeSupported) {
  18237. return;
  18238. }
  18239. var disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
  18240. pdfManager = new NetworkPdfManager(docId, pdfStream, {
  18241. msgHandler: handler,
  18242. url: source.url,
  18243. password: source.password,
  18244. length: fullRequest.contentLength,
  18245. disableAutoFetch: disableAutoFetch,
  18246. rangeChunkSize: source.rangeChunkSize
  18247. }, evaluatorOptions, docBaseUrl);
  18248. pdfManagerCapability.resolve(pdfManager);
  18249. cancelXHRs = null;
  18250. }).catch(function (reason) {
  18251. pdfManagerCapability.reject(reason);
  18252. cancelXHRs = null;
  18253. });
  18254. var cachedChunks = [], loaded = 0;
  18255. var flushChunks = function () {
  18256. var pdfFile = arraysToBytes(cachedChunks);
  18257. if (source.length && pdfFile.length !== source.length) {
  18258. warn('reported HTTP length is different from actual');
  18259. }
  18260. try {
  18261. pdfManager = new LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, docBaseUrl);
  18262. pdfManagerCapability.resolve(pdfManager);
  18263. } catch (ex) {
  18264. pdfManagerCapability.reject(ex);
  18265. }
  18266. cachedChunks = [];
  18267. };
  18268. var readPromise = new Promise(function (resolve, reject) {
  18269. var readChunk = function (chunk) {
  18270. try {
  18271. ensureNotTerminated();
  18272. if (chunk.done) {
  18273. if (!pdfManager) {
  18274. flushChunks();
  18275. }
  18276. cancelXHRs = null;
  18277. return;
  18278. }
  18279. var data = chunk.value;
  18280. loaded += arrayByteLength(data);
  18281. if (!fullRequest.isStreamingSupported) {
  18282. handler.send('DocProgress', {
  18283. loaded: loaded,
  18284. total: Math.max(loaded, fullRequest.contentLength || 0)
  18285. });
  18286. }
  18287. if (pdfManager) {
  18288. pdfManager.sendProgressiveData(data);
  18289. } else {
  18290. cachedChunks.push(data);
  18291. }
  18292. fullRequest.read().then(readChunk, reject);
  18293. } catch (e) {
  18294. reject(e);
  18295. }
  18296. };
  18297. fullRequest.read().then(readChunk, reject);
  18298. });
  18299. readPromise.catch(function (e) {
  18300. pdfManagerCapability.reject(e);
  18301. cancelXHRs = null;
  18302. });
  18303. cancelXHRs = function () {
  18304. pdfStream.cancelAllRequests('abort');
  18305. };
  18306. return pdfManagerCapability.promise;
  18307. }
  18308. function setupDoc(data) {
  18309. function onSuccess(doc) {
  18310. ensureNotTerminated();
  18311. handler.send('GetDoc', { pdfInfo: doc });
  18312. }
  18313. function onFailure(e) {
  18314. if (e instanceof PasswordException) {
  18315. var task = new WorkerTask('PasswordException: response ' + e.code);
  18316. startWorkerTask(task);
  18317. handler.sendWithPromise('PasswordRequest', e).then(function (data) {
  18318. finishWorkerTask(task);
  18319. pdfManager.updatePassword(data.password);
  18320. pdfManagerReady();
  18321. }).catch(function (ex) {
  18322. finishWorkerTask(task);
  18323. handler.send('PasswordException', ex);
  18324. }.bind(null, e));
  18325. } else if (e instanceof InvalidPDFException) {
  18326. handler.send('InvalidPDF', e);
  18327. } else if (e instanceof MissingPDFException) {
  18328. handler.send('MissingPDF', e);
  18329. } else if (e instanceof UnexpectedResponseException) {
  18330. handler.send('UnexpectedResponse', e);
  18331. } else {
  18332. handler.send('UnknownError', new UnknownErrorException(e.message, e.toString()));
  18333. }
  18334. }
  18335. function pdfManagerReady() {
  18336. ensureNotTerminated();
  18337. loadDocument(false).then(onSuccess, function loadFailure(ex) {
  18338. ensureNotTerminated();
  18339. if (!(ex instanceof XRefParseException)) {
  18340. onFailure(ex);
  18341. return;
  18342. }
  18343. pdfManager.requestLoadedStream();
  18344. pdfManager.onLoadedStream().then(function () {
  18345. ensureNotTerminated();
  18346. loadDocument(true).then(onSuccess, onFailure);
  18347. });
  18348. }, onFailure);
  18349. }
  18350. ensureNotTerminated();
  18351. var evaluatorOptions = {
  18352. forceDataSchema: data.disableCreateObjectURL,
  18353. maxImageSize: data.maxImageSize === undefined ? -1 : data.maxImageSize,
  18354. disableFontFace: data.disableFontFace,
  18355. disableNativeImageDecoder: data.disableNativeImageDecoder
  18356. };
  18357. getPdfManager(data, evaluatorOptions).then(function (newPdfManager) {
  18358. if (terminated) {
  18359. newPdfManager.terminate();
  18360. throw new Error('Worker was terminated');
  18361. }
  18362. pdfManager = newPdfManager;
  18363. handler.send('PDFManagerReady', null);
  18364. pdfManager.onLoadedStream().then(function (stream) {
  18365. handler.send('DataLoaded', { length: stream.bytes.byteLength });
  18366. });
  18367. }).then(pdfManagerReady, onFailure);
  18368. }
  18369. handler.on('GetPage', function wphSetupGetPage(data) {
  18370. return pdfManager.getPage(data.pageIndex).then(function (page) {
  18371. var rotatePromise = pdfManager.ensure(page, 'rotate');
  18372. var refPromise = pdfManager.ensure(page, 'ref');
  18373. var userUnitPromise = pdfManager.ensure(page, 'userUnit');
  18374. var viewPromise = pdfManager.ensure(page, 'view');
  18375. return Promise.all([
  18376. rotatePromise,
  18377. refPromise,
  18378. userUnitPromise,
  18379. viewPromise
  18380. ]).then(function (results) {
  18381. return {
  18382. rotate: results[0],
  18383. ref: results[1],
  18384. userUnit: results[2],
  18385. view: results[3]
  18386. };
  18387. });
  18388. });
  18389. });
  18390. handler.on('GetPageIndex', function wphSetupGetPageIndex(data) {
  18391. var ref = new Ref(data.ref.num, data.ref.gen);
  18392. var catalog = pdfManager.pdfDocument.catalog;
  18393. return catalog.getPageIndex(ref);
  18394. });
  18395. handler.on('GetDestinations', function wphSetupGetDestinations(data) {
  18396. return pdfManager.ensureCatalog('destinations');
  18397. });
  18398. handler.on('GetDestination', function wphSetupGetDestination(data) {
  18399. return pdfManager.ensureCatalog('getDestination', [data.id]);
  18400. });
  18401. handler.on('GetPageLabels', function wphSetupGetPageLabels(data) {
  18402. return pdfManager.ensureCatalog('pageLabels');
  18403. });
  18404. handler.on('GetAttachments', function wphSetupGetAttachments(data) {
  18405. return pdfManager.ensureCatalog('attachments');
  18406. });
  18407. handler.on('GetJavaScript', function wphSetupGetJavaScript(data) {
  18408. return pdfManager.ensureCatalog('javaScript');
  18409. });
  18410. handler.on('GetOutline', function wphSetupGetOutline(data) {
  18411. return pdfManager.ensureCatalog('documentOutline');
  18412. });
  18413. handler.on('GetMetadata', function wphSetupGetMetadata(data) {
  18414. return Promise.all([
  18415. pdfManager.ensureDoc('documentInfo'),
  18416. pdfManager.ensureCatalog('metadata')
  18417. ]);
  18418. });
  18419. handler.on('GetData', function wphSetupGetData(data) {
  18420. pdfManager.requestLoadedStream();
  18421. return pdfManager.onLoadedStream().then(function (stream) {
  18422. return stream.bytes;
  18423. });
  18424. });
  18425. handler.on('GetStats', function wphSetupGetStats(data) {
  18426. return pdfManager.pdfDocument.xref.stats;
  18427. });
  18428. handler.on('GetAnnotations', function wphSetupGetAnnotations(data) {
  18429. return pdfManager.getPage(data.pageIndex).then(function (page) {
  18430. return pdfManager.ensure(page, 'getAnnotationsData', [data.intent]);
  18431. });
  18432. });
  18433. handler.on('RenderPageRequest', function wphSetupRenderPage(data) {
  18434. var pageIndex = data.pageIndex;
  18435. pdfManager.getPage(pageIndex).then(function (page) {
  18436. var task = new WorkerTask('RenderPageRequest: page ' + pageIndex);
  18437. startWorkerTask(task);
  18438. var pageNum = pageIndex + 1;
  18439. var start = Date.now();
  18440. page.getOperatorList(handler, task, data.intent, data.renderInteractiveForms).then(function (operatorList) {
  18441. finishWorkerTask(task);
  18442. info('page=' + pageNum + ' - getOperatorList: time=' + (Date.now() - start) + 'ms, len=' + operatorList.totalLength);
  18443. }, function (e) {
  18444. finishWorkerTask(task);
  18445. if (task.terminated) {
  18446. return;
  18447. }
  18448. handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.unknown });
  18449. var minimumStackMessage = 'worker.js: while trying to getPage() and getOperatorList()';
  18450. var wrappedException;
  18451. if (typeof e === 'string') {
  18452. wrappedException = {
  18453. message: e,
  18454. stack: minimumStackMessage
  18455. };
  18456. } else if (typeof e === 'object') {
  18457. wrappedException = {
  18458. message: e.message || e.toString(),
  18459. stack: e.stack || minimumStackMessage
  18460. };
  18461. } else {
  18462. wrappedException = {
  18463. message: 'Unknown exception type: ' + typeof e,
  18464. stack: minimumStackMessage
  18465. };
  18466. }
  18467. handler.send('PageError', {
  18468. pageNum: pageNum,
  18469. error: wrappedException,
  18470. intent: data.intent
  18471. });
  18472. });
  18473. });
  18474. }, this);
  18475. handler.on('GetTextContent', function wphExtractText(data) {
  18476. var pageIndex = data.pageIndex;
  18477. var normalizeWhitespace = data.normalizeWhitespace;
  18478. var combineTextItems = data.combineTextItems;
  18479. return pdfManager.getPage(pageIndex).then(function (page) {
  18480. var task = new WorkerTask('GetTextContent: page ' + pageIndex);
  18481. startWorkerTask(task);
  18482. var pageNum = pageIndex + 1;
  18483. var start = Date.now();
  18484. return page.extractTextContent(task, normalizeWhitespace, combineTextItems).then(function (textContent) {
  18485. finishWorkerTask(task);
  18486. info('text indexing: page=' + pageNum + ' - time=' + (Date.now() - start) + 'ms');
  18487. return textContent;
  18488. }, function (reason) {
  18489. finishWorkerTask(task);
  18490. if (task.terminated) {
  18491. return;
  18492. }
  18493. throw reason;
  18494. });
  18495. });
  18496. });
  18497. handler.on('Cleanup', function wphCleanup(data) {
  18498. return pdfManager.cleanup();
  18499. });
  18500. handler.on('Terminate', function wphTerminate(data) {
  18501. terminated = true;
  18502. if (pdfManager) {
  18503. pdfManager.terminate();
  18504. pdfManager = null;
  18505. }
  18506. if (cancelXHRs) {
  18507. cancelXHRs();
  18508. }
  18509. var waitOn = [];
  18510. WorkerTasks.forEach(function (task) {
  18511. waitOn.push(task.finished);
  18512. task.terminate();
  18513. });
  18514. return Promise.all(waitOn).then(function () {
  18515. handler.destroy();
  18516. handler = null;
  18517. });
  18518. });
  18519. handler.on('Ready', function wphReady(data) {
  18520. setupDoc(docParams);
  18521. docParams = null;
  18522. });
  18523. return workerHandlerName;
  18524. }
  18525. };
  18526. function initializeWorker() {
  18527. var handler = new MessageHandler('worker', 'main', self);
  18528. WorkerMessageHandler.setup(handler, self);
  18529. handler.send('ready', null);
  18530. }
  18531. if (typeof window === 'undefined' && !isNodeJS()) {
  18532. initializeWorker();
  18533. }
  18534. exports.setPDFNetworkStreamClass = setPDFNetworkStreamClass;
  18535. exports.WorkerTask = WorkerTask;
  18536. exports.WorkerMessageHandler = WorkerMessageHandler;
  18537. /***/ }),
  18538. /* 9 */
  18539. /***/ (function(module, exports) {
  18540. var g;
  18541. g = function () {
  18542. return this;
  18543. }();
  18544. try {
  18545. g = g || Function("return this")() || (1, eval)("this");
  18546. } catch (e) {
  18547. if (typeof window === "object")
  18548. g = window;
  18549. }
  18550. module.exports = g;
  18551. /***/ }),
  18552. /* 10 */
  18553. /***/ (function(module, exports, __w_pdfjs_require__) {
  18554. "use strict";
  18555. var ArithmeticDecoder = function ArithmeticDecoderClosure() {
  18556. var QeTable = [
  18557. {
  18558. qe: 0x5601,
  18559. nmps: 1,
  18560. nlps: 1,
  18561. switchFlag: 1
  18562. },
  18563. {
  18564. qe: 0x3401,
  18565. nmps: 2,
  18566. nlps: 6,
  18567. switchFlag: 0
  18568. },
  18569. {
  18570. qe: 0x1801,
  18571. nmps: 3,
  18572. nlps: 9,
  18573. switchFlag: 0
  18574. },
  18575. {
  18576. qe: 0x0AC1,
  18577. nmps: 4,
  18578. nlps: 12,
  18579. switchFlag: 0
  18580. },
  18581. {
  18582. qe: 0x0521,
  18583. nmps: 5,
  18584. nlps: 29,
  18585. switchFlag: 0
  18586. },
  18587. {
  18588. qe: 0x0221,
  18589. nmps: 38,
  18590. nlps: 33,
  18591. switchFlag: 0
  18592. },
  18593. {
  18594. qe: 0x5601,
  18595. nmps: 7,
  18596. nlps: 6,
  18597. switchFlag: 1
  18598. },
  18599. {
  18600. qe: 0x5401,
  18601. nmps: 8,
  18602. nlps: 14,
  18603. switchFlag: 0
  18604. },
  18605. {
  18606. qe: 0x4801,
  18607. nmps: 9,
  18608. nlps: 14,
  18609. switchFlag: 0
  18610. },
  18611. {
  18612. qe: 0x3801,
  18613. nmps: 10,
  18614. nlps: 14,
  18615. switchFlag: 0
  18616. },
  18617. {
  18618. qe: 0x3001,
  18619. nmps: 11,
  18620. nlps: 17,
  18621. switchFlag: 0
  18622. },
  18623. {
  18624. qe: 0x2401,
  18625. nmps: 12,
  18626. nlps: 18,
  18627. switchFlag: 0
  18628. },
  18629. {
  18630. qe: 0x1C01,
  18631. nmps: 13,
  18632. nlps: 20,
  18633. switchFlag: 0
  18634. },
  18635. {
  18636. qe: 0x1601,
  18637. nmps: 29,
  18638. nlps: 21,
  18639. switchFlag: 0
  18640. },
  18641. {
  18642. qe: 0x5601,
  18643. nmps: 15,
  18644. nlps: 14,
  18645. switchFlag: 1
  18646. },
  18647. {
  18648. qe: 0x5401,
  18649. nmps: 16,
  18650. nlps: 14,
  18651. switchFlag: 0
  18652. },
  18653. {
  18654. qe: 0x5101,
  18655. nmps: 17,
  18656. nlps: 15,
  18657. switchFlag: 0
  18658. },
  18659. {
  18660. qe: 0x4801,
  18661. nmps: 18,
  18662. nlps: 16,
  18663. switchFlag: 0
  18664. },
  18665. {
  18666. qe: 0x3801,
  18667. nmps: 19,
  18668. nlps: 17,
  18669. switchFlag: 0
  18670. },
  18671. {
  18672. qe: 0x3401,
  18673. nmps: 20,
  18674. nlps: 18,
  18675. switchFlag: 0
  18676. },
  18677. {
  18678. qe: 0x3001,
  18679. nmps: 21,
  18680. nlps: 19,
  18681. switchFlag: 0
  18682. },
  18683. {
  18684. qe: 0x2801,
  18685. nmps: 22,
  18686. nlps: 19,
  18687. switchFlag: 0
  18688. },
  18689. {
  18690. qe: 0x2401,
  18691. nmps: 23,
  18692. nlps: 20,
  18693. switchFlag: 0
  18694. },
  18695. {
  18696. qe: 0x2201,
  18697. nmps: 24,
  18698. nlps: 21,
  18699. switchFlag: 0
  18700. },
  18701. {
  18702. qe: 0x1C01,
  18703. nmps: 25,
  18704. nlps: 22,
  18705. switchFlag: 0
  18706. },
  18707. {
  18708. qe: 0x1801,
  18709. nmps: 26,
  18710. nlps: 23,
  18711. switchFlag: 0
  18712. },
  18713. {
  18714. qe: 0x1601,
  18715. nmps: 27,
  18716. nlps: 24,
  18717. switchFlag: 0
  18718. },
  18719. {
  18720. qe: 0x1401,
  18721. nmps: 28,
  18722. nlps: 25,
  18723. switchFlag: 0
  18724. },
  18725. {
  18726. qe: 0x1201,
  18727. nmps: 29,
  18728. nlps: 26,
  18729. switchFlag: 0
  18730. },
  18731. {
  18732. qe: 0x1101,
  18733. nmps: 30,
  18734. nlps: 27,
  18735. switchFlag: 0
  18736. },
  18737. {
  18738. qe: 0x0AC1,
  18739. nmps: 31,
  18740. nlps: 28,
  18741. switchFlag: 0
  18742. },
  18743. {
  18744. qe: 0x09C1,
  18745. nmps: 32,
  18746. nlps: 29,
  18747. switchFlag: 0
  18748. },
  18749. {
  18750. qe: 0x08A1,
  18751. nmps: 33,
  18752. nlps: 30,
  18753. switchFlag: 0
  18754. },
  18755. {
  18756. qe: 0x0521,
  18757. nmps: 34,
  18758. nlps: 31,
  18759. switchFlag: 0
  18760. },
  18761. {
  18762. qe: 0x0441,
  18763. nmps: 35,
  18764. nlps: 32,
  18765. switchFlag: 0
  18766. },
  18767. {
  18768. qe: 0x02A1,
  18769. nmps: 36,
  18770. nlps: 33,
  18771. switchFlag: 0
  18772. },
  18773. {
  18774. qe: 0x0221,
  18775. nmps: 37,
  18776. nlps: 34,
  18777. switchFlag: 0
  18778. },
  18779. {
  18780. qe: 0x0141,
  18781. nmps: 38,
  18782. nlps: 35,
  18783. switchFlag: 0
  18784. },
  18785. {
  18786. qe: 0x0111,
  18787. nmps: 39,
  18788. nlps: 36,
  18789. switchFlag: 0
  18790. },
  18791. {
  18792. qe: 0x0085,
  18793. nmps: 40,
  18794. nlps: 37,
  18795. switchFlag: 0
  18796. },
  18797. {
  18798. qe: 0x0049,
  18799. nmps: 41,
  18800. nlps: 38,
  18801. switchFlag: 0
  18802. },
  18803. {
  18804. qe: 0x0025,
  18805. nmps: 42,
  18806. nlps: 39,
  18807. switchFlag: 0
  18808. },
  18809. {
  18810. qe: 0x0015,
  18811. nmps: 43,
  18812. nlps: 40,
  18813. switchFlag: 0
  18814. },
  18815. {
  18816. qe: 0x0009,
  18817. nmps: 44,
  18818. nlps: 41,
  18819. switchFlag: 0
  18820. },
  18821. {
  18822. qe: 0x0005,
  18823. nmps: 45,
  18824. nlps: 42,
  18825. switchFlag: 0
  18826. },
  18827. {
  18828. qe: 0x0001,
  18829. nmps: 45,
  18830. nlps: 43,
  18831. switchFlag: 0
  18832. },
  18833. {
  18834. qe: 0x5601,
  18835. nmps: 46,
  18836. nlps: 46,
  18837. switchFlag: 0
  18838. }
  18839. ];
  18840. function ArithmeticDecoder(data, start, end) {
  18841. this.data = data;
  18842. this.bp = start;
  18843. this.dataEnd = end;
  18844. this.chigh = data[start];
  18845. this.clow = 0;
  18846. this.byteIn();
  18847. this.chigh = this.chigh << 7 & 0xFFFF | this.clow >> 9 & 0x7F;
  18848. this.clow = this.clow << 7 & 0xFFFF;
  18849. this.ct -= 7;
  18850. this.a = 0x8000;
  18851. }
  18852. ArithmeticDecoder.prototype = {
  18853. byteIn: function ArithmeticDecoder_byteIn() {
  18854. var data = this.data;
  18855. var bp = this.bp;
  18856. if (data[bp] === 0xFF) {
  18857. var b1 = data[bp + 1];
  18858. if (b1 > 0x8F) {
  18859. this.clow += 0xFF00;
  18860. this.ct = 8;
  18861. } else {
  18862. bp++;
  18863. this.clow += data[bp] << 9;
  18864. this.ct = 7;
  18865. this.bp = bp;
  18866. }
  18867. } else {
  18868. bp++;
  18869. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xFF00;
  18870. this.ct = 8;
  18871. this.bp = bp;
  18872. }
  18873. if (this.clow > 0xFFFF) {
  18874. this.chigh += this.clow >> 16;
  18875. this.clow &= 0xFFFF;
  18876. }
  18877. },
  18878. readBit: function ArithmeticDecoder_readBit(contexts, pos) {
  18879. var cx_index = contexts[pos] >> 1, cx_mps = contexts[pos] & 1;
  18880. var qeTableIcx = QeTable[cx_index];
  18881. var qeIcx = qeTableIcx.qe;
  18882. var d;
  18883. var a = this.a - qeIcx;
  18884. if (this.chigh < qeIcx) {
  18885. if (a < qeIcx) {
  18886. a = qeIcx;
  18887. d = cx_mps;
  18888. cx_index = qeTableIcx.nmps;
  18889. } else {
  18890. a = qeIcx;
  18891. d = 1 ^ cx_mps;
  18892. if (qeTableIcx.switchFlag === 1) {
  18893. cx_mps = d;
  18894. }
  18895. cx_index = qeTableIcx.nlps;
  18896. }
  18897. } else {
  18898. this.chigh -= qeIcx;
  18899. if ((a & 0x8000) !== 0) {
  18900. this.a = a;
  18901. return cx_mps;
  18902. }
  18903. if (a < qeIcx) {
  18904. d = 1 ^ cx_mps;
  18905. if (qeTableIcx.switchFlag === 1) {
  18906. cx_mps = d;
  18907. }
  18908. cx_index = qeTableIcx.nlps;
  18909. } else {
  18910. d = cx_mps;
  18911. cx_index = qeTableIcx.nmps;
  18912. }
  18913. }
  18914. do {
  18915. if (this.ct === 0) {
  18916. this.byteIn();
  18917. }
  18918. a <<= 1;
  18919. this.chigh = this.chigh << 1 & 0xFFFF | this.clow >> 15 & 1;
  18920. this.clow = this.clow << 1 & 0xFFFF;
  18921. this.ct--;
  18922. } while ((a & 0x8000) === 0);
  18923. this.a = a;
  18924. contexts[pos] = cx_index << 1 | cx_mps;
  18925. return d;
  18926. }
  18927. };
  18928. return ArithmeticDecoder;
  18929. }();
  18930. exports.ArithmeticDecoder = ArithmeticDecoder;
  18931. /***/ }),
  18932. /* 11 */
  18933. /***/ (function(module, exports, __w_pdfjs_require__) {
  18934. "use strict";
  18935. var sharedUtil = __w_pdfjs_require__(0);
  18936. var coreCharsets = __w_pdfjs_require__(22);
  18937. var coreEncodings = __w_pdfjs_require__(4);
  18938. var error = sharedUtil.error;
  18939. var info = sharedUtil.info;
  18940. var bytesToString = sharedUtil.bytesToString;
  18941. var warn = sharedUtil.warn;
  18942. var isArray = sharedUtil.isArray;
  18943. var Util = sharedUtil.Util;
  18944. var stringToBytes = sharedUtil.stringToBytes;
  18945. var assert = sharedUtil.assert;
  18946. var ISOAdobeCharset = coreCharsets.ISOAdobeCharset;
  18947. var ExpertCharset = coreCharsets.ExpertCharset;
  18948. var ExpertSubsetCharset = coreCharsets.ExpertSubsetCharset;
  18949. var StandardEncoding = coreEncodings.StandardEncoding;
  18950. var ExpertEncoding = coreEncodings.ExpertEncoding;
  18951. var MAX_SUBR_NESTING = 10;
  18952. var CFFStandardStrings = [
  18953. '.notdef',
  18954. 'space',
  18955. 'exclam',
  18956. 'quotedbl',
  18957. 'numbersign',
  18958. 'dollar',
  18959. 'percent',
  18960. 'ampersand',
  18961. 'quoteright',
  18962. 'parenleft',
  18963. 'parenright',
  18964. 'asterisk',
  18965. 'plus',
  18966. 'comma',
  18967. 'hyphen',
  18968. 'period',
  18969. 'slash',
  18970. 'zero',
  18971. 'one',
  18972. 'two',
  18973. 'three',
  18974. 'four',
  18975. 'five',
  18976. 'six',
  18977. 'seven',
  18978. 'eight',
  18979. 'nine',
  18980. 'colon',
  18981. 'semicolon',
  18982. 'less',
  18983. 'equal',
  18984. 'greater',
  18985. 'question',
  18986. 'at',
  18987. 'A',
  18988. 'B',
  18989. 'C',
  18990. 'D',
  18991. 'E',
  18992. 'F',
  18993. 'G',
  18994. 'H',
  18995. 'I',
  18996. 'J',
  18997. 'K',
  18998. 'L',
  18999. 'M',
  19000. 'N',
  19001. 'O',
  19002. 'P',
  19003. 'Q',
  19004. 'R',
  19005. 'S',
  19006. 'T',
  19007. 'U',
  19008. 'V',
  19009. 'W',
  19010. 'X',
  19011. 'Y',
  19012. 'Z',
  19013. 'bracketleft',
  19014. 'backslash',
  19015. 'bracketright',
  19016. 'asciicircum',
  19017. 'underscore',
  19018. 'quoteleft',
  19019. 'a',
  19020. 'b',
  19021. 'c',
  19022. 'd',
  19023. 'e',
  19024. 'f',
  19025. 'g',
  19026. 'h',
  19027. 'i',
  19028. 'j',
  19029. 'k',
  19030. 'l',
  19031. 'm',
  19032. 'n',
  19033. 'o',
  19034. 'p',
  19035. 'q',
  19036. 'r',
  19037. 's',
  19038. 't',
  19039. 'u',
  19040. 'v',
  19041. 'w',
  19042. 'x',
  19043. 'y',
  19044. 'z',
  19045. 'braceleft',
  19046. 'bar',
  19047. 'braceright',
  19048. 'asciitilde',
  19049. 'exclamdown',
  19050. 'cent',
  19051. 'sterling',
  19052. 'fraction',
  19053. 'yen',
  19054. 'florin',
  19055. 'section',
  19056. 'currency',
  19057. 'quotesingle',
  19058. 'quotedblleft',
  19059. 'guillemotleft',
  19060. 'guilsinglleft',
  19061. 'guilsinglright',
  19062. 'fi',
  19063. 'fl',
  19064. 'endash',
  19065. 'dagger',
  19066. 'daggerdbl',
  19067. 'periodcentered',
  19068. 'paragraph',
  19069. 'bullet',
  19070. 'quotesinglbase',
  19071. 'quotedblbase',
  19072. 'quotedblright',
  19073. 'guillemotright',
  19074. 'ellipsis',
  19075. 'perthousand',
  19076. 'questiondown',
  19077. 'grave',
  19078. 'acute',
  19079. 'circumflex',
  19080. 'tilde',
  19081. 'macron',
  19082. 'breve',
  19083. 'dotaccent',
  19084. 'dieresis',
  19085. 'ring',
  19086. 'cedilla',
  19087. 'hungarumlaut',
  19088. 'ogonek',
  19089. 'caron',
  19090. 'emdash',
  19091. 'AE',
  19092. 'ordfeminine',
  19093. 'Lslash',
  19094. 'Oslash',
  19095. 'OE',
  19096. 'ordmasculine',
  19097. 'ae',
  19098. 'dotlessi',
  19099. 'lslash',
  19100. 'oslash',
  19101. 'oe',
  19102. 'germandbls',
  19103. 'onesuperior',
  19104. 'logicalnot',
  19105. 'mu',
  19106. 'trademark',
  19107. 'Eth',
  19108. 'onehalf',
  19109. 'plusminus',
  19110. 'Thorn',
  19111. 'onequarter',
  19112. 'divide',
  19113. 'brokenbar',
  19114. 'degree',
  19115. 'thorn',
  19116. 'threequarters',
  19117. 'twosuperior',
  19118. 'registered',
  19119. 'minus',
  19120. 'eth',
  19121. 'multiply',
  19122. 'threesuperior',
  19123. 'copyright',
  19124. 'Aacute',
  19125. 'Acircumflex',
  19126. 'Adieresis',
  19127. 'Agrave',
  19128. 'Aring',
  19129. 'Atilde',
  19130. 'Ccedilla',
  19131. 'Eacute',
  19132. 'Ecircumflex',
  19133. 'Edieresis',
  19134. 'Egrave',
  19135. 'Iacute',
  19136. 'Icircumflex',
  19137. 'Idieresis',
  19138. 'Igrave',
  19139. 'Ntilde',
  19140. 'Oacute',
  19141. 'Ocircumflex',
  19142. 'Odieresis',
  19143. 'Ograve',
  19144. 'Otilde',
  19145. 'Scaron',
  19146. 'Uacute',
  19147. 'Ucircumflex',
  19148. 'Udieresis',
  19149. 'Ugrave',
  19150. 'Yacute',
  19151. 'Ydieresis',
  19152. 'Zcaron',
  19153. 'aacute',
  19154. 'acircumflex',
  19155. 'adieresis',
  19156. 'agrave',
  19157. 'aring',
  19158. 'atilde',
  19159. 'ccedilla',
  19160. 'eacute',
  19161. 'ecircumflex',
  19162. 'edieresis',
  19163. 'egrave',
  19164. 'iacute',
  19165. 'icircumflex',
  19166. 'idieresis',
  19167. 'igrave',
  19168. 'ntilde',
  19169. 'oacute',
  19170. 'ocircumflex',
  19171. 'odieresis',
  19172. 'ograve',
  19173. 'otilde',
  19174. 'scaron',
  19175. 'uacute',
  19176. 'ucircumflex',
  19177. 'udieresis',
  19178. 'ugrave',
  19179. 'yacute',
  19180. 'ydieresis',
  19181. 'zcaron',
  19182. 'exclamsmall',
  19183. 'Hungarumlautsmall',
  19184. 'dollaroldstyle',
  19185. 'dollarsuperior',
  19186. 'ampersandsmall',
  19187. 'Acutesmall',
  19188. 'parenleftsuperior',
  19189. 'parenrightsuperior',
  19190. 'twodotenleader',
  19191. 'onedotenleader',
  19192. 'zerooldstyle',
  19193. 'oneoldstyle',
  19194. 'twooldstyle',
  19195. 'threeoldstyle',
  19196. 'fouroldstyle',
  19197. 'fiveoldstyle',
  19198. 'sixoldstyle',
  19199. 'sevenoldstyle',
  19200. 'eightoldstyle',
  19201. 'nineoldstyle',
  19202. 'commasuperior',
  19203. 'threequartersemdash',
  19204. 'periodsuperior',
  19205. 'questionsmall',
  19206. 'asuperior',
  19207. 'bsuperior',
  19208. 'centsuperior',
  19209. 'dsuperior',
  19210. 'esuperior',
  19211. 'isuperior',
  19212. 'lsuperior',
  19213. 'msuperior',
  19214. 'nsuperior',
  19215. 'osuperior',
  19216. 'rsuperior',
  19217. 'ssuperior',
  19218. 'tsuperior',
  19219. 'ff',
  19220. 'ffi',
  19221. 'ffl',
  19222. 'parenleftinferior',
  19223. 'parenrightinferior',
  19224. 'Circumflexsmall',
  19225. 'hyphensuperior',
  19226. 'Gravesmall',
  19227. 'Asmall',
  19228. 'Bsmall',
  19229. 'Csmall',
  19230. 'Dsmall',
  19231. 'Esmall',
  19232. 'Fsmall',
  19233. 'Gsmall',
  19234. 'Hsmall',
  19235. 'Ismall',
  19236. 'Jsmall',
  19237. 'Ksmall',
  19238. 'Lsmall',
  19239. 'Msmall',
  19240. 'Nsmall',
  19241. 'Osmall',
  19242. 'Psmall',
  19243. 'Qsmall',
  19244. 'Rsmall',
  19245. 'Ssmall',
  19246. 'Tsmall',
  19247. 'Usmall',
  19248. 'Vsmall',
  19249. 'Wsmall',
  19250. 'Xsmall',
  19251. 'Ysmall',
  19252. 'Zsmall',
  19253. 'colonmonetary',
  19254. 'onefitted',
  19255. 'rupiah',
  19256. 'Tildesmall',
  19257. 'exclamdownsmall',
  19258. 'centoldstyle',
  19259. 'Lslashsmall',
  19260. 'Scaronsmall',
  19261. 'Zcaronsmall',
  19262. 'Dieresissmall',
  19263. 'Brevesmall',
  19264. 'Caronsmall',
  19265. 'Dotaccentsmall',
  19266. 'Macronsmall',
  19267. 'figuredash',
  19268. 'hypheninferior',
  19269. 'Ogoneksmall',
  19270. 'Ringsmall',
  19271. 'Cedillasmall',
  19272. 'questiondownsmall',
  19273. 'oneeighth',
  19274. 'threeeighths',
  19275. 'fiveeighths',
  19276. 'seveneighths',
  19277. 'onethird',
  19278. 'twothirds',
  19279. 'zerosuperior',
  19280. 'foursuperior',
  19281. 'fivesuperior',
  19282. 'sixsuperior',
  19283. 'sevensuperior',
  19284. 'eightsuperior',
  19285. 'ninesuperior',
  19286. 'zeroinferior',
  19287. 'oneinferior',
  19288. 'twoinferior',
  19289. 'threeinferior',
  19290. 'fourinferior',
  19291. 'fiveinferior',
  19292. 'sixinferior',
  19293. 'seveninferior',
  19294. 'eightinferior',
  19295. 'nineinferior',
  19296. 'centinferior',
  19297. 'dollarinferior',
  19298. 'periodinferior',
  19299. 'commainferior',
  19300. 'Agravesmall',
  19301. 'Aacutesmall',
  19302. 'Acircumflexsmall',
  19303. 'Atildesmall',
  19304. 'Adieresissmall',
  19305. 'Aringsmall',
  19306. 'AEsmall',
  19307. 'Ccedillasmall',
  19308. 'Egravesmall',
  19309. 'Eacutesmall',
  19310. 'Ecircumflexsmall',
  19311. 'Edieresissmall',
  19312. 'Igravesmall',
  19313. 'Iacutesmall',
  19314. 'Icircumflexsmall',
  19315. 'Idieresissmall',
  19316. 'Ethsmall',
  19317. 'Ntildesmall',
  19318. 'Ogravesmall',
  19319. 'Oacutesmall',
  19320. 'Ocircumflexsmall',
  19321. 'Otildesmall',
  19322. 'Odieresissmall',
  19323. 'OEsmall',
  19324. 'Oslashsmall',
  19325. 'Ugravesmall',
  19326. 'Uacutesmall',
  19327. 'Ucircumflexsmall',
  19328. 'Udieresissmall',
  19329. 'Yacutesmall',
  19330. 'Thornsmall',
  19331. 'Ydieresissmall',
  19332. '001.000',
  19333. '001.001',
  19334. '001.002',
  19335. '001.003',
  19336. 'Black',
  19337. 'Bold',
  19338. 'Book',
  19339. 'Light',
  19340. 'Medium',
  19341. 'Regular',
  19342. 'Roman',
  19343. 'Semibold'
  19344. ];
  19345. var CFFParser = function CFFParserClosure() {
  19346. var CharstringValidationData = [
  19347. null,
  19348. {
  19349. id: 'hstem',
  19350. min: 2,
  19351. stackClearing: true,
  19352. stem: true
  19353. },
  19354. null,
  19355. {
  19356. id: 'vstem',
  19357. min: 2,
  19358. stackClearing: true,
  19359. stem: true
  19360. },
  19361. {
  19362. id: 'vmoveto',
  19363. min: 1,
  19364. stackClearing: true
  19365. },
  19366. {
  19367. id: 'rlineto',
  19368. min: 2,
  19369. resetStack: true
  19370. },
  19371. {
  19372. id: 'hlineto',
  19373. min: 1,
  19374. resetStack: true
  19375. },
  19376. {
  19377. id: 'vlineto',
  19378. min: 1,
  19379. resetStack: true
  19380. },
  19381. {
  19382. id: 'rrcurveto',
  19383. min: 6,
  19384. resetStack: true
  19385. },
  19386. null,
  19387. {
  19388. id: 'callsubr',
  19389. min: 1,
  19390. undefStack: true
  19391. },
  19392. {
  19393. id: 'return',
  19394. min: 0,
  19395. undefStack: true
  19396. },
  19397. null,
  19398. null,
  19399. {
  19400. id: 'endchar',
  19401. min: 0,
  19402. stackClearing: true
  19403. },
  19404. null,
  19405. null,
  19406. null,
  19407. {
  19408. id: 'hstemhm',
  19409. min: 2,
  19410. stackClearing: true,
  19411. stem: true
  19412. },
  19413. {
  19414. id: 'hintmask',
  19415. min: 0,
  19416. stackClearing: true
  19417. },
  19418. {
  19419. id: 'cntrmask',
  19420. min: 0,
  19421. stackClearing: true
  19422. },
  19423. {
  19424. id: 'rmoveto',
  19425. min: 2,
  19426. stackClearing: true
  19427. },
  19428. {
  19429. id: 'hmoveto',
  19430. min: 1,
  19431. stackClearing: true
  19432. },
  19433. {
  19434. id: 'vstemhm',
  19435. min: 2,
  19436. stackClearing: true,
  19437. stem: true
  19438. },
  19439. {
  19440. id: 'rcurveline',
  19441. min: 8,
  19442. resetStack: true
  19443. },
  19444. {
  19445. id: 'rlinecurve',
  19446. min: 8,
  19447. resetStack: true
  19448. },
  19449. {
  19450. id: 'vvcurveto',
  19451. min: 4,
  19452. resetStack: true
  19453. },
  19454. {
  19455. id: 'hhcurveto',
  19456. min: 4,
  19457. resetStack: true
  19458. },
  19459. null,
  19460. {
  19461. id: 'callgsubr',
  19462. min: 1,
  19463. undefStack: true
  19464. },
  19465. {
  19466. id: 'vhcurveto',
  19467. min: 4,
  19468. resetStack: true
  19469. },
  19470. {
  19471. id: 'hvcurveto',
  19472. min: 4,
  19473. resetStack: true
  19474. }
  19475. ];
  19476. var CharstringValidationData12 = [
  19477. null,
  19478. null,
  19479. null,
  19480. {
  19481. id: 'and',
  19482. min: 2,
  19483. stackDelta: -1
  19484. },
  19485. {
  19486. id: 'or',
  19487. min: 2,
  19488. stackDelta: -1
  19489. },
  19490. {
  19491. id: 'not',
  19492. min: 1,
  19493. stackDelta: 0
  19494. },
  19495. null,
  19496. null,
  19497. null,
  19498. {
  19499. id: 'abs',
  19500. min: 1,
  19501. stackDelta: 0
  19502. },
  19503. {
  19504. id: 'add',
  19505. min: 2,
  19506. stackDelta: -1,
  19507. stackFn: function stack_div(stack, index) {
  19508. stack[index - 2] = stack[index - 2] + stack[index - 1];
  19509. }
  19510. },
  19511. {
  19512. id: 'sub',
  19513. min: 2,
  19514. stackDelta: -1,
  19515. stackFn: function stack_div(stack, index) {
  19516. stack[index - 2] = stack[index - 2] - stack[index - 1];
  19517. }
  19518. },
  19519. {
  19520. id: 'div',
  19521. min: 2,
  19522. stackDelta: -1,
  19523. stackFn: function stack_div(stack, index) {
  19524. stack[index - 2] = stack[index - 2] / stack[index - 1];
  19525. }
  19526. },
  19527. null,
  19528. {
  19529. id: 'neg',
  19530. min: 1,
  19531. stackDelta: 0,
  19532. stackFn: function stack_div(stack, index) {
  19533. stack[index - 1] = -stack[index - 1];
  19534. }
  19535. },
  19536. {
  19537. id: 'eq',
  19538. min: 2,
  19539. stackDelta: -1
  19540. },
  19541. null,
  19542. null,
  19543. {
  19544. id: 'drop',
  19545. min: 1,
  19546. stackDelta: -1
  19547. },
  19548. null,
  19549. {
  19550. id: 'put',
  19551. min: 2,
  19552. stackDelta: -2
  19553. },
  19554. {
  19555. id: 'get',
  19556. min: 1,
  19557. stackDelta: 0
  19558. },
  19559. {
  19560. id: 'ifelse',
  19561. min: 4,
  19562. stackDelta: -3
  19563. },
  19564. {
  19565. id: 'random',
  19566. min: 0,
  19567. stackDelta: 1
  19568. },
  19569. {
  19570. id: 'mul',
  19571. min: 2,
  19572. stackDelta: -1,
  19573. stackFn: function stack_div(stack, index) {
  19574. stack[index - 2] = stack[index - 2] * stack[index - 1];
  19575. }
  19576. },
  19577. null,
  19578. {
  19579. id: 'sqrt',
  19580. min: 1,
  19581. stackDelta: 0
  19582. },
  19583. {
  19584. id: 'dup',
  19585. min: 1,
  19586. stackDelta: 1
  19587. },
  19588. {
  19589. id: 'exch',
  19590. min: 2,
  19591. stackDelta: 0
  19592. },
  19593. {
  19594. id: 'index',
  19595. min: 2,
  19596. stackDelta: 0
  19597. },
  19598. {
  19599. id: 'roll',
  19600. min: 3,
  19601. stackDelta: -2
  19602. },
  19603. null,
  19604. null,
  19605. null,
  19606. {
  19607. id: 'hflex',
  19608. min: 7,
  19609. resetStack: true
  19610. },
  19611. {
  19612. id: 'flex',
  19613. min: 13,
  19614. resetStack: true
  19615. },
  19616. {
  19617. id: 'hflex1',
  19618. min: 9,
  19619. resetStack: true
  19620. },
  19621. {
  19622. id: 'flex1',
  19623. min: 11,
  19624. resetStack: true
  19625. }
  19626. ];
  19627. function CFFParser(file, properties, seacAnalysisEnabled) {
  19628. this.bytes = file.getBytes();
  19629. this.properties = properties;
  19630. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  19631. }
  19632. CFFParser.prototype = {
  19633. parse: function CFFParser_parse() {
  19634. var properties = this.properties;
  19635. var cff = new CFF();
  19636. this.cff = cff;
  19637. var header = this.parseHeader();
  19638. var nameIndex = this.parseIndex(header.endPos);
  19639. var topDictIndex = this.parseIndex(nameIndex.endPos);
  19640. var stringIndex = this.parseIndex(topDictIndex.endPos);
  19641. var globalSubrIndex = this.parseIndex(stringIndex.endPos);
  19642. var topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  19643. var topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  19644. cff.header = header.obj;
  19645. cff.names = this.parseNameIndex(nameIndex.obj);
  19646. cff.strings = this.parseStringIndex(stringIndex.obj);
  19647. cff.topDict = topDict;
  19648. cff.globalSubrIndex = globalSubrIndex.obj;
  19649. this.parsePrivateDict(cff.topDict);
  19650. cff.isCIDFont = topDict.hasName('ROS');
  19651. var charStringOffset = topDict.getByName('CharStrings');
  19652. var charStringIndex = this.parseIndex(charStringOffset).obj;
  19653. var fontMatrix = topDict.getByName('FontMatrix');
  19654. if (fontMatrix) {
  19655. properties.fontMatrix = fontMatrix;
  19656. }
  19657. var fontBBox = topDict.getByName('FontBBox');
  19658. if (fontBBox) {
  19659. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  19660. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  19661. properties.ascentScaled = true;
  19662. }
  19663. var charset, encoding;
  19664. if (cff.isCIDFont) {
  19665. var fdArrayIndex = this.parseIndex(topDict.getByName('FDArray')).obj;
  19666. for (var i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  19667. var dictRaw = fdArrayIndex.get(i);
  19668. var fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  19669. this.parsePrivateDict(fontDict);
  19670. cff.fdArray.push(fontDict);
  19671. }
  19672. encoding = null;
  19673. charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, true);
  19674. cff.fdSelect = this.parseFDSelect(topDict.getByName('FDSelect'), charStringIndex.count);
  19675. } else {
  19676. charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, false);
  19677. encoding = this.parseEncoding(topDict.getByName('Encoding'), properties, cff.strings, charset.charset);
  19678. }
  19679. cff.charset = charset;
  19680. cff.encoding = encoding;
  19681. var charStringsAndSeacs = this.parseCharStrings(charStringIndex, topDict.privateDict.subrsIndex, globalSubrIndex.obj, cff.fdSelect, cff.fdArray);
  19682. cff.charStrings = charStringsAndSeacs.charStrings;
  19683. cff.seacs = charStringsAndSeacs.seacs;
  19684. cff.widths = charStringsAndSeacs.widths;
  19685. return cff;
  19686. },
  19687. parseHeader: function CFFParser_parseHeader() {
  19688. var bytes = this.bytes;
  19689. var bytesLength = bytes.length;
  19690. var offset = 0;
  19691. while (offset < bytesLength && bytes[offset] !== 1) {
  19692. ++offset;
  19693. }
  19694. if (offset >= bytesLength) {
  19695. error('Invalid CFF header');
  19696. } else if (offset !== 0) {
  19697. info('cff data is shifted');
  19698. bytes = bytes.subarray(offset);
  19699. this.bytes = bytes;
  19700. }
  19701. var major = bytes[0];
  19702. var minor = bytes[1];
  19703. var hdrSize = bytes[2];
  19704. var offSize = bytes[3];
  19705. var header = new CFFHeader(major, minor, hdrSize, offSize);
  19706. return {
  19707. obj: header,
  19708. endPos: hdrSize
  19709. };
  19710. },
  19711. parseDict: function CFFParser_parseDict(dict) {
  19712. var pos = 0;
  19713. function parseOperand() {
  19714. var value = dict[pos++];
  19715. if (value === 30) {
  19716. return parseFloatOperand();
  19717. } else if (value === 28) {
  19718. value = dict[pos++];
  19719. value = (value << 24 | dict[pos++] << 16) >> 16;
  19720. return value;
  19721. } else if (value === 29) {
  19722. value = dict[pos++];
  19723. value = value << 8 | dict[pos++];
  19724. value = value << 8 | dict[pos++];
  19725. value = value << 8 | dict[pos++];
  19726. return value;
  19727. } else if (value >= 32 && value <= 246) {
  19728. return value - 139;
  19729. } else if (value >= 247 && value <= 250) {
  19730. return (value - 247) * 256 + dict[pos++] + 108;
  19731. } else if (value >= 251 && value <= 254) {
  19732. return -((value - 251) * 256) - dict[pos++] - 108;
  19733. }
  19734. warn('CFFParser_parseDict: "' + value + '" is a reserved command.');
  19735. return NaN;
  19736. }
  19737. function parseFloatOperand() {
  19738. var str = '';
  19739. var eof = 15;
  19740. var lookup = [
  19741. '0',
  19742. '1',
  19743. '2',
  19744. '3',
  19745. '4',
  19746. '5',
  19747. '6',
  19748. '7',
  19749. '8',
  19750. '9',
  19751. '.',
  19752. 'E',
  19753. 'E-',
  19754. null,
  19755. '-'
  19756. ];
  19757. var length = dict.length;
  19758. while (pos < length) {
  19759. var b = dict[pos++];
  19760. var b1 = b >> 4;
  19761. var b2 = b & 15;
  19762. if (b1 === eof) {
  19763. break;
  19764. }
  19765. str += lookup[b1];
  19766. if (b2 === eof) {
  19767. break;
  19768. }
  19769. str += lookup[b2];
  19770. }
  19771. return parseFloat(str);
  19772. }
  19773. var operands = [];
  19774. var entries = [];
  19775. pos = 0;
  19776. var end = dict.length;
  19777. while (pos < end) {
  19778. var b = dict[pos];
  19779. if (b <= 21) {
  19780. if (b === 12) {
  19781. b = b << 8 | dict[++pos];
  19782. }
  19783. entries.push([
  19784. b,
  19785. operands
  19786. ]);
  19787. operands = [];
  19788. ++pos;
  19789. } else {
  19790. operands.push(parseOperand());
  19791. }
  19792. }
  19793. return entries;
  19794. },
  19795. parseIndex: function CFFParser_parseIndex(pos) {
  19796. var cffIndex = new CFFIndex();
  19797. var bytes = this.bytes;
  19798. var count = bytes[pos++] << 8 | bytes[pos++];
  19799. var offsets = [];
  19800. var end = pos;
  19801. var i, ii;
  19802. if (count !== 0) {
  19803. var offsetSize = bytes[pos++];
  19804. var startPos = pos + (count + 1) * offsetSize - 1;
  19805. for (i = 0, ii = count + 1; i < ii; ++i) {
  19806. var offset = 0;
  19807. for (var j = 0; j < offsetSize; ++j) {
  19808. offset <<= 8;
  19809. offset += bytes[pos++];
  19810. }
  19811. offsets.push(startPos + offset);
  19812. }
  19813. end = offsets[count];
  19814. }
  19815. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  19816. var offsetStart = offsets[i];
  19817. var offsetEnd = offsets[i + 1];
  19818. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  19819. }
  19820. return {
  19821. obj: cffIndex,
  19822. endPos: end
  19823. };
  19824. },
  19825. parseNameIndex: function CFFParser_parseNameIndex(index) {
  19826. var names = [];
  19827. for (var i = 0, ii = index.count; i < ii; ++i) {
  19828. var name = index.get(i);
  19829. var length = Math.min(name.length, 127);
  19830. var data = [];
  19831. for (var j = 0; j < length; ++j) {
  19832. var c = name[j];
  19833. if (j === 0 && c === 0) {
  19834. data[j] = c;
  19835. continue;
  19836. }
  19837. 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) {
  19838. data[j] = 95;
  19839. continue;
  19840. }
  19841. data[j] = c;
  19842. }
  19843. names.push(bytesToString(data));
  19844. }
  19845. return names;
  19846. },
  19847. parseStringIndex: function CFFParser_parseStringIndex(index) {
  19848. var strings = new CFFStrings();
  19849. for (var i = 0, ii = index.count; i < ii; ++i) {
  19850. var data = index.get(i);
  19851. strings.add(bytesToString(data));
  19852. }
  19853. return strings;
  19854. },
  19855. createDict: function CFFParser_createDict(Type, dict, strings) {
  19856. var cffDict = new Type(strings);
  19857. for (var i = 0, ii = dict.length; i < ii; ++i) {
  19858. var pair = dict[i];
  19859. var key = pair[0];
  19860. var value = pair[1];
  19861. cffDict.setByKey(key, value);
  19862. }
  19863. return cffDict;
  19864. },
  19865. parseCharString: function CFFParser_parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  19866. if (state.callDepth > MAX_SUBR_NESTING) {
  19867. return false;
  19868. }
  19869. var stackSize = state.stackSize;
  19870. var stack = state.stack;
  19871. var length = data.length;
  19872. for (var j = 0; j < length;) {
  19873. var value = data[j++];
  19874. var validationCommand = null;
  19875. if (value === 12) {
  19876. var q = data[j++];
  19877. if (q === 0) {
  19878. data[j - 2] = 139;
  19879. data[j - 1] = 22;
  19880. stackSize = 0;
  19881. } else {
  19882. validationCommand = CharstringValidationData12[q];
  19883. }
  19884. } else if (value === 28) {
  19885. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  19886. j += 2;
  19887. stackSize++;
  19888. } else if (value === 14) {
  19889. if (stackSize >= 4) {
  19890. stackSize -= 4;
  19891. if (this.seacAnalysisEnabled) {
  19892. state.seac = stack.slice(stackSize, stackSize + 4);
  19893. return false;
  19894. }
  19895. }
  19896. validationCommand = CharstringValidationData[value];
  19897. } else if (value >= 32 && value <= 246) {
  19898. stack[stackSize] = value - 139;
  19899. stackSize++;
  19900. } else if (value >= 247 && value <= 254) {
  19901. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  19902. j++;
  19903. stackSize++;
  19904. } else if (value === 255) {
  19905. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  19906. j += 4;
  19907. stackSize++;
  19908. } else if (value === 19 || value === 20) {
  19909. state.hints += stackSize >> 1;
  19910. j += state.hints + 7 >> 3;
  19911. stackSize %= 2;
  19912. validationCommand = CharstringValidationData[value];
  19913. } else if (value === 10 || value === 29) {
  19914. var subrsIndex;
  19915. if (value === 10) {
  19916. subrsIndex = localSubrIndex;
  19917. } else {
  19918. subrsIndex = globalSubrIndex;
  19919. }
  19920. if (!subrsIndex) {
  19921. validationCommand = CharstringValidationData[value];
  19922. warn('Missing subrsIndex for ' + validationCommand.id);
  19923. return false;
  19924. }
  19925. var bias = 32768;
  19926. if (subrsIndex.count < 1240) {
  19927. bias = 107;
  19928. } else if (subrsIndex.count < 33900) {
  19929. bias = 1131;
  19930. }
  19931. var subrNumber = stack[--stackSize] + bias;
  19932. if (subrNumber < 0 || subrNumber >= subrsIndex.count) {
  19933. validationCommand = CharstringValidationData[value];
  19934. warn('Out of bounds subrIndex for ' + validationCommand.id);
  19935. return false;
  19936. }
  19937. state.stackSize = stackSize;
  19938. state.callDepth++;
  19939. var valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  19940. if (!valid) {
  19941. return false;
  19942. }
  19943. state.callDepth--;
  19944. stackSize = state.stackSize;
  19945. continue;
  19946. } else if (value === 11) {
  19947. state.stackSize = stackSize;
  19948. return true;
  19949. } else {
  19950. validationCommand = CharstringValidationData[value];
  19951. }
  19952. if (validationCommand) {
  19953. if (validationCommand.stem) {
  19954. state.hints += stackSize >> 1;
  19955. }
  19956. if ('min' in validationCommand) {
  19957. if (!state.undefStack && stackSize < validationCommand.min) {
  19958. warn('Not enough parameters for ' + validationCommand.id + '; actual: ' + stackSize + ', expected: ' + validationCommand.min);
  19959. return false;
  19960. }
  19961. }
  19962. if (state.firstStackClearing && validationCommand.stackClearing) {
  19963. state.firstStackClearing = false;
  19964. stackSize -= validationCommand.min;
  19965. if (stackSize >= 2 && validationCommand.stem) {
  19966. stackSize %= 2;
  19967. } else if (stackSize > 1) {
  19968. warn('Found too many parameters for stack-clearing command');
  19969. }
  19970. if (stackSize > 0 && stack[stackSize - 1] >= 0) {
  19971. state.width = stack[stackSize - 1];
  19972. }
  19973. }
  19974. if ('stackDelta' in validationCommand) {
  19975. if ('stackFn' in validationCommand) {
  19976. validationCommand.stackFn(stack, stackSize);
  19977. }
  19978. stackSize += validationCommand.stackDelta;
  19979. } else if (validationCommand.stackClearing) {
  19980. stackSize = 0;
  19981. } else if (validationCommand.resetStack) {
  19982. stackSize = 0;
  19983. state.undefStack = false;
  19984. } else if (validationCommand.undefStack) {
  19985. stackSize = 0;
  19986. state.undefStack = true;
  19987. state.firstStackClearing = false;
  19988. }
  19989. }
  19990. }
  19991. state.stackSize = stackSize;
  19992. return true;
  19993. },
  19994. parseCharStrings: function CFFParser_parseCharStrings(charStrings, localSubrIndex, globalSubrIndex, fdSelect, fdArray) {
  19995. var seacs = [];
  19996. var widths = [];
  19997. var count = charStrings.count;
  19998. for (var i = 0; i < count; i++) {
  19999. var charstring = charStrings.get(i);
  20000. var state = {
  20001. callDepth: 0,
  20002. stackSize: 0,
  20003. stack: [],
  20004. undefStack: true,
  20005. hints: 0,
  20006. firstStackClearing: true,
  20007. seac: null,
  20008. width: null
  20009. };
  20010. var valid = true;
  20011. var localSubrToUse = null;
  20012. if (fdSelect && fdArray.length) {
  20013. var fdIndex = fdSelect.getFDIndex(i);
  20014. if (fdIndex === -1) {
  20015. warn('Glyph index is not in fd select.');
  20016. valid = false;
  20017. }
  20018. if (fdIndex >= fdArray.length) {
  20019. warn('Invalid fd index for glyph index.');
  20020. valid = false;
  20021. }
  20022. if (valid) {
  20023. localSubrToUse = fdArray[fdIndex].privateDict.subrsIndex;
  20024. }
  20025. } else if (localSubrIndex) {
  20026. localSubrToUse = localSubrIndex;
  20027. }
  20028. if (valid) {
  20029. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  20030. }
  20031. if (state.width !== null) {
  20032. widths[i] = state.width;
  20033. }
  20034. if (state.seac !== null) {
  20035. seacs[i] = state.seac;
  20036. }
  20037. if (!valid) {
  20038. charStrings.set(i, new Uint8Array([14]));
  20039. }
  20040. }
  20041. return {
  20042. charStrings: charStrings,
  20043. seacs: seacs,
  20044. widths: widths
  20045. };
  20046. },
  20047. emptyPrivateDictionary: function CFFParser_emptyPrivateDictionary(parentDict) {
  20048. var privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  20049. parentDict.setByKey(18, [
  20050. 0,
  20051. 0
  20052. ]);
  20053. parentDict.privateDict = privateDict;
  20054. },
  20055. parsePrivateDict: function CFFParser_parsePrivateDict(parentDict) {
  20056. if (!parentDict.hasName('Private')) {
  20057. this.emptyPrivateDictionary(parentDict);
  20058. return;
  20059. }
  20060. var privateOffset = parentDict.getByName('Private');
  20061. if (!isArray(privateOffset) || privateOffset.length !== 2) {
  20062. parentDict.removeByName('Private');
  20063. return;
  20064. }
  20065. var size = privateOffset[0];
  20066. var offset = privateOffset[1];
  20067. if (size === 0 || offset >= this.bytes.length) {
  20068. this.emptyPrivateDictionary(parentDict);
  20069. return;
  20070. }
  20071. var privateDictEnd = offset + size;
  20072. var dictData = this.bytes.subarray(offset, privateDictEnd);
  20073. var dict = this.parseDict(dictData);
  20074. var privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  20075. parentDict.privateDict = privateDict;
  20076. if (!privateDict.getByName('Subrs')) {
  20077. return;
  20078. }
  20079. var subrsOffset = privateDict.getByName('Subrs');
  20080. var relativeOffset = offset + subrsOffset;
  20081. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  20082. this.emptyPrivateDictionary(parentDict);
  20083. return;
  20084. }
  20085. var subrsIndex = this.parseIndex(relativeOffset);
  20086. privateDict.subrsIndex = subrsIndex.obj;
  20087. },
  20088. parseCharsets: function CFFParser_parseCharsets(pos, length, strings, cid) {
  20089. if (pos === 0) {
  20090. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, ISOAdobeCharset);
  20091. } else if (pos === 1) {
  20092. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, ExpertCharset);
  20093. } else if (pos === 2) {
  20094. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, ExpertSubsetCharset);
  20095. }
  20096. var bytes = this.bytes;
  20097. var start = pos;
  20098. var format = bytes[pos++];
  20099. var charset = ['.notdef'];
  20100. var id, count, i;
  20101. length -= 1;
  20102. switch (format) {
  20103. case 0:
  20104. for (i = 0; i < length; i++) {
  20105. id = bytes[pos++] << 8 | bytes[pos++];
  20106. charset.push(cid ? id : strings.get(id));
  20107. }
  20108. break;
  20109. case 1:
  20110. while (charset.length <= length) {
  20111. id = bytes[pos++] << 8 | bytes[pos++];
  20112. count = bytes[pos++];
  20113. for (i = 0; i <= count; i++) {
  20114. charset.push(cid ? id++ : strings.get(id++));
  20115. }
  20116. }
  20117. break;
  20118. case 2:
  20119. while (charset.length <= length) {
  20120. id = bytes[pos++] << 8 | bytes[pos++];
  20121. count = bytes[pos++] << 8 | bytes[pos++];
  20122. for (i = 0; i <= count; i++) {
  20123. charset.push(cid ? id++ : strings.get(id++));
  20124. }
  20125. }
  20126. break;
  20127. default:
  20128. error('Unknown charset format');
  20129. }
  20130. var end = pos;
  20131. var raw = bytes.subarray(start, end);
  20132. return new CFFCharset(false, format, charset, raw);
  20133. },
  20134. parseEncoding: function CFFParser_parseEncoding(pos, properties, strings, charset) {
  20135. var encoding = Object.create(null);
  20136. var bytes = this.bytes;
  20137. var predefined = false;
  20138. var format, i, ii;
  20139. var raw = null;
  20140. function readSupplement() {
  20141. var supplementsCount = bytes[pos++];
  20142. for (i = 0; i < supplementsCount; i++) {
  20143. var code = bytes[pos++];
  20144. var sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  20145. encoding[code] = charset.indexOf(strings.get(sid));
  20146. }
  20147. }
  20148. if (pos === 0 || pos === 1) {
  20149. predefined = true;
  20150. format = pos;
  20151. var baseEncoding = pos ? ExpertEncoding : StandardEncoding;
  20152. for (i = 0, ii = charset.length; i < ii; i++) {
  20153. var index = baseEncoding.indexOf(charset[i]);
  20154. if (index !== -1) {
  20155. encoding[index] = i;
  20156. }
  20157. }
  20158. } else {
  20159. var dataStart = pos;
  20160. format = bytes[pos++];
  20161. switch (format & 0x7f) {
  20162. case 0:
  20163. var glyphsCount = bytes[pos++];
  20164. for (i = 1; i <= glyphsCount; i++) {
  20165. encoding[bytes[pos++]] = i;
  20166. }
  20167. break;
  20168. case 1:
  20169. var rangesCount = bytes[pos++];
  20170. var gid = 1;
  20171. for (i = 0; i < rangesCount; i++) {
  20172. var start = bytes[pos++];
  20173. var left = bytes[pos++];
  20174. for (var j = start; j <= start + left; j++) {
  20175. encoding[j] = gid++;
  20176. }
  20177. }
  20178. break;
  20179. default:
  20180. error('Unknown encoding format: ' + format + ' in CFF');
  20181. break;
  20182. }
  20183. var dataEnd = pos;
  20184. if (format & 0x80) {
  20185. bytes[dataStart] &= 0x7f;
  20186. readSupplement();
  20187. }
  20188. raw = bytes.subarray(dataStart, dataEnd);
  20189. }
  20190. format = format & 0x7f;
  20191. return new CFFEncoding(predefined, format, encoding, raw);
  20192. },
  20193. parseFDSelect: function CFFParser_parseFDSelect(pos, length) {
  20194. var start = pos;
  20195. var bytes = this.bytes;
  20196. var format = bytes[pos++];
  20197. var fdSelect = [], rawBytes;
  20198. var i, invalidFirstGID = false;
  20199. switch (format) {
  20200. case 0:
  20201. for (i = 0; i < length; ++i) {
  20202. var id = bytes[pos++];
  20203. fdSelect.push(id);
  20204. }
  20205. rawBytes = bytes.subarray(start, pos);
  20206. break;
  20207. case 3:
  20208. var rangesCount = bytes[pos++] << 8 | bytes[pos++];
  20209. for (i = 0; i < rangesCount; ++i) {
  20210. var first = bytes[pos++] << 8 | bytes[pos++];
  20211. if (i === 0 && first !== 0) {
  20212. warn('parseFDSelect: The first range must have a first GID of 0' + ' -- trying to recover.');
  20213. invalidFirstGID = true;
  20214. first = 0;
  20215. }
  20216. var fdIndex = bytes[pos++];
  20217. var next = bytes[pos] << 8 | bytes[pos + 1];
  20218. for (var j = first; j < next; ++j) {
  20219. fdSelect.push(fdIndex);
  20220. }
  20221. }
  20222. pos += 2;
  20223. rawBytes = bytes.subarray(start, pos);
  20224. if (invalidFirstGID) {
  20225. rawBytes[3] = rawBytes[4] = 0;
  20226. }
  20227. break;
  20228. default:
  20229. error('parseFDSelect: Unknown format "' + format + '".');
  20230. break;
  20231. }
  20232. assert(fdSelect.length === length, 'parseFDSelect: Invalid font data.');
  20233. return new CFFFDSelect(fdSelect, rawBytes);
  20234. }
  20235. };
  20236. return CFFParser;
  20237. }();
  20238. var CFF = function CFFClosure() {
  20239. function CFF() {
  20240. this.header = null;
  20241. this.names = [];
  20242. this.topDict = null;
  20243. this.strings = new CFFStrings();
  20244. this.globalSubrIndex = null;
  20245. this.encoding = null;
  20246. this.charset = null;
  20247. this.charStrings = null;
  20248. this.fdArray = [];
  20249. this.fdSelect = null;
  20250. this.isCIDFont = false;
  20251. }
  20252. return CFF;
  20253. }();
  20254. var CFFHeader = function CFFHeaderClosure() {
  20255. function CFFHeader(major, minor, hdrSize, offSize) {
  20256. this.major = major;
  20257. this.minor = minor;
  20258. this.hdrSize = hdrSize;
  20259. this.offSize = offSize;
  20260. }
  20261. return CFFHeader;
  20262. }();
  20263. var CFFStrings = function CFFStringsClosure() {
  20264. function CFFStrings() {
  20265. this.strings = [];
  20266. }
  20267. CFFStrings.prototype = {
  20268. get: function CFFStrings_get(index) {
  20269. if (index >= 0 && index <= 390) {
  20270. return CFFStandardStrings[index];
  20271. }
  20272. if (index - 391 <= this.strings.length) {
  20273. return this.strings[index - 391];
  20274. }
  20275. return CFFStandardStrings[0];
  20276. },
  20277. add: function CFFStrings_add(value) {
  20278. this.strings.push(value);
  20279. },
  20280. get count() {
  20281. return this.strings.length;
  20282. }
  20283. };
  20284. return CFFStrings;
  20285. }();
  20286. var CFFIndex = function CFFIndexClosure() {
  20287. function CFFIndex() {
  20288. this.objects = [];
  20289. this.length = 0;
  20290. }
  20291. CFFIndex.prototype = {
  20292. add: function CFFIndex_add(data) {
  20293. this.length += data.length;
  20294. this.objects.push(data);
  20295. },
  20296. set: function CFFIndex_set(index, data) {
  20297. this.length += data.length - this.objects[index].length;
  20298. this.objects[index] = data;
  20299. },
  20300. get: function CFFIndex_get(index) {
  20301. return this.objects[index];
  20302. },
  20303. get count() {
  20304. return this.objects.length;
  20305. }
  20306. };
  20307. return CFFIndex;
  20308. }();
  20309. var CFFDict = function CFFDictClosure() {
  20310. function CFFDict(tables, strings) {
  20311. this.keyToNameMap = tables.keyToNameMap;
  20312. this.nameToKeyMap = tables.nameToKeyMap;
  20313. this.defaults = tables.defaults;
  20314. this.types = tables.types;
  20315. this.opcodes = tables.opcodes;
  20316. this.order = tables.order;
  20317. this.strings = strings;
  20318. this.values = Object.create(null);
  20319. }
  20320. CFFDict.prototype = {
  20321. setByKey: function CFFDict_setByKey(key, value) {
  20322. if (!(key in this.keyToNameMap)) {
  20323. return false;
  20324. }
  20325. var valueLength = value.length;
  20326. if (valueLength === 0) {
  20327. return true;
  20328. }
  20329. for (var i = 0; i < valueLength; i++) {
  20330. if (isNaN(value[i])) {
  20331. warn('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
  20332. return true;
  20333. }
  20334. }
  20335. var type = this.types[key];
  20336. if (type === 'num' || type === 'sid' || type === 'offset') {
  20337. value = value[0];
  20338. }
  20339. this.values[key] = value;
  20340. return true;
  20341. },
  20342. setByName: function CFFDict_setByName(name, value) {
  20343. if (!(name in this.nameToKeyMap)) {
  20344. error('Invalid dictionary name "' + name + '"');
  20345. }
  20346. this.values[this.nameToKeyMap[name]] = value;
  20347. },
  20348. hasName: function CFFDict_hasName(name) {
  20349. return this.nameToKeyMap[name] in this.values;
  20350. },
  20351. getByName: function CFFDict_getByName(name) {
  20352. if (!(name in this.nameToKeyMap)) {
  20353. error('Invalid dictionary name "' + name + '"');
  20354. }
  20355. var key = this.nameToKeyMap[name];
  20356. if (!(key in this.values)) {
  20357. return this.defaults[key];
  20358. }
  20359. return this.values[key];
  20360. },
  20361. removeByName: function CFFDict_removeByName(name) {
  20362. delete this.values[this.nameToKeyMap[name]];
  20363. }
  20364. };
  20365. CFFDict.createTables = function CFFDict_createTables(layout) {
  20366. var tables = {
  20367. keyToNameMap: {},
  20368. nameToKeyMap: {},
  20369. defaults: {},
  20370. types: {},
  20371. opcodes: {},
  20372. order: []
  20373. };
  20374. for (var i = 0, ii = layout.length; i < ii; ++i) {
  20375. var entry = layout[i];
  20376. var key = isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  20377. tables.keyToNameMap[key] = entry[1];
  20378. tables.nameToKeyMap[entry[1]] = key;
  20379. tables.types[key] = entry[2];
  20380. tables.defaults[key] = entry[3];
  20381. tables.opcodes[key] = isArray(entry[0]) ? entry[0] : [entry[0]];
  20382. tables.order.push(key);
  20383. }
  20384. return tables;
  20385. };
  20386. return CFFDict;
  20387. }();
  20388. var CFFTopDict = function CFFTopDictClosure() {
  20389. var layout = [
  20390. [
  20391. [
  20392. 12,
  20393. 30
  20394. ],
  20395. 'ROS',
  20396. [
  20397. 'sid',
  20398. 'sid',
  20399. 'num'
  20400. ],
  20401. null
  20402. ],
  20403. [
  20404. [
  20405. 12,
  20406. 20
  20407. ],
  20408. 'SyntheticBase',
  20409. 'num',
  20410. null
  20411. ],
  20412. [
  20413. 0,
  20414. 'version',
  20415. 'sid',
  20416. null
  20417. ],
  20418. [
  20419. 1,
  20420. 'Notice',
  20421. 'sid',
  20422. null
  20423. ],
  20424. [
  20425. [
  20426. 12,
  20427. 0
  20428. ],
  20429. 'Copyright',
  20430. 'sid',
  20431. null
  20432. ],
  20433. [
  20434. 2,
  20435. 'FullName',
  20436. 'sid',
  20437. null
  20438. ],
  20439. [
  20440. 3,
  20441. 'FamilyName',
  20442. 'sid',
  20443. null
  20444. ],
  20445. [
  20446. 4,
  20447. 'Weight',
  20448. 'sid',
  20449. null
  20450. ],
  20451. [
  20452. [
  20453. 12,
  20454. 1
  20455. ],
  20456. 'isFixedPitch',
  20457. 'num',
  20458. 0
  20459. ],
  20460. [
  20461. [
  20462. 12,
  20463. 2
  20464. ],
  20465. 'ItalicAngle',
  20466. 'num',
  20467. 0
  20468. ],
  20469. [
  20470. [
  20471. 12,
  20472. 3
  20473. ],
  20474. 'UnderlinePosition',
  20475. 'num',
  20476. -100
  20477. ],
  20478. [
  20479. [
  20480. 12,
  20481. 4
  20482. ],
  20483. 'UnderlineThickness',
  20484. 'num',
  20485. 50
  20486. ],
  20487. [
  20488. [
  20489. 12,
  20490. 5
  20491. ],
  20492. 'PaintType',
  20493. 'num',
  20494. 0
  20495. ],
  20496. [
  20497. [
  20498. 12,
  20499. 6
  20500. ],
  20501. 'CharstringType',
  20502. 'num',
  20503. 2
  20504. ],
  20505. [
  20506. [
  20507. 12,
  20508. 7
  20509. ],
  20510. 'FontMatrix',
  20511. [
  20512. 'num',
  20513. 'num',
  20514. 'num',
  20515. 'num',
  20516. 'num',
  20517. 'num'
  20518. ],
  20519. [
  20520. 0.001,
  20521. 0,
  20522. 0,
  20523. 0.001,
  20524. 0,
  20525. 0
  20526. ]
  20527. ],
  20528. [
  20529. 13,
  20530. 'UniqueID',
  20531. 'num',
  20532. null
  20533. ],
  20534. [
  20535. 5,
  20536. 'FontBBox',
  20537. [
  20538. 'num',
  20539. 'num',
  20540. 'num',
  20541. 'num'
  20542. ],
  20543. [
  20544. 0,
  20545. 0,
  20546. 0,
  20547. 0
  20548. ]
  20549. ],
  20550. [
  20551. [
  20552. 12,
  20553. 8
  20554. ],
  20555. 'StrokeWidth',
  20556. 'num',
  20557. 0
  20558. ],
  20559. [
  20560. 14,
  20561. 'XUID',
  20562. 'array',
  20563. null
  20564. ],
  20565. [
  20566. 15,
  20567. 'charset',
  20568. 'offset',
  20569. 0
  20570. ],
  20571. [
  20572. 16,
  20573. 'Encoding',
  20574. 'offset',
  20575. 0
  20576. ],
  20577. [
  20578. 17,
  20579. 'CharStrings',
  20580. 'offset',
  20581. 0
  20582. ],
  20583. [
  20584. 18,
  20585. 'Private',
  20586. [
  20587. 'offset',
  20588. 'offset'
  20589. ],
  20590. null
  20591. ],
  20592. [
  20593. [
  20594. 12,
  20595. 21
  20596. ],
  20597. 'PostScript',
  20598. 'sid',
  20599. null
  20600. ],
  20601. [
  20602. [
  20603. 12,
  20604. 22
  20605. ],
  20606. 'BaseFontName',
  20607. 'sid',
  20608. null
  20609. ],
  20610. [
  20611. [
  20612. 12,
  20613. 23
  20614. ],
  20615. 'BaseFontBlend',
  20616. 'delta',
  20617. null
  20618. ],
  20619. [
  20620. [
  20621. 12,
  20622. 31
  20623. ],
  20624. 'CIDFontVersion',
  20625. 'num',
  20626. 0
  20627. ],
  20628. [
  20629. [
  20630. 12,
  20631. 32
  20632. ],
  20633. 'CIDFontRevision',
  20634. 'num',
  20635. 0
  20636. ],
  20637. [
  20638. [
  20639. 12,
  20640. 33
  20641. ],
  20642. 'CIDFontType',
  20643. 'num',
  20644. 0
  20645. ],
  20646. [
  20647. [
  20648. 12,
  20649. 34
  20650. ],
  20651. 'CIDCount',
  20652. 'num',
  20653. 8720
  20654. ],
  20655. [
  20656. [
  20657. 12,
  20658. 35
  20659. ],
  20660. 'UIDBase',
  20661. 'num',
  20662. null
  20663. ],
  20664. [
  20665. [
  20666. 12,
  20667. 37
  20668. ],
  20669. 'FDSelect',
  20670. 'offset',
  20671. null
  20672. ],
  20673. [
  20674. [
  20675. 12,
  20676. 36
  20677. ],
  20678. 'FDArray',
  20679. 'offset',
  20680. null
  20681. ],
  20682. [
  20683. [
  20684. 12,
  20685. 38
  20686. ],
  20687. 'FontName',
  20688. 'sid',
  20689. null
  20690. ]
  20691. ];
  20692. var tables = null;
  20693. function CFFTopDict(strings) {
  20694. if (tables === null) {
  20695. tables = CFFDict.createTables(layout);
  20696. }
  20697. CFFDict.call(this, tables, strings);
  20698. this.privateDict = null;
  20699. }
  20700. CFFTopDict.prototype = Object.create(CFFDict.prototype);
  20701. return CFFTopDict;
  20702. }();
  20703. var CFFPrivateDict = function CFFPrivateDictClosure() {
  20704. var layout = [
  20705. [
  20706. 6,
  20707. 'BlueValues',
  20708. 'delta',
  20709. null
  20710. ],
  20711. [
  20712. 7,
  20713. 'OtherBlues',
  20714. 'delta',
  20715. null
  20716. ],
  20717. [
  20718. 8,
  20719. 'FamilyBlues',
  20720. 'delta',
  20721. null
  20722. ],
  20723. [
  20724. 9,
  20725. 'FamilyOtherBlues',
  20726. 'delta',
  20727. null
  20728. ],
  20729. [
  20730. [
  20731. 12,
  20732. 9
  20733. ],
  20734. 'BlueScale',
  20735. 'num',
  20736. 0.039625
  20737. ],
  20738. [
  20739. [
  20740. 12,
  20741. 10
  20742. ],
  20743. 'BlueShift',
  20744. 'num',
  20745. 7
  20746. ],
  20747. [
  20748. [
  20749. 12,
  20750. 11
  20751. ],
  20752. 'BlueFuzz',
  20753. 'num',
  20754. 1
  20755. ],
  20756. [
  20757. 10,
  20758. 'StdHW',
  20759. 'num',
  20760. null
  20761. ],
  20762. [
  20763. 11,
  20764. 'StdVW',
  20765. 'num',
  20766. null
  20767. ],
  20768. [
  20769. [
  20770. 12,
  20771. 12
  20772. ],
  20773. 'StemSnapH',
  20774. 'delta',
  20775. null
  20776. ],
  20777. [
  20778. [
  20779. 12,
  20780. 13
  20781. ],
  20782. 'StemSnapV',
  20783. 'delta',
  20784. null
  20785. ],
  20786. [
  20787. [
  20788. 12,
  20789. 14
  20790. ],
  20791. 'ForceBold',
  20792. 'num',
  20793. 0
  20794. ],
  20795. [
  20796. [
  20797. 12,
  20798. 17
  20799. ],
  20800. 'LanguageGroup',
  20801. 'num',
  20802. 0
  20803. ],
  20804. [
  20805. [
  20806. 12,
  20807. 18
  20808. ],
  20809. 'ExpansionFactor',
  20810. 'num',
  20811. 0.06
  20812. ],
  20813. [
  20814. [
  20815. 12,
  20816. 19
  20817. ],
  20818. 'initialRandomSeed',
  20819. 'num',
  20820. 0
  20821. ],
  20822. [
  20823. 20,
  20824. 'defaultWidthX',
  20825. 'num',
  20826. 0
  20827. ],
  20828. [
  20829. 21,
  20830. 'nominalWidthX',
  20831. 'num',
  20832. 0
  20833. ],
  20834. [
  20835. 19,
  20836. 'Subrs',
  20837. 'offset',
  20838. null
  20839. ]
  20840. ];
  20841. var tables = null;
  20842. function CFFPrivateDict(strings) {
  20843. if (tables === null) {
  20844. tables = CFFDict.createTables(layout);
  20845. }
  20846. CFFDict.call(this, tables, strings);
  20847. this.subrsIndex = null;
  20848. }
  20849. CFFPrivateDict.prototype = Object.create(CFFDict.prototype);
  20850. return CFFPrivateDict;
  20851. }();
  20852. var CFFCharsetPredefinedTypes = {
  20853. ISO_ADOBE: 0,
  20854. EXPERT: 1,
  20855. EXPERT_SUBSET: 2
  20856. };
  20857. var CFFCharset = function CFFCharsetClosure() {
  20858. function CFFCharset(predefined, format, charset, raw) {
  20859. this.predefined = predefined;
  20860. this.format = format;
  20861. this.charset = charset;
  20862. this.raw = raw;
  20863. }
  20864. return CFFCharset;
  20865. }();
  20866. var CFFEncoding = function CFFEncodingClosure() {
  20867. function CFFEncoding(predefined, format, encoding, raw) {
  20868. this.predefined = predefined;
  20869. this.format = format;
  20870. this.encoding = encoding;
  20871. this.raw = raw;
  20872. }
  20873. return CFFEncoding;
  20874. }();
  20875. var CFFFDSelect = function CFFFDSelectClosure() {
  20876. function CFFFDSelect(fdSelect, raw) {
  20877. this.fdSelect = fdSelect;
  20878. this.raw = raw;
  20879. }
  20880. CFFFDSelect.prototype = {
  20881. getFDIndex: function CFFFDSelect_get(glyphIndex) {
  20882. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  20883. return -1;
  20884. }
  20885. return this.fdSelect[glyphIndex];
  20886. }
  20887. };
  20888. return CFFFDSelect;
  20889. }();
  20890. var CFFOffsetTracker = function CFFOffsetTrackerClosure() {
  20891. function CFFOffsetTracker() {
  20892. this.offsets = Object.create(null);
  20893. }
  20894. CFFOffsetTracker.prototype = {
  20895. isTracking: function CFFOffsetTracker_isTracking(key) {
  20896. return key in this.offsets;
  20897. },
  20898. track: function CFFOffsetTracker_track(key, location) {
  20899. if (key in this.offsets) {
  20900. error('Already tracking location of ' + key);
  20901. }
  20902. this.offsets[key] = location;
  20903. },
  20904. offset: function CFFOffsetTracker_offset(value) {
  20905. for (var key in this.offsets) {
  20906. this.offsets[key] += value;
  20907. }
  20908. },
  20909. setEntryLocation: function CFFOffsetTracker_setEntryLocation(key, values, output) {
  20910. if (!(key in this.offsets)) {
  20911. error('Not tracking location of ' + key);
  20912. }
  20913. var data = output.data;
  20914. var dataOffset = this.offsets[key];
  20915. var size = 5;
  20916. for (var i = 0, ii = values.length; i < ii; ++i) {
  20917. var offset0 = i * size + dataOffset;
  20918. var offset1 = offset0 + 1;
  20919. var offset2 = offset0 + 2;
  20920. var offset3 = offset0 + 3;
  20921. var offset4 = offset0 + 4;
  20922. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  20923. error('writing to an offset that is not empty');
  20924. }
  20925. var value = values[i];
  20926. data[offset0] = 0x1d;
  20927. data[offset1] = value >> 24 & 0xFF;
  20928. data[offset2] = value >> 16 & 0xFF;
  20929. data[offset3] = value >> 8 & 0xFF;
  20930. data[offset4] = value & 0xFF;
  20931. }
  20932. }
  20933. };
  20934. return CFFOffsetTracker;
  20935. }();
  20936. var CFFCompiler = function CFFCompilerClosure() {
  20937. function CFFCompiler(cff) {
  20938. this.cff = cff;
  20939. }
  20940. CFFCompiler.prototype = {
  20941. compile: function CFFCompiler_compile() {
  20942. var cff = this.cff;
  20943. var output = {
  20944. data: [],
  20945. length: 0,
  20946. add: function CFFCompiler_add(data) {
  20947. this.data = this.data.concat(data);
  20948. this.length = this.data.length;
  20949. }
  20950. };
  20951. var header = this.compileHeader(cff.header);
  20952. output.add(header);
  20953. var nameIndex = this.compileNameIndex(cff.names);
  20954. output.add(nameIndex);
  20955. if (cff.isCIDFont) {
  20956. if (cff.topDict.hasName('FontMatrix')) {
  20957. var base = cff.topDict.getByName('FontMatrix');
  20958. cff.topDict.removeByName('FontMatrix');
  20959. for (var i = 0, ii = cff.fdArray.length; i < ii; i++) {
  20960. var subDict = cff.fdArray[i];
  20961. var matrix = base.slice(0);
  20962. if (subDict.hasName('FontMatrix')) {
  20963. matrix = Util.transform(matrix, subDict.getByName('FontMatrix'));
  20964. }
  20965. subDict.setByName('FontMatrix', matrix);
  20966. }
  20967. }
  20968. }
  20969. var compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  20970. output.add(compiled.output);
  20971. var topDictTracker = compiled.trackers[0];
  20972. var stringIndex = this.compileStringIndex(cff.strings.strings);
  20973. output.add(stringIndex);
  20974. var globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  20975. output.add(globalSubrIndex);
  20976. if (cff.encoding && cff.topDict.hasName('Encoding')) {
  20977. if (cff.encoding.predefined) {
  20978. topDictTracker.setEntryLocation('Encoding', [cff.encoding.format], output);
  20979. } else {
  20980. var encoding = this.compileEncoding(cff.encoding);
  20981. topDictTracker.setEntryLocation('Encoding', [output.length], output);
  20982. output.add(encoding);
  20983. }
  20984. }
  20985. if (cff.charset && cff.topDict.hasName('charset')) {
  20986. if (cff.charset.predefined) {
  20987. topDictTracker.setEntryLocation('charset', [cff.charset.format], output);
  20988. } else {
  20989. var charset = this.compileCharset(cff.charset);
  20990. topDictTracker.setEntryLocation('charset', [output.length], output);
  20991. output.add(charset);
  20992. }
  20993. }
  20994. var charStrings = this.compileCharStrings(cff.charStrings);
  20995. topDictTracker.setEntryLocation('CharStrings', [output.length], output);
  20996. output.add(charStrings);
  20997. if (cff.isCIDFont) {
  20998. topDictTracker.setEntryLocation('FDSelect', [output.length], output);
  20999. var fdSelect = this.compileFDSelect(cff.fdSelect.raw);
  21000. output.add(fdSelect);
  21001. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  21002. topDictTracker.setEntryLocation('FDArray', [output.length], output);
  21003. output.add(compiled.output);
  21004. var fontDictTrackers = compiled.trackers;
  21005. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  21006. }
  21007. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  21008. output.add([0]);
  21009. return output.data;
  21010. },
  21011. encodeNumber: function CFFCompiler_encodeNumber(value) {
  21012. if (parseFloat(value) === parseInt(value, 10) && !isNaN(value)) {
  21013. return this.encodeInteger(value);
  21014. }
  21015. return this.encodeFloat(value);
  21016. },
  21017. encodeFloat: function CFFCompiler_encodeFloat(num) {
  21018. var value = num.toString();
  21019. var m = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value);
  21020. if (m) {
  21021. var epsilon = parseFloat('1e' + ((m[2] ? +m[2] : 0) + m[1].length));
  21022. value = (Math.round(num * epsilon) / epsilon).toString();
  21023. }
  21024. var nibbles = '';
  21025. var i, ii;
  21026. for (i = 0, ii = value.length; i < ii; ++i) {
  21027. var a = value[i];
  21028. if (a === 'e') {
  21029. nibbles += value[++i] === '-' ? 'c' : 'b';
  21030. } else if (a === '.') {
  21031. nibbles += 'a';
  21032. } else if (a === '-') {
  21033. nibbles += 'e';
  21034. } else {
  21035. nibbles += a;
  21036. }
  21037. }
  21038. nibbles += nibbles.length & 1 ? 'f' : 'ff';
  21039. var out = [30];
  21040. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  21041. out.push(parseInt(nibbles.substr(i, 2), 16));
  21042. }
  21043. return out;
  21044. },
  21045. encodeInteger: function CFFCompiler_encodeInteger(value) {
  21046. var code;
  21047. if (value >= -107 && value <= 107) {
  21048. code = [value + 139];
  21049. } else if (value >= 108 && value <= 1131) {
  21050. value = value - 108;
  21051. code = [
  21052. (value >> 8) + 247,
  21053. value & 0xFF
  21054. ];
  21055. } else if (value >= -1131 && value <= -108) {
  21056. value = -value - 108;
  21057. code = [
  21058. (value >> 8) + 251,
  21059. value & 0xFF
  21060. ];
  21061. } else if (value >= -32768 && value <= 32767) {
  21062. code = [
  21063. 0x1c,
  21064. value >> 8 & 0xFF,
  21065. value & 0xFF
  21066. ];
  21067. } else {
  21068. code = [
  21069. 0x1d,
  21070. value >> 24 & 0xFF,
  21071. value >> 16 & 0xFF,
  21072. value >> 8 & 0xFF,
  21073. value & 0xFF
  21074. ];
  21075. }
  21076. return code;
  21077. },
  21078. compileHeader: function CFFCompiler_compileHeader(header) {
  21079. return [
  21080. header.major,
  21081. header.minor,
  21082. header.hdrSize,
  21083. header.offSize
  21084. ];
  21085. },
  21086. compileNameIndex: function CFFCompiler_compileNameIndex(names) {
  21087. var nameIndex = new CFFIndex();
  21088. for (var i = 0, ii = names.length; i < ii; ++i) {
  21089. nameIndex.add(stringToBytes(names[i]));
  21090. }
  21091. return this.compileIndex(nameIndex);
  21092. },
  21093. compileTopDicts: function CFFCompiler_compileTopDicts(dicts, length, removeCidKeys) {
  21094. var fontDictTrackers = [];
  21095. var fdArrayIndex = new CFFIndex();
  21096. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  21097. var fontDict = dicts[i];
  21098. if (removeCidKeys) {
  21099. fontDict.removeByName('CIDFontVersion');
  21100. fontDict.removeByName('CIDFontRevision');
  21101. fontDict.removeByName('CIDFontType');
  21102. fontDict.removeByName('CIDCount');
  21103. fontDict.removeByName('UIDBase');
  21104. }
  21105. var fontDictTracker = new CFFOffsetTracker();
  21106. var fontDictData = this.compileDict(fontDict, fontDictTracker);
  21107. fontDictTrackers.push(fontDictTracker);
  21108. fdArrayIndex.add(fontDictData);
  21109. fontDictTracker.offset(length);
  21110. }
  21111. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  21112. return {
  21113. trackers: fontDictTrackers,
  21114. output: fdArrayIndex
  21115. };
  21116. },
  21117. compilePrivateDicts: function CFFCompiler_compilePrivateDicts(dicts, trackers, output) {
  21118. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  21119. var fontDict = dicts[i];
  21120. assert(fontDict.privateDict && fontDict.hasName('Private'), 'There must be an private dictionary.');
  21121. var privateDict = fontDict.privateDict;
  21122. var privateDictTracker = new CFFOffsetTracker();
  21123. var privateDictData = this.compileDict(privateDict, privateDictTracker);
  21124. var outputLength = output.length;
  21125. privateDictTracker.offset(outputLength);
  21126. if (!privateDictData.length) {
  21127. outputLength = 0;
  21128. }
  21129. trackers[i].setEntryLocation('Private', [
  21130. privateDictData.length,
  21131. outputLength
  21132. ], output);
  21133. output.add(privateDictData);
  21134. if (privateDict.subrsIndex && privateDict.hasName('Subrs')) {
  21135. var subrs = this.compileIndex(privateDict.subrsIndex);
  21136. privateDictTracker.setEntryLocation('Subrs', [privateDictData.length], output);
  21137. output.add(subrs);
  21138. }
  21139. }
  21140. },
  21141. compileDict: function CFFCompiler_compileDict(dict, offsetTracker) {
  21142. var out = [];
  21143. var order = dict.order;
  21144. for (var i = 0; i < order.length; ++i) {
  21145. var key = order[i];
  21146. if (!(key in dict.values)) {
  21147. continue;
  21148. }
  21149. var values = dict.values[key];
  21150. var types = dict.types[key];
  21151. if (!isArray(types)) {
  21152. types = [types];
  21153. }
  21154. if (!isArray(values)) {
  21155. values = [values];
  21156. }
  21157. if (values.length === 0) {
  21158. continue;
  21159. }
  21160. for (var j = 0, jj = types.length; j < jj; ++j) {
  21161. var type = types[j];
  21162. var value = values[j];
  21163. switch (type) {
  21164. case 'num':
  21165. case 'sid':
  21166. out = out.concat(this.encodeNumber(value));
  21167. break;
  21168. case 'offset':
  21169. var name = dict.keyToNameMap[key];
  21170. if (!offsetTracker.isTracking(name)) {
  21171. offsetTracker.track(name, out.length);
  21172. }
  21173. out = out.concat([
  21174. 0x1d,
  21175. 0,
  21176. 0,
  21177. 0,
  21178. 0
  21179. ]);
  21180. break;
  21181. case 'array':
  21182. case 'delta':
  21183. out = out.concat(this.encodeNumber(value));
  21184. for (var k = 1, kk = values.length; k < kk; ++k) {
  21185. out = out.concat(this.encodeNumber(values[k]));
  21186. }
  21187. break;
  21188. default:
  21189. error('Unknown data type of ' + type);
  21190. break;
  21191. }
  21192. }
  21193. out = out.concat(dict.opcodes[key]);
  21194. }
  21195. return out;
  21196. },
  21197. compileStringIndex: function CFFCompiler_compileStringIndex(strings) {
  21198. var stringIndex = new CFFIndex();
  21199. for (var i = 0, ii = strings.length; i < ii; ++i) {
  21200. stringIndex.add(stringToBytes(strings[i]));
  21201. }
  21202. return this.compileIndex(stringIndex);
  21203. },
  21204. compileGlobalSubrIndex: function CFFCompiler_compileGlobalSubrIndex() {
  21205. var globalSubrIndex = this.cff.globalSubrIndex;
  21206. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  21207. },
  21208. compileCharStrings: function CFFCompiler_compileCharStrings(charStrings) {
  21209. return this.compileIndex(charStrings);
  21210. },
  21211. compileCharset: function CFFCompiler_compileCharset(charset) {
  21212. return this.compileTypedArray(charset.raw);
  21213. },
  21214. compileEncoding: function CFFCompiler_compileEncoding(encoding) {
  21215. return this.compileTypedArray(encoding.raw);
  21216. },
  21217. compileFDSelect: function CFFCompiler_compileFDSelect(fdSelect) {
  21218. return this.compileTypedArray(fdSelect);
  21219. },
  21220. compileTypedArray: function CFFCompiler_compileTypedArray(data) {
  21221. var out = [];
  21222. for (var i = 0, ii = data.length; i < ii; ++i) {
  21223. out[i] = data[i];
  21224. }
  21225. return out;
  21226. },
  21227. compileIndex: function CFFCompiler_compileIndex(index, trackers) {
  21228. trackers = trackers || [];
  21229. var objects = index.objects;
  21230. var count = objects.length;
  21231. if (count === 0) {
  21232. return [
  21233. 0,
  21234. 0,
  21235. 0
  21236. ];
  21237. }
  21238. var data = [
  21239. count >> 8 & 0xFF,
  21240. count & 0xff
  21241. ];
  21242. var lastOffset = 1, i;
  21243. for (i = 0; i < count; ++i) {
  21244. lastOffset += objects[i].length;
  21245. }
  21246. var offsetSize;
  21247. if (lastOffset < 0x100) {
  21248. offsetSize = 1;
  21249. } else if (lastOffset < 0x10000) {
  21250. offsetSize = 2;
  21251. } else if (lastOffset < 0x1000000) {
  21252. offsetSize = 3;
  21253. } else {
  21254. offsetSize = 4;
  21255. }
  21256. data.push(offsetSize);
  21257. var relativeOffset = 1;
  21258. for (i = 0; i < count + 1; i++) {
  21259. if (offsetSize === 1) {
  21260. data.push(relativeOffset & 0xFF);
  21261. } else if (offsetSize === 2) {
  21262. data.push(relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  21263. } else if (offsetSize === 3) {
  21264. data.push(relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  21265. } else {
  21266. data.push(relativeOffset >>> 24 & 0xFF, relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  21267. }
  21268. if (objects[i]) {
  21269. relativeOffset += objects[i].length;
  21270. }
  21271. }
  21272. for (i = 0; i < count; i++) {
  21273. if (trackers[i]) {
  21274. trackers[i].offset(data.length);
  21275. }
  21276. for (var j = 0, jj = objects[i].length; j < jj; j++) {
  21277. data.push(objects[i][j]);
  21278. }
  21279. }
  21280. return data;
  21281. }
  21282. };
  21283. return CFFCompiler;
  21284. }();
  21285. exports.CFFStandardStrings = CFFStandardStrings;
  21286. exports.CFFParser = CFFParser;
  21287. exports.CFF = CFF;
  21288. exports.CFFHeader = CFFHeader;
  21289. exports.CFFStrings = CFFStrings;
  21290. exports.CFFIndex = CFFIndex;
  21291. exports.CFFCharset = CFFCharset;
  21292. exports.CFFTopDict = CFFTopDict;
  21293. exports.CFFPrivateDict = CFFPrivateDict;
  21294. exports.CFFCompiler = CFFCompiler;
  21295. /***/ }),
  21296. /* 12 */
  21297. /***/ (function(module, exports, __w_pdfjs_require__) {
  21298. "use strict";
  21299. var sharedUtil = __w_pdfjs_require__(0);
  21300. var MissingDataException = sharedUtil.MissingDataException;
  21301. var arrayByteLength = sharedUtil.arrayByteLength;
  21302. var arraysToBytes = sharedUtil.arraysToBytes;
  21303. var assert = sharedUtil.assert;
  21304. var createPromiseCapability = sharedUtil.createPromiseCapability;
  21305. var isInt = sharedUtil.isInt;
  21306. var isEmptyObj = sharedUtil.isEmptyObj;
  21307. var ChunkedStream = function ChunkedStreamClosure() {
  21308. function ChunkedStream(length, chunkSize, manager) {
  21309. this.bytes = new Uint8Array(length);
  21310. this.start = 0;
  21311. this.pos = 0;
  21312. this.end = length;
  21313. this.chunkSize = chunkSize;
  21314. this.loadedChunks = [];
  21315. this.numChunksLoaded = 0;
  21316. this.numChunks = Math.ceil(length / chunkSize);
  21317. this.manager = manager;
  21318. this.progressiveDataLength = 0;
  21319. this.lastSuccessfulEnsureByteChunk = -1;
  21320. }
  21321. ChunkedStream.prototype = {
  21322. getMissingChunks: function ChunkedStream_getMissingChunks() {
  21323. var chunks = [];
  21324. for (var chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  21325. if (!this.loadedChunks[chunk]) {
  21326. chunks.push(chunk);
  21327. }
  21328. }
  21329. return chunks;
  21330. },
  21331. getBaseStreams: function ChunkedStream_getBaseStreams() {
  21332. return [this];
  21333. },
  21334. allChunksLoaded: function ChunkedStream_allChunksLoaded() {
  21335. return this.numChunksLoaded === this.numChunks;
  21336. },
  21337. onReceiveData: function ChunkedStream_onReceiveData(begin, chunk) {
  21338. var end = begin + chunk.byteLength;
  21339. assert(begin % this.chunkSize === 0, 'Bad begin offset: ' + begin);
  21340. var length = this.bytes.length;
  21341. assert(end % this.chunkSize === 0 || end === length, 'Bad end offset: ' + end);
  21342. this.bytes.set(new Uint8Array(chunk), begin);
  21343. var chunkSize = this.chunkSize;
  21344. var beginChunk = Math.floor(begin / chunkSize);
  21345. var endChunk = Math.floor((end - 1) / chunkSize) + 1;
  21346. var curChunk;
  21347. for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  21348. if (!this.loadedChunks[curChunk]) {
  21349. this.loadedChunks[curChunk] = true;
  21350. ++this.numChunksLoaded;
  21351. }
  21352. }
  21353. },
  21354. onReceiveProgressiveData: function ChunkedStream_onReceiveProgressiveData(data) {
  21355. var position = this.progressiveDataLength;
  21356. var beginChunk = Math.floor(position / this.chunkSize);
  21357. this.bytes.set(new Uint8Array(data), position);
  21358. position += data.byteLength;
  21359. this.progressiveDataLength = position;
  21360. var endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  21361. var curChunk;
  21362. for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  21363. if (!this.loadedChunks[curChunk]) {
  21364. this.loadedChunks[curChunk] = true;
  21365. ++this.numChunksLoaded;
  21366. }
  21367. }
  21368. },
  21369. ensureByte: function ChunkedStream_ensureByte(pos) {
  21370. var chunk = Math.floor(pos / this.chunkSize);
  21371. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  21372. return;
  21373. }
  21374. if (!this.loadedChunks[chunk]) {
  21375. throw new MissingDataException(pos, pos + 1);
  21376. }
  21377. this.lastSuccessfulEnsureByteChunk = chunk;
  21378. },
  21379. ensureRange: function ChunkedStream_ensureRange(begin, end) {
  21380. if (begin >= end) {
  21381. return;
  21382. }
  21383. if (end <= this.progressiveDataLength) {
  21384. return;
  21385. }
  21386. var chunkSize = this.chunkSize;
  21387. var beginChunk = Math.floor(begin / chunkSize);
  21388. var endChunk = Math.floor((end - 1) / chunkSize) + 1;
  21389. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  21390. if (!this.loadedChunks[chunk]) {
  21391. throw new MissingDataException(begin, end);
  21392. }
  21393. }
  21394. },
  21395. nextEmptyChunk: function ChunkedStream_nextEmptyChunk(beginChunk) {
  21396. var chunk, numChunks = this.numChunks;
  21397. for (var i = 0; i < numChunks; ++i) {
  21398. chunk = (beginChunk + i) % numChunks;
  21399. if (!this.loadedChunks[chunk]) {
  21400. return chunk;
  21401. }
  21402. }
  21403. return null;
  21404. },
  21405. hasChunk: function ChunkedStream_hasChunk(chunk) {
  21406. return !!this.loadedChunks[chunk];
  21407. },
  21408. get length() {
  21409. return this.end - this.start;
  21410. },
  21411. get isEmpty() {
  21412. return this.length === 0;
  21413. },
  21414. getByte: function ChunkedStream_getByte() {
  21415. var pos = this.pos;
  21416. if (pos >= this.end) {
  21417. return -1;
  21418. }
  21419. this.ensureByte(pos);
  21420. return this.bytes[this.pos++];
  21421. },
  21422. getUint16: function ChunkedStream_getUint16() {
  21423. var b0 = this.getByte();
  21424. var b1 = this.getByte();
  21425. if (b0 === -1 || b1 === -1) {
  21426. return -1;
  21427. }
  21428. return (b0 << 8) + b1;
  21429. },
  21430. getInt32: function ChunkedStream_getInt32() {
  21431. var b0 = this.getByte();
  21432. var b1 = this.getByte();
  21433. var b2 = this.getByte();
  21434. var b3 = this.getByte();
  21435. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  21436. },
  21437. getBytes: function ChunkedStream_getBytes(length) {
  21438. var bytes = this.bytes;
  21439. var pos = this.pos;
  21440. var strEnd = this.end;
  21441. if (!length) {
  21442. this.ensureRange(pos, strEnd);
  21443. return bytes.subarray(pos, strEnd);
  21444. }
  21445. var end = pos + length;
  21446. if (end > strEnd) {
  21447. end = strEnd;
  21448. }
  21449. this.ensureRange(pos, end);
  21450. this.pos = end;
  21451. return bytes.subarray(pos, end);
  21452. },
  21453. peekByte: function ChunkedStream_peekByte() {
  21454. var peekedByte = this.getByte();
  21455. this.pos--;
  21456. return peekedByte;
  21457. },
  21458. peekBytes: function ChunkedStream_peekBytes(length) {
  21459. var bytes = this.getBytes(length);
  21460. this.pos -= bytes.length;
  21461. return bytes;
  21462. },
  21463. getByteRange: function ChunkedStream_getBytes(begin, end) {
  21464. this.ensureRange(begin, end);
  21465. return this.bytes.subarray(begin, end);
  21466. },
  21467. skip: function ChunkedStream_skip(n) {
  21468. if (!n) {
  21469. n = 1;
  21470. }
  21471. this.pos += n;
  21472. },
  21473. reset: function ChunkedStream_reset() {
  21474. this.pos = this.start;
  21475. },
  21476. moveStart: function ChunkedStream_moveStart() {
  21477. this.start = this.pos;
  21478. },
  21479. makeSubStream: function ChunkedStream_makeSubStream(start, length, dict) {
  21480. this.ensureRange(start, start + length);
  21481. function ChunkedStreamSubstream() {
  21482. }
  21483. ChunkedStreamSubstream.prototype = Object.create(this);
  21484. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  21485. var chunkSize = this.chunkSize;
  21486. var beginChunk = Math.floor(this.start / chunkSize);
  21487. var endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  21488. var missingChunks = [];
  21489. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  21490. if (!this.loadedChunks[chunk]) {
  21491. missingChunks.push(chunk);
  21492. }
  21493. }
  21494. return missingChunks;
  21495. };
  21496. var subStream = new ChunkedStreamSubstream();
  21497. subStream.pos = subStream.start = start;
  21498. subStream.end = start + length || this.end;
  21499. subStream.dict = dict;
  21500. return subStream;
  21501. }
  21502. };
  21503. return ChunkedStream;
  21504. }();
  21505. var ChunkedStreamManager = function ChunkedStreamManagerClosure() {
  21506. function ChunkedStreamManager(pdfNetworkStream, args) {
  21507. var chunkSize = args.rangeChunkSize;
  21508. var length = args.length;
  21509. this.stream = new ChunkedStream(length, chunkSize, this);
  21510. this.length = length;
  21511. this.chunkSize = chunkSize;
  21512. this.pdfNetworkStream = pdfNetworkStream;
  21513. this.url = args.url;
  21514. this.disableAutoFetch = args.disableAutoFetch;
  21515. this.msgHandler = args.msgHandler;
  21516. this.currRequestId = 0;
  21517. this.chunksNeededByRequest = Object.create(null);
  21518. this.requestsByChunk = Object.create(null);
  21519. this.promisesByRequest = Object.create(null);
  21520. this.progressiveDataLength = 0;
  21521. this.aborted = false;
  21522. this._loadedStreamCapability = createPromiseCapability();
  21523. }
  21524. ChunkedStreamManager.prototype = {
  21525. onLoadedStream: function ChunkedStreamManager_getLoadedStream() {
  21526. return this._loadedStreamCapability.promise;
  21527. },
  21528. sendRequest: function ChunkedStreamManager_sendRequest(begin, end) {
  21529. var rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  21530. if (!rangeReader.isStreamingSupported) {
  21531. rangeReader.onProgress = this.onProgress.bind(this);
  21532. }
  21533. var chunks = [], loaded = 0;
  21534. var manager = this;
  21535. var promise = new Promise(function (resolve, reject) {
  21536. var readChunk = function (chunk) {
  21537. try {
  21538. if (!chunk.done) {
  21539. var data = chunk.value;
  21540. chunks.push(data);
  21541. loaded += arrayByteLength(data);
  21542. if (rangeReader.isStreamingSupported) {
  21543. manager.onProgress({ loaded: loaded });
  21544. }
  21545. rangeReader.read().then(readChunk, reject);
  21546. return;
  21547. }
  21548. var chunkData = arraysToBytes(chunks);
  21549. chunks = null;
  21550. resolve(chunkData);
  21551. } catch (e) {
  21552. reject(e);
  21553. }
  21554. };
  21555. rangeReader.read().then(readChunk, reject);
  21556. });
  21557. promise.then(function (data) {
  21558. if (this.aborted) {
  21559. return;
  21560. }
  21561. this.onReceiveData({
  21562. chunk: data,
  21563. begin: begin
  21564. });
  21565. }.bind(this));
  21566. },
  21567. requestAllChunks: function ChunkedStreamManager_requestAllChunks() {
  21568. var missingChunks = this.stream.getMissingChunks();
  21569. this._requestChunks(missingChunks);
  21570. return this._loadedStreamCapability.promise;
  21571. },
  21572. _requestChunks: function ChunkedStreamManager_requestChunks(chunks) {
  21573. var requestId = this.currRequestId++;
  21574. var i, ii;
  21575. var chunksNeeded = Object.create(null);
  21576. this.chunksNeededByRequest[requestId] = chunksNeeded;
  21577. for (i = 0, ii = chunks.length; i < ii; i++) {
  21578. if (!this.stream.hasChunk(chunks[i])) {
  21579. chunksNeeded[chunks[i]] = true;
  21580. }
  21581. }
  21582. if (isEmptyObj(chunksNeeded)) {
  21583. return Promise.resolve();
  21584. }
  21585. var capability = createPromiseCapability();
  21586. this.promisesByRequest[requestId] = capability;
  21587. var chunksToRequest = [];
  21588. for (var chunk in chunksNeeded) {
  21589. chunk = chunk | 0;
  21590. if (!(chunk in this.requestsByChunk)) {
  21591. this.requestsByChunk[chunk] = [];
  21592. chunksToRequest.push(chunk);
  21593. }
  21594. this.requestsByChunk[chunk].push(requestId);
  21595. }
  21596. if (!chunksToRequest.length) {
  21597. return capability.promise;
  21598. }
  21599. var groupedChunksToRequest = this.groupChunks(chunksToRequest);
  21600. for (i = 0; i < groupedChunksToRequest.length; ++i) {
  21601. var groupedChunk = groupedChunksToRequest[i];
  21602. var begin = groupedChunk.beginChunk * this.chunkSize;
  21603. var end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  21604. this.sendRequest(begin, end);
  21605. }
  21606. return capability.promise;
  21607. },
  21608. getStream: function ChunkedStreamManager_getStream() {
  21609. return this.stream;
  21610. },
  21611. requestRange: function ChunkedStreamManager_requestRange(begin, end) {
  21612. end = Math.min(end, this.length);
  21613. var beginChunk = this.getBeginChunk(begin);
  21614. var endChunk = this.getEndChunk(end);
  21615. var chunks = [];
  21616. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  21617. chunks.push(chunk);
  21618. }
  21619. return this._requestChunks(chunks);
  21620. },
  21621. requestRanges: function ChunkedStreamManager_requestRanges(ranges) {
  21622. ranges = ranges || [];
  21623. var chunksToRequest = [];
  21624. for (var i = 0; i < ranges.length; i++) {
  21625. var beginChunk = this.getBeginChunk(ranges[i].begin);
  21626. var endChunk = this.getEndChunk(ranges[i].end);
  21627. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  21628. if (chunksToRequest.indexOf(chunk) < 0) {
  21629. chunksToRequest.push(chunk);
  21630. }
  21631. }
  21632. }
  21633. chunksToRequest.sort(function (a, b) {
  21634. return a - b;
  21635. });
  21636. return this._requestChunks(chunksToRequest);
  21637. },
  21638. groupChunks: function ChunkedStreamManager_groupChunks(chunks) {
  21639. var groupedChunks = [];
  21640. var beginChunk = -1;
  21641. var prevChunk = -1;
  21642. for (var i = 0; i < chunks.length; ++i) {
  21643. var chunk = chunks[i];
  21644. if (beginChunk < 0) {
  21645. beginChunk = chunk;
  21646. }
  21647. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  21648. groupedChunks.push({
  21649. beginChunk: beginChunk,
  21650. endChunk: prevChunk + 1
  21651. });
  21652. beginChunk = chunk;
  21653. }
  21654. if (i + 1 === chunks.length) {
  21655. groupedChunks.push({
  21656. beginChunk: beginChunk,
  21657. endChunk: chunk + 1
  21658. });
  21659. }
  21660. prevChunk = chunk;
  21661. }
  21662. return groupedChunks;
  21663. },
  21664. onProgress: function ChunkedStreamManager_onProgress(args) {
  21665. var bytesLoaded = this.stream.numChunksLoaded * this.chunkSize + args.loaded;
  21666. this.msgHandler.send('DocProgress', {
  21667. loaded: bytesLoaded,
  21668. total: this.length
  21669. });
  21670. },
  21671. onReceiveData: function ChunkedStreamManager_onReceiveData(args) {
  21672. var chunk = args.chunk;
  21673. var isProgressive = args.begin === undefined;
  21674. var begin = isProgressive ? this.progressiveDataLength : args.begin;
  21675. var end = begin + chunk.byteLength;
  21676. var beginChunk = Math.floor(begin / this.chunkSize);
  21677. var endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  21678. if (isProgressive) {
  21679. this.stream.onReceiveProgressiveData(chunk);
  21680. this.progressiveDataLength = end;
  21681. } else {
  21682. this.stream.onReceiveData(begin, chunk);
  21683. }
  21684. if (this.stream.allChunksLoaded()) {
  21685. this._loadedStreamCapability.resolve(this.stream);
  21686. }
  21687. var loadedRequests = [];
  21688. var i, requestId;
  21689. for (chunk = beginChunk; chunk < endChunk; ++chunk) {
  21690. var requestIds = this.requestsByChunk[chunk] || [];
  21691. delete this.requestsByChunk[chunk];
  21692. for (i = 0; i < requestIds.length; ++i) {
  21693. requestId = requestIds[i];
  21694. var chunksNeeded = this.chunksNeededByRequest[requestId];
  21695. if (chunk in chunksNeeded) {
  21696. delete chunksNeeded[chunk];
  21697. }
  21698. if (!isEmptyObj(chunksNeeded)) {
  21699. continue;
  21700. }
  21701. loadedRequests.push(requestId);
  21702. }
  21703. }
  21704. if (!this.disableAutoFetch && isEmptyObj(this.requestsByChunk)) {
  21705. var nextEmptyChunk;
  21706. if (this.stream.numChunksLoaded === 1) {
  21707. var lastChunk = this.stream.numChunks - 1;
  21708. if (!this.stream.hasChunk(lastChunk)) {
  21709. nextEmptyChunk = lastChunk;
  21710. }
  21711. } else {
  21712. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  21713. }
  21714. if (isInt(nextEmptyChunk)) {
  21715. this._requestChunks([nextEmptyChunk]);
  21716. }
  21717. }
  21718. for (i = 0; i < loadedRequests.length; ++i) {
  21719. requestId = loadedRequests[i];
  21720. var capability = this.promisesByRequest[requestId];
  21721. delete this.promisesByRequest[requestId];
  21722. capability.resolve();
  21723. }
  21724. this.msgHandler.send('DocProgress', {
  21725. loaded: this.stream.numChunksLoaded * this.chunkSize,
  21726. total: this.length
  21727. });
  21728. },
  21729. onError: function ChunkedStreamManager_onError(err) {
  21730. this._loadedStreamCapability.reject(err);
  21731. },
  21732. getBeginChunk: function ChunkedStreamManager_getBeginChunk(begin) {
  21733. var chunk = Math.floor(begin / this.chunkSize);
  21734. return chunk;
  21735. },
  21736. getEndChunk: function ChunkedStreamManager_getEndChunk(end) {
  21737. var chunk = Math.floor((end - 1) / this.chunkSize) + 1;
  21738. return chunk;
  21739. },
  21740. abort: function ChunkedStreamManager_abort() {
  21741. this.aborted = true;
  21742. if (this.pdfNetworkStream) {
  21743. this.pdfNetworkStream.cancelAllRequests('abort');
  21744. }
  21745. for (var requestId in this.promisesByRequest) {
  21746. var capability = this.promisesByRequest[requestId];
  21747. capability.reject(new Error('Request was aborted'));
  21748. }
  21749. }
  21750. };
  21751. return ChunkedStreamManager;
  21752. }();
  21753. exports.ChunkedStream = ChunkedStream;
  21754. exports.ChunkedStreamManager = ChunkedStreamManager;
  21755. /***/ }),
  21756. /* 13 */
  21757. /***/ (function(module, exports, __w_pdfjs_require__) {
  21758. "use strict";
  21759. var sharedUtil = __w_pdfjs_require__(0);
  21760. var corePrimitives = __w_pdfjs_require__(1);
  21761. var coreStream = __w_pdfjs_require__(2);
  21762. var PasswordException = sharedUtil.PasswordException;
  21763. var PasswordResponses = sharedUtil.PasswordResponses;
  21764. var bytesToString = sharedUtil.bytesToString;
  21765. var warn = sharedUtil.warn;
  21766. var error = sharedUtil.error;
  21767. var assert = sharedUtil.assert;
  21768. var isInt = sharedUtil.isInt;
  21769. var stringToBytes = sharedUtil.stringToBytes;
  21770. var utf8StringToString = sharedUtil.utf8StringToString;
  21771. var Name = corePrimitives.Name;
  21772. var isName = corePrimitives.isName;
  21773. var isDict = corePrimitives.isDict;
  21774. var DecryptStream = coreStream.DecryptStream;
  21775. var ARCFourCipher = function ARCFourCipherClosure() {
  21776. function ARCFourCipher(key) {
  21777. this.a = 0;
  21778. this.b = 0;
  21779. var s = new Uint8Array(256);
  21780. var i, j = 0, tmp, keyLength = key.length;
  21781. for (i = 0; i < 256; ++i) {
  21782. s[i] = i;
  21783. }
  21784. for (i = 0; i < 256; ++i) {
  21785. tmp = s[i];
  21786. j = j + tmp + key[i % keyLength] & 0xFF;
  21787. s[i] = s[j];
  21788. s[j] = tmp;
  21789. }
  21790. this.s = s;
  21791. }
  21792. ARCFourCipher.prototype = {
  21793. encryptBlock: function ARCFourCipher_encryptBlock(data) {
  21794. var i, n = data.length, tmp, tmp2;
  21795. var a = this.a, b = this.b, s = this.s;
  21796. var output = new Uint8Array(n);
  21797. for (i = 0; i < n; ++i) {
  21798. a = a + 1 & 0xFF;
  21799. tmp = s[a];
  21800. b = b + tmp & 0xFF;
  21801. tmp2 = s[b];
  21802. s[a] = tmp2;
  21803. s[b] = tmp;
  21804. output[i] = data[i] ^ s[tmp + tmp2 & 0xFF];
  21805. }
  21806. this.a = a;
  21807. this.b = b;
  21808. return output;
  21809. }
  21810. };
  21811. ARCFourCipher.prototype.decryptBlock = ARCFourCipher.prototype.encryptBlock;
  21812. return ARCFourCipher;
  21813. }();
  21814. var calculateMD5 = function calculateMD5Closure() {
  21815. var r = new Uint8Array([
  21816. 7,
  21817. 12,
  21818. 17,
  21819. 22,
  21820. 7,
  21821. 12,
  21822. 17,
  21823. 22,
  21824. 7,
  21825. 12,
  21826. 17,
  21827. 22,
  21828. 7,
  21829. 12,
  21830. 17,
  21831. 22,
  21832. 5,
  21833. 9,
  21834. 14,
  21835. 20,
  21836. 5,
  21837. 9,
  21838. 14,
  21839. 20,
  21840. 5,
  21841. 9,
  21842. 14,
  21843. 20,
  21844. 5,
  21845. 9,
  21846. 14,
  21847. 20,
  21848. 4,
  21849. 11,
  21850. 16,
  21851. 23,
  21852. 4,
  21853. 11,
  21854. 16,
  21855. 23,
  21856. 4,
  21857. 11,
  21858. 16,
  21859. 23,
  21860. 4,
  21861. 11,
  21862. 16,
  21863. 23,
  21864. 6,
  21865. 10,
  21866. 15,
  21867. 21,
  21868. 6,
  21869. 10,
  21870. 15,
  21871. 21,
  21872. 6,
  21873. 10,
  21874. 15,
  21875. 21,
  21876. 6,
  21877. 10,
  21878. 15,
  21879. 21
  21880. ]);
  21881. var k = new Int32Array([
  21882. -680876936,
  21883. -389564586,
  21884. 606105819,
  21885. -1044525330,
  21886. -176418897,
  21887. 1200080426,
  21888. -1473231341,
  21889. -45705983,
  21890. 1770035416,
  21891. -1958414417,
  21892. -42063,
  21893. -1990404162,
  21894. 1804603682,
  21895. -40341101,
  21896. -1502002290,
  21897. 1236535329,
  21898. -165796510,
  21899. -1069501632,
  21900. 643717713,
  21901. -373897302,
  21902. -701558691,
  21903. 38016083,
  21904. -660478335,
  21905. -405537848,
  21906. 568446438,
  21907. -1019803690,
  21908. -187363961,
  21909. 1163531501,
  21910. -1444681467,
  21911. -51403784,
  21912. 1735328473,
  21913. -1926607734,
  21914. -378558,
  21915. -2022574463,
  21916. 1839030562,
  21917. -35309556,
  21918. -1530992060,
  21919. 1272893353,
  21920. -155497632,
  21921. -1094730640,
  21922. 681279174,
  21923. -358537222,
  21924. -722521979,
  21925. 76029189,
  21926. -640364487,
  21927. -421815835,
  21928. 530742520,
  21929. -995338651,
  21930. -198630844,
  21931. 1126891415,
  21932. -1416354905,
  21933. -57434055,
  21934. 1700485571,
  21935. -1894986606,
  21936. -1051523,
  21937. -2054922799,
  21938. 1873313359,
  21939. -30611744,
  21940. -1560198380,
  21941. 1309151649,
  21942. -145523070,
  21943. -1120210379,
  21944. 718787259,
  21945. -343485551
  21946. ]);
  21947. function hash(data, offset, length) {
  21948. var h0 = 1732584193, h1 = -271733879, h2 = -1732584194, h3 = 271733878;
  21949. var paddedLength = length + 72 & ~63;
  21950. var padded = new Uint8Array(paddedLength);
  21951. var i, j, n;
  21952. for (i = 0; i < length; ++i) {
  21953. padded[i] = data[offset++];
  21954. }
  21955. padded[i++] = 0x80;
  21956. n = paddedLength - 8;
  21957. while (i < n) {
  21958. padded[i++] = 0;
  21959. }
  21960. padded[i++] = length << 3 & 0xFF;
  21961. padded[i++] = length >> 5 & 0xFF;
  21962. padded[i++] = length >> 13 & 0xFF;
  21963. padded[i++] = length >> 21 & 0xFF;
  21964. padded[i++] = length >>> 29 & 0xFF;
  21965. padded[i++] = 0;
  21966. padded[i++] = 0;
  21967. padded[i++] = 0;
  21968. var w = new Int32Array(16);
  21969. for (i = 0; i < paddedLength;) {
  21970. for (j = 0; j < 16; ++j, i += 4) {
  21971. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  21972. }
  21973. var a = h0, b = h1, c = h2, d = h3, f, g;
  21974. for (j = 0; j < 64; ++j) {
  21975. if (j < 16) {
  21976. f = b & c | ~b & d;
  21977. g = j;
  21978. } else if (j < 32) {
  21979. f = d & b | ~d & c;
  21980. g = 5 * j + 1 & 15;
  21981. } else if (j < 48) {
  21982. f = b ^ c ^ d;
  21983. g = 3 * j + 5 & 15;
  21984. } else {
  21985. f = c ^ (b | ~d);
  21986. g = 7 * j & 15;
  21987. }
  21988. var tmp = d, rotateArg = a + f + k[j] + w[g] | 0, rotate = r[j];
  21989. d = c;
  21990. c = b;
  21991. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  21992. a = tmp;
  21993. }
  21994. h0 = h0 + a | 0;
  21995. h1 = h1 + b | 0;
  21996. h2 = h2 + c | 0;
  21997. h3 = h3 + d | 0;
  21998. }
  21999. return new Uint8Array([
  22000. h0 & 0xFF,
  22001. h0 >> 8 & 0xFF,
  22002. h0 >> 16 & 0xFF,
  22003. h0 >>> 24 & 0xFF,
  22004. h1 & 0xFF,
  22005. h1 >> 8 & 0xFF,
  22006. h1 >> 16 & 0xFF,
  22007. h1 >>> 24 & 0xFF,
  22008. h2 & 0xFF,
  22009. h2 >> 8 & 0xFF,
  22010. h2 >> 16 & 0xFF,
  22011. h2 >>> 24 & 0xFF,
  22012. h3 & 0xFF,
  22013. h3 >> 8 & 0xFF,
  22014. h3 >> 16 & 0xFF,
  22015. h3 >>> 24 & 0xFF
  22016. ]);
  22017. }
  22018. return hash;
  22019. }();
  22020. var Word64 = function Word64Closure() {
  22021. function Word64(highInteger, lowInteger) {
  22022. this.high = highInteger | 0;
  22023. this.low = lowInteger | 0;
  22024. }
  22025. Word64.prototype = {
  22026. and: function Word64_and(word) {
  22027. this.high &= word.high;
  22028. this.low &= word.low;
  22029. },
  22030. xor: function Word64_xor(word) {
  22031. this.high ^= word.high;
  22032. this.low ^= word.low;
  22033. },
  22034. or: function Word64_or(word) {
  22035. this.high |= word.high;
  22036. this.low |= word.low;
  22037. },
  22038. shiftRight: function Word64_shiftRight(places) {
  22039. if (places >= 32) {
  22040. this.low = this.high >>> places - 32 | 0;
  22041. this.high = 0;
  22042. } else {
  22043. this.low = this.low >>> places | this.high << 32 - places;
  22044. this.high = this.high >>> places | 0;
  22045. }
  22046. },
  22047. shiftLeft: function Word64_shiftLeft(places) {
  22048. if (places >= 32) {
  22049. this.high = this.low << places - 32;
  22050. this.low = 0;
  22051. } else {
  22052. this.high = this.high << places | this.low >>> 32 - places;
  22053. this.low = this.low << places;
  22054. }
  22055. },
  22056. rotateRight: function Word64_rotateRight(places) {
  22057. var low, high;
  22058. if (places & 32) {
  22059. high = this.low;
  22060. low = this.high;
  22061. } else {
  22062. low = this.low;
  22063. high = this.high;
  22064. }
  22065. places &= 31;
  22066. this.low = low >>> places | high << 32 - places;
  22067. this.high = high >>> places | low << 32 - places;
  22068. },
  22069. not: function Word64_not() {
  22070. this.high = ~this.high;
  22071. this.low = ~this.low;
  22072. },
  22073. add: function Word64_add(word) {
  22074. var lowAdd = (this.low >>> 0) + (word.low >>> 0);
  22075. var highAdd = (this.high >>> 0) + (word.high >>> 0);
  22076. if (lowAdd > 0xFFFFFFFF) {
  22077. highAdd += 1;
  22078. }
  22079. this.low = lowAdd | 0;
  22080. this.high = highAdd | 0;
  22081. },
  22082. copyTo: function Word64_copyTo(bytes, offset) {
  22083. bytes[offset] = this.high >>> 24 & 0xFF;
  22084. bytes[offset + 1] = this.high >> 16 & 0xFF;
  22085. bytes[offset + 2] = this.high >> 8 & 0xFF;
  22086. bytes[offset + 3] = this.high & 0xFF;
  22087. bytes[offset + 4] = this.low >>> 24 & 0xFF;
  22088. bytes[offset + 5] = this.low >> 16 & 0xFF;
  22089. bytes[offset + 6] = this.low >> 8 & 0xFF;
  22090. bytes[offset + 7] = this.low & 0xFF;
  22091. },
  22092. assign: function Word64_assign(word) {
  22093. this.high = word.high;
  22094. this.low = word.low;
  22095. }
  22096. };
  22097. return Word64;
  22098. }();
  22099. var calculateSHA256 = function calculateSHA256Closure() {
  22100. function rotr(x, n) {
  22101. return x >>> n | x << 32 - n;
  22102. }
  22103. function ch(x, y, z) {
  22104. return x & y ^ ~x & z;
  22105. }
  22106. function maj(x, y, z) {
  22107. return x & y ^ x & z ^ y & z;
  22108. }
  22109. function sigma(x) {
  22110. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  22111. }
  22112. function sigmaPrime(x) {
  22113. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  22114. }
  22115. function littleSigma(x) {
  22116. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  22117. }
  22118. function littleSigmaPrime(x) {
  22119. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  22120. }
  22121. var k = [
  22122. 0x428a2f98,
  22123. 0x71374491,
  22124. 0xb5c0fbcf,
  22125. 0xe9b5dba5,
  22126. 0x3956c25b,
  22127. 0x59f111f1,
  22128. 0x923f82a4,
  22129. 0xab1c5ed5,
  22130. 0xd807aa98,
  22131. 0x12835b01,
  22132. 0x243185be,
  22133. 0x550c7dc3,
  22134. 0x72be5d74,
  22135. 0x80deb1fe,
  22136. 0x9bdc06a7,
  22137. 0xc19bf174,
  22138. 0xe49b69c1,
  22139. 0xefbe4786,
  22140. 0x0fc19dc6,
  22141. 0x240ca1cc,
  22142. 0x2de92c6f,
  22143. 0x4a7484aa,
  22144. 0x5cb0a9dc,
  22145. 0x76f988da,
  22146. 0x983e5152,
  22147. 0xa831c66d,
  22148. 0xb00327c8,
  22149. 0xbf597fc7,
  22150. 0xc6e00bf3,
  22151. 0xd5a79147,
  22152. 0x06ca6351,
  22153. 0x14292967,
  22154. 0x27b70a85,
  22155. 0x2e1b2138,
  22156. 0x4d2c6dfc,
  22157. 0x53380d13,
  22158. 0x650a7354,
  22159. 0x766a0abb,
  22160. 0x81c2c92e,
  22161. 0x92722c85,
  22162. 0xa2bfe8a1,
  22163. 0xa81a664b,
  22164. 0xc24b8b70,
  22165. 0xc76c51a3,
  22166. 0xd192e819,
  22167. 0xd6990624,
  22168. 0xf40e3585,
  22169. 0x106aa070,
  22170. 0x19a4c116,
  22171. 0x1e376c08,
  22172. 0x2748774c,
  22173. 0x34b0bcb5,
  22174. 0x391c0cb3,
  22175. 0x4ed8aa4a,
  22176. 0x5b9cca4f,
  22177. 0x682e6ff3,
  22178. 0x748f82ee,
  22179. 0x78a5636f,
  22180. 0x84c87814,
  22181. 0x8cc70208,
  22182. 0x90befffa,
  22183. 0xa4506ceb,
  22184. 0xbef9a3f7,
  22185. 0xc67178f2
  22186. ];
  22187. function hash(data, offset, length) {
  22188. var h0 = 0x6a09e667, h1 = 0xbb67ae85, h2 = 0x3c6ef372, h3 = 0xa54ff53a, h4 = 0x510e527f, h5 = 0x9b05688c, h6 = 0x1f83d9ab, h7 = 0x5be0cd19;
  22189. var paddedLength = Math.ceil((length + 9) / 64) * 64;
  22190. var padded = new Uint8Array(paddedLength);
  22191. var i, j, n;
  22192. for (i = 0; i < length; ++i) {
  22193. padded[i] = data[offset++];
  22194. }
  22195. padded[i++] = 0x80;
  22196. n = paddedLength - 8;
  22197. while (i < n) {
  22198. padded[i++] = 0;
  22199. }
  22200. padded[i++] = 0;
  22201. padded[i++] = 0;
  22202. padded[i++] = 0;
  22203. padded[i++] = length >>> 29 & 0xFF;
  22204. padded[i++] = length >> 21 & 0xFF;
  22205. padded[i++] = length >> 13 & 0xFF;
  22206. padded[i++] = length >> 5 & 0xFF;
  22207. padded[i++] = length << 3 & 0xFF;
  22208. var w = new Uint32Array(64);
  22209. for (i = 0; i < paddedLength;) {
  22210. for (j = 0; j < 16; ++j) {
  22211. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  22212. i += 4;
  22213. }
  22214. for (j = 16; j < 64; ++j) {
  22215. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  22216. }
  22217. var a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7, t1, t2;
  22218. for (j = 0; j < 64; ++j) {
  22219. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  22220. t2 = sigma(a) + maj(a, b, c);
  22221. h = g;
  22222. g = f;
  22223. f = e;
  22224. e = d + t1 | 0;
  22225. d = c;
  22226. c = b;
  22227. b = a;
  22228. a = t1 + t2 | 0;
  22229. }
  22230. h0 = h0 + a | 0;
  22231. h1 = h1 + b | 0;
  22232. h2 = h2 + c | 0;
  22233. h3 = h3 + d | 0;
  22234. h4 = h4 + e | 0;
  22235. h5 = h5 + f | 0;
  22236. h6 = h6 + g | 0;
  22237. h7 = h7 + h | 0;
  22238. }
  22239. return new Uint8Array([
  22240. h0 >> 24 & 0xFF,
  22241. h0 >> 16 & 0xFF,
  22242. h0 >> 8 & 0xFF,
  22243. h0 & 0xFF,
  22244. h1 >> 24 & 0xFF,
  22245. h1 >> 16 & 0xFF,
  22246. h1 >> 8 & 0xFF,
  22247. h1 & 0xFF,
  22248. h2 >> 24 & 0xFF,
  22249. h2 >> 16 & 0xFF,
  22250. h2 >> 8 & 0xFF,
  22251. h2 & 0xFF,
  22252. h3 >> 24 & 0xFF,
  22253. h3 >> 16 & 0xFF,
  22254. h3 >> 8 & 0xFF,
  22255. h3 & 0xFF,
  22256. h4 >> 24 & 0xFF,
  22257. h4 >> 16 & 0xFF,
  22258. h4 >> 8 & 0xFF,
  22259. h4 & 0xFF,
  22260. h5 >> 24 & 0xFF,
  22261. h5 >> 16 & 0xFF,
  22262. h5 >> 8 & 0xFF,
  22263. h5 & 0xFF,
  22264. h6 >> 24 & 0xFF,
  22265. h6 >> 16 & 0xFF,
  22266. h6 >> 8 & 0xFF,
  22267. h6 & 0xFF,
  22268. h7 >> 24 & 0xFF,
  22269. h7 >> 16 & 0xFF,
  22270. h7 >> 8 & 0xFF,
  22271. h7 & 0xFF
  22272. ]);
  22273. }
  22274. return hash;
  22275. }();
  22276. var calculateSHA512 = function calculateSHA512Closure() {
  22277. function ch(result, x, y, z, tmp) {
  22278. result.assign(x);
  22279. result.and(y);
  22280. tmp.assign(x);
  22281. tmp.not();
  22282. tmp.and(z);
  22283. result.xor(tmp);
  22284. }
  22285. function maj(result, x, y, z, tmp) {
  22286. result.assign(x);
  22287. result.and(y);
  22288. tmp.assign(x);
  22289. tmp.and(z);
  22290. result.xor(tmp);
  22291. tmp.assign(y);
  22292. tmp.and(z);
  22293. result.xor(tmp);
  22294. }
  22295. function sigma(result, x, tmp) {
  22296. result.assign(x);
  22297. result.rotateRight(28);
  22298. tmp.assign(x);
  22299. tmp.rotateRight(34);
  22300. result.xor(tmp);
  22301. tmp.assign(x);
  22302. tmp.rotateRight(39);
  22303. result.xor(tmp);
  22304. }
  22305. function sigmaPrime(result, x, tmp) {
  22306. result.assign(x);
  22307. result.rotateRight(14);
  22308. tmp.assign(x);
  22309. tmp.rotateRight(18);
  22310. result.xor(tmp);
  22311. tmp.assign(x);
  22312. tmp.rotateRight(41);
  22313. result.xor(tmp);
  22314. }
  22315. function littleSigma(result, x, tmp) {
  22316. result.assign(x);
  22317. result.rotateRight(1);
  22318. tmp.assign(x);
  22319. tmp.rotateRight(8);
  22320. result.xor(tmp);
  22321. tmp.assign(x);
  22322. tmp.shiftRight(7);
  22323. result.xor(tmp);
  22324. }
  22325. function littleSigmaPrime(result, x, tmp) {
  22326. result.assign(x);
  22327. result.rotateRight(19);
  22328. tmp.assign(x);
  22329. tmp.rotateRight(61);
  22330. result.xor(tmp);
  22331. tmp.assign(x);
  22332. tmp.shiftRight(6);
  22333. result.xor(tmp);
  22334. }
  22335. var k = [
  22336. new Word64(0x428a2f98, 0xd728ae22),
  22337. new Word64(0x71374491, 0x23ef65cd),
  22338. new Word64(0xb5c0fbcf, 0xec4d3b2f),
  22339. new Word64(0xe9b5dba5, 0x8189dbbc),
  22340. new Word64(0x3956c25b, 0xf348b538),
  22341. new Word64(0x59f111f1, 0xb605d019),
  22342. new Word64(0x923f82a4, 0xaf194f9b),
  22343. new Word64(0xab1c5ed5, 0xda6d8118),
  22344. new Word64(0xd807aa98, 0xa3030242),
  22345. new Word64(0x12835b01, 0x45706fbe),
  22346. new Word64(0x243185be, 0x4ee4b28c),
  22347. new Word64(0x550c7dc3, 0xd5ffb4e2),
  22348. new Word64(0x72be5d74, 0xf27b896f),
  22349. new Word64(0x80deb1fe, 0x3b1696b1),
  22350. new Word64(0x9bdc06a7, 0x25c71235),
  22351. new Word64(0xc19bf174, 0xcf692694),
  22352. new Word64(0xe49b69c1, 0x9ef14ad2),
  22353. new Word64(0xefbe4786, 0x384f25e3),
  22354. new Word64(0x0fc19dc6, 0x8b8cd5b5),
  22355. new Word64(0x240ca1cc, 0x77ac9c65),
  22356. new Word64(0x2de92c6f, 0x592b0275),
  22357. new Word64(0x4a7484aa, 0x6ea6e483),
  22358. new Word64(0x5cb0a9dc, 0xbd41fbd4),
  22359. new Word64(0x76f988da, 0x831153b5),
  22360. new Word64(0x983e5152, 0xee66dfab),
  22361. new Word64(0xa831c66d, 0x2db43210),
  22362. new Word64(0xb00327c8, 0x98fb213f),
  22363. new Word64(0xbf597fc7, 0xbeef0ee4),
  22364. new Word64(0xc6e00bf3, 0x3da88fc2),
  22365. new Word64(0xd5a79147, 0x930aa725),
  22366. new Word64(0x06ca6351, 0xe003826f),
  22367. new Word64(0x14292967, 0x0a0e6e70),
  22368. new Word64(0x27b70a85, 0x46d22ffc),
  22369. new Word64(0x2e1b2138, 0x5c26c926),
  22370. new Word64(0x4d2c6dfc, 0x5ac42aed),
  22371. new Word64(0x53380d13, 0x9d95b3df),
  22372. new Word64(0x650a7354, 0x8baf63de),
  22373. new Word64(0x766a0abb, 0x3c77b2a8),
  22374. new Word64(0x81c2c92e, 0x47edaee6),
  22375. new Word64(0x92722c85, 0x1482353b),
  22376. new Word64(0xa2bfe8a1, 0x4cf10364),
  22377. new Word64(0xa81a664b, 0xbc423001),
  22378. new Word64(0xc24b8b70, 0xd0f89791),
  22379. new Word64(0xc76c51a3, 0x0654be30),
  22380. new Word64(0xd192e819, 0xd6ef5218),
  22381. new Word64(0xd6990624, 0x5565a910),
  22382. new Word64(0xf40e3585, 0x5771202a),
  22383. new Word64(0x106aa070, 0x32bbd1b8),
  22384. new Word64(0x19a4c116, 0xb8d2d0c8),
  22385. new Word64(0x1e376c08, 0x5141ab53),
  22386. new Word64(0x2748774c, 0xdf8eeb99),
  22387. new Word64(0x34b0bcb5, 0xe19b48a8),
  22388. new Word64(0x391c0cb3, 0xc5c95a63),
  22389. new Word64(0x4ed8aa4a, 0xe3418acb),
  22390. new Word64(0x5b9cca4f, 0x7763e373),
  22391. new Word64(0x682e6ff3, 0xd6b2b8a3),
  22392. new Word64(0x748f82ee, 0x5defb2fc),
  22393. new Word64(0x78a5636f, 0x43172f60),
  22394. new Word64(0x84c87814, 0xa1f0ab72),
  22395. new Word64(0x8cc70208, 0x1a6439ec),
  22396. new Word64(0x90befffa, 0x23631e28),
  22397. new Word64(0xa4506ceb, 0xde82bde9),
  22398. new Word64(0xbef9a3f7, 0xb2c67915),
  22399. new Word64(0xc67178f2, 0xe372532b),
  22400. new Word64(0xca273ece, 0xea26619c),
  22401. new Word64(0xd186b8c7, 0x21c0c207),
  22402. new Word64(0xeada7dd6, 0xcde0eb1e),
  22403. new Word64(0xf57d4f7f, 0xee6ed178),
  22404. new Word64(0x06f067aa, 0x72176fba),
  22405. new Word64(0x0a637dc5, 0xa2c898a6),
  22406. new Word64(0x113f9804, 0xbef90dae),
  22407. new Word64(0x1b710b35, 0x131c471b),
  22408. new Word64(0x28db77f5, 0x23047d84),
  22409. new Word64(0x32caab7b, 0x40c72493),
  22410. new Word64(0x3c9ebe0a, 0x15c9bebc),
  22411. new Word64(0x431d67c4, 0x9c100d4c),
  22412. new Word64(0x4cc5d4be, 0xcb3e42b6),
  22413. new Word64(0x597f299c, 0xfc657e2a),
  22414. new Word64(0x5fcb6fab, 0x3ad6faec),
  22415. new Word64(0x6c44198c, 0x4a475817)
  22416. ];
  22417. function hash(data, offset, length, mode384) {
  22418. mode384 = !!mode384;
  22419. var h0, h1, h2, h3, h4, h5, h6, h7;
  22420. if (!mode384) {
  22421. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  22422. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  22423. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  22424. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  22425. h4 = new Word64(0x510e527f, 0xade682d1);
  22426. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  22427. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  22428. h7 = new Word64(0x5be0cd19, 0x137e2179);
  22429. } else {
  22430. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  22431. h1 = new Word64(0x629a292a, 0x367cd507);
  22432. h2 = new Word64(0x9159015a, 0x3070dd17);
  22433. h3 = new Word64(0x152fecd8, 0xf70e5939);
  22434. h4 = new Word64(0x67332667, 0xffc00b31);
  22435. h5 = new Word64(0x8eb44a87, 0x68581511);
  22436. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  22437. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  22438. }
  22439. var paddedLength = Math.ceil((length + 17) / 128) * 128;
  22440. var padded = new Uint8Array(paddedLength);
  22441. var i, j, n;
  22442. for (i = 0; i < length; ++i) {
  22443. padded[i] = data[offset++];
  22444. }
  22445. padded[i++] = 0x80;
  22446. n = paddedLength - 16;
  22447. while (i < n) {
  22448. padded[i++] = 0;
  22449. }
  22450. padded[i++] = 0;
  22451. padded[i++] = 0;
  22452. padded[i++] = 0;
  22453. padded[i++] = 0;
  22454. padded[i++] = 0;
  22455. padded[i++] = 0;
  22456. padded[i++] = 0;
  22457. padded[i++] = 0;
  22458. padded[i++] = 0;
  22459. padded[i++] = 0;
  22460. padded[i++] = 0;
  22461. padded[i++] = length >>> 29 & 0xFF;
  22462. padded[i++] = length >> 21 & 0xFF;
  22463. padded[i++] = length >> 13 & 0xFF;
  22464. padded[i++] = length >> 5 & 0xFF;
  22465. padded[i++] = length << 3 & 0xFF;
  22466. var w = new Array(80);
  22467. for (i = 0; i < 80; i++) {
  22468. w[i] = new Word64(0, 0);
  22469. }
  22470. var a = new Word64(0, 0), b = new Word64(0, 0), c = new Word64(0, 0);
  22471. var d = new Word64(0, 0), e = new Word64(0, 0), f = new Word64(0, 0);
  22472. var g = new Word64(0, 0), h = new Word64(0, 0);
  22473. var t1 = new Word64(0, 0), t2 = new Word64(0, 0);
  22474. var tmp1 = new Word64(0, 0), tmp2 = new Word64(0, 0), tmp3;
  22475. for (i = 0; i < paddedLength;) {
  22476. for (j = 0; j < 16; ++j) {
  22477. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  22478. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  22479. i += 8;
  22480. }
  22481. for (j = 16; j < 80; ++j) {
  22482. tmp3 = w[j];
  22483. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  22484. tmp3.add(w[j - 7]);
  22485. littleSigma(tmp1, w[j - 15], tmp2);
  22486. tmp3.add(tmp1);
  22487. tmp3.add(w[j - 16]);
  22488. }
  22489. a.assign(h0);
  22490. b.assign(h1);
  22491. c.assign(h2);
  22492. d.assign(h3);
  22493. e.assign(h4);
  22494. f.assign(h5);
  22495. g.assign(h6);
  22496. h.assign(h7);
  22497. for (j = 0; j < 80; ++j) {
  22498. t1.assign(h);
  22499. sigmaPrime(tmp1, e, tmp2);
  22500. t1.add(tmp1);
  22501. ch(tmp1, e, f, g, tmp2);
  22502. t1.add(tmp1);
  22503. t1.add(k[j]);
  22504. t1.add(w[j]);
  22505. sigma(t2, a, tmp2);
  22506. maj(tmp1, a, b, c, tmp2);
  22507. t2.add(tmp1);
  22508. tmp3 = h;
  22509. h = g;
  22510. g = f;
  22511. f = e;
  22512. d.add(t1);
  22513. e = d;
  22514. d = c;
  22515. c = b;
  22516. b = a;
  22517. tmp3.assign(t1);
  22518. tmp3.add(t2);
  22519. a = tmp3;
  22520. }
  22521. h0.add(a);
  22522. h1.add(b);
  22523. h2.add(c);
  22524. h3.add(d);
  22525. h4.add(e);
  22526. h5.add(f);
  22527. h6.add(g);
  22528. h7.add(h);
  22529. }
  22530. var result;
  22531. if (!mode384) {
  22532. result = new Uint8Array(64);
  22533. h0.copyTo(result, 0);
  22534. h1.copyTo(result, 8);
  22535. h2.copyTo(result, 16);
  22536. h3.copyTo(result, 24);
  22537. h4.copyTo(result, 32);
  22538. h5.copyTo(result, 40);
  22539. h6.copyTo(result, 48);
  22540. h7.copyTo(result, 56);
  22541. } else {
  22542. result = new Uint8Array(48);
  22543. h0.copyTo(result, 0);
  22544. h1.copyTo(result, 8);
  22545. h2.copyTo(result, 16);
  22546. h3.copyTo(result, 24);
  22547. h4.copyTo(result, 32);
  22548. h5.copyTo(result, 40);
  22549. }
  22550. return result;
  22551. }
  22552. return hash;
  22553. }();
  22554. var calculateSHA384 = function calculateSHA384Closure() {
  22555. function hash(data, offset, length) {
  22556. return calculateSHA512(data, offset, length, true);
  22557. }
  22558. return hash;
  22559. }();
  22560. var NullCipher = function NullCipherClosure() {
  22561. function NullCipher() {
  22562. }
  22563. NullCipher.prototype = {
  22564. decryptBlock: function NullCipher_decryptBlock(data) {
  22565. return data;
  22566. }
  22567. };
  22568. return NullCipher;
  22569. }();
  22570. var AES128Cipher = function AES128CipherClosure() {
  22571. var rcon = new Uint8Array([
  22572. 0x8d,
  22573. 0x01,
  22574. 0x02,
  22575. 0x04,
  22576. 0x08,
  22577. 0x10,
  22578. 0x20,
  22579. 0x40,
  22580. 0x80,
  22581. 0x1b,
  22582. 0x36,
  22583. 0x6c,
  22584. 0xd8,
  22585. 0xab,
  22586. 0x4d,
  22587. 0x9a,
  22588. 0x2f,
  22589. 0x5e,
  22590. 0xbc,
  22591. 0x63,
  22592. 0xc6,
  22593. 0x97,
  22594. 0x35,
  22595. 0x6a,
  22596. 0xd4,
  22597. 0xb3,
  22598. 0x7d,
  22599. 0xfa,
  22600. 0xef,
  22601. 0xc5,
  22602. 0x91,
  22603. 0x39,
  22604. 0x72,
  22605. 0xe4,
  22606. 0xd3,
  22607. 0xbd,
  22608. 0x61,
  22609. 0xc2,
  22610. 0x9f,
  22611. 0x25,
  22612. 0x4a,
  22613. 0x94,
  22614. 0x33,
  22615. 0x66,
  22616. 0xcc,
  22617. 0x83,
  22618. 0x1d,
  22619. 0x3a,
  22620. 0x74,
  22621. 0xe8,
  22622. 0xcb,
  22623. 0x8d,
  22624. 0x01,
  22625. 0x02,
  22626. 0x04,
  22627. 0x08,
  22628. 0x10,
  22629. 0x20,
  22630. 0x40,
  22631. 0x80,
  22632. 0x1b,
  22633. 0x36,
  22634. 0x6c,
  22635. 0xd8,
  22636. 0xab,
  22637. 0x4d,
  22638. 0x9a,
  22639. 0x2f,
  22640. 0x5e,
  22641. 0xbc,
  22642. 0x63,
  22643. 0xc6,
  22644. 0x97,
  22645. 0x35,
  22646. 0x6a,
  22647. 0xd4,
  22648. 0xb3,
  22649. 0x7d,
  22650. 0xfa,
  22651. 0xef,
  22652. 0xc5,
  22653. 0x91,
  22654. 0x39,
  22655. 0x72,
  22656. 0xe4,
  22657. 0xd3,
  22658. 0xbd,
  22659. 0x61,
  22660. 0xc2,
  22661. 0x9f,
  22662. 0x25,
  22663. 0x4a,
  22664. 0x94,
  22665. 0x33,
  22666. 0x66,
  22667. 0xcc,
  22668. 0x83,
  22669. 0x1d,
  22670. 0x3a,
  22671. 0x74,
  22672. 0xe8,
  22673. 0xcb,
  22674. 0x8d,
  22675. 0x01,
  22676. 0x02,
  22677. 0x04,
  22678. 0x08,
  22679. 0x10,
  22680. 0x20,
  22681. 0x40,
  22682. 0x80,
  22683. 0x1b,
  22684. 0x36,
  22685. 0x6c,
  22686. 0xd8,
  22687. 0xab,
  22688. 0x4d,
  22689. 0x9a,
  22690. 0x2f,
  22691. 0x5e,
  22692. 0xbc,
  22693. 0x63,
  22694. 0xc6,
  22695. 0x97,
  22696. 0x35,
  22697. 0x6a,
  22698. 0xd4,
  22699. 0xb3,
  22700. 0x7d,
  22701. 0xfa,
  22702. 0xef,
  22703. 0xc5,
  22704. 0x91,
  22705. 0x39,
  22706. 0x72,
  22707. 0xe4,
  22708. 0xd3,
  22709. 0xbd,
  22710. 0x61,
  22711. 0xc2,
  22712. 0x9f,
  22713. 0x25,
  22714. 0x4a,
  22715. 0x94,
  22716. 0x33,
  22717. 0x66,
  22718. 0xcc,
  22719. 0x83,
  22720. 0x1d,
  22721. 0x3a,
  22722. 0x74,
  22723. 0xe8,
  22724. 0xcb,
  22725. 0x8d,
  22726. 0x01,
  22727. 0x02,
  22728. 0x04,
  22729. 0x08,
  22730. 0x10,
  22731. 0x20,
  22732. 0x40,
  22733. 0x80,
  22734. 0x1b,
  22735. 0x36,
  22736. 0x6c,
  22737. 0xd8,
  22738. 0xab,
  22739. 0x4d,
  22740. 0x9a,
  22741. 0x2f,
  22742. 0x5e,
  22743. 0xbc,
  22744. 0x63,
  22745. 0xc6,
  22746. 0x97,
  22747. 0x35,
  22748. 0x6a,
  22749. 0xd4,
  22750. 0xb3,
  22751. 0x7d,
  22752. 0xfa,
  22753. 0xef,
  22754. 0xc5,
  22755. 0x91,
  22756. 0x39,
  22757. 0x72,
  22758. 0xe4,
  22759. 0xd3,
  22760. 0xbd,
  22761. 0x61,
  22762. 0xc2,
  22763. 0x9f,
  22764. 0x25,
  22765. 0x4a,
  22766. 0x94,
  22767. 0x33,
  22768. 0x66,
  22769. 0xcc,
  22770. 0x83,
  22771. 0x1d,
  22772. 0x3a,
  22773. 0x74,
  22774. 0xe8,
  22775. 0xcb,
  22776. 0x8d,
  22777. 0x01,
  22778. 0x02,
  22779. 0x04,
  22780. 0x08,
  22781. 0x10,
  22782. 0x20,
  22783. 0x40,
  22784. 0x80,
  22785. 0x1b,
  22786. 0x36,
  22787. 0x6c,
  22788. 0xd8,
  22789. 0xab,
  22790. 0x4d,
  22791. 0x9a,
  22792. 0x2f,
  22793. 0x5e,
  22794. 0xbc,
  22795. 0x63,
  22796. 0xc6,
  22797. 0x97,
  22798. 0x35,
  22799. 0x6a,
  22800. 0xd4,
  22801. 0xb3,
  22802. 0x7d,
  22803. 0xfa,
  22804. 0xef,
  22805. 0xc5,
  22806. 0x91,
  22807. 0x39,
  22808. 0x72,
  22809. 0xe4,
  22810. 0xd3,
  22811. 0xbd,
  22812. 0x61,
  22813. 0xc2,
  22814. 0x9f,
  22815. 0x25,
  22816. 0x4a,
  22817. 0x94,
  22818. 0x33,
  22819. 0x66,
  22820. 0xcc,
  22821. 0x83,
  22822. 0x1d,
  22823. 0x3a,
  22824. 0x74,
  22825. 0xe8,
  22826. 0xcb,
  22827. 0x8d
  22828. ]);
  22829. var s = new Uint8Array([
  22830. 0x63,
  22831. 0x7c,
  22832. 0x77,
  22833. 0x7b,
  22834. 0xf2,
  22835. 0x6b,
  22836. 0x6f,
  22837. 0xc5,
  22838. 0x30,
  22839. 0x01,
  22840. 0x67,
  22841. 0x2b,
  22842. 0xfe,
  22843. 0xd7,
  22844. 0xab,
  22845. 0x76,
  22846. 0xca,
  22847. 0x82,
  22848. 0xc9,
  22849. 0x7d,
  22850. 0xfa,
  22851. 0x59,
  22852. 0x47,
  22853. 0xf0,
  22854. 0xad,
  22855. 0xd4,
  22856. 0xa2,
  22857. 0xaf,
  22858. 0x9c,
  22859. 0xa4,
  22860. 0x72,
  22861. 0xc0,
  22862. 0xb7,
  22863. 0xfd,
  22864. 0x93,
  22865. 0x26,
  22866. 0x36,
  22867. 0x3f,
  22868. 0xf7,
  22869. 0xcc,
  22870. 0x34,
  22871. 0xa5,
  22872. 0xe5,
  22873. 0xf1,
  22874. 0x71,
  22875. 0xd8,
  22876. 0x31,
  22877. 0x15,
  22878. 0x04,
  22879. 0xc7,
  22880. 0x23,
  22881. 0xc3,
  22882. 0x18,
  22883. 0x96,
  22884. 0x05,
  22885. 0x9a,
  22886. 0x07,
  22887. 0x12,
  22888. 0x80,
  22889. 0xe2,
  22890. 0xeb,
  22891. 0x27,
  22892. 0xb2,
  22893. 0x75,
  22894. 0x09,
  22895. 0x83,
  22896. 0x2c,
  22897. 0x1a,
  22898. 0x1b,
  22899. 0x6e,
  22900. 0x5a,
  22901. 0xa0,
  22902. 0x52,
  22903. 0x3b,
  22904. 0xd6,
  22905. 0xb3,
  22906. 0x29,
  22907. 0xe3,
  22908. 0x2f,
  22909. 0x84,
  22910. 0x53,
  22911. 0xd1,
  22912. 0x00,
  22913. 0xed,
  22914. 0x20,
  22915. 0xfc,
  22916. 0xb1,
  22917. 0x5b,
  22918. 0x6a,
  22919. 0xcb,
  22920. 0xbe,
  22921. 0x39,
  22922. 0x4a,
  22923. 0x4c,
  22924. 0x58,
  22925. 0xcf,
  22926. 0xd0,
  22927. 0xef,
  22928. 0xaa,
  22929. 0xfb,
  22930. 0x43,
  22931. 0x4d,
  22932. 0x33,
  22933. 0x85,
  22934. 0x45,
  22935. 0xf9,
  22936. 0x02,
  22937. 0x7f,
  22938. 0x50,
  22939. 0x3c,
  22940. 0x9f,
  22941. 0xa8,
  22942. 0x51,
  22943. 0xa3,
  22944. 0x40,
  22945. 0x8f,
  22946. 0x92,
  22947. 0x9d,
  22948. 0x38,
  22949. 0xf5,
  22950. 0xbc,
  22951. 0xb6,
  22952. 0xda,
  22953. 0x21,
  22954. 0x10,
  22955. 0xff,
  22956. 0xf3,
  22957. 0xd2,
  22958. 0xcd,
  22959. 0x0c,
  22960. 0x13,
  22961. 0xec,
  22962. 0x5f,
  22963. 0x97,
  22964. 0x44,
  22965. 0x17,
  22966. 0xc4,
  22967. 0xa7,
  22968. 0x7e,
  22969. 0x3d,
  22970. 0x64,
  22971. 0x5d,
  22972. 0x19,
  22973. 0x73,
  22974. 0x60,
  22975. 0x81,
  22976. 0x4f,
  22977. 0xdc,
  22978. 0x22,
  22979. 0x2a,
  22980. 0x90,
  22981. 0x88,
  22982. 0x46,
  22983. 0xee,
  22984. 0xb8,
  22985. 0x14,
  22986. 0xde,
  22987. 0x5e,
  22988. 0x0b,
  22989. 0xdb,
  22990. 0xe0,
  22991. 0x32,
  22992. 0x3a,
  22993. 0x0a,
  22994. 0x49,
  22995. 0x06,
  22996. 0x24,
  22997. 0x5c,
  22998. 0xc2,
  22999. 0xd3,
  23000. 0xac,
  23001. 0x62,
  23002. 0x91,
  23003. 0x95,
  23004. 0xe4,
  23005. 0x79,
  23006. 0xe7,
  23007. 0xc8,
  23008. 0x37,
  23009. 0x6d,
  23010. 0x8d,
  23011. 0xd5,
  23012. 0x4e,
  23013. 0xa9,
  23014. 0x6c,
  23015. 0x56,
  23016. 0xf4,
  23017. 0xea,
  23018. 0x65,
  23019. 0x7a,
  23020. 0xae,
  23021. 0x08,
  23022. 0xba,
  23023. 0x78,
  23024. 0x25,
  23025. 0x2e,
  23026. 0x1c,
  23027. 0xa6,
  23028. 0xb4,
  23029. 0xc6,
  23030. 0xe8,
  23031. 0xdd,
  23032. 0x74,
  23033. 0x1f,
  23034. 0x4b,
  23035. 0xbd,
  23036. 0x8b,
  23037. 0x8a,
  23038. 0x70,
  23039. 0x3e,
  23040. 0xb5,
  23041. 0x66,
  23042. 0x48,
  23043. 0x03,
  23044. 0xf6,
  23045. 0x0e,
  23046. 0x61,
  23047. 0x35,
  23048. 0x57,
  23049. 0xb9,
  23050. 0x86,
  23051. 0xc1,
  23052. 0x1d,
  23053. 0x9e,
  23054. 0xe1,
  23055. 0xf8,
  23056. 0x98,
  23057. 0x11,
  23058. 0x69,
  23059. 0xd9,
  23060. 0x8e,
  23061. 0x94,
  23062. 0x9b,
  23063. 0x1e,
  23064. 0x87,
  23065. 0xe9,
  23066. 0xce,
  23067. 0x55,
  23068. 0x28,
  23069. 0xdf,
  23070. 0x8c,
  23071. 0xa1,
  23072. 0x89,
  23073. 0x0d,
  23074. 0xbf,
  23075. 0xe6,
  23076. 0x42,
  23077. 0x68,
  23078. 0x41,
  23079. 0x99,
  23080. 0x2d,
  23081. 0x0f,
  23082. 0xb0,
  23083. 0x54,
  23084. 0xbb,
  23085. 0x16
  23086. ]);
  23087. var inv_s = new Uint8Array([
  23088. 0x52,
  23089. 0x09,
  23090. 0x6a,
  23091. 0xd5,
  23092. 0x30,
  23093. 0x36,
  23094. 0xa5,
  23095. 0x38,
  23096. 0xbf,
  23097. 0x40,
  23098. 0xa3,
  23099. 0x9e,
  23100. 0x81,
  23101. 0xf3,
  23102. 0xd7,
  23103. 0xfb,
  23104. 0x7c,
  23105. 0xe3,
  23106. 0x39,
  23107. 0x82,
  23108. 0x9b,
  23109. 0x2f,
  23110. 0xff,
  23111. 0x87,
  23112. 0x34,
  23113. 0x8e,
  23114. 0x43,
  23115. 0x44,
  23116. 0xc4,
  23117. 0xde,
  23118. 0xe9,
  23119. 0xcb,
  23120. 0x54,
  23121. 0x7b,
  23122. 0x94,
  23123. 0x32,
  23124. 0xa6,
  23125. 0xc2,
  23126. 0x23,
  23127. 0x3d,
  23128. 0xee,
  23129. 0x4c,
  23130. 0x95,
  23131. 0x0b,
  23132. 0x42,
  23133. 0xfa,
  23134. 0xc3,
  23135. 0x4e,
  23136. 0x08,
  23137. 0x2e,
  23138. 0xa1,
  23139. 0x66,
  23140. 0x28,
  23141. 0xd9,
  23142. 0x24,
  23143. 0xb2,
  23144. 0x76,
  23145. 0x5b,
  23146. 0xa2,
  23147. 0x49,
  23148. 0x6d,
  23149. 0x8b,
  23150. 0xd1,
  23151. 0x25,
  23152. 0x72,
  23153. 0xf8,
  23154. 0xf6,
  23155. 0x64,
  23156. 0x86,
  23157. 0x68,
  23158. 0x98,
  23159. 0x16,
  23160. 0xd4,
  23161. 0xa4,
  23162. 0x5c,
  23163. 0xcc,
  23164. 0x5d,
  23165. 0x65,
  23166. 0xb6,
  23167. 0x92,
  23168. 0x6c,
  23169. 0x70,
  23170. 0x48,
  23171. 0x50,
  23172. 0xfd,
  23173. 0xed,
  23174. 0xb9,
  23175. 0xda,
  23176. 0x5e,
  23177. 0x15,
  23178. 0x46,
  23179. 0x57,
  23180. 0xa7,
  23181. 0x8d,
  23182. 0x9d,
  23183. 0x84,
  23184. 0x90,
  23185. 0xd8,
  23186. 0xab,
  23187. 0x00,
  23188. 0x8c,
  23189. 0xbc,
  23190. 0xd3,
  23191. 0x0a,
  23192. 0xf7,
  23193. 0xe4,
  23194. 0x58,
  23195. 0x05,
  23196. 0xb8,
  23197. 0xb3,
  23198. 0x45,
  23199. 0x06,
  23200. 0xd0,
  23201. 0x2c,
  23202. 0x1e,
  23203. 0x8f,
  23204. 0xca,
  23205. 0x3f,
  23206. 0x0f,
  23207. 0x02,
  23208. 0xc1,
  23209. 0xaf,
  23210. 0xbd,
  23211. 0x03,
  23212. 0x01,
  23213. 0x13,
  23214. 0x8a,
  23215. 0x6b,
  23216. 0x3a,
  23217. 0x91,
  23218. 0x11,
  23219. 0x41,
  23220. 0x4f,
  23221. 0x67,
  23222. 0xdc,
  23223. 0xea,
  23224. 0x97,
  23225. 0xf2,
  23226. 0xcf,
  23227. 0xce,
  23228. 0xf0,
  23229. 0xb4,
  23230. 0xe6,
  23231. 0x73,
  23232. 0x96,
  23233. 0xac,
  23234. 0x74,
  23235. 0x22,
  23236. 0xe7,
  23237. 0xad,
  23238. 0x35,
  23239. 0x85,
  23240. 0xe2,
  23241. 0xf9,
  23242. 0x37,
  23243. 0xe8,
  23244. 0x1c,
  23245. 0x75,
  23246. 0xdf,
  23247. 0x6e,
  23248. 0x47,
  23249. 0xf1,
  23250. 0x1a,
  23251. 0x71,
  23252. 0x1d,
  23253. 0x29,
  23254. 0xc5,
  23255. 0x89,
  23256. 0x6f,
  23257. 0xb7,
  23258. 0x62,
  23259. 0x0e,
  23260. 0xaa,
  23261. 0x18,
  23262. 0xbe,
  23263. 0x1b,
  23264. 0xfc,
  23265. 0x56,
  23266. 0x3e,
  23267. 0x4b,
  23268. 0xc6,
  23269. 0xd2,
  23270. 0x79,
  23271. 0x20,
  23272. 0x9a,
  23273. 0xdb,
  23274. 0xc0,
  23275. 0xfe,
  23276. 0x78,
  23277. 0xcd,
  23278. 0x5a,
  23279. 0xf4,
  23280. 0x1f,
  23281. 0xdd,
  23282. 0xa8,
  23283. 0x33,
  23284. 0x88,
  23285. 0x07,
  23286. 0xc7,
  23287. 0x31,
  23288. 0xb1,
  23289. 0x12,
  23290. 0x10,
  23291. 0x59,
  23292. 0x27,
  23293. 0x80,
  23294. 0xec,
  23295. 0x5f,
  23296. 0x60,
  23297. 0x51,
  23298. 0x7f,
  23299. 0xa9,
  23300. 0x19,
  23301. 0xb5,
  23302. 0x4a,
  23303. 0x0d,
  23304. 0x2d,
  23305. 0xe5,
  23306. 0x7a,
  23307. 0x9f,
  23308. 0x93,
  23309. 0xc9,
  23310. 0x9c,
  23311. 0xef,
  23312. 0xa0,
  23313. 0xe0,
  23314. 0x3b,
  23315. 0x4d,
  23316. 0xae,
  23317. 0x2a,
  23318. 0xf5,
  23319. 0xb0,
  23320. 0xc8,
  23321. 0xeb,
  23322. 0xbb,
  23323. 0x3c,
  23324. 0x83,
  23325. 0x53,
  23326. 0x99,
  23327. 0x61,
  23328. 0x17,
  23329. 0x2b,
  23330. 0x04,
  23331. 0x7e,
  23332. 0xba,
  23333. 0x77,
  23334. 0xd6,
  23335. 0x26,
  23336. 0xe1,
  23337. 0x69,
  23338. 0x14,
  23339. 0x63,
  23340. 0x55,
  23341. 0x21,
  23342. 0x0c,
  23343. 0x7d
  23344. ]);
  23345. var mixCol = new Uint8Array(256);
  23346. for (var i = 0; i < 256; i++) {
  23347. if (i < 128) {
  23348. mixCol[i] = i << 1;
  23349. } else {
  23350. mixCol[i] = i << 1 ^ 0x1b;
  23351. }
  23352. }
  23353. var mix = new Uint32Array([
  23354. 0x00000000,
  23355. 0x0e090d0b,
  23356. 0x1c121a16,
  23357. 0x121b171d,
  23358. 0x3824342c,
  23359. 0x362d3927,
  23360. 0x24362e3a,
  23361. 0x2a3f2331,
  23362. 0x70486858,
  23363. 0x7e416553,
  23364. 0x6c5a724e,
  23365. 0x62537f45,
  23366. 0x486c5c74,
  23367. 0x4665517f,
  23368. 0x547e4662,
  23369. 0x5a774b69,
  23370. 0xe090d0b0,
  23371. 0xee99ddbb,
  23372. 0xfc82caa6,
  23373. 0xf28bc7ad,
  23374. 0xd8b4e49c,
  23375. 0xd6bde997,
  23376. 0xc4a6fe8a,
  23377. 0xcaaff381,
  23378. 0x90d8b8e8,
  23379. 0x9ed1b5e3,
  23380. 0x8ccaa2fe,
  23381. 0x82c3aff5,
  23382. 0xa8fc8cc4,
  23383. 0xa6f581cf,
  23384. 0xb4ee96d2,
  23385. 0xbae79bd9,
  23386. 0xdb3bbb7b,
  23387. 0xd532b670,
  23388. 0xc729a16d,
  23389. 0xc920ac66,
  23390. 0xe31f8f57,
  23391. 0xed16825c,
  23392. 0xff0d9541,
  23393. 0xf104984a,
  23394. 0xab73d323,
  23395. 0xa57ade28,
  23396. 0xb761c935,
  23397. 0xb968c43e,
  23398. 0x9357e70f,
  23399. 0x9d5eea04,
  23400. 0x8f45fd19,
  23401. 0x814cf012,
  23402. 0x3bab6bcb,
  23403. 0x35a266c0,
  23404. 0x27b971dd,
  23405. 0x29b07cd6,
  23406. 0x038f5fe7,
  23407. 0x0d8652ec,
  23408. 0x1f9d45f1,
  23409. 0x119448fa,
  23410. 0x4be30393,
  23411. 0x45ea0e98,
  23412. 0x57f11985,
  23413. 0x59f8148e,
  23414. 0x73c737bf,
  23415. 0x7dce3ab4,
  23416. 0x6fd52da9,
  23417. 0x61dc20a2,
  23418. 0xad766df6,
  23419. 0xa37f60fd,
  23420. 0xb16477e0,
  23421. 0xbf6d7aeb,
  23422. 0x955259da,
  23423. 0x9b5b54d1,
  23424. 0x894043cc,
  23425. 0x87494ec7,
  23426. 0xdd3e05ae,
  23427. 0xd33708a5,
  23428. 0xc12c1fb8,
  23429. 0xcf2512b3,
  23430. 0xe51a3182,
  23431. 0xeb133c89,
  23432. 0xf9082b94,
  23433. 0xf701269f,
  23434. 0x4de6bd46,
  23435. 0x43efb04d,
  23436. 0x51f4a750,
  23437. 0x5ffdaa5b,
  23438. 0x75c2896a,
  23439. 0x7bcb8461,
  23440. 0x69d0937c,
  23441. 0x67d99e77,
  23442. 0x3daed51e,
  23443. 0x33a7d815,
  23444. 0x21bccf08,
  23445. 0x2fb5c203,
  23446. 0x058ae132,
  23447. 0x0b83ec39,
  23448. 0x1998fb24,
  23449. 0x1791f62f,
  23450. 0x764dd68d,
  23451. 0x7844db86,
  23452. 0x6a5fcc9b,
  23453. 0x6456c190,
  23454. 0x4e69e2a1,
  23455. 0x4060efaa,
  23456. 0x527bf8b7,
  23457. 0x5c72f5bc,
  23458. 0x0605bed5,
  23459. 0x080cb3de,
  23460. 0x1a17a4c3,
  23461. 0x141ea9c8,
  23462. 0x3e218af9,
  23463. 0x302887f2,
  23464. 0x223390ef,
  23465. 0x2c3a9de4,
  23466. 0x96dd063d,
  23467. 0x98d40b36,
  23468. 0x8acf1c2b,
  23469. 0x84c61120,
  23470. 0xaef93211,
  23471. 0xa0f03f1a,
  23472. 0xb2eb2807,
  23473. 0xbce2250c,
  23474. 0xe6956e65,
  23475. 0xe89c636e,
  23476. 0xfa877473,
  23477. 0xf48e7978,
  23478. 0xdeb15a49,
  23479. 0xd0b85742,
  23480. 0xc2a3405f,
  23481. 0xccaa4d54,
  23482. 0x41ecdaf7,
  23483. 0x4fe5d7fc,
  23484. 0x5dfec0e1,
  23485. 0x53f7cdea,
  23486. 0x79c8eedb,
  23487. 0x77c1e3d0,
  23488. 0x65daf4cd,
  23489. 0x6bd3f9c6,
  23490. 0x31a4b2af,
  23491. 0x3fadbfa4,
  23492. 0x2db6a8b9,
  23493. 0x23bfa5b2,
  23494. 0x09808683,
  23495. 0x07898b88,
  23496. 0x15929c95,
  23497. 0x1b9b919e,
  23498. 0xa17c0a47,
  23499. 0xaf75074c,
  23500. 0xbd6e1051,
  23501. 0xb3671d5a,
  23502. 0x99583e6b,
  23503. 0x97513360,
  23504. 0x854a247d,
  23505. 0x8b432976,
  23506. 0xd134621f,
  23507. 0xdf3d6f14,
  23508. 0xcd267809,
  23509. 0xc32f7502,
  23510. 0xe9105633,
  23511. 0xe7195b38,
  23512. 0xf5024c25,
  23513. 0xfb0b412e,
  23514. 0x9ad7618c,
  23515. 0x94de6c87,
  23516. 0x86c57b9a,
  23517. 0x88cc7691,
  23518. 0xa2f355a0,
  23519. 0xacfa58ab,
  23520. 0xbee14fb6,
  23521. 0xb0e842bd,
  23522. 0xea9f09d4,
  23523. 0xe49604df,
  23524. 0xf68d13c2,
  23525. 0xf8841ec9,
  23526. 0xd2bb3df8,
  23527. 0xdcb230f3,
  23528. 0xcea927ee,
  23529. 0xc0a02ae5,
  23530. 0x7a47b13c,
  23531. 0x744ebc37,
  23532. 0x6655ab2a,
  23533. 0x685ca621,
  23534. 0x42638510,
  23535. 0x4c6a881b,
  23536. 0x5e719f06,
  23537. 0x5078920d,
  23538. 0x0a0fd964,
  23539. 0x0406d46f,
  23540. 0x161dc372,
  23541. 0x1814ce79,
  23542. 0x322bed48,
  23543. 0x3c22e043,
  23544. 0x2e39f75e,
  23545. 0x2030fa55,
  23546. 0xec9ab701,
  23547. 0xe293ba0a,
  23548. 0xf088ad17,
  23549. 0xfe81a01c,
  23550. 0xd4be832d,
  23551. 0xdab78e26,
  23552. 0xc8ac993b,
  23553. 0xc6a59430,
  23554. 0x9cd2df59,
  23555. 0x92dbd252,
  23556. 0x80c0c54f,
  23557. 0x8ec9c844,
  23558. 0xa4f6eb75,
  23559. 0xaaffe67e,
  23560. 0xb8e4f163,
  23561. 0xb6edfc68,
  23562. 0x0c0a67b1,
  23563. 0x02036aba,
  23564. 0x10187da7,
  23565. 0x1e1170ac,
  23566. 0x342e539d,
  23567. 0x3a275e96,
  23568. 0x283c498b,
  23569. 0x26354480,
  23570. 0x7c420fe9,
  23571. 0x724b02e2,
  23572. 0x605015ff,
  23573. 0x6e5918f4,
  23574. 0x44663bc5,
  23575. 0x4a6f36ce,
  23576. 0x587421d3,
  23577. 0x567d2cd8,
  23578. 0x37a10c7a,
  23579. 0x39a80171,
  23580. 0x2bb3166c,
  23581. 0x25ba1b67,
  23582. 0x0f853856,
  23583. 0x018c355d,
  23584. 0x13972240,
  23585. 0x1d9e2f4b,
  23586. 0x47e96422,
  23587. 0x49e06929,
  23588. 0x5bfb7e34,
  23589. 0x55f2733f,
  23590. 0x7fcd500e,
  23591. 0x71c45d05,
  23592. 0x63df4a18,
  23593. 0x6dd64713,
  23594. 0xd731dcca,
  23595. 0xd938d1c1,
  23596. 0xcb23c6dc,
  23597. 0xc52acbd7,
  23598. 0xef15e8e6,
  23599. 0xe11ce5ed,
  23600. 0xf307f2f0,
  23601. 0xfd0efffb,
  23602. 0xa779b492,
  23603. 0xa970b999,
  23604. 0xbb6bae84,
  23605. 0xb562a38f,
  23606. 0x9f5d80be,
  23607. 0x91548db5,
  23608. 0x834f9aa8,
  23609. 0x8d4697a3
  23610. ]);
  23611. function expandKey128(cipherKey) {
  23612. var b = 176, result = new Uint8Array(b);
  23613. result.set(cipherKey);
  23614. for (var j = 16, i = 1; j < b; ++i) {
  23615. var t1 = result[j - 3], t2 = result[j - 2], t3 = result[j - 1], t4 = result[j - 4];
  23616. t1 = s[t1];
  23617. t2 = s[t2];
  23618. t3 = s[t3];
  23619. t4 = s[t4];
  23620. t1 = t1 ^ rcon[i];
  23621. for (var n = 0; n < 4; ++n) {
  23622. result[j] = t1 ^= result[j - 16];
  23623. j++;
  23624. result[j] = t2 ^= result[j - 16];
  23625. j++;
  23626. result[j] = t3 ^= result[j - 16];
  23627. j++;
  23628. result[j] = t4 ^= result[j - 16];
  23629. j++;
  23630. }
  23631. }
  23632. return result;
  23633. }
  23634. function decrypt128(input, key) {
  23635. var state = new Uint8Array(16);
  23636. state.set(input);
  23637. var i, j, k;
  23638. var t, u, v;
  23639. for (j = 0, k = 160; j < 16; ++j, ++k) {
  23640. state[j] ^= key[k];
  23641. }
  23642. for (i = 9; i >= 1; --i) {
  23643. t = state[13];
  23644. state[13] = state[9];
  23645. state[9] = state[5];
  23646. state[5] = state[1];
  23647. state[1] = t;
  23648. t = state[14];
  23649. u = state[10];
  23650. state[14] = state[6];
  23651. state[10] = state[2];
  23652. state[6] = t;
  23653. state[2] = u;
  23654. t = state[15];
  23655. u = state[11];
  23656. v = state[7];
  23657. state[15] = state[3];
  23658. state[11] = t;
  23659. state[7] = u;
  23660. state[3] = v;
  23661. for (j = 0; j < 16; ++j) {
  23662. state[j] = inv_s[state[j]];
  23663. }
  23664. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  23665. state[j] ^= key[k];
  23666. }
  23667. for (j = 0; j < 16; j += 4) {
  23668. var s0 = mix[state[j]], s1 = mix[state[j + 1]], s2 = mix[state[j + 2]], s3 = mix[state[j + 3]];
  23669. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  23670. state[j] = t >>> 24 & 0xFF;
  23671. state[j + 1] = t >> 16 & 0xFF;
  23672. state[j + 2] = t >> 8 & 0xFF;
  23673. state[j + 3] = t & 0xFF;
  23674. }
  23675. }
  23676. t = state[13];
  23677. state[13] = state[9];
  23678. state[9] = state[5];
  23679. state[5] = state[1];
  23680. state[1] = t;
  23681. t = state[14];
  23682. u = state[10];
  23683. state[14] = state[6];
  23684. state[10] = state[2];
  23685. state[6] = t;
  23686. state[2] = u;
  23687. t = state[15];
  23688. u = state[11];
  23689. v = state[7];
  23690. state[15] = state[3];
  23691. state[11] = t;
  23692. state[7] = u;
  23693. state[3] = v;
  23694. for (j = 0; j < 16; ++j) {
  23695. state[j] = inv_s[state[j]];
  23696. state[j] ^= key[j];
  23697. }
  23698. return state;
  23699. }
  23700. function encrypt128(input, key) {
  23701. var t, u, v, k;
  23702. var state = new Uint8Array(16);
  23703. state.set(input);
  23704. for (j = 0; j < 16; ++j) {
  23705. state[j] ^= key[j];
  23706. }
  23707. for (i = 1; i < 10; i++) {
  23708. for (j = 0; j < 16; ++j) {
  23709. state[j] = s[state[j]];
  23710. }
  23711. v = state[1];
  23712. state[1] = state[5];
  23713. state[5] = state[9];
  23714. state[9] = state[13];
  23715. state[13] = v;
  23716. v = state[2];
  23717. u = state[6];
  23718. state[2] = state[10];
  23719. state[6] = state[14];
  23720. state[10] = v;
  23721. state[14] = u;
  23722. v = state[3];
  23723. u = state[7];
  23724. t = state[11];
  23725. state[3] = state[15];
  23726. state[7] = v;
  23727. state[11] = u;
  23728. state[15] = t;
  23729. for (var j = 0; j < 16; j += 4) {
  23730. var s0 = state[j + 0], s1 = state[j + 1];
  23731. var s2 = state[j + 2], s3 = state[j + 3];
  23732. t = s0 ^ s1 ^ s2 ^ s3;
  23733. state[j + 0] ^= t ^ mixCol[s0 ^ s1];
  23734. state[j + 1] ^= t ^ mixCol[s1 ^ s2];
  23735. state[j + 2] ^= t ^ mixCol[s2 ^ s3];
  23736. state[j + 3] ^= t ^ mixCol[s3 ^ s0];
  23737. }
  23738. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  23739. state[j] ^= key[k];
  23740. }
  23741. }
  23742. for (j = 0; j < 16; ++j) {
  23743. state[j] = s[state[j]];
  23744. }
  23745. v = state[1];
  23746. state[1] = state[5];
  23747. state[5] = state[9];
  23748. state[9] = state[13];
  23749. state[13] = v;
  23750. v = state[2];
  23751. u = state[6];
  23752. state[2] = state[10];
  23753. state[6] = state[14];
  23754. state[10] = v;
  23755. state[14] = u;
  23756. v = state[3];
  23757. u = state[7];
  23758. t = state[11];
  23759. state[3] = state[15];
  23760. state[7] = v;
  23761. state[11] = u;
  23762. state[15] = t;
  23763. for (j = 0, k = 160; j < 16; ++j, ++k) {
  23764. state[j] ^= key[k];
  23765. }
  23766. return state;
  23767. }
  23768. function AES128Cipher(key) {
  23769. this.key = expandKey128(key);
  23770. this.buffer = new Uint8Array(16);
  23771. this.bufferPosition = 0;
  23772. }
  23773. function decryptBlock2(data, finalize) {
  23774. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [], iv = this.iv;
  23775. for (i = 0; i < sourceLength; ++i) {
  23776. buffer[bufferLength] = data[i];
  23777. ++bufferLength;
  23778. if (bufferLength < 16) {
  23779. continue;
  23780. }
  23781. var plain = decrypt128(buffer, this.key);
  23782. for (j = 0; j < 16; ++j) {
  23783. plain[j] ^= iv[j];
  23784. }
  23785. iv = buffer;
  23786. result.push(plain);
  23787. buffer = new Uint8Array(16);
  23788. bufferLength = 0;
  23789. }
  23790. this.buffer = buffer;
  23791. this.bufferLength = bufferLength;
  23792. this.iv = iv;
  23793. if (result.length === 0) {
  23794. return new Uint8Array([]);
  23795. }
  23796. var outputLength = 16 * result.length;
  23797. if (finalize) {
  23798. var lastBlock = result[result.length - 1];
  23799. var psLen = lastBlock[15];
  23800. if (psLen <= 16) {
  23801. for (i = 15, ii = 16 - psLen; i >= ii; --i) {
  23802. if (lastBlock[i] !== psLen) {
  23803. psLen = 0;
  23804. break;
  23805. }
  23806. }
  23807. outputLength -= psLen;
  23808. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  23809. }
  23810. }
  23811. var output = new Uint8Array(outputLength);
  23812. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  23813. output.set(result[i], j);
  23814. }
  23815. return output;
  23816. }
  23817. AES128Cipher.prototype = {
  23818. decryptBlock: function AES128Cipher_decryptBlock(data, finalize) {
  23819. var i, sourceLength = data.length;
  23820. var buffer = this.buffer, bufferLength = this.bufferPosition;
  23821. for (i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  23822. buffer[bufferLength] = data[i];
  23823. }
  23824. if (bufferLength < 16) {
  23825. this.bufferLength = bufferLength;
  23826. return new Uint8Array([]);
  23827. }
  23828. this.iv = buffer;
  23829. this.buffer = new Uint8Array(16);
  23830. this.bufferLength = 0;
  23831. this.decryptBlock = decryptBlock2;
  23832. return this.decryptBlock(data.subarray(16), finalize);
  23833. },
  23834. encrypt: function AES128Cipher_encrypt(data, iv) {
  23835. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [];
  23836. if (!iv) {
  23837. iv = new Uint8Array(16);
  23838. }
  23839. for (i = 0; i < sourceLength; ++i) {
  23840. buffer[bufferLength] = data[i];
  23841. ++bufferLength;
  23842. if (bufferLength < 16) {
  23843. continue;
  23844. }
  23845. for (j = 0; j < 16; ++j) {
  23846. buffer[j] ^= iv[j];
  23847. }
  23848. var cipher = encrypt128(buffer, this.key);
  23849. iv = cipher;
  23850. result.push(cipher);
  23851. buffer = new Uint8Array(16);
  23852. bufferLength = 0;
  23853. }
  23854. this.buffer = buffer;
  23855. this.bufferLength = bufferLength;
  23856. this.iv = iv;
  23857. if (result.length === 0) {
  23858. return new Uint8Array([]);
  23859. }
  23860. var outputLength = 16 * result.length;
  23861. var output = new Uint8Array(outputLength);
  23862. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  23863. output.set(result[i], j);
  23864. }
  23865. return output;
  23866. }
  23867. };
  23868. return AES128Cipher;
  23869. }();
  23870. var AES256Cipher = function AES256CipherClosure() {
  23871. var s = new Uint8Array([
  23872. 0x63,
  23873. 0x7c,
  23874. 0x77,
  23875. 0x7b,
  23876. 0xf2,
  23877. 0x6b,
  23878. 0x6f,
  23879. 0xc5,
  23880. 0x30,
  23881. 0x01,
  23882. 0x67,
  23883. 0x2b,
  23884. 0xfe,
  23885. 0xd7,
  23886. 0xab,
  23887. 0x76,
  23888. 0xca,
  23889. 0x82,
  23890. 0xc9,
  23891. 0x7d,
  23892. 0xfa,
  23893. 0x59,
  23894. 0x47,
  23895. 0xf0,
  23896. 0xad,
  23897. 0xd4,
  23898. 0xa2,
  23899. 0xaf,
  23900. 0x9c,
  23901. 0xa4,
  23902. 0x72,
  23903. 0xc0,
  23904. 0xb7,
  23905. 0xfd,
  23906. 0x93,
  23907. 0x26,
  23908. 0x36,
  23909. 0x3f,
  23910. 0xf7,
  23911. 0xcc,
  23912. 0x34,
  23913. 0xa5,
  23914. 0xe5,
  23915. 0xf1,
  23916. 0x71,
  23917. 0xd8,
  23918. 0x31,
  23919. 0x15,
  23920. 0x04,
  23921. 0xc7,
  23922. 0x23,
  23923. 0xc3,
  23924. 0x18,
  23925. 0x96,
  23926. 0x05,
  23927. 0x9a,
  23928. 0x07,
  23929. 0x12,
  23930. 0x80,
  23931. 0xe2,
  23932. 0xeb,
  23933. 0x27,
  23934. 0xb2,
  23935. 0x75,
  23936. 0x09,
  23937. 0x83,
  23938. 0x2c,
  23939. 0x1a,
  23940. 0x1b,
  23941. 0x6e,
  23942. 0x5a,
  23943. 0xa0,
  23944. 0x52,
  23945. 0x3b,
  23946. 0xd6,
  23947. 0xb3,
  23948. 0x29,
  23949. 0xe3,
  23950. 0x2f,
  23951. 0x84,
  23952. 0x53,
  23953. 0xd1,
  23954. 0x00,
  23955. 0xed,
  23956. 0x20,
  23957. 0xfc,
  23958. 0xb1,
  23959. 0x5b,
  23960. 0x6a,
  23961. 0xcb,
  23962. 0xbe,
  23963. 0x39,
  23964. 0x4a,
  23965. 0x4c,
  23966. 0x58,
  23967. 0xcf,
  23968. 0xd0,
  23969. 0xef,
  23970. 0xaa,
  23971. 0xfb,
  23972. 0x43,
  23973. 0x4d,
  23974. 0x33,
  23975. 0x85,
  23976. 0x45,
  23977. 0xf9,
  23978. 0x02,
  23979. 0x7f,
  23980. 0x50,
  23981. 0x3c,
  23982. 0x9f,
  23983. 0xa8,
  23984. 0x51,
  23985. 0xa3,
  23986. 0x40,
  23987. 0x8f,
  23988. 0x92,
  23989. 0x9d,
  23990. 0x38,
  23991. 0xf5,
  23992. 0xbc,
  23993. 0xb6,
  23994. 0xda,
  23995. 0x21,
  23996. 0x10,
  23997. 0xff,
  23998. 0xf3,
  23999. 0xd2,
  24000. 0xcd,
  24001. 0x0c,
  24002. 0x13,
  24003. 0xec,
  24004. 0x5f,
  24005. 0x97,
  24006. 0x44,
  24007. 0x17,
  24008. 0xc4,
  24009. 0xa7,
  24010. 0x7e,
  24011. 0x3d,
  24012. 0x64,
  24013. 0x5d,
  24014. 0x19,
  24015. 0x73,
  24016. 0x60,
  24017. 0x81,
  24018. 0x4f,
  24019. 0xdc,
  24020. 0x22,
  24021. 0x2a,
  24022. 0x90,
  24023. 0x88,
  24024. 0x46,
  24025. 0xee,
  24026. 0xb8,
  24027. 0x14,
  24028. 0xde,
  24029. 0x5e,
  24030. 0x0b,
  24031. 0xdb,
  24032. 0xe0,
  24033. 0x32,
  24034. 0x3a,
  24035. 0x0a,
  24036. 0x49,
  24037. 0x06,
  24038. 0x24,
  24039. 0x5c,
  24040. 0xc2,
  24041. 0xd3,
  24042. 0xac,
  24043. 0x62,
  24044. 0x91,
  24045. 0x95,
  24046. 0xe4,
  24047. 0x79,
  24048. 0xe7,
  24049. 0xc8,
  24050. 0x37,
  24051. 0x6d,
  24052. 0x8d,
  24053. 0xd5,
  24054. 0x4e,
  24055. 0xa9,
  24056. 0x6c,
  24057. 0x56,
  24058. 0xf4,
  24059. 0xea,
  24060. 0x65,
  24061. 0x7a,
  24062. 0xae,
  24063. 0x08,
  24064. 0xba,
  24065. 0x78,
  24066. 0x25,
  24067. 0x2e,
  24068. 0x1c,
  24069. 0xa6,
  24070. 0xb4,
  24071. 0xc6,
  24072. 0xe8,
  24073. 0xdd,
  24074. 0x74,
  24075. 0x1f,
  24076. 0x4b,
  24077. 0xbd,
  24078. 0x8b,
  24079. 0x8a,
  24080. 0x70,
  24081. 0x3e,
  24082. 0xb5,
  24083. 0x66,
  24084. 0x48,
  24085. 0x03,
  24086. 0xf6,
  24087. 0x0e,
  24088. 0x61,
  24089. 0x35,
  24090. 0x57,
  24091. 0xb9,
  24092. 0x86,
  24093. 0xc1,
  24094. 0x1d,
  24095. 0x9e,
  24096. 0xe1,
  24097. 0xf8,
  24098. 0x98,
  24099. 0x11,
  24100. 0x69,
  24101. 0xd9,
  24102. 0x8e,
  24103. 0x94,
  24104. 0x9b,
  24105. 0x1e,
  24106. 0x87,
  24107. 0xe9,
  24108. 0xce,
  24109. 0x55,
  24110. 0x28,
  24111. 0xdf,
  24112. 0x8c,
  24113. 0xa1,
  24114. 0x89,
  24115. 0x0d,
  24116. 0xbf,
  24117. 0xe6,
  24118. 0x42,
  24119. 0x68,
  24120. 0x41,
  24121. 0x99,
  24122. 0x2d,
  24123. 0x0f,
  24124. 0xb0,
  24125. 0x54,
  24126. 0xbb,
  24127. 0x16
  24128. ]);
  24129. var inv_s = new Uint8Array([
  24130. 0x52,
  24131. 0x09,
  24132. 0x6a,
  24133. 0xd5,
  24134. 0x30,
  24135. 0x36,
  24136. 0xa5,
  24137. 0x38,
  24138. 0xbf,
  24139. 0x40,
  24140. 0xa3,
  24141. 0x9e,
  24142. 0x81,
  24143. 0xf3,
  24144. 0xd7,
  24145. 0xfb,
  24146. 0x7c,
  24147. 0xe3,
  24148. 0x39,
  24149. 0x82,
  24150. 0x9b,
  24151. 0x2f,
  24152. 0xff,
  24153. 0x87,
  24154. 0x34,
  24155. 0x8e,
  24156. 0x43,
  24157. 0x44,
  24158. 0xc4,
  24159. 0xde,
  24160. 0xe9,
  24161. 0xcb,
  24162. 0x54,
  24163. 0x7b,
  24164. 0x94,
  24165. 0x32,
  24166. 0xa6,
  24167. 0xc2,
  24168. 0x23,
  24169. 0x3d,
  24170. 0xee,
  24171. 0x4c,
  24172. 0x95,
  24173. 0x0b,
  24174. 0x42,
  24175. 0xfa,
  24176. 0xc3,
  24177. 0x4e,
  24178. 0x08,
  24179. 0x2e,
  24180. 0xa1,
  24181. 0x66,
  24182. 0x28,
  24183. 0xd9,
  24184. 0x24,
  24185. 0xb2,
  24186. 0x76,
  24187. 0x5b,
  24188. 0xa2,
  24189. 0x49,
  24190. 0x6d,
  24191. 0x8b,
  24192. 0xd1,
  24193. 0x25,
  24194. 0x72,
  24195. 0xf8,
  24196. 0xf6,
  24197. 0x64,
  24198. 0x86,
  24199. 0x68,
  24200. 0x98,
  24201. 0x16,
  24202. 0xd4,
  24203. 0xa4,
  24204. 0x5c,
  24205. 0xcc,
  24206. 0x5d,
  24207. 0x65,
  24208. 0xb6,
  24209. 0x92,
  24210. 0x6c,
  24211. 0x70,
  24212. 0x48,
  24213. 0x50,
  24214. 0xfd,
  24215. 0xed,
  24216. 0xb9,
  24217. 0xda,
  24218. 0x5e,
  24219. 0x15,
  24220. 0x46,
  24221. 0x57,
  24222. 0xa7,
  24223. 0x8d,
  24224. 0x9d,
  24225. 0x84,
  24226. 0x90,
  24227. 0xd8,
  24228. 0xab,
  24229. 0x00,
  24230. 0x8c,
  24231. 0xbc,
  24232. 0xd3,
  24233. 0x0a,
  24234. 0xf7,
  24235. 0xe4,
  24236. 0x58,
  24237. 0x05,
  24238. 0xb8,
  24239. 0xb3,
  24240. 0x45,
  24241. 0x06,
  24242. 0xd0,
  24243. 0x2c,
  24244. 0x1e,
  24245. 0x8f,
  24246. 0xca,
  24247. 0x3f,
  24248. 0x0f,
  24249. 0x02,
  24250. 0xc1,
  24251. 0xaf,
  24252. 0xbd,
  24253. 0x03,
  24254. 0x01,
  24255. 0x13,
  24256. 0x8a,
  24257. 0x6b,
  24258. 0x3a,
  24259. 0x91,
  24260. 0x11,
  24261. 0x41,
  24262. 0x4f,
  24263. 0x67,
  24264. 0xdc,
  24265. 0xea,
  24266. 0x97,
  24267. 0xf2,
  24268. 0xcf,
  24269. 0xce,
  24270. 0xf0,
  24271. 0xb4,
  24272. 0xe6,
  24273. 0x73,
  24274. 0x96,
  24275. 0xac,
  24276. 0x74,
  24277. 0x22,
  24278. 0xe7,
  24279. 0xad,
  24280. 0x35,
  24281. 0x85,
  24282. 0xe2,
  24283. 0xf9,
  24284. 0x37,
  24285. 0xe8,
  24286. 0x1c,
  24287. 0x75,
  24288. 0xdf,
  24289. 0x6e,
  24290. 0x47,
  24291. 0xf1,
  24292. 0x1a,
  24293. 0x71,
  24294. 0x1d,
  24295. 0x29,
  24296. 0xc5,
  24297. 0x89,
  24298. 0x6f,
  24299. 0xb7,
  24300. 0x62,
  24301. 0x0e,
  24302. 0xaa,
  24303. 0x18,
  24304. 0xbe,
  24305. 0x1b,
  24306. 0xfc,
  24307. 0x56,
  24308. 0x3e,
  24309. 0x4b,
  24310. 0xc6,
  24311. 0xd2,
  24312. 0x79,
  24313. 0x20,
  24314. 0x9a,
  24315. 0xdb,
  24316. 0xc0,
  24317. 0xfe,
  24318. 0x78,
  24319. 0xcd,
  24320. 0x5a,
  24321. 0xf4,
  24322. 0x1f,
  24323. 0xdd,
  24324. 0xa8,
  24325. 0x33,
  24326. 0x88,
  24327. 0x07,
  24328. 0xc7,
  24329. 0x31,
  24330. 0xb1,
  24331. 0x12,
  24332. 0x10,
  24333. 0x59,
  24334. 0x27,
  24335. 0x80,
  24336. 0xec,
  24337. 0x5f,
  24338. 0x60,
  24339. 0x51,
  24340. 0x7f,
  24341. 0xa9,
  24342. 0x19,
  24343. 0xb5,
  24344. 0x4a,
  24345. 0x0d,
  24346. 0x2d,
  24347. 0xe5,
  24348. 0x7a,
  24349. 0x9f,
  24350. 0x93,
  24351. 0xc9,
  24352. 0x9c,
  24353. 0xef,
  24354. 0xa0,
  24355. 0xe0,
  24356. 0x3b,
  24357. 0x4d,
  24358. 0xae,
  24359. 0x2a,
  24360. 0xf5,
  24361. 0xb0,
  24362. 0xc8,
  24363. 0xeb,
  24364. 0xbb,
  24365. 0x3c,
  24366. 0x83,
  24367. 0x53,
  24368. 0x99,
  24369. 0x61,
  24370. 0x17,
  24371. 0x2b,
  24372. 0x04,
  24373. 0x7e,
  24374. 0xba,
  24375. 0x77,
  24376. 0xd6,
  24377. 0x26,
  24378. 0xe1,
  24379. 0x69,
  24380. 0x14,
  24381. 0x63,
  24382. 0x55,
  24383. 0x21,
  24384. 0x0c,
  24385. 0x7d
  24386. ]);
  24387. var mixCol = new Uint8Array(256);
  24388. for (var i = 0; i < 256; i++) {
  24389. if (i < 128) {
  24390. mixCol[i] = i << 1;
  24391. } else {
  24392. mixCol[i] = i << 1 ^ 0x1b;
  24393. }
  24394. }
  24395. var mix = new Uint32Array([
  24396. 0x00000000,
  24397. 0x0e090d0b,
  24398. 0x1c121a16,
  24399. 0x121b171d,
  24400. 0x3824342c,
  24401. 0x362d3927,
  24402. 0x24362e3a,
  24403. 0x2a3f2331,
  24404. 0x70486858,
  24405. 0x7e416553,
  24406. 0x6c5a724e,
  24407. 0x62537f45,
  24408. 0x486c5c74,
  24409. 0x4665517f,
  24410. 0x547e4662,
  24411. 0x5a774b69,
  24412. 0xe090d0b0,
  24413. 0xee99ddbb,
  24414. 0xfc82caa6,
  24415. 0xf28bc7ad,
  24416. 0xd8b4e49c,
  24417. 0xd6bde997,
  24418. 0xc4a6fe8a,
  24419. 0xcaaff381,
  24420. 0x90d8b8e8,
  24421. 0x9ed1b5e3,
  24422. 0x8ccaa2fe,
  24423. 0x82c3aff5,
  24424. 0xa8fc8cc4,
  24425. 0xa6f581cf,
  24426. 0xb4ee96d2,
  24427. 0xbae79bd9,
  24428. 0xdb3bbb7b,
  24429. 0xd532b670,
  24430. 0xc729a16d,
  24431. 0xc920ac66,
  24432. 0xe31f8f57,
  24433. 0xed16825c,
  24434. 0xff0d9541,
  24435. 0xf104984a,
  24436. 0xab73d323,
  24437. 0xa57ade28,
  24438. 0xb761c935,
  24439. 0xb968c43e,
  24440. 0x9357e70f,
  24441. 0x9d5eea04,
  24442. 0x8f45fd19,
  24443. 0x814cf012,
  24444. 0x3bab6bcb,
  24445. 0x35a266c0,
  24446. 0x27b971dd,
  24447. 0x29b07cd6,
  24448. 0x038f5fe7,
  24449. 0x0d8652ec,
  24450. 0x1f9d45f1,
  24451. 0x119448fa,
  24452. 0x4be30393,
  24453. 0x45ea0e98,
  24454. 0x57f11985,
  24455. 0x59f8148e,
  24456. 0x73c737bf,
  24457. 0x7dce3ab4,
  24458. 0x6fd52da9,
  24459. 0x61dc20a2,
  24460. 0xad766df6,
  24461. 0xa37f60fd,
  24462. 0xb16477e0,
  24463. 0xbf6d7aeb,
  24464. 0x955259da,
  24465. 0x9b5b54d1,
  24466. 0x894043cc,
  24467. 0x87494ec7,
  24468. 0xdd3e05ae,
  24469. 0xd33708a5,
  24470. 0xc12c1fb8,
  24471. 0xcf2512b3,
  24472. 0xe51a3182,
  24473. 0xeb133c89,
  24474. 0xf9082b94,
  24475. 0xf701269f,
  24476. 0x4de6bd46,
  24477. 0x43efb04d,
  24478. 0x51f4a750,
  24479. 0x5ffdaa5b,
  24480. 0x75c2896a,
  24481. 0x7bcb8461,
  24482. 0x69d0937c,
  24483. 0x67d99e77,
  24484. 0x3daed51e,
  24485. 0x33a7d815,
  24486. 0x21bccf08,
  24487. 0x2fb5c203,
  24488. 0x058ae132,
  24489. 0x0b83ec39,
  24490. 0x1998fb24,
  24491. 0x1791f62f,
  24492. 0x764dd68d,
  24493. 0x7844db86,
  24494. 0x6a5fcc9b,
  24495. 0x6456c190,
  24496. 0x4e69e2a1,
  24497. 0x4060efaa,
  24498. 0x527bf8b7,
  24499. 0x5c72f5bc,
  24500. 0x0605bed5,
  24501. 0x080cb3de,
  24502. 0x1a17a4c3,
  24503. 0x141ea9c8,
  24504. 0x3e218af9,
  24505. 0x302887f2,
  24506. 0x223390ef,
  24507. 0x2c3a9de4,
  24508. 0x96dd063d,
  24509. 0x98d40b36,
  24510. 0x8acf1c2b,
  24511. 0x84c61120,
  24512. 0xaef93211,
  24513. 0xa0f03f1a,
  24514. 0xb2eb2807,
  24515. 0xbce2250c,
  24516. 0xe6956e65,
  24517. 0xe89c636e,
  24518. 0xfa877473,
  24519. 0xf48e7978,
  24520. 0xdeb15a49,
  24521. 0xd0b85742,
  24522. 0xc2a3405f,
  24523. 0xccaa4d54,
  24524. 0x41ecdaf7,
  24525. 0x4fe5d7fc,
  24526. 0x5dfec0e1,
  24527. 0x53f7cdea,
  24528. 0x79c8eedb,
  24529. 0x77c1e3d0,
  24530. 0x65daf4cd,
  24531. 0x6bd3f9c6,
  24532. 0x31a4b2af,
  24533. 0x3fadbfa4,
  24534. 0x2db6a8b9,
  24535. 0x23bfa5b2,
  24536. 0x09808683,
  24537. 0x07898b88,
  24538. 0x15929c95,
  24539. 0x1b9b919e,
  24540. 0xa17c0a47,
  24541. 0xaf75074c,
  24542. 0xbd6e1051,
  24543. 0xb3671d5a,
  24544. 0x99583e6b,
  24545. 0x97513360,
  24546. 0x854a247d,
  24547. 0x8b432976,
  24548. 0xd134621f,
  24549. 0xdf3d6f14,
  24550. 0xcd267809,
  24551. 0xc32f7502,
  24552. 0xe9105633,
  24553. 0xe7195b38,
  24554. 0xf5024c25,
  24555. 0xfb0b412e,
  24556. 0x9ad7618c,
  24557. 0x94de6c87,
  24558. 0x86c57b9a,
  24559. 0x88cc7691,
  24560. 0xa2f355a0,
  24561. 0xacfa58ab,
  24562. 0xbee14fb6,
  24563. 0xb0e842bd,
  24564. 0xea9f09d4,
  24565. 0xe49604df,
  24566. 0xf68d13c2,
  24567. 0xf8841ec9,
  24568. 0xd2bb3df8,
  24569. 0xdcb230f3,
  24570. 0xcea927ee,
  24571. 0xc0a02ae5,
  24572. 0x7a47b13c,
  24573. 0x744ebc37,
  24574. 0x6655ab2a,
  24575. 0x685ca621,
  24576. 0x42638510,
  24577. 0x4c6a881b,
  24578. 0x5e719f06,
  24579. 0x5078920d,
  24580. 0x0a0fd964,
  24581. 0x0406d46f,
  24582. 0x161dc372,
  24583. 0x1814ce79,
  24584. 0x322bed48,
  24585. 0x3c22e043,
  24586. 0x2e39f75e,
  24587. 0x2030fa55,
  24588. 0xec9ab701,
  24589. 0xe293ba0a,
  24590. 0xf088ad17,
  24591. 0xfe81a01c,
  24592. 0xd4be832d,
  24593. 0xdab78e26,
  24594. 0xc8ac993b,
  24595. 0xc6a59430,
  24596. 0x9cd2df59,
  24597. 0x92dbd252,
  24598. 0x80c0c54f,
  24599. 0x8ec9c844,
  24600. 0xa4f6eb75,
  24601. 0xaaffe67e,
  24602. 0xb8e4f163,
  24603. 0xb6edfc68,
  24604. 0x0c0a67b1,
  24605. 0x02036aba,
  24606. 0x10187da7,
  24607. 0x1e1170ac,
  24608. 0x342e539d,
  24609. 0x3a275e96,
  24610. 0x283c498b,
  24611. 0x26354480,
  24612. 0x7c420fe9,
  24613. 0x724b02e2,
  24614. 0x605015ff,
  24615. 0x6e5918f4,
  24616. 0x44663bc5,
  24617. 0x4a6f36ce,
  24618. 0x587421d3,
  24619. 0x567d2cd8,
  24620. 0x37a10c7a,
  24621. 0x39a80171,
  24622. 0x2bb3166c,
  24623. 0x25ba1b67,
  24624. 0x0f853856,
  24625. 0x018c355d,
  24626. 0x13972240,
  24627. 0x1d9e2f4b,
  24628. 0x47e96422,
  24629. 0x49e06929,
  24630. 0x5bfb7e34,
  24631. 0x55f2733f,
  24632. 0x7fcd500e,
  24633. 0x71c45d05,
  24634. 0x63df4a18,
  24635. 0x6dd64713,
  24636. 0xd731dcca,
  24637. 0xd938d1c1,
  24638. 0xcb23c6dc,
  24639. 0xc52acbd7,
  24640. 0xef15e8e6,
  24641. 0xe11ce5ed,
  24642. 0xf307f2f0,
  24643. 0xfd0efffb,
  24644. 0xa779b492,
  24645. 0xa970b999,
  24646. 0xbb6bae84,
  24647. 0xb562a38f,
  24648. 0x9f5d80be,
  24649. 0x91548db5,
  24650. 0x834f9aa8,
  24651. 0x8d4697a3
  24652. ]);
  24653. function expandKey256(cipherKey) {
  24654. var b = 240, result = new Uint8Array(b);
  24655. var r = 1;
  24656. result.set(cipherKey);
  24657. for (var j = 32, i = 1; j < b; ++i) {
  24658. if (j % 32 === 16) {
  24659. t1 = s[t1];
  24660. t2 = s[t2];
  24661. t3 = s[t3];
  24662. t4 = s[t4];
  24663. } else if (j % 32 === 0) {
  24664. var t1 = result[j - 3], t2 = result[j - 2], t3 = result[j - 1], t4 = result[j - 4];
  24665. t1 = s[t1];
  24666. t2 = s[t2];
  24667. t3 = s[t3];
  24668. t4 = s[t4];
  24669. t1 = t1 ^ r;
  24670. if ((r <<= 1) >= 256) {
  24671. r = (r ^ 0x1b) & 0xFF;
  24672. }
  24673. }
  24674. for (var n = 0; n < 4; ++n) {
  24675. result[j] = t1 ^= result[j - 32];
  24676. j++;
  24677. result[j] = t2 ^= result[j - 32];
  24678. j++;
  24679. result[j] = t3 ^= result[j - 32];
  24680. j++;
  24681. result[j] = t4 ^= result[j - 32];
  24682. j++;
  24683. }
  24684. }
  24685. return result;
  24686. }
  24687. function decrypt256(input, key) {
  24688. var state = new Uint8Array(16);
  24689. state.set(input);
  24690. var i, j, k;
  24691. var t, u, v;
  24692. for (j = 0, k = 224; j < 16; ++j, ++k) {
  24693. state[j] ^= key[k];
  24694. }
  24695. for (i = 13; i >= 1; --i) {
  24696. t = state[13];
  24697. state[13] = state[9];
  24698. state[9] = state[5];
  24699. state[5] = state[1];
  24700. state[1] = t;
  24701. t = state[14];
  24702. u = state[10];
  24703. state[14] = state[6];
  24704. state[10] = state[2];
  24705. state[6] = t;
  24706. state[2] = u;
  24707. t = state[15];
  24708. u = state[11];
  24709. v = state[7];
  24710. state[15] = state[3];
  24711. state[11] = t;
  24712. state[7] = u;
  24713. state[3] = v;
  24714. for (j = 0; j < 16; ++j) {
  24715. state[j] = inv_s[state[j]];
  24716. }
  24717. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  24718. state[j] ^= key[k];
  24719. }
  24720. for (j = 0; j < 16; j += 4) {
  24721. var s0 = mix[state[j]], s1 = mix[state[j + 1]], s2 = mix[state[j + 2]], s3 = mix[state[j + 3]];
  24722. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  24723. state[j] = t >>> 24 & 0xFF;
  24724. state[j + 1] = t >> 16 & 0xFF;
  24725. state[j + 2] = t >> 8 & 0xFF;
  24726. state[j + 3] = t & 0xFF;
  24727. }
  24728. }
  24729. t = state[13];
  24730. state[13] = state[9];
  24731. state[9] = state[5];
  24732. state[5] = state[1];
  24733. state[1] = t;
  24734. t = state[14];
  24735. u = state[10];
  24736. state[14] = state[6];
  24737. state[10] = state[2];
  24738. state[6] = t;
  24739. state[2] = u;
  24740. t = state[15];
  24741. u = state[11];
  24742. v = state[7];
  24743. state[15] = state[3];
  24744. state[11] = t;
  24745. state[7] = u;
  24746. state[3] = v;
  24747. for (j = 0; j < 16; ++j) {
  24748. state[j] = inv_s[state[j]];
  24749. state[j] ^= key[j];
  24750. }
  24751. return state;
  24752. }
  24753. function encrypt256(input, key) {
  24754. var t, u, v, k;
  24755. var state = new Uint8Array(16);
  24756. state.set(input);
  24757. for (j = 0; j < 16; ++j) {
  24758. state[j] ^= key[j];
  24759. }
  24760. for (i = 1; i < 14; i++) {
  24761. for (j = 0; j < 16; ++j) {
  24762. state[j] = s[state[j]];
  24763. }
  24764. v = state[1];
  24765. state[1] = state[5];
  24766. state[5] = state[9];
  24767. state[9] = state[13];
  24768. state[13] = v;
  24769. v = state[2];
  24770. u = state[6];
  24771. state[2] = state[10];
  24772. state[6] = state[14];
  24773. state[10] = v;
  24774. state[14] = u;
  24775. v = state[3];
  24776. u = state[7];
  24777. t = state[11];
  24778. state[3] = state[15];
  24779. state[7] = v;
  24780. state[11] = u;
  24781. state[15] = t;
  24782. for (var j = 0; j < 16; j += 4) {
  24783. var s0 = state[j + 0], s1 = state[j + 1];
  24784. var s2 = state[j + 2], s3 = state[j + 3];
  24785. t = s0 ^ s1 ^ s2 ^ s3;
  24786. state[j + 0] ^= t ^ mixCol[s0 ^ s1];
  24787. state[j + 1] ^= t ^ mixCol[s1 ^ s2];
  24788. state[j + 2] ^= t ^ mixCol[s2 ^ s3];
  24789. state[j + 3] ^= t ^ mixCol[s3 ^ s0];
  24790. }
  24791. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  24792. state[j] ^= key[k];
  24793. }
  24794. }
  24795. for (j = 0; j < 16; ++j) {
  24796. state[j] = s[state[j]];
  24797. }
  24798. v = state[1];
  24799. state[1] = state[5];
  24800. state[5] = state[9];
  24801. state[9] = state[13];
  24802. state[13] = v;
  24803. v = state[2];
  24804. u = state[6];
  24805. state[2] = state[10];
  24806. state[6] = state[14];
  24807. state[10] = v;
  24808. state[14] = u;
  24809. v = state[3];
  24810. u = state[7];
  24811. t = state[11];
  24812. state[3] = state[15];
  24813. state[7] = v;
  24814. state[11] = u;
  24815. state[15] = t;
  24816. for (j = 0, k = 224; j < 16; ++j, ++k) {
  24817. state[j] ^= key[k];
  24818. }
  24819. return state;
  24820. }
  24821. function AES256Cipher(key) {
  24822. this.key = expandKey256(key);
  24823. this.buffer = new Uint8Array(16);
  24824. this.bufferPosition = 0;
  24825. }
  24826. function decryptBlock2(data, finalize) {
  24827. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [], iv = this.iv;
  24828. for (i = 0; i < sourceLength; ++i) {
  24829. buffer[bufferLength] = data[i];
  24830. ++bufferLength;
  24831. if (bufferLength < 16) {
  24832. continue;
  24833. }
  24834. var plain = decrypt256(buffer, this.key);
  24835. for (j = 0; j < 16; ++j) {
  24836. plain[j] ^= iv[j];
  24837. }
  24838. iv = buffer;
  24839. result.push(plain);
  24840. buffer = new Uint8Array(16);
  24841. bufferLength = 0;
  24842. }
  24843. this.buffer = buffer;
  24844. this.bufferLength = bufferLength;
  24845. this.iv = iv;
  24846. if (result.length === 0) {
  24847. return new Uint8Array([]);
  24848. }
  24849. var outputLength = 16 * result.length;
  24850. if (finalize) {
  24851. var lastBlock = result[result.length - 1];
  24852. var psLen = lastBlock[15];
  24853. if (psLen <= 16) {
  24854. for (i = 15, ii = 16 - psLen; i >= ii; --i) {
  24855. if (lastBlock[i] !== psLen) {
  24856. psLen = 0;
  24857. break;
  24858. }
  24859. }
  24860. outputLength -= psLen;
  24861. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  24862. }
  24863. }
  24864. var output = new Uint8Array(outputLength);
  24865. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  24866. output.set(result[i], j);
  24867. }
  24868. return output;
  24869. }
  24870. AES256Cipher.prototype = {
  24871. decryptBlock: function AES256Cipher_decryptBlock(data, finalize, iv) {
  24872. var i, sourceLength = data.length;
  24873. var buffer = this.buffer, bufferLength = this.bufferPosition;
  24874. if (iv) {
  24875. this.iv = iv;
  24876. } else {
  24877. for (i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  24878. buffer[bufferLength] = data[i];
  24879. }
  24880. if (bufferLength < 16) {
  24881. this.bufferLength = bufferLength;
  24882. return new Uint8Array([]);
  24883. }
  24884. this.iv = buffer;
  24885. data = data.subarray(16);
  24886. }
  24887. this.buffer = new Uint8Array(16);
  24888. this.bufferLength = 0;
  24889. this.decryptBlock = decryptBlock2;
  24890. return this.decryptBlock(data, finalize);
  24891. },
  24892. encrypt: function AES256Cipher_encrypt(data, iv) {
  24893. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [];
  24894. if (!iv) {
  24895. iv = new Uint8Array(16);
  24896. }
  24897. for (i = 0; i < sourceLength; ++i) {
  24898. buffer[bufferLength] = data[i];
  24899. ++bufferLength;
  24900. if (bufferLength < 16) {
  24901. continue;
  24902. }
  24903. for (j = 0; j < 16; ++j) {
  24904. buffer[j] ^= iv[j];
  24905. }
  24906. var cipher = encrypt256(buffer, this.key);
  24907. this.iv = cipher;
  24908. result.push(cipher);
  24909. buffer = new Uint8Array(16);
  24910. bufferLength = 0;
  24911. }
  24912. this.buffer = buffer;
  24913. this.bufferLength = bufferLength;
  24914. this.iv = iv;
  24915. if (result.length === 0) {
  24916. return new Uint8Array([]);
  24917. }
  24918. var outputLength = 16 * result.length;
  24919. var output = new Uint8Array(outputLength);
  24920. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  24921. output.set(result[i], j);
  24922. }
  24923. return output;
  24924. }
  24925. };
  24926. return AES256Cipher;
  24927. }();
  24928. var PDF17 = function PDF17Closure() {
  24929. function compareByteArrays(array1, array2) {
  24930. if (array1.length !== array2.length) {
  24931. return false;
  24932. }
  24933. for (var i = 0; i < array1.length; i++) {
  24934. if (array1[i] !== array2[i]) {
  24935. return false;
  24936. }
  24937. }
  24938. return true;
  24939. }
  24940. function PDF17() {
  24941. }
  24942. PDF17.prototype = {
  24943. checkOwnerPassword: function PDF17_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  24944. var hashData = new Uint8Array(password.length + 56);
  24945. hashData.set(password, 0);
  24946. hashData.set(ownerValidationSalt, password.length);
  24947. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  24948. var result = calculateSHA256(hashData, 0, hashData.length);
  24949. return compareByteArrays(result, ownerPassword);
  24950. },
  24951. checkUserPassword: function PDF17_checkUserPassword(password, userValidationSalt, userPassword) {
  24952. var hashData = new Uint8Array(password.length + 8);
  24953. hashData.set(password, 0);
  24954. hashData.set(userValidationSalt, password.length);
  24955. var result = calculateSHA256(hashData, 0, hashData.length);
  24956. return compareByteArrays(result, userPassword);
  24957. },
  24958. getOwnerKey: function PDF17_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  24959. var hashData = new Uint8Array(password.length + 56);
  24960. hashData.set(password, 0);
  24961. hashData.set(ownerKeySalt, password.length);
  24962. hashData.set(userBytes, password.length + ownerKeySalt.length);
  24963. var key = calculateSHA256(hashData, 0, hashData.length);
  24964. var cipher = new AES256Cipher(key);
  24965. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  24966. },
  24967. getUserKey: function PDF17_getUserKey(password, userKeySalt, userEncryption) {
  24968. var hashData = new Uint8Array(password.length + 8);
  24969. hashData.set(password, 0);
  24970. hashData.set(userKeySalt, password.length);
  24971. var key = calculateSHA256(hashData, 0, hashData.length);
  24972. var cipher = new AES256Cipher(key);
  24973. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  24974. }
  24975. };
  24976. return PDF17;
  24977. }();
  24978. var PDF20 = function PDF20Closure() {
  24979. function concatArrays(array1, array2) {
  24980. var t = new Uint8Array(array1.length + array2.length);
  24981. t.set(array1, 0);
  24982. t.set(array2, array1.length);
  24983. return t;
  24984. }
  24985. function calculatePDF20Hash(password, input, userBytes) {
  24986. var k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  24987. var e = [0];
  24988. var i = 0;
  24989. while (i < 64 || e[e.length - 1] > i - 32) {
  24990. var arrayLength = password.length + k.length + userBytes.length;
  24991. var k1 = new Uint8Array(arrayLength * 64);
  24992. var array = concatArrays(password, k);
  24993. array = concatArrays(array, userBytes);
  24994. for (var j = 0, pos = 0; j < 64; j++, pos += arrayLength) {
  24995. k1.set(array, pos);
  24996. }
  24997. var cipher = new AES128Cipher(k.subarray(0, 16));
  24998. e = cipher.encrypt(k1, k.subarray(16, 32));
  24999. var remainder = 0;
  25000. for (var z = 0; z < 16; z++) {
  25001. remainder *= 256 % 3;
  25002. remainder %= 3;
  25003. remainder += (e[z] >>> 0) % 3;
  25004. remainder %= 3;
  25005. }
  25006. if (remainder === 0) {
  25007. k = calculateSHA256(e, 0, e.length);
  25008. } else if (remainder === 1) {
  25009. k = calculateSHA384(e, 0, e.length);
  25010. } else if (remainder === 2) {
  25011. k = calculateSHA512(e, 0, e.length);
  25012. }
  25013. i++;
  25014. }
  25015. return k.subarray(0, 32);
  25016. }
  25017. function PDF20() {
  25018. }
  25019. function compareByteArrays(array1, array2) {
  25020. if (array1.length !== array2.length) {
  25021. return false;
  25022. }
  25023. for (var i = 0; i < array1.length; i++) {
  25024. if (array1[i] !== array2[i]) {
  25025. return false;
  25026. }
  25027. }
  25028. return true;
  25029. }
  25030. PDF20.prototype = {
  25031. hash: function PDF20_hash(password, concatBytes, userBytes) {
  25032. return calculatePDF20Hash(password, concatBytes, userBytes);
  25033. },
  25034. checkOwnerPassword: function PDF20_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  25035. var hashData = new Uint8Array(password.length + 56);
  25036. hashData.set(password, 0);
  25037. hashData.set(ownerValidationSalt, password.length);
  25038. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  25039. var result = calculatePDF20Hash(password, hashData, userBytes);
  25040. return compareByteArrays(result, ownerPassword);
  25041. },
  25042. checkUserPassword: function PDF20_checkUserPassword(password, userValidationSalt, userPassword) {
  25043. var hashData = new Uint8Array(password.length + 8);
  25044. hashData.set(password, 0);
  25045. hashData.set(userValidationSalt, password.length);
  25046. var result = calculatePDF20Hash(password, hashData, []);
  25047. return compareByteArrays(result, userPassword);
  25048. },
  25049. getOwnerKey: function PDF20_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  25050. var hashData = new Uint8Array(password.length + 56);
  25051. hashData.set(password, 0);
  25052. hashData.set(ownerKeySalt, password.length);
  25053. hashData.set(userBytes, password.length + ownerKeySalt.length);
  25054. var key = calculatePDF20Hash(password, hashData, userBytes);
  25055. var cipher = new AES256Cipher(key);
  25056. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  25057. },
  25058. getUserKey: function PDF20_getUserKey(password, userKeySalt, userEncryption) {
  25059. var hashData = new Uint8Array(password.length + 8);
  25060. hashData.set(password, 0);
  25061. hashData.set(userKeySalt, password.length);
  25062. var key = calculatePDF20Hash(password, hashData, []);
  25063. var cipher = new AES256Cipher(key);
  25064. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  25065. }
  25066. };
  25067. return PDF20;
  25068. }();
  25069. var CipherTransform = function CipherTransformClosure() {
  25070. function CipherTransform(stringCipherConstructor, streamCipherConstructor) {
  25071. this.StringCipherConstructor = stringCipherConstructor;
  25072. this.StreamCipherConstructor = streamCipherConstructor;
  25073. }
  25074. CipherTransform.prototype = {
  25075. createStream: function CipherTransform_createStream(stream, length) {
  25076. var cipher = new this.StreamCipherConstructor();
  25077. return new DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  25078. return cipher.decryptBlock(data, finalize);
  25079. });
  25080. },
  25081. decryptString: function CipherTransform_decryptString(s) {
  25082. var cipher = new this.StringCipherConstructor();
  25083. var data = stringToBytes(s);
  25084. data = cipher.decryptBlock(data, true);
  25085. return bytesToString(data);
  25086. }
  25087. };
  25088. return CipherTransform;
  25089. }();
  25090. var CipherTransformFactory = function CipherTransformFactoryClosure() {
  25091. var defaultPasswordBytes = new Uint8Array([
  25092. 0x28,
  25093. 0xBF,
  25094. 0x4E,
  25095. 0x5E,
  25096. 0x4E,
  25097. 0x75,
  25098. 0x8A,
  25099. 0x41,
  25100. 0x64,
  25101. 0x00,
  25102. 0x4E,
  25103. 0x56,
  25104. 0xFF,
  25105. 0xFA,
  25106. 0x01,
  25107. 0x08,
  25108. 0x2E,
  25109. 0x2E,
  25110. 0x00,
  25111. 0xB6,
  25112. 0xD0,
  25113. 0x68,
  25114. 0x3E,
  25115. 0x80,
  25116. 0x2F,
  25117. 0x0C,
  25118. 0xA9,
  25119. 0xFE,
  25120. 0x64,
  25121. 0x53,
  25122. 0x69,
  25123. 0x7A
  25124. ]);
  25125. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  25126. if (password) {
  25127. var passwordLength = Math.min(127, password.length);
  25128. password = password.subarray(0, passwordLength);
  25129. } else {
  25130. password = [];
  25131. }
  25132. var pdfAlgorithm;
  25133. if (revision === 6) {
  25134. pdfAlgorithm = new PDF20();
  25135. } else {
  25136. pdfAlgorithm = new PDF17();
  25137. }
  25138. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  25139. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  25140. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  25141. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  25142. }
  25143. return null;
  25144. }
  25145. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  25146. var hashDataSize = 40 + ownerPassword.length + fileId.length;
  25147. var hashData = new Uint8Array(hashDataSize), i = 0, j, n;
  25148. if (password) {
  25149. n = Math.min(32, password.length);
  25150. for (; i < n; ++i) {
  25151. hashData[i] = password[i];
  25152. }
  25153. }
  25154. j = 0;
  25155. while (i < 32) {
  25156. hashData[i++] = defaultPasswordBytes[j++];
  25157. }
  25158. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  25159. hashData[i++] = ownerPassword[j];
  25160. }
  25161. hashData[i++] = flags & 0xFF;
  25162. hashData[i++] = flags >> 8 & 0xFF;
  25163. hashData[i++] = flags >> 16 & 0xFF;
  25164. hashData[i++] = flags >>> 24 & 0xFF;
  25165. for (j = 0, n = fileId.length; j < n; ++j) {
  25166. hashData[i++] = fileId[j];
  25167. }
  25168. if (revision >= 4 && !encryptMetadata) {
  25169. hashData[i++] = 0xFF;
  25170. hashData[i++] = 0xFF;
  25171. hashData[i++] = 0xFF;
  25172. hashData[i++] = 0xFF;
  25173. }
  25174. var hash = calculateMD5(hashData, 0, i);
  25175. var keyLengthInBytes = keyLength >> 3;
  25176. if (revision >= 3) {
  25177. for (j = 0; j < 50; ++j) {
  25178. hash = calculateMD5(hash, 0, keyLengthInBytes);
  25179. }
  25180. }
  25181. var encryptionKey = hash.subarray(0, keyLengthInBytes);
  25182. var cipher, checkData;
  25183. if (revision >= 3) {
  25184. for (i = 0; i < 32; ++i) {
  25185. hashData[i] = defaultPasswordBytes[i];
  25186. }
  25187. for (j = 0, n = fileId.length; j < n; ++j) {
  25188. hashData[i++] = fileId[j];
  25189. }
  25190. cipher = new ARCFourCipher(encryptionKey);
  25191. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  25192. n = encryptionKey.length;
  25193. var derivedKey = new Uint8Array(n), k;
  25194. for (j = 1; j <= 19; ++j) {
  25195. for (k = 0; k < n; ++k) {
  25196. derivedKey[k] = encryptionKey[k] ^ j;
  25197. }
  25198. cipher = new ARCFourCipher(derivedKey);
  25199. checkData = cipher.encryptBlock(checkData);
  25200. }
  25201. for (j = 0, n = checkData.length; j < n; ++j) {
  25202. if (userPassword[j] !== checkData[j]) {
  25203. return null;
  25204. }
  25205. }
  25206. } else {
  25207. cipher = new ARCFourCipher(encryptionKey);
  25208. checkData = cipher.encryptBlock(defaultPasswordBytes);
  25209. for (j = 0, n = checkData.length; j < n; ++j) {
  25210. if (userPassword[j] !== checkData[j]) {
  25211. return null;
  25212. }
  25213. }
  25214. }
  25215. return encryptionKey;
  25216. }
  25217. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  25218. var hashData = new Uint8Array(32), i = 0, j, n;
  25219. n = Math.min(32, password.length);
  25220. for (; i < n; ++i) {
  25221. hashData[i] = password[i];
  25222. }
  25223. j = 0;
  25224. while (i < 32) {
  25225. hashData[i++] = defaultPasswordBytes[j++];
  25226. }
  25227. var hash = calculateMD5(hashData, 0, i);
  25228. var keyLengthInBytes = keyLength >> 3;
  25229. if (revision >= 3) {
  25230. for (j = 0; j < 50; ++j) {
  25231. hash = calculateMD5(hash, 0, hash.length);
  25232. }
  25233. }
  25234. var cipher, userPassword;
  25235. if (revision >= 3) {
  25236. userPassword = ownerPassword;
  25237. var derivedKey = new Uint8Array(keyLengthInBytes), k;
  25238. for (j = 19; j >= 0; j--) {
  25239. for (k = 0; k < keyLengthInBytes; ++k) {
  25240. derivedKey[k] = hash[k] ^ j;
  25241. }
  25242. cipher = new ARCFourCipher(derivedKey);
  25243. userPassword = cipher.encryptBlock(userPassword);
  25244. }
  25245. } else {
  25246. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  25247. userPassword = cipher.encryptBlock(ownerPassword);
  25248. }
  25249. return userPassword;
  25250. }
  25251. var identityName = Name.get('Identity');
  25252. function CipherTransformFactory(dict, fileId, password) {
  25253. var filter = dict.get('Filter');
  25254. if (!isName(filter, 'Standard')) {
  25255. error('unknown encryption method');
  25256. }
  25257. this.dict = dict;
  25258. var algorithm = dict.get('V');
  25259. if (!isInt(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  25260. error('unsupported encryption algorithm');
  25261. }
  25262. this.algorithm = algorithm;
  25263. var keyLength = dict.get('Length');
  25264. if (!keyLength) {
  25265. if (algorithm <= 3) {
  25266. keyLength = 40;
  25267. } else {
  25268. var cfDict = dict.get('CF');
  25269. var streamCryptoName = dict.get('StmF');
  25270. if (isDict(cfDict) && isName(streamCryptoName)) {
  25271. cfDict.suppressEncryption = true;
  25272. var handlerDict = cfDict.get(streamCryptoName.name);
  25273. keyLength = handlerDict && handlerDict.get('Length') || 128;
  25274. if (keyLength < 40) {
  25275. keyLength <<= 3;
  25276. }
  25277. }
  25278. }
  25279. }
  25280. if (!isInt(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  25281. error('invalid key length');
  25282. }
  25283. var ownerPassword = stringToBytes(dict.get('O')).subarray(0, 32);
  25284. var userPassword = stringToBytes(dict.get('U')).subarray(0, 32);
  25285. var flags = dict.get('P');
  25286. var revision = dict.get('R');
  25287. var encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get('EncryptMetadata') !== false;
  25288. this.encryptMetadata = encryptMetadata;
  25289. var fileIdBytes = stringToBytes(fileId);
  25290. var passwordBytes;
  25291. if (password) {
  25292. if (revision === 6) {
  25293. try {
  25294. password = utf8StringToString(password);
  25295. } catch (ex) {
  25296. warn('CipherTransformFactory: ' + 'Unable to convert UTF8 encoded password.');
  25297. }
  25298. }
  25299. passwordBytes = stringToBytes(password);
  25300. }
  25301. var encryptionKey;
  25302. if (algorithm !== 5) {
  25303. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  25304. } else {
  25305. var ownerValidationSalt = stringToBytes(dict.get('O')).subarray(32, 40);
  25306. var ownerKeySalt = stringToBytes(dict.get('O')).subarray(40, 48);
  25307. var uBytes = stringToBytes(dict.get('U')).subarray(0, 48);
  25308. var userValidationSalt = stringToBytes(dict.get('U')).subarray(32, 40);
  25309. var userKeySalt = stringToBytes(dict.get('U')).subarray(40, 48);
  25310. var ownerEncryption = stringToBytes(dict.get('OE'));
  25311. var userEncryption = stringToBytes(dict.get('UE'));
  25312. var perms = stringToBytes(dict.get('Perms'));
  25313. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  25314. }
  25315. if (!encryptionKey && !password) {
  25316. throw new PasswordException('No password given', PasswordResponses.NEED_PASSWORD);
  25317. } else if (!encryptionKey && password) {
  25318. var decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  25319. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  25320. }
  25321. if (!encryptionKey) {
  25322. throw new PasswordException('Incorrect Password', PasswordResponses.INCORRECT_PASSWORD);
  25323. }
  25324. this.encryptionKey = encryptionKey;
  25325. if (algorithm >= 4) {
  25326. var cf = dict.get('CF');
  25327. if (isDict(cf)) {
  25328. cf.suppressEncryption = true;
  25329. }
  25330. this.cf = cf;
  25331. this.stmf = dict.get('StmF') || identityName;
  25332. this.strf = dict.get('StrF') || identityName;
  25333. this.eff = dict.get('EFF') || this.stmf;
  25334. }
  25335. }
  25336. function buildObjectKey(num, gen, encryptionKey, isAes) {
  25337. var key = new Uint8Array(encryptionKey.length + 9), i, n;
  25338. for (i = 0, n = encryptionKey.length; i < n; ++i) {
  25339. key[i] = encryptionKey[i];
  25340. }
  25341. key[i++] = num & 0xFF;
  25342. key[i++] = num >> 8 & 0xFF;
  25343. key[i++] = num >> 16 & 0xFF;
  25344. key[i++] = gen & 0xFF;
  25345. key[i++] = gen >> 8 & 0xFF;
  25346. if (isAes) {
  25347. key[i++] = 0x73;
  25348. key[i++] = 0x41;
  25349. key[i++] = 0x6C;
  25350. key[i++] = 0x54;
  25351. }
  25352. var hash = calculateMD5(key, 0, i);
  25353. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  25354. }
  25355. function buildCipherConstructor(cf, name, num, gen, key) {
  25356. assert(isName(name), 'Invalid crypt filter name.');
  25357. var cryptFilter = cf.get(name.name);
  25358. var cfm;
  25359. if (cryptFilter !== null && cryptFilter !== undefined) {
  25360. cfm = cryptFilter.get('CFM');
  25361. }
  25362. if (!cfm || cfm.name === 'None') {
  25363. return function cipherTransformFactoryBuildCipherConstructorNone() {
  25364. return new NullCipher();
  25365. };
  25366. }
  25367. if (cfm.name === 'V2') {
  25368. return function cipherTransformFactoryBuildCipherConstructorV2() {
  25369. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  25370. };
  25371. }
  25372. if (cfm.name === 'AESV2') {
  25373. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  25374. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  25375. };
  25376. }
  25377. if (cfm.name === 'AESV3') {
  25378. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  25379. return new AES256Cipher(key);
  25380. };
  25381. }
  25382. error('Unknown crypto method');
  25383. }
  25384. CipherTransformFactory.prototype = {
  25385. createCipherTransform: function CipherTransformFactory_createCipherTransform(num, gen) {
  25386. if (this.algorithm === 4 || this.algorithm === 5) {
  25387. return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey));
  25388. }
  25389. var key = buildObjectKey(num, gen, this.encryptionKey, false);
  25390. var cipherConstructor = function buildCipherCipherConstructor() {
  25391. return new ARCFourCipher(key);
  25392. };
  25393. return new CipherTransform(cipherConstructor, cipherConstructor);
  25394. }
  25395. };
  25396. return CipherTransformFactory;
  25397. }();
  25398. exports.AES128Cipher = AES128Cipher;
  25399. exports.AES256Cipher = AES256Cipher;
  25400. exports.ARCFourCipher = ARCFourCipher;
  25401. exports.CipherTransformFactory = CipherTransformFactory;
  25402. exports.PDF17 = PDF17;
  25403. exports.PDF20 = PDF20;
  25404. exports.calculateMD5 = calculateMD5;
  25405. exports.calculateSHA256 = calculateSHA256;
  25406. exports.calculateSHA384 = calculateSHA384;
  25407. exports.calculateSHA512 = calculateSHA512;
  25408. /***/ }),
  25409. /* 14 */
  25410. /***/ (function(module, exports, __w_pdfjs_require__) {
  25411. "use strict";
  25412. var sharedUtil = __w_pdfjs_require__(0);
  25413. var corePrimitives = __w_pdfjs_require__(1);
  25414. var coreStream = __w_pdfjs_require__(2);
  25415. var coreParser = __w_pdfjs_require__(5);
  25416. var coreImage = __w_pdfjs_require__(27);
  25417. var coreColorSpace = __w_pdfjs_require__(3);
  25418. var coreMurmurHash3 = __w_pdfjs_require__(31);
  25419. var coreFonts = __w_pdfjs_require__(26);
  25420. var coreFunction = __w_pdfjs_require__(6);
  25421. var corePattern = __w_pdfjs_require__(32);
  25422. var coreCMap = __w_pdfjs_require__(23);
  25423. var coreMetrics = __w_pdfjs_require__(30);
  25424. var coreBidi = __w_pdfjs_require__(21);
  25425. var coreEncodings = __w_pdfjs_require__(4);
  25426. var coreStandardFonts = __w_pdfjs_require__(17);
  25427. var coreUnicode = __w_pdfjs_require__(18);
  25428. var coreGlyphList = __w_pdfjs_require__(7);
  25429. var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
  25430. var IDENTITY_MATRIX = sharedUtil.IDENTITY_MATRIX;
  25431. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  25432. var ImageKind = sharedUtil.ImageKind;
  25433. var OPS = sharedUtil.OPS;
  25434. var TextRenderingMode = sharedUtil.TextRenderingMode;
  25435. var CMapCompressionType = sharedUtil.CMapCompressionType;
  25436. var Util = sharedUtil.Util;
  25437. var assert = sharedUtil.assert;
  25438. var createPromiseCapability = sharedUtil.createPromiseCapability;
  25439. var error = sharedUtil.error;
  25440. var info = sharedUtil.info;
  25441. var isArray = sharedUtil.isArray;
  25442. var isNum = sharedUtil.isNum;
  25443. var isString = sharedUtil.isString;
  25444. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  25445. var warn = sharedUtil.warn;
  25446. var Dict = corePrimitives.Dict;
  25447. var Name = corePrimitives.Name;
  25448. var isEOF = corePrimitives.isEOF;
  25449. var isCmd = corePrimitives.isCmd;
  25450. var isDict = corePrimitives.isDict;
  25451. var isName = corePrimitives.isName;
  25452. var isRef = corePrimitives.isRef;
  25453. var isStream = corePrimitives.isStream;
  25454. var DecodeStream = coreStream.DecodeStream;
  25455. var JpegStream = coreStream.JpegStream;
  25456. var Stream = coreStream.Stream;
  25457. var Lexer = coreParser.Lexer;
  25458. var Parser = coreParser.Parser;
  25459. var PDFImage = coreImage.PDFImage;
  25460. var ColorSpace = coreColorSpace.ColorSpace;
  25461. var MurmurHash3_64 = coreMurmurHash3.MurmurHash3_64;
  25462. var ErrorFont = coreFonts.ErrorFont;
  25463. var FontFlags = coreFonts.FontFlags;
  25464. var Font = coreFonts.Font;
  25465. var IdentityToUnicodeMap = coreFonts.IdentityToUnicodeMap;
  25466. var ToUnicodeMap = coreFonts.ToUnicodeMap;
  25467. var getFontType = coreFonts.getFontType;
  25468. var isPDFFunction = coreFunction.isPDFFunction;
  25469. var PDFFunction = coreFunction.PDFFunction;
  25470. var Pattern = corePattern.Pattern;
  25471. var getTilingPatternIR = corePattern.getTilingPatternIR;
  25472. var CMapFactory = coreCMap.CMapFactory;
  25473. var IdentityCMap = coreCMap.IdentityCMap;
  25474. var getMetrics = coreMetrics.getMetrics;
  25475. var bidi = coreBidi.bidi;
  25476. var WinAnsiEncoding = coreEncodings.WinAnsiEncoding;
  25477. var StandardEncoding = coreEncodings.StandardEncoding;
  25478. var MacRomanEncoding = coreEncodings.MacRomanEncoding;
  25479. var SymbolSetEncoding = coreEncodings.SymbolSetEncoding;
  25480. var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding;
  25481. var getEncoding = coreEncodings.getEncoding;
  25482. var getStdFontMap = coreStandardFonts.getStdFontMap;
  25483. var getSerifFonts = coreStandardFonts.getSerifFonts;
  25484. var getSymbolsFonts = coreStandardFonts.getSymbolsFonts;
  25485. var getNormalizedUnicodes = coreUnicode.getNormalizedUnicodes;
  25486. var reverseIfRtl = coreUnicode.reverseIfRtl;
  25487. var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph;
  25488. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  25489. var PartialEvaluator = function PartialEvaluatorClosure() {
  25490. var DefaultPartialEvaluatorOptions = {
  25491. forceDataSchema: false,
  25492. maxImageSize: -1,
  25493. disableFontFace: false,
  25494. disableNativeImageDecoder: false
  25495. };
  25496. function NativeImageDecoder(xref, resources, handler, forceDataSchema) {
  25497. this.xref = xref;
  25498. this.resources = resources;
  25499. this.handler = handler;
  25500. this.forceDataSchema = forceDataSchema;
  25501. }
  25502. NativeImageDecoder.prototype = {
  25503. canDecode: function (image) {
  25504. return image instanceof JpegStream && NativeImageDecoder.isDecodable(image, this.xref, this.resources);
  25505. },
  25506. decode: function (image) {
  25507. var dict = image.dict;
  25508. var colorSpace = dict.get('ColorSpace', 'CS');
  25509. colorSpace = ColorSpace.parse(colorSpace, this.xref, this.resources);
  25510. var numComps = colorSpace.numComps;
  25511. var decodePromise = this.handler.sendWithPromise('JpegDecode', [
  25512. image.getIR(this.forceDataSchema),
  25513. numComps
  25514. ]);
  25515. return decodePromise.then(function (message) {
  25516. var data = message.data;
  25517. return new Stream(data, 0, data.length, image.dict);
  25518. });
  25519. }
  25520. };
  25521. NativeImageDecoder.isSupported = function NativeImageDecoder_isSupported(image, xref, res) {
  25522. var dict = image.dict;
  25523. if (dict.has('DecodeParms') || dict.has('DP')) {
  25524. return false;
  25525. }
  25526. var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res);
  25527. return (cs.name === 'DeviceGray' || cs.name === 'DeviceRGB') && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
  25528. };
  25529. NativeImageDecoder.isDecodable = function NativeImageDecoder_isDecodable(image, xref, res) {
  25530. var dict = image.dict;
  25531. if (dict.has('DecodeParms') || dict.has('DP')) {
  25532. return false;
  25533. }
  25534. var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res);
  25535. return (cs.numComps === 1 || cs.numComps === 3) && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
  25536. };
  25537. function PartialEvaluator(pdfManager, xref, handler, pageIndex, idFactory, fontCache, builtInCMapCache, options) {
  25538. this.pdfManager = pdfManager;
  25539. this.xref = xref;
  25540. this.handler = handler;
  25541. this.pageIndex = pageIndex;
  25542. this.idFactory = idFactory;
  25543. this.fontCache = fontCache;
  25544. this.builtInCMapCache = builtInCMapCache;
  25545. this.options = options || DefaultPartialEvaluatorOptions;
  25546. this.fetchBuiltInCMap = function (name) {
  25547. var cachedCMap = builtInCMapCache[name];
  25548. if (cachedCMap) {
  25549. return Promise.resolve(cachedCMap);
  25550. }
  25551. return handler.sendWithPromise('FetchBuiltInCMap', { name: name }).then(function (data) {
  25552. if (data.compressionType !== CMapCompressionType.NONE) {
  25553. builtInCMapCache[name] = data;
  25554. }
  25555. return data;
  25556. });
  25557. };
  25558. }
  25559. var TIME_SLOT_DURATION_MS = 20;
  25560. var CHECK_TIME_EVERY = 100;
  25561. function TimeSlotManager() {
  25562. this.reset();
  25563. }
  25564. TimeSlotManager.prototype = {
  25565. check: function TimeSlotManager_check() {
  25566. if (++this.checked < CHECK_TIME_EVERY) {
  25567. return false;
  25568. }
  25569. this.checked = 0;
  25570. return this.endTime <= Date.now();
  25571. },
  25572. reset: function TimeSlotManager_reset() {
  25573. this.endTime = Date.now() + TIME_SLOT_DURATION_MS;
  25574. this.checked = 0;
  25575. }
  25576. };
  25577. var deferred = Promise.resolve();
  25578. var TILING_PATTERN = 1, SHADING_PATTERN = 2;
  25579. PartialEvaluator.prototype = {
  25580. hasBlendModes: function PartialEvaluator_hasBlendModes(resources) {
  25581. if (!isDict(resources)) {
  25582. return false;
  25583. }
  25584. var processed = Object.create(null);
  25585. if (resources.objId) {
  25586. processed[resources.objId] = true;
  25587. }
  25588. var nodes = [resources], xref = this.xref;
  25589. while (nodes.length) {
  25590. var key, i, ii;
  25591. var node = nodes.shift();
  25592. var graphicStates = node.get('ExtGState');
  25593. if (isDict(graphicStates)) {
  25594. var graphicStatesKeys = graphicStates.getKeys();
  25595. for (i = 0, ii = graphicStatesKeys.length; i < ii; i++) {
  25596. key = graphicStatesKeys[i];
  25597. var graphicState = graphicStates.get(key);
  25598. var bm = graphicState.get('BM');
  25599. if (isName(bm) && bm.name !== 'Normal') {
  25600. return true;
  25601. }
  25602. }
  25603. }
  25604. var xObjects = node.get('XObject');
  25605. if (!isDict(xObjects)) {
  25606. continue;
  25607. }
  25608. var xObjectsKeys = xObjects.getKeys();
  25609. for (i = 0, ii = xObjectsKeys.length; i < ii; i++) {
  25610. key = xObjectsKeys[i];
  25611. var xObject = xObjects.getRaw(key);
  25612. if (isRef(xObject)) {
  25613. if (processed[xObject.toString()]) {
  25614. continue;
  25615. }
  25616. xObject = xref.fetch(xObject);
  25617. }
  25618. if (!isStream(xObject)) {
  25619. continue;
  25620. }
  25621. if (xObject.dict.objId) {
  25622. if (processed[xObject.dict.objId]) {
  25623. continue;
  25624. }
  25625. processed[xObject.dict.objId] = true;
  25626. }
  25627. var xResources = xObject.dict.get('Resources');
  25628. if (isDict(xResources) && (!xResources.objId || !processed[xResources.objId])) {
  25629. nodes.push(xResources);
  25630. if (xResources.objId) {
  25631. processed[xResources.objId] = true;
  25632. }
  25633. }
  25634. }
  25635. }
  25636. return false;
  25637. },
  25638. buildFormXObject: function PartialEvaluator_buildFormXObject(resources, xobj, smask, operatorList, task, initialState) {
  25639. var matrix = xobj.dict.getArray('Matrix');
  25640. var bbox = xobj.dict.getArray('BBox');
  25641. var group = xobj.dict.get('Group');
  25642. if (group) {
  25643. var groupOptions = {
  25644. matrix: matrix,
  25645. bbox: bbox,
  25646. smask: smask,
  25647. isolated: false,
  25648. knockout: false
  25649. };
  25650. var groupSubtype = group.get('S');
  25651. var colorSpace;
  25652. if (isName(groupSubtype, 'Transparency')) {
  25653. groupOptions.isolated = group.get('I') || false;
  25654. groupOptions.knockout = group.get('K') || false;
  25655. colorSpace = group.has('CS') ? ColorSpace.parse(group.get('CS'), this.xref, resources) : null;
  25656. }
  25657. if (smask && smask.backdrop) {
  25658. colorSpace = colorSpace || ColorSpace.singletons.rgb;
  25659. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  25660. }
  25661. operatorList.addOp(OPS.beginGroup, [groupOptions]);
  25662. }
  25663. operatorList.addOp(OPS.paintFormXObjectBegin, [
  25664. matrix,
  25665. bbox
  25666. ]);
  25667. return this.getOperatorList(xobj, task, xobj.dict.get('Resources') || resources, operatorList, initialState).then(function () {
  25668. operatorList.addOp(OPS.paintFormXObjectEnd, []);
  25669. if (group) {
  25670. operatorList.addOp(OPS.endGroup, [groupOptions]);
  25671. }
  25672. });
  25673. },
  25674. buildPaintImageXObject: function PartialEvaluator_buildPaintImageXObject(resources, image, inline, operatorList, cacheKey, imageCache) {
  25675. var self = this;
  25676. var dict = image.dict;
  25677. var w = dict.get('Width', 'W');
  25678. var h = dict.get('Height', 'H');
  25679. if (!(w && isNum(w)) || !(h && isNum(h))) {
  25680. warn('Image dimensions are missing, or not numbers.');
  25681. return;
  25682. }
  25683. var maxImageSize = this.options.maxImageSize;
  25684. if (maxImageSize !== -1 && w * h > maxImageSize) {
  25685. warn('Image exceeded maximum allowed size and was removed.');
  25686. return;
  25687. }
  25688. var imageMask = dict.get('ImageMask', 'IM') || false;
  25689. var imgData, args;
  25690. if (imageMask) {
  25691. var width = dict.get('Width', 'W');
  25692. var height = dict.get('Height', 'H');
  25693. var bitStrideLength = width + 7 >> 3;
  25694. var imgArray = image.getBytes(bitStrideLength * height);
  25695. var decode = dict.getArray('Decode', 'D');
  25696. var inverseDecode = !!decode && decode[0] > 0;
  25697. imgData = PDFImage.createMask(imgArray, width, height, image instanceof DecodeStream, inverseDecode);
  25698. imgData.cached = true;
  25699. args = [imgData];
  25700. operatorList.addOp(OPS.paintImageMaskXObject, args);
  25701. if (cacheKey) {
  25702. imageCache[cacheKey] = {
  25703. fn: OPS.paintImageMaskXObject,
  25704. args: args
  25705. };
  25706. }
  25707. return;
  25708. }
  25709. var softMask = dict.get('SMask', 'SM') || false;
  25710. var mask = dict.get('Mask') || false;
  25711. var SMALL_IMAGE_DIMENSIONS = 200;
  25712. if (inline && !softMask && !mask && !(image instanceof JpegStream) && w + h < SMALL_IMAGE_DIMENSIONS) {
  25713. var imageObj = new PDFImage(this.xref, resources, image, inline, null, null);
  25714. imgData = imageObj.createImageData(true);
  25715. operatorList.addOp(OPS.paintInlineImageXObject, [imgData]);
  25716. return;
  25717. }
  25718. var useNativeImageDecoder = !this.options.disableNativeImageDecoder;
  25719. var objId = 'img_' + this.idFactory.createObjId();
  25720. operatorList.addDependency(objId);
  25721. args = [
  25722. objId,
  25723. w,
  25724. h
  25725. ];
  25726. if (useNativeImageDecoder && !softMask && !mask && image instanceof JpegStream && NativeImageDecoder.isSupported(image, this.xref, resources)) {
  25727. operatorList.addOp(OPS.paintJpegXObject, args);
  25728. this.handler.send('obj', [
  25729. objId,
  25730. this.pageIndex,
  25731. 'JpegStream',
  25732. image.getIR(this.options.forceDataSchema)
  25733. ]);
  25734. return;
  25735. }
  25736. var nativeImageDecoder = null;
  25737. if (useNativeImageDecoder && (image instanceof JpegStream || mask instanceof JpegStream || softMask instanceof JpegStream)) {
  25738. nativeImageDecoder = new NativeImageDecoder(self.xref, resources, self.handler, self.options.forceDataSchema);
  25739. }
  25740. PDFImage.buildImage(self.handler, self.xref, resources, image, inline, nativeImageDecoder).then(function (imageObj) {
  25741. var imgData = imageObj.createImageData(false);
  25742. self.handler.send('obj', [
  25743. objId,
  25744. self.pageIndex,
  25745. 'Image',
  25746. imgData
  25747. ], [imgData.data.buffer]);
  25748. }).then(undefined, function (reason) {
  25749. warn('Unable to decode image: ' + reason);
  25750. self.handler.send('obj', [
  25751. objId,
  25752. self.pageIndex,
  25753. 'Image',
  25754. null
  25755. ]);
  25756. });
  25757. operatorList.addOp(OPS.paintImageXObject, args);
  25758. if (cacheKey) {
  25759. imageCache[cacheKey] = {
  25760. fn: OPS.paintImageXObject,
  25761. args: args
  25762. };
  25763. }
  25764. },
  25765. handleSMask: function PartialEvaluator_handleSmask(smask, resources, operatorList, task, stateManager) {
  25766. var smaskContent = smask.get('G');
  25767. var smaskOptions = {
  25768. subtype: smask.get('S').name,
  25769. backdrop: smask.get('BC')
  25770. };
  25771. var transferObj = smask.get('TR');
  25772. if (isPDFFunction(transferObj)) {
  25773. var transferFn = PDFFunction.parse(this.xref, transferObj);
  25774. var transferMap = new Uint8Array(256);
  25775. var tmp = new Float32Array(1);
  25776. for (var i = 0; i < 256; i++) {
  25777. tmp[0] = i / 255;
  25778. transferFn(tmp, 0, tmp, 0);
  25779. transferMap[i] = tmp[0] * 255 | 0;
  25780. }
  25781. smaskOptions.transferMap = transferMap;
  25782. }
  25783. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone());
  25784. },
  25785. handleTilingType: function PartialEvaluator_handleTilingType(fn, args, resources, pattern, patternDict, operatorList, task) {
  25786. var tilingOpList = new OperatorList();
  25787. var resourcesArray = [
  25788. patternDict.get('Resources'),
  25789. resources
  25790. ];
  25791. var patternResources = Dict.merge(this.xref, resourcesArray);
  25792. return this.getOperatorList(pattern, task, patternResources, tilingOpList).then(function () {
  25793. operatorList.addDependencies(tilingOpList.dependencies);
  25794. operatorList.addOp(fn, getTilingPatternIR({
  25795. fnArray: tilingOpList.fnArray,
  25796. argsArray: tilingOpList.argsArray
  25797. }, patternDict, args));
  25798. });
  25799. },
  25800. handleSetFont: function PartialEvaluator_handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) {
  25801. var fontName;
  25802. if (fontArgs) {
  25803. fontArgs = fontArgs.slice();
  25804. fontName = fontArgs[0].name;
  25805. }
  25806. var self = this;
  25807. return this.loadFont(fontName, fontRef, this.xref, resources).then(function (translated) {
  25808. if (!translated.font.isType3Font) {
  25809. return translated;
  25810. }
  25811. return translated.loadType3Data(self, resources, operatorList, task).then(function () {
  25812. return translated;
  25813. }, function (reason) {
  25814. self.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font });
  25815. return new TranslatedFont('g_font_error', new ErrorFont('Type3 font load error: ' + reason), translated.font);
  25816. });
  25817. }).then(function (translated) {
  25818. state.font = translated.font;
  25819. translated.send(self.handler);
  25820. return translated.loadedName;
  25821. });
  25822. },
  25823. handleText: function PartialEvaluator_handleText(chars, state) {
  25824. var font = state.font;
  25825. var glyphs = font.charsToGlyphs(chars);
  25826. var isAddToPathSet = !!(state.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
  25827. if (font.data && (isAddToPathSet || this.options.disableFontFace)) {
  25828. var buildPath = function (fontChar) {
  25829. if (!font.renderer.hasBuiltPath(fontChar)) {
  25830. var path = font.renderer.getPathJs(fontChar);
  25831. this.handler.send('commonobj', [
  25832. font.loadedName + '_path_' + fontChar,
  25833. 'FontPath',
  25834. path
  25835. ]);
  25836. }
  25837. }.bind(this);
  25838. for (var i = 0, ii = glyphs.length; i < ii; i++) {
  25839. var glyph = glyphs[i];
  25840. buildPath(glyph.fontChar);
  25841. var accent = glyph.accent;
  25842. if (accent && accent.fontChar) {
  25843. buildPath(accent.fontChar);
  25844. }
  25845. }
  25846. }
  25847. return glyphs;
  25848. },
  25849. setGState: function PartialEvaluator_setGState(resources, gState, operatorList, task, xref, stateManager) {
  25850. var gStateObj = [];
  25851. var gStateKeys = gState.getKeys();
  25852. var self = this;
  25853. var promise = Promise.resolve();
  25854. for (var i = 0, ii = gStateKeys.length; i < ii; i++) {
  25855. var key = gStateKeys[i];
  25856. var value = gState.get(key);
  25857. switch (key) {
  25858. case 'Type':
  25859. break;
  25860. case 'LW':
  25861. case 'LC':
  25862. case 'LJ':
  25863. case 'ML':
  25864. case 'D':
  25865. case 'RI':
  25866. case 'FL':
  25867. case 'CA':
  25868. case 'ca':
  25869. gStateObj.push([
  25870. key,
  25871. value
  25872. ]);
  25873. break;
  25874. case 'Font':
  25875. promise = promise.then(function () {
  25876. return self.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  25877. operatorList.addDependency(loadedName);
  25878. gStateObj.push([
  25879. key,
  25880. [
  25881. loadedName,
  25882. value[1]
  25883. ]
  25884. ]);
  25885. });
  25886. });
  25887. break;
  25888. case 'BM':
  25889. gStateObj.push([
  25890. key,
  25891. value
  25892. ]);
  25893. break;
  25894. case 'SMask':
  25895. if (isName(value, 'None')) {
  25896. gStateObj.push([
  25897. key,
  25898. false
  25899. ]);
  25900. break;
  25901. }
  25902. if (isDict(value)) {
  25903. promise = promise.then(function (dict) {
  25904. return self.handleSMask(dict, resources, operatorList, task, stateManager);
  25905. }.bind(this, value));
  25906. gStateObj.push([
  25907. key,
  25908. true
  25909. ]);
  25910. } else {
  25911. warn('Unsupported SMask type');
  25912. }
  25913. break;
  25914. case 'OP':
  25915. case 'op':
  25916. case 'OPM':
  25917. case 'BG':
  25918. case 'BG2':
  25919. case 'UCR':
  25920. case 'UCR2':
  25921. case 'TR':
  25922. case 'TR2':
  25923. case 'HT':
  25924. case 'SM':
  25925. case 'SA':
  25926. case 'AIS':
  25927. case 'TK':
  25928. info('graphic state operator ' + key);
  25929. break;
  25930. default:
  25931. info('Unknown graphic state operator ' + key);
  25932. break;
  25933. }
  25934. }
  25935. return promise.then(function () {
  25936. if (gStateObj.length > 0) {
  25937. operatorList.addOp(OPS.setGState, [gStateObj]);
  25938. }
  25939. });
  25940. },
  25941. loadFont: function PartialEvaluator_loadFont(fontName, font, xref, resources) {
  25942. function errorFont() {
  25943. return Promise.resolve(new TranslatedFont('g_font_error', new ErrorFont('Font ' + fontName + ' is not available'), font));
  25944. }
  25945. var fontRef;
  25946. if (font) {
  25947. assert(isRef(font));
  25948. fontRef = font;
  25949. } else {
  25950. var fontRes = resources.get('Font');
  25951. if (fontRes) {
  25952. fontRef = fontRes.getRaw(fontName);
  25953. } else {
  25954. warn('fontRes not available');
  25955. return errorFont();
  25956. }
  25957. }
  25958. if (!fontRef) {
  25959. warn('fontRef not available');
  25960. return errorFont();
  25961. }
  25962. if (this.fontCache.has(fontRef)) {
  25963. return this.fontCache.get(fontRef);
  25964. }
  25965. font = xref.fetchIfRef(fontRef);
  25966. if (!isDict(font)) {
  25967. return errorFont();
  25968. }
  25969. if (font.translated) {
  25970. return font.translated;
  25971. }
  25972. var fontCapability = createPromiseCapability();
  25973. var preEvaluatedFont = this.preEvaluateFont(font, xref);
  25974. var descriptor = preEvaluatedFont.descriptor;
  25975. var fontRefIsRef = isRef(fontRef), fontID;
  25976. if (fontRefIsRef) {
  25977. fontID = fontRef.toString();
  25978. }
  25979. if (isDict(descriptor)) {
  25980. if (!descriptor.fontAliases) {
  25981. descriptor.fontAliases = Object.create(null);
  25982. }
  25983. var fontAliases = descriptor.fontAliases;
  25984. var hash = preEvaluatedFont.hash;
  25985. if (fontAliases[hash]) {
  25986. var aliasFontRef = fontAliases[hash].aliasRef;
  25987. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  25988. this.fontCache.putAlias(fontRef, aliasFontRef);
  25989. return this.fontCache.get(fontRef);
  25990. }
  25991. } else {
  25992. fontAliases[hash] = { fontID: Font.getFontID() };
  25993. }
  25994. if (fontRefIsRef) {
  25995. fontAliases[hash].aliasRef = fontRef;
  25996. }
  25997. fontID = fontAliases[hash].fontID;
  25998. }
  25999. if (fontRefIsRef) {
  26000. this.fontCache.put(fontRef, fontCapability.promise);
  26001. } else {
  26002. if (!fontID) {
  26003. fontID = this.idFactory.createObjId();
  26004. }
  26005. this.fontCache.put('id_' + fontID, fontCapability.promise);
  26006. }
  26007. assert(fontID, 'The "fontID" must be defined.');
  26008. font.loadedName = 'g_' + this.pdfManager.docId + '_f' + fontID;
  26009. font.translated = fontCapability.promise;
  26010. var translatedPromise;
  26011. try {
  26012. translatedPromise = this.translateFont(preEvaluatedFont, xref);
  26013. } catch (e) {
  26014. translatedPromise = Promise.reject(e);
  26015. }
  26016. var self = this;
  26017. translatedPromise.then(function (translatedFont) {
  26018. if (translatedFont.fontType !== undefined) {
  26019. var xrefFontStats = xref.stats.fontTypes;
  26020. xrefFontStats[translatedFont.fontType] = true;
  26021. }
  26022. fontCapability.resolve(new TranslatedFont(font.loadedName, translatedFont, font));
  26023. }, function (reason) {
  26024. self.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font });
  26025. try {
  26026. var descriptor = preEvaluatedFont.descriptor;
  26027. var fontFile3 = descriptor && descriptor.get('FontFile3');
  26028. var subtype = fontFile3 && fontFile3.get('Subtype');
  26029. var fontType = getFontType(preEvaluatedFont.type, subtype && subtype.name);
  26030. var xrefFontStats = xref.stats.fontTypes;
  26031. xrefFontStats[fontType] = true;
  26032. } catch (ex) {
  26033. }
  26034. fontCapability.resolve(new TranslatedFont(font.loadedName, new ErrorFont(reason instanceof Error ? reason.message : reason), font));
  26035. });
  26036. return fontCapability.promise;
  26037. },
  26038. buildPath: function PartialEvaluator_buildPath(operatorList, fn, args) {
  26039. var lastIndex = operatorList.length - 1;
  26040. if (!args) {
  26041. args = [];
  26042. }
  26043. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== OPS.constructPath) {
  26044. operatorList.addOp(OPS.constructPath, [
  26045. [fn],
  26046. args
  26047. ]);
  26048. } else {
  26049. var opArgs = operatorList.argsArray[lastIndex];
  26050. opArgs[0].push(fn);
  26051. Array.prototype.push.apply(opArgs[1], args);
  26052. }
  26053. },
  26054. handleColorN: function PartialEvaluator_handleColorN(operatorList, fn, args, cs, patterns, resources, task, xref) {
  26055. var patternName = args[args.length - 1];
  26056. var pattern;
  26057. if (isName(patternName) && (pattern = patterns.get(patternName.name))) {
  26058. var dict = isStream(pattern) ? pattern.dict : pattern;
  26059. var typeNum = dict.get('PatternType');
  26060. if (typeNum === TILING_PATTERN) {
  26061. var color = cs.base ? cs.base.getRgb(args, 0) : null;
  26062. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task);
  26063. } else if (typeNum === SHADING_PATTERN) {
  26064. var shading = dict.get('Shading');
  26065. var matrix = dict.getArray('Matrix');
  26066. pattern = Pattern.parseShading(shading, matrix, xref, resources, this.handler);
  26067. operatorList.addOp(fn, pattern.getIR());
  26068. return Promise.resolve();
  26069. }
  26070. return Promise.reject('Unknown PatternType: ' + typeNum);
  26071. }
  26072. operatorList.addOp(fn, args);
  26073. return Promise.resolve();
  26074. },
  26075. getOperatorList: function PartialEvaluator_getOperatorList(stream, task, resources, operatorList, initialState) {
  26076. var self = this;
  26077. var xref = this.xref;
  26078. var imageCache = Object.create(null);
  26079. assert(operatorList);
  26080. resources = resources || Dict.empty;
  26081. var xobjs = resources.get('XObject') || Dict.empty;
  26082. var patterns = resources.get('Pattern') || Dict.empty;
  26083. var stateManager = new StateManager(initialState || new EvalState());
  26084. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  26085. var timeSlotManager = new TimeSlotManager();
  26086. return new Promise(function promiseBody(resolve, reject) {
  26087. var next = function (promise) {
  26088. promise.then(function () {
  26089. try {
  26090. promiseBody(resolve, reject);
  26091. } catch (ex) {
  26092. reject(ex);
  26093. }
  26094. }, reject);
  26095. };
  26096. task.ensureNotTerminated();
  26097. timeSlotManager.reset();
  26098. var stop, operation = {}, i, ii, cs;
  26099. while (!(stop = timeSlotManager.check())) {
  26100. operation.args = null;
  26101. if (!preprocessor.read(operation)) {
  26102. break;
  26103. }
  26104. var args = operation.args;
  26105. var fn = operation.fn;
  26106. switch (fn | 0) {
  26107. case OPS.paintXObject:
  26108. if (args[0].code) {
  26109. break;
  26110. }
  26111. var name = args[0].name;
  26112. if (!name) {
  26113. warn('XObject must be referred to by name.');
  26114. continue;
  26115. }
  26116. if (imageCache[name] !== undefined) {
  26117. operatorList.addOp(imageCache[name].fn, imageCache[name].args);
  26118. args = null;
  26119. continue;
  26120. }
  26121. var xobj = xobjs.get(name);
  26122. if (xobj) {
  26123. assert(isStream(xobj), 'XObject should be a stream');
  26124. var type = xobj.dict.get('Subtype');
  26125. assert(isName(type), 'XObject should have a Name subtype');
  26126. if (type.name === 'Form') {
  26127. stateManager.save();
  26128. next(self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () {
  26129. stateManager.restore();
  26130. }));
  26131. return;
  26132. } else if (type.name === 'Image') {
  26133. self.buildPaintImageXObject(resources, xobj, false, operatorList, name, imageCache);
  26134. args = null;
  26135. continue;
  26136. } else if (type.name === 'PS') {
  26137. info('Ignored XObject subtype PS');
  26138. continue;
  26139. } else {
  26140. error('Unhandled XObject subtype ' + type.name);
  26141. }
  26142. }
  26143. break;
  26144. case OPS.setFont:
  26145. var fontSize = args[1];
  26146. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state).then(function (loadedName) {
  26147. operatorList.addDependency(loadedName);
  26148. operatorList.addOp(OPS.setFont, [
  26149. loadedName,
  26150. fontSize
  26151. ]);
  26152. }));
  26153. return;
  26154. case OPS.endInlineImage:
  26155. var cacheKey = args[0].cacheKey;
  26156. if (cacheKey) {
  26157. var cacheEntry = imageCache[cacheKey];
  26158. if (cacheEntry !== undefined) {
  26159. operatorList.addOp(cacheEntry.fn, cacheEntry.args);
  26160. args = null;
  26161. continue;
  26162. }
  26163. }
  26164. self.buildPaintImageXObject(resources, args[0], true, operatorList, cacheKey, imageCache);
  26165. args = null;
  26166. continue;
  26167. case OPS.showText:
  26168. args[0] = self.handleText(args[0], stateManager.state);
  26169. break;
  26170. case OPS.showSpacedText:
  26171. var arr = args[0];
  26172. var combinedGlyphs = [];
  26173. var arrLength = arr.length;
  26174. var state = stateManager.state;
  26175. for (i = 0; i < arrLength; ++i) {
  26176. var arrItem = arr[i];
  26177. if (isString(arrItem)) {
  26178. Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
  26179. } else if (isNum(arrItem)) {
  26180. combinedGlyphs.push(arrItem);
  26181. }
  26182. }
  26183. args[0] = combinedGlyphs;
  26184. fn = OPS.showText;
  26185. break;
  26186. case OPS.nextLineShowText:
  26187. operatorList.addOp(OPS.nextLine);
  26188. args[0] = self.handleText(args[0], stateManager.state);
  26189. fn = OPS.showText;
  26190. break;
  26191. case OPS.nextLineSetSpacingShowText:
  26192. operatorList.addOp(OPS.nextLine);
  26193. operatorList.addOp(OPS.setWordSpacing, [args.shift()]);
  26194. operatorList.addOp(OPS.setCharSpacing, [args.shift()]);
  26195. args[0] = self.handleText(args[0], stateManager.state);
  26196. fn = OPS.showText;
  26197. break;
  26198. case OPS.setTextRenderingMode:
  26199. stateManager.state.textRenderingMode = args[0];
  26200. break;
  26201. case OPS.setFillColorSpace:
  26202. stateManager.state.fillColorSpace = ColorSpace.parse(args[0], xref, resources);
  26203. continue;
  26204. case OPS.setStrokeColorSpace:
  26205. stateManager.state.strokeColorSpace = ColorSpace.parse(args[0], xref, resources);
  26206. continue;
  26207. case OPS.setFillColor:
  26208. cs = stateManager.state.fillColorSpace;
  26209. args = cs.getRgb(args, 0);
  26210. fn = OPS.setFillRGBColor;
  26211. break;
  26212. case OPS.setStrokeColor:
  26213. cs = stateManager.state.strokeColorSpace;
  26214. args = cs.getRgb(args, 0);
  26215. fn = OPS.setStrokeRGBColor;
  26216. break;
  26217. case OPS.setFillGray:
  26218. stateManager.state.fillColorSpace = ColorSpace.singletons.gray;
  26219. args = ColorSpace.singletons.gray.getRgb(args, 0);
  26220. fn = OPS.setFillRGBColor;
  26221. break;
  26222. case OPS.setStrokeGray:
  26223. stateManager.state.strokeColorSpace = ColorSpace.singletons.gray;
  26224. args = ColorSpace.singletons.gray.getRgb(args, 0);
  26225. fn = OPS.setStrokeRGBColor;
  26226. break;
  26227. case OPS.setFillCMYKColor:
  26228. stateManager.state.fillColorSpace = ColorSpace.singletons.cmyk;
  26229. args = ColorSpace.singletons.cmyk.getRgb(args, 0);
  26230. fn = OPS.setFillRGBColor;
  26231. break;
  26232. case OPS.setStrokeCMYKColor:
  26233. stateManager.state.strokeColorSpace = ColorSpace.singletons.cmyk;
  26234. args = ColorSpace.singletons.cmyk.getRgb(args, 0);
  26235. fn = OPS.setStrokeRGBColor;
  26236. break;
  26237. case OPS.setFillRGBColor:
  26238. stateManager.state.fillColorSpace = ColorSpace.singletons.rgb;
  26239. args = ColorSpace.singletons.rgb.getRgb(args, 0);
  26240. break;
  26241. case OPS.setStrokeRGBColor:
  26242. stateManager.state.strokeColorSpace = ColorSpace.singletons.rgb;
  26243. args = ColorSpace.singletons.rgb.getRgb(args, 0);
  26244. break;
  26245. case OPS.setFillColorN:
  26246. cs = stateManager.state.fillColorSpace;
  26247. if (cs.name === 'Pattern') {
  26248. next(self.handleColorN(operatorList, OPS.setFillColorN, args, cs, patterns, resources, task, xref));
  26249. return;
  26250. }
  26251. args = cs.getRgb(args, 0);
  26252. fn = OPS.setFillRGBColor;
  26253. break;
  26254. case OPS.setStrokeColorN:
  26255. cs = stateManager.state.strokeColorSpace;
  26256. if (cs.name === 'Pattern') {
  26257. next(self.handleColorN(operatorList, OPS.setStrokeColorN, args, cs, patterns, resources, task, xref));
  26258. return;
  26259. }
  26260. args = cs.getRgb(args, 0);
  26261. fn = OPS.setStrokeRGBColor;
  26262. break;
  26263. case OPS.shadingFill:
  26264. var shadingRes = resources.get('Shading');
  26265. if (!shadingRes) {
  26266. error('No shading resource found');
  26267. }
  26268. var shading = shadingRes.get(args[0].name);
  26269. if (!shading) {
  26270. error('No shading object found');
  26271. }
  26272. var shadingFill = Pattern.parseShading(shading, null, xref, resources, self.handler);
  26273. var patternIR = shadingFill.getIR();
  26274. args = [patternIR];
  26275. fn = OPS.shadingFill;
  26276. break;
  26277. case OPS.setGState:
  26278. var dictName = args[0];
  26279. var extGState = resources.get('ExtGState');
  26280. if (!isDict(extGState) || !extGState.has(dictName.name)) {
  26281. break;
  26282. }
  26283. var gState = extGState.get(dictName.name);
  26284. next(self.setGState(resources, gState, operatorList, task, xref, stateManager));
  26285. return;
  26286. case OPS.moveTo:
  26287. case OPS.lineTo:
  26288. case OPS.curveTo:
  26289. case OPS.curveTo2:
  26290. case OPS.curveTo3:
  26291. case OPS.closePath:
  26292. self.buildPath(operatorList, fn, args);
  26293. continue;
  26294. case OPS.rectangle:
  26295. self.buildPath(operatorList, fn, args);
  26296. continue;
  26297. case OPS.markPoint:
  26298. case OPS.markPointProps:
  26299. case OPS.beginMarkedContent:
  26300. case OPS.beginMarkedContentProps:
  26301. case OPS.endMarkedContent:
  26302. case OPS.beginCompat:
  26303. case OPS.endCompat:
  26304. continue;
  26305. default:
  26306. if (args !== null) {
  26307. for (i = 0, ii = args.length; i < ii; i++) {
  26308. if (args[i] instanceof Dict) {
  26309. break;
  26310. }
  26311. }
  26312. if (i < ii) {
  26313. warn('getOperatorList - ignoring operator: ' + fn);
  26314. continue;
  26315. }
  26316. }
  26317. }
  26318. operatorList.addOp(fn, args);
  26319. }
  26320. if (stop) {
  26321. next(deferred);
  26322. return;
  26323. }
  26324. for (i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  26325. operatorList.addOp(OPS.restore, []);
  26326. }
  26327. resolve();
  26328. });
  26329. },
  26330. getTextContent: function PartialEvaluator_getTextContent(stream, task, resources, stateManager, normalizeWhitespace, combineTextItems) {
  26331. stateManager = stateManager || new StateManager(new TextState());
  26332. var WhitespaceRegexp = /\s/g;
  26333. var textContent = {
  26334. items: [],
  26335. styles: Object.create(null)
  26336. };
  26337. var textContentItem = {
  26338. initialized: false,
  26339. str: [],
  26340. width: 0,
  26341. height: 0,
  26342. vertical: false,
  26343. lastAdvanceWidth: 0,
  26344. lastAdvanceHeight: 0,
  26345. textAdvanceScale: 0,
  26346. spaceWidth: 0,
  26347. fakeSpaceMin: Infinity,
  26348. fakeMultiSpaceMin: Infinity,
  26349. fakeMultiSpaceMax: -0,
  26350. textRunBreakAllowed: false,
  26351. transform: null,
  26352. fontName: null
  26353. };
  26354. var SPACE_FACTOR = 0.3;
  26355. var MULTI_SPACE_FACTOR = 1.5;
  26356. var MULTI_SPACE_FACTOR_MAX = 4;
  26357. var self = this;
  26358. var xref = this.xref;
  26359. resources = xref.fetchIfRef(resources) || Dict.empty;
  26360. var xobjs = null;
  26361. var xobjsCache = Object.create(null);
  26362. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  26363. var textState;
  26364. function ensureTextContentItem() {
  26365. if (textContentItem.initialized) {
  26366. return textContentItem;
  26367. }
  26368. var font = textState.font;
  26369. if (!(font.loadedName in textContent.styles)) {
  26370. textContent.styles[font.loadedName] = {
  26371. fontFamily: font.fallbackName,
  26372. ascent: font.ascent,
  26373. descent: font.descent,
  26374. vertical: font.vertical
  26375. };
  26376. }
  26377. textContentItem.fontName = font.loadedName;
  26378. var tsm = [
  26379. textState.fontSize * textState.textHScale,
  26380. 0,
  26381. 0,
  26382. textState.fontSize,
  26383. 0,
  26384. textState.textRise
  26385. ];
  26386. if (font.isType3Font && textState.fontMatrix !== FONT_IDENTITY_MATRIX && textState.fontSize === 1) {
  26387. var glyphHeight = font.bbox[3] - font.bbox[1];
  26388. if (glyphHeight > 0) {
  26389. glyphHeight = glyphHeight * textState.fontMatrix[3];
  26390. tsm[3] *= glyphHeight;
  26391. }
  26392. }
  26393. var trm = Util.transform(textState.ctm, Util.transform(textState.textMatrix, tsm));
  26394. textContentItem.transform = trm;
  26395. if (!font.vertical) {
  26396. textContentItem.width = 0;
  26397. textContentItem.height = Math.sqrt(trm[2] * trm[2] + trm[3] * trm[3]);
  26398. textContentItem.vertical = false;
  26399. } else {
  26400. textContentItem.width = Math.sqrt(trm[0] * trm[0] + trm[1] * trm[1]);
  26401. textContentItem.height = 0;
  26402. textContentItem.vertical = true;
  26403. }
  26404. var a = textState.textLineMatrix[0];
  26405. var b = textState.textLineMatrix[1];
  26406. var scaleLineX = Math.sqrt(a * a + b * b);
  26407. a = textState.ctm[0];
  26408. b = textState.ctm[1];
  26409. var scaleCtmX = Math.sqrt(a * a + b * b);
  26410. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  26411. textContentItem.lastAdvanceWidth = 0;
  26412. textContentItem.lastAdvanceHeight = 0;
  26413. var spaceWidth = font.spaceWidth / 1000 * textState.fontSize;
  26414. if (spaceWidth) {
  26415. textContentItem.spaceWidth = spaceWidth;
  26416. textContentItem.fakeSpaceMin = spaceWidth * SPACE_FACTOR;
  26417. textContentItem.fakeMultiSpaceMin = spaceWidth * MULTI_SPACE_FACTOR;
  26418. textContentItem.fakeMultiSpaceMax = spaceWidth * MULTI_SPACE_FACTOR_MAX;
  26419. textContentItem.textRunBreakAllowed = !font.isMonospace;
  26420. } else {
  26421. textContentItem.spaceWidth = 0;
  26422. textContentItem.fakeSpaceMin = Infinity;
  26423. textContentItem.fakeMultiSpaceMin = Infinity;
  26424. textContentItem.fakeMultiSpaceMax = 0;
  26425. textContentItem.textRunBreakAllowed = false;
  26426. }
  26427. textContentItem.initialized = true;
  26428. return textContentItem;
  26429. }
  26430. function replaceWhitespace(str) {
  26431. var i = 0, ii = str.length, code;
  26432. while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7F) {
  26433. i++;
  26434. }
  26435. return i < ii ? str.replace(WhitespaceRegexp, ' ') : str;
  26436. }
  26437. function runBidiTransform(textChunk) {
  26438. var str = textChunk.str.join('');
  26439. var bidiResult = bidi(str, -1, textChunk.vertical);
  26440. return {
  26441. str: normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str,
  26442. dir: bidiResult.dir,
  26443. width: textChunk.width,
  26444. height: textChunk.height,
  26445. transform: textChunk.transform,
  26446. fontName: textChunk.fontName
  26447. };
  26448. }
  26449. function handleSetFont(fontName, fontRef) {
  26450. return self.loadFont(fontName, fontRef, xref, resources).then(function (translated) {
  26451. textState.font = translated.font;
  26452. textState.fontMatrix = translated.font.fontMatrix || FONT_IDENTITY_MATRIX;
  26453. });
  26454. }
  26455. function buildTextContentItem(chars) {
  26456. var font = textState.font;
  26457. var textChunk = ensureTextContentItem();
  26458. var width = 0;
  26459. var height = 0;
  26460. var glyphs = font.charsToGlyphs(chars);
  26461. for (var i = 0; i < glyphs.length; i++) {
  26462. var glyph = glyphs[i];
  26463. var glyphWidth = null;
  26464. if (font.vertical && glyph.vmetric) {
  26465. glyphWidth = glyph.vmetric[0];
  26466. } else {
  26467. glyphWidth = glyph.width;
  26468. }
  26469. var glyphUnicode = glyph.unicode;
  26470. var NormalizedUnicodes = getNormalizedUnicodes();
  26471. if (NormalizedUnicodes[glyphUnicode] !== undefined) {
  26472. glyphUnicode = NormalizedUnicodes[glyphUnicode];
  26473. }
  26474. glyphUnicode = reverseIfRtl(glyphUnicode);
  26475. var charSpacing = textState.charSpacing;
  26476. if (glyph.isSpace) {
  26477. var wordSpacing = textState.wordSpacing;
  26478. charSpacing += wordSpacing;
  26479. if (wordSpacing > 0) {
  26480. addFakeSpaces(wordSpacing, textChunk.str);
  26481. }
  26482. }
  26483. var tx = 0;
  26484. var ty = 0;
  26485. if (!font.vertical) {
  26486. var w0 = glyphWidth * textState.fontMatrix[0];
  26487. tx = (w0 * textState.fontSize + charSpacing) * textState.textHScale;
  26488. width += tx;
  26489. } else {
  26490. var w1 = glyphWidth * textState.fontMatrix[0];
  26491. ty = w1 * textState.fontSize + charSpacing;
  26492. height += ty;
  26493. }
  26494. textState.translateTextMatrix(tx, ty);
  26495. textChunk.str.push(glyphUnicode);
  26496. }
  26497. if (!font.vertical) {
  26498. textChunk.lastAdvanceWidth = width;
  26499. textChunk.width += width;
  26500. } else {
  26501. textChunk.lastAdvanceHeight = height;
  26502. textChunk.height += Math.abs(height);
  26503. }
  26504. return textChunk;
  26505. }
  26506. function addFakeSpaces(width, strBuf) {
  26507. if (width < textContentItem.fakeSpaceMin) {
  26508. return;
  26509. }
  26510. if (width < textContentItem.fakeMultiSpaceMin) {
  26511. strBuf.push(' ');
  26512. return;
  26513. }
  26514. var fakeSpaces = Math.round(width / textContentItem.spaceWidth);
  26515. while (fakeSpaces-- > 0) {
  26516. strBuf.push(' ');
  26517. }
  26518. }
  26519. function flushTextContentItem() {
  26520. if (!textContentItem.initialized) {
  26521. return;
  26522. }
  26523. textContentItem.width *= textContentItem.textAdvanceScale;
  26524. textContentItem.height *= textContentItem.textAdvanceScale;
  26525. textContent.items.push(runBidiTransform(textContentItem));
  26526. textContentItem.initialized = false;
  26527. textContentItem.str.length = 0;
  26528. }
  26529. var timeSlotManager = new TimeSlotManager();
  26530. return new Promise(function promiseBody(resolve, reject) {
  26531. var next = function (promise) {
  26532. promise.then(function () {
  26533. try {
  26534. promiseBody(resolve, reject);
  26535. } catch (ex) {
  26536. reject(ex);
  26537. }
  26538. }, reject);
  26539. };
  26540. task.ensureNotTerminated();
  26541. timeSlotManager.reset();
  26542. var stop, operation = {}, args = [];
  26543. while (!(stop = timeSlotManager.check())) {
  26544. args.length = 0;
  26545. operation.args = args;
  26546. if (!preprocessor.read(operation)) {
  26547. break;
  26548. }
  26549. textState = stateManager.state;
  26550. var fn = operation.fn;
  26551. args = operation.args;
  26552. var advance, diff;
  26553. switch (fn | 0) {
  26554. case OPS.setFont:
  26555. var fontNameArg = args[0].name, fontSizeArg = args[1];
  26556. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  26557. break;
  26558. }
  26559. flushTextContentItem();
  26560. textState.fontName = fontNameArg;
  26561. textState.fontSize = fontSizeArg;
  26562. next(handleSetFont(fontNameArg, null));
  26563. return;
  26564. case OPS.setTextRise:
  26565. flushTextContentItem();
  26566. textState.textRise = args[0];
  26567. break;
  26568. case OPS.setHScale:
  26569. flushTextContentItem();
  26570. textState.textHScale = args[0] / 100;
  26571. break;
  26572. case OPS.setLeading:
  26573. flushTextContentItem();
  26574. textState.leading = args[0];
  26575. break;
  26576. case OPS.moveText:
  26577. var isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0;
  26578. advance = args[0] - args[1];
  26579. if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) {
  26580. textState.translateTextLineMatrix(args[0], args[1]);
  26581. textContentItem.width += args[0] - textContentItem.lastAdvanceWidth;
  26582. textContentItem.height += args[1] - textContentItem.lastAdvanceHeight;
  26583. diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight);
  26584. addFakeSpaces(diff, textContentItem.str);
  26585. break;
  26586. }
  26587. flushTextContentItem();
  26588. textState.translateTextLineMatrix(args[0], args[1]);
  26589. textState.textMatrix = textState.textLineMatrix.slice();
  26590. break;
  26591. case OPS.setLeadingMoveText:
  26592. flushTextContentItem();
  26593. textState.leading = -args[1];
  26594. textState.translateTextLineMatrix(args[0], args[1]);
  26595. textState.textMatrix = textState.textLineMatrix.slice();
  26596. break;
  26597. case OPS.nextLine:
  26598. flushTextContentItem();
  26599. textState.carriageReturn();
  26600. break;
  26601. case OPS.setTextMatrix:
  26602. advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]);
  26603. if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) {
  26604. textState.translateTextLineMatrix(advance.width, advance.height);
  26605. textContentItem.width += advance.width - textContentItem.lastAdvanceWidth;
  26606. textContentItem.height += advance.height - textContentItem.lastAdvanceHeight;
  26607. diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight);
  26608. addFakeSpaces(diff, textContentItem.str);
  26609. break;
  26610. }
  26611. flushTextContentItem();
  26612. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  26613. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  26614. break;
  26615. case OPS.setCharSpacing:
  26616. textState.charSpacing = args[0];
  26617. break;
  26618. case OPS.setWordSpacing:
  26619. textState.wordSpacing = args[0];
  26620. break;
  26621. case OPS.beginText:
  26622. flushTextContentItem();
  26623. textState.textMatrix = IDENTITY_MATRIX.slice();
  26624. textState.textLineMatrix = IDENTITY_MATRIX.slice();
  26625. break;
  26626. case OPS.showSpacedText:
  26627. var items = args[0];
  26628. var offset;
  26629. for (var j = 0, jj = items.length; j < jj; j++) {
  26630. if (typeof items[j] === 'string') {
  26631. buildTextContentItem(items[j]);
  26632. } else if (isNum(items[j])) {
  26633. ensureTextContentItem();
  26634. advance = items[j] * textState.fontSize / 1000;
  26635. var breakTextRun = false;
  26636. if (textState.font.vertical) {
  26637. offset = advance;
  26638. textState.translateTextMatrix(0, offset);
  26639. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  26640. if (!breakTextRun) {
  26641. textContentItem.height += offset;
  26642. }
  26643. } else {
  26644. advance = -advance;
  26645. offset = advance * textState.textHScale;
  26646. textState.translateTextMatrix(offset, 0);
  26647. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  26648. if (!breakTextRun) {
  26649. textContentItem.width += offset;
  26650. }
  26651. }
  26652. if (breakTextRun) {
  26653. flushTextContentItem();
  26654. } else if (advance > 0) {
  26655. addFakeSpaces(advance, textContentItem.str);
  26656. }
  26657. }
  26658. }
  26659. break;
  26660. case OPS.showText:
  26661. buildTextContentItem(args[0]);
  26662. break;
  26663. case OPS.nextLineShowText:
  26664. flushTextContentItem();
  26665. textState.carriageReturn();
  26666. buildTextContentItem(args[0]);
  26667. break;
  26668. case OPS.nextLineSetSpacingShowText:
  26669. flushTextContentItem();
  26670. textState.wordSpacing = args[0];
  26671. textState.charSpacing = args[1];
  26672. textState.carriageReturn();
  26673. buildTextContentItem(args[2]);
  26674. break;
  26675. case OPS.paintXObject:
  26676. flushTextContentItem();
  26677. if (args[0].code) {
  26678. break;
  26679. }
  26680. if (!xobjs) {
  26681. xobjs = resources.get('XObject') || Dict.empty;
  26682. }
  26683. var name = args[0].name;
  26684. if (xobjsCache.key === name) {
  26685. if (xobjsCache.texts) {
  26686. Util.appendToArray(textContent.items, xobjsCache.texts.items);
  26687. Util.extendObj(textContent.styles, xobjsCache.texts.styles);
  26688. }
  26689. break;
  26690. }
  26691. var xobj = xobjs.get(name);
  26692. if (!xobj) {
  26693. break;
  26694. }
  26695. assert(isStream(xobj), 'XObject should be a stream');
  26696. var type = xobj.dict.get('Subtype');
  26697. assert(isName(type), 'XObject should have a Name subtype');
  26698. if ('Form' !== type.name) {
  26699. xobjsCache.key = name;
  26700. xobjsCache.texts = null;
  26701. break;
  26702. }
  26703. stateManager.save();
  26704. var matrix = xobj.dict.getArray('Matrix');
  26705. if (isArray(matrix) && matrix.length === 6) {
  26706. stateManager.transform(matrix);
  26707. }
  26708. next(self.getTextContent(xobj, task, xobj.dict.get('Resources') || resources, stateManager, normalizeWhitespace, combineTextItems).then(function (formTextContent) {
  26709. Util.appendToArray(textContent.items, formTextContent.items);
  26710. Util.extendObj(textContent.styles, formTextContent.styles);
  26711. stateManager.restore();
  26712. xobjsCache.key = name;
  26713. xobjsCache.texts = formTextContent;
  26714. }));
  26715. return;
  26716. case OPS.setGState:
  26717. flushTextContentItem();
  26718. var dictName = args[0];
  26719. var extGState = resources.get('ExtGState');
  26720. if (!isDict(extGState) || !isName(dictName)) {
  26721. break;
  26722. }
  26723. var gState = extGState.get(dictName.name);
  26724. if (!isDict(gState)) {
  26725. break;
  26726. }
  26727. var gStateFont = gState.get('Font');
  26728. if (gStateFont) {
  26729. textState.fontName = null;
  26730. textState.fontSize = gStateFont[1];
  26731. next(handleSetFont(null, gStateFont[0]));
  26732. return;
  26733. }
  26734. break;
  26735. }
  26736. }
  26737. if (stop) {
  26738. next(deferred);
  26739. return;
  26740. }
  26741. flushTextContentItem();
  26742. resolve(textContent);
  26743. });
  26744. },
  26745. extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, xref, properties) {
  26746. var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
  26747. var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined);
  26748. if (properties.composite) {
  26749. var cidSystemInfo = dict.get('CIDSystemInfo');
  26750. if (isDict(cidSystemInfo)) {
  26751. properties.cidSystemInfo = {
  26752. registry: cidSystemInfo.get('Registry'),
  26753. ordering: cidSystemInfo.get('Ordering'),
  26754. supplement: cidSystemInfo.get('Supplement')
  26755. };
  26756. }
  26757. var cidToGidMap = dict.get('CIDToGIDMap');
  26758. if (isStream(cidToGidMap)) {
  26759. properties.cidToGidMap = this.readCidToGidMap(cidToGidMap);
  26760. }
  26761. }
  26762. var differences = [];
  26763. var baseEncodingName = null;
  26764. var encoding;
  26765. if (dict.has('Encoding')) {
  26766. encoding = dict.get('Encoding');
  26767. if (isDict(encoding)) {
  26768. baseEncodingName = encoding.get('BaseEncoding');
  26769. baseEncodingName = isName(baseEncodingName) ? baseEncodingName.name : null;
  26770. if (encoding.has('Differences')) {
  26771. var diffEncoding = encoding.get('Differences');
  26772. var index = 0;
  26773. for (var j = 0, jj = diffEncoding.length; j < jj; j++) {
  26774. var data = xref.fetchIfRef(diffEncoding[j]);
  26775. if (isNum(data)) {
  26776. index = data;
  26777. } else if (isName(data)) {
  26778. differences[index++] = data.name;
  26779. } else {
  26780. error('Invalid entry in \'Differences\' array: ' + data);
  26781. }
  26782. }
  26783. }
  26784. } else if (isName(encoding)) {
  26785. baseEncodingName = encoding.name;
  26786. } else {
  26787. error('Encoding is not a Name nor a Dict');
  26788. }
  26789. if (baseEncodingName !== 'MacRomanEncoding' && baseEncodingName !== 'MacExpertEncoding' && baseEncodingName !== 'WinAnsiEncoding') {
  26790. baseEncodingName = null;
  26791. }
  26792. }
  26793. if (baseEncodingName) {
  26794. properties.defaultEncoding = getEncoding(baseEncodingName).slice();
  26795. } else {
  26796. var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  26797. var isNonsymbolicFont = !!(properties.flags & FontFlags.Nonsymbolic);
  26798. encoding = StandardEncoding;
  26799. if (properties.type === 'TrueType' && !isNonsymbolicFont) {
  26800. encoding = WinAnsiEncoding;
  26801. }
  26802. if (isSymbolicFont) {
  26803. encoding = MacRomanEncoding;
  26804. if (!properties.file) {
  26805. if (/Symbol/i.test(properties.name)) {
  26806. encoding = SymbolSetEncoding;
  26807. } else if (/Dingbats/i.test(properties.name)) {
  26808. encoding = ZapfDingbatsEncoding;
  26809. }
  26810. }
  26811. }
  26812. properties.defaultEncoding = encoding;
  26813. }
  26814. properties.differences = differences;
  26815. properties.baseEncodingName = baseEncodingName;
  26816. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  26817. properties.dict = dict;
  26818. return toUnicodePromise.then(function (toUnicode) {
  26819. properties.toUnicode = toUnicode;
  26820. return this.buildToUnicode(properties);
  26821. }.bind(this)).then(function (toUnicode) {
  26822. properties.toUnicode = toUnicode;
  26823. return properties;
  26824. });
  26825. },
  26826. buildToUnicode: function PartialEvaluator_buildToUnicode(properties) {
  26827. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  26828. if (properties.hasIncludedToUnicodeMap) {
  26829. return Promise.resolve(properties.toUnicode);
  26830. }
  26831. var toUnicode, charcode, glyphName;
  26832. if (!properties.composite) {
  26833. toUnicode = [];
  26834. var encoding = properties.defaultEncoding.slice();
  26835. var baseEncodingName = properties.baseEncodingName;
  26836. var differences = properties.differences;
  26837. for (charcode in differences) {
  26838. glyphName = differences[charcode];
  26839. if (glyphName === '.notdef') {
  26840. continue;
  26841. }
  26842. encoding[charcode] = glyphName;
  26843. }
  26844. var glyphsUnicodeMap = getGlyphsUnicode();
  26845. for (charcode in encoding) {
  26846. glyphName = encoding[charcode];
  26847. if (glyphName === '') {
  26848. continue;
  26849. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  26850. var code = 0;
  26851. switch (glyphName[0]) {
  26852. case 'G':
  26853. if (glyphName.length === 3) {
  26854. code = parseInt(glyphName.substr(1), 16);
  26855. }
  26856. break;
  26857. case 'g':
  26858. if (glyphName.length === 5) {
  26859. code = parseInt(glyphName.substr(1), 16);
  26860. }
  26861. break;
  26862. case 'C':
  26863. case 'c':
  26864. if (glyphName.length >= 3) {
  26865. code = +glyphName.substr(1);
  26866. }
  26867. break;
  26868. default:
  26869. var unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  26870. if (unicode !== -1) {
  26871. code = unicode;
  26872. }
  26873. }
  26874. if (code) {
  26875. if (baseEncodingName && code === +charcode) {
  26876. var baseEncoding = getEncoding(baseEncodingName);
  26877. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  26878. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  26879. continue;
  26880. }
  26881. }
  26882. toUnicode[charcode] = String.fromCharCode(code);
  26883. }
  26884. continue;
  26885. }
  26886. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  26887. }
  26888. return Promise.resolve(new ToUnicodeMap(toUnicode));
  26889. }
  26890. 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'))) {
  26891. var registry = properties.cidSystemInfo.registry;
  26892. var ordering = properties.cidSystemInfo.ordering;
  26893. var ucs2CMapName = Name.get(registry + '-' + ordering + '-UCS2');
  26894. return CMapFactory.create({
  26895. encoding: ucs2CMapName,
  26896. fetchBuiltInCMap: this.fetchBuiltInCMap,
  26897. useCMap: null
  26898. }).then(function (ucs2CMap) {
  26899. var cMap = properties.cMap;
  26900. toUnicode = [];
  26901. cMap.forEach(function (charcode, cid) {
  26902. assert(cid <= 0xffff, 'Max size of CID is 65,535');
  26903. var ucs2 = ucs2CMap.lookup(cid);
  26904. if (ucs2) {
  26905. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  26906. }
  26907. });
  26908. return new ToUnicodeMap(toUnicode);
  26909. });
  26910. }
  26911. return Promise.resolve(new IdentityToUnicodeMap(properties.firstChar, properties.lastChar));
  26912. },
  26913. readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) {
  26914. var cmapObj = toUnicode;
  26915. if (isName(cmapObj)) {
  26916. return CMapFactory.create({
  26917. encoding: cmapObj,
  26918. fetchBuiltInCMap: this.fetchBuiltInCMap,
  26919. useCMap: null
  26920. }).then(function (cmap) {
  26921. if (cmap instanceof IdentityCMap) {
  26922. return new IdentityToUnicodeMap(0, 0xFFFF);
  26923. }
  26924. return new ToUnicodeMap(cmap.getMap());
  26925. });
  26926. } else if (isStream(cmapObj)) {
  26927. return CMapFactory.create({
  26928. encoding: cmapObj,
  26929. fetchBuiltInCMap: this.fetchBuiltInCMap,
  26930. useCMap: null
  26931. }).then(function (cmap) {
  26932. if (cmap instanceof IdentityCMap) {
  26933. return new IdentityToUnicodeMap(0, 0xFFFF);
  26934. }
  26935. var map = new Array(cmap.length);
  26936. cmap.forEach(function (charCode, token) {
  26937. var str = [];
  26938. for (var k = 0; k < token.length; k += 2) {
  26939. var w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  26940. if ((w1 & 0xF800) !== 0xD800) {
  26941. str.push(w1);
  26942. continue;
  26943. }
  26944. k += 2;
  26945. var w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  26946. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  26947. }
  26948. map[charCode] = String.fromCharCode.apply(String, str);
  26949. });
  26950. return new ToUnicodeMap(map);
  26951. });
  26952. }
  26953. return Promise.resolve(null);
  26954. },
  26955. readCidToGidMap: function PartialEvaluator_readCidToGidMap(cidToGidStream) {
  26956. var glyphsData = cidToGidStream.getBytes();
  26957. var result = [];
  26958. for (var j = 0, jj = glyphsData.length; j < jj; j++) {
  26959. var glyphID = glyphsData[j++] << 8 | glyphsData[j];
  26960. if (glyphID === 0) {
  26961. continue;
  26962. }
  26963. var code = j >> 1;
  26964. result[code] = glyphID;
  26965. }
  26966. return result;
  26967. },
  26968. extractWidths: function PartialEvaluator_extractWidths(dict, xref, descriptor, properties) {
  26969. var glyphsWidths = [];
  26970. var defaultWidth = 0;
  26971. var glyphsVMetrics = [];
  26972. var defaultVMetrics;
  26973. var i, ii, j, jj, start, code, widths;
  26974. if (properties.composite) {
  26975. defaultWidth = dict.get('DW') || 1000;
  26976. widths = dict.get('W');
  26977. if (widths) {
  26978. for (i = 0, ii = widths.length; i < ii; i++) {
  26979. start = xref.fetchIfRef(widths[i++]);
  26980. code = xref.fetchIfRef(widths[i]);
  26981. if (isArray(code)) {
  26982. for (j = 0, jj = code.length; j < jj; j++) {
  26983. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  26984. }
  26985. } else {
  26986. var width = xref.fetchIfRef(widths[++i]);
  26987. for (j = start; j <= code; j++) {
  26988. glyphsWidths[j] = width;
  26989. }
  26990. }
  26991. }
  26992. }
  26993. if (properties.vertical) {
  26994. var vmetrics = dict.getArray('DW2') || [
  26995. 880,
  26996. -1000
  26997. ];
  26998. defaultVMetrics = [
  26999. vmetrics[1],
  27000. defaultWidth * 0.5,
  27001. vmetrics[0]
  27002. ];
  27003. vmetrics = dict.get('W2');
  27004. if (vmetrics) {
  27005. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  27006. start = xref.fetchIfRef(vmetrics[i++]);
  27007. code = xref.fetchIfRef(vmetrics[i]);
  27008. if (isArray(code)) {
  27009. for (j = 0, jj = code.length; j < jj; j++) {
  27010. glyphsVMetrics[start++] = [
  27011. xref.fetchIfRef(code[j++]),
  27012. xref.fetchIfRef(code[j++]),
  27013. xref.fetchIfRef(code[j])
  27014. ];
  27015. }
  27016. } else {
  27017. var vmetric = [
  27018. xref.fetchIfRef(vmetrics[++i]),
  27019. xref.fetchIfRef(vmetrics[++i]),
  27020. xref.fetchIfRef(vmetrics[++i])
  27021. ];
  27022. for (j = start; j <= code; j++) {
  27023. glyphsVMetrics[j] = vmetric;
  27024. }
  27025. }
  27026. }
  27027. }
  27028. }
  27029. } else {
  27030. var firstChar = properties.firstChar;
  27031. widths = dict.get('Widths');
  27032. if (widths) {
  27033. j = firstChar;
  27034. for (i = 0, ii = widths.length; i < ii; i++) {
  27035. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  27036. }
  27037. defaultWidth = parseFloat(descriptor.get('MissingWidth')) || 0;
  27038. } else {
  27039. var baseFontName = dict.get('BaseFont');
  27040. if (isName(baseFontName)) {
  27041. var metrics = this.getBaseFontMetrics(baseFontName.name);
  27042. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  27043. defaultWidth = metrics.defaultWidth;
  27044. }
  27045. }
  27046. }
  27047. var isMonospace = true;
  27048. var firstWidth = defaultWidth;
  27049. for (var glyph in glyphsWidths) {
  27050. var glyphWidth = glyphsWidths[glyph];
  27051. if (!glyphWidth) {
  27052. continue;
  27053. }
  27054. if (!firstWidth) {
  27055. firstWidth = glyphWidth;
  27056. continue;
  27057. }
  27058. if (firstWidth !== glyphWidth) {
  27059. isMonospace = false;
  27060. break;
  27061. }
  27062. }
  27063. if (isMonospace) {
  27064. properties.flags |= FontFlags.FixedPitch;
  27065. }
  27066. properties.defaultWidth = defaultWidth;
  27067. properties.widths = glyphsWidths;
  27068. properties.defaultVMetrics = defaultVMetrics;
  27069. properties.vmetrics = glyphsVMetrics;
  27070. },
  27071. isSerifFont: function PartialEvaluator_isSerifFont(baseFontName) {
  27072. var fontNameWoStyle = baseFontName.split('-')[0];
  27073. return fontNameWoStyle in getSerifFonts() || fontNameWoStyle.search(/serif/gi) !== -1;
  27074. },
  27075. getBaseFontMetrics: function PartialEvaluator_getBaseFontMetrics(name) {
  27076. var defaultWidth = 0;
  27077. var widths = [];
  27078. var monospace = false;
  27079. var stdFontMap = getStdFontMap();
  27080. var lookupName = stdFontMap[name] || name;
  27081. var Metrics = getMetrics();
  27082. if (!(lookupName in Metrics)) {
  27083. if (this.isSerifFont(name)) {
  27084. lookupName = 'Times-Roman';
  27085. } else {
  27086. lookupName = 'Helvetica';
  27087. }
  27088. }
  27089. var glyphWidths = Metrics[lookupName];
  27090. if (isNum(glyphWidths)) {
  27091. defaultWidth = glyphWidths;
  27092. monospace = true;
  27093. } else {
  27094. widths = glyphWidths();
  27095. }
  27096. return {
  27097. defaultWidth: defaultWidth,
  27098. monospace: monospace,
  27099. widths: widths
  27100. };
  27101. },
  27102. buildCharCodeToWidth: function PartialEvaluator_bulildCharCodeToWidth(widthsByGlyphName, properties) {
  27103. var widths = Object.create(null);
  27104. var differences = properties.differences;
  27105. var encoding = properties.defaultEncoding;
  27106. for (var charCode = 0; charCode < 256; charCode++) {
  27107. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  27108. widths[charCode] = widthsByGlyphName[differences[charCode]];
  27109. continue;
  27110. }
  27111. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  27112. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  27113. continue;
  27114. }
  27115. }
  27116. return widths;
  27117. },
  27118. preEvaluateFont: function PartialEvaluator_preEvaluateFont(dict, xref) {
  27119. var baseDict = dict;
  27120. var type = dict.get('Subtype');
  27121. assert(isName(type), 'invalid font Subtype');
  27122. var composite = false;
  27123. var uint8array;
  27124. if (type.name === 'Type0') {
  27125. var df = dict.get('DescendantFonts');
  27126. if (!df) {
  27127. error('Descendant fonts are not specified');
  27128. }
  27129. dict = isArray(df) ? xref.fetchIfRef(df[0]) : df;
  27130. type = dict.get('Subtype');
  27131. assert(isName(type), 'invalid font Subtype');
  27132. composite = true;
  27133. }
  27134. var descriptor = dict.get('FontDescriptor');
  27135. if (descriptor) {
  27136. var hash = new MurmurHash3_64();
  27137. var encoding = baseDict.getRaw('Encoding');
  27138. if (isName(encoding)) {
  27139. hash.update(encoding.name);
  27140. } else if (isRef(encoding)) {
  27141. hash.update(encoding.toString());
  27142. } else if (isDict(encoding)) {
  27143. var keys = encoding.getKeys();
  27144. for (var i = 0, ii = keys.length; i < ii; i++) {
  27145. var entry = encoding.getRaw(keys[i]);
  27146. if (isName(entry)) {
  27147. hash.update(entry.name);
  27148. } else if (isRef(entry)) {
  27149. hash.update(entry.toString());
  27150. } else if (isArray(entry)) {
  27151. var diffLength = entry.length, diffBuf = new Array(diffLength);
  27152. for (var j = 0; j < diffLength; j++) {
  27153. var diffEntry = entry[j];
  27154. if (isName(diffEntry)) {
  27155. diffBuf[j] = diffEntry.name;
  27156. } else if (isNum(diffEntry) || isRef(diffEntry)) {
  27157. diffBuf[j] = diffEntry.toString();
  27158. }
  27159. }
  27160. hash.update(diffBuf.join());
  27161. }
  27162. }
  27163. }
  27164. var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
  27165. if (isStream(toUnicode)) {
  27166. var stream = toUnicode.str || toUnicode;
  27167. uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  27168. hash.update(uint8array);
  27169. } else if (isName(toUnicode)) {
  27170. hash.update(toUnicode.name);
  27171. }
  27172. var widths = dict.get('Widths') || baseDict.get('Widths');
  27173. if (widths) {
  27174. uint8array = new Uint8Array(new Uint32Array(widths).buffer);
  27175. hash.update(uint8array);
  27176. }
  27177. }
  27178. return {
  27179. descriptor: descriptor,
  27180. dict: dict,
  27181. baseDict: baseDict,
  27182. composite: composite,
  27183. type: type.name,
  27184. hash: hash ? hash.hexdigest() : ''
  27185. };
  27186. },
  27187. translateFont: function PartialEvaluator_translateFont(preEvaluatedFont, xref) {
  27188. var baseDict = preEvaluatedFont.baseDict;
  27189. var dict = preEvaluatedFont.dict;
  27190. var composite = preEvaluatedFont.composite;
  27191. var descriptor = preEvaluatedFont.descriptor;
  27192. var type = preEvaluatedFont.type;
  27193. var maxCharIndex = composite ? 0xFFFF : 0xFF;
  27194. var properties;
  27195. if (!descriptor) {
  27196. if (type === 'Type3') {
  27197. descriptor = new Dict(null);
  27198. descriptor.set('FontName', Name.get(type));
  27199. descriptor.set('FontBBox', dict.getArray('FontBBox'));
  27200. } else {
  27201. var baseFontName = dict.get('BaseFont');
  27202. if (!isName(baseFontName)) {
  27203. error('Base font is not specified');
  27204. }
  27205. baseFontName = baseFontName.name.replace(/[,_]/g, '-');
  27206. var metrics = this.getBaseFontMetrics(baseFontName);
  27207. var fontNameWoStyle = baseFontName.split('-')[0];
  27208. var flags = (this.isSerifFont(fontNameWoStyle) ? FontFlags.Serif : 0) | (metrics.monospace ? FontFlags.FixedPitch : 0) | (getSymbolsFonts()[fontNameWoStyle] ? FontFlags.Symbolic : FontFlags.Nonsymbolic);
  27209. properties = {
  27210. type: type,
  27211. name: baseFontName,
  27212. widths: metrics.widths,
  27213. defaultWidth: metrics.defaultWidth,
  27214. flags: flags,
  27215. firstChar: 0,
  27216. lastChar: maxCharIndex
  27217. };
  27218. return this.extractDataStructures(dict, dict, xref, properties).then(function (properties) {
  27219. properties.widths = this.buildCharCodeToWidth(metrics.widths, properties);
  27220. return new Font(baseFontName, null, properties);
  27221. }.bind(this));
  27222. }
  27223. }
  27224. var firstChar = dict.get('FirstChar') || 0;
  27225. var lastChar = dict.get('LastChar') || maxCharIndex;
  27226. var fontName = descriptor.get('FontName');
  27227. var baseFont = dict.get('BaseFont');
  27228. if (isString(fontName)) {
  27229. fontName = Name.get(fontName);
  27230. }
  27231. if (isString(baseFont)) {
  27232. baseFont = Name.get(baseFont);
  27233. }
  27234. if (type !== 'Type3') {
  27235. var fontNameStr = fontName && fontName.name;
  27236. var baseFontStr = baseFont && baseFont.name;
  27237. if (fontNameStr !== baseFontStr) {
  27238. info('The FontDescriptor\'s FontName is "' + fontNameStr + '" but should be the same as the Font\'s BaseFont "' + baseFontStr + '"');
  27239. if (fontNameStr && baseFontStr && baseFontStr.indexOf(fontNameStr) === 0) {
  27240. fontName = baseFont;
  27241. }
  27242. }
  27243. }
  27244. fontName = fontName || baseFont;
  27245. assert(isName(fontName), 'invalid font name');
  27246. var fontFile = descriptor.get('FontFile', 'FontFile2', 'FontFile3');
  27247. if (fontFile) {
  27248. if (fontFile.dict) {
  27249. var subtype = fontFile.dict.get('Subtype');
  27250. if (subtype) {
  27251. subtype = subtype.name;
  27252. }
  27253. var length1 = fontFile.dict.get('Length1');
  27254. var length2 = fontFile.dict.get('Length2');
  27255. var length3 = fontFile.dict.get('Length3');
  27256. }
  27257. }
  27258. properties = {
  27259. type: type,
  27260. name: fontName.name,
  27261. subtype: subtype,
  27262. file: fontFile,
  27263. length1: length1,
  27264. length2: length2,
  27265. length3: length3,
  27266. loadedName: baseDict.loadedName,
  27267. composite: composite,
  27268. wideChars: composite,
  27269. fixedPitch: false,
  27270. fontMatrix: dict.getArray('FontMatrix') || FONT_IDENTITY_MATRIX,
  27271. firstChar: firstChar || 0,
  27272. lastChar: lastChar || maxCharIndex,
  27273. bbox: descriptor.getArray('FontBBox'),
  27274. ascent: descriptor.get('Ascent'),
  27275. descent: descriptor.get('Descent'),
  27276. xHeight: descriptor.get('XHeight'),
  27277. capHeight: descriptor.get('CapHeight'),
  27278. flags: descriptor.get('Flags'),
  27279. italicAngle: descriptor.get('ItalicAngle'),
  27280. coded: false
  27281. };
  27282. var cMapPromise;
  27283. if (composite) {
  27284. var cidEncoding = baseDict.get('Encoding');
  27285. if (isName(cidEncoding)) {
  27286. properties.cidEncoding = cidEncoding.name;
  27287. }
  27288. cMapPromise = CMapFactory.create({
  27289. encoding: cidEncoding,
  27290. fetchBuiltInCMap: this.fetchBuiltInCMap,
  27291. useCMap: null
  27292. }).then(function (cMap) {
  27293. properties.cMap = cMap;
  27294. properties.vertical = properties.cMap.vertical;
  27295. });
  27296. } else {
  27297. cMapPromise = Promise.resolve(undefined);
  27298. }
  27299. return cMapPromise.then(function () {
  27300. return this.extractDataStructures(dict, baseDict, xref, properties);
  27301. }.bind(this)).then(function (properties) {
  27302. this.extractWidths(dict, xref, descriptor, properties);
  27303. if (type === 'Type3') {
  27304. properties.isType3Font = true;
  27305. }
  27306. return new Font(fontName.name, fontFile, properties);
  27307. }.bind(this));
  27308. }
  27309. };
  27310. return PartialEvaluator;
  27311. }();
  27312. var TranslatedFont = function TranslatedFontClosure() {
  27313. function TranslatedFont(loadedName, font, dict) {
  27314. this.loadedName = loadedName;
  27315. this.font = font;
  27316. this.dict = dict;
  27317. this.type3Loaded = null;
  27318. this.sent = false;
  27319. }
  27320. TranslatedFont.prototype = {
  27321. send: function (handler) {
  27322. if (this.sent) {
  27323. return;
  27324. }
  27325. var fontData = this.font.exportData();
  27326. handler.send('commonobj', [
  27327. this.loadedName,
  27328. 'Font',
  27329. fontData
  27330. ]);
  27331. this.sent = true;
  27332. },
  27333. loadType3Data: function (evaluator, resources, parentOperatorList, task) {
  27334. assert(this.font.isType3Font);
  27335. if (this.type3Loaded) {
  27336. return this.type3Loaded;
  27337. }
  27338. var translatedFont = this.font;
  27339. var loadCharProcsPromise = Promise.resolve();
  27340. var charProcs = this.dict.get('CharProcs');
  27341. var fontResources = this.dict.get('Resources') || resources;
  27342. var charProcKeys = charProcs.getKeys();
  27343. var charProcOperatorList = Object.create(null);
  27344. for (var i = 0, n = charProcKeys.length; i < n; ++i) {
  27345. loadCharProcsPromise = loadCharProcsPromise.then(function (key) {
  27346. var glyphStream = charProcs.get(key);
  27347. var operatorList = new OperatorList();
  27348. return evaluator.getOperatorList(glyphStream, task, fontResources, operatorList).then(function () {
  27349. charProcOperatorList[key] = operatorList.getIR();
  27350. parentOperatorList.addDependencies(operatorList.dependencies);
  27351. }, function (reason) {
  27352. warn('Type3 font resource \"' + key + '\" is not available');
  27353. var operatorList = new OperatorList();
  27354. charProcOperatorList[key] = operatorList.getIR();
  27355. });
  27356. }.bind(this, charProcKeys[i]));
  27357. }
  27358. this.type3Loaded = loadCharProcsPromise.then(function () {
  27359. translatedFont.charProcOperatorList = charProcOperatorList;
  27360. });
  27361. return this.type3Loaded;
  27362. }
  27363. };
  27364. return TranslatedFont;
  27365. }();
  27366. var OperatorList = function OperatorListClosure() {
  27367. var CHUNK_SIZE = 1000;
  27368. var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5;
  27369. function getTransfers(queue) {
  27370. var transfers = [];
  27371. var fnArray = queue.fnArray, argsArray = queue.argsArray;
  27372. for (var i = 0, ii = queue.length; i < ii; i++) {
  27373. switch (fnArray[i]) {
  27374. case OPS.paintInlineImageXObject:
  27375. case OPS.paintInlineImageXObjectGroup:
  27376. case OPS.paintImageMaskXObject:
  27377. var arg = argsArray[i][0];
  27378. if (!arg.cached) {
  27379. transfers.push(arg.data.buffer);
  27380. }
  27381. break;
  27382. }
  27383. }
  27384. return transfers;
  27385. }
  27386. function OperatorList(intent, messageHandler, pageIndex) {
  27387. this.messageHandler = messageHandler;
  27388. this.fnArray = [];
  27389. this.argsArray = [];
  27390. this.dependencies = Object.create(null);
  27391. this._totalLength = 0;
  27392. this.pageIndex = pageIndex;
  27393. this.intent = intent;
  27394. }
  27395. OperatorList.prototype = {
  27396. get length() {
  27397. return this.argsArray.length;
  27398. },
  27399. get totalLength() {
  27400. return this._totalLength + this.length;
  27401. },
  27402. addOp: function (fn, args) {
  27403. this.fnArray.push(fn);
  27404. this.argsArray.push(args);
  27405. if (this.messageHandler) {
  27406. if (this.fnArray.length >= CHUNK_SIZE) {
  27407. this.flush();
  27408. } else if (this.fnArray.length >= CHUNK_SIZE_ABOUT && (fn === OPS.restore || fn === OPS.endText)) {
  27409. this.flush();
  27410. }
  27411. }
  27412. },
  27413. addDependency: function (dependency) {
  27414. if (dependency in this.dependencies) {
  27415. return;
  27416. }
  27417. this.dependencies[dependency] = true;
  27418. this.addOp(OPS.dependency, [dependency]);
  27419. },
  27420. addDependencies: function (dependencies) {
  27421. for (var key in dependencies) {
  27422. this.addDependency(key);
  27423. }
  27424. },
  27425. addOpList: function (opList) {
  27426. Util.extendObj(this.dependencies, opList.dependencies);
  27427. for (var i = 0, ii = opList.length; i < ii; i++) {
  27428. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  27429. }
  27430. },
  27431. getIR: function () {
  27432. return {
  27433. fnArray: this.fnArray,
  27434. argsArray: this.argsArray,
  27435. length: this.length
  27436. };
  27437. },
  27438. flush: function (lastChunk) {
  27439. if (this.intent !== 'oplist') {
  27440. new QueueOptimizer().optimize(this);
  27441. }
  27442. var transfers = getTransfers(this);
  27443. var length = this.length;
  27444. this._totalLength += length;
  27445. this.messageHandler.send('RenderPageChunk', {
  27446. operatorList: {
  27447. fnArray: this.fnArray,
  27448. argsArray: this.argsArray,
  27449. lastChunk: lastChunk,
  27450. length: length
  27451. },
  27452. pageIndex: this.pageIndex,
  27453. intent: this.intent
  27454. }, transfers);
  27455. this.dependencies = Object.create(null);
  27456. this.fnArray.length = 0;
  27457. this.argsArray.length = 0;
  27458. }
  27459. };
  27460. return OperatorList;
  27461. }();
  27462. var StateManager = function StateManagerClosure() {
  27463. function StateManager(initialState) {
  27464. this.state = initialState;
  27465. this.stateStack = [];
  27466. }
  27467. StateManager.prototype = {
  27468. save: function () {
  27469. var old = this.state;
  27470. this.stateStack.push(this.state);
  27471. this.state = old.clone();
  27472. },
  27473. restore: function () {
  27474. var prev = this.stateStack.pop();
  27475. if (prev) {
  27476. this.state = prev;
  27477. }
  27478. },
  27479. transform: function (args) {
  27480. this.state.ctm = Util.transform(this.state.ctm, args);
  27481. }
  27482. };
  27483. return StateManager;
  27484. }();
  27485. var TextState = function TextStateClosure() {
  27486. function TextState() {
  27487. this.ctm = new Float32Array(IDENTITY_MATRIX);
  27488. this.fontName = null;
  27489. this.fontSize = 0;
  27490. this.font = null;
  27491. this.fontMatrix = FONT_IDENTITY_MATRIX;
  27492. this.textMatrix = IDENTITY_MATRIX.slice();
  27493. this.textLineMatrix = IDENTITY_MATRIX.slice();
  27494. this.charSpacing = 0;
  27495. this.wordSpacing = 0;
  27496. this.leading = 0;
  27497. this.textHScale = 1;
  27498. this.textRise = 0;
  27499. }
  27500. TextState.prototype = {
  27501. setTextMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
  27502. var m = this.textMatrix;
  27503. m[0] = a;
  27504. m[1] = b;
  27505. m[2] = c;
  27506. m[3] = d;
  27507. m[4] = e;
  27508. m[5] = f;
  27509. },
  27510. setTextLineMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
  27511. var m = this.textLineMatrix;
  27512. m[0] = a;
  27513. m[1] = b;
  27514. m[2] = c;
  27515. m[3] = d;
  27516. m[4] = e;
  27517. m[5] = f;
  27518. },
  27519. translateTextMatrix: function TextState_translateTextMatrix(x, y) {
  27520. var m = this.textMatrix;
  27521. m[4] = m[0] * x + m[2] * y + m[4];
  27522. m[5] = m[1] * x + m[3] * y + m[5];
  27523. },
  27524. translateTextLineMatrix: function TextState_translateTextMatrix(x, y) {
  27525. var m = this.textLineMatrix;
  27526. m[4] = m[0] * x + m[2] * y + m[4];
  27527. m[5] = m[1] * x + m[3] * y + m[5];
  27528. },
  27529. calcTextLineMatrixAdvance: function TextState_calcTextLineMatrixAdvance(a, b, c, d, e, f) {
  27530. var font = this.font;
  27531. if (!font) {
  27532. return null;
  27533. }
  27534. var m = this.textLineMatrix;
  27535. if (!(a === m[0] && b === m[1] && c === m[2] && d === m[3])) {
  27536. return null;
  27537. }
  27538. var txDiff = e - m[4], tyDiff = f - m[5];
  27539. if (font.vertical && txDiff !== 0 || !font.vertical && tyDiff !== 0) {
  27540. return null;
  27541. }
  27542. var tx, ty, denominator = a * d - b * c;
  27543. if (font.vertical) {
  27544. tx = -tyDiff * c / denominator;
  27545. ty = tyDiff * a / denominator;
  27546. } else {
  27547. tx = txDiff * d / denominator;
  27548. ty = -txDiff * b / denominator;
  27549. }
  27550. return {
  27551. width: tx,
  27552. height: ty,
  27553. value: font.vertical ? ty : tx
  27554. };
  27555. },
  27556. calcRenderMatrix: function TextState_calcRendeMatrix(ctm) {
  27557. var tsm = [
  27558. this.fontSize * this.textHScale,
  27559. 0,
  27560. 0,
  27561. this.fontSize,
  27562. 0,
  27563. this.textRise
  27564. ];
  27565. return Util.transform(ctm, Util.transform(this.textMatrix, tsm));
  27566. },
  27567. carriageReturn: function TextState_carriageReturn() {
  27568. this.translateTextLineMatrix(0, -this.leading);
  27569. this.textMatrix = this.textLineMatrix.slice();
  27570. },
  27571. clone: function TextState_clone() {
  27572. var clone = Object.create(this);
  27573. clone.textMatrix = this.textMatrix.slice();
  27574. clone.textLineMatrix = this.textLineMatrix.slice();
  27575. clone.fontMatrix = this.fontMatrix.slice();
  27576. return clone;
  27577. }
  27578. };
  27579. return TextState;
  27580. }();
  27581. var EvalState = function EvalStateClosure() {
  27582. function EvalState() {
  27583. this.ctm = new Float32Array(IDENTITY_MATRIX);
  27584. this.font = null;
  27585. this.textRenderingMode = TextRenderingMode.FILL;
  27586. this.fillColorSpace = ColorSpace.singletons.gray;
  27587. this.strokeColorSpace = ColorSpace.singletons.gray;
  27588. }
  27589. EvalState.prototype = {
  27590. clone: function CanvasExtraState_clone() {
  27591. return Object.create(this);
  27592. }
  27593. };
  27594. return EvalState;
  27595. }();
  27596. var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() {
  27597. var getOPMap = getLookupTableFactory(function (t) {
  27598. t['w'] = {
  27599. id: OPS.setLineWidth,
  27600. numArgs: 1,
  27601. variableArgs: false
  27602. };
  27603. t['J'] = {
  27604. id: OPS.setLineCap,
  27605. numArgs: 1,
  27606. variableArgs: false
  27607. };
  27608. t['j'] = {
  27609. id: OPS.setLineJoin,
  27610. numArgs: 1,
  27611. variableArgs: false
  27612. };
  27613. t['M'] = {
  27614. id: OPS.setMiterLimit,
  27615. numArgs: 1,
  27616. variableArgs: false
  27617. };
  27618. t['d'] = {
  27619. id: OPS.setDash,
  27620. numArgs: 2,
  27621. variableArgs: false
  27622. };
  27623. t['ri'] = {
  27624. id: OPS.setRenderingIntent,
  27625. numArgs: 1,
  27626. variableArgs: false
  27627. };
  27628. t['i'] = {
  27629. id: OPS.setFlatness,
  27630. numArgs: 1,
  27631. variableArgs: false
  27632. };
  27633. t['gs'] = {
  27634. id: OPS.setGState,
  27635. numArgs: 1,
  27636. variableArgs: false
  27637. };
  27638. t['q'] = {
  27639. id: OPS.save,
  27640. numArgs: 0,
  27641. variableArgs: false
  27642. };
  27643. t['Q'] = {
  27644. id: OPS.restore,
  27645. numArgs: 0,
  27646. variableArgs: false
  27647. };
  27648. t['cm'] = {
  27649. id: OPS.transform,
  27650. numArgs: 6,
  27651. variableArgs: false
  27652. };
  27653. t['m'] = {
  27654. id: OPS.moveTo,
  27655. numArgs: 2,
  27656. variableArgs: false
  27657. };
  27658. t['l'] = {
  27659. id: OPS.lineTo,
  27660. numArgs: 2,
  27661. variableArgs: false
  27662. };
  27663. t['c'] = {
  27664. id: OPS.curveTo,
  27665. numArgs: 6,
  27666. variableArgs: false
  27667. };
  27668. t['v'] = {
  27669. id: OPS.curveTo2,
  27670. numArgs: 4,
  27671. variableArgs: false
  27672. };
  27673. t['y'] = {
  27674. id: OPS.curveTo3,
  27675. numArgs: 4,
  27676. variableArgs: false
  27677. };
  27678. t['h'] = {
  27679. id: OPS.closePath,
  27680. numArgs: 0,
  27681. variableArgs: false
  27682. };
  27683. t['re'] = {
  27684. id: OPS.rectangle,
  27685. numArgs: 4,
  27686. variableArgs: false
  27687. };
  27688. t['S'] = {
  27689. id: OPS.stroke,
  27690. numArgs: 0,
  27691. variableArgs: false
  27692. };
  27693. t['s'] = {
  27694. id: OPS.closeStroke,
  27695. numArgs: 0,
  27696. variableArgs: false
  27697. };
  27698. t['f'] = {
  27699. id: OPS.fill,
  27700. numArgs: 0,
  27701. variableArgs: false
  27702. };
  27703. t['F'] = {
  27704. id: OPS.fill,
  27705. numArgs: 0,
  27706. variableArgs: false
  27707. };
  27708. t['f*'] = {
  27709. id: OPS.eoFill,
  27710. numArgs: 0,
  27711. variableArgs: false
  27712. };
  27713. t['B'] = {
  27714. id: OPS.fillStroke,
  27715. numArgs: 0,
  27716. variableArgs: false
  27717. };
  27718. t['B*'] = {
  27719. id: OPS.eoFillStroke,
  27720. numArgs: 0,
  27721. variableArgs: false
  27722. };
  27723. t['b'] = {
  27724. id: OPS.closeFillStroke,
  27725. numArgs: 0,
  27726. variableArgs: false
  27727. };
  27728. t['b*'] = {
  27729. id: OPS.closeEOFillStroke,
  27730. numArgs: 0,
  27731. variableArgs: false
  27732. };
  27733. t['n'] = {
  27734. id: OPS.endPath,
  27735. numArgs: 0,
  27736. variableArgs: false
  27737. };
  27738. t['W'] = {
  27739. id: OPS.clip,
  27740. numArgs: 0,
  27741. variableArgs: false
  27742. };
  27743. t['W*'] = {
  27744. id: OPS.eoClip,
  27745. numArgs: 0,
  27746. variableArgs: false
  27747. };
  27748. t['BT'] = {
  27749. id: OPS.beginText,
  27750. numArgs: 0,
  27751. variableArgs: false
  27752. };
  27753. t['ET'] = {
  27754. id: OPS.endText,
  27755. numArgs: 0,
  27756. variableArgs: false
  27757. };
  27758. t['Tc'] = {
  27759. id: OPS.setCharSpacing,
  27760. numArgs: 1,
  27761. variableArgs: false
  27762. };
  27763. t['Tw'] = {
  27764. id: OPS.setWordSpacing,
  27765. numArgs: 1,
  27766. variableArgs: false
  27767. };
  27768. t['Tz'] = {
  27769. id: OPS.setHScale,
  27770. numArgs: 1,
  27771. variableArgs: false
  27772. };
  27773. t['TL'] = {
  27774. id: OPS.setLeading,
  27775. numArgs: 1,
  27776. variableArgs: false
  27777. };
  27778. t['Tf'] = {
  27779. id: OPS.setFont,
  27780. numArgs: 2,
  27781. variableArgs: false
  27782. };
  27783. t['Tr'] = {
  27784. id: OPS.setTextRenderingMode,
  27785. numArgs: 1,
  27786. variableArgs: false
  27787. };
  27788. t['Ts'] = {
  27789. id: OPS.setTextRise,
  27790. numArgs: 1,
  27791. variableArgs: false
  27792. };
  27793. t['Td'] = {
  27794. id: OPS.moveText,
  27795. numArgs: 2,
  27796. variableArgs: false
  27797. };
  27798. t['TD'] = {
  27799. id: OPS.setLeadingMoveText,
  27800. numArgs: 2,
  27801. variableArgs: false
  27802. };
  27803. t['Tm'] = {
  27804. id: OPS.setTextMatrix,
  27805. numArgs: 6,
  27806. variableArgs: false
  27807. };
  27808. t['T*'] = {
  27809. id: OPS.nextLine,
  27810. numArgs: 0,
  27811. variableArgs: false
  27812. };
  27813. t['Tj'] = {
  27814. id: OPS.showText,
  27815. numArgs: 1,
  27816. variableArgs: false
  27817. };
  27818. t['TJ'] = {
  27819. id: OPS.showSpacedText,
  27820. numArgs: 1,
  27821. variableArgs: false
  27822. };
  27823. t['\''] = {
  27824. id: OPS.nextLineShowText,
  27825. numArgs: 1,
  27826. variableArgs: false
  27827. };
  27828. t['"'] = {
  27829. id: OPS.nextLineSetSpacingShowText,
  27830. numArgs: 3,
  27831. variableArgs: false
  27832. };
  27833. t['d0'] = {
  27834. id: OPS.setCharWidth,
  27835. numArgs: 2,
  27836. variableArgs: false
  27837. };
  27838. t['d1'] = {
  27839. id: OPS.setCharWidthAndBounds,
  27840. numArgs: 6,
  27841. variableArgs: false
  27842. };
  27843. t['CS'] = {
  27844. id: OPS.setStrokeColorSpace,
  27845. numArgs: 1,
  27846. variableArgs: false
  27847. };
  27848. t['cs'] = {
  27849. id: OPS.setFillColorSpace,
  27850. numArgs: 1,
  27851. variableArgs: false
  27852. };
  27853. t['SC'] = {
  27854. id: OPS.setStrokeColor,
  27855. numArgs: 4,
  27856. variableArgs: true
  27857. };
  27858. t['SCN'] = {
  27859. id: OPS.setStrokeColorN,
  27860. numArgs: 33,
  27861. variableArgs: true
  27862. };
  27863. t['sc'] = {
  27864. id: OPS.setFillColor,
  27865. numArgs: 4,
  27866. variableArgs: true
  27867. };
  27868. t['scn'] = {
  27869. id: OPS.setFillColorN,
  27870. numArgs: 33,
  27871. variableArgs: true
  27872. };
  27873. t['G'] = {
  27874. id: OPS.setStrokeGray,
  27875. numArgs: 1,
  27876. variableArgs: false
  27877. };
  27878. t['g'] = {
  27879. id: OPS.setFillGray,
  27880. numArgs: 1,
  27881. variableArgs: false
  27882. };
  27883. t['RG'] = {
  27884. id: OPS.setStrokeRGBColor,
  27885. numArgs: 3,
  27886. variableArgs: false
  27887. };
  27888. t['rg'] = {
  27889. id: OPS.setFillRGBColor,
  27890. numArgs: 3,
  27891. variableArgs: false
  27892. };
  27893. t['K'] = {
  27894. id: OPS.setStrokeCMYKColor,
  27895. numArgs: 4,
  27896. variableArgs: false
  27897. };
  27898. t['k'] = {
  27899. id: OPS.setFillCMYKColor,
  27900. numArgs: 4,
  27901. variableArgs: false
  27902. };
  27903. t['sh'] = {
  27904. id: OPS.shadingFill,
  27905. numArgs: 1,
  27906. variableArgs: false
  27907. };
  27908. t['BI'] = {
  27909. id: OPS.beginInlineImage,
  27910. numArgs: 0,
  27911. variableArgs: false
  27912. };
  27913. t['ID'] = {
  27914. id: OPS.beginImageData,
  27915. numArgs: 0,
  27916. variableArgs: false
  27917. };
  27918. t['EI'] = {
  27919. id: OPS.endInlineImage,
  27920. numArgs: 1,
  27921. variableArgs: false
  27922. };
  27923. t['Do'] = {
  27924. id: OPS.paintXObject,
  27925. numArgs: 1,
  27926. variableArgs: false
  27927. };
  27928. t['MP'] = {
  27929. id: OPS.markPoint,
  27930. numArgs: 1,
  27931. variableArgs: false
  27932. };
  27933. t['DP'] = {
  27934. id: OPS.markPointProps,
  27935. numArgs: 2,
  27936. variableArgs: false
  27937. };
  27938. t['BMC'] = {
  27939. id: OPS.beginMarkedContent,
  27940. numArgs: 1,
  27941. variableArgs: false
  27942. };
  27943. t['BDC'] = {
  27944. id: OPS.beginMarkedContentProps,
  27945. numArgs: 2,
  27946. variableArgs: false
  27947. };
  27948. t['EMC'] = {
  27949. id: OPS.endMarkedContent,
  27950. numArgs: 0,
  27951. variableArgs: false
  27952. };
  27953. t['BX'] = {
  27954. id: OPS.beginCompat,
  27955. numArgs: 0,
  27956. variableArgs: false
  27957. };
  27958. t['EX'] = {
  27959. id: OPS.endCompat,
  27960. numArgs: 0,
  27961. variableArgs: false
  27962. };
  27963. t['BM'] = null;
  27964. t['BD'] = null;
  27965. t['true'] = null;
  27966. t['fa'] = null;
  27967. t['fal'] = null;
  27968. t['fals'] = null;
  27969. t['false'] = null;
  27970. t['nu'] = null;
  27971. t['nul'] = null;
  27972. t['null'] = null;
  27973. });
  27974. function EvaluatorPreprocessor(stream, xref, stateManager) {
  27975. this.opMap = getOPMap();
  27976. this.parser = new Parser(new Lexer(stream, this.opMap), false, xref);
  27977. this.stateManager = stateManager;
  27978. this.nonProcessedArgs = [];
  27979. }
  27980. EvaluatorPreprocessor.prototype = {
  27981. get savedStatesDepth() {
  27982. return this.stateManager.stateStack.length;
  27983. },
  27984. read: function EvaluatorPreprocessor_read(operation) {
  27985. var args = operation.args;
  27986. while (true) {
  27987. var obj = this.parser.getObj();
  27988. if (isCmd(obj)) {
  27989. var cmd = obj.cmd;
  27990. var opSpec = this.opMap[cmd];
  27991. if (!opSpec) {
  27992. warn('Unknown command "' + cmd + '"');
  27993. continue;
  27994. }
  27995. var fn = opSpec.id;
  27996. var numArgs = opSpec.numArgs;
  27997. var argsLength = args !== null ? args.length : 0;
  27998. if (!opSpec.variableArgs) {
  27999. if (argsLength !== numArgs) {
  28000. var nonProcessedArgs = this.nonProcessedArgs;
  28001. while (argsLength > numArgs) {
  28002. nonProcessedArgs.push(args.shift());
  28003. argsLength--;
  28004. }
  28005. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  28006. if (args === null) {
  28007. args = [];
  28008. }
  28009. args.unshift(nonProcessedArgs.pop());
  28010. argsLength++;
  28011. }
  28012. }
  28013. if (argsLength < numArgs) {
  28014. warn('Skipping command ' + fn + ': expected ' + numArgs + ' args, but received ' + argsLength + ' args.');
  28015. if (args !== null) {
  28016. args.length = 0;
  28017. }
  28018. continue;
  28019. }
  28020. } else if (argsLength > numArgs) {
  28021. info('Command ' + fn + ': expected [0,' + numArgs + '] args, but received ' + argsLength + ' args.');
  28022. }
  28023. this.preprocessCommand(fn, args);
  28024. operation.fn = fn;
  28025. operation.args = args;
  28026. return true;
  28027. }
  28028. if (isEOF(obj)) {
  28029. return false;
  28030. }
  28031. if (obj !== null) {
  28032. if (args === null) {
  28033. args = [];
  28034. }
  28035. args.push(obj);
  28036. assert(args.length <= 33, 'Too many arguments');
  28037. }
  28038. }
  28039. },
  28040. preprocessCommand: function EvaluatorPreprocessor_preprocessCommand(fn, args) {
  28041. switch (fn | 0) {
  28042. case OPS.save:
  28043. this.stateManager.save();
  28044. break;
  28045. case OPS.restore:
  28046. this.stateManager.restore();
  28047. break;
  28048. case OPS.transform:
  28049. this.stateManager.transform(args);
  28050. break;
  28051. }
  28052. }
  28053. };
  28054. return EvaluatorPreprocessor;
  28055. }();
  28056. var QueueOptimizer = function QueueOptimizerClosure() {
  28057. function addState(parentState, pattern, fn) {
  28058. var state = parentState;
  28059. for (var i = 0, ii = pattern.length - 1; i < ii; i++) {
  28060. var item = pattern[i];
  28061. state = state[item] || (state[item] = []);
  28062. }
  28063. state[pattern[pattern.length - 1]] = fn;
  28064. }
  28065. function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) {
  28066. var iFirstPIMXO = iFirstSave + 2;
  28067. for (var i = 0; i < count; i++) {
  28068. var arg = argsArray[iFirstPIMXO + 4 * i];
  28069. var imageMask = arg.length === 1 && arg[0];
  28070. if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) {
  28071. fnArray[iFirstPIMXO + 4 * i] = OPS.paintSolidColorImageMask;
  28072. continue;
  28073. }
  28074. break;
  28075. }
  28076. return count - i;
  28077. }
  28078. var InitialState = [];
  28079. addState(InitialState, [
  28080. OPS.save,
  28081. OPS.transform,
  28082. OPS.paintInlineImageXObject,
  28083. OPS.restore
  28084. ], function foundInlineImageGroup(context) {
  28085. var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  28086. var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  28087. var MAX_WIDTH = 1000;
  28088. var IMAGE_PADDING = 1;
  28089. var fnArray = context.fnArray, argsArray = context.argsArray;
  28090. var curr = context.iCurr;
  28091. var iFirstSave = curr - 3;
  28092. var iFirstTransform = curr - 2;
  28093. var iFirstPIIXO = curr - 1;
  28094. var i = iFirstSave + 4;
  28095. var ii = fnArray.length;
  28096. while (i + 3 < ii) {
  28097. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintInlineImageXObject || fnArray[i + 3] !== OPS.restore) {
  28098. break;
  28099. }
  28100. i += 4;
  28101. }
  28102. var count = Math.min((i - iFirstSave) / 4, MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  28103. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  28104. return i;
  28105. }
  28106. var maxX = 0;
  28107. var map = [], maxLineHeight = 0;
  28108. var currentX = IMAGE_PADDING, currentY = IMAGE_PADDING;
  28109. var q;
  28110. for (q = 0; q < count; q++) {
  28111. var transform = argsArray[iFirstTransform + (q << 2)];
  28112. var img = argsArray[iFirstPIIXO + (q << 2)][0];
  28113. if (currentX + img.width > MAX_WIDTH) {
  28114. maxX = Math.max(maxX, currentX);
  28115. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  28116. currentX = 0;
  28117. maxLineHeight = 0;
  28118. }
  28119. map.push({
  28120. transform: transform,
  28121. x: currentX,
  28122. y: currentY,
  28123. w: img.width,
  28124. h: img.height
  28125. });
  28126. currentX += img.width + 2 * IMAGE_PADDING;
  28127. maxLineHeight = Math.max(maxLineHeight, img.height);
  28128. }
  28129. var imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  28130. var imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  28131. var imgData = new Uint8Array(imgWidth * imgHeight * 4);
  28132. var imgRowSize = imgWidth << 2;
  28133. for (q = 0; q < count; q++) {
  28134. var data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  28135. var rowSize = map[q].w << 2;
  28136. var dataOffset = 0;
  28137. var offset = map[q].x + map[q].y * imgWidth << 2;
  28138. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  28139. for (var k = 0, kk = map[q].h; k < kk; k++) {
  28140. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  28141. dataOffset += rowSize;
  28142. offset += imgRowSize;
  28143. }
  28144. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  28145. while (offset >= 0) {
  28146. data[offset - 4] = data[offset];
  28147. data[offset - 3] = data[offset + 1];
  28148. data[offset - 2] = data[offset + 2];
  28149. data[offset - 1] = data[offset + 3];
  28150. data[offset + rowSize] = data[offset + rowSize - 4];
  28151. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  28152. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  28153. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  28154. offset -= imgRowSize;
  28155. }
  28156. }
  28157. fnArray.splice(iFirstSave, count * 4, OPS.paintInlineImageXObjectGroup);
  28158. argsArray.splice(iFirstSave, count * 4, [
  28159. {
  28160. width: imgWidth,
  28161. height: imgHeight,
  28162. kind: ImageKind.RGBA_32BPP,
  28163. data: imgData
  28164. },
  28165. map
  28166. ]);
  28167. return iFirstSave + 1;
  28168. });
  28169. addState(InitialState, [
  28170. OPS.save,
  28171. OPS.transform,
  28172. OPS.paintImageMaskXObject,
  28173. OPS.restore
  28174. ], function foundImageMaskGroup(context) {
  28175. var MIN_IMAGES_IN_MASKS_BLOCK = 10;
  28176. var MAX_IMAGES_IN_MASKS_BLOCK = 100;
  28177. var MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  28178. var fnArray = context.fnArray, argsArray = context.argsArray;
  28179. var curr = context.iCurr;
  28180. var iFirstSave = curr - 3;
  28181. var iFirstTransform = curr - 2;
  28182. var iFirstPIMXO = curr - 1;
  28183. var i = iFirstSave + 4;
  28184. var ii = fnArray.length;
  28185. while (i + 3 < ii) {
  28186. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintImageMaskXObject || fnArray[i + 3] !== OPS.restore) {
  28187. break;
  28188. }
  28189. i += 4;
  28190. }
  28191. var count = (i - iFirstSave) / 4;
  28192. count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray);
  28193. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  28194. return i;
  28195. }
  28196. var q;
  28197. var isSameImage = false;
  28198. var iTransform, transformArgs;
  28199. var firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  28200. if (argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0) {
  28201. isSameImage = true;
  28202. var firstTransformArg0 = argsArray[iFirstTransform][0];
  28203. var firstTransformArg3 = argsArray[iFirstTransform][3];
  28204. iTransform = iFirstTransform + 4;
  28205. var iPIMXO = iFirstPIMXO + 4;
  28206. for (q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  28207. transformArgs = argsArray[iTransform];
  28208. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== 0 || transformArgs[2] !== 0 || transformArgs[3] !== firstTransformArg3) {
  28209. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  28210. isSameImage = false;
  28211. } else {
  28212. count = q;
  28213. }
  28214. break;
  28215. }
  28216. }
  28217. }
  28218. if (isSameImage) {
  28219. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  28220. var positions = new Float32Array(count * 2);
  28221. iTransform = iFirstTransform;
  28222. for (q = 0; q < count; q++, iTransform += 4) {
  28223. transformArgs = argsArray[iTransform];
  28224. positions[q << 1] = transformArgs[4];
  28225. positions[(q << 1) + 1] = transformArgs[5];
  28226. }
  28227. fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectRepeat);
  28228. argsArray.splice(iFirstSave, count * 4, [
  28229. firstPIMXOArg0,
  28230. firstTransformArg0,
  28231. firstTransformArg3,
  28232. positions
  28233. ]);
  28234. } else {
  28235. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  28236. var images = [];
  28237. for (q = 0; q < count; q++) {
  28238. transformArgs = argsArray[iFirstTransform + (q << 2)];
  28239. var maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  28240. images.push({
  28241. data: maskParams.data,
  28242. width: maskParams.width,
  28243. height: maskParams.height,
  28244. transform: transformArgs
  28245. });
  28246. }
  28247. fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectGroup);
  28248. argsArray.splice(iFirstSave, count * 4, [images]);
  28249. }
  28250. return iFirstSave + 1;
  28251. });
  28252. addState(InitialState, [
  28253. OPS.save,
  28254. OPS.transform,
  28255. OPS.paintImageXObject,
  28256. OPS.restore
  28257. ], function (context) {
  28258. var MIN_IMAGES_IN_BLOCK = 3;
  28259. var MAX_IMAGES_IN_BLOCK = 1000;
  28260. var fnArray = context.fnArray, argsArray = context.argsArray;
  28261. var curr = context.iCurr;
  28262. var iFirstSave = curr - 3;
  28263. var iFirstTransform = curr - 2;
  28264. var iFirstPIXO = curr - 1;
  28265. var iFirstRestore = curr;
  28266. if (argsArray[iFirstTransform][1] !== 0 || argsArray[iFirstTransform][2] !== 0) {
  28267. return iFirstRestore + 1;
  28268. }
  28269. var firstPIXOArg0 = argsArray[iFirstPIXO][0];
  28270. var firstTransformArg0 = argsArray[iFirstTransform][0];
  28271. var firstTransformArg3 = argsArray[iFirstTransform][3];
  28272. var i = iFirstSave + 4;
  28273. var ii = fnArray.length;
  28274. while (i + 3 < ii) {
  28275. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintImageXObject || fnArray[i + 3] !== OPS.restore) {
  28276. break;
  28277. }
  28278. if (argsArray[i + 1][0] !== firstTransformArg0 || argsArray[i + 1][1] !== 0 || argsArray[i + 1][2] !== 0 || argsArray[i + 1][3] !== firstTransformArg3) {
  28279. break;
  28280. }
  28281. if (argsArray[i + 2][0] !== firstPIXOArg0) {
  28282. break;
  28283. }
  28284. i += 4;
  28285. }
  28286. var count = Math.min((i - iFirstSave) / 4, MAX_IMAGES_IN_BLOCK);
  28287. if (count < MIN_IMAGES_IN_BLOCK) {
  28288. return i;
  28289. }
  28290. var positions = new Float32Array(count * 2);
  28291. var iTransform = iFirstTransform;
  28292. for (var q = 0; q < count; q++, iTransform += 4) {
  28293. var transformArgs = argsArray[iTransform];
  28294. positions[q << 1] = transformArgs[4];
  28295. positions[(q << 1) + 1] = transformArgs[5];
  28296. }
  28297. var args = [
  28298. firstPIXOArg0,
  28299. firstTransformArg0,
  28300. firstTransformArg3,
  28301. positions
  28302. ];
  28303. fnArray.splice(iFirstSave, count * 4, OPS.paintImageXObjectRepeat);
  28304. argsArray.splice(iFirstSave, count * 4, args);
  28305. return iFirstSave + 1;
  28306. });
  28307. addState(InitialState, [
  28308. OPS.beginText,
  28309. OPS.setFont,
  28310. OPS.setTextMatrix,
  28311. OPS.showText,
  28312. OPS.endText
  28313. ], function (context) {
  28314. var MIN_CHARS_IN_BLOCK = 3;
  28315. var MAX_CHARS_IN_BLOCK = 1000;
  28316. var fnArray = context.fnArray, argsArray = context.argsArray;
  28317. var curr = context.iCurr;
  28318. var iFirstBeginText = curr - 4;
  28319. var iFirstSetFont = curr - 3;
  28320. var iFirstSetTextMatrix = curr - 2;
  28321. var iFirstShowText = curr - 1;
  28322. var iFirstEndText = curr;
  28323. var firstSetFontArg0 = argsArray[iFirstSetFont][0];
  28324. var firstSetFontArg1 = argsArray[iFirstSetFont][1];
  28325. var i = iFirstBeginText + 5;
  28326. var ii = fnArray.length;
  28327. while (i + 4 < ii) {
  28328. 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) {
  28329. break;
  28330. }
  28331. if (argsArray[i + 1][0] !== firstSetFontArg0 || argsArray[i + 1][1] !== firstSetFontArg1) {
  28332. break;
  28333. }
  28334. i += 5;
  28335. }
  28336. var count = Math.min((i - iFirstBeginText) / 5, MAX_CHARS_IN_BLOCK);
  28337. if (count < MIN_CHARS_IN_BLOCK) {
  28338. return i;
  28339. }
  28340. var iFirst = iFirstBeginText;
  28341. 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) {
  28342. count++;
  28343. iFirst -= 5;
  28344. }
  28345. var iEndText = iFirst + 4;
  28346. for (var q = 1; q < count; q++) {
  28347. fnArray.splice(iEndText, 3);
  28348. argsArray.splice(iEndText, 3);
  28349. iEndText += 2;
  28350. }
  28351. return iEndText + 1;
  28352. });
  28353. function QueueOptimizer() {
  28354. }
  28355. QueueOptimizer.prototype = {
  28356. optimize: function QueueOptimizer_optimize(queue) {
  28357. var fnArray = queue.fnArray, argsArray = queue.argsArray;
  28358. var context = {
  28359. iCurr: 0,
  28360. fnArray: fnArray,
  28361. argsArray: argsArray
  28362. };
  28363. var state;
  28364. var i = 0, ii = fnArray.length;
  28365. while (i < ii) {
  28366. state = (state || InitialState)[fnArray[i]];
  28367. if (typeof state === 'function') {
  28368. context.iCurr = i;
  28369. i = state(context);
  28370. state = undefined;
  28371. ii = context.fnArray.length;
  28372. } else {
  28373. i++;
  28374. }
  28375. }
  28376. }
  28377. };
  28378. return QueueOptimizer;
  28379. }();
  28380. exports.OperatorList = OperatorList;
  28381. exports.PartialEvaluator = PartialEvaluator;
  28382. /***/ }),
  28383. /* 15 */
  28384. /***/ (function(module, exports, __w_pdfjs_require__) {
  28385. "use strict";
  28386. var sharedUtil = __w_pdfjs_require__(0);
  28387. var coreArithmeticDecoder = __w_pdfjs_require__(10);
  28388. var info = sharedUtil.info;
  28389. var warn = sharedUtil.warn;
  28390. var error = sharedUtil.error;
  28391. var log2 = sharedUtil.log2;
  28392. var readUint16 = sharedUtil.readUint16;
  28393. var readUint32 = sharedUtil.readUint32;
  28394. var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder;
  28395. var JpxImage = function JpxImageClosure() {
  28396. var SubbandsGainLog2 = {
  28397. 'LL': 0,
  28398. 'LH': 1,
  28399. 'HL': 1,
  28400. 'HH': 2
  28401. };
  28402. function JpxImage() {
  28403. this.failOnCorruptedImage = false;
  28404. }
  28405. JpxImage.prototype = {
  28406. parse: function JpxImage_parse(data) {
  28407. var head = readUint16(data, 0);
  28408. if (head === 0xFF4F) {
  28409. this.parseCodestream(data, 0, data.length);
  28410. return;
  28411. }
  28412. var position = 0, length = data.length;
  28413. while (position < length) {
  28414. var headerSize = 8;
  28415. var lbox = readUint32(data, position);
  28416. var tbox = readUint32(data, position + 4);
  28417. position += headerSize;
  28418. if (lbox === 1) {
  28419. lbox = readUint32(data, position) * 4294967296 + readUint32(data, position + 4);
  28420. position += 8;
  28421. headerSize += 8;
  28422. }
  28423. if (lbox === 0) {
  28424. lbox = length - position + headerSize;
  28425. }
  28426. if (lbox < headerSize) {
  28427. error('JPX Error: Invalid box field size');
  28428. }
  28429. var dataLength = lbox - headerSize;
  28430. var jumpDataLength = true;
  28431. switch (tbox) {
  28432. case 0x6A703268:
  28433. jumpDataLength = false;
  28434. break;
  28435. case 0x636F6C72:
  28436. var method = data[position];
  28437. if (method === 1) {
  28438. var colorspace = readUint32(data, position + 3);
  28439. switch (colorspace) {
  28440. case 16:
  28441. case 17:
  28442. case 18:
  28443. break;
  28444. default:
  28445. warn('Unknown colorspace ' + colorspace);
  28446. break;
  28447. }
  28448. } else if (method === 2) {
  28449. info('ICC profile not supported');
  28450. }
  28451. break;
  28452. case 0x6A703263:
  28453. this.parseCodestream(data, position, position + dataLength);
  28454. break;
  28455. case 0x6A502020:
  28456. if (0x0d0a870a !== readUint32(data, position)) {
  28457. warn('Invalid JP2 signature');
  28458. }
  28459. break;
  28460. case 0x6A501A1A:
  28461. case 0x66747970:
  28462. case 0x72726571:
  28463. case 0x72657320:
  28464. case 0x69686472:
  28465. break;
  28466. default:
  28467. var headerType = String.fromCharCode(tbox >> 24 & 0xFF, tbox >> 16 & 0xFF, tbox >> 8 & 0xFF, tbox & 0xFF);
  28468. warn('Unsupported header type ' + tbox + ' (' + headerType + ')');
  28469. break;
  28470. }
  28471. if (jumpDataLength) {
  28472. position += dataLength;
  28473. }
  28474. }
  28475. },
  28476. parseImageProperties: function JpxImage_parseImageProperties(stream) {
  28477. var newByte = stream.getByte();
  28478. while (newByte >= 0) {
  28479. var oldByte = newByte;
  28480. newByte = stream.getByte();
  28481. var code = oldByte << 8 | newByte;
  28482. if (code === 0xFF51) {
  28483. stream.skip(4);
  28484. var Xsiz = stream.getInt32() >>> 0;
  28485. var Ysiz = stream.getInt32() >>> 0;
  28486. var XOsiz = stream.getInt32() >>> 0;
  28487. var YOsiz = stream.getInt32() >>> 0;
  28488. stream.skip(16);
  28489. var Csiz = stream.getUint16();
  28490. this.width = Xsiz - XOsiz;
  28491. this.height = Ysiz - YOsiz;
  28492. this.componentsCount = Csiz;
  28493. this.bitsPerComponent = 8;
  28494. return;
  28495. }
  28496. }
  28497. error('JPX Error: No size marker found in JPX stream');
  28498. },
  28499. parseCodestream: function JpxImage_parseCodestream(data, start, end) {
  28500. var context = {};
  28501. var doNotRecover = false;
  28502. try {
  28503. var position = start;
  28504. while (position + 1 < end) {
  28505. var code = readUint16(data, position);
  28506. position += 2;
  28507. var length = 0, j, sqcd, spqcds, spqcdSize, scalarExpounded, tile;
  28508. switch (code) {
  28509. case 0xFF4F:
  28510. context.mainHeader = true;
  28511. break;
  28512. case 0xFFD9:
  28513. break;
  28514. case 0xFF51:
  28515. length = readUint16(data, position);
  28516. var siz = {};
  28517. siz.Xsiz = readUint32(data, position + 4);
  28518. siz.Ysiz = readUint32(data, position + 8);
  28519. siz.XOsiz = readUint32(data, position + 12);
  28520. siz.YOsiz = readUint32(data, position + 16);
  28521. siz.XTsiz = readUint32(data, position + 20);
  28522. siz.YTsiz = readUint32(data, position + 24);
  28523. siz.XTOsiz = readUint32(data, position + 28);
  28524. siz.YTOsiz = readUint32(data, position + 32);
  28525. var componentsCount = readUint16(data, position + 36);
  28526. siz.Csiz = componentsCount;
  28527. var components = [];
  28528. j = position + 38;
  28529. for (var i = 0; i < componentsCount; i++) {
  28530. var component = {
  28531. precision: (data[j] & 0x7F) + 1,
  28532. isSigned: !!(data[j] & 0x80),
  28533. XRsiz: data[j + 1],
  28534. YRsiz: data[j + 1]
  28535. };
  28536. calculateComponentDimensions(component, siz);
  28537. components.push(component);
  28538. }
  28539. context.SIZ = siz;
  28540. context.components = components;
  28541. calculateTileGrids(context, components);
  28542. context.QCC = [];
  28543. context.COC = [];
  28544. break;
  28545. case 0xFF5C:
  28546. length = readUint16(data, position);
  28547. var qcd = {};
  28548. j = position + 2;
  28549. sqcd = data[j++];
  28550. switch (sqcd & 0x1F) {
  28551. case 0:
  28552. spqcdSize = 8;
  28553. scalarExpounded = true;
  28554. break;
  28555. case 1:
  28556. spqcdSize = 16;
  28557. scalarExpounded = false;
  28558. break;
  28559. case 2:
  28560. spqcdSize = 16;
  28561. scalarExpounded = true;
  28562. break;
  28563. default:
  28564. throw new Error('Invalid SQcd value ' + sqcd);
  28565. }
  28566. qcd.noQuantization = spqcdSize === 8;
  28567. qcd.scalarExpounded = scalarExpounded;
  28568. qcd.guardBits = sqcd >> 5;
  28569. spqcds = [];
  28570. while (j < length + position) {
  28571. var spqcd = {};
  28572. if (spqcdSize === 8) {
  28573. spqcd.epsilon = data[j++] >> 3;
  28574. spqcd.mu = 0;
  28575. } else {
  28576. spqcd.epsilon = data[j] >> 3;
  28577. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  28578. j += 2;
  28579. }
  28580. spqcds.push(spqcd);
  28581. }
  28582. qcd.SPqcds = spqcds;
  28583. if (context.mainHeader) {
  28584. context.QCD = qcd;
  28585. } else {
  28586. context.currentTile.QCD = qcd;
  28587. context.currentTile.QCC = [];
  28588. }
  28589. break;
  28590. case 0xFF5D:
  28591. length = readUint16(data, position);
  28592. var qcc = {};
  28593. j = position + 2;
  28594. var cqcc;
  28595. if (context.SIZ.Csiz < 257) {
  28596. cqcc = data[j++];
  28597. } else {
  28598. cqcc = readUint16(data, j);
  28599. j += 2;
  28600. }
  28601. sqcd = data[j++];
  28602. switch (sqcd & 0x1F) {
  28603. case 0:
  28604. spqcdSize = 8;
  28605. scalarExpounded = true;
  28606. break;
  28607. case 1:
  28608. spqcdSize = 16;
  28609. scalarExpounded = false;
  28610. break;
  28611. case 2:
  28612. spqcdSize = 16;
  28613. scalarExpounded = true;
  28614. break;
  28615. default:
  28616. throw new Error('Invalid SQcd value ' + sqcd);
  28617. }
  28618. qcc.noQuantization = spqcdSize === 8;
  28619. qcc.scalarExpounded = scalarExpounded;
  28620. qcc.guardBits = sqcd >> 5;
  28621. spqcds = [];
  28622. while (j < length + position) {
  28623. spqcd = {};
  28624. if (spqcdSize === 8) {
  28625. spqcd.epsilon = data[j++] >> 3;
  28626. spqcd.mu = 0;
  28627. } else {
  28628. spqcd.epsilon = data[j] >> 3;
  28629. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  28630. j += 2;
  28631. }
  28632. spqcds.push(spqcd);
  28633. }
  28634. qcc.SPqcds = spqcds;
  28635. if (context.mainHeader) {
  28636. context.QCC[cqcc] = qcc;
  28637. } else {
  28638. context.currentTile.QCC[cqcc] = qcc;
  28639. }
  28640. break;
  28641. case 0xFF52:
  28642. length = readUint16(data, position);
  28643. var cod = {};
  28644. j = position + 2;
  28645. var scod = data[j++];
  28646. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  28647. cod.sopMarkerUsed = !!(scod & 2);
  28648. cod.ephMarkerUsed = !!(scod & 4);
  28649. cod.progressionOrder = data[j++];
  28650. cod.layersCount = readUint16(data, j);
  28651. j += 2;
  28652. cod.multipleComponentTransform = data[j++];
  28653. cod.decompositionLevelsCount = data[j++];
  28654. cod.xcb = (data[j++] & 0xF) + 2;
  28655. cod.ycb = (data[j++] & 0xF) + 2;
  28656. var blockStyle = data[j++];
  28657. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  28658. cod.resetContextProbabilities = !!(blockStyle & 2);
  28659. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  28660. cod.verticalyStripe = !!(blockStyle & 8);
  28661. cod.predictableTermination = !!(blockStyle & 16);
  28662. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  28663. cod.reversibleTransformation = data[j++];
  28664. if (cod.entropyCoderWithCustomPrecincts) {
  28665. var precinctsSizes = [];
  28666. while (j < length + position) {
  28667. var precinctsSize = data[j++];
  28668. precinctsSizes.push({
  28669. PPx: precinctsSize & 0xF,
  28670. PPy: precinctsSize >> 4
  28671. });
  28672. }
  28673. cod.precinctsSizes = precinctsSizes;
  28674. }
  28675. var unsupported = [];
  28676. if (cod.selectiveArithmeticCodingBypass) {
  28677. unsupported.push('selectiveArithmeticCodingBypass');
  28678. }
  28679. if (cod.resetContextProbabilities) {
  28680. unsupported.push('resetContextProbabilities');
  28681. }
  28682. if (cod.terminationOnEachCodingPass) {
  28683. unsupported.push('terminationOnEachCodingPass');
  28684. }
  28685. if (cod.verticalyStripe) {
  28686. unsupported.push('verticalyStripe');
  28687. }
  28688. if (cod.predictableTermination) {
  28689. unsupported.push('predictableTermination');
  28690. }
  28691. if (unsupported.length > 0) {
  28692. doNotRecover = true;
  28693. throw new Error('Unsupported COD options (' + unsupported.join(', ') + ')');
  28694. }
  28695. if (context.mainHeader) {
  28696. context.COD = cod;
  28697. } else {
  28698. context.currentTile.COD = cod;
  28699. context.currentTile.COC = [];
  28700. }
  28701. break;
  28702. case 0xFF90:
  28703. length = readUint16(data, position);
  28704. tile = {};
  28705. tile.index = readUint16(data, position + 2);
  28706. tile.length = readUint32(data, position + 4);
  28707. tile.dataEnd = tile.length + position - 2;
  28708. tile.partIndex = data[position + 8];
  28709. tile.partsCount = data[position + 9];
  28710. context.mainHeader = false;
  28711. if (tile.partIndex === 0) {
  28712. tile.COD = context.COD;
  28713. tile.COC = context.COC.slice(0);
  28714. tile.QCD = context.QCD;
  28715. tile.QCC = context.QCC.slice(0);
  28716. }
  28717. context.currentTile = tile;
  28718. break;
  28719. case 0xFF93:
  28720. tile = context.currentTile;
  28721. if (tile.partIndex === 0) {
  28722. initializeTile(context, tile.index);
  28723. buildPackets(context);
  28724. }
  28725. length = tile.dataEnd - position;
  28726. parseTilePackets(context, data, position, length);
  28727. break;
  28728. case 0xFF55:
  28729. case 0xFF57:
  28730. case 0xFF58:
  28731. case 0xFF64:
  28732. length = readUint16(data, position);
  28733. break;
  28734. case 0xFF53:
  28735. throw new Error('Codestream code 0xFF53 (COC) is ' + 'not implemented');
  28736. default:
  28737. throw new Error('Unknown codestream code: ' + code.toString(16));
  28738. }
  28739. position += length;
  28740. }
  28741. } catch (e) {
  28742. if (doNotRecover || this.failOnCorruptedImage) {
  28743. error('JPX Error: ' + e.message);
  28744. } else {
  28745. warn('JPX: Trying to recover from: ' + e.message);
  28746. }
  28747. }
  28748. this.tiles = transformComponents(context);
  28749. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  28750. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  28751. this.componentsCount = context.SIZ.Csiz;
  28752. }
  28753. };
  28754. function calculateComponentDimensions(component, siz) {
  28755. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  28756. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  28757. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  28758. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  28759. component.width = component.x1 - component.x0;
  28760. component.height = component.y1 - component.y0;
  28761. }
  28762. function calculateTileGrids(context, components) {
  28763. var siz = context.SIZ;
  28764. var tile, tiles = [];
  28765. var numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  28766. var numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  28767. for (var q = 0; q < numYtiles; q++) {
  28768. for (var p = 0; p < numXtiles; p++) {
  28769. tile = {};
  28770. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  28771. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  28772. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  28773. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  28774. tile.width = tile.tx1 - tile.tx0;
  28775. tile.height = tile.ty1 - tile.ty0;
  28776. tile.components = [];
  28777. tiles.push(tile);
  28778. }
  28779. }
  28780. context.tiles = tiles;
  28781. var componentsCount = siz.Csiz;
  28782. for (var i = 0, ii = componentsCount; i < ii; i++) {
  28783. var component = components[i];
  28784. for (var j = 0, jj = tiles.length; j < jj; j++) {
  28785. var tileComponent = {};
  28786. tile = tiles[j];
  28787. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  28788. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  28789. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  28790. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  28791. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  28792. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  28793. tile.components[i] = tileComponent;
  28794. }
  28795. }
  28796. }
  28797. function getBlocksDimensions(context, component, r) {
  28798. var codOrCoc = component.codingStyleParameters;
  28799. var result = {};
  28800. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  28801. result.PPx = 15;
  28802. result.PPy = 15;
  28803. } else {
  28804. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  28805. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  28806. }
  28807. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  28808. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  28809. return result;
  28810. }
  28811. function buildPrecincts(context, resolution, dimensions) {
  28812. var precinctWidth = 1 << dimensions.PPx;
  28813. var precinctHeight = 1 << dimensions.PPy;
  28814. var isZeroRes = resolution.resLevel === 0;
  28815. var precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  28816. var precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  28817. var numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  28818. var numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  28819. var numprecincts = numprecinctswide * numprecinctshigh;
  28820. resolution.precinctParameters = {
  28821. precinctWidth: precinctWidth,
  28822. precinctHeight: precinctHeight,
  28823. numprecinctswide: numprecinctswide,
  28824. numprecinctshigh: numprecinctshigh,
  28825. numprecincts: numprecincts,
  28826. precinctWidthInSubband: precinctWidthInSubband,
  28827. precinctHeightInSubband: precinctHeightInSubband
  28828. };
  28829. }
  28830. function buildCodeblocks(context, subband, dimensions) {
  28831. var xcb_ = dimensions.xcb_;
  28832. var ycb_ = dimensions.ycb_;
  28833. var codeblockWidth = 1 << xcb_;
  28834. var codeblockHeight = 1 << ycb_;
  28835. var cbx0 = subband.tbx0 >> xcb_;
  28836. var cby0 = subband.tby0 >> ycb_;
  28837. var cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  28838. var cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  28839. var precinctParameters = subband.resolution.precinctParameters;
  28840. var codeblocks = [];
  28841. var precincts = [];
  28842. var i, j, codeblock, precinctNumber;
  28843. for (j = cby0; j < cby1; j++) {
  28844. for (i = cbx0; i < cbx1; i++) {
  28845. codeblock = {
  28846. cbx: i,
  28847. cby: j,
  28848. tbx0: codeblockWidth * i,
  28849. tby0: codeblockHeight * j,
  28850. tbx1: codeblockWidth * (i + 1),
  28851. tby1: codeblockHeight * (j + 1)
  28852. };
  28853. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  28854. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  28855. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  28856. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  28857. var pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  28858. var pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  28859. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  28860. codeblock.precinctNumber = precinctNumber;
  28861. codeblock.subbandType = subband.type;
  28862. codeblock.Lblock = 3;
  28863. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  28864. continue;
  28865. }
  28866. codeblocks.push(codeblock);
  28867. var precinct = precincts[precinctNumber];
  28868. if (precinct !== undefined) {
  28869. if (i < precinct.cbxMin) {
  28870. precinct.cbxMin = i;
  28871. } else if (i > precinct.cbxMax) {
  28872. precinct.cbxMax = i;
  28873. }
  28874. if (j < precinct.cbyMin) {
  28875. precinct.cbxMin = j;
  28876. } else if (j > precinct.cbyMax) {
  28877. precinct.cbyMax = j;
  28878. }
  28879. } else {
  28880. precincts[precinctNumber] = precinct = {
  28881. cbxMin: i,
  28882. cbyMin: j,
  28883. cbxMax: i,
  28884. cbyMax: j
  28885. };
  28886. }
  28887. codeblock.precinct = precinct;
  28888. }
  28889. }
  28890. subband.codeblockParameters = {
  28891. codeblockWidth: xcb_,
  28892. codeblockHeight: ycb_,
  28893. numcodeblockwide: cbx1 - cbx0 + 1,
  28894. numcodeblockhigh: cby1 - cby0 + 1
  28895. };
  28896. subband.codeblocks = codeblocks;
  28897. subband.precincts = precincts;
  28898. }
  28899. function createPacket(resolution, precinctNumber, layerNumber) {
  28900. var precinctCodeblocks = [];
  28901. var subbands = resolution.subbands;
  28902. for (var i = 0, ii = subbands.length; i < ii; i++) {
  28903. var subband = subbands[i];
  28904. var codeblocks = subband.codeblocks;
  28905. for (var j = 0, jj = codeblocks.length; j < jj; j++) {
  28906. var codeblock = codeblocks[j];
  28907. if (codeblock.precinctNumber !== precinctNumber) {
  28908. continue;
  28909. }
  28910. precinctCodeblocks.push(codeblock);
  28911. }
  28912. }
  28913. return {
  28914. layerNumber: layerNumber,
  28915. codeblocks: precinctCodeblocks
  28916. };
  28917. }
  28918. function LayerResolutionComponentPositionIterator(context) {
  28919. var siz = context.SIZ;
  28920. var tileIndex = context.currentTile.index;
  28921. var tile = context.tiles[tileIndex];
  28922. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  28923. var componentsCount = siz.Csiz;
  28924. var maxDecompositionLevelsCount = 0;
  28925. for (var q = 0; q < componentsCount; q++) {
  28926. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  28927. }
  28928. var l = 0, r = 0, i = 0, k = 0;
  28929. this.nextPacket = function JpxImage_nextPacket() {
  28930. for (; l < layersCount; l++) {
  28931. for (; r <= maxDecompositionLevelsCount; r++) {
  28932. for (; i < componentsCount; i++) {
  28933. var component = tile.components[i];
  28934. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  28935. continue;
  28936. }
  28937. var resolution = component.resolutions[r];
  28938. var numprecincts = resolution.precinctParameters.numprecincts;
  28939. for (; k < numprecincts;) {
  28940. var packet = createPacket(resolution, k, l);
  28941. k++;
  28942. return packet;
  28943. }
  28944. k = 0;
  28945. }
  28946. i = 0;
  28947. }
  28948. r = 0;
  28949. }
  28950. error('JPX Error: Out of packets');
  28951. };
  28952. }
  28953. function ResolutionLayerComponentPositionIterator(context) {
  28954. var siz = context.SIZ;
  28955. var tileIndex = context.currentTile.index;
  28956. var tile = context.tiles[tileIndex];
  28957. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  28958. var componentsCount = siz.Csiz;
  28959. var maxDecompositionLevelsCount = 0;
  28960. for (var q = 0; q < componentsCount; q++) {
  28961. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  28962. }
  28963. var r = 0, l = 0, i = 0, k = 0;
  28964. this.nextPacket = function JpxImage_nextPacket() {
  28965. for (; r <= maxDecompositionLevelsCount; r++) {
  28966. for (; l < layersCount; l++) {
  28967. for (; i < componentsCount; i++) {
  28968. var component = tile.components[i];
  28969. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  28970. continue;
  28971. }
  28972. var resolution = component.resolutions[r];
  28973. var numprecincts = resolution.precinctParameters.numprecincts;
  28974. for (; k < numprecincts;) {
  28975. var packet = createPacket(resolution, k, l);
  28976. k++;
  28977. return packet;
  28978. }
  28979. k = 0;
  28980. }
  28981. i = 0;
  28982. }
  28983. l = 0;
  28984. }
  28985. error('JPX Error: Out of packets');
  28986. };
  28987. }
  28988. function ResolutionPositionComponentLayerIterator(context) {
  28989. var siz = context.SIZ;
  28990. var tileIndex = context.currentTile.index;
  28991. var tile = context.tiles[tileIndex];
  28992. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  28993. var componentsCount = siz.Csiz;
  28994. var l, r, c, p;
  28995. var maxDecompositionLevelsCount = 0;
  28996. for (c = 0; c < componentsCount; c++) {
  28997. var component = tile.components[c];
  28998. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  28999. }
  29000. var maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  29001. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  29002. var maxNumPrecincts = 0;
  29003. for (c = 0; c < componentsCount; ++c) {
  29004. var resolutions = tile.components[c].resolutions;
  29005. if (r < resolutions.length) {
  29006. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  29007. }
  29008. }
  29009. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  29010. }
  29011. l = 0;
  29012. r = 0;
  29013. c = 0;
  29014. p = 0;
  29015. this.nextPacket = function JpxImage_nextPacket() {
  29016. for (; r <= maxDecompositionLevelsCount; r++) {
  29017. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  29018. for (; c < componentsCount; c++) {
  29019. var component = tile.components[c];
  29020. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  29021. continue;
  29022. }
  29023. var resolution = component.resolutions[r];
  29024. var numprecincts = resolution.precinctParameters.numprecincts;
  29025. if (p >= numprecincts) {
  29026. continue;
  29027. }
  29028. for (; l < layersCount;) {
  29029. var packet = createPacket(resolution, p, l);
  29030. l++;
  29031. return packet;
  29032. }
  29033. l = 0;
  29034. }
  29035. c = 0;
  29036. }
  29037. p = 0;
  29038. }
  29039. error('JPX Error: Out of packets');
  29040. };
  29041. }
  29042. function PositionComponentResolutionLayerIterator(context) {
  29043. var siz = context.SIZ;
  29044. var tileIndex = context.currentTile.index;
  29045. var tile = context.tiles[tileIndex];
  29046. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29047. var componentsCount = siz.Csiz;
  29048. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  29049. var precinctsIterationSizes = precinctsSizes;
  29050. var l = 0, r = 0, c = 0, px = 0, py = 0;
  29051. this.nextPacket = function JpxImage_nextPacket() {
  29052. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  29053. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  29054. for (; c < componentsCount; c++) {
  29055. var component = tile.components[c];
  29056. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29057. for (; r <= decompositionLevelsCount; r++) {
  29058. var resolution = component.resolutions[r];
  29059. var sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  29060. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  29061. if (k === null) {
  29062. continue;
  29063. }
  29064. for (; l < layersCount;) {
  29065. var packet = createPacket(resolution, k, l);
  29066. l++;
  29067. return packet;
  29068. }
  29069. l = 0;
  29070. }
  29071. r = 0;
  29072. }
  29073. c = 0;
  29074. }
  29075. px = 0;
  29076. }
  29077. error('JPX Error: Out of packets');
  29078. };
  29079. }
  29080. function ComponentPositionResolutionLayerIterator(context) {
  29081. var siz = context.SIZ;
  29082. var tileIndex = context.currentTile.index;
  29083. var tile = context.tiles[tileIndex];
  29084. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29085. var componentsCount = siz.Csiz;
  29086. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  29087. var l = 0, r = 0, c = 0, px = 0, py = 0;
  29088. this.nextPacket = function JpxImage_nextPacket() {
  29089. for (; c < componentsCount; ++c) {
  29090. var component = tile.components[c];
  29091. var precinctsIterationSizes = precinctsSizes.components[c];
  29092. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29093. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  29094. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  29095. for (; r <= decompositionLevelsCount; r++) {
  29096. var resolution = component.resolutions[r];
  29097. var sizeInImageScale = precinctsIterationSizes.resolutions[r];
  29098. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  29099. if (k === null) {
  29100. continue;
  29101. }
  29102. for (; l < layersCount;) {
  29103. var packet = createPacket(resolution, k, l);
  29104. l++;
  29105. return packet;
  29106. }
  29107. l = 0;
  29108. }
  29109. r = 0;
  29110. }
  29111. px = 0;
  29112. }
  29113. py = 0;
  29114. }
  29115. error('JPX Error: Out of packets');
  29116. };
  29117. }
  29118. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  29119. var posX = pxIndex * precinctIterationSizes.minWidth;
  29120. var posY = pyIndex * precinctIterationSizes.minHeight;
  29121. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  29122. return null;
  29123. }
  29124. var startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  29125. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  29126. }
  29127. function getPrecinctSizesInImageScale(tile) {
  29128. var componentsCount = tile.components.length;
  29129. var minWidth = Number.MAX_VALUE;
  29130. var minHeight = Number.MAX_VALUE;
  29131. var maxNumWide = 0;
  29132. var maxNumHigh = 0;
  29133. var sizePerComponent = new Array(componentsCount);
  29134. for (var c = 0; c < componentsCount; c++) {
  29135. var component = tile.components[c];
  29136. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29137. var sizePerResolution = new Array(decompositionLevelsCount + 1);
  29138. var minWidthCurrentComponent = Number.MAX_VALUE;
  29139. var minHeightCurrentComponent = Number.MAX_VALUE;
  29140. var maxNumWideCurrentComponent = 0;
  29141. var maxNumHighCurrentComponent = 0;
  29142. var scale = 1;
  29143. for (var r = decompositionLevelsCount; r >= 0; --r) {
  29144. var resolution = component.resolutions[r];
  29145. var widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  29146. var heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  29147. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  29148. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  29149. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  29150. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  29151. sizePerResolution[r] = {
  29152. width: widthCurrentResolution,
  29153. height: heightCurrentResolution
  29154. };
  29155. scale <<= 1;
  29156. }
  29157. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  29158. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  29159. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  29160. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  29161. sizePerComponent[c] = {
  29162. resolutions: sizePerResolution,
  29163. minWidth: minWidthCurrentComponent,
  29164. minHeight: minHeightCurrentComponent,
  29165. maxNumWide: maxNumWideCurrentComponent,
  29166. maxNumHigh: maxNumHighCurrentComponent
  29167. };
  29168. }
  29169. return {
  29170. components: sizePerComponent,
  29171. minWidth: minWidth,
  29172. minHeight: minHeight,
  29173. maxNumWide: maxNumWide,
  29174. maxNumHigh: maxNumHigh
  29175. };
  29176. }
  29177. function buildPackets(context) {
  29178. var siz = context.SIZ;
  29179. var tileIndex = context.currentTile.index;
  29180. var tile = context.tiles[tileIndex];
  29181. var componentsCount = siz.Csiz;
  29182. for (var c = 0; c < componentsCount; c++) {
  29183. var component = tile.components[c];
  29184. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29185. var resolutions = [];
  29186. var subbands = [];
  29187. for (var r = 0; r <= decompositionLevelsCount; r++) {
  29188. var blocksDimensions = getBlocksDimensions(context, component, r);
  29189. var resolution = {};
  29190. var scale = 1 << decompositionLevelsCount - r;
  29191. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  29192. resolution.try0 = Math.ceil(component.tcy0 / scale);
  29193. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  29194. resolution.try1 = Math.ceil(component.tcy1 / scale);
  29195. resolution.resLevel = r;
  29196. buildPrecincts(context, resolution, blocksDimensions);
  29197. resolutions.push(resolution);
  29198. var subband;
  29199. if (r === 0) {
  29200. subband = {};
  29201. subband.type = 'LL';
  29202. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  29203. subband.tby0 = Math.ceil(component.tcy0 / scale);
  29204. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  29205. subband.tby1 = Math.ceil(component.tcy1 / scale);
  29206. subband.resolution = resolution;
  29207. buildCodeblocks(context, subband, blocksDimensions);
  29208. subbands.push(subband);
  29209. resolution.subbands = [subband];
  29210. } else {
  29211. var bscale = 1 << decompositionLevelsCount - r + 1;
  29212. var resolutionSubbands = [];
  29213. subband = {};
  29214. subband.type = 'HL';
  29215. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  29216. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  29217. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  29218. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  29219. subband.resolution = resolution;
  29220. buildCodeblocks(context, subband, blocksDimensions);
  29221. subbands.push(subband);
  29222. resolutionSubbands.push(subband);
  29223. subband = {};
  29224. subband.type = 'LH';
  29225. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  29226. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  29227. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  29228. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  29229. subband.resolution = resolution;
  29230. buildCodeblocks(context, subband, blocksDimensions);
  29231. subbands.push(subband);
  29232. resolutionSubbands.push(subband);
  29233. subband = {};
  29234. subband.type = 'HH';
  29235. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  29236. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  29237. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  29238. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  29239. subband.resolution = resolution;
  29240. buildCodeblocks(context, subband, blocksDimensions);
  29241. subbands.push(subband);
  29242. resolutionSubbands.push(subband);
  29243. resolution.subbands = resolutionSubbands;
  29244. }
  29245. }
  29246. component.resolutions = resolutions;
  29247. component.subbands = subbands;
  29248. }
  29249. var progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  29250. switch (progressionOrder) {
  29251. case 0:
  29252. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  29253. break;
  29254. case 1:
  29255. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  29256. break;
  29257. case 2:
  29258. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  29259. break;
  29260. case 3:
  29261. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  29262. break;
  29263. case 4:
  29264. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  29265. break;
  29266. default:
  29267. error('JPX Error: Unsupported progression order ' + progressionOrder);
  29268. }
  29269. }
  29270. function parseTilePackets(context, data, offset, dataLength) {
  29271. var position = 0;
  29272. var buffer, bufferSize = 0, skipNextBit = false;
  29273. function readBits(count) {
  29274. while (bufferSize < count) {
  29275. var b = data[offset + position];
  29276. position++;
  29277. if (skipNextBit) {
  29278. buffer = buffer << 7 | b;
  29279. bufferSize += 7;
  29280. skipNextBit = false;
  29281. } else {
  29282. buffer = buffer << 8 | b;
  29283. bufferSize += 8;
  29284. }
  29285. if (b === 0xFF) {
  29286. skipNextBit = true;
  29287. }
  29288. }
  29289. bufferSize -= count;
  29290. return buffer >>> bufferSize & (1 << count) - 1;
  29291. }
  29292. function skipMarkerIfEqual(value) {
  29293. if (data[offset + position - 1] === 0xFF && data[offset + position] === value) {
  29294. skipBytes(1);
  29295. return true;
  29296. } else if (data[offset + position] === 0xFF && data[offset + position + 1] === value) {
  29297. skipBytes(2);
  29298. return true;
  29299. }
  29300. return false;
  29301. }
  29302. function skipBytes(count) {
  29303. position += count;
  29304. }
  29305. function alignToByte() {
  29306. bufferSize = 0;
  29307. if (skipNextBit) {
  29308. position++;
  29309. skipNextBit = false;
  29310. }
  29311. }
  29312. function readCodingpasses() {
  29313. if (readBits(1) === 0) {
  29314. return 1;
  29315. }
  29316. if (readBits(1) === 0) {
  29317. return 2;
  29318. }
  29319. var value = readBits(2);
  29320. if (value < 3) {
  29321. return value + 3;
  29322. }
  29323. value = readBits(5);
  29324. if (value < 31) {
  29325. return value + 6;
  29326. }
  29327. value = readBits(7);
  29328. return value + 37;
  29329. }
  29330. var tileIndex = context.currentTile.index;
  29331. var tile = context.tiles[tileIndex];
  29332. var sopMarkerUsed = context.COD.sopMarkerUsed;
  29333. var ephMarkerUsed = context.COD.ephMarkerUsed;
  29334. var packetsIterator = tile.packetsIterator;
  29335. while (position < dataLength) {
  29336. alignToByte();
  29337. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  29338. skipBytes(4);
  29339. }
  29340. var packet = packetsIterator.nextPacket();
  29341. if (!readBits(1)) {
  29342. continue;
  29343. }
  29344. var layerNumber = packet.layerNumber;
  29345. var queue = [], codeblock;
  29346. for (var i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  29347. codeblock = packet.codeblocks[i];
  29348. var precinct = codeblock.precinct;
  29349. var codeblockColumn = codeblock.cbx - precinct.cbxMin;
  29350. var codeblockRow = codeblock.cby - precinct.cbyMin;
  29351. var codeblockIncluded = false;
  29352. var firstTimeInclusion = false;
  29353. var valueReady;
  29354. if (codeblock['included'] !== undefined) {
  29355. codeblockIncluded = !!readBits(1);
  29356. } else {
  29357. precinct = codeblock.precinct;
  29358. var inclusionTree, zeroBitPlanesTree;
  29359. if (precinct['inclusionTree'] !== undefined) {
  29360. inclusionTree = precinct.inclusionTree;
  29361. } else {
  29362. var width = precinct.cbxMax - precinct.cbxMin + 1;
  29363. var height = precinct.cbyMax - precinct.cbyMin + 1;
  29364. inclusionTree = new InclusionTree(width, height, layerNumber);
  29365. zeroBitPlanesTree = new TagTree(width, height);
  29366. precinct.inclusionTree = inclusionTree;
  29367. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  29368. }
  29369. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  29370. while (true) {
  29371. if (readBits(1)) {
  29372. valueReady = !inclusionTree.nextLevel();
  29373. if (valueReady) {
  29374. codeblock.included = true;
  29375. codeblockIncluded = firstTimeInclusion = true;
  29376. break;
  29377. }
  29378. } else {
  29379. inclusionTree.incrementValue(layerNumber);
  29380. break;
  29381. }
  29382. }
  29383. }
  29384. }
  29385. if (!codeblockIncluded) {
  29386. continue;
  29387. }
  29388. if (firstTimeInclusion) {
  29389. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  29390. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  29391. while (true) {
  29392. if (readBits(1)) {
  29393. valueReady = !zeroBitPlanesTree.nextLevel();
  29394. if (valueReady) {
  29395. break;
  29396. }
  29397. } else {
  29398. zeroBitPlanesTree.incrementValue();
  29399. }
  29400. }
  29401. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  29402. }
  29403. var codingpasses = readCodingpasses();
  29404. while (readBits(1)) {
  29405. codeblock.Lblock++;
  29406. }
  29407. var codingpassesLog2 = log2(codingpasses);
  29408. var bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  29409. var codedDataLength = readBits(bits);
  29410. queue.push({
  29411. codeblock: codeblock,
  29412. codingpasses: codingpasses,
  29413. dataLength: codedDataLength
  29414. });
  29415. }
  29416. alignToByte();
  29417. if (ephMarkerUsed) {
  29418. skipMarkerIfEqual(0x92);
  29419. }
  29420. while (queue.length > 0) {
  29421. var packetItem = queue.shift();
  29422. codeblock = packetItem.codeblock;
  29423. if (codeblock['data'] === undefined) {
  29424. codeblock.data = [];
  29425. }
  29426. codeblock.data.push({
  29427. data: data,
  29428. start: offset + position,
  29429. end: offset + position + packetItem.dataLength,
  29430. codingpasses: packetItem.codingpasses
  29431. });
  29432. position += packetItem.dataLength;
  29433. }
  29434. }
  29435. return position;
  29436. }
  29437. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) {
  29438. var x0 = subband.tbx0;
  29439. var y0 = subband.tby0;
  29440. var width = subband.tbx1 - subband.tbx0;
  29441. var codeblocks = subband.codeblocks;
  29442. var right = subband.type.charAt(0) === 'H' ? 1 : 0;
  29443. var bottom = subband.type.charAt(1) === 'H' ? levelWidth : 0;
  29444. for (var i = 0, ii = codeblocks.length; i < ii; ++i) {
  29445. var codeblock = codeblocks[i];
  29446. var blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  29447. var blockHeight = codeblock.tby1_ - codeblock.tby0_;
  29448. if (blockWidth === 0 || blockHeight === 0) {
  29449. continue;
  29450. }
  29451. if (codeblock['data'] === undefined) {
  29452. continue;
  29453. }
  29454. var bitModel, currentCodingpassType;
  29455. bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  29456. currentCodingpassType = 2;
  29457. var data = codeblock.data, totalLength = 0, codingpasses = 0;
  29458. var j, jj, dataItem;
  29459. for (j = 0, jj = data.length; j < jj; j++) {
  29460. dataItem = data[j];
  29461. totalLength += dataItem.end - dataItem.start;
  29462. codingpasses += dataItem.codingpasses;
  29463. }
  29464. var encodedData = new Uint8Array(totalLength);
  29465. var position = 0;
  29466. for (j = 0, jj = data.length; j < jj; j++) {
  29467. dataItem = data[j];
  29468. var chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  29469. encodedData.set(chunk, position);
  29470. position += chunk.length;
  29471. }
  29472. var decoder = new ArithmeticDecoder(encodedData, 0, totalLength);
  29473. bitModel.setDecoder(decoder);
  29474. for (j = 0; j < codingpasses; j++) {
  29475. switch (currentCodingpassType) {
  29476. case 0:
  29477. bitModel.runSignificancePropagationPass();
  29478. break;
  29479. case 1:
  29480. bitModel.runMagnitudeRefinementPass();
  29481. break;
  29482. case 2:
  29483. bitModel.runCleanupPass();
  29484. if (segmentationSymbolUsed) {
  29485. bitModel.checkSegmentationSymbol();
  29486. }
  29487. break;
  29488. }
  29489. currentCodingpassType = (currentCodingpassType + 1) % 3;
  29490. }
  29491. var offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  29492. var sign = bitModel.coefficentsSign;
  29493. var magnitude = bitModel.coefficentsMagnitude;
  29494. var bitsDecoded = bitModel.bitsDecoded;
  29495. var magnitudeCorrection = reversible ? 0 : 0.5;
  29496. var k, n, nb;
  29497. position = 0;
  29498. var interleave = subband.type !== 'LL';
  29499. for (j = 0; j < blockHeight; j++) {
  29500. var row = offset / width | 0;
  29501. var levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  29502. for (k = 0; k < blockWidth; k++) {
  29503. n = magnitude[position];
  29504. if (n !== 0) {
  29505. n = (n + magnitudeCorrection) * delta;
  29506. if (sign[position] !== 0) {
  29507. n = -n;
  29508. }
  29509. nb = bitsDecoded[position];
  29510. var pos = interleave ? levelOffset + (offset << 1) : offset;
  29511. if (reversible && nb >= mb) {
  29512. coefficients[pos] = n;
  29513. } else {
  29514. coefficients[pos] = n * (1 << mb - nb);
  29515. }
  29516. }
  29517. offset++;
  29518. position++;
  29519. }
  29520. offset += width - blockWidth;
  29521. }
  29522. }
  29523. }
  29524. function transformTile(context, tile, c) {
  29525. var component = tile.components[c];
  29526. var codingStyleParameters = component.codingStyleParameters;
  29527. var quantizationParameters = component.quantizationParameters;
  29528. var decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  29529. var spqcds = quantizationParameters.SPqcds;
  29530. var scalarExpounded = quantizationParameters.scalarExpounded;
  29531. var guardBits = quantizationParameters.guardBits;
  29532. var segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  29533. var precision = context.components[c].precision;
  29534. var reversible = codingStyleParameters.reversibleTransformation;
  29535. var transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  29536. var subbandCoefficients = [];
  29537. var b = 0;
  29538. for (var i = 0; i <= decompositionLevelsCount; i++) {
  29539. var resolution = component.resolutions[i];
  29540. var width = resolution.trx1 - resolution.trx0;
  29541. var height = resolution.try1 - resolution.try0;
  29542. var coefficients = new Float32Array(width * height);
  29543. for (var j = 0, jj = resolution.subbands.length; j < jj; j++) {
  29544. var mu, epsilon;
  29545. if (!scalarExpounded) {
  29546. mu = spqcds[0].mu;
  29547. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  29548. } else {
  29549. mu = spqcds[b].mu;
  29550. epsilon = spqcds[b].epsilon;
  29551. b++;
  29552. }
  29553. var subband = resolution.subbands[j];
  29554. var gainLog2 = SubbandsGainLog2[subband.type];
  29555. var delta = reversible ? 1 : Math.pow(2, precision + gainLog2 - epsilon) * (1 + mu / 2048);
  29556. var mb = guardBits + epsilon - 1;
  29557. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed);
  29558. }
  29559. subbandCoefficients.push({
  29560. width: width,
  29561. height: height,
  29562. items: coefficients
  29563. });
  29564. }
  29565. var result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  29566. return {
  29567. left: component.tcx0,
  29568. top: component.tcy0,
  29569. width: result.width,
  29570. height: result.height,
  29571. items: result.items
  29572. };
  29573. }
  29574. function transformComponents(context) {
  29575. var siz = context.SIZ;
  29576. var components = context.components;
  29577. var componentsCount = siz.Csiz;
  29578. var resultImages = [];
  29579. for (var i = 0, ii = context.tiles.length; i < ii; i++) {
  29580. var tile = context.tiles[i];
  29581. var transformedTiles = [];
  29582. var c;
  29583. for (c = 0; c < componentsCount; c++) {
  29584. transformedTiles[c] = transformTile(context, tile, c);
  29585. }
  29586. var tile0 = transformedTiles[0];
  29587. var out = new Uint8Array(tile0.items.length * componentsCount);
  29588. var result = {
  29589. left: tile0.left,
  29590. top: tile0.top,
  29591. width: tile0.width,
  29592. height: tile0.height,
  29593. items: out
  29594. };
  29595. var shift, offset, max, min, maxK;
  29596. var pos = 0, j, jj, y0, y1, y2, r, g, b, k, val;
  29597. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  29598. var fourComponents = componentsCount === 4;
  29599. var y0items = transformedTiles[0].items;
  29600. var y1items = transformedTiles[1].items;
  29601. var y2items = transformedTiles[2].items;
  29602. var y3items = fourComponents ? transformedTiles[3].items : null;
  29603. shift = components[0].precision - 8;
  29604. offset = (128 << shift) + 0.5;
  29605. max = 255 * (1 << shift);
  29606. maxK = max * 0.5;
  29607. min = -maxK;
  29608. var component0 = tile.components[0];
  29609. var alpha01 = componentsCount - 3;
  29610. jj = y0items.length;
  29611. if (!component0.codingStyleParameters.reversibleTransformation) {
  29612. for (j = 0; j < jj; j++, pos += alpha01) {
  29613. y0 = y0items[j] + offset;
  29614. y1 = y1items[j];
  29615. y2 = y2items[j];
  29616. r = y0 + 1.402 * y2;
  29617. g = y0 - 0.34413 * y1 - 0.71414 * y2;
  29618. b = y0 + 1.772 * y1;
  29619. out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift;
  29620. out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift;
  29621. out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift;
  29622. }
  29623. } else {
  29624. for (j = 0; j < jj; j++, pos += alpha01) {
  29625. y0 = y0items[j] + offset;
  29626. y1 = y1items[j];
  29627. y2 = y2items[j];
  29628. g = y0 - (y2 + y1 >> 2);
  29629. r = g + y2;
  29630. b = g + y1;
  29631. out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift;
  29632. out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift;
  29633. out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift;
  29634. }
  29635. }
  29636. if (fourComponents) {
  29637. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  29638. k = y3items[j];
  29639. out[pos] = k <= min ? 0 : k >= maxK ? 255 : k + offset >> shift;
  29640. }
  29641. }
  29642. } else {
  29643. for (c = 0; c < componentsCount; c++) {
  29644. var items = transformedTiles[c].items;
  29645. shift = components[c].precision - 8;
  29646. offset = (128 << shift) + 0.5;
  29647. max = 127.5 * (1 << shift);
  29648. min = -max;
  29649. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  29650. val = items[j];
  29651. out[pos] = val <= min ? 0 : val >= max ? 255 : val + offset >> shift;
  29652. pos += componentsCount;
  29653. }
  29654. }
  29655. }
  29656. resultImages.push(result);
  29657. }
  29658. return resultImages;
  29659. }
  29660. function initializeTile(context, tileIndex) {
  29661. var siz = context.SIZ;
  29662. var componentsCount = siz.Csiz;
  29663. var tile = context.tiles[tileIndex];
  29664. for (var c = 0; c < componentsCount; c++) {
  29665. var component = tile.components[c];
  29666. var qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  29667. component.quantizationParameters = qcdOrQcc;
  29668. var codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  29669. component.codingStyleParameters = codOrCoc;
  29670. }
  29671. tile.codingStyleDefaultParameters = context.currentTile.COD;
  29672. }
  29673. var TagTree = function TagTreeClosure() {
  29674. function TagTree(width, height) {
  29675. var levelsLength = log2(Math.max(width, height)) + 1;
  29676. this.levels = [];
  29677. for (var i = 0; i < levelsLength; i++) {
  29678. var level = {
  29679. width: width,
  29680. height: height,
  29681. items: []
  29682. };
  29683. this.levels.push(level);
  29684. width = Math.ceil(width / 2);
  29685. height = Math.ceil(height / 2);
  29686. }
  29687. }
  29688. TagTree.prototype = {
  29689. reset: function TagTree_reset(i, j) {
  29690. var currentLevel = 0, value = 0, level;
  29691. while (currentLevel < this.levels.length) {
  29692. level = this.levels[currentLevel];
  29693. var index = i + j * level.width;
  29694. if (level.items[index] !== undefined) {
  29695. value = level.items[index];
  29696. break;
  29697. }
  29698. level.index = index;
  29699. i >>= 1;
  29700. j >>= 1;
  29701. currentLevel++;
  29702. }
  29703. currentLevel--;
  29704. level = this.levels[currentLevel];
  29705. level.items[level.index] = value;
  29706. this.currentLevel = currentLevel;
  29707. delete this.value;
  29708. },
  29709. incrementValue: function TagTree_incrementValue() {
  29710. var level = this.levels[this.currentLevel];
  29711. level.items[level.index]++;
  29712. },
  29713. nextLevel: function TagTree_nextLevel() {
  29714. var currentLevel = this.currentLevel;
  29715. var level = this.levels[currentLevel];
  29716. var value = level.items[level.index];
  29717. currentLevel--;
  29718. if (currentLevel < 0) {
  29719. this.value = value;
  29720. return false;
  29721. }
  29722. this.currentLevel = currentLevel;
  29723. level = this.levels[currentLevel];
  29724. level.items[level.index] = value;
  29725. return true;
  29726. }
  29727. };
  29728. return TagTree;
  29729. }();
  29730. var InclusionTree = function InclusionTreeClosure() {
  29731. function InclusionTree(width, height, defaultValue) {
  29732. var levelsLength = log2(Math.max(width, height)) + 1;
  29733. this.levels = [];
  29734. for (var i = 0; i < levelsLength; i++) {
  29735. var items = new Uint8Array(width * height);
  29736. for (var j = 0, jj = items.length; j < jj; j++) {
  29737. items[j] = defaultValue;
  29738. }
  29739. var level = {
  29740. width: width,
  29741. height: height,
  29742. items: items
  29743. };
  29744. this.levels.push(level);
  29745. width = Math.ceil(width / 2);
  29746. height = Math.ceil(height / 2);
  29747. }
  29748. }
  29749. InclusionTree.prototype = {
  29750. reset: function InclusionTree_reset(i, j, stopValue) {
  29751. var currentLevel = 0;
  29752. while (currentLevel < this.levels.length) {
  29753. var level = this.levels[currentLevel];
  29754. var index = i + j * level.width;
  29755. level.index = index;
  29756. var value = level.items[index];
  29757. if (value === 0xFF) {
  29758. break;
  29759. }
  29760. if (value > stopValue) {
  29761. this.currentLevel = currentLevel;
  29762. this.propagateValues();
  29763. return false;
  29764. }
  29765. i >>= 1;
  29766. j >>= 1;
  29767. currentLevel++;
  29768. }
  29769. this.currentLevel = currentLevel - 1;
  29770. return true;
  29771. },
  29772. incrementValue: function InclusionTree_incrementValue(stopValue) {
  29773. var level = this.levels[this.currentLevel];
  29774. level.items[level.index] = stopValue + 1;
  29775. this.propagateValues();
  29776. },
  29777. propagateValues: function InclusionTree_propagateValues() {
  29778. var levelIndex = this.currentLevel;
  29779. var level = this.levels[levelIndex];
  29780. var currentValue = level.items[level.index];
  29781. while (--levelIndex >= 0) {
  29782. level = this.levels[levelIndex];
  29783. level.items[level.index] = currentValue;
  29784. }
  29785. },
  29786. nextLevel: function InclusionTree_nextLevel() {
  29787. var currentLevel = this.currentLevel;
  29788. var level = this.levels[currentLevel];
  29789. var value = level.items[level.index];
  29790. level.items[level.index] = 0xFF;
  29791. currentLevel--;
  29792. if (currentLevel < 0) {
  29793. return false;
  29794. }
  29795. this.currentLevel = currentLevel;
  29796. level = this.levels[currentLevel];
  29797. level.items[level.index] = value;
  29798. return true;
  29799. }
  29800. };
  29801. return InclusionTree;
  29802. }();
  29803. var BitModel = function BitModelClosure() {
  29804. var UNIFORM_CONTEXT = 17;
  29805. var RUNLENGTH_CONTEXT = 18;
  29806. var LLAndLHContextsLabel = new Uint8Array([
  29807. 0,
  29808. 5,
  29809. 8,
  29810. 0,
  29811. 3,
  29812. 7,
  29813. 8,
  29814. 0,
  29815. 4,
  29816. 7,
  29817. 8,
  29818. 0,
  29819. 0,
  29820. 0,
  29821. 0,
  29822. 0,
  29823. 1,
  29824. 6,
  29825. 8,
  29826. 0,
  29827. 3,
  29828. 7,
  29829. 8,
  29830. 0,
  29831. 4,
  29832. 7,
  29833. 8,
  29834. 0,
  29835. 0,
  29836. 0,
  29837. 0,
  29838. 0,
  29839. 2,
  29840. 6,
  29841. 8,
  29842. 0,
  29843. 3,
  29844. 7,
  29845. 8,
  29846. 0,
  29847. 4,
  29848. 7,
  29849. 8,
  29850. 0,
  29851. 0,
  29852. 0,
  29853. 0,
  29854. 0,
  29855. 2,
  29856. 6,
  29857. 8,
  29858. 0,
  29859. 3,
  29860. 7,
  29861. 8,
  29862. 0,
  29863. 4,
  29864. 7,
  29865. 8,
  29866. 0,
  29867. 0,
  29868. 0,
  29869. 0,
  29870. 0,
  29871. 2,
  29872. 6,
  29873. 8,
  29874. 0,
  29875. 3,
  29876. 7,
  29877. 8,
  29878. 0,
  29879. 4,
  29880. 7,
  29881. 8
  29882. ]);
  29883. var HLContextLabel = new Uint8Array([
  29884. 0,
  29885. 3,
  29886. 4,
  29887. 0,
  29888. 5,
  29889. 7,
  29890. 7,
  29891. 0,
  29892. 8,
  29893. 8,
  29894. 8,
  29895. 0,
  29896. 0,
  29897. 0,
  29898. 0,
  29899. 0,
  29900. 1,
  29901. 3,
  29902. 4,
  29903. 0,
  29904. 6,
  29905. 7,
  29906. 7,
  29907. 0,
  29908. 8,
  29909. 8,
  29910. 8,
  29911. 0,
  29912. 0,
  29913. 0,
  29914. 0,
  29915. 0,
  29916. 2,
  29917. 3,
  29918. 4,
  29919. 0,
  29920. 6,
  29921. 7,
  29922. 7,
  29923. 0,
  29924. 8,
  29925. 8,
  29926. 8,
  29927. 0,
  29928. 0,
  29929. 0,
  29930. 0,
  29931. 0,
  29932. 2,
  29933. 3,
  29934. 4,
  29935. 0,
  29936. 6,
  29937. 7,
  29938. 7,
  29939. 0,
  29940. 8,
  29941. 8,
  29942. 8,
  29943. 0,
  29944. 0,
  29945. 0,
  29946. 0,
  29947. 0,
  29948. 2,
  29949. 3,
  29950. 4,
  29951. 0,
  29952. 6,
  29953. 7,
  29954. 7,
  29955. 0,
  29956. 8,
  29957. 8,
  29958. 8
  29959. ]);
  29960. var HHContextLabel = new Uint8Array([
  29961. 0,
  29962. 1,
  29963. 2,
  29964. 0,
  29965. 1,
  29966. 2,
  29967. 2,
  29968. 0,
  29969. 2,
  29970. 2,
  29971. 2,
  29972. 0,
  29973. 0,
  29974. 0,
  29975. 0,
  29976. 0,
  29977. 3,
  29978. 4,
  29979. 5,
  29980. 0,
  29981. 4,
  29982. 5,
  29983. 5,
  29984. 0,
  29985. 5,
  29986. 5,
  29987. 5,
  29988. 0,
  29989. 0,
  29990. 0,
  29991. 0,
  29992. 0,
  29993. 6,
  29994. 7,
  29995. 7,
  29996. 0,
  29997. 7,
  29998. 7,
  29999. 7,
  30000. 0,
  30001. 7,
  30002. 7,
  30003. 7,
  30004. 0,
  30005. 0,
  30006. 0,
  30007. 0,
  30008. 0,
  30009. 8,
  30010. 8,
  30011. 8,
  30012. 0,
  30013. 8,
  30014. 8,
  30015. 8,
  30016. 0,
  30017. 8,
  30018. 8,
  30019. 8,
  30020. 0,
  30021. 0,
  30022. 0,
  30023. 0,
  30024. 0,
  30025. 8,
  30026. 8,
  30027. 8,
  30028. 0,
  30029. 8,
  30030. 8,
  30031. 8,
  30032. 0,
  30033. 8,
  30034. 8,
  30035. 8
  30036. ]);
  30037. function BitModel(width, height, subband, zeroBitPlanes, mb) {
  30038. this.width = width;
  30039. this.height = height;
  30040. this.contextLabelTable = subband === 'HH' ? HHContextLabel : subband === 'HL' ? HLContextLabel : LLAndLHContextsLabel;
  30041. var coefficientCount = width * height;
  30042. this.neighborsSignificance = new Uint8Array(coefficientCount);
  30043. this.coefficentsSign = new Uint8Array(coefficientCount);
  30044. this.coefficentsMagnitude = mb > 14 ? new Uint32Array(coefficientCount) : mb > 6 ? new Uint16Array(coefficientCount) : new Uint8Array(coefficientCount);
  30045. this.processingFlags = new Uint8Array(coefficientCount);
  30046. var bitsDecoded = new Uint8Array(coefficientCount);
  30047. if (zeroBitPlanes !== 0) {
  30048. for (var i = 0; i < coefficientCount; i++) {
  30049. bitsDecoded[i] = zeroBitPlanes;
  30050. }
  30051. }
  30052. this.bitsDecoded = bitsDecoded;
  30053. this.reset();
  30054. }
  30055. BitModel.prototype = {
  30056. setDecoder: function BitModel_setDecoder(decoder) {
  30057. this.decoder = decoder;
  30058. },
  30059. reset: function BitModel_reset() {
  30060. this.contexts = new Int8Array(19);
  30061. this.contexts[0] = 4 << 1 | 0;
  30062. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  30063. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  30064. },
  30065. setNeighborsSignificance: function BitModel_setNeighborsSignificance(row, column, index) {
  30066. var neighborsSignificance = this.neighborsSignificance;
  30067. var width = this.width, height = this.height;
  30068. var left = column > 0;
  30069. var right = column + 1 < width;
  30070. var i;
  30071. if (row > 0) {
  30072. i = index - width;
  30073. if (left) {
  30074. neighborsSignificance[i - 1] += 0x10;
  30075. }
  30076. if (right) {
  30077. neighborsSignificance[i + 1] += 0x10;
  30078. }
  30079. neighborsSignificance[i] += 0x04;
  30080. }
  30081. if (row + 1 < height) {
  30082. i = index + width;
  30083. if (left) {
  30084. neighborsSignificance[i - 1] += 0x10;
  30085. }
  30086. if (right) {
  30087. neighborsSignificance[i + 1] += 0x10;
  30088. }
  30089. neighborsSignificance[i] += 0x04;
  30090. }
  30091. if (left) {
  30092. neighborsSignificance[index - 1] += 0x01;
  30093. }
  30094. if (right) {
  30095. neighborsSignificance[index + 1] += 0x01;
  30096. }
  30097. neighborsSignificance[index] |= 0x80;
  30098. },
  30099. runSignificancePropagationPass: function BitModel_runSignificancePropagationPass() {
  30100. var decoder = this.decoder;
  30101. var width = this.width, height = this.height;
  30102. var coefficentsMagnitude = this.coefficentsMagnitude;
  30103. var coefficentsSign = this.coefficentsSign;
  30104. var neighborsSignificance = this.neighborsSignificance;
  30105. var processingFlags = this.processingFlags;
  30106. var contexts = this.contexts;
  30107. var labels = this.contextLabelTable;
  30108. var bitsDecoded = this.bitsDecoded;
  30109. var processedInverseMask = ~1;
  30110. var processedMask = 1;
  30111. var firstMagnitudeBitMask = 2;
  30112. for (var i0 = 0; i0 < height; i0 += 4) {
  30113. for (var j = 0; j < width; j++) {
  30114. var index = i0 * width + j;
  30115. for (var i1 = 0; i1 < 4; i1++, index += width) {
  30116. var i = i0 + i1;
  30117. if (i >= height) {
  30118. break;
  30119. }
  30120. processingFlags[index] &= processedInverseMask;
  30121. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  30122. continue;
  30123. }
  30124. var contextLabel = labels[neighborsSignificance[index]];
  30125. var decision = decoder.readBit(contexts, contextLabel);
  30126. if (decision) {
  30127. var sign = this.decodeSignBit(i, j, index);
  30128. coefficentsSign[index] = sign;
  30129. coefficentsMagnitude[index] = 1;
  30130. this.setNeighborsSignificance(i, j, index);
  30131. processingFlags[index] |= firstMagnitudeBitMask;
  30132. }
  30133. bitsDecoded[index]++;
  30134. processingFlags[index] |= processedMask;
  30135. }
  30136. }
  30137. }
  30138. },
  30139. decodeSignBit: function BitModel_decodeSignBit(row, column, index) {
  30140. var width = this.width, height = this.height;
  30141. var coefficentsMagnitude = this.coefficentsMagnitude;
  30142. var coefficentsSign = this.coefficentsSign;
  30143. var contribution, sign0, sign1, significance1;
  30144. var contextLabel, decoded;
  30145. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  30146. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  30147. sign1 = coefficentsSign[index + 1];
  30148. if (significance1) {
  30149. sign0 = coefficentsSign[index - 1];
  30150. contribution = 1 - sign1 - sign0;
  30151. } else {
  30152. contribution = 1 - sign1 - sign1;
  30153. }
  30154. } else if (significance1) {
  30155. sign0 = coefficentsSign[index - 1];
  30156. contribution = 1 - sign0 - sign0;
  30157. } else {
  30158. contribution = 0;
  30159. }
  30160. var horizontalContribution = 3 * contribution;
  30161. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  30162. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  30163. sign1 = coefficentsSign[index + width];
  30164. if (significance1) {
  30165. sign0 = coefficentsSign[index - width];
  30166. contribution = 1 - sign1 - sign0 + horizontalContribution;
  30167. } else {
  30168. contribution = 1 - sign1 - sign1 + horizontalContribution;
  30169. }
  30170. } else if (significance1) {
  30171. sign0 = coefficentsSign[index - width];
  30172. contribution = 1 - sign0 - sign0 + horizontalContribution;
  30173. } else {
  30174. contribution = horizontalContribution;
  30175. }
  30176. if (contribution >= 0) {
  30177. contextLabel = 9 + contribution;
  30178. decoded = this.decoder.readBit(this.contexts, contextLabel);
  30179. } else {
  30180. contextLabel = 9 - contribution;
  30181. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  30182. }
  30183. return decoded;
  30184. },
  30185. runMagnitudeRefinementPass: function BitModel_runMagnitudeRefinementPass() {
  30186. var decoder = this.decoder;
  30187. var width = this.width, height = this.height;
  30188. var coefficentsMagnitude = this.coefficentsMagnitude;
  30189. var neighborsSignificance = this.neighborsSignificance;
  30190. var contexts = this.contexts;
  30191. var bitsDecoded = this.bitsDecoded;
  30192. var processingFlags = this.processingFlags;
  30193. var processedMask = 1;
  30194. var firstMagnitudeBitMask = 2;
  30195. var length = width * height;
  30196. var width4 = width * 4;
  30197. for (var index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  30198. indexNext = Math.min(length, index0 + width4);
  30199. for (var j = 0; j < width; j++) {
  30200. for (var index = index0 + j; index < indexNext; index += width) {
  30201. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  30202. continue;
  30203. }
  30204. var contextLabel = 16;
  30205. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  30206. processingFlags[index] ^= firstMagnitudeBitMask;
  30207. var significance = neighborsSignificance[index] & 127;
  30208. contextLabel = significance === 0 ? 15 : 14;
  30209. }
  30210. var bit = decoder.readBit(contexts, contextLabel);
  30211. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  30212. bitsDecoded[index]++;
  30213. processingFlags[index] |= processedMask;
  30214. }
  30215. }
  30216. }
  30217. },
  30218. runCleanupPass: function BitModel_runCleanupPass() {
  30219. var decoder = this.decoder;
  30220. var width = this.width, height = this.height;
  30221. var neighborsSignificance = this.neighborsSignificance;
  30222. var coefficentsMagnitude = this.coefficentsMagnitude;
  30223. var coefficentsSign = this.coefficentsSign;
  30224. var contexts = this.contexts;
  30225. var labels = this.contextLabelTable;
  30226. var bitsDecoded = this.bitsDecoded;
  30227. var processingFlags = this.processingFlags;
  30228. var processedMask = 1;
  30229. var firstMagnitudeBitMask = 2;
  30230. var oneRowDown = width;
  30231. var twoRowsDown = width * 2;
  30232. var threeRowsDown = width * 3;
  30233. var iNext;
  30234. for (var i0 = 0; i0 < height; i0 = iNext) {
  30235. iNext = Math.min(i0 + 4, height);
  30236. var indexBase = i0 * width;
  30237. var checkAllEmpty = i0 + 3 < height;
  30238. for (var j = 0; j < width; j++) {
  30239. var index0 = indexBase + j;
  30240. 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;
  30241. var i1 = 0, index = index0;
  30242. var i = i0, sign;
  30243. if (allEmpty) {
  30244. var hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  30245. if (!hasSignificantCoefficent) {
  30246. bitsDecoded[index0]++;
  30247. bitsDecoded[index0 + oneRowDown]++;
  30248. bitsDecoded[index0 + twoRowsDown]++;
  30249. bitsDecoded[index0 + threeRowsDown]++;
  30250. continue;
  30251. }
  30252. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  30253. if (i1 !== 0) {
  30254. i = i0 + i1;
  30255. index += i1 * width;
  30256. }
  30257. sign = this.decodeSignBit(i, j, index);
  30258. coefficentsSign[index] = sign;
  30259. coefficentsMagnitude[index] = 1;
  30260. this.setNeighborsSignificance(i, j, index);
  30261. processingFlags[index] |= firstMagnitudeBitMask;
  30262. index = index0;
  30263. for (var i2 = i0; i2 <= i; i2++, index += width) {
  30264. bitsDecoded[index]++;
  30265. }
  30266. i1++;
  30267. }
  30268. for (i = i0 + i1; i < iNext; i++, index += width) {
  30269. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  30270. continue;
  30271. }
  30272. var contextLabel = labels[neighborsSignificance[index]];
  30273. var decision = decoder.readBit(contexts, contextLabel);
  30274. if (decision === 1) {
  30275. sign = this.decodeSignBit(i, j, index);
  30276. coefficentsSign[index] = sign;
  30277. coefficentsMagnitude[index] = 1;
  30278. this.setNeighborsSignificance(i, j, index);
  30279. processingFlags[index] |= firstMagnitudeBitMask;
  30280. }
  30281. bitsDecoded[index]++;
  30282. }
  30283. }
  30284. }
  30285. },
  30286. checkSegmentationSymbol: function BitModel_checkSegmentationSymbol() {
  30287. var decoder = this.decoder;
  30288. var contexts = this.contexts;
  30289. 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);
  30290. if (symbol !== 0xA) {
  30291. error('JPX Error: Invalid segmentation symbol');
  30292. }
  30293. }
  30294. };
  30295. return BitModel;
  30296. }();
  30297. var Transform = function TransformClosure() {
  30298. function Transform() {
  30299. }
  30300. Transform.prototype.calculate = function transformCalculate(subbands, u0, v0) {
  30301. var ll = subbands[0];
  30302. for (var i = 1, ii = subbands.length; i < ii; i++) {
  30303. ll = this.iterate(ll, subbands[i], u0, v0);
  30304. }
  30305. return ll;
  30306. };
  30307. Transform.prototype.extend = function extend(buffer, offset, size) {
  30308. var i1 = offset - 1, j1 = offset + 1;
  30309. var i2 = offset + size - 2, j2 = offset + size;
  30310. buffer[i1--] = buffer[j1++];
  30311. buffer[j2++] = buffer[i2--];
  30312. buffer[i1--] = buffer[j1++];
  30313. buffer[j2++] = buffer[i2--];
  30314. buffer[i1--] = buffer[j1++];
  30315. buffer[j2++] = buffer[i2--];
  30316. buffer[i1] = buffer[j1];
  30317. buffer[j2] = buffer[i2];
  30318. };
  30319. Transform.prototype.iterate = function Transform_iterate(ll, hl_lh_hh, u0, v0) {
  30320. var llWidth = ll.width, llHeight = ll.height, llItems = ll.items;
  30321. var width = hl_lh_hh.width;
  30322. var height = hl_lh_hh.height;
  30323. var items = hl_lh_hh.items;
  30324. var i, j, k, l, u, v;
  30325. for (k = 0, i = 0; i < llHeight; i++) {
  30326. l = i * 2 * width;
  30327. for (j = 0; j < llWidth; j++, k++, l += 2) {
  30328. items[l] = llItems[k];
  30329. }
  30330. }
  30331. llItems = ll.items = null;
  30332. var bufferPadding = 4;
  30333. var rowBuffer = new Float32Array(width + 2 * bufferPadding);
  30334. if (width === 1) {
  30335. if ((u0 & 1) !== 0) {
  30336. for (v = 0, k = 0; v < height; v++, k += width) {
  30337. items[k] *= 0.5;
  30338. }
  30339. }
  30340. } else {
  30341. for (v = 0, k = 0; v < height; v++, k += width) {
  30342. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  30343. this.extend(rowBuffer, bufferPadding, width);
  30344. this.filter(rowBuffer, bufferPadding, width);
  30345. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  30346. }
  30347. }
  30348. var numBuffers = 16;
  30349. var colBuffers = [];
  30350. for (i = 0; i < numBuffers; i++) {
  30351. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  30352. }
  30353. var b, currentBuffer = 0;
  30354. ll = bufferPadding + height;
  30355. if (height === 1) {
  30356. if ((v0 & 1) !== 0) {
  30357. for (u = 0; u < width; u++) {
  30358. items[u] *= 0.5;
  30359. }
  30360. }
  30361. } else {
  30362. for (u = 0; u < width; u++) {
  30363. if (currentBuffer === 0) {
  30364. numBuffers = Math.min(width - u, numBuffers);
  30365. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  30366. for (b = 0; b < numBuffers; b++) {
  30367. colBuffers[b][l] = items[k + b];
  30368. }
  30369. }
  30370. currentBuffer = numBuffers;
  30371. }
  30372. currentBuffer--;
  30373. var buffer = colBuffers[currentBuffer];
  30374. this.extend(buffer, bufferPadding, height);
  30375. this.filter(buffer, bufferPadding, height);
  30376. if (currentBuffer === 0) {
  30377. k = u - numBuffers + 1;
  30378. for (l = bufferPadding; l < ll; k += width, l++) {
  30379. for (b = 0; b < numBuffers; b++) {
  30380. items[k + b] = colBuffers[b][l];
  30381. }
  30382. }
  30383. }
  30384. }
  30385. }
  30386. return {
  30387. width: width,
  30388. height: height,
  30389. items: items
  30390. };
  30391. };
  30392. return Transform;
  30393. }();
  30394. var IrreversibleTransform = function IrreversibleTransformClosure() {
  30395. function IrreversibleTransform() {
  30396. Transform.call(this);
  30397. }
  30398. IrreversibleTransform.prototype = Object.create(Transform.prototype);
  30399. IrreversibleTransform.prototype.filter = function irreversibleTransformFilter(x, offset, length) {
  30400. var len = length >> 1;
  30401. offset = offset | 0;
  30402. var j, n, current, next;
  30403. var alpha = -1.586134342059924;
  30404. var beta = -0.052980118572961;
  30405. var gamma = 0.882911075530934;
  30406. var delta = 0.443506852043971;
  30407. var K = 1.230174104914001;
  30408. var K_ = 1 / K;
  30409. j = offset - 3;
  30410. for (n = len + 4; n--; j += 2) {
  30411. x[j] *= K_;
  30412. }
  30413. j = offset - 2;
  30414. current = delta * x[j - 1];
  30415. for (n = len + 3; n--; j += 2) {
  30416. next = delta * x[j + 1];
  30417. x[j] = K * x[j] - current - next;
  30418. if (n--) {
  30419. j += 2;
  30420. current = delta * x[j + 1];
  30421. x[j] = K * x[j] - current - next;
  30422. } else {
  30423. break;
  30424. }
  30425. }
  30426. j = offset - 1;
  30427. current = gamma * x[j - 1];
  30428. for (n = len + 2; n--; j += 2) {
  30429. next = gamma * x[j + 1];
  30430. x[j] -= current + next;
  30431. if (n--) {
  30432. j += 2;
  30433. current = gamma * x[j + 1];
  30434. x[j] -= current + next;
  30435. } else {
  30436. break;
  30437. }
  30438. }
  30439. j = offset;
  30440. current = beta * x[j - 1];
  30441. for (n = len + 1; n--; j += 2) {
  30442. next = beta * x[j + 1];
  30443. x[j] -= current + next;
  30444. if (n--) {
  30445. j += 2;
  30446. current = beta * x[j + 1];
  30447. x[j] -= current + next;
  30448. } else {
  30449. break;
  30450. }
  30451. }
  30452. if (len !== 0) {
  30453. j = offset + 1;
  30454. current = alpha * x[j - 1];
  30455. for (n = len; n--; j += 2) {
  30456. next = alpha * x[j + 1];
  30457. x[j] -= current + next;
  30458. if (n--) {
  30459. j += 2;
  30460. current = alpha * x[j + 1];
  30461. x[j] -= current + next;
  30462. } else {
  30463. break;
  30464. }
  30465. }
  30466. }
  30467. };
  30468. return IrreversibleTransform;
  30469. }();
  30470. var ReversibleTransform = function ReversibleTransformClosure() {
  30471. function ReversibleTransform() {
  30472. Transform.call(this);
  30473. }
  30474. ReversibleTransform.prototype = Object.create(Transform.prototype);
  30475. ReversibleTransform.prototype.filter = function reversibleTransformFilter(x, offset, length) {
  30476. var len = length >> 1;
  30477. offset = offset | 0;
  30478. var j, n;
  30479. for (j = offset, n = len + 1; n--; j += 2) {
  30480. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  30481. }
  30482. for (j = offset + 1, n = len; n--; j += 2) {
  30483. x[j] += x[j - 1] + x[j + 1] >> 1;
  30484. }
  30485. };
  30486. return ReversibleTransform;
  30487. }();
  30488. return JpxImage;
  30489. }();
  30490. exports.JpxImage = JpxImage;
  30491. /***/ }),
  30492. /* 16 */
  30493. /***/ (function(module, exports, __w_pdfjs_require__) {
  30494. "use strict";
  30495. var sharedUtil = __w_pdfjs_require__(0);
  30496. var corePrimitives = __w_pdfjs_require__(1);
  30497. var coreCrypto = __w_pdfjs_require__(13);
  30498. var coreParser = __w_pdfjs_require__(5);
  30499. var coreChunkedStream = __w_pdfjs_require__(12);
  30500. var coreColorSpace = __w_pdfjs_require__(3);
  30501. var InvalidPDFException = sharedUtil.InvalidPDFException;
  30502. var MissingDataException = sharedUtil.MissingDataException;
  30503. var XRefParseException = sharedUtil.XRefParseException;
  30504. var assert = sharedUtil.assert;
  30505. var bytesToString = sharedUtil.bytesToString;
  30506. var createPromiseCapability = sharedUtil.createPromiseCapability;
  30507. var error = sharedUtil.error;
  30508. var info = sharedUtil.info;
  30509. var isArray = sharedUtil.isArray;
  30510. var isBool = sharedUtil.isBool;
  30511. var isInt = sharedUtil.isInt;
  30512. var isString = sharedUtil.isString;
  30513. var shadow = sharedUtil.shadow;
  30514. var stringToPDFString = sharedUtil.stringToPDFString;
  30515. var stringToUTF8String = sharedUtil.stringToUTF8String;
  30516. var warn = sharedUtil.warn;
  30517. var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
  30518. var Util = sharedUtil.Util;
  30519. var Ref = corePrimitives.Ref;
  30520. var RefSet = corePrimitives.RefSet;
  30521. var RefSetCache = corePrimitives.RefSetCache;
  30522. var isName = corePrimitives.isName;
  30523. var isCmd = corePrimitives.isCmd;
  30524. var isDict = corePrimitives.isDict;
  30525. var isRef = corePrimitives.isRef;
  30526. var isRefsEqual = corePrimitives.isRefsEqual;
  30527. var isStream = corePrimitives.isStream;
  30528. var CipherTransformFactory = coreCrypto.CipherTransformFactory;
  30529. var Lexer = coreParser.Lexer;
  30530. var Parser = coreParser.Parser;
  30531. var ChunkedStream = coreChunkedStream.ChunkedStream;
  30532. var ColorSpace = coreColorSpace.ColorSpace;
  30533. var Catalog = function CatalogClosure() {
  30534. function Catalog(pdfManager, xref, pageFactory) {
  30535. this.pdfManager = pdfManager;
  30536. this.xref = xref;
  30537. this.catDict = xref.getCatalogObj();
  30538. this.fontCache = new RefSetCache();
  30539. this.builtInCMapCache = Object.create(null);
  30540. assert(isDict(this.catDict), 'catalog object is not a dictionary');
  30541. this.pageFactory = pageFactory;
  30542. this.pagePromises = [];
  30543. }
  30544. Catalog.prototype = {
  30545. get metadata() {
  30546. var streamRef = this.catDict.getRaw('Metadata');
  30547. if (!isRef(streamRef)) {
  30548. return shadow(this, 'metadata', null);
  30549. }
  30550. var encryptMetadata = !this.xref.encrypt ? false : this.xref.encrypt.encryptMetadata;
  30551. var stream = this.xref.fetch(streamRef, !encryptMetadata);
  30552. var metadata;
  30553. if (stream && isDict(stream.dict)) {
  30554. var type = stream.dict.get('Type');
  30555. var subtype = stream.dict.get('Subtype');
  30556. if (isName(type, 'Metadata') && isName(subtype, 'XML')) {
  30557. try {
  30558. metadata = stringToUTF8String(bytesToString(stream.getBytes()));
  30559. } catch (e) {
  30560. info('Skipping invalid metadata.');
  30561. }
  30562. }
  30563. }
  30564. return shadow(this, 'metadata', metadata);
  30565. },
  30566. get toplevelPagesDict() {
  30567. var pagesObj = this.catDict.get('Pages');
  30568. assert(isDict(pagesObj), 'invalid top-level pages dictionary');
  30569. return shadow(this, 'toplevelPagesDict', pagesObj);
  30570. },
  30571. get documentOutline() {
  30572. var obj = null;
  30573. try {
  30574. obj = this.readDocumentOutline();
  30575. } catch (ex) {
  30576. if (ex instanceof MissingDataException) {
  30577. throw ex;
  30578. }
  30579. warn('Unable to read document outline');
  30580. }
  30581. return shadow(this, 'documentOutline', obj);
  30582. },
  30583. readDocumentOutline: function Catalog_readDocumentOutline() {
  30584. var obj = this.catDict.get('Outlines');
  30585. if (!isDict(obj)) {
  30586. return null;
  30587. }
  30588. obj = obj.getRaw('First');
  30589. if (!isRef(obj)) {
  30590. return null;
  30591. }
  30592. var root = { items: [] };
  30593. var queue = [{
  30594. obj: obj,
  30595. parent: root
  30596. }];
  30597. var processed = new RefSet();
  30598. processed.put(obj);
  30599. var xref = this.xref, blackColor = new Uint8Array(3);
  30600. while (queue.length > 0) {
  30601. var i = queue.shift();
  30602. var outlineDict = xref.fetchIfRef(i.obj);
  30603. if (outlineDict === null) {
  30604. continue;
  30605. }
  30606. assert(outlineDict.has('Title'), 'Invalid outline item');
  30607. var data = {
  30608. url: null,
  30609. dest: null
  30610. };
  30611. Catalog.parseDestDictionary({
  30612. destDict: outlineDict,
  30613. resultObj: data,
  30614. docBaseUrl: this.pdfManager.docBaseUrl
  30615. });
  30616. var title = outlineDict.get('Title');
  30617. var flags = outlineDict.get('F') || 0;
  30618. var color = outlineDict.getArray('C'), rgbColor = blackColor;
  30619. if (isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  30620. rgbColor = ColorSpace.singletons.rgb.getRgb(color, 0);
  30621. }
  30622. var outlineItem = {
  30623. dest: data.dest,
  30624. url: data.url,
  30625. unsafeUrl: data.unsafeUrl,
  30626. newWindow: data.newWindow,
  30627. title: stringToPDFString(title),
  30628. color: rgbColor,
  30629. count: outlineDict.get('Count'),
  30630. bold: !!(flags & 2),
  30631. italic: !!(flags & 1),
  30632. items: []
  30633. };
  30634. i.parent.items.push(outlineItem);
  30635. obj = outlineDict.getRaw('First');
  30636. if (isRef(obj) && !processed.has(obj)) {
  30637. queue.push({
  30638. obj: obj,
  30639. parent: outlineItem
  30640. });
  30641. processed.put(obj);
  30642. }
  30643. obj = outlineDict.getRaw('Next');
  30644. if (isRef(obj) && !processed.has(obj)) {
  30645. queue.push({
  30646. obj: obj,
  30647. parent: i.parent
  30648. });
  30649. processed.put(obj);
  30650. }
  30651. }
  30652. return root.items.length > 0 ? root.items : null;
  30653. },
  30654. get numPages() {
  30655. var obj = this.toplevelPagesDict.get('Count');
  30656. assert(isInt(obj), 'page count in top level pages object is not an integer');
  30657. return shadow(this, 'num', obj);
  30658. },
  30659. get destinations() {
  30660. function fetchDestination(dest) {
  30661. return isDict(dest) ? dest.get('D') : dest;
  30662. }
  30663. var xref = this.xref;
  30664. var dests = {}, nameTreeRef, nameDictionaryRef;
  30665. var obj = this.catDict.get('Names');
  30666. if (obj && obj.has('Dests')) {
  30667. nameTreeRef = obj.getRaw('Dests');
  30668. } else if (this.catDict.has('Dests')) {
  30669. nameDictionaryRef = this.catDict.get('Dests');
  30670. }
  30671. if (nameDictionaryRef) {
  30672. obj = nameDictionaryRef;
  30673. obj.forEach(function catalogForEach(key, value) {
  30674. if (!value) {
  30675. return;
  30676. }
  30677. dests[key] = fetchDestination(value);
  30678. });
  30679. }
  30680. if (nameTreeRef) {
  30681. var nameTree = new NameTree(nameTreeRef, xref);
  30682. var names = nameTree.getAll();
  30683. for (var name in names) {
  30684. dests[name] = fetchDestination(names[name]);
  30685. }
  30686. }
  30687. return shadow(this, 'destinations', dests);
  30688. },
  30689. getDestination: function Catalog_getDestination(destinationId) {
  30690. function fetchDestination(dest) {
  30691. return isDict(dest) ? dest.get('D') : dest;
  30692. }
  30693. var xref = this.xref;
  30694. var dest = null, nameTreeRef, nameDictionaryRef;
  30695. var obj = this.catDict.get('Names');
  30696. if (obj && obj.has('Dests')) {
  30697. nameTreeRef = obj.getRaw('Dests');
  30698. } else if (this.catDict.has('Dests')) {
  30699. nameDictionaryRef = this.catDict.get('Dests');
  30700. }
  30701. if (nameDictionaryRef) {
  30702. var value = nameDictionaryRef.get(destinationId);
  30703. if (value) {
  30704. dest = fetchDestination(value);
  30705. }
  30706. }
  30707. if (nameTreeRef) {
  30708. var nameTree = new NameTree(nameTreeRef, xref);
  30709. dest = fetchDestination(nameTree.get(destinationId));
  30710. }
  30711. return dest;
  30712. },
  30713. get pageLabels() {
  30714. var obj = null;
  30715. try {
  30716. obj = this.readPageLabels();
  30717. } catch (ex) {
  30718. if (ex instanceof MissingDataException) {
  30719. throw ex;
  30720. }
  30721. warn('Unable to read page labels.');
  30722. }
  30723. return shadow(this, 'pageLabels', obj);
  30724. },
  30725. readPageLabels: function Catalog_readPageLabels() {
  30726. var obj = this.catDict.getRaw('PageLabels');
  30727. if (!obj) {
  30728. return null;
  30729. }
  30730. var pageLabels = new Array(this.numPages);
  30731. var style = null;
  30732. var prefix = '';
  30733. var numberTree = new NumberTree(obj, this.xref);
  30734. var nums = numberTree.getAll();
  30735. var currentLabel = '', currentIndex = 1;
  30736. for (var i = 0, ii = this.numPages; i < ii; i++) {
  30737. if (i in nums) {
  30738. var labelDict = nums[i];
  30739. assert(isDict(labelDict), 'The PageLabel is not a dictionary.');
  30740. var type = labelDict.get('Type');
  30741. assert(!type || isName(type, 'PageLabel'), 'Invalid type in PageLabel dictionary.');
  30742. var s = labelDict.get('S');
  30743. assert(!s || isName(s), 'Invalid style in PageLabel dictionary.');
  30744. style = s ? s.name : null;
  30745. var p = labelDict.get('P');
  30746. assert(!p || isString(p), 'Invalid prefix in PageLabel dictionary.');
  30747. prefix = p ? stringToPDFString(p) : '';
  30748. var st = labelDict.get('St');
  30749. assert(!st || isInt(st) && st >= 1, 'Invalid start in PageLabel dictionary.');
  30750. currentIndex = st || 1;
  30751. }
  30752. switch (style) {
  30753. case 'D':
  30754. currentLabel = currentIndex;
  30755. break;
  30756. case 'R':
  30757. case 'r':
  30758. currentLabel = Util.toRoman(currentIndex, style === 'r');
  30759. break;
  30760. case 'A':
  30761. case 'a':
  30762. var LIMIT = 26;
  30763. var A_UPPER_CASE = 0x41, A_LOWER_CASE = 0x61;
  30764. var baseCharCode = style === 'a' ? A_LOWER_CASE : A_UPPER_CASE;
  30765. var letterIndex = currentIndex - 1;
  30766. var character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  30767. var charBuf = [];
  30768. for (var j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) {
  30769. charBuf.push(character);
  30770. }
  30771. currentLabel = charBuf.join('');
  30772. break;
  30773. default:
  30774. assert(!style, 'Invalid style "' + style + '" in PageLabel dictionary.');
  30775. }
  30776. pageLabels[i] = prefix + currentLabel;
  30777. currentLabel = '';
  30778. currentIndex++;
  30779. }
  30780. return pageLabels;
  30781. },
  30782. get attachments() {
  30783. var xref = this.xref;
  30784. var attachments = null, nameTreeRef;
  30785. var obj = this.catDict.get('Names');
  30786. if (obj) {
  30787. nameTreeRef = obj.getRaw('EmbeddedFiles');
  30788. }
  30789. if (nameTreeRef) {
  30790. var nameTree = new NameTree(nameTreeRef, xref);
  30791. var names = nameTree.getAll();
  30792. for (var name in names) {
  30793. var fs = new FileSpec(names[name], xref);
  30794. if (!attachments) {
  30795. attachments = Object.create(null);
  30796. }
  30797. attachments[stringToPDFString(name)] = fs.serializable;
  30798. }
  30799. }
  30800. return shadow(this, 'attachments', attachments);
  30801. },
  30802. get javaScript() {
  30803. var xref = this.xref;
  30804. var obj = this.catDict.get('Names');
  30805. var javaScript = [];
  30806. function appendIfJavaScriptDict(jsDict) {
  30807. var type = jsDict.get('S');
  30808. if (!isName(type, 'JavaScript')) {
  30809. return;
  30810. }
  30811. var js = jsDict.get('JS');
  30812. if (isStream(js)) {
  30813. js = bytesToString(js.getBytes());
  30814. } else if (!isString(js)) {
  30815. return;
  30816. }
  30817. javaScript.push(stringToPDFString(js));
  30818. }
  30819. if (obj && obj.has('JavaScript')) {
  30820. var nameTree = new NameTree(obj.getRaw('JavaScript'), xref);
  30821. var names = nameTree.getAll();
  30822. for (var name in names) {
  30823. var jsDict = names[name];
  30824. if (isDict(jsDict)) {
  30825. appendIfJavaScriptDict(jsDict);
  30826. }
  30827. }
  30828. }
  30829. var openactionDict = this.catDict.get('OpenAction');
  30830. if (isDict(openactionDict, 'Action')) {
  30831. var actionType = openactionDict.get('S');
  30832. if (isName(actionType, 'Named')) {
  30833. var action = openactionDict.get('N');
  30834. if (isName(action, 'Print')) {
  30835. javaScript.push('print({});');
  30836. }
  30837. } else {
  30838. appendIfJavaScriptDict(openactionDict);
  30839. }
  30840. }
  30841. return shadow(this, 'javaScript', javaScript);
  30842. },
  30843. cleanup: function Catalog_cleanup() {
  30844. var promises = [];
  30845. this.fontCache.forEach(function (promise) {
  30846. promises.push(promise);
  30847. });
  30848. return Promise.all(promises).then(function (translatedFonts) {
  30849. for (var i = 0, ii = translatedFonts.length; i < ii; i++) {
  30850. var font = translatedFonts[i].dict;
  30851. delete font.translated;
  30852. }
  30853. this.fontCache.clear();
  30854. this.builtInCMapCache = Object.create(null);
  30855. }.bind(this));
  30856. },
  30857. getPage: function Catalog_getPage(pageIndex) {
  30858. if (!(pageIndex in this.pagePromises)) {
  30859. this.pagePromises[pageIndex] = this.getPageDict(pageIndex).then(function (a) {
  30860. var dict = a[0];
  30861. var ref = a[1];
  30862. return this.pageFactory.createPage(pageIndex, dict, ref, this.fontCache, this.builtInCMapCache);
  30863. }.bind(this));
  30864. }
  30865. return this.pagePromises[pageIndex];
  30866. },
  30867. getPageDict: function Catalog_getPageDict(pageIndex) {
  30868. var capability = createPromiseCapability();
  30869. var nodesToVisit = [this.catDict.getRaw('Pages')];
  30870. var currentPageIndex = 0;
  30871. var xref = this.xref;
  30872. function next() {
  30873. while (nodesToVisit.length) {
  30874. var currentNode = nodesToVisit.pop();
  30875. if (isRef(currentNode)) {
  30876. xref.fetchAsync(currentNode).then(function (obj) {
  30877. if (isDict(obj, 'Page') || isDict(obj) && !obj.has('Kids')) {
  30878. if (pageIndex === currentPageIndex) {
  30879. capability.resolve([
  30880. obj,
  30881. currentNode
  30882. ]);
  30883. } else {
  30884. currentPageIndex++;
  30885. next();
  30886. }
  30887. return;
  30888. }
  30889. nodesToVisit.push(obj);
  30890. next();
  30891. }, capability.reject);
  30892. return;
  30893. }
  30894. assert(isDict(currentNode), 'page dictionary kid reference points to wrong type of object');
  30895. var count = currentNode.get('Count');
  30896. if (currentPageIndex + count <= pageIndex) {
  30897. currentPageIndex += count;
  30898. continue;
  30899. }
  30900. var kids = currentNode.get('Kids');
  30901. assert(isArray(kids), 'page dictionary kids object is not an array');
  30902. for (var last = kids.length - 1; last >= 0; last--) {
  30903. nodesToVisit.push(kids[last]);
  30904. }
  30905. }
  30906. capability.reject('Page index ' + pageIndex + ' not found.');
  30907. }
  30908. next();
  30909. return capability.promise;
  30910. },
  30911. getPageIndex: function Catalog_getPageIndex(pageRef) {
  30912. var xref = this.xref;
  30913. function pagesBeforeRef(kidRef) {
  30914. var total = 0;
  30915. var parentRef;
  30916. return xref.fetchAsync(kidRef).then(function (node) {
  30917. if (isRefsEqual(kidRef, pageRef) && !isDict(node, 'Page') && !(isDict(node) && !node.has('Type') && node.has('Contents'))) {
  30918. throw new Error('The reference does not point to a /Page Dict.');
  30919. }
  30920. if (!node) {
  30921. return null;
  30922. }
  30923. assert(isDict(node), 'node must be a Dict.');
  30924. parentRef = node.getRaw('Parent');
  30925. return node.getAsync('Parent');
  30926. }).then(function (parent) {
  30927. if (!parent) {
  30928. return null;
  30929. }
  30930. assert(isDict(parent), 'parent must be a Dict.');
  30931. return parent.getAsync('Kids');
  30932. }).then(function (kids) {
  30933. if (!kids) {
  30934. return null;
  30935. }
  30936. var kidPromises = [];
  30937. var found = false;
  30938. for (var i = 0; i < kids.length; i++) {
  30939. var kid = kids[i];
  30940. assert(isRef(kid), 'kid must be a Ref.');
  30941. if (kid.num === kidRef.num) {
  30942. found = true;
  30943. break;
  30944. }
  30945. kidPromises.push(xref.fetchAsync(kid).then(function (kid) {
  30946. if (kid.has('Count')) {
  30947. var count = kid.get('Count');
  30948. total += count;
  30949. } else {
  30950. total++;
  30951. }
  30952. }));
  30953. }
  30954. if (!found) {
  30955. error('kid ref not found in parents kids');
  30956. }
  30957. return Promise.all(kidPromises).then(function () {
  30958. return [
  30959. total,
  30960. parentRef
  30961. ];
  30962. });
  30963. });
  30964. }
  30965. var total = 0;
  30966. function next(ref) {
  30967. return pagesBeforeRef(ref).then(function (args) {
  30968. if (!args) {
  30969. return total;
  30970. }
  30971. var count = args[0];
  30972. var parentRef = args[1];
  30973. total += count;
  30974. return next(parentRef);
  30975. });
  30976. }
  30977. return next(pageRef);
  30978. }
  30979. };
  30980. Catalog.parseDestDictionary = function Catalog_parseDestDictionary(params) {
  30981. function addDefaultProtocolToUrl(url) {
  30982. if (url.indexOf('www.') === 0) {
  30983. return 'http://' + url;
  30984. }
  30985. return url;
  30986. }
  30987. function tryConvertUrlEncoding(url) {
  30988. try {
  30989. return stringToUTF8String(url);
  30990. } catch (e) {
  30991. return url;
  30992. }
  30993. }
  30994. var destDict = params.destDict;
  30995. if (!isDict(destDict)) {
  30996. warn('Catalog_parseDestDictionary: "destDict" must be a dictionary.');
  30997. return;
  30998. }
  30999. var resultObj = params.resultObj;
  31000. if (typeof resultObj !== 'object') {
  31001. warn('Catalog_parseDestDictionary: "resultObj" must be an object.');
  31002. return;
  31003. }
  31004. var docBaseUrl = params.docBaseUrl || null;
  31005. var action = destDict.get('A'), url, dest;
  31006. if (isDict(action)) {
  31007. var linkType = action.get('S').name;
  31008. switch (linkType) {
  31009. case 'URI':
  31010. url = action.get('URI');
  31011. if (isName(url)) {
  31012. url = '/' + url.name;
  31013. } else if (isString(url)) {
  31014. url = addDefaultProtocolToUrl(url);
  31015. }
  31016. break;
  31017. case 'GoTo':
  31018. dest = action.get('D');
  31019. break;
  31020. case 'Launch':
  31021. case 'GoToR':
  31022. var urlDict = action.get('F');
  31023. if (isDict(urlDict)) {
  31024. url = urlDict.get('F') || null;
  31025. } else if (isString(urlDict)) {
  31026. url = urlDict;
  31027. }
  31028. var remoteDest = action.get('D');
  31029. if (remoteDest) {
  31030. if (isName(remoteDest)) {
  31031. remoteDest = remoteDest.name;
  31032. }
  31033. if (isString(url)) {
  31034. var baseUrl = url.split('#')[0];
  31035. if (isString(remoteDest)) {
  31036. url = baseUrl + '#' + (/^\d+$/.test(remoteDest) ? 'nameddest=' : '') + remoteDest;
  31037. } else if (isArray(remoteDest)) {
  31038. url = baseUrl + '#' + JSON.stringify(remoteDest);
  31039. }
  31040. }
  31041. }
  31042. var newWindow = action.get('NewWindow');
  31043. if (isBool(newWindow)) {
  31044. resultObj.newWindow = newWindow;
  31045. }
  31046. break;
  31047. case 'Named':
  31048. var namedAction = action.get('N');
  31049. if (isName(namedAction)) {
  31050. resultObj.action = namedAction.name;
  31051. }
  31052. break;
  31053. case 'JavaScript':
  31054. var jsAction = action.get('JS'), js;
  31055. if (isStream(jsAction)) {
  31056. js = bytesToString(jsAction.getBytes());
  31057. } else if (isString(jsAction)) {
  31058. js = jsAction;
  31059. }
  31060. if (js) {
  31061. var URL_OPEN_METHODS = [
  31062. 'app.launchURL',
  31063. 'window.open'
  31064. ];
  31065. var regex = new RegExp('^\\s*(' + URL_OPEN_METHODS.join('|').split('.').join('\\.') + ')\\((?:\'|\")([^\'\"]*)(?:\'|\")(?:,\\s*(\\w+)\\)|\\))', 'i');
  31066. var jsUrl = regex.exec(stringToPDFString(js));
  31067. if (jsUrl && jsUrl[2]) {
  31068. url = jsUrl[2];
  31069. if (jsUrl[3] === 'true' && jsUrl[1] === 'app.launchURL') {
  31070. resultObj.newWindow = true;
  31071. }
  31072. break;
  31073. }
  31074. }
  31075. default:
  31076. warn('Catalog_parseDestDictionary: Unrecognized link type "' + linkType + '".');
  31077. break;
  31078. }
  31079. } else if (destDict.has('Dest')) {
  31080. dest = destDict.get('Dest');
  31081. }
  31082. if (isString(url)) {
  31083. url = tryConvertUrlEncoding(url);
  31084. var absoluteUrl = createValidAbsoluteUrl(url, docBaseUrl);
  31085. if (absoluteUrl) {
  31086. resultObj.url = absoluteUrl.href;
  31087. }
  31088. resultObj.unsafeUrl = url;
  31089. }
  31090. if (dest) {
  31091. if (isName(dest)) {
  31092. dest = dest.name;
  31093. }
  31094. if (isString(dest) || isArray(dest)) {
  31095. resultObj.dest = dest;
  31096. }
  31097. }
  31098. };
  31099. return Catalog;
  31100. }();
  31101. var XRef = function XRefClosure() {
  31102. function XRef(stream, pdfManager) {
  31103. this.stream = stream;
  31104. this.pdfManager = pdfManager;
  31105. this.entries = [];
  31106. this.xrefstms = Object.create(null);
  31107. this.cache = [];
  31108. this.stats = {
  31109. streamTypes: [],
  31110. fontTypes: []
  31111. };
  31112. }
  31113. XRef.prototype = {
  31114. setStartXRef: function XRef_setStartXRef(startXRef) {
  31115. this.startXRefQueue = [startXRef];
  31116. },
  31117. parse: function XRef_parse(recoveryMode) {
  31118. var trailerDict;
  31119. if (!recoveryMode) {
  31120. trailerDict = this.readXRef();
  31121. } else {
  31122. warn('Indexing all PDF objects');
  31123. trailerDict = this.indexObjects();
  31124. }
  31125. trailerDict.assignXref(this);
  31126. this.trailer = trailerDict;
  31127. var encrypt = trailerDict.get('Encrypt');
  31128. if (isDict(encrypt)) {
  31129. var ids = trailerDict.get('ID');
  31130. var fileId = ids && ids.length ? ids[0] : '';
  31131. encrypt.suppressEncryption = true;
  31132. this.encrypt = new CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  31133. }
  31134. if (!(this.root = trailerDict.get('Root'))) {
  31135. error('Invalid root reference');
  31136. }
  31137. },
  31138. processXRefTable: function XRef_processXRefTable(parser) {
  31139. if (!('tableState' in this)) {
  31140. this.tableState = {
  31141. entryNum: 0,
  31142. streamPos: parser.lexer.stream.pos,
  31143. parserBuf1: parser.buf1,
  31144. parserBuf2: parser.buf2
  31145. };
  31146. }
  31147. var obj = this.readXRefTable(parser);
  31148. if (!isCmd(obj, 'trailer')) {
  31149. error('Invalid XRef table: could not find trailer dictionary');
  31150. }
  31151. var dict = parser.getObj();
  31152. if (!isDict(dict) && dict.dict) {
  31153. dict = dict.dict;
  31154. }
  31155. if (!isDict(dict)) {
  31156. error('Invalid XRef table: could not parse trailer dictionary');
  31157. }
  31158. delete this.tableState;
  31159. return dict;
  31160. },
  31161. readXRefTable: function XRef_readXRefTable(parser) {
  31162. var stream = parser.lexer.stream;
  31163. var tableState = this.tableState;
  31164. stream.pos = tableState.streamPos;
  31165. parser.buf1 = tableState.parserBuf1;
  31166. parser.buf2 = tableState.parserBuf2;
  31167. var obj;
  31168. while (true) {
  31169. if (!('firstEntryNum' in tableState) || !('entryCount' in tableState)) {
  31170. if (isCmd(obj = parser.getObj(), 'trailer')) {
  31171. break;
  31172. }
  31173. tableState.firstEntryNum = obj;
  31174. tableState.entryCount = parser.getObj();
  31175. }
  31176. var first = tableState.firstEntryNum;
  31177. var count = tableState.entryCount;
  31178. if (!isInt(first) || !isInt(count)) {
  31179. error('Invalid XRef table: wrong types in subsection header');
  31180. }
  31181. for (var i = tableState.entryNum; i < count; i++) {
  31182. tableState.streamPos = stream.pos;
  31183. tableState.entryNum = i;
  31184. tableState.parserBuf1 = parser.buf1;
  31185. tableState.parserBuf2 = parser.buf2;
  31186. var entry = {};
  31187. entry.offset = parser.getObj();
  31188. entry.gen = parser.getObj();
  31189. var type = parser.getObj();
  31190. if (isCmd(type, 'f')) {
  31191. entry.free = true;
  31192. } else if (isCmd(type, 'n')) {
  31193. entry.uncompressed = true;
  31194. }
  31195. if (!isInt(entry.offset) || !isInt(entry.gen) || !(entry.free || entry.uncompressed)) {
  31196. error('Invalid entry in XRef subsection: ' + first + ', ' + count);
  31197. }
  31198. if (i === 0 && entry.free && first === 1) {
  31199. first = 0;
  31200. }
  31201. if (!this.entries[i + first]) {
  31202. this.entries[i + first] = entry;
  31203. }
  31204. }
  31205. tableState.entryNum = 0;
  31206. tableState.streamPos = stream.pos;
  31207. tableState.parserBuf1 = parser.buf1;
  31208. tableState.parserBuf2 = parser.buf2;
  31209. delete tableState.firstEntryNum;
  31210. delete tableState.entryCount;
  31211. }
  31212. if (this.entries[0] && !this.entries[0].free) {
  31213. error('Invalid XRef table: unexpected first object');
  31214. }
  31215. return obj;
  31216. },
  31217. processXRefStream: function XRef_processXRefStream(stream) {
  31218. if (!('streamState' in this)) {
  31219. var streamParameters = stream.dict;
  31220. var byteWidths = streamParameters.get('W');
  31221. var range = streamParameters.get('Index');
  31222. if (!range) {
  31223. range = [
  31224. 0,
  31225. streamParameters.get('Size')
  31226. ];
  31227. }
  31228. this.streamState = {
  31229. entryRanges: range,
  31230. byteWidths: byteWidths,
  31231. entryNum: 0,
  31232. streamPos: stream.pos
  31233. };
  31234. }
  31235. this.readXRefStream(stream);
  31236. delete this.streamState;
  31237. return stream.dict;
  31238. },
  31239. readXRefStream: function XRef_readXRefStream(stream) {
  31240. var i, j;
  31241. var streamState = this.streamState;
  31242. stream.pos = streamState.streamPos;
  31243. var byteWidths = streamState.byteWidths;
  31244. var typeFieldWidth = byteWidths[0];
  31245. var offsetFieldWidth = byteWidths[1];
  31246. var generationFieldWidth = byteWidths[2];
  31247. var entryRanges = streamState.entryRanges;
  31248. while (entryRanges.length > 0) {
  31249. var first = entryRanges[0];
  31250. var n = entryRanges[1];
  31251. if (!isInt(first) || !isInt(n)) {
  31252. error('Invalid XRef range fields: ' + first + ', ' + n);
  31253. }
  31254. if (!isInt(typeFieldWidth) || !isInt(offsetFieldWidth) || !isInt(generationFieldWidth)) {
  31255. error('Invalid XRef entry fields length: ' + first + ', ' + n);
  31256. }
  31257. for (i = streamState.entryNum; i < n; ++i) {
  31258. streamState.entryNum = i;
  31259. streamState.streamPos = stream.pos;
  31260. var type = 0, offset = 0, generation = 0;
  31261. for (j = 0; j < typeFieldWidth; ++j) {
  31262. type = type << 8 | stream.getByte();
  31263. }
  31264. if (typeFieldWidth === 0) {
  31265. type = 1;
  31266. }
  31267. for (j = 0; j < offsetFieldWidth; ++j) {
  31268. offset = offset << 8 | stream.getByte();
  31269. }
  31270. for (j = 0; j < generationFieldWidth; ++j) {
  31271. generation = generation << 8 | stream.getByte();
  31272. }
  31273. var entry = {};
  31274. entry.offset = offset;
  31275. entry.gen = generation;
  31276. switch (type) {
  31277. case 0:
  31278. entry.free = true;
  31279. break;
  31280. case 1:
  31281. entry.uncompressed = true;
  31282. break;
  31283. case 2:
  31284. break;
  31285. default:
  31286. error('Invalid XRef entry type: ' + type);
  31287. }
  31288. if (!this.entries[first + i]) {
  31289. this.entries[first + i] = entry;
  31290. }
  31291. }
  31292. streamState.entryNum = 0;
  31293. streamState.streamPos = stream.pos;
  31294. entryRanges.splice(0, 2);
  31295. }
  31296. },
  31297. indexObjects: function XRef_indexObjects() {
  31298. var TAB = 0x9, LF = 0xA, CR = 0xD, SPACE = 0x20;
  31299. var PERCENT = 0x25, LT = 0x3C;
  31300. function readToken(data, offset) {
  31301. var token = '', ch = data[offset];
  31302. while (ch !== LF && ch !== CR && ch !== LT) {
  31303. if (++offset >= data.length) {
  31304. break;
  31305. }
  31306. token += String.fromCharCode(ch);
  31307. ch = data[offset];
  31308. }
  31309. return token;
  31310. }
  31311. function skipUntil(data, offset, what) {
  31312. var length = what.length, dataLength = data.length;
  31313. var skipped = 0;
  31314. while (offset < dataLength) {
  31315. var i = 0;
  31316. while (i < length && data[offset + i] === what[i]) {
  31317. ++i;
  31318. }
  31319. if (i >= length) {
  31320. break;
  31321. }
  31322. offset++;
  31323. skipped++;
  31324. }
  31325. return skipped;
  31326. }
  31327. var objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  31328. var trailerBytes = new Uint8Array([
  31329. 116,
  31330. 114,
  31331. 97,
  31332. 105,
  31333. 108,
  31334. 101,
  31335. 114
  31336. ]);
  31337. var startxrefBytes = new Uint8Array([
  31338. 115,
  31339. 116,
  31340. 97,
  31341. 114,
  31342. 116,
  31343. 120,
  31344. 114,
  31345. 101,
  31346. 102
  31347. ]);
  31348. var endobjBytes = new Uint8Array([
  31349. 101,
  31350. 110,
  31351. 100,
  31352. 111,
  31353. 98,
  31354. 106
  31355. ]);
  31356. var xrefBytes = new Uint8Array([
  31357. 47,
  31358. 88,
  31359. 82,
  31360. 101,
  31361. 102
  31362. ]);
  31363. this.entries.length = 0;
  31364. var stream = this.stream;
  31365. stream.pos = 0;
  31366. var buffer = stream.getBytes();
  31367. var position = stream.start, length = buffer.length;
  31368. var trailers = [], xrefStms = [];
  31369. while (position < length) {
  31370. var ch = buffer[position];
  31371. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  31372. ++position;
  31373. continue;
  31374. }
  31375. if (ch === PERCENT) {
  31376. do {
  31377. ++position;
  31378. if (position >= length) {
  31379. break;
  31380. }
  31381. ch = buffer[position];
  31382. } while (ch !== LF && ch !== CR);
  31383. continue;
  31384. }
  31385. var token = readToken(buffer, position);
  31386. var m;
  31387. if (token.indexOf('xref') === 0 && (token.length === 4 || /\s/.test(token[4]))) {
  31388. position += skipUntil(buffer, position, trailerBytes);
  31389. trailers.push(position);
  31390. position += skipUntil(buffer, position, startxrefBytes);
  31391. } else if (m = objRegExp.exec(token)) {
  31392. if (typeof this.entries[m[1]] === 'undefined') {
  31393. this.entries[m[1]] = {
  31394. offset: position - stream.start,
  31395. gen: m[2] | 0,
  31396. uncompressed: true
  31397. };
  31398. }
  31399. var contentLength = skipUntil(buffer, position, endobjBytes) + 7;
  31400. var content = buffer.subarray(position, position + contentLength);
  31401. var xrefTagOffset = skipUntil(content, 0, xrefBytes);
  31402. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  31403. xrefStms.push(position - stream.start);
  31404. this.xrefstms[position - stream.start] = 1;
  31405. }
  31406. position += contentLength;
  31407. } else if (token.indexOf('trailer') === 0 && (token.length === 7 || /\s/.test(token[7]))) {
  31408. trailers.push(position);
  31409. position += skipUntil(buffer, position, startxrefBytes);
  31410. } else {
  31411. position += token.length + 1;
  31412. }
  31413. }
  31414. var i, ii;
  31415. for (i = 0, ii = xrefStms.length; i < ii; ++i) {
  31416. this.startXRefQueue.push(xrefStms[i]);
  31417. this.readXRef(true);
  31418. }
  31419. var dict;
  31420. for (i = 0, ii = trailers.length; i < ii; ++i) {
  31421. stream.pos = trailers[i];
  31422. var parser = new Parser(new Lexer(stream), true, this, true);
  31423. var obj = parser.getObj();
  31424. if (!isCmd(obj, 'trailer')) {
  31425. continue;
  31426. }
  31427. dict = parser.getObj();
  31428. if (!isDict(dict)) {
  31429. continue;
  31430. }
  31431. if (dict.has('ID')) {
  31432. return dict;
  31433. }
  31434. }
  31435. if (dict) {
  31436. return dict;
  31437. }
  31438. throw new InvalidPDFException('Invalid PDF structure');
  31439. },
  31440. readXRef: function XRef_readXRef(recoveryMode) {
  31441. var stream = this.stream;
  31442. try {
  31443. while (this.startXRefQueue.length) {
  31444. var startXRef = this.startXRefQueue[0];
  31445. stream.pos = startXRef + stream.start;
  31446. var parser = new Parser(new Lexer(stream), true, this);
  31447. var obj = parser.getObj();
  31448. var dict;
  31449. if (isCmd(obj, 'xref')) {
  31450. dict = this.processXRefTable(parser);
  31451. if (!this.topDict) {
  31452. this.topDict = dict;
  31453. }
  31454. obj = dict.get('XRefStm');
  31455. if (isInt(obj)) {
  31456. var pos = obj;
  31457. if (!(pos in this.xrefstms)) {
  31458. this.xrefstms[pos] = 1;
  31459. this.startXRefQueue.push(pos);
  31460. }
  31461. }
  31462. } else if (isInt(obj)) {
  31463. if (!isInt(parser.getObj()) || !isCmd(parser.getObj(), 'obj') || !isStream(obj = parser.getObj())) {
  31464. error('Invalid XRef stream');
  31465. }
  31466. dict = this.processXRefStream(obj);
  31467. if (!this.topDict) {
  31468. this.topDict = dict;
  31469. }
  31470. if (!dict) {
  31471. error('Failed to read XRef stream');
  31472. }
  31473. } else {
  31474. error('Invalid XRef stream header');
  31475. }
  31476. obj = dict.get('Prev');
  31477. if (isInt(obj)) {
  31478. this.startXRefQueue.push(obj);
  31479. } else if (isRef(obj)) {
  31480. this.startXRefQueue.push(obj.num);
  31481. }
  31482. this.startXRefQueue.shift();
  31483. }
  31484. return this.topDict;
  31485. } catch (e) {
  31486. if (e instanceof MissingDataException) {
  31487. throw e;
  31488. }
  31489. info('(while reading XRef): ' + e);
  31490. }
  31491. if (recoveryMode) {
  31492. return;
  31493. }
  31494. throw new XRefParseException();
  31495. },
  31496. getEntry: function XRef_getEntry(i) {
  31497. var xrefEntry = this.entries[i];
  31498. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  31499. return xrefEntry;
  31500. }
  31501. return null;
  31502. },
  31503. fetchIfRef: function XRef_fetchIfRef(obj, suppressEncryption) {
  31504. if (!isRef(obj)) {
  31505. return obj;
  31506. }
  31507. return this.fetch(obj, suppressEncryption);
  31508. },
  31509. fetch: function XRef_fetch(ref, suppressEncryption) {
  31510. assert(isRef(ref), 'ref object is not a reference');
  31511. var num = ref.num;
  31512. if (num in this.cache) {
  31513. var cacheEntry = this.cache[num];
  31514. if (isDict(cacheEntry) && !cacheEntry.objId) {
  31515. cacheEntry.objId = ref.toString();
  31516. }
  31517. return cacheEntry;
  31518. }
  31519. var xrefEntry = this.getEntry(num);
  31520. if (xrefEntry === null) {
  31521. return this.cache[num] = null;
  31522. }
  31523. if (xrefEntry.uncompressed) {
  31524. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  31525. } else {
  31526. xrefEntry = this.fetchCompressed(xrefEntry, suppressEncryption);
  31527. }
  31528. if (isDict(xrefEntry)) {
  31529. xrefEntry.objId = ref.toString();
  31530. } else if (isStream(xrefEntry)) {
  31531. xrefEntry.dict.objId = ref.toString();
  31532. }
  31533. return xrefEntry;
  31534. },
  31535. fetchUncompressed: function XRef_fetchUncompressed(ref, xrefEntry, suppressEncryption) {
  31536. var gen = ref.gen;
  31537. var num = ref.num;
  31538. if (xrefEntry.gen !== gen) {
  31539. error('inconsistent generation in XRef');
  31540. }
  31541. var stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  31542. var parser = new Parser(new Lexer(stream), true, this);
  31543. var obj1 = parser.getObj();
  31544. var obj2 = parser.getObj();
  31545. var obj3 = parser.getObj();
  31546. if (!isInt(obj1) || parseInt(obj1, 10) !== num || !isInt(obj2) || parseInt(obj2, 10) !== gen || !isCmd(obj3)) {
  31547. error('bad XRef entry');
  31548. }
  31549. if (!isCmd(obj3, 'obj')) {
  31550. if (obj3.cmd.indexOf('obj') === 0) {
  31551. num = parseInt(obj3.cmd.substring(3), 10);
  31552. if (!isNaN(num)) {
  31553. return num;
  31554. }
  31555. }
  31556. error('bad XRef entry');
  31557. }
  31558. if (this.encrypt && !suppressEncryption) {
  31559. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  31560. } else {
  31561. xrefEntry = parser.getObj();
  31562. }
  31563. if (!isStream(xrefEntry)) {
  31564. this.cache[num] = xrefEntry;
  31565. }
  31566. return xrefEntry;
  31567. },
  31568. fetchCompressed: function XRef_fetchCompressed(xrefEntry, suppressEncryption) {
  31569. var tableOffset = xrefEntry.offset;
  31570. var stream = this.fetch(new Ref(tableOffset, 0));
  31571. if (!isStream(stream)) {
  31572. error('bad ObjStm stream');
  31573. }
  31574. var first = stream.dict.get('First');
  31575. var n = stream.dict.get('N');
  31576. if (!isInt(first) || !isInt(n)) {
  31577. error('invalid first and n parameters for ObjStm stream');
  31578. }
  31579. var parser = new Parser(new Lexer(stream), false, this);
  31580. parser.allowStreams = true;
  31581. var i, entries = [], num, nums = [];
  31582. for (i = 0; i < n; ++i) {
  31583. num = parser.getObj();
  31584. if (!isInt(num)) {
  31585. error('invalid object number in the ObjStm stream: ' + num);
  31586. }
  31587. nums.push(num);
  31588. var offset = parser.getObj();
  31589. if (!isInt(offset)) {
  31590. error('invalid object offset in the ObjStm stream: ' + offset);
  31591. }
  31592. }
  31593. for (i = 0; i < n; ++i) {
  31594. entries.push(parser.getObj());
  31595. if (isCmd(parser.buf1, 'endobj')) {
  31596. parser.shift();
  31597. }
  31598. num = nums[i];
  31599. var entry = this.entries[num];
  31600. if (entry && entry.offset === tableOffset && entry.gen === i) {
  31601. this.cache[num] = entries[i];
  31602. }
  31603. }
  31604. xrefEntry = entries[xrefEntry.gen];
  31605. if (xrefEntry === undefined) {
  31606. error('bad XRef entry for compressed object');
  31607. }
  31608. return xrefEntry;
  31609. },
  31610. fetchIfRefAsync: function XRef_fetchIfRefAsync(obj, suppressEncryption) {
  31611. if (!isRef(obj)) {
  31612. return Promise.resolve(obj);
  31613. }
  31614. return this.fetchAsync(obj, suppressEncryption);
  31615. },
  31616. fetchAsync: function XRef_fetchAsync(ref, suppressEncryption) {
  31617. var streamManager = this.stream.manager;
  31618. var xref = this;
  31619. return new Promise(function tryFetch(resolve, reject) {
  31620. try {
  31621. resolve(xref.fetch(ref, suppressEncryption));
  31622. } catch (e) {
  31623. if (e instanceof MissingDataException) {
  31624. streamManager.requestRange(e.begin, e.end).then(function () {
  31625. tryFetch(resolve, reject);
  31626. }, reject);
  31627. return;
  31628. }
  31629. reject(e);
  31630. }
  31631. });
  31632. },
  31633. getCatalogObj: function XRef_getCatalogObj() {
  31634. return this.root;
  31635. }
  31636. };
  31637. return XRef;
  31638. }();
  31639. var NameOrNumberTree = function NameOrNumberTreeClosure() {
  31640. function NameOrNumberTree(root, xref) {
  31641. throw new Error('Cannot initialize NameOrNumberTree.');
  31642. }
  31643. NameOrNumberTree.prototype = {
  31644. getAll: function NameOrNumberTree_getAll() {
  31645. var dict = Object.create(null);
  31646. if (!this.root) {
  31647. return dict;
  31648. }
  31649. var xref = this.xref;
  31650. var processed = new RefSet();
  31651. processed.put(this.root);
  31652. var queue = [this.root];
  31653. while (queue.length > 0) {
  31654. var i, n;
  31655. var obj = xref.fetchIfRef(queue.shift());
  31656. if (!isDict(obj)) {
  31657. continue;
  31658. }
  31659. if (obj.has('Kids')) {
  31660. var kids = obj.get('Kids');
  31661. for (i = 0, n = kids.length; i < n; i++) {
  31662. var kid = kids[i];
  31663. assert(!processed.has(kid), 'Duplicate entry in "' + this._type + '" tree.');
  31664. queue.push(kid);
  31665. processed.put(kid);
  31666. }
  31667. continue;
  31668. }
  31669. var entries = obj.get(this._type);
  31670. if (isArray(entries)) {
  31671. for (i = 0, n = entries.length; i < n; i += 2) {
  31672. dict[xref.fetchIfRef(entries[i])] = xref.fetchIfRef(entries[i + 1]);
  31673. }
  31674. }
  31675. }
  31676. return dict;
  31677. },
  31678. get: function NameOrNumberTree_get(key) {
  31679. if (!this.root) {
  31680. return null;
  31681. }
  31682. var xref = this.xref;
  31683. var kidsOrEntries = xref.fetchIfRef(this.root);
  31684. var loopCount = 0;
  31685. var MAX_LEVELS = 10;
  31686. var l, r, m;
  31687. while (kidsOrEntries.has('Kids')) {
  31688. if (++loopCount > MAX_LEVELS) {
  31689. warn('Search depth limit reached for "' + this._type + '" tree.');
  31690. return null;
  31691. }
  31692. var kids = kidsOrEntries.get('Kids');
  31693. if (!isArray(kids)) {
  31694. return null;
  31695. }
  31696. l = 0;
  31697. r = kids.length - 1;
  31698. while (l <= r) {
  31699. m = l + r >> 1;
  31700. var kid = xref.fetchIfRef(kids[m]);
  31701. var limits = kid.get('Limits');
  31702. if (key < xref.fetchIfRef(limits[0])) {
  31703. r = m - 1;
  31704. } else if (key > xref.fetchIfRef(limits[1])) {
  31705. l = m + 1;
  31706. } else {
  31707. kidsOrEntries = xref.fetchIfRef(kids[m]);
  31708. break;
  31709. }
  31710. }
  31711. if (l > r) {
  31712. return null;
  31713. }
  31714. }
  31715. var entries = kidsOrEntries.get(this._type);
  31716. if (isArray(entries)) {
  31717. l = 0;
  31718. r = entries.length - 2;
  31719. while (l <= r) {
  31720. m = l + r & ~1;
  31721. var currentKey = xref.fetchIfRef(entries[m]);
  31722. if (key < currentKey) {
  31723. r = m - 2;
  31724. } else if (key > currentKey) {
  31725. l = m + 2;
  31726. } else {
  31727. return xref.fetchIfRef(entries[m + 1]);
  31728. }
  31729. }
  31730. }
  31731. return null;
  31732. }
  31733. };
  31734. return NameOrNumberTree;
  31735. }();
  31736. var NameTree = function NameTreeClosure() {
  31737. function NameTree(root, xref) {
  31738. this.root = root;
  31739. this.xref = xref;
  31740. this._type = 'Names';
  31741. }
  31742. Util.inherit(NameTree, NameOrNumberTree, {});
  31743. return NameTree;
  31744. }();
  31745. var NumberTree = function NumberTreeClosure() {
  31746. function NumberTree(root, xref) {
  31747. this.root = root;
  31748. this.xref = xref;
  31749. this._type = 'Nums';
  31750. }
  31751. Util.inherit(NumberTree, NameOrNumberTree, {});
  31752. return NumberTree;
  31753. }();
  31754. var FileSpec = function FileSpecClosure() {
  31755. function FileSpec(root, xref) {
  31756. if (!root || !isDict(root)) {
  31757. return;
  31758. }
  31759. this.xref = xref;
  31760. this.root = root;
  31761. if (root.has('FS')) {
  31762. this.fs = root.get('FS');
  31763. }
  31764. this.description = root.has('Desc') ? stringToPDFString(root.get('Desc')) : '';
  31765. if (root.has('RF')) {
  31766. warn('Related file specifications are not supported');
  31767. }
  31768. this.contentAvailable = true;
  31769. if (!root.has('EF')) {
  31770. this.contentAvailable = false;
  31771. warn('Non-embedded file specifications are not supported');
  31772. }
  31773. }
  31774. function pickPlatformItem(dict) {
  31775. if (dict.has('UF')) {
  31776. return dict.get('UF');
  31777. } else if (dict.has('F')) {
  31778. return dict.get('F');
  31779. } else if (dict.has('Unix')) {
  31780. return dict.get('Unix');
  31781. } else if (dict.has('Mac')) {
  31782. return dict.get('Mac');
  31783. } else if (dict.has('DOS')) {
  31784. return dict.get('DOS');
  31785. }
  31786. return null;
  31787. }
  31788. FileSpec.prototype = {
  31789. get filename() {
  31790. if (!this._filename && this.root) {
  31791. var filename = pickPlatformItem(this.root) || 'unnamed';
  31792. this._filename = stringToPDFString(filename).replace(/\\\\/g, '\\').replace(/\\\//g, '/').replace(/\\/g, '/');
  31793. }
  31794. return this._filename;
  31795. },
  31796. get content() {
  31797. if (!this.contentAvailable) {
  31798. return null;
  31799. }
  31800. if (!this.contentRef && this.root) {
  31801. this.contentRef = pickPlatformItem(this.root.get('EF'));
  31802. }
  31803. var content = null;
  31804. if (this.contentRef) {
  31805. var xref = this.xref;
  31806. var fileObj = xref.fetchIfRef(this.contentRef);
  31807. if (fileObj && isStream(fileObj)) {
  31808. content = fileObj.getBytes();
  31809. } else {
  31810. warn('Embedded file specification points to non-existing/invalid ' + 'content');
  31811. }
  31812. } else {
  31813. warn('Embedded file specification does not have a content');
  31814. }
  31815. return content;
  31816. },
  31817. get serializable() {
  31818. return {
  31819. filename: this.filename,
  31820. content: this.content
  31821. };
  31822. }
  31823. };
  31824. return FileSpec;
  31825. }();
  31826. var ObjectLoader = function () {
  31827. function mayHaveChildren(value) {
  31828. return isRef(value) || isDict(value) || isArray(value) || isStream(value);
  31829. }
  31830. function addChildren(node, nodesToVisit) {
  31831. var value;
  31832. if (isDict(node) || isStream(node)) {
  31833. var map;
  31834. if (isDict(node)) {
  31835. map = node.map;
  31836. } else {
  31837. map = node.dict.map;
  31838. }
  31839. for (var key in map) {
  31840. value = map[key];
  31841. if (mayHaveChildren(value)) {
  31842. nodesToVisit.push(value);
  31843. }
  31844. }
  31845. } else if (isArray(node)) {
  31846. for (var i = 0, ii = node.length; i < ii; i++) {
  31847. value = node[i];
  31848. if (mayHaveChildren(value)) {
  31849. nodesToVisit.push(value);
  31850. }
  31851. }
  31852. }
  31853. }
  31854. function ObjectLoader(obj, keys, xref) {
  31855. this.obj = obj;
  31856. this.keys = keys;
  31857. this.xref = xref;
  31858. this.refSet = null;
  31859. this.capability = null;
  31860. }
  31861. ObjectLoader.prototype = {
  31862. load: function ObjectLoader_load() {
  31863. var keys = this.keys;
  31864. this.capability = createPromiseCapability();
  31865. if (!(this.xref.stream instanceof ChunkedStream) || this.xref.stream.getMissingChunks().length === 0) {
  31866. this.capability.resolve();
  31867. return this.capability.promise;
  31868. }
  31869. this.refSet = new RefSet();
  31870. var nodesToVisit = [];
  31871. for (var i = 0; i < keys.length; i++) {
  31872. nodesToVisit.push(this.obj[keys[i]]);
  31873. }
  31874. this._walk(nodesToVisit);
  31875. return this.capability.promise;
  31876. },
  31877. _walk: function ObjectLoader_walk(nodesToVisit) {
  31878. var nodesToRevisit = [];
  31879. var pendingRequests = [];
  31880. while (nodesToVisit.length) {
  31881. var currentNode = nodesToVisit.pop();
  31882. if (isRef(currentNode)) {
  31883. if (this.refSet.has(currentNode)) {
  31884. continue;
  31885. }
  31886. try {
  31887. var ref = currentNode;
  31888. this.refSet.put(ref);
  31889. currentNode = this.xref.fetch(currentNode);
  31890. } catch (e) {
  31891. if (!(e instanceof MissingDataException)) {
  31892. throw e;
  31893. }
  31894. nodesToRevisit.push(currentNode);
  31895. pendingRequests.push({
  31896. begin: e.begin,
  31897. end: e.end
  31898. });
  31899. }
  31900. }
  31901. if (currentNode && currentNode.getBaseStreams) {
  31902. var baseStreams = currentNode.getBaseStreams();
  31903. var foundMissingData = false;
  31904. for (var i = 0; i < baseStreams.length; i++) {
  31905. var stream = baseStreams[i];
  31906. if (stream.getMissingChunks && stream.getMissingChunks().length) {
  31907. foundMissingData = true;
  31908. pendingRequests.push({
  31909. begin: stream.start,
  31910. end: stream.end
  31911. });
  31912. }
  31913. }
  31914. if (foundMissingData) {
  31915. nodesToRevisit.push(currentNode);
  31916. }
  31917. }
  31918. addChildren(currentNode, nodesToVisit);
  31919. }
  31920. if (pendingRequests.length) {
  31921. this.xref.stream.manager.requestRanges(pendingRequests).then(function pendingRequestCallback() {
  31922. nodesToVisit = nodesToRevisit;
  31923. for (var i = 0; i < nodesToRevisit.length; i++) {
  31924. var node = nodesToRevisit[i];
  31925. if (isRef(node)) {
  31926. this.refSet.remove(node);
  31927. }
  31928. }
  31929. this._walk(nodesToVisit);
  31930. }.bind(this), this.capability.reject);
  31931. return;
  31932. }
  31933. this.refSet = null;
  31934. this.capability.resolve();
  31935. }
  31936. };
  31937. return ObjectLoader;
  31938. }();
  31939. exports.Catalog = Catalog;
  31940. exports.ObjectLoader = ObjectLoader;
  31941. exports.XRef = XRef;
  31942. exports.FileSpec = FileSpec;
  31943. /***/ }),
  31944. /* 17 */
  31945. /***/ (function(module, exports, __w_pdfjs_require__) {
  31946. "use strict";
  31947. var sharedUtil = __w_pdfjs_require__(0);
  31948. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  31949. var getStdFontMap = getLookupTableFactory(function (t) {
  31950. t['ArialNarrow'] = 'Helvetica';
  31951. t['ArialNarrow-Bold'] = 'Helvetica-Bold';
  31952. t['ArialNarrow-BoldItalic'] = 'Helvetica-BoldOblique';
  31953. t['ArialNarrow-Italic'] = 'Helvetica-Oblique';
  31954. t['ArialBlack'] = 'Helvetica';
  31955. t['ArialBlack-Bold'] = 'Helvetica-Bold';
  31956. t['ArialBlack-BoldItalic'] = 'Helvetica-BoldOblique';
  31957. t['ArialBlack-Italic'] = 'Helvetica-Oblique';
  31958. t['Arial-Black'] = 'Helvetica';
  31959. t['Arial-Black-Bold'] = 'Helvetica-Bold';
  31960. t['Arial-Black-BoldItalic'] = 'Helvetica-BoldOblique';
  31961. t['Arial-Black-Italic'] = 'Helvetica-Oblique';
  31962. t['Arial'] = 'Helvetica';
  31963. t['Arial-Bold'] = 'Helvetica-Bold';
  31964. t['Arial-BoldItalic'] = 'Helvetica-BoldOblique';
  31965. t['Arial-Italic'] = 'Helvetica-Oblique';
  31966. t['Arial-BoldItalicMT'] = 'Helvetica-BoldOblique';
  31967. t['Arial-BoldMT'] = 'Helvetica-Bold';
  31968. t['Arial-ItalicMT'] = 'Helvetica-Oblique';
  31969. t['ArialMT'] = 'Helvetica';
  31970. t['Courier-Bold'] = 'Courier-Bold';
  31971. t['Courier-BoldItalic'] = 'Courier-BoldOblique';
  31972. t['Courier-Italic'] = 'Courier-Oblique';
  31973. t['CourierNew'] = 'Courier';
  31974. t['CourierNew-Bold'] = 'Courier-Bold';
  31975. t['CourierNew-BoldItalic'] = 'Courier-BoldOblique';
  31976. t['CourierNew-Italic'] = 'Courier-Oblique';
  31977. t['CourierNewPS-BoldItalicMT'] = 'Courier-BoldOblique';
  31978. t['CourierNewPS-BoldMT'] = 'Courier-Bold';
  31979. t['CourierNewPS-ItalicMT'] = 'Courier-Oblique';
  31980. t['CourierNewPSMT'] = 'Courier';
  31981. t['Helvetica'] = 'Helvetica';
  31982. t['Helvetica-Bold'] = 'Helvetica-Bold';
  31983. t['Helvetica-BoldItalic'] = 'Helvetica-BoldOblique';
  31984. t['Helvetica-BoldOblique'] = 'Helvetica-BoldOblique';
  31985. t['Helvetica-Italic'] = 'Helvetica-Oblique';
  31986. t['Helvetica-Oblique'] = 'Helvetica-Oblique';
  31987. t['Symbol-Bold'] = 'Symbol';
  31988. t['Symbol-BoldItalic'] = 'Symbol';
  31989. t['Symbol-Italic'] = 'Symbol';
  31990. t['TimesNewRoman'] = 'Times-Roman';
  31991. t['TimesNewRoman-Bold'] = 'Times-Bold';
  31992. t['TimesNewRoman-BoldItalic'] = 'Times-BoldItalic';
  31993. t['TimesNewRoman-Italic'] = 'Times-Italic';
  31994. t['TimesNewRomanPS'] = 'Times-Roman';
  31995. t['TimesNewRomanPS-Bold'] = 'Times-Bold';
  31996. t['TimesNewRomanPS-BoldItalic'] = 'Times-BoldItalic';
  31997. t['TimesNewRomanPS-BoldItalicMT'] = 'Times-BoldItalic';
  31998. t['TimesNewRomanPS-BoldMT'] = 'Times-Bold';
  31999. t['TimesNewRomanPS-Italic'] = 'Times-Italic';
  32000. t['TimesNewRomanPS-ItalicMT'] = 'Times-Italic';
  32001. t['TimesNewRomanPSMT'] = 'Times-Roman';
  32002. t['TimesNewRomanPSMT-Bold'] = 'Times-Bold';
  32003. t['TimesNewRomanPSMT-BoldItalic'] = 'Times-BoldItalic';
  32004. t['TimesNewRomanPSMT-Italic'] = 'Times-Italic';
  32005. });
  32006. var getNonStdFontMap = getLookupTableFactory(function (t) {
  32007. t['CenturyGothic'] = 'Helvetica';
  32008. t['CenturyGothic-Bold'] = 'Helvetica-Bold';
  32009. t['CenturyGothic-BoldItalic'] = 'Helvetica-BoldOblique';
  32010. t['CenturyGothic-Italic'] = 'Helvetica-Oblique';
  32011. t['ComicSansMS'] = 'Comic Sans MS';
  32012. t['ComicSansMS-Bold'] = 'Comic Sans MS-Bold';
  32013. t['ComicSansMS-BoldItalic'] = 'Comic Sans MS-BoldItalic';
  32014. t['ComicSansMS-Italic'] = 'Comic Sans MS-Italic';
  32015. t['LucidaConsole'] = 'Courier';
  32016. t['LucidaConsole-Bold'] = 'Courier-Bold';
  32017. t['LucidaConsole-BoldItalic'] = 'Courier-BoldOblique';
  32018. t['LucidaConsole-Italic'] = 'Courier-Oblique';
  32019. t['MS-Gothic'] = 'MS Gothic';
  32020. t['MS-Gothic-Bold'] = 'MS Gothic-Bold';
  32021. t['MS-Gothic-BoldItalic'] = 'MS Gothic-BoldItalic';
  32022. t['MS-Gothic-Italic'] = 'MS Gothic-Italic';
  32023. t['MS-Mincho'] = 'MS Mincho';
  32024. t['MS-Mincho-Bold'] = 'MS Mincho-Bold';
  32025. t['MS-Mincho-BoldItalic'] = 'MS Mincho-BoldItalic';
  32026. t['MS-Mincho-Italic'] = 'MS Mincho-Italic';
  32027. t['MS-PGothic'] = 'MS PGothic';
  32028. t['MS-PGothic-Bold'] = 'MS PGothic-Bold';
  32029. t['MS-PGothic-BoldItalic'] = 'MS PGothic-BoldItalic';
  32030. t['MS-PGothic-Italic'] = 'MS PGothic-Italic';
  32031. t['MS-PMincho'] = 'MS PMincho';
  32032. t['MS-PMincho-Bold'] = 'MS PMincho-Bold';
  32033. t['MS-PMincho-BoldItalic'] = 'MS PMincho-BoldItalic';
  32034. t['MS-PMincho-Italic'] = 'MS PMincho-Italic';
  32035. t['NuptialScript'] = 'Times-Italic';
  32036. t['Wingdings'] = 'ZapfDingbats';
  32037. });
  32038. var getSerifFonts = getLookupTableFactory(function (t) {
  32039. t['Adobe Jenson'] = true;
  32040. t['Adobe Text'] = true;
  32041. t['Albertus'] = true;
  32042. t['Aldus'] = true;
  32043. t['Alexandria'] = true;
  32044. t['Algerian'] = true;
  32045. t['American Typewriter'] = true;
  32046. t['Antiqua'] = true;
  32047. t['Apex'] = true;
  32048. t['Arno'] = true;
  32049. t['Aster'] = true;
  32050. t['Aurora'] = true;
  32051. t['Baskerville'] = true;
  32052. t['Bell'] = true;
  32053. t['Bembo'] = true;
  32054. t['Bembo Schoolbook'] = true;
  32055. t['Benguiat'] = true;
  32056. t['Berkeley Old Style'] = true;
  32057. t['Bernhard Modern'] = true;
  32058. t['Berthold City'] = true;
  32059. t['Bodoni'] = true;
  32060. t['Bauer Bodoni'] = true;
  32061. t['Book Antiqua'] = true;
  32062. t['Bookman'] = true;
  32063. t['Bordeaux Roman'] = true;
  32064. t['Californian FB'] = true;
  32065. t['Calisto'] = true;
  32066. t['Calvert'] = true;
  32067. t['Capitals'] = true;
  32068. t['Cambria'] = true;
  32069. t['Cartier'] = true;
  32070. t['Caslon'] = true;
  32071. t['Catull'] = true;
  32072. t['Centaur'] = true;
  32073. t['Century Old Style'] = true;
  32074. t['Century Schoolbook'] = true;
  32075. t['Chaparral'] = true;
  32076. t['Charis SIL'] = true;
  32077. t['Cheltenham'] = true;
  32078. t['Cholla Slab'] = true;
  32079. t['Clarendon'] = true;
  32080. t['Clearface'] = true;
  32081. t['Cochin'] = true;
  32082. t['Colonna'] = true;
  32083. t['Computer Modern'] = true;
  32084. t['Concrete Roman'] = true;
  32085. t['Constantia'] = true;
  32086. t['Cooper Black'] = true;
  32087. t['Corona'] = true;
  32088. t['Ecotype'] = true;
  32089. t['Egyptienne'] = true;
  32090. t['Elephant'] = true;
  32091. t['Excelsior'] = true;
  32092. t['Fairfield'] = true;
  32093. t['FF Scala'] = true;
  32094. t['Folkard'] = true;
  32095. t['Footlight'] = true;
  32096. t['FreeSerif'] = true;
  32097. t['Friz Quadrata'] = true;
  32098. t['Garamond'] = true;
  32099. t['Gentium'] = true;
  32100. t['Georgia'] = true;
  32101. t['Gloucester'] = true;
  32102. t['Goudy Old Style'] = true;
  32103. t['Goudy Schoolbook'] = true;
  32104. t['Goudy Pro Font'] = true;
  32105. t['Granjon'] = true;
  32106. t['Guardian Egyptian'] = true;
  32107. t['Heather'] = true;
  32108. t['Hercules'] = true;
  32109. t['High Tower Text'] = true;
  32110. t['Hiroshige'] = true;
  32111. t['Hoefler Text'] = true;
  32112. t['Humana Serif'] = true;
  32113. t['Imprint'] = true;
  32114. t['Ionic No. 5'] = true;
  32115. t['Janson'] = true;
  32116. t['Joanna'] = true;
  32117. t['Korinna'] = true;
  32118. t['Lexicon'] = true;
  32119. t['Liberation Serif'] = true;
  32120. t['Linux Libertine'] = true;
  32121. t['Literaturnaya'] = true;
  32122. t['Lucida'] = true;
  32123. t['Lucida Bright'] = true;
  32124. t['Melior'] = true;
  32125. t['Memphis'] = true;
  32126. t['Miller'] = true;
  32127. t['Minion'] = true;
  32128. t['Modern'] = true;
  32129. t['Mona Lisa'] = true;
  32130. t['Mrs Eaves'] = true;
  32131. t['MS Serif'] = true;
  32132. t['Museo Slab'] = true;
  32133. t['New York'] = true;
  32134. t['Nimbus Roman'] = true;
  32135. t['NPS Rawlinson Roadway'] = true;
  32136. t['NuptialScript'] = true;
  32137. t['Palatino'] = true;
  32138. t['Perpetua'] = true;
  32139. t['Plantin'] = true;
  32140. t['Plantin Schoolbook'] = true;
  32141. t['Playbill'] = true;
  32142. t['Poor Richard'] = true;
  32143. t['Rawlinson Roadway'] = true;
  32144. t['Renault'] = true;
  32145. t['Requiem'] = true;
  32146. t['Rockwell'] = true;
  32147. t['Roman'] = true;
  32148. t['Rotis Serif'] = true;
  32149. t['Sabon'] = true;
  32150. t['Scala'] = true;
  32151. t['Seagull'] = true;
  32152. t['Sistina'] = true;
  32153. t['Souvenir'] = true;
  32154. t['STIX'] = true;
  32155. t['Stone Informal'] = true;
  32156. t['Stone Serif'] = true;
  32157. t['Sylfaen'] = true;
  32158. t['Times'] = true;
  32159. t['Trajan'] = true;
  32160. t['Trinité'] = true;
  32161. t['Trump Mediaeval'] = true;
  32162. t['Utopia'] = true;
  32163. t['Vale Type'] = true;
  32164. t['Bitstream Vera'] = true;
  32165. t['Vera Serif'] = true;
  32166. t['Versailles'] = true;
  32167. t['Wanted'] = true;
  32168. t['Weiss'] = true;
  32169. t['Wide Latin'] = true;
  32170. t['Windsor'] = true;
  32171. t['XITS'] = true;
  32172. });
  32173. var getSymbolsFonts = getLookupTableFactory(function (t) {
  32174. t['Dingbats'] = true;
  32175. t['Symbol'] = true;
  32176. t['ZapfDingbats'] = true;
  32177. });
  32178. var getGlyphMapForStandardFonts = getLookupTableFactory(function (t) {
  32179. t[2] = 10;
  32180. t[3] = 32;
  32181. t[4] = 33;
  32182. t[5] = 34;
  32183. t[6] = 35;
  32184. t[7] = 36;
  32185. t[8] = 37;
  32186. t[9] = 38;
  32187. t[10] = 39;
  32188. t[11] = 40;
  32189. t[12] = 41;
  32190. t[13] = 42;
  32191. t[14] = 43;
  32192. t[15] = 44;
  32193. t[16] = 45;
  32194. t[17] = 46;
  32195. t[18] = 47;
  32196. t[19] = 48;
  32197. t[20] = 49;
  32198. t[21] = 50;
  32199. t[22] = 51;
  32200. t[23] = 52;
  32201. t[24] = 53;
  32202. t[25] = 54;
  32203. t[26] = 55;
  32204. t[27] = 56;
  32205. t[28] = 57;
  32206. t[29] = 58;
  32207. t[30] = 894;
  32208. t[31] = 60;
  32209. t[32] = 61;
  32210. t[33] = 62;
  32211. t[34] = 63;
  32212. t[35] = 64;
  32213. t[36] = 65;
  32214. t[37] = 66;
  32215. t[38] = 67;
  32216. t[39] = 68;
  32217. t[40] = 69;
  32218. t[41] = 70;
  32219. t[42] = 71;
  32220. t[43] = 72;
  32221. t[44] = 73;
  32222. t[45] = 74;
  32223. t[46] = 75;
  32224. t[47] = 76;
  32225. t[48] = 77;
  32226. t[49] = 78;
  32227. t[50] = 79;
  32228. t[51] = 80;
  32229. t[52] = 81;
  32230. t[53] = 82;
  32231. t[54] = 83;
  32232. t[55] = 84;
  32233. t[56] = 85;
  32234. t[57] = 86;
  32235. t[58] = 87;
  32236. t[59] = 88;
  32237. t[60] = 89;
  32238. t[61] = 90;
  32239. t[62] = 91;
  32240. t[63] = 92;
  32241. t[64] = 93;
  32242. t[65] = 94;
  32243. t[66] = 95;
  32244. t[67] = 96;
  32245. t[68] = 97;
  32246. t[69] = 98;
  32247. t[70] = 99;
  32248. t[71] = 100;
  32249. t[72] = 101;
  32250. t[73] = 102;
  32251. t[74] = 103;
  32252. t[75] = 104;
  32253. t[76] = 105;
  32254. t[77] = 106;
  32255. t[78] = 107;
  32256. t[79] = 108;
  32257. t[80] = 109;
  32258. t[81] = 110;
  32259. t[82] = 111;
  32260. t[83] = 112;
  32261. t[84] = 113;
  32262. t[85] = 114;
  32263. t[86] = 115;
  32264. t[87] = 116;
  32265. t[88] = 117;
  32266. t[89] = 118;
  32267. t[90] = 119;
  32268. t[91] = 120;
  32269. t[92] = 121;
  32270. t[93] = 122;
  32271. t[94] = 123;
  32272. t[95] = 124;
  32273. t[96] = 125;
  32274. t[97] = 126;
  32275. t[98] = 196;
  32276. t[99] = 197;
  32277. t[100] = 199;
  32278. t[101] = 201;
  32279. t[102] = 209;
  32280. t[103] = 214;
  32281. t[104] = 220;
  32282. t[105] = 225;
  32283. t[106] = 224;
  32284. t[107] = 226;
  32285. t[108] = 228;
  32286. t[109] = 227;
  32287. t[110] = 229;
  32288. t[111] = 231;
  32289. t[112] = 233;
  32290. t[113] = 232;
  32291. t[114] = 234;
  32292. t[115] = 235;
  32293. t[116] = 237;
  32294. t[117] = 236;
  32295. t[118] = 238;
  32296. t[119] = 239;
  32297. t[120] = 241;
  32298. t[121] = 243;
  32299. t[122] = 242;
  32300. t[123] = 244;
  32301. t[124] = 246;
  32302. t[125] = 245;
  32303. t[126] = 250;
  32304. t[127] = 249;
  32305. t[128] = 251;
  32306. t[129] = 252;
  32307. t[130] = 8224;
  32308. t[131] = 176;
  32309. t[132] = 162;
  32310. t[133] = 163;
  32311. t[134] = 167;
  32312. t[135] = 8226;
  32313. t[136] = 182;
  32314. t[137] = 223;
  32315. t[138] = 174;
  32316. t[139] = 169;
  32317. t[140] = 8482;
  32318. t[141] = 180;
  32319. t[142] = 168;
  32320. t[143] = 8800;
  32321. t[144] = 198;
  32322. t[145] = 216;
  32323. t[146] = 8734;
  32324. t[147] = 177;
  32325. t[148] = 8804;
  32326. t[149] = 8805;
  32327. t[150] = 165;
  32328. t[151] = 181;
  32329. t[152] = 8706;
  32330. t[153] = 8721;
  32331. t[154] = 8719;
  32332. t[156] = 8747;
  32333. t[157] = 170;
  32334. t[158] = 186;
  32335. t[159] = 8486;
  32336. t[160] = 230;
  32337. t[161] = 248;
  32338. t[162] = 191;
  32339. t[163] = 161;
  32340. t[164] = 172;
  32341. t[165] = 8730;
  32342. t[166] = 402;
  32343. t[167] = 8776;
  32344. t[168] = 8710;
  32345. t[169] = 171;
  32346. t[170] = 187;
  32347. t[171] = 8230;
  32348. t[210] = 218;
  32349. t[223] = 711;
  32350. t[224] = 321;
  32351. t[225] = 322;
  32352. t[227] = 353;
  32353. t[229] = 382;
  32354. t[234] = 253;
  32355. t[252] = 263;
  32356. t[253] = 268;
  32357. t[254] = 269;
  32358. t[258] = 258;
  32359. t[260] = 260;
  32360. t[261] = 261;
  32361. t[265] = 280;
  32362. t[266] = 281;
  32363. t[268] = 283;
  32364. t[269] = 313;
  32365. t[275] = 323;
  32366. t[276] = 324;
  32367. t[278] = 328;
  32368. t[284] = 345;
  32369. t[285] = 346;
  32370. t[286] = 347;
  32371. t[292] = 367;
  32372. t[295] = 377;
  32373. t[296] = 378;
  32374. t[298] = 380;
  32375. t[305] = 963;
  32376. t[306] = 964;
  32377. t[307] = 966;
  32378. t[308] = 8215;
  32379. t[309] = 8252;
  32380. t[310] = 8319;
  32381. t[311] = 8359;
  32382. t[312] = 8592;
  32383. t[313] = 8593;
  32384. t[337] = 9552;
  32385. t[493] = 1039;
  32386. t[494] = 1040;
  32387. t[705] = 1524;
  32388. t[706] = 8362;
  32389. t[710] = 64288;
  32390. t[711] = 64298;
  32391. t[759] = 1617;
  32392. t[761] = 1776;
  32393. t[763] = 1778;
  32394. t[775] = 1652;
  32395. t[777] = 1764;
  32396. t[778] = 1780;
  32397. t[779] = 1781;
  32398. t[780] = 1782;
  32399. t[782] = 771;
  32400. t[783] = 64726;
  32401. t[786] = 8363;
  32402. t[788] = 8532;
  32403. t[790] = 768;
  32404. t[791] = 769;
  32405. t[792] = 768;
  32406. t[795] = 803;
  32407. t[797] = 64336;
  32408. t[798] = 64337;
  32409. t[799] = 64342;
  32410. t[800] = 64343;
  32411. t[801] = 64344;
  32412. t[802] = 64345;
  32413. t[803] = 64362;
  32414. t[804] = 64363;
  32415. t[805] = 64364;
  32416. t[2424] = 7821;
  32417. t[2425] = 7822;
  32418. t[2426] = 7823;
  32419. t[2427] = 7824;
  32420. t[2428] = 7825;
  32421. t[2429] = 7826;
  32422. t[2430] = 7827;
  32423. t[2433] = 7682;
  32424. t[2678] = 8045;
  32425. t[2679] = 8046;
  32426. t[2830] = 1552;
  32427. t[2838] = 686;
  32428. t[2840] = 751;
  32429. t[2842] = 753;
  32430. t[2843] = 754;
  32431. t[2844] = 755;
  32432. t[2846] = 757;
  32433. t[2856] = 767;
  32434. t[2857] = 848;
  32435. t[2858] = 849;
  32436. t[2862] = 853;
  32437. t[2863] = 854;
  32438. t[2864] = 855;
  32439. t[2865] = 861;
  32440. t[2866] = 862;
  32441. t[2906] = 7460;
  32442. t[2908] = 7462;
  32443. t[2909] = 7463;
  32444. t[2910] = 7464;
  32445. t[2912] = 7466;
  32446. t[2913] = 7467;
  32447. t[2914] = 7468;
  32448. t[2916] = 7470;
  32449. t[2917] = 7471;
  32450. t[2918] = 7472;
  32451. t[2920] = 7474;
  32452. t[2921] = 7475;
  32453. t[2922] = 7476;
  32454. t[2924] = 7478;
  32455. t[2925] = 7479;
  32456. t[2926] = 7480;
  32457. t[2928] = 7482;
  32458. t[2929] = 7483;
  32459. t[2930] = 7484;
  32460. t[2932] = 7486;
  32461. t[2933] = 7487;
  32462. t[2934] = 7488;
  32463. t[2936] = 7490;
  32464. t[2937] = 7491;
  32465. t[2938] = 7492;
  32466. t[2940] = 7494;
  32467. t[2941] = 7495;
  32468. t[2942] = 7496;
  32469. t[2944] = 7498;
  32470. t[2946] = 7500;
  32471. t[2948] = 7502;
  32472. t[2950] = 7504;
  32473. t[2951] = 7505;
  32474. t[2952] = 7506;
  32475. t[2954] = 7508;
  32476. t[2955] = 7509;
  32477. t[2956] = 7510;
  32478. t[2958] = 7512;
  32479. t[2959] = 7513;
  32480. t[2960] = 7514;
  32481. t[2962] = 7516;
  32482. t[2963] = 7517;
  32483. t[2964] = 7518;
  32484. t[2966] = 7520;
  32485. t[2967] = 7521;
  32486. t[2968] = 7522;
  32487. t[2970] = 7524;
  32488. t[2971] = 7525;
  32489. t[2972] = 7526;
  32490. t[2974] = 7528;
  32491. t[2975] = 7529;
  32492. t[2976] = 7530;
  32493. t[2978] = 1537;
  32494. t[2979] = 1538;
  32495. t[2980] = 1539;
  32496. t[2982] = 1549;
  32497. t[2983] = 1551;
  32498. t[2984] = 1552;
  32499. t[2986] = 1554;
  32500. t[2987] = 1555;
  32501. t[2988] = 1556;
  32502. t[2990] = 1623;
  32503. t[2991] = 1624;
  32504. t[2995] = 1775;
  32505. t[2999] = 1791;
  32506. t[3002] = 64290;
  32507. t[3003] = 64291;
  32508. t[3004] = 64292;
  32509. t[3006] = 64294;
  32510. t[3007] = 64295;
  32511. t[3008] = 64296;
  32512. t[3011] = 1900;
  32513. t[3014] = 8223;
  32514. t[3015] = 8244;
  32515. t[3017] = 7532;
  32516. t[3018] = 7533;
  32517. t[3019] = 7534;
  32518. t[3075] = 7590;
  32519. t[3076] = 7591;
  32520. t[3079] = 7594;
  32521. t[3080] = 7595;
  32522. t[3083] = 7598;
  32523. t[3084] = 7599;
  32524. t[3087] = 7602;
  32525. t[3088] = 7603;
  32526. t[3091] = 7606;
  32527. t[3092] = 7607;
  32528. t[3095] = 7610;
  32529. t[3096] = 7611;
  32530. t[3099] = 7614;
  32531. t[3100] = 7615;
  32532. t[3103] = 7618;
  32533. t[3104] = 7619;
  32534. t[3107] = 8337;
  32535. t[3108] = 8338;
  32536. t[3116] = 1884;
  32537. t[3119] = 1885;
  32538. t[3120] = 1885;
  32539. t[3123] = 1886;
  32540. t[3124] = 1886;
  32541. t[3127] = 1887;
  32542. t[3128] = 1887;
  32543. t[3131] = 1888;
  32544. t[3132] = 1888;
  32545. t[3135] = 1889;
  32546. t[3136] = 1889;
  32547. t[3139] = 1890;
  32548. t[3140] = 1890;
  32549. t[3143] = 1891;
  32550. t[3144] = 1891;
  32551. t[3147] = 1892;
  32552. t[3148] = 1892;
  32553. t[3153] = 580;
  32554. t[3154] = 581;
  32555. t[3157] = 584;
  32556. t[3158] = 585;
  32557. t[3161] = 588;
  32558. t[3162] = 589;
  32559. t[3165] = 891;
  32560. t[3166] = 892;
  32561. t[3169] = 1274;
  32562. t[3170] = 1275;
  32563. t[3173] = 1278;
  32564. t[3174] = 1279;
  32565. t[3181] = 7622;
  32566. t[3182] = 7623;
  32567. t[3282] = 11799;
  32568. t[3316] = 578;
  32569. t[3379] = 42785;
  32570. t[3393] = 1159;
  32571. t[3416] = 8377;
  32572. });
  32573. var getSupplementalGlyphMapForArialBlack = getLookupTableFactory(function (t) {
  32574. t[227] = 322;
  32575. t[264] = 261;
  32576. t[291] = 346;
  32577. });
  32578. exports.getStdFontMap = getStdFontMap;
  32579. exports.getNonStdFontMap = getNonStdFontMap;
  32580. exports.getSerifFonts = getSerifFonts;
  32581. exports.getSymbolsFonts = getSymbolsFonts;
  32582. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  32583. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  32584. /***/ }),
  32585. /* 18 */
  32586. /***/ (function(module, exports, __w_pdfjs_require__) {
  32587. "use strict";
  32588. var sharedUtil = __w_pdfjs_require__(0);
  32589. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  32590. var getSpecialPUASymbols = getLookupTableFactory(function (t) {
  32591. t[63721] = 0x00A9;
  32592. t[63193] = 0x00A9;
  32593. t[63720] = 0x00AE;
  32594. t[63194] = 0x00AE;
  32595. t[63722] = 0x2122;
  32596. t[63195] = 0x2122;
  32597. t[63729] = 0x23A7;
  32598. t[63730] = 0x23A8;
  32599. t[63731] = 0x23A9;
  32600. t[63740] = 0x23AB;
  32601. t[63741] = 0x23AC;
  32602. t[63742] = 0x23AD;
  32603. t[63726] = 0x23A1;
  32604. t[63727] = 0x23A2;
  32605. t[63728] = 0x23A3;
  32606. t[63737] = 0x23A4;
  32607. t[63738] = 0x23A5;
  32608. t[63739] = 0x23A6;
  32609. t[63723] = 0x239B;
  32610. t[63724] = 0x239C;
  32611. t[63725] = 0x239D;
  32612. t[63734] = 0x239E;
  32613. t[63735] = 0x239F;
  32614. t[63736] = 0x23A0;
  32615. });
  32616. function mapSpecialUnicodeValues(code) {
  32617. if (code >= 0xFFF0 && code <= 0xFFFF) {
  32618. return 0;
  32619. } else if (code >= 0xF600 && code <= 0xF8FF) {
  32620. return getSpecialPUASymbols()[code] || code;
  32621. }
  32622. return code;
  32623. }
  32624. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  32625. var unicode = glyphsUnicodeMap[name];
  32626. if (unicode !== undefined) {
  32627. return unicode;
  32628. }
  32629. if (!name) {
  32630. return -1;
  32631. }
  32632. if (name[0] === 'u') {
  32633. var nameLen = name.length, hexStr;
  32634. if (nameLen === 7 && name[1] === 'n' && name[2] === 'i') {
  32635. hexStr = name.substr(3);
  32636. } else if (nameLen >= 5 && nameLen <= 7) {
  32637. hexStr = name.substr(1);
  32638. } else {
  32639. return -1;
  32640. }
  32641. if (hexStr === hexStr.toUpperCase()) {
  32642. unicode = parseInt(hexStr, 16);
  32643. if (unicode >= 0) {
  32644. return unicode;
  32645. }
  32646. }
  32647. }
  32648. return -1;
  32649. }
  32650. var UnicodeRanges = [
  32651. {
  32652. 'begin': 0x0000,
  32653. 'end': 0x007F
  32654. },
  32655. {
  32656. 'begin': 0x0080,
  32657. 'end': 0x00FF
  32658. },
  32659. {
  32660. 'begin': 0x0100,
  32661. 'end': 0x017F
  32662. },
  32663. {
  32664. 'begin': 0x0180,
  32665. 'end': 0x024F
  32666. },
  32667. {
  32668. 'begin': 0x0250,
  32669. 'end': 0x02AF
  32670. },
  32671. {
  32672. 'begin': 0x02B0,
  32673. 'end': 0x02FF
  32674. },
  32675. {
  32676. 'begin': 0x0300,
  32677. 'end': 0x036F
  32678. },
  32679. {
  32680. 'begin': 0x0370,
  32681. 'end': 0x03FF
  32682. },
  32683. {
  32684. 'begin': 0x2C80,
  32685. 'end': 0x2CFF
  32686. },
  32687. {
  32688. 'begin': 0x0400,
  32689. 'end': 0x04FF
  32690. },
  32691. {
  32692. 'begin': 0x0530,
  32693. 'end': 0x058F
  32694. },
  32695. {
  32696. 'begin': 0x0590,
  32697. 'end': 0x05FF
  32698. },
  32699. {
  32700. 'begin': 0xA500,
  32701. 'end': 0xA63F
  32702. },
  32703. {
  32704. 'begin': 0x0600,
  32705. 'end': 0x06FF
  32706. },
  32707. {
  32708. 'begin': 0x07C0,
  32709. 'end': 0x07FF
  32710. },
  32711. {
  32712. 'begin': 0x0900,
  32713. 'end': 0x097F
  32714. },
  32715. {
  32716. 'begin': 0x0980,
  32717. 'end': 0x09FF
  32718. },
  32719. {
  32720. 'begin': 0x0A00,
  32721. 'end': 0x0A7F
  32722. },
  32723. {
  32724. 'begin': 0x0A80,
  32725. 'end': 0x0AFF
  32726. },
  32727. {
  32728. 'begin': 0x0B00,
  32729. 'end': 0x0B7F
  32730. },
  32731. {
  32732. 'begin': 0x0B80,
  32733. 'end': 0x0BFF
  32734. },
  32735. {
  32736. 'begin': 0x0C00,
  32737. 'end': 0x0C7F
  32738. },
  32739. {
  32740. 'begin': 0x0C80,
  32741. 'end': 0x0CFF
  32742. },
  32743. {
  32744. 'begin': 0x0D00,
  32745. 'end': 0x0D7F
  32746. },
  32747. {
  32748. 'begin': 0x0E00,
  32749. 'end': 0x0E7F
  32750. },
  32751. {
  32752. 'begin': 0x0E80,
  32753. 'end': 0x0EFF
  32754. },
  32755. {
  32756. 'begin': 0x10A0,
  32757. 'end': 0x10FF
  32758. },
  32759. {
  32760. 'begin': 0x1B00,
  32761. 'end': 0x1B7F
  32762. },
  32763. {
  32764. 'begin': 0x1100,
  32765. 'end': 0x11FF
  32766. },
  32767. {
  32768. 'begin': 0x1E00,
  32769. 'end': 0x1EFF
  32770. },
  32771. {
  32772. 'begin': 0x1F00,
  32773. 'end': 0x1FFF
  32774. },
  32775. {
  32776. 'begin': 0x2000,
  32777. 'end': 0x206F
  32778. },
  32779. {
  32780. 'begin': 0x2070,
  32781. 'end': 0x209F
  32782. },
  32783. {
  32784. 'begin': 0x20A0,
  32785. 'end': 0x20CF
  32786. },
  32787. {
  32788. 'begin': 0x20D0,
  32789. 'end': 0x20FF
  32790. },
  32791. {
  32792. 'begin': 0x2100,
  32793. 'end': 0x214F
  32794. },
  32795. {
  32796. 'begin': 0x2150,
  32797. 'end': 0x218F
  32798. },
  32799. {
  32800. 'begin': 0x2190,
  32801. 'end': 0x21FF
  32802. },
  32803. {
  32804. 'begin': 0x2200,
  32805. 'end': 0x22FF
  32806. },
  32807. {
  32808. 'begin': 0x2300,
  32809. 'end': 0x23FF
  32810. },
  32811. {
  32812. 'begin': 0x2400,
  32813. 'end': 0x243F
  32814. },
  32815. {
  32816. 'begin': 0x2440,
  32817. 'end': 0x245F
  32818. },
  32819. {
  32820. 'begin': 0x2460,
  32821. 'end': 0x24FF
  32822. },
  32823. {
  32824. 'begin': 0x2500,
  32825. 'end': 0x257F
  32826. },
  32827. {
  32828. 'begin': 0x2580,
  32829. 'end': 0x259F
  32830. },
  32831. {
  32832. 'begin': 0x25A0,
  32833. 'end': 0x25FF
  32834. },
  32835. {
  32836. 'begin': 0x2600,
  32837. 'end': 0x26FF
  32838. },
  32839. {
  32840. 'begin': 0x2700,
  32841. 'end': 0x27BF
  32842. },
  32843. {
  32844. 'begin': 0x3000,
  32845. 'end': 0x303F
  32846. },
  32847. {
  32848. 'begin': 0x3040,
  32849. 'end': 0x309F
  32850. },
  32851. {
  32852. 'begin': 0x30A0,
  32853. 'end': 0x30FF
  32854. },
  32855. {
  32856. 'begin': 0x3100,
  32857. 'end': 0x312F
  32858. },
  32859. {
  32860. 'begin': 0x3130,
  32861. 'end': 0x318F
  32862. },
  32863. {
  32864. 'begin': 0xA840,
  32865. 'end': 0xA87F
  32866. },
  32867. {
  32868. 'begin': 0x3200,
  32869. 'end': 0x32FF
  32870. },
  32871. {
  32872. 'begin': 0x3300,
  32873. 'end': 0x33FF
  32874. },
  32875. {
  32876. 'begin': 0xAC00,
  32877. 'end': 0xD7AF
  32878. },
  32879. {
  32880. 'begin': 0xD800,
  32881. 'end': 0xDFFF
  32882. },
  32883. {
  32884. 'begin': 0x10900,
  32885. 'end': 0x1091F
  32886. },
  32887. {
  32888. 'begin': 0x4E00,
  32889. 'end': 0x9FFF
  32890. },
  32891. {
  32892. 'begin': 0xE000,
  32893. 'end': 0xF8FF
  32894. },
  32895. {
  32896. 'begin': 0x31C0,
  32897. 'end': 0x31EF
  32898. },
  32899. {
  32900. 'begin': 0xFB00,
  32901. 'end': 0xFB4F
  32902. },
  32903. {
  32904. 'begin': 0xFB50,
  32905. 'end': 0xFDFF
  32906. },
  32907. {
  32908. 'begin': 0xFE20,
  32909. 'end': 0xFE2F
  32910. },
  32911. {
  32912. 'begin': 0xFE10,
  32913. 'end': 0xFE1F
  32914. },
  32915. {
  32916. 'begin': 0xFE50,
  32917. 'end': 0xFE6F
  32918. },
  32919. {
  32920. 'begin': 0xFE70,
  32921. 'end': 0xFEFF
  32922. },
  32923. {
  32924. 'begin': 0xFF00,
  32925. 'end': 0xFFEF
  32926. },
  32927. {
  32928. 'begin': 0xFFF0,
  32929. 'end': 0xFFFF
  32930. },
  32931. {
  32932. 'begin': 0x0F00,
  32933. 'end': 0x0FFF
  32934. },
  32935. {
  32936. 'begin': 0x0700,
  32937. 'end': 0x074F
  32938. },
  32939. {
  32940. 'begin': 0x0780,
  32941. 'end': 0x07BF
  32942. },
  32943. {
  32944. 'begin': 0x0D80,
  32945. 'end': 0x0DFF
  32946. },
  32947. {
  32948. 'begin': 0x1000,
  32949. 'end': 0x109F
  32950. },
  32951. {
  32952. 'begin': 0x1200,
  32953. 'end': 0x137F
  32954. },
  32955. {
  32956. 'begin': 0x13A0,
  32957. 'end': 0x13FF
  32958. },
  32959. {
  32960. 'begin': 0x1400,
  32961. 'end': 0x167F
  32962. },
  32963. {
  32964. 'begin': 0x1680,
  32965. 'end': 0x169F
  32966. },
  32967. {
  32968. 'begin': 0x16A0,
  32969. 'end': 0x16FF
  32970. },
  32971. {
  32972. 'begin': 0x1780,
  32973. 'end': 0x17FF
  32974. },
  32975. {
  32976. 'begin': 0x1800,
  32977. 'end': 0x18AF
  32978. },
  32979. {
  32980. 'begin': 0x2800,
  32981. 'end': 0x28FF
  32982. },
  32983. {
  32984. 'begin': 0xA000,
  32985. 'end': 0xA48F
  32986. },
  32987. {
  32988. 'begin': 0x1700,
  32989. 'end': 0x171F
  32990. },
  32991. {
  32992. 'begin': 0x10300,
  32993. 'end': 0x1032F
  32994. },
  32995. {
  32996. 'begin': 0x10330,
  32997. 'end': 0x1034F
  32998. },
  32999. {
  33000. 'begin': 0x10400,
  33001. 'end': 0x1044F
  33002. },
  33003. {
  33004. 'begin': 0x1D000,
  33005. 'end': 0x1D0FF
  33006. },
  33007. {
  33008. 'begin': 0x1D400,
  33009. 'end': 0x1D7FF
  33010. },
  33011. {
  33012. 'begin': 0xFF000,
  33013. 'end': 0xFFFFD
  33014. },
  33015. {
  33016. 'begin': 0xFE00,
  33017. 'end': 0xFE0F
  33018. },
  33019. {
  33020. 'begin': 0xE0000,
  33021. 'end': 0xE007F
  33022. },
  33023. {
  33024. 'begin': 0x1900,
  33025. 'end': 0x194F
  33026. },
  33027. {
  33028. 'begin': 0x1950,
  33029. 'end': 0x197F
  33030. },
  33031. {
  33032. 'begin': 0x1980,
  33033. 'end': 0x19DF
  33034. },
  33035. {
  33036. 'begin': 0x1A00,
  33037. 'end': 0x1A1F
  33038. },
  33039. {
  33040. 'begin': 0x2C00,
  33041. 'end': 0x2C5F
  33042. },
  33043. {
  33044. 'begin': 0x2D30,
  33045. 'end': 0x2D7F
  33046. },
  33047. {
  33048. 'begin': 0x4DC0,
  33049. 'end': 0x4DFF
  33050. },
  33051. {
  33052. 'begin': 0xA800,
  33053. 'end': 0xA82F
  33054. },
  33055. {
  33056. 'begin': 0x10000,
  33057. 'end': 0x1007F
  33058. },
  33059. {
  33060. 'begin': 0x10140,
  33061. 'end': 0x1018F
  33062. },
  33063. {
  33064. 'begin': 0x10380,
  33065. 'end': 0x1039F
  33066. },
  33067. {
  33068. 'begin': 0x103A0,
  33069. 'end': 0x103DF
  33070. },
  33071. {
  33072. 'begin': 0x10450,
  33073. 'end': 0x1047F
  33074. },
  33075. {
  33076. 'begin': 0x10480,
  33077. 'end': 0x104AF
  33078. },
  33079. {
  33080. 'begin': 0x10800,
  33081. 'end': 0x1083F
  33082. },
  33083. {
  33084. 'begin': 0x10A00,
  33085. 'end': 0x10A5F
  33086. },
  33087. {
  33088. 'begin': 0x1D300,
  33089. 'end': 0x1D35F
  33090. },
  33091. {
  33092. 'begin': 0x12000,
  33093. 'end': 0x123FF
  33094. },
  33095. {
  33096. 'begin': 0x1D360,
  33097. 'end': 0x1D37F
  33098. },
  33099. {
  33100. 'begin': 0x1B80,
  33101. 'end': 0x1BBF
  33102. },
  33103. {
  33104. 'begin': 0x1C00,
  33105. 'end': 0x1C4F
  33106. },
  33107. {
  33108. 'begin': 0x1C50,
  33109. 'end': 0x1C7F
  33110. },
  33111. {
  33112. 'begin': 0xA880,
  33113. 'end': 0xA8DF
  33114. },
  33115. {
  33116. 'begin': 0xA900,
  33117. 'end': 0xA92F
  33118. },
  33119. {
  33120. 'begin': 0xA930,
  33121. 'end': 0xA95F
  33122. },
  33123. {
  33124. 'begin': 0xAA00,
  33125. 'end': 0xAA5F
  33126. },
  33127. {
  33128. 'begin': 0x10190,
  33129. 'end': 0x101CF
  33130. },
  33131. {
  33132. 'begin': 0x101D0,
  33133. 'end': 0x101FF
  33134. },
  33135. {
  33136. 'begin': 0x102A0,
  33137. 'end': 0x102DF
  33138. },
  33139. {
  33140. 'begin': 0x1F030,
  33141. 'end': 0x1F09F
  33142. }
  33143. ];
  33144. function getUnicodeRangeFor(value) {
  33145. for (var i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  33146. var range = UnicodeRanges[i];
  33147. if (value >= range.begin && value < range.end) {
  33148. return i;
  33149. }
  33150. }
  33151. return -1;
  33152. }
  33153. function isRTLRangeFor(value) {
  33154. var range = UnicodeRanges[13];
  33155. if (value >= range.begin && value < range.end) {
  33156. return true;
  33157. }
  33158. range = UnicodeRanges[11];
  33159. if (value >= range.begin && value < range.end) {
  33160. return true;
  33161. }
  33162. return false;
  33163. }
  33164. var getNormalizedUnicodes = getLookupTableFactory(function (t) {
  33165. t['\u00A8'] = '\u0020\u0308';
  33166. t['\u00AF'] = '\u0020\u0304';
  33167. t['\u00B4'] = '\u0020\u0301';
  33168. t['\u00B5'] = '\u03BC';
  33169. t['\u00B8'] = '\u0020\u0327';
  33170. t['\u0132'] = '\u0049\u004A';
  33171. t['\u0133'] = '\u0069\u006A';
  33172. t['\u013F'] = '\u004C\u00B7';
  33173. t['\u0140'] = '\u006C\u00B7';
  33174. t['\u0149'] = '\u02BC\u006E';
  33175. t['\u017F'] = '\u0073';
  33176. t['\u01C4'] = '\u0044\u017D';
  33177. t['\u01C5'] = '\u0044\u017E';
  33178. t['\u01C6'] = '\u0064\u017E';
  33179. t['\u01C7'] = '\u004C\u004A';
  33180. t['\u01C8'] = '\u004C\u006A';
  33181. t['\u01C9'] = '\u006C\u006A';
  33182. t['\u01CA'] = '\u004E\u004A';
  33183. t['\u01CB'] = '\u004E\u006A';
  33184. t['\u01CC'] = '\u006E\u006A';
  33185. t['\u01F1'] = '\u0044\u005A';
  33186. t['\u01F2'] = '\u0044\u007A';
  33187. t['\u01F3'] = '\u0064\u007A';
  33188. t['\u02D8'] = '\u0020\u0306';
  33189. t['\u02D9'] = '\u0020\u0307';
  33190. t['\u02DA'] = '\u0020\u030A';
  33191. t['\u02DB'] = '\u0020\u0328';
  33192. t['\u02DC'] = '\u0020\u0303';
  33193. t['\u02DD'] = '\u0020\u030B';
  33194. t['\u037A'] = '\u0020\u0345';
  33195. t['\u0384'] = '\u0020\u0301';
  33196. t['\u03D0'] = '\u03B2';
  33197. t['\u03D1'] = '\u03B8';
  33198. t['\u03D2'] = '\u03A5';
  33199. t['\u03D5'] = '\u03C6';
  33200. t['\u03D6'] = '\u03C0';
  33201. t['\u03F0'] = '\u03BA';
  33202. t['\u03F1'] = '\u03C1';
  33203. t['\u03F2'] = '\u03C2';
  33204. t['\u03F4'] = '\u0398';
  33205. t['\u03F5'] = '\u03B5';
  33206. t['\u03F9'] = '\u03A3';
  33207. t['\u0587'] = '\u0565\u0582';
  33208. t['\u0675'] = '\u0627\u0674';
  33209. t['\u0676'] = '\u0648\u0674';
  33210. t['\u0677'] = '\u06C7\u0674';
  33211. t['\u0678'] = '\u064A\u0674';
  33212. t['\u0E33'] = '\u0E4D\u0E32';
  33213. t['\u0EB3'] = '\u0ECD\u0EB2';
  33214. t['\u0EDC'] = '\u0EAB\u0E99';
  33215. t['\u0EDD'] = '\u0EAB\u0EA1';
  33216. t['\u0F77'] = '\u0FB2\u0F81';
  33217. t['\u0F79'] = '\u0FB3\u0F81';
  33218. t['\u1E9A'] = '\u0061\u02BE';
  33219. t['\u1FBD'] = '\u0020\u0313';
  33220. t['\u1FBF'] = '\u0020\u0313';
  33221. t['\u1FC0'] = '\u0020\u0342';
  33222. t['\u1FFE'] = '\u0020\u0314';
  33223. t['\u2002'] = '\u0020';
  33224. t['\u2003'] = '\u0020';
  33225. t['\u2004'] = '\u0020';
  33226. t['\u2005'] = '\u0020';
  33227. t['\u2006'] = '\u0020';
  33228. t['\u2008'] = '\u0020';
  33229. t['\u2009'] = '\u0020';
  33230. t['\u200A'] = '\u0020';
  33231. t['\u2017'] = '\u0020\u0333';
  33232. t['\u2024'] = '\u002E';
  33233. t['\u2025'] = '\u002E\u002E';
  33234. t['\u2026'] = '\u002E\u002E\u002E';
  33235. t['\u2033'] = '\u2032\u2032';
  33236. t['\u2034'] = '\u2032\u2032\u2032';
  33237. t['\u2036'] = '\u2035\u2035';
  33238. t['\u2037'] = '\u2035\u2035\u2035';
  33239. t['\u203C'] = '\u0021\u0021';
  33240. t['\u203E'] = '\u0020\u0305';
  33241. t['\u2047'] = '\u003F\u003F';
  33242. t['\u2048'] = '\u003F\u0021';
  33243. t['\u2049'] = '\u0021\u003F';
  33244. t['\u2057'] = '\u2032\u2032\u2032\u2032';
  33245. t['\u205F'] = '\u0020';
  33246. t['\u20A8'] = '\u0052\u0073';
  33247. t['\u2100'] = '\u0061\u002F\u0063';
  33248. t['\u2101'] = '\u0061\u002F\u0073';
  33249. t['\u2103'] = '\u00B0\u0043';
  33250. t['\u2105'] = '\u0063\u002F\u006F';
  33251. t['\u2106'] = '\u0063\u002F\u0075';
  33252. t['\u2107'] = '\u0190';
  33253. t['\u2109'] = '\u00B0\u0046';
  33254. t['\u2116'] = '\u004E\u006F';
  33255. t['\u2121'] = '\u0054\u0045\u004C';
  33256. t['\u2135'] = '\u05D0';
  33257. t['\u2136'] = '\u05D1';
  33258. t['\u2137'] = '\u05D2';
  33259. t['\u2138'] = '\u05D3';
  33260. t['\u213B'] = '\u0046\u0041\u0058';
  33261. t['\u2160'] = '\u0049';
  33262. t['\u2161'] = '\u0049\u0049';
  33263. t['\u2162'] = '\u0049\u0049\u0049';
  33264. t['\u2163'] = '\u0049\u0056';
  33265. t['\u2164'] = '\u0056';
  33266. t['\u2165'] = '\u0056\u0049';
  33267. t['\u2166'] = '\u0056\u0049\u0049';
  33268. t['\u2167'] = '\u0056\u0049\u0049\u0049';
  33269. t['\u2168'] = '\u0049\u0058';
  33270. t['\u2169'] = '\u0058';
  33271. t['\u216A'] = '\u0058\u0049';
  33272. t['\u216B'] = '\u0058\u0049\u0049';
  33273. t['\u216C'] = '\u004C';
  33274. t['\u216D'] = '\u0043';
  33275. t['\u216E'] = '\u0044';
  33276. t['\u216F'] = '\u004D';
  33277. t['\u2170'] = '\u0069';
  33278. t['\u2171'] = '\u0069\u0069';
  33279. t['\u2172'] = '\u0069\u0069\u0069';
  33280. t['\u2173'] = '\u0069\u0076';
  33281. t['\u2174'] = '\u0076';
  33282. t['\u2175'] = '\u0076\u0069';
  33283. t['\u2176'] = '\u0076\u0069\u0069';
  33284. t['\u2177'] = '\u0076\u0069\u0069\u0069';
  33285. t['\u2178'] = '\u0069\u0078';
  33286. t['\u2179'] = '\u0078';
  33287. t['\u217A'] = '\u0078\u0069';
  33288. t['\u217B'] = '\u0078\u0069\u0069';
  33289. t['\u217C'] = '\u006C';
  33290. t['\u217D'] = '\u0063';
  33291. t['\u217E'] = '\u0064';
  33292. t['\u217F'] = '\u006D';
  33293. t['\u222C'] = '\u222B\u222B';
  33294. t['\u222D'] = '\u222B\u222B\u222B';
  33295. t['\u222F'] = '\u222E\u222E';
  33296. t['\u2230'] = '\u222E\u222E\u222E';
  33297. t['\u2474'] = '\u0028\u0031\u0029';
  33298. t['\u2475'] = '\u0028\u0032\u0029';
  33299. t['\u2476'] = '\u0028\u0033\u0029';
  33300. t['\u2477'] = '\u0028\u0034\u0029';
  33301. t['\u2478'] = '\u0028\u0035\u0029';
  33302. t['\u2479'] = '\u0028\u0036\u0029';
  33303. t['\u247A'] = '\u0028\u0037\u0029';
  33304. t['\u247B'] = '\u0028\u0038\u0029';
  33305. t['\u247C'] = '\u0028\u0039\u0029';
  33306. t['\u247D'] = '\u0028\u0031\u0030\u0029';
  33307. t['\u247E'] = '\u0028\u0031\u0031\u0029';
  33308. t['\u247F'] = '\u0028\u0031\u0032\u0029';
  33309. t['\u2480'] = '\u0028\u0031\u0033\u0029';
  33310. t['\u2481'] = '\u0028\u0031\u0034\u0029';
  33311. t['\u2482'] = '\u0028\u0031\u0035\u0029';
  33312. t['\u2483'] = '\u0028\u0031\u0036\u0029';
  33313. t['\u2484'] = '\u0028\u0031\u0037\u0029';
  33314. t['\u2485'] = '\u0028\u0031\u0038\u0029';
  33315. t['\u2486'] = '\u0028\u0031\u0039\u0029';
  33316. t['\u2487'] = '\u0028\u0032\u0030\u0029';
  33317. t['\u2488'] = '\u0031\u002E';
  33318. t['\u2489'] = '\u0032\u002E';
  33319. t['\u248A'] = '\u0033\u002E';
  33320. t['\u248B'] = '\u0034\u002E';
  33321. t['\u248C'] = '\u0035\u002E';
  33322. t['\u248D'] = '\u0036\u002E';
  33323. t['\u248E'] = '\u0037\u002E';
  33324. t['\u248F'] = '\u0038\u002E';
  33325. t['\u2490'] = '\u0039\u002E';
  33326. t['\u2491'] = '\u0031\u0030\u002E';
  33327. t['\u2492'] = '\u0031\u0031\u002E';
  33328. t['\u2493'] = '\u0031\u0032\u002E';
  33329. t['\u2494'] = '\u0031\u0033\u002E';
  33330. t['\u2495'] = '\u0031\u0034\u002E';
  33331. t['\u2496'] = '\u0031\u0035\u002E';
  33332. t['\u2497'] = '\u0031\u0036\u002E';
  33333. t['\u2498'] = '\u0031\u0037\u002E';
  33334. t['\u2499'] = '\u0031\u0038\u002E';
  33335. t['\u249A'] = '\u0031\u0039\u002E';
  33336. t['\u249B'] = '\u0032\u0030\u002E';
  33337. t['\u249C'] = '\u0028\u0061\u0029';
  33338. t['\u249D'] = '\u0028\u0062\u0029';
  33339. t['\u249E'] = '\u0028\u0063\u0029';
  33340. t['\u249F'] = '\u0028\u0064\u0029';
  33341. t['\u24A0'] = '\u0028\u0065\u0029';
  33342. t['\u24A1'] = '\u0028\u0066\u0029';
  33343. t['\u24A2'] = '\u0028\u0067\u0029';
  33344. t['\u24A3'] = '\u0028\u0068\u0029';
  33345. t['\u24A4'] = '\u0028\u0069\u0029';
  33346. t['\u24A5'] = '\u0028\u006A\u0029';
  33347. t['\u24A6'] = '\u0028\u006B\u0029';
  33348. t['\u24A7'] = '\u0028\u006C\u0029';
  33349. t['\u24A8'] = '\u0028\u006D\u0029';
  33350. t['\u24A9'] = '\u0028\u006E\u0029';
  33351. t['\u24AA'] = '\u0028\u006F\u0029';
  33352. t['\u24AB'] = '\u0028\u0070\u0029';
  33353. t['\u24AC'] = '\u0028\u0071\u0029';
  33354. t['\u24AD'] = '\u0028\u0072\u0029';
  33355. t['\u24AE'] = '\u0028\u0073\u0029';
  33356. t['\u24AF'] = '\u0028\u0074\u0029';
  33357. t['\u24B0'] = '\u0028\u0075\u0029';
  33358. t['\u24B1'] = '\u0028\u0076\u0029';
  33359. t['\u24B2'] = '\u0028\u0077\u0029';
  33360. t['\u24B3'] = '\u0028\u0078\u0029';
  33361. t['\u24B4'] = '\u0028\u0079\u0029';
  33362. t['\u24B5'] = '\u0028\u007A\u0029';
  33363. t['\u2A0C'] = '\u222B\u222B\u222B\u222B';
  33364. t['\u2A74'] = '\u003A\u003A\u003D';
  33365. t['\u2A75'] = '\u003D\u003D';
  33366. t['\u2A76'] = '\u003D\u003D\u003D';
  33367. t['\u2E9F'] = '\u6BCD';
  33368. t['\u2EF3'] = '\u9F9F';
  33369. t['\u2F00'] = '\u4E00';
  33370. t['\u2F01'] = '\u4E28';
  33371. t['\u2F02'] = '\u4E36';
  33372. t['\u2F03'] = '\u4E3F';
  33373. t['\u2F04'] = '\u4E59';
  33374. t['\u2F05'] = '\u4E85';
  33375. t['\u2F06'] = '\u4E8C';
  33376. t['\u2F07'] = '\u4EA0';
  33377. t['\u2F08'] = '\u4EBA';
  33378. t['\u2F09'] = '\u513F';
  33379. t['\u2F0A'] = '\u5165';
  33380. t['\u2F0B'] = '\u516B';
  33381. t['\u2F0C'] = '\u5182';
  33382. t['\u2F0D'] = '\u5196';
  33383. t['\u2F0E'] = '\u51AB';
  33384. t['\u2F0F'] = '\u51E0';
  33385. t['\u2F10'] = '\u51F5';
  33386. t['\u2F11'] = '\u5200';
  33387. t['\u2F12'] = '\u529B';
  33388. t['\u2F13'] = '\u52F9';
  33389. t['\u2F14'] = '\u5315';
  33390. t['\u2F15'] = '\u531A';
  33391. t['\u2F16'] = '\u5338';
  33392. t['\u2F17'] = '\u5341';
  33393. t['\u2F18'] = '\u535C';
  33394. t['\u2F19'] = '\u5369';
  33395. t['\u2F1A'] = '\u5382';
  33396. t['\u2F1B'] = '\u53B6';
  33397. t['\u2F1C'] = '\u53C8';
  33398. t['\u2F1D'] = '\u53E3';
  33399. t['\u2F1E'] = '\u56D7';
  33400. t['\u2F1F'] = '\u571F';
  33401. t['\u2F20'] = '\u58EB';
  33402. t['\u2F21'] = '\u5902';
  33403. t['\u2F22'] = '\u590A';
  33404. t['\u2F23'] = '\u5915';
  33405. t['\u2F24'] = '\u5927';
  33406. t['\u2F25'] = '\u5973';
  33407. t['\u2F26'] = '\u5B50';
  33408. t['\u2F27'] = '\u5B80';
  33409. t['\u2F28'] = '\u5BF8';
  33410. t['\u2F29'] = '\u5C0F';
  33411. t['\u2F2A'] = '\u5C22';
  33412. t['\u2F2B'] = '\u5C38';
  33413. t['\u2F2C'] = '\u5C6E';
  33414. t['\u2F2D'] = '\u5C71';
  33415. t['\u2F2E'] = '\u5DDB';
  33416. t['\u2F2F'] = '\u5DE5';
  33417. t['\u2F30'] = '\u5DF1';
  33418. t['\u2F31'] = '\u5DFE';
  33419. t['\u2F32'] = '\u5E72';
  33420. t['\u2F33'] = '\u5E7A';
  33421. t['\u2F34'] = '\u5E7F';
  33422. t['\u2F35'] = '\u5EF4';
  33423. t['\u2F36'] = '\u5EFE';
  33424. t['\u2F37'] = '\u5F0B';
  33425. t['\u2F38'] = '\u5F13';
  33426. t['\u2F39'] = '\u5F50';
  33427. t['\u2F3A'] = '\u5F61';
  33428. t['\u2F3B'] = '\u5F73';
  33429. t['\u2F3C'] = '\u5FC3';
  33430. t['\u2F3D'] = '\u6208';
  33431. t['\u2F3E'] = '\u6236';
  33432. t['\u2F3F'] = '\u624B';
  33433. t['\u2F40'] = '\u652F';
  33434. t['\u2F41'] = '\u6534';
  33435. t['\u2F42'] = '\u6587';
  33436. t['\u2F43'] = '\u6597';
  33437. t['\u2F44'] = '\u65A4';
  33438. t['\u2F45'] = '\u65B9';
  33439. t['\u2F46'] = '\u65E0';
  33440. t['\u2F47'] = '\u65E5';
  33441. t['\u2F48'] = '\u66F0';
  33442. t['\u2F49'] = '\u6708';
  33443. t['\u2F4A'] = '\u6728';
  33444. t['\u2F4B'] = '\u6B20';
  33445. t['\u2F4C'] = '\u6B62';
  33446. t['\u2F4D'] = '\u6B79';
  33447. t['\u2F4E'] = '\u6BB3';
  33448. t['\u2F4F'] = '\u6BCB';
  33449. t['\u2F50'] = '\u6BD4';
  33450. t['\u2F51'] = '\u6BDB';
  33451. t['\u2F52'] = '\u6C0F';
  33452. t['\u2F53'] = '\u6C14';
  33453. t['\u2F54'] = '\u6C34';
  33454. t['\u2F55'] = '\u706B';
  33455. t['\u2F56'] = '\u722A';
  33456. t['\u2F57'] = '\u7236';
  33457. t['\u2F58'] = '\u723B';
  33458. t['\u2F59'] = '\u723F';
  33459. t['\u2F5A'] = '\u7247';
  33460. t['\u2F5B'] = '\u7259';
  33461. t['\u2F5C'] = '\u725B';
  33462. t['\u2F5D'] = '\u72AC';
  33463. t['\u2F5E'] = '\u7384';
  33464. t['\u2F5F'] = '\u7389';
  33465. t['\u2F60'] = '\u74DC';
  33466. t['\u2F61'] = '\u74E6';
  33467. t['\u2F62'] = '\u7518';
  33468. t['\u2F63'] = '\u751F';
  33469. t['\u2F64'] = '\u7528';
  33470. t['\u2F65'] = '\u7530';
  33471. t['\u2F66'] = '\u758B';
  33472. t['\u2F67'] = '\u7592';
  33473. t['\u2F68'] = '\u7676';
  33474. t['\u2F69'] = '\u767D';
  33475. t['\u2F6A'] = '\u76AE';
  33476. t['\u2F6B'] = '\u76BF';
  33477. t['\u2F6C'] = '\u76EE';
  33478. t['\u2F6D'] = '\u77DB';
  33479. t['\u2F6E'] = '\u77E2';
  33480. t['\u2F6F'] = '\u77F3';
  33481. t['\u2F70'] = '\u793A';
  33482. t['\u2F71'] = '\u79B8';
  33483. t['\u2F72'] = '\u79BE';
  33484. t['\u2F73'] = '\u7A74';
  33485. t['\u2F74'] = '\u7ACB';
  33486. t['\u2F75'] = '\u7AF9';
  33487. t['\u2F76'] = '\u7C73';
  33488. t['\u2F77'] = '\u7CF8';
  33489. t['\u2F78'] = '\u7F36';
  33490. t['\u2F79'] = '\u7F51';
  33491. t['\u2F7A'] = '\u7F8A';
  33492. t['\u2F7B'] = '\u7FBD';
  33493. t['\u2F7C'] = '\u8001';
  33494. t['\u2F7D'] = '\u800C';
  33495. t['\u2F7E'] = '\u8012';
  33496. t['\u2F7F'] = '\u8033';
  33497. t['\u2F80'] = '\u807F';
  33498. t['\u2F81'] = '\u8089';
  33499. t['\u2F82'] = '\u81E3';
  33500. t['\u2F83'] = '\u81EA';
  33501. t['\u2F84'] = '\u81F3';
  33502. t['\u2F85'] = '\u81FC';
  33503. t['\u2F86'] = '\u820C';
  33504. t['\u2F87'] = '\u821B';
  33505. t['\u2F88'] = '\u821F';
  33506. t['\u2F89'] = '\u826E';
  33507. t['\u2F8A'] = '\u8272';
  33508. t['\u2F8B'] = '\u8278';
  33509. t['\u2F8C'] = '\u864D';
  33510. t['\u2F8D'] = '\u866B';
  33511. t['\u2F8E'] = '\u8840';
  33512. t['\u2F8F'] = '\u884C';
  33513. t['\u2F90'] = '\u8863';
  33514. t['\u2F91'] = '\u897E';
  33515. t['\u2F92'] = '\u898B';
  33516. t['\u2F93'] = '\u89D2';
  33517. t['\u2F94'] = '\u8A00';
  33518. t['\u2F95'] = '\u8C37';
  33519. t['\u2F96'] = '\u8C46';
  33520. t['\u2F97'] = '\u8C55';
  33521. t['\u2F98'] = '\u8C78';
  33522. t['\u2F99'] = '\u8C9D';
  33523. t['\u2F9A'] = '\u8D64';
  33524. t['\u2F9B'] = '\u8D70';
  33525. t['\u2F9C'] = '\u8DB3';
  33526. t['\u2F9D'] = '\u8EAB';
  33527. t['\u2F9E'] = '\u8ECA';
  33528. t['\u2F9F'] = '\u8F9B';
  33529. t['\u2FA0'] = '\u8FB0';
  33530. t['\u2FA1'] = '\u8FB5';
  33531. t['\u2FA2'] = '\u9091';
  33532. t['\u2FA3'] = '\u9149';
  33533. t['\u2FA4'] = '\u91C6';
  33534. t['\u2FA5'] = '\u91CC';
  33535. t['\u2FA6'] = '\u91D1';
  33536. t['\u2FA7'] = '\u9577';
  33537. t['\u2FA8'] = '\u9580';
  33538. t['\u2FA9'] = '\u961C';
  33539. t['\u2FAA'] = '\u96B6';
  33540. t['\u2FAB'] = '\u96B9';
  33541. t['\u2FAC'] = '\u96E8';
  33542. t['\u2FAD'] = '\u9751';
  33543. t['\u2FAE'] = '\u975E';
  33544. t['\u2FAF'] = '\u9762';
  33545. t['\u2FB0'] = '\u9769';
  33546. t['\u2FB1'] = '\u97CB';
  33547. t['\u2FB2'] = '\u97ED';
  33548. t['\u2FB3'] = '\u97F3';
  33549. t['\u2FB4'] = '\u9801';
  33550. t['\u2FB5'] = '\u98A8';
  33551. t['\u2FB6'] = '\u98DB';
  33552. t['\u2FB7'] = '\u98DF';
  33553. t['\u2FB8'] = '\u9996';
  33554. t['\u2FB9'] = '\u9999';
  33555. t['\u2FBA'] = '\u99AC';
  33556. t['\u2FBB'] = '\u9AA8';
  33557. t['\u2FBC'] = '\u9AD8';
  33558. t['\u2FBD'] = '\u9ADF';
  33559. t['\u2FBE'] = '\u9B25';
  33560. t['\u2FBF'] = '\u9B2F';
  33561. t['\u2FC0'] = '\u9B32';
  33562. t['\u2FC1'] = '\u9B3C';
  33563. t['\u2FC2'] = '\u9B5A';
  33564. t['\u2FC3'] = '\u9CE5';
  33565. t['\u2FC4'] = '\u9E75';
  33566. t['\u2FC5'] = '\u9E7F';
  33567. t['\u2FC6'] = '\u9EA5';
  33568. t['\u2FC7'] = '\u9EBB';
  33569. t['\u2FC8'] = '\u9EC3';
  33570. t['\u2FC9'] = '\u9ECD';
  33571. t['\u2FCA'] = '\u9ED1';
  33572. t['\u2FCB'] = '\u9EF9';
  33573. t['\u2FCC'] = '\u9EFD';
  33574. t['\u2FCD'] = '\u9F0E';
  33575. t['\u2FCE'] = '\u9F13';
  33576. t['\u2FCF'] = '\u9F20';
  33577. t['\u2FD0'] = '\u9F3B';
  33578. t['\u2FD1'] = '\u9F4A';
  33579. t['\u2FD2'] = '\u9F52';
  33580. t['\u2FD3'] = '\u9F8D';
  33581. t['\u2FD4'] = '\u9F9C';
  33582. t['\u2FD5'] = '\u9FA0';
  33583. t['\u3036'] = '\u3012';
  33584. t['\u3038'] = '\u5341';
  33585. t['\u3039'] = '\u5344';
  33586. t['\u303A'] = '\u5345';
  33587. t['\u309B'] = '\u0020\u3099';
  33588. t['\u309C'] = '\u0020\u309A';
  33589. t['\u3131'] = '\u1100';
  33590. t['\u3132'] = '\u1101';
  33591. t['\u3133'] = '\u11AA';
  33592. t['\u3134'] = '\u1102';
  33593. t['\u3135'] = '\u11AC';
  33594. t['\u3136'] = '\u11AD';
  33595. t['\u3137'] = '\u1103';
  33596. t['\u3138'] = '\u1104';
  33597. t['\u3139'] = '\u1105';
  33598. t['\u313A'] = '\u11B0';
  33599. t['\u313B'] = '\u11B1';
  33600. t['\u313C'] = '\u11B2';
  33601. t['\u313D'] = '\u11B3';
  33602. t['\u313E'] = '\u11B4';
  33603. t['\u313F'] = '\u11B5';
  33604. t['\u3140'] = '\u111A';
  33605. t['\u3141'] = '\u1106';
  33606. t['\u3142'] = '\u1107';
  33607. t['\u3143'] = '\u1108';
  33608. t['\u3144'] = '\u1121';
  33609. t['\u3145'] = '\u1109';
  33610. t['\u3146'] = '\u110A';
  33611. t['\u3147'] = '\u110B';
  33612. t['\u3148'] = '\u110C';
  33613. t['\u3149'] = '\u110D';
  33614. t['\u314A'] = '\u110E';
  33615. t['\u314B'] = '\u110F';
  33616. t['\u314C'] = '\u1110';
  33617. t['\u314D'] = '\u1111';
  33618. t['\u314E'] = '\u1112';
  33619. t['\u314F'] = '\u1161';
  33620. t['\u3150'] = '\u1162';
  33621. t['\u3151'] = '\u1163';
  33622. t['\u3152'] = '\u1164';
  33623. t['\u3153'] = '\u1165';
  33624. t['\u3154'] = '\u1166';
  33625. t['\u3155'] = '\u1167';
  33626. t['\u3156'] = '\u1168';
  33627. t['\u3157'] = '\u1169';
  33628. t['\u3158'] = '\u116A';
  33629. t['\u3159'] = '\u116B';
  33630. t['\u315A'] = '\u116C';
  33631. t['\u315B'] = '\u116D';
  33632. t['\u315C'] = '\u116E';
  33633. t['\u315D'] = '\u116F';
  33634. t['\u315E'] = '\u1170';
  33635. t['\u315F'] = '\u1171';
  33636. t['\u3160'] = '\u1172';
  33637. t['\u3161'] = '\u1173';
  33638. t['\u3162'] = '\u1174';
  33639. t['\u3163'] = '\u1175';
  33640. t['\u3164'] = '\u1160';
  33641. t['\u3165'] = '\u1114';
  33642. t['\u3166'] = '\u1115';
  33643. t['\u3167'] = '\u11C7';
  33644. t['\u3168'] = '\u11C8';
  33645. t['\u3169'] = '\u11CC';
  33646. t['\u316A'] = '\u11CE';
  33647. t['\u316B'] = '\u11D3';
  33648. t['\u316C'] = '\u11D7';
  33649. t['\u316D'] = '\u11D9';
  33650. t['\u316E'] = '\u111C';
  33651. t['\u316F'] = '\u11DD';
  33652. t['\u3170'] = '\u11DF';
  33653. t['\u3171'] = '\u111D';
  33654. t['\u3172'] = '\u111E';
  33655. t['\u3173'] = '\u1120';
  33656. t['\u3174'] = '\u1122';
  33657. t['\u3175'] = '\u1123';
  33658. t['\u3176'] = '\u1127';
  33659. t['\u3177'] = '\u1129';
  33660. t['\u3178'] = '\u112B';
  33661. t['\u3179'] = '\u112C';
  33662. t['\u317A'] = '\u112D';
  33663. t['\u317B'] = '\u112E';
  33664. t['\u317C'] = '\u112F';
  33665. t['\u317D'] = '\u1132';
  33666. t['\u317E'] = '\u1136';
  33667. t['\u317F'] = '\u1140';
  33668. t['\u3180'] = '\u1147';
  33669. t['\u3181'] = '\u114C';
  33670. t['\u3182'] = '\u11F1';
  33671. t['\u3183'] = '\u11F2';
  33672. t['\u3184'] = '\u1157';
  33673. t['\u3185'] = '\u1158';
  33674. t['\u3186'] = '\u1159';
  33675. t['\u3187'] = '\u1184';
  33676. t['\u3188'] = '\u1185';
  33677. t['\u3189'] = '\u1188';
  33678. t['\u318A'] = '\u1191';
  33679. t['\u318B'] = '\u1192';
  33680. t['\u318C'] = '\u1194';
  33681. t['\u318D'] = '\u119E';
  33682. t['\u318E'] = '\u11A1';
  33683. t['\u3200'] = '\u0028\u1100\u0029';
  33684. t['\u3201'] = '\u0028\u1102\u0029';
  33685. t['\u3202'] = '\u0028\u1103\u0029';
  33686. t['\u3203'] = '\u0028\u1105\u0029';
  33687. t['\u3204'] = '\u0028\u1106\u0029';
  33688. t['\u3205'] = '\u0028\u1107\u0029';
  33689. t['\u3206'] = '\u0028\u1109\u0029';
  33690. t['\u3207'] = '\u0028\u110B\u0029';
  33691. t['\u3208'] = '\u0028\u110C\u0029';
  33692. t['\u3209'] = '\u0028\u110E\u0029';
  33693. t['\u320A'] = '\u0028\u110F\u0029';
  33694. t['\u320B'] = '\u0028\u1110\u0029';
  33695. t['\u320C'] = '\u0028\u1111\u0029';
  33696. t['\u320D'] = '\u0028\u1112\u0029';
  33697. t['\u320E'] = '\u0028\u1100\u1161\u0029';
  33698. t['\u320F'] = '\u0028\u1102\u1161\u0029';
  33699. t['\u3210'] = '\u0028\u1103\u1161\u0029';
  33700. t['\u3211'] = '\u0028\u1105\u1161\u0029';
  33701. t['\u3212'] = '\u0028\u1106\u1161\u0029';
  33702. t['\u3213'] = '\u0028\u1107\u1161\u0029';
  33703. t['\u3214'] = '\u0028\u1109\u1161\u0029';
  33704. t['\u3215'] = '\u0028\u110B\u1161\u0029';
  33705. t['\u3216'] = '\u0028\u110C\u1161\u0029';
  33706. t['\u3217'] = '\u0028\u110E\u1161\u0029';
  33707. t['\u3218'] = '\u0028\u110F\u1161\u0029';
  33708. t['\u3219'] = '\u0028\u1110\u1161\u0029';
  33709. t['\u321A'] = '\u0028\u1111\u1161\u0029';
  33710. t['\u321B'] = '\u0028\u1112\u1161\u0029';
  33711. t['\u321C'] = '\u0028\u110C\u116E\u0029';
  33712. t['\u321D'] = '\u0028\u110B\u1169\u110C\u1165\u11AB\u0029';
  33713. t['\u321E'] = '\u0028\u110B\u1169\u1112\u116E\u0029';
  33714. t['\u3220'] = '\u0028\u4E00\u0029';
  33715. t['\u3221'] = '\u0028\u4E8C\u0029';
  33716. t['\u3222'] = '\u0028\u4E09\u0029';
  33717. t['\u3223'] = '\u0028\u56DB\u0029';
  33718. t['\u3224'] = '\u0028\u4E94\u0029';
  33719. t['\u3225'] = '\u0028\u516D\u0029';
  33720. t['\u3226'] = '\u0028\u4E03\u0029';
  33721. t['\u3227'] = '\u0028\u516B\u0029';
  33722. t['\u3228'] = '\u0028\u4E5D\u0029';
  33723. t['\u3229'] = '\u0028\u5341\u0029';
  33724. t['\u322A'] = '\u0028\u6708\u0029';
  33725. t['\u322B'] = '\u0028\u706B\u0029';
  33726. t['\u322C'] = '\u0028\u6C34\u0029';
  33727. t['\u322D'] = '\u0028\u6728\u0029';
  33728. t['\u322E'] = '\u0028\u91D1\u0029';
  33729. t['\u322F'] = '\u0028\u571F\u0029';
  33730. t['\u3230'] = '\u0028\u65E5\u0029';
  33731. t['\u3231'] = '\u0028\u682A\u0029';
  33732. t['\u3232'] = '\u0028\u6709\u0029';
  33733. t['\u3233'] = '\u0028\u793E\u0029';
  33734. t['\u3234'] = '\u0028\u540D\u0029';
  33735. t['\u3235'] = '\u0028\u7279\u0029';
  33736. t['\u3236'] = '\u0028\u8CA1\u0029';
  33737. t['\u3237'] = '\u0028\u795D\u0029';
  33738. t['\u3238'] = '\u0028\u52B4\u0029';
  33739. t['\u3239'] = '\u0028\u4EE3\u0029';
  33740. t['\u323A'] = '\u0028\u547C\u0029';
  33741. t['\u323B'] = '\u0028\u5B66\u0029';
  33742. t['\u323C'] = '\u0028\u76E3\u0029';
  33743. t['\u323D'] = '\u0028\u4F01\u0029';
  33744. t['\u323E'] = '\u0028\u8CC7\u0029';
  33745. t['\u323F'] = '\u0028\u5354\u0029';
  33746. t['\u3240'] = '\u0028\u796D\u0029';
  33747. t['\u3241'] = '\u0028\u4F11\u0029';
  33748. t['\u3242'] = '\u0028\u81EA\u0029';
  33749. t['\u3243'] = '\u0028\u81F3\u0029';
  33750. t['\u32C0'] = '\u0031\u6708';
  33751. t['\u32C1'] = '\u0032\u6708';
  33752. t['\u32C2'] = '\u0033\u6708';
  33753. t['\u32C3'] = '\u0034\u6708';
  33754. t['\u32C4'] = '\u0035\u6708';
  33755. t['\u32C5'] = '\u0036\u6708';
  33756. t['\u32C6'] = '\u0037\u6708';
  33757. t['\u32C7'] = '\u0038\u6708';
  33758. t['\u32C8'] = '\u0039\u6708';
  33759. t['\u32C9'] = '\u0031\u0030\u6708';
  33760. t['\u32CA'] = '\u0031\u0031\u6708';
  33761. t['\u32CB'] = '\u0031\u0032\u6708';
  33762. t['\u3358'] = '\u0030\u70B9';
  33763. t['\u3359'] = '\u0031\u70B9';
  33764. t['\u335A'] = '\u0032\u70B9';
  33765. t['\u335B'] = '\u0033\u70B9';
  33766. t['\u335C'] = '\u0034\u70B9';
  33767. t['\u335D'] = '\u0035\u70B9';
  33768. t['\u335E'] = '\u0036\u70B9';
  33769. t['\u335F'] = '\u0037\u70B9';
  33770. t['\u3360'] = '\u0038\u70B9';
  33771. t['\u3361'] = '\u0039\u70B9';
  33772. t['\u3362'] = '\u0031\u0030\u70B9';
  33773. t['\u3363'] = '\u0031\u0031\u70B9';
  33774. t['\u3364'] = '\u0031\u0032\u70B9';
  33775. t['\u3365'] = '\u0031\u0033\u70B9';
  33776. t['\u3366'] = '\u0031\u0034\u70B9';
  33777. t['\u3367'] = '\u0031\u0035\u70B9';
  33778. t['\u3368'] = '\u0031\u0036\u70B9';
  33779. t['\u3369'] = '\u0031\u0037\u70B9';
  33780. t['\u336A'] = '\u0031\u0038\u70B9';
  33781. t['\u336B'] = '\u0031\u0039\u70B9';
  33782. t['\u336C'] = '\u0032\u0030\u70B9';
  33783. t['\u336D'] = '\u0032\u0031\u70B9';
  33784. t['\u336E'] = '\u0032\u0032\u70B9';
  33785. t['\u336F'] = '\u0032\u0033\u70B9';
  33786. t['\u3370'] = '\u0032\u0034\u70B9';
  33787. t['\u33E0'] = '\u0031\u65E5';
  33788. t['\u33E1'] = '\u0032\u65E5';
  33789. t['\u33E2'] = '\u0033\u65E5';
  33790. t['\u33E3'] = '\u0034\u65E5';
  33791. t['\u33E4'] = '\u0035\u65E5';
  33792. t['\u33E5'] = '\u0036\u65E5';
  33793. t['\u33E6'] = '\u0037\u65E5';
  33794. t['\u33E7'] = '\u0038\u65E5';
  33795. t['\u33E8'] = '\u0039\u65E5';
  33796. t['\u33E9'] = '\u0031\u0030\u65E5';
  33797. t['\u33EA'] = '\u0031\u0031\u65E5';
  33798. t['\u33EB'] = '\u0031\u0032\u65E5';
  33799. t['\u33EC'] = '\u0031\u0033\u65E5';
  33800. t['\u33ED'] = '\u0031\u0034\u65E5';
  33801. t['\u33EE'] = '\u0031\u0035\u65E5';
  33802. t['\u33EF'] = '\u0031\u0036\u65E5';
  33803. t['\u33F0'] = '\u0031\u0037\u65E5';
  33804. t['\u33F1'] = '\u0031\u0038\u65E5';
  33805. t['\u33F2'] = '\u0031\u0039\u65E5';
  33806. t['\u33F3'] = '\u0032\u0030\u65E5';
  33807. t['\u33F4'] = '\u0032\u0031\u65E5';
  33808. t['\u33F5'] = '\u0032\u0032\u65E5';
  33809. t['\u33F6'] = '\u0032\u0033\u65E5';
  33810. t['\u33F7'] = '\u0032\u0034\u65E5';
  33811. t['\u33F8'] = '\u0032\u0035\u65E5';
  33812. t['\u33F9'] = '\u0032\u0036\u65E5';
  33813. t['\u33FA'] = '\u0032\u0037\u65E5';
  33814. t['\u33FB'] = '\u0032\u0038\u65E5';
  33815. t['\u33FC'] = '\u0032\u0039\u65E5';
  33816. t['\u33FD'] = '\u0033\u0030\u65E5';
  33817. t['\u33FE'] = '\u0033\u0031\u65E5';
  33818. t['\uFB00'] = '\u0066\u0066';
  33819. t['\uFB01'] = '\u0066\u0069';
  33820. t['\uFB02'] = '\u0066\u006C';
  33821. t['\uFB03'] = '\u0066\u0066\u0069';
  33822. t['\uFB04'] = '\u0066\u0066\u006C';
  33823. t['\uFB05'] = '\u017F\u0074';
  33824. t['\uFB06'] = '\u0073\u0074';
  33825. t['\uFB13'] = '\u0574\u0576';
  33826. t['\uFB14'] = '\u0574\u0565';
  33827. t['\uFB15'] = '\u0574\u056B';
  33828. t['\uFB16'] = '\u057E\u0576';
  33829. t['\uFB17'] = '\u0574\u056D';
  33830. t['\uFB4F'] = '\u05D0\u05DC';
  33831. t['\uFB50'] = '\u0671';
  33832. t['\uFB51'] = '\u0671';
  33833. t['\uFB52'] = '\u067B';
  33834. t['\uFB53'] = '\u067B';
  33835. t['\uFB54'] = '\u067B';
  33836. t['\uFB55'] = '\u067B';
  33837. t['\uFB56'] = '\u067E';
  33838. t['\uFB57'] = '\u067E';
  33839. t['\uFB58'] = '\u067E';
  33840. t['\uFB59'] = '\u067E';
  33841. t['\uFB5A'] = '\u0680';
  33842. t['\uFB5B'] = '\u0680';
  33843. t['\uFB5C'] = '\u0680';
  33844. t['\uFB5D'] = '\u0680';
  33845. t['\uFB5E'] = '\u067A';
  33846. t['\uFB5F'] = '\u067A';
  33847. t['\uFB60'] = '\u067A';
  33848. t['\uFB61'] = '\u067A';
  33849. t['\uFB62'] = '\u067F';
  33850. t['\uFB63'] = '\u067F';
  33851. t['\uFB64'] = '\u067F';
  33852. t['\uFB65'] = '\u067F';
  33853. t['\uFB66'] = '\u0679';
  33854. t['\uFB67'] = '\u0679';
  33855. t['\uFB68'] = '\u0679';
  33856. t['\uFB69'] = '\u0679';
  33857. t['\uFB6A'] = '\u06A4';
  33858. t['\uFB6B'] = '\u06A4';
  33859. t['\uFB6C'] = '\u06A4';
  33860. t['\uFB6D'] = '\u06A4';
  33861. t['\uFB6E'] = '\u06A6';
  33862. t['\uFB6F'] = '\u06A6';
  33863. t['\uFB70'] = '\u06A6';
  33864. t['\uFB71'] = '\u06A6';
  33865. t['\uFB72'] = '\u0684';
  33866. t['\uFB73'] = '\u0684';
  33867. t['\uFB74'] = '\u0684';
  33868. t['\uFB75'] = '\u0684';
  33869. t['\uFB76'] = '\u0683';
  33870. t['\uFB77'] = '\u0683';
  33871. t['\uFB78'] = '\u0683';
  33872. t['\uFB79'] = '\u0683';
  33873. t['\uFB7A'] = '\u0686';
  33874. t['\uFB7B'] = '\u0686';
  33875. t['\uFB7C'] = '\u0686';
  33876. t['\uFB7D'] = '\u0686';
  33877. t['\uFB7E'] = '\u0687';
  33878. t['\uFB7F'] = '\u0687';
  33879. t['\uFB80'] = '\u0687';
  33880. t['\uFB81'] = '\u0687';
  33881. t['\uFB82'] = '\u068D';
  33882. t['\uFB83'] = '\u068D';
  33883. t['\uFB84'] = '\u068C';
  33884. t['\uFB85'] = '\u068C';
  33885. t['\uFB86'] = '\u068E';
  33886. t['\uFB87'] = '\u068E';
  33887. t['\uFB88'] = '\u0688';
  33888. t['\uFB89'] = '\u0688';
  33889. t['\uFB8A'] = '\u0698';
  33890. t['\uFB8B'] = '\u0698';
  33891. t['\uFB8C'] = '\u0691';
  33892. t['\uFB8D'] = '\u0691';
  33893. t['\uFB8E'] = '\u06A9';
  33894. t['\uFB8F'] = '\u06A9';
  33895. t['\uFB90'] = '\u06A9';
  33896. t['\uFB91'] = '\u06A9';
  33897. t['\uFB92'] = '\u06AF';
  33898. t['\uFB93'] = '\u06AF';
  33899. t['\uFB94'] = '\u06AF';
  33900. t['\uFB95'] = '\u06AF';
  33901. t['\uFB96'] = '\u06B3';
  33902. t['\uFB97'] = '\u06B3';
  33903. t['\uFB98'] = '\u06B3';
  33904. t['\uFB99'] = '\u06B3';
  33905. t['\uFB9A'] = '\u06B1';
  33906. t['\uFB9B'] = '\u06B1';
  33907. t['\uFB9C'] = '\u06B1';
  33908. t['\uFB9D'] = '\u06B1';
  33909. t['\uFB9E'] = '\u06BA';
  33910. t['\uFB9F'] = '\u06BA';
  33911. t['\uFBA0'] = '\u06BB';
  33912. t['\uFBA1'] = '\u06BB';
  33913. t['\uFBA2'] = '\u06BB';
  33914. t['\uFBA3'] = '\u06BB';
  33915. t['\uFBA4'] = '\u06C0';
  33916. t['\uFBA5'] = '\u06C0';
  33917. t['\uFBA6'] = '\u06C1';
  33918. t['\uFBA7'] = '\u06C1';
  33919. t['\uFBA8'] = '\u06C1';
  33920. t['\uFBA9'] = '\u06C1';
  33921. t['\uFBAA'] = '\u06BE';
  33922. t['\uFBAB'] = '\u06BE';
  33923. t['\uFBAC'] = '\u06BE';
  33924. t['\uFBAD'] = '\u06BE';
  33925. t['\uFBAE'] = '\u06D2';
  33926. t['\uFBAF'] = '\u06D2';
  33927. t['\uFBB0'] = '\u06D3';
  33928. t['\uFBB1'] = '\u06D3';
  33929. t['\uFBD3'] = '\u06AD';
  33930. t['\uFBD4'] = '\u06AD';
  33931. t['\uFBD5'] = '\u06AD';
  33932. t['\uFBD6'] = '\u06AD';
  33933. t['\uFBD7'] = '\u06C7';
  33934. t['\uFBD8'] = '\u06C7';
  33935. t['\uFBD9'] = '\u06C6';
  33936. t['\uFBDA'] = '\u06C6';
  33937. t['\uFBDB'] = '\u06C8';
  33938. t['\uFBDC'] = '\u06C8';
  33939. t['\uFBDD'] = '\u0677';
  33940. t['\uFBDE'] = '\u06CB';
  33941. t['\uFBDF'] = '\u06CB';
  33942. t['\uFBE0'] = '\u06C5';
  33943. t['\uFBE1'] = '\u06C5';
  33944. t['\uFBE2'] = '\u06C9';
  33945. t['\uFBE3'] = '\u06C9';
  33946. t['\uFBE4'] = '\u06D0';
  33947. t['\uFBE5'] = '\u06D0';
  33948. t['\uFBE6'] = '\u06D0';
  33949. t['\uFBE7'] = '\u06D0';
  33950. t['\uFBE8'] = '\u0649';
  33951. t['\uFBE9'] = '\u0649';
  33952. t['\uFBEA'] = '\u0626\u0627';
  33953. t['\uFBEB'] = '\u0626\u0627';
  33954. t['\uFBEC'] = '\u0626\u06D5';
  33955. t['\uFBED'] = '\u0626\u06D5';
  33956. t['\uFBEE'] = '\u0626\u0648';
  33957. t['\uFBEF'] = '\u0626\u0648';
  33958. t['\uFBF0'] = '\u0626\u06C7';
  33959. t['\uFBF1'] = '\u0626\u06C7';
  33960. t['\uFBF2'] = '\u0626\u06C6';
  33961. t['\uFBF3'] = '\u0626\u06C6';
  33962. t['\uFBF4'] = '\u0626\u06C8';
  33963. t['\uFBF5'] = '\u0626\u06C8';
  33964. t['\uFBF6'] = '\u0626\u06D0';
  33965. t['\uFBF7'] = '\u0626\u06D0';
  33966. t['\uFBF8'] = '\u0626\u06D0';
  33967. t['\uFBF9'] = '\u0626\u0649';
  33968. t['\uFBFA'] = '\u0626\u0649';
  33969. t['\uFBFB'] = '\u0626\u0649';
  33970. t['\uFBFC'] = '\u06CC';
  33971. t['\uFBFD'] = '\u06CC';
  33972. t['\uFBFE'] = '\u06CC';
  33973. t['\uFBFF'] = '\u06CC';
  33974. t['\uFC00'] = '\u0626\u062C';
  33975. t['\uFC01'] = '\u0626\u062D';
  33976. t['\uFC02'] = '\u0626\u0645';
  33977. t['\uFC03'] = '\u0626\u0649';
  33978. t['\uFC04'] = '\u0626\u064A';
  33979. t['\uFC05'] = '\u0628\u062C';
  33980. t['\uFC06'] = '\u0628\u062D';
  33981. t['\uFC07'] = '\u0628\u062E';
  33982. t['\uFC08'] = '\u0628\u0645';
  33983. t['\uFC09'] = '\u0628\u0649';
  33984. t['\uFC0A'] = '\u0628\u064A';
  33985. t['\uFC0B'] = '\u062A\u062C';
  33986. t['\uFC0C'] = '\u062A\u062D';
  33987. t['\uFC0D'] = '\u062A\u062E';
  33988. t['\uFC0E'] = '\u062A\u0645';
  33989. t['\uFC0F'] = '\u062A\u0649';
  33990. t['\uFC10'] = '\u062A\u064A';
  33991. t['\uFC11'] = '\u062B\u062C';
  33992. t['\uFC12'] = '\u062B\u0645';
  33993. t['\uFC13'] = '\u062B\u0649';
  33994. t['\uFC14'] = '\u062B\u064A';
  33995. t['\uFC15'] = '\u062C\u062D';
  33996. t['\uFC16'] = '\u062C\u0645';
  33997. t['\uFC17'] = '\u062D\u062C';
  33998. t['\uFC18'] = '\u062D\u0645';
  33999. t['\uFC19'] = '\u062E\u062C';
  34000. t['\uFC1A'] = '\u062E\u062D';
  34001. t['\uFC1B'] = '\u062E\u0645';
  34002. t['\uFC1C'] = '\u0633\u062C';
  34003. t['\uFC1D'] = '\u0633\u062D';
  34004. t['\uFC1E'] = '\u0633\u062E';
  34005. t['\uFC1F'] = '\u0633\u0645';
  34006. t['\uFC20'] = '\u0635\u062D';
  34007. t['\uFC21'] = '\u0635\u0645';
  34008. t['\uFC22'] = '\u0636\u062C';
  34009. t['\uFC23'] = '\u0636\u062D';
  34010. t['\uFC24'] = '\u0636\u062E';
  34011. t['\uFC25'] = '\u0636\u0645';
  34012. t['\uFC26'] = '\u0637\u062D';
  34013. t['\uFC27'] = '\u0637\u0645';
  34014. t['\uFC28'] = '\u0638\u0645';
  34015. t['\uFC29'] = '\u0639\u062C';
  34016. t['\uFC2A'] = '\u0639\u0645';
  34017. t['\uFC2B'] = '\u063A\u062C';
  34018. t['\uFC2C'] = '\u063A\u0645';
  34019. t['\uFC2D'] = '\u0641\u062C';
  34020. t['\uFC2E'] = '\u0641\u062D';
  34021. t['\uFC2F'] = '\u0641\u062E';
  34022. t['\uFC30'] = '\u0641\u0645';
  34023. t['\uFC31'] = '\u0641\u0649';
  34024. t['\uFC32'] = '\u0641\u064A';
  34025. t['\uFC33'] = '\u0642\u062D';
  34026. t['\uFC34'] = '\u0642\u0645';
  34027. t['\uFC35'] = '\u0642\u0649';
  34028. t['\uFC36'] = '\u0642\u064A';
  34029. t['\uFC37'] = '\u0643\u0627';
  34030. t['\uFC38'] = '\u0643\u062C';
  34031. t['\uFC39'] = '\u0643\u062D';
  34032. t['\uFC3A'] = '\u0643\u062E';
  34033. t['\uFC3B'] = '\u0643\u0644';
  34034. t['\uFC3C'] = '\u0643\u0645';
  34035. t['\uFC3D'] = '\u0643\u0649';
  34036. t['\uFC3E'] = '\u0643\u064A';
  34037. t['\uFC3F'] = '\u0644\u062C';
  34038. t['\uFC40'] = '\u0644\u062D';
  34039. t['\uFC41'] = '\u0644\u062E';
  34040. t['\uFC42'] = '\u0644\u0645';
  34041. t['\uFC43'] = '\u0644\u0649';
  34042. t['\uFC44'] = '\u0644\u064A';
  34043. t['\uFC45'] = '\u0645\u062C';
  34044. t['\uFC46'] = '\u0645\u062D';
  34045. t['\uFC47'] = '\u0645\u062E';
  34046. t['\uFC48'] = '\u0645\u0645';
  34047. t['\uFC49'] = '\u0645\u0649';
  34048. t['\uFC4A'] = '\u0645\u064A';
  34049. t['\uFC4B'] = '\u0646\u062C';
  34050. t['\uFC4C'] = '\u0646\u062D';
  34051. t['\uFC4D'] = '\u0646\u062E';
  34052. t['\uFC4E'] = '\u0646\u0645';
  34053. t['\uFC4F'] = '\u0646\u0649';
  34054. t['\uFC50'] = '\u0646\u064A';
  34055. t['\uFC51'] = '\u0647\u062C';
  34056. t['\uFC52'] = '\u0647\u0645';
  34057. t['\uFC53'] = '\u0647\u0649';
  34058. t['\uFC54'] = '\u0647\u064A';
  34059. t['\uFC55'] = '\u064A\u062C';
  34060. t['\uFC56'] = '\u064A\u062D';
  34061. t['\uFC57'] = '\u064A\u062E';
  34062. t['\uFC58'] = '\u064A\u0645';
  34063. t['\uFC59'] = '\u064A\u0649';
  34064. t['\uFC5A'] = '\u064A\u064A';
  34065. t['\uFC5B'] = '\u0630\u0670';
  34066. t['\uFC5C'] = '\u0631\u0670';
  34067. t['\uFC5D'] = '\u0649\u0670';
  34068. t['\uFC5E'] = '\u0020\u064C\u0651';
  34069. t['\uFC5F'] = '\u0020\u064D\u0651';
  34070. t['\uFC60'] = '\u0020\u064E\u0651';
  34071. t['\uFC61'] = '\u0020\u064F\u0651';
  34072. t['\uFC62'] = '\u0020\u0650\u0651';
  34073. t['\uFC63'] = '\u0020\u0651\u0670';
  34074. t['\uFC64'] = '\u0626\u0631';
  34075. t['\uFC65'] = '\u0626\u0632';
  34076. t['\uFC66'] = '\u0626\u0645';
  34077. t['\uFC67'] = '\u0626\u0646';
  34078. t['\uFC68'] = '\u0626\u0649';
  34079. t['\uFC69'] = '\u0626\u064A';
  34080. t['\uFC6A'] = '\u0628\u0631';
  34081. t['\uFC6B'] = '\u0628\u0632';
  34082. t['\uFC6C'] = '\u0628\u0645';
  34083. t['\uFC6D'] = '\u0628\u0646';
  34084. t['\uFC6E'] = '\u0628\u0649';
  34085. t['\uFC6F'] = '\u0628\u064A';
  34086. t['\uFC70'] = '\u062A\u0631';
  34087. t['\uFC71'] = '\u062A\u0632';
  34088. t['\uFC72'] = '\u062A\u0645';
  34089. t['\uFC73'] = '\u062A\u0646';
  34090. t['\uFC74'] = '\u062A\u0649';
  34091. t['\uFC75'] = '\u062A\u064A';
  34092. t['\uFC76'] = '\u062B\u0631';
  34093. t['\uFC77'] = '\u062B\u0632';
  34094. t['\uFC78'] = '\u062B\u0645';
  34095. t['\uFC79'] = '\u062B\u0646';
  34096. t['\uFC7A'] = '\u062B\u0649';
  34097. t['\uFC7B'] = '\u062B\u064A';
  34098. t['\uFC7C'] = '\u0641\u0649';
  34099. t['\uFC7D'] = '\u0641\u064A';
  34100. t['\uFC7E'] = '\u0642\u0649';
  34101. t['\uFC7F'] = '\u0642\u064A';
  34102. t['\uFC80'] = '\u0643\u0627';
  34103. t['\uFC81'] = '\u0643\u0644';
  34104. t['\uFC82'] = '\u0643\u0645';
  34105. t['\uFC83'] = '\u0643\u0649';
  34106. t['\uFC84'] = '\u0643\u064A';
  34107. t['\uFC85'] = '\u0644\u0645';
  34108. t['\uFC86'] = '\u0644\u0649';
  34109. t['\uFC87'] = '\u0644\u064A';
  34110. t['\uFC88'] = '\u0645\u0627';
  34111. t['\uFC89'] = '\u0645\u0645';
  34112. t['\uFC8A'] = '\u0646\u0631';
  34113. t['\uFC8B'] = '\u0646\u0632';
  34114. t['\uFC8C'] = '\u0646\u0645';
  34115. t['\uFC8D'] = '\u0646\u0646';
  34116. t['\uFC8E'] = '\u0646\u0649';
  34117. t['\uFC8F'] = '\u0646\u064A';
  34118. t['\uFC90'] = '\u0649\u0670';
  34119. t['\uFC91'] = '\u064A\u0631';
  34120. t['\uFC92'] = '\u064A\u0632';
  34121. t['\uFC93'] = '\u064A\u0645';
  34122. t['\uFC94'] = '\u064A\u0646';
  34123. t['\uFC95'] = '\u064A\u0649';
  34124. t['\uFC96'] = '\u064A\u064A';
  34125. t['\uFC97'] = '\u0626\u062C';
  34126. t['\uFC98'] = '\u0626\u062D';
  34127. t['\uFC99'] = '\u0626\u062E';
  34128. t['\uFC9A'] = '\u0626\u0645';
  34129. t['\uFC9B'] = '\u0626\u0647';
  34130. t['\uFC9C'] = '\u0628\u062C';
  34131. t['\uFC9D'] = '\u0628\u062D';
  34132. t['\uFC9E'] = '\u0628\u062E';
  34133. t['\uFC9F'] = '\u0628\u0645';
  34134. t['\uFCA0'] = '\u0628\u0647';
  34135. t['\uFCA1'] = '\u062A\u062C';
  34136. t['\uFCA2'] = '\u062A\u062D';
  34137. t['\uFCA3'] = '\u062A\u062E';
  34138. t['\uFCA4'] = '\u062A\u0645';
  34139. t['\uFCA5'] = '\u062A\u0647';
  34140. t['\uFCA6'] = '\u062B\u0645';
  34141. t['\uFCA7'] = '\u062C\u062D';
  34142. t['\uFCA8'] = '\u062C\u0645';
  34143. t['\uFCA9'] = '\u062D\u062C';
  34144. t['\uFCAA'] = '\u062D\u0645';
  34145. t['\uFCAB'] = '\u062E\u062C';
  34146. t['\uFCAC'] = '\u062E\u0645';
  34147. t['\uFCAD'] = '\u0633\u062C';
  34148. t['\uFCAE'] = '\u0633\u062D';
  34149. t['\uFCAF'] = '\u0633\u062E';
  34150. t['\uFCB0'] = '\u0633\u0645';
  34151. t['\uFCB1'] = '\u0635\u062D';
  34152. t['\uFCB2'] = '\u0635\u062E';
  34153. t['\uFCB3'] = '\u0635\u0645';
  34154. t['\uFCB4'] = '\u0636\u062C';
  34155. t['\uFCB5'] = '\u0636\u062D';
  34156. t['\uFCB6'] = '\u0636\u062E';
  34157. t['\uFCB7'] = '\u0636\u0645';
  34158. t['\uFCB8'] = '\u0637\u062D';
  34159. t['\uFCB9'] = '\u0638\u0645';
  34160. t['\uFCBA'] = '\u0639\u062C';
  34161. t['\uFCBB'] = '\u0639\u0645';
  34162. t['\uFCBC'] = '\u063A\u062C';
  34163. t['\uFCBD'] = '\u063A\u0645';
  34164. t['\uFCBE'] = '\u0641\u062C';
  34165. t['\uFCBF'] = '\u0641\u062D';
  34166. t['\uFCC0'] = '\u0641\u062E';
  34167. t['\uFCC1'] = '\u0641\u0645';
  34168. t['\uFCC2'] = '\u0642\u062D';
  34169. t['\uFCC3'] = '\u0642\u0645';
  34170. t['\uFCC4'] = '\u0643\u062C';
  34171. t['\uFCC5'] = '\u0643\u062D';
  34172. t['\uFCC6'] = '\u0643\u062E';
  34173. t['\uFCC7'] = '\u0643\u0644';
  34174. t['\uFCC8'] = '\u0643\u0645';
  34175. t['\uFCC9'] = '\u0644\u062C';
  34176. t['\uFCCA'] = '\u0644\u062D';
  34177. t['\uFCCB'] = '\u0644\u062E';
  34178. t['\uFCCC'] = '\u0644\u0645';
  34179. t['\uFCCD'] = '\u0644\u0647';
  34180. t['\uFCCE'] = '\u0645\u062C';
  34181. t['\uFCCF'] = '\u0645\u062D';
  34182. t['\uFCD0'] = '\u0645\u062E';
  34183. t['\uFCD1'] = '\u0645\u0645';
  34184. t['\uFCD2'] = '\u0646\u062C';
  34185. t['\uFCD3'] = '\u0646\u062D';
  34186. t['\uFCD4'] = '\u0646\u062E';
  34187. t['\uFCD5'] = '\u0646\u0645';
  34188. t['\uFCD6'] = '\u0646\u0647';
  34189. t['\uFCD7'] = '\u0647\u062C';
  34190. t['\uFCD8'] = '\u0647\u0645';
  34191. t['\uFCD9'] = '\u0647\u0670';
  34192. t['\uFCDA'] = '\u064A\u062C';
  34193. t['\uFCDB'] = '\u064A\u062D';
  34194. t['\uFCDC'] = '\u064A\u062E';
  34195. t['\uFCDD'] = '\u064A\u0645';
  34196. t['\uFCDE'] = '\u064A\u0647';
  34197. t['\uFCDF'] = '\u0626\u0645';
  34198. t['\uFCE0'] = '\u0626\u0647';
  34199. t['\uFCE1'] = '\u0628\u0645';
  34200. t['\uFCE2'] = '\u0628\u0647';
  34201. t['\uFCE3'] = '\u062A\u0645';
  34202. t['\uFCE4'] = '\u062A\u0647';
  34203. t['\uFCE5'] = '\u062B\u0645';
  34204. t['\uFCE6'] = '\u062B\u0647';
  34205. t['\uFCE7'] = '\u0633\u0645';
  34206. t['\uFCE8'] = '\u0633\u0647';
  34207. t['\uFCE9'] = '\u0634\u0645';
  34208. t['\uFCEA'] = '\u0634\u0647';
  34209. t['\uFCEB'] = '\u0643\u0644';
  34210. t['\uFCEC'] = '\u0643\u0645';
  34211. t['\uFCED'] = '\u0644\u0645';
  34212. t['\uFCEE'] = '\u0646\u0645';
  34213. t['\uFCEF'] = '\u0646\u0647';
  34214. t['\uFCF0'] = '\u064A\u0645';
  34215. t['\uFCF1'] = '\u064A\u0647';
  34216. t['\uFCF2'] = '\u0640\u064E\u0651';
  34217. t['\uFCF3'] = '\u0640\u064F\u0651';
  34218. t['\uFCF4'] = '\u0640\u0650\u0651';
  34219. t['\uFCF5'] = '\u0637\u0649';
  34220. t['\uFCF6'] = '\u0637\u064A';
  34221. t['\uFCF7'] = '\u0639\u0649';
  34222. t['\uFCF8'] = '\u0639\u064A';
  34223. t['\uFCF9'] = '\u063A\u0649';
  34224. t['\uFCFA'] = '\u063A\u064A';
  34225. t['\uFCFB'] = '\u0633\u0649';
  34226. t['\uFCFC'] = '\u0633\u064A';
  34227. t['\uFCFD'] = '\u0634\u0649';
  34228. t['\uFCFE'] = '\u0634\u064A';
  34229. t['\uFCFF'] = '\u062D\u0649';
  34230. t['\uFD00'] = '\u062D\u064A';
  34231. t['\uFD01'] = '\u062C\u0649';
  34232. t['\uFD02'] = '\u062C\u064A';
  34233. t['\uFD03'] = '\u062E\u0649';
  34234. t['\uFD04'] = '\u062E\u064A';
  34235. t['\uFD05'] = '\u0635\u0649';
  34236. t['\uFD06'] = '\u0635\u064A';
  34237. t['\uFD07'] = '\u0636\u0649';
  34238. t['\uFD08'] = '\u0636\u064A';
  34239. t['\uFD09'] = '\u0634\u062C';
  34240. t['\uFD0A'] = '\u0634\u062D';
  34241. t['\uFD0B'] = '\u0634\u062E';
  34242. t['\uFD0C'] = '\u0634\u0645';
  34243. t['\uFD0D'] = '\u0634\u0631';
  34244. t['\uFD0E'] = '\u0633\u0631';
  34245. t['\uFD0F'] = '\u0635\u0631';
  34246. t['\uFD10'] = '\u0636\u0631';
  34247. t['\uFD11'] = '\u0637\u0649';
  34248. t['\uFD12'] = '\u0637\u064A';
  34249. t['\uFD13'] = '\u0639\u0649';
  34250. t['\uFD14'] = '\u0639\u064A';
  34251. t['\uFD15'] = '\u063A\u0649';
  34252. t['\uFD16'] = '\u063A\u064A';
  34253. t['\uFD17'] = '\u0633\u0649';
  34254. t['\uFD18'] = '\u0633\u064A';
  34255. t['\uFD19'] = '\u0634\u0649';
  34256. t['\uFD1A'] = '\u0634\u064A';
  34257. t['\uFD1B'] = '\u062D\u0649';
  34258. t['\uFD1C'] = '\u062D\u064A';
  34259. t['\uFD1D'] = '\u062C\u0649';
  34260. t['\uFD1E'] = '\u062C\u064A';
  34261. t['\uFD1F'] = '\u062E\u0649';
  34262. t['\uFD20'] = '\u062E\u064A';
  34263. t['\uFD21'] = '\u0635\u0649';
  34264. t['\uFD22'] = '\u0635\u064A';
  34265. t['\uFD23'] = '\u0636\u0649';
  34266. t['\uFD24'] = '\u0636\u064A';
  34267. t['\uFD25'] = '\u0634\u062C';
  34268. t['\uFD26'] = '\u0634\u062D';
  34269. t['\uFD27'] = '\u0634\u062E';
  34270. t['\uFD28'] = '\u0634\u0645';
  34271. t['\uFD29'] = '\u0634\u0631';
  34272. t['\uFD2A'] = '\u0633\u0631';
  34273. t['\uFD2B'] = '\u0635\u0631';
  34274. t['\uFD2C'] = '\u0636\u0631';
  34275. t['\uFD2D'] = '\u0634\u062C';
  34276. t['\uFD2E'] = '\u0634\u062D';
  34277. t['\uFD2F'] = '\u0634\u062E';
  34278. t['\uFD30'] = '\u0634\u0645';
  34279. t['\uFD31'] = '\u0633\u0647';
  34280. t['\uFD32'] = '\u0634\u0647';
  34281. t['\uFD33'] = '\u0637\u0645';
  34282. t['\uFD34'] = '\u0633\u062C';
  34283. t['\uFD35'] = '\u0633\u062D';
  34284. t['\uFD36'] = '\u0633\u062E';
  34285. t['\uFD37'] = '\u0634\u062C';
  34286. t['\uFD38'] = '\u0634\u062D';
  34287. t['\uFD39'] = '\u0634\u062E';
  34288. t['\uFD3A'] = '\u0637\u0645';
  34289. t['\uFD3B'] = '\u0638\u0645';
  34290. t['\uFD3C'] = '\u0627\u064B';
  34291. t['\uFD3D'] = '\u0627\u064B';
  34292. t['\uFD50'] = '\u062A\u062C\u0645';
  34293. t['\uFD51'] = '\u062A\u062D\u062C';
  34294. t['\uFD52'] = '\u062A\u062D\u062C';
  34295. t['\uFD53'] = '\u062A\u062D\u0645';
  34296. t['\uFD54'] = '\u062A\u062E\u0645';
  34297. t['\uFD55'] = '\u062A\u0645\u062C';
  34298. t['\uFD56'] = '\u062A\u0645\u062D';
  34299. t['\uFD57'] = '\u062A\u0645\u062E';
  34300. t['\uFD58'] = '\u062C\u0645\u062D';
  34301. t['\uFD59'] = '\u062C\u0645\u062D';
  34302. t['\uFD5A'] = '\u062D\u0645\u064A';
  34303. t['\uFD5B'] = '\u062D\u0645\u0649';
  34304. t['\uFD5C'] = '\u0633\u062D\u062C';
  34305. t['\uFD5D'] = '\u0633\u062C\u062D';
  34306. t['\uFD5E'] = '\u0633\u062C\u0649';
  34307. t['\uFD5F'] = '\u0633\u0645\u062D';
  34308. t['\uFD60'] = '\u0633\u0645\u062D';
  34309. t['\uFD61'] = '\u0633\u0645\u062C';
  34310. t['\uFD62'] = '\u0633\u0645\u0645';
  34311. t['\uFD63'] = '\u0633\u0645\u0645';
  34312. t['\uFD64'] = '\u0635\u062D\u062D';
  34313. t['\uFD65'] = '\u0635\u062D\u062D';
  34314. t['\uFD66'] = '\u0635\u0645\u0645';
  34315. t['\uFD67'] = '\u0634\u062D\u0645';
  34316. t['\uFD68'] = '\u0634\u062D\u0645';
  34317. t['\uFD69'] = '\u0634\u062C\u064A';
  34318. t['\uFD6A'] = '\u0634\u0645\u062E';
  34319. t['\uFD6B'] = '\u0634\u0645\u062E';
  34320. t['\uFD6C'] = '\u0634\u0645\u0645';
  34321. t['\uFD6D'] = '\u0634\u0645\u0645';
  34322. t['\uFD6E'] = '\u0636\u062D\u0649';
  34323. t['\uFD6F'] = '\u0636\u062E\u0645';
  34324. t['\uFD70'] = '\u0636\u062E\u0645';
  34325. t['\uFD71'] = '\u0637\u0645\u062D';
  34326. t['\uFD72'] = '\u0637\u0645\u062D';
  34327. t['\uFD73'] = '\u0637\u0645\u0645';
  34328. t['\uFD74'] = '\u0637\u0645\u064A';
  34329. t['\uFD75'] = '\u0639\u062C\u0645';
  34330. t['\uFD76'] = '\u0639\u0645\u0645';
  34331. t['\uFD77'] = '\u0639\u0645\u0645';
  34332. t['\uFD78'] = '\u0639\u0645\u0649';
  34333. t['\uFD79'] = '\u063A\u0645\u0645';
  34334. t['\uFD7A'] = '\u063A\u0645\u064A';
  34335. t['\uFD7B'] = '\u063A\u0645\u0649';
  34336. t['\uFD7C'] = '\u0641\u062E\u0645';
  34337. t['\uFD7D'] = '\u0641\u062E\u0645';
  34338. t['\uFD7E'] = '\u0642\u0645\u062D';
  34339. t['\uFD7F'] = '\u0642\u0645\u0645';
  34340. t['\uFD80'] = '\u0644\u062D\u0645';
  34341. t['\uFD81'] = '\u0644\u062D\u064A';
  34342. t['\uFD82'] = '\u0644\u062D\u0649';
  34343. t['\uFD83'] = '\u0644\u062C\u062C';
  34344. t['\uFD84'] = '\u0644\u062C\u062C';
  34345. t['\uFD85'] = '\u0644\u062E\u0645';
  34346. t['\uFD86'] = '\u0644\u062E\u0645';
  34347. t['\uFD87'] = '\u0644\u0645\u062D';
  34348. t['\uFD88'] = '\u0644\u0645\u062D';
  34349. t['\uFD89'] = '\u0645\u062D\u062C';
  34350. t['\uFD8A'] = '\u0645\u062D\u0645';
  34351. t['\uFD8B'] = '\u0645\u062D\u064A';
  34352. t['\uFD8C'] = '\u0645\u062C\u062D';
  34353. t['\uFD8D'] = '\u0645\u062C\u0645';
  34354. t['\uFD8E'] = '\u0645\u062E\u062C';
  34355. t['\uFD8F'] = '\u0645\u062E\u0645';
  34356. t['\uFD92'] = '\u0645\u062C\u062E';
  34357. t['\uFD93'] = '\u0647\u0645\u062C';
  34358. t['\uFD94'] = '\u0647\u0645\u0645';
  34359. t['\uFD95'] = '\u0646\u062D\u0645';
  34360. t['\uFD96'] = '\u0646\u062D\u0649';
  34361. t['\uFD97'] = '\u0646\u062C\u0645';
  34362. t['\uFD98'] = '\u0646\u062C\u0645';
  34363. t['\uFD99'] = '\u0646\u062C\u0649';
  34364. t['\uFD9A'] = '\u0646\u0645\u064A';
  34365. t['\uFD9B'] = '\u0646\u0645\u0649';
  34366. t['\uFD9C'] = '\u064A\u0645\u0645';
  34367. t['\uFD9D'] = '\u064A\u0645\u0645';
  34368. t['\uFD9E'] = '\u0628\u062E\u064A';
  34369. t['\uFD9F'] = '\u062A\u062C\u064A';
  34370. t['\uFDA0'] = '\u062A\u062C\u0649';
  34371. t['\uFDA1'] = '\u062A\u062E\u064A';
  34372. t['\uFDA2'] = '\u062A\u062E\u0649';
  34373. t['\uFDA3'] = '\u062A\u0645\u064A';
  34374. t['\uFDA4'] = '\u062A\u0645\u0649';
  34375. t['\uFDA5'] = '\u062C\u0645\u064A';
  34376. t['\uFDA6'] = '\u062C\u062D\u0649';
  34377. t['\uFDA7'] = '\u062C\u0645\u0649';
  34378. t['\uFDA8'] = '\u0633\u062E\u0649';
  34379. t['\uFDA9'] = '\u0635\u062D\u064A';
  34380. t['\uFDAA'] = '\u0634\u062D\u064A';
  34381. t['\uFDAB'] = '\u0636\u062D\u064A';
  34382. t['\uFDAC'] = '\u0644\u062C\u064A';
  34383. t['\uFDAD'] = '\u0644\u0645\u064A';
  34384. t['\uFDAE'] = '\u064A\u062D\u064A';
  34385. t['\uFDAF'] = '\u064A\u062C\u064A';
  34386. t['\uFDB0'] = '\u064A\u0645\u064A';
  34387. t['\uFDB1'] = '\u0645\u0645\u064A';
  34388. t['\uFDB2'] = '\u0642\u0645\u064A';
  34389. t['\uFDB3'] = '\u0646\u062D\u064A';
  34390. t['\uFDB4'] = '\u0642\u0645\u062D';
  34391. t['\uFDB5'] = '\u0644\u062D\u0645';
  34392. t['\uFDB6'] = '\u0639\u0645\u064A';
  34393. t['\uFDB7'] = '\u0643\u0645\u064A';
  34394. t['\uFDB8'] = '\u0646\u062C\u062D';
  34395. t['\uFDB9'] = '\u0645\u062E\u064A';
  34396. t['\uFDBA'] = '\u0644\u062C\u0645';
  34397. t['\uFDBB'] = '\u0643\u0645\u0645';
  34398. t['\uFDBC'] = '\u0644\u062C\u0645';
  34399. t['\uFDBD'] = '\u0646\u062C\u062D';
  34400. t['\uFDBE'] = '\u062C\u062D\u064A';
  34401. t['\uFDBF'] = '\u062D\u062C\u064A';
  34402. t['\uFDC0'] = '\u0645\u062C\u064A';
  34403. t['\uFDC1'] = '\u0641\u0645\u064A';
  34404. t['\uFDC2'] = '\u0628\u062D\u064A';
  34405. t['\uFDC3'] = '\u0643\u0645\u0645';
  34406. t['\uFDC4'] = '\u0639\u062C\u0645';
  34407. t['\uFDC5'] = '\u0635\u0645\u0645';
  34408. t['\uFDC6'] = '\u0633\u062E\u064A';
  34409. t['\uFDC7'] = '\u0646\u062C\u064A';
  34410. t['\uFE49'] = '\u203E';
  34411. t['\uFE4A'] = '\u203E';
  34412. t['\uFE4B'] = '\u203E';
  34413. t['\uFE4C'] = '\u203E';
  34414. t['\uFE4D'] = '\u005F';
  34415. t['\uFE4E'] = '\u005F';
  34416. t['\uFE4F'] = '\u005F';
  34417. t['\uFE80'] = '\u0621';
  34418. t['\uFE81'] = '\u0622';
  34419. t['\uFE82'] = '\u0622';
  34420. t['\uFE83'] = '\u0623';
  34421. t['\uFE84'] = '\u0623';
  34422. t['\uFE85'] = '\u0624';
  34423. t['\uFE86'] = '\u0624';
  34424. t['\uFE87'] = '\u0625';
  34425. t['\uFE88'] = '\u0625';
  34426. t['\uFE89'] = '\u0626';
  34427. t['\uFE8A'] = '\u0626';
  34428. t['\uFE8B'] = '\u0626';
  34429. t['\uFE8C'] = '\u0626';
  34430. t['\uFE8D'] = '\u0627';
  34431. t['\uFE8E'] = '\u0627';
  34432. t['\uFE8F'] = '\u0628';
  34433. t['\uFE90'] = '\u0628';
  34434. t['\uFE91'] = '\u0628';
  34435. t['\uFE92'] = '\u0628';
  34436. t['\uFE93'] = '\u0629';
  34437. t['\uFE94'] = '\u0629';
  34438. t['\uFE95'] = '\u062A';
  34439. t['\uFE96'] = '\u062A';
  34440. t['\uFE97'] = '\u062A';
  34441. t['\uFE98'] = '\u062A';
  34442. t['\uFE99'] = '\u062B';
  34443. t['\uFE9A'] = '\u062B';
  34444. t['\uFE9B'] = '\u062B';
  34445. t['\uFE9C'] = '\u062B';
  34446. t['\uFE9D'] = '\u062C';
  34447. t['\uFE9E'] = '\u062C';
  34448. t['\uFE9F'] = '\u062C';
  34449. t['\uFEA0'] = '\u062C';
  34450. t['\uFEA1'] = '\u062D';
  34451. t['\uFEA2'] = '\u062D';
  34452. t['\uFEA3'] = '\u062D';
  34453. t['\uFEA4'] = '\u062D';
  34454. t['\uFEA5'] = '\u062E';
  34455. t['\uFEA6'] = '\u062E';
  34456. t['\uFEA7'] = '\u062E';
  34457. t['\uFEA8'] = '\u062E';
  34458. t['\uFEA9'] = '\u062F';
  34459. t['\uFEAA'] = '\u062F';
  34460. t['\uFEAB'] = '\u0630';
  34461. t['\uFEAC'] = '\u0630';
  34462. t['\uFEAD'] = '\u0631';
  34463. t['\uFEAE'] = '\u0631';
  34464. t['\uFEAF'] = '\u0632';
  34465. t['\uFEB0'] = '\u0632';
  34466. t['\uFEB1'] = '\u0633';
  34467. t['\uFEB2'] = '\u0633';
  34468. t['\uFEB3'] = '\u0633';
  34469. t['\uFEB4'] = '\u0633';
  34470. t['\uFEB5'] = '\u0634';
  34471. t['\uFEB6'] = '\u0634';
  34472. t['\uFEB7'] = '\u0634';
  34473. t['\uFEB8'] = '\u0634';
  34474. t['\uFEB9'] = '\u0635';
  34475. t['\uFEBA'] = '\u0635';
  34476. t['\uFEBB'] = '\u0635';
  34477. t['\uFEBC'] = '\u0635';
  34478. t['\uFEBD'] = '\u0636';
  34479. t['\uFEBE'] = '\u0636';
  34480. t['\uFEBF'] = '\u0636';
  34481. t['\uFEC0'] = '\u0636';
  34482. t['\uFEC1'] = '\u0637';
  34483. t['\uFEC2'] = '\u0637';
  34484. t['\uFEC3'] = '\u0637';
  34485. t['\uFEC4'] = '\u0637';
  34486. t['\uFEC5'] = '\u0638';
  34487. t['\uFEC6'] = '\u0638';
  34488. t['\uFEC7'] = '\u0638';
  34489. t['\uFEC8'] = '\u0638';
  34490. t['\uFEC9'] = '\u0639';
  34491. t['\uFECA'] = '\u0639';
  34492. t['\uFECB'] = '\u0639';
  34493. t['\uFECC'] = '\u0639';
  34494. t['\uFECD'] = '\u063A';
  34495. t['\uFECE'] = '\u063A';
  34496. t['\uFECF'] = '\u063A';
  34497. t['\uFED0'] = '\u063A';
  34498. t['\uFED1'] = '\u0641';
  34499. t['\uFED2'] = '\u0641';
  34500. t['\uFED3'] = '\u0641';
  34501. t['\uFED4'] = '\u0641';
  34502. t['\uFED5'] = '\u0642';
  34503. t['\uFED6'] = '\u0642';
  34504. t['\uFED7'] = '\u0642';
  34505. t['\uFED8'] = '\u0642';
  34506. t['\uFED9'] = '\u0643';
  34507. t['\uFEDA'] = '\u0643';
  34508. t['\uFEDB'] = '\u0643';
  34509. t['\uFEDC'] = '\u0643';
  34510. t['\uFEDD'] = '\u0644';
  34511. t['\uFEDE'] = '\u0644';
  34512. t['\uFEDF'] = '\u0644';
  34513. t['\uFEE0'] = '\u0644';
  34514. t['\uFEE1'] = '\u0645';
  34515. t['\uFEE2'] = '\u0645';
  34516. t['\uFEE3'] = '\u0645';
  34517. t['\uFEE4'] = '\u0645';
  34518. t['\uFEE5'] = '\u0646';
  34519. t['\uFEE6'] = '\u0646';
  34520. t['\uFEE7'] = '\u0646';
  34521. t['\uFEE8'] = '\u0646';
  34522. t['\uFEE9'] = '\u0647';
  34523. t['\uFEEA'] = '\u0647';
  34524. t['\uFEEB'] = '\u0647';
  34525. t['\uFEEC'] = '\u0647';
  34526. t['\uFEED'] = '\u0648';
  34527. t['\uFEEE'] = '\u0648';
  34528. t['\uFEEF'] = '\u0649';
  34529. t['\uFEF0'] = '\u0649';
  34530. t['\uFEF1'] = '\u064A';
  34531. t['\uFEF2'] = '\u064A';
  34532. t['\uFEF3'] = '\u064A';
  34533. t['\uFEF4'] = '\u064A';
  34534. t['\uFEF5'] = '\u0644\u0622';
  34535. t['\uFEF6'] = '\u0644\u0622';
  34536. t['\uFEF7'] = '\u0644\u0623';
  34537. t['\uFEF8'] = '\u0644\u0623';
  34538. t['\uFEF9'] = '\u0644\u0625';
  34539. t['\uFEFA'] = '\u0644\u0625';
  34540. t['\uFEFB'] = '\u0644\u0627';
  34541. t['\uFEFC'] = '\u0644\u0627';
  34542. });
  34543. function reverseIfRtl(chars) {
  34544. var charsLength = chars.length;
  34545. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  34546. return chars;
  34547. }
  34548. var s = '';
  34549. for (var ii = charsLength - 1; ii >= 0; ii--) {
  34550. s += chars[ii];
  34551. }
  34552. return s;
  34553. }
  34554. exports.mapSpecialUnicodeValues = mapSpecialUnicodeValues;
  34555. exports.reverseIfRtl = reverseIfRtl;
  34556. exports.getUnicodeRangeFor = getUnicodeRangeFor;
  34557. exports.getNormalizedUnicodes = getNormalizedUnicodes;
  34558. exports.getUnicodeForGlyph = getUnicodeForGlyph;
  34559. /***/ }),
  34560. /* 19 */
  34561. /***/ (function(module, exports, __w_pdfjs_require__) {
  34562. "use strict";
  34563. var sharedUtil = __w_pdfjs_require__(0);
  34564. var coreWorker = __w_pdfjs_require__(8);
  34565. var globalScope = sharedUtil.globalScope;
  34566. var OK_RESPONSE = 200;
  34567. var PARTIAL_CONTENT_RESPONSE = 206;
  34568. function NetworkManager(url, args) {
  34569. this.url = url;
  34570. args = args || {};
  34571. this.isHttp = /^https?:/i.test(url);
  34572. this.httpHeaders = this.isHttp && args.httpHeaders || {};
  34573. this.withCredentials = args.withCredentials || false;
  34574. this.getXhr = args.getXhr || function NetworkManager_getXhr() {
  34575. return new XMLHttpRequest();
  34576. };
  34577. this.currXhrId = 0;
  34578. this.pendingRequests = Object.create(null);
  34579. this.loadedRequests = Object.create(null);
  34580. }
  34581. function getArrayBuffer(xhr) {
  34582. var data = xhr.response;
  34583. if (typeof data !== 'string') {
  34584. return data;
  34585. }
  34586. var length = data.length;
  34587. var array = new Uint8Array(length);
  34588. for (var i = 0; i < length; i++) {
  34589. array[i] = data.charCodeAt(i) & 0xFF;
  34590. }
  34591. return array.buffer;
  34592. }
  34593. var supportsMozChunked = function supportsMozChunkedClosure() {
  34594. try {
  34595. var x = new XMLHttpRequest();
  34596. x.open('GET', globalScope.location.href);
  34597. x.responseType = 'moz-chunked-arraybuffer';
  34598. return x.responseType === 'moz-chunked-arraybuffer';
  34599. } catch (e) {
  34600. return false;
  34601. }
  34602. }();
  34603. NetworkManager.prototype = {
  34604. requestRange: function NetworkManager_requestRange(begin, end, listeners) {
  34605. var args = {
  34606. begin: begin,
  34607. end: end
  34608. };
  34609. for (var prop in listeners) {
  34610. args[prop] = listeners[prop];
  34611. }
  34612. return this.request(args);
  34613. },
  34614. requestFull: function NetworkManager_requestFull(listeners) {
  34615. return this.request(listeners);
  34616. },
  34617. request: function NetworkManager_request(args) {
  34618. var xhr = this.getXhr();
  34619. var xhrId = this.currXhrId++;
  34620. var pendingRequest = this.pendingRequests[xhrId] = { xhr: xhr };
  34621. xhr.open('GET', this.url);
  34622. xhr.withCredentials = this.withCredentials;
  34623. for (var property in this.httpHeaders) {
  34624. var value = this.httpHeaders[property];
  34625. if (typeof value === 'undefined') {
  34626. continue;
  34627. }
  34628. xhr.setRequestHeader(property, value);
  34629. }
  34630. if (this.isHttp && 'begin' in args && 'end' in args) {
  34631. var rangeStr = args.begin + '-' + (args.end - 1);
  34632. xhr.setRequestHeader('Range', 'bytes=' + rangeStr);
  34633. pendingRequest.expectedStatus = 206;
  34634. } else {
  34635. pendingRequest.expectedStatus = 200;
  34636. }
  34637. var useMozChunkedLoading = supportsMozChunked && !!args.onProgressiveData;
  34638. if (useMozChunkedLoading) {
  34639. xhr.responseType = 'moz-chunked-arraybuffer';
  34640. pendingRequest.onProgressiveData = args.onProgressiveData;
  34641. pendingRequest.mozChunked = true;
  34642. } else {
  34643. xhr.responseType = 'arraybuffer';
  34644. }
  34645. if (args.onError) {
  34646. xhr.onerror = function (evt) {
  34647. args.onError(xhr.status);
  34648. };
  34649. }
  34650. xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);
  34651. xhr.onprogress = this.onProgress.bind(this, xhrId);
  34652. pendingRequest.onHeadersReceived = args.onHeadersReceived;
  34653. pendingRequest.onDone = args.onDone;
  34654. pendingRequest.onError = args.onError;
  34655. pendingRequest.onProgress = args.onProgress;
  34656. xhr.send(null);
  34657. return xhrId;
  34658. },
  34659. onProgress: function NetworkManager_onProgress(xhrId, evt) {
  34660. var pendingRequest = this.pendingRequests[xhrId];
  34661. if (!pendingRequest) {
  34662. return;
  34663. }
  34664. if (pendingRequest.mozChunked) {
  34665. var chunk = getArrayBuffer(pendingRequest.xhr);
  34666. pendingRequest.onProgressiveData(chunk);
  34667. }
  34668. var onProgress = pendingRequest.onProgress;
  34669. if (onProgress) {
  34670. onProgress(evt);
  34671. }
  34672. },
  34673. onStateChange: function NetworkManager_onStateChange(xhrId, evt) {
  34674. var pendingRequest = this.pendingRequests[xhrId];
  34675. if (!pendingRequest) {
  34676. return;
  34677. }
  34678. var xhr = pendingRequest.xhr;
  34679. if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {
  34680. pendingRequest.onHeadersReceived();
  34681. delete pendingRequest.onHeadersReceived;
  34682. }
  34683. if (xhr.readyState !== 4) {
  34684. return;
  34685. }
  34686. if (!(xhrId in this.pendingRequests)) {
  34687. return;
  34688. }
  34689. delete this.pendingRequests[xhrId];
  34690. if (xhr.status === 0 && this.isHttp) {
  34691. if (pendingRequest.onError) {
  34692. pendingRequest.onError(xhr.status);
  34693. }
  34694. return;
  34695. }
  34696. var xhrStatus = xhr.status || OK_RESPONSE;
  34697. var ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;
  34698. if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) {
  34699. if (pendingRequest.onError) {
  34700. pendingRequest.onError(xhr.status);
  34701. }
  34702. return;
  34703. }
  34704. this.loadedRequests[xhrId] = true;
  34705. var chunk = getArrayBuffer(xhr);
  34706. if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
  34707. var rangeHeader = xhr.getResponseHeader('Content-Range');
  34708. var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
  34709. var begin = parseInt(matches[1], 10);
  34710. pendingRequest.onDone({
  34711. begin: begin,
  34712. chunk: chunk
  34713. });
  34714. } else if (pendingRequest.onProgressiveData) {
  34715. pendingRequest.onDone(null);
  34716. } else if (chunk) {
  34717. pendingRequest.onDone({
  34718. begin: 0,
  34719. chunk: chunk
  34720. });
  34721. } else if (pendingRequest.onError) {
  34722. pendingRequest.onError(xhr.status);
  34723. }
  34724. },
  34725. hasPendingRequests: function NetworkManager_hasPendingRequests() {
  34726. for (var xhrId in this.pendingRequests) {
  34727. return true;
  34728. }
  34729. return false;
  34730. },
  34731. getRequestXhr: function NetworkManager_getXhr(xhrId) {
  34732. return this.pendingRequests[xhrId].xhr;
  34733. },
  34734. isStreamingRequest: function NetworkManager_isStreamingRequest(xhrId) {
  34735. return !!this.pendingRequests[xhrId].onProgressiveData;
  34736. },
  34737. isPendingRequest: function NetworkManager_isPendingRequest(xhrId) {
  34738. return xhrId in this.pendingRequests;
  34739. },
  34740. isLoadedRequest: function NetworkManager_isLoadedRequest(xhrId) {
  34741. return xhrId in this.loadedRequests;
  34742. },
  34743. abortAllRequests: function NetworkManager_abortAllRequests() {
  34744. for (var xhrId in this.pendingRequests) {
  34745. this.abortRequest(xhrId | 0);
  34746. }
  34747. },
  34748. abortRequest: function NetworkManager_abortRequest(xhrId) {
  34749. var xhr = this.pendingRequests[xhrId].xhr;
  34750. delete this.pendingRequests[xhrId];
  34751. xhr.abort();
  34752. }
  34753. };
  34754. var assert = sharedUtil.assert;
  34755. var createPromiseCapability = sharedUtil.createPromiseCapability;
  34756. var isInt = sharedUtil.isInt;
  34757. var MissingPDFException = sharedUtil.MissingPDFException;
  34758. var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
  34759. function PDFNetworkStream(options) {
  34760. this._options = options;
  34761. var source = options.source;
  34762. this._manager = new NetworkManager(source.url, {
  34763. httpHeaders: source.httpHeaders,
  34764. withCredentials: source.withCredentials
  34765. });
  34766. this._rangeChunkSize = source.rangeChunkSize;
  34767. this._fullRequestReader = null;
  34768. this._rangeRequestReaders = [];
  34769. }
  34770. PDFNetworkStream.prototype = {
  34771. _onRangeRequestReaderClosed: function PDFNetworkStream_onRangeRequestReaderClosed(reader) {
  34772. var i = this._rangeRequestReaders.indexOf(reader);
  34773. if (i >= 0) {
  34774. this._rangeRequestReaders.splice(i, 1);
  34775. }
  34776. },
  34777. getFullReader: function PDFNetworkStream_getFullReader() {
  34778. assert(!this._fullRequestReader);
  34779. this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._options);
  34780. return this._fullRequestReader;
  34781. },
  34782. getRangeReader: function PDFNetworkStream_getRangeReader(begin, end) {
  34783. var reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end);
  34784. reader.onClosed = this._onRangeRequestReaderClosed.bind(this);
  34785. this._rangeRequestReaders.push(reader);
  34786. return reader;
  34787. },
  34788. cancelAllRequests: function PDFNetworkStream_cancelAllRequests(reason) {
  34789. if (this._fullRequestReader) {
  34790. this._fullRequestReader.cancel(reason);
  34791. }
  34792. var readers = this._rangeRequestReaders.slice(0);
  34793. readers.forEach(function (reader) {
  34794. reader.cancel(reason);
  34795. });
  34796. }
  34797. };
  34798. function PDFNetworkStreamFullRequestReader(manager, options) {
  34799. this._manager = manager;
  34800. var source = options.source;
  34801. var args = {
  34802. onHeadersReceived: this._onHeadersReceived.bind(this),
  34803. onProgressiveData: source.disableStream ? null : this._onProgressiveData.bind(this),
  34804. onDone: this._onDone.bind(this),
  34805. onError: this._onError.bind(this),
  34806. onProgress: this._onProgress.bind(this)
  34807. };
  34808. this._url = source.url;
  34809. this._fullRequestId = manager.requestFull(args);
  34810. this._headersReceivedCapability = createPromiseCapability();
  34811. this._disableRange = options.disableRange || false;
  34812. this._contentLength = source.length;
  34813. this._rangeChunkSize = source.rangeChunkSize;
  34814. if (!this._rangeChunkSize && !this._disableRange) {
  34815. this._disableRange = true;
  34816. }
  34817. this._isStreamingSupported = false;
  34818. this._isRangeSupported = false;
  34819. this._cachedChunks = [];
  34820. this._requests = [];
  34821. this._done = false;
  34822. this._storedError = undefined;
  34823. this.onProgress = null;
  34824. }
  34825. PDFNetworkStreamFullRequestReader.prototype = {
  34826. _validateRangeRequestCapabilities: function PDFNetworkStreamFullRequestReader_validateRangeRequestCapabilities() {
  34827. if (this._disableRange) {
  34828. return false;
  34829. }
  34830. var networkManager = this._manager;
  34831. if (!networkManager.isHttp) {
  34832. return false;
  34833. }
  34834. var fullRequestXhrId = this._fullRequestId;
  34835. var fullRequestXhr = networkManager.getRequestXhr(fullRequestXhrId);
  34836. if (fullRequestXhr.getResponseHeader('Accept-Ranges') !== 'bytes') {
  34837. return false;
  34838. }
  34839. var contentEncoding = fullRequestXhr.getResponseHeader('Content-Encoding') || 'identity';
  34840. if (contentEncoding !== 'identity') {
  34841. return false;
  34842. }
  34843. var length = fullRequestXhr.getResponseHeader('Content-Length');
  34844. length = parseInt(length, 10);
  34845. if (!isInt(length)) {
  34846. return false;
  34847. }
  34848. this._contentLength = length;
  34849. if (length <= 2 * this._rangeChunkSize) {
  34850. return false;
  34851. }
  34852. return true;
  34853. },
  34854. _onHeadersReceived: function PDFNetworkStreamFullRequestReader_onHeadersReceived() {
  34855. if (this._validateRangeRequestCapabilities()) {
  34856. this._isRangeSupported = true;
  34857. }
  34858. var networkManager = this._manager;
  34859. var fullRequestXhrId = this._fullRequestId;
  34860. if (networkManager.isStreamingRequest(fullRequestXhrId)) {
  34861. this._isStreamingSupported = true;
  34862. } else if (this._isRangeSupported) {
  34863. networkManager.abortRequest(fullRequestXhrId);
  34864. }
  34865. this._headersReceivedCapability.resolve();
  34866. },
  34867. _onProgressiveData: function PDFNetworkStreamFullRequestReader_onProgressiveData(chunk) {
  34868. if (this._requests.length > 0) {
  34869. var requestCapability = this._requests.shift();
  34870. requestCapability.resolve({
  34871. value: chunk,
  34872. done: false
  34873. });
  34874. } else {
  34875. this._cachedChunks.push(chunk);
  34876. }
  34877. },
  34878. _onDone: function PDFNetworkStreamFullRequestReader_onDone(args) {
  34879. if (args) {
  34880. this._onProgressiveData(args.chunk);
  34881. }
  34882. this._done = true;
  34883. if (this._cachedChunks.length > 0) {
  34884. return;
  34885. }
  34886. this._requests.forEach(function (requestCapability) {
  34887. requestCapability.resolve({
  34888. value: undefined,
  34889. done: true
  34890. });
  34891. });
  34892. this._requests = [];
  34893. },
  34894. _onError: function PDFNetworkStreamFullRequestReader_onError(status) {
  34895. var url = this._url;
  34896. var exception;
  34897. if (status === 404 || status === 0 && /^file:/.test(url)) {
  34898. exception = new MissingPDFException('Missing PDF "' + url + '".');
  34899. } else {
  34900. exception = new UnexpectedResponseException('Unexpected server response (' + status + ') while retrieving PDF "' + url + '".', status);
  34901. }
  34902. this._storedError = exception;
  34903. this._headersReceivedCapability.reject(exception);
  34904. this._requests.forEach(function (requestCapability) {
  34905. requestCapability.reject(exception);
  34906. });
  34907. this._requests = [];
  34908. this._cachedChunks = [];
  34909. },
  34910. _onProgress: function PDFNetworkStreamFullRequestReader_onProgress(data) {
  34911. if (this.onProgress) {
  34912. this.onProgress({
  34913. loaded: data.loaded,
  34914. total: data.lengthComputable ? data.total : this._contentLength
  34915. });
  34916. }
  34917. },
  34918. get isRangeSupported() {
  34919. return this._isRangeSupported;
  34920. },
  34921. get isStreamingSupported() {
  34922. return this._isStreamingSupported;
  34923. },
  34924. get contentLength() {
  34925. return this._contentLength;
  34926. },
  34927. get headersReady() {
  34928. return this._headersReceivedCapability.promise;
  34929. },
  34930. read: function PDFNetworkStreamFullRequestReader_read() {
  34931. if (this._storedError) {
  34932. return Promise.reject(this._storedError);
  34933. }
  34934. if (this._cachedChunks.length > 0) {
  34935. var chunk = this._cachedChunks.shift();
  34936. return Promise.resolve(chunk);
  34937. }
  34938. if (this._done) {
  34939. return Promise.resolve({
  34940. value: undefined,
  34941. done: true
  34942. });
  34943. }
  34944. var requestCapability = createPromiseCapability();
  34945. this._requests.push(requestCapability);
  34946. return requestCapability.promise;
  34947. },
  34948. cancel: function PDFNetworkStreamFullRequestReader_cancel(reason) {
  34949. this._done = true;
  34950. this._headersReceivedCapability.reject(reason);
  34951. this._requests.forEach(function (requestCapability) {
  34952. requestCapability.resolve({
  34953. value: undefined,
  34954. done: true
  34955. });
  34956. });
  34957. this._requests = [];
  34958. if (this._manager.isPendingRequest(this._fullRequestId)) {
  34959. this._manager.abortRequest(this._fullRequestId);
  34960. }
  34961. this._fullRequestReader = null;
  34962. }
  34963. };
  34964. function PDFNetworkStreamRangeRequestReader(manager, begin, end) {
  34965. this._manager = manager;
  34966. var args = {
  34967. onDone: this._onDone.bind(this),
  34968. onProgress: this._onProgress.bind(this)
  34969. };
  34970. this._requestId = manager.requestRange(begin, end, args);
  34971. this._requests = [];
  34972. this._queuedChunk = null;
  34973. this._done = false;
  34974. this.onProgress = null;
  34975. this.onClosed = null;
  34976. }
  34977. PDFNetworkStreamRangeRequestReader.prototype = {
  34978. _close: function PDFNetworkStreamRangeRequestReader_close() {
  34979. if (this.onClosed) {
  34980. this.onClosed(this);
  34981. }
  34982. },
  34983. _onDone: function PDFNetworkStreamRangeRequestReader_onDone(data) {
  34984. var chunk = data.chunk;
  34985. if (this._requests.length > 0) {
  34986. var requestCapability = this._requests.shift();
  34987. requestCapability.resolve({
  34988. value: chunk,
  34989. done: false
  34990. });
  34991. } else {
  34992. this._queuedChunk = chunk;
  34993. }
  34994. this._done = true;
  34995. this._requests.forEach(function (requestCapability) {
  34996. requestCapability.resolve({
  34997. value: undefined,
  34998. done: true
  34999. });
  35000. });
  35001. this._requests = [];
  35002. this._close();
  35003. },
  35004. _onProgress: function PDFNetworkStreamRangeRequestReader_onProgress(evt) {
  35005. if (!this.isStreamingSupported && this.onProgress) {
  35006. this.onProgress({ loaded: evt.loaded });
  35007. }
  35008. },
  35009. get isStreamingSupported() {
  35010. return false;
  35011. },
  35012. read: function PDFNetworkStreamRangeRequestReader_read() {
  35013. if (this._queuedChunk !== null) {
  35014. var chunk = this._queuedChunk;
  35015. this._queuedChunk = null;
  35016. return Promise.resolve({
  35017. value: chunk,
  35018. done: false
  35019. });
  35020. }
  35021. if (this._done) {
  35022. return Promise.resolve({
  35023. value: undefined,
  35024. done: true
  35025. });
  35026. }
  35027. var requestCapability = createPromiseCapability();
  35028. this._requests.push(requestCapability);
  35029. return requestCapability.promise;
  35030. },
  35031. cancel: function PDFNetworkStreamRangeRequestReader_cancel(reason) {
  35032. this._done = true;
  35033. this._requests.forEach(function (requestCapability) {
  35034. requestCapability.resolve({
  35035. value: undefined,
  35036. done: true
  35037. });
  35038. });
  35039. this._requests = [];
  35040. if (this._manager.isPendingRequest(this._requestId)) {
  35041. this._manager.abortRequest(this._requestId);
  35042. }
  35043. this._close();
  35044. }
  35045. };
  35046. coreWorker.setPDFNetworkStreamClass(PDFNetworkStream);
  35047. exports.PDFNetworkStream = PDFNetworkStream;
  35048. exports.NetworkManager = NetworkManager;
  35049. /***/ }),
  35050. /* 20 */
  35051. /***/ (function(module, exports, __w_pdfjs_require__) {
  35052. "use strict";
  35053. var sharedUtil = __w_pdfjs_require__(0);
  35054. var corePrimitives = __w_pdfjs_require__(1);
  35055. var coreStream = __w_pdfjs_require__(2);
  35056. var coreColorSpace = __w_pdfjs_require__(3);
  35057. var coreObj = __w_pdfjs_require__(16);
  35058. var coreEvaluator = __w_pdfjs_require__(14);
  35059. var AnnotationBorderStyleType = sharedUtil.AnnotationBorderStyleType;
  35060. var AnnotationFieldFlag = sharedUtil.AnnotationFieldFlag;
  35061. var AnnotationFlag = sharedUtil.AnnotationFlag;
  35062. var AnnotationType = sharedUtil.AnnotationType;
  35063. var OPS = sharedUtil.OPS;
  35064. var Util = sharedUtil.Util;
  35065. var isArray = sharedUtil.isArray;
  35066. var isInt = sharedUtil.isInt;
  35067. var stringToBytes = sharedUtil.stringToBytes;
  35068. var stringToPDFString = sharedUtil.stringToPDFString;
  35069. var warn = sharedUtil.warn;
  35070. var Dict = corePrimitives.Dict;
  35071. var isDict = corePrimitives.isDict;
  35072. var isName = corePrimitives.isName;
  35073. var isRef = corePrimitives.isRef;
  35074. var isStream = corePrimitives.isStream;
  35075. var Stream = coreStream.Stream;
  35076. var ColorSpace = coreColorSpace.ColorSpace;
  35077. var Catalog = coreObj.Catalog;
  35078. var ObjectLoader = coreObj.ObjectLoader;
  35079. var FileSpec = coreObj.FileSpec;
  35080. var OperatorList = coreEvaluator.OperatorList;
  35081. function AnnotationFactory() {
  35082. }
  35083. AnnotationFactory.prototype = {
  35084. create: function AnnotationFactory_create(xref, ref, pdfManager, idFactory) {
  35085. var dict = xref.fetchIfRef(ref);
  35086. if (!isDict(dict)) {
  35087. return;
  35088. }
  35089. var id = isRef(ref) ? ref.toString() : 'annot_' + idFactory.createObjId();
  35090. var subtype = dict.get('Subtype');
  35091. subtype = isName(subtype) ? subtype.name : null;
  35092. var parameters = {
  35093. xref: xref,
  35094. dict: dict,
  35095. ref: isRef(ref) ? ref : null,
  35096. subtype: subtype,
  35097. id: id,
  35098. pdfManager: pdfManager
  35099. };
  35100. switch (subtype) {
  35101. case 'Link':
  35102. return new LinkAnnotation(parameters);
  35103. case 'Text':
  35104. return new TextAnnotation(parameters);
  35105. case 'Widget':
  35106. var fieldType = Util.getInheritableProperty(dict, 'FT');
  35107. fieldType = isName(fieldType) ? fieldType.name : null;
  35108. switch (fieldType) {
  35109. case 'Tx':
  35110. return new TextWidgetAnnotation(parameters);
  35111. case 'Btn':
  35112. return new ButtonWidgetAnnotation(parameters);
  35113. case 'Ch':
  35114. return new ChoiceWidgetAnnotation(parameters);
  35115. }
  35116. warn('Unimplemented widget field type "' + fieldType + '", ' + 'falling back to base field type.');
  35117. return new WidgetAnnotation(parameters);
  35118. case 'Popup':
  35119. return new PopupAnnotation(parameters);
  35120. case 'Highlight':
  35121. return new HighlightAnnotation(parameters);
  35122. case 'Underline':
  35123. return new UnderlineAnnotation(parameters);
  35124. case 'Squiggly':
  35125. return new SquigglyAnnotation(parameters);
  35126. case 'StrikeOut':
  35127. return new StrikeOutAnnotation(parameters);
  35128. case 'FileAttachment':
  35129. return new FileAttachmentAnnotation(parameters);
  35130. default:
  35131. if (!subtype) {
  35132. warn('Annotation is missing the required /Subtype.');
  35133. } else {
  35134. warn('Unimplemented annotation type "' + subtype + '", ' + 'falling back to base annotation.');
  35135. }
  35136. return new Annotation(parameters);
  35137. }
  35138. }
  35139. };
  35140. var Annotation = function AnnotationClosure() {
  35141. function getTransformMatrix(rect, bbox, matrix) {
  35142. var bounds = Util.getAxialAlignedBoundingBox(bbox, matrix);
  35143. var minX = bounds[0];
  35144. var minY = bounds[1];
  35145. var maxX = bounds[2];
  35146. var maxY = bounds[3];
  35147. if (minX === maxX || minY === maxY) {
  35148. return [
  35149. 1,
  35150. 0,
  35151. 0,
  35152. 1,
  35153. rect[0],
  35154. rect[1]
  35155. ];
  35156. }
  35157. var xRatio = (rect[2] - rect[0]) / (maxX - minX);
  35158. var yRatio = (rect[3] - rect[1]) / (maxY - minY);
  35159. return [
  35160. xRatio,
  35161. 0,
  35162. 0,
  35163. yRatio,
  35164. rect[0] - minX * xRatio,
  35165. rect[1] - minY * yRatio
  35166. ];
  35167. }
  35168. function Annotation(params) {
  35169. var dict = params.dict;
  35170. this.setFlags(dict.get('F'));
  35171. this.setRectangle(dict.getArray('Rect'));
  35172. this.setColor(dict.getArray('C'));
  35173. this.setBorderStyle(dict);
  35174. this.setAppearance(dict);
  35175. this.data = {};
  35176. this.data.id = params.id;
  35177. this.data.subtype = params.subtype;
  35178. this.data.annotationFlags = this.flags;
  35179. this.data.rect = this.rectangle;
  35180. this.data.color = this.color;
  35181. this.data.borderStyle = this.borderStyle;
  35182. this.data.hasAppearance = !!this.appearance;
  35183. }
  35184. Annotation.prototype = {
  35185. _hasFlag: function Annotation_hasFlag(flags, flag) {
  35186. return !!(flags & flag);
  35187. },
  35188. _isViewable: function Annotation_isViewable(flags) {
  35189. return !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.HIDDEN) && !this._hasFlag(flags, AnnotationFlag.NOVIEW);
  35190. },
  35191. _isPrintable: function AnnotationFlag_isPrintable(flags) {
  35192. return this._hasFlag(flags, AnnotationFlag.PRINT) && !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.HIDDEN);
  35193. },
  35194. get viewable() {
  35195. if (this.flags === 0) {
  35196. return true;
  35197. }
  35198. return this._isViewable(this.flags);
  35199. },
  35200. get printable() {
  35201. if (this.flags === 0) {
  35202. return false;
  35203. }
  35204. return this._isPrintable(this.flags);
  35205. },
  35206. setFlags: function Annotation_setFlags(flags) {
  35207. this.flags = isInt(flags) && flags > 0 ? flags : 0;
  35208. },
  35209. hasFlag: function Annotation_hasFlag(flag) {
  35210. return this._hasFlag(this.flags, flag);
  35211. },
  35212. setRectangle: function Annotation_setRectangle(rectangle) {
  35213. if (isArray(rectangle) && rectangle.length === 4) {
  35214. this.rectangle = Util.normalizeRect(rectangle);
  35215. } else {
  35216. this.rectangle = [
  35217. 0,
  35218. 0,
  35219. 0,
  35220. 0
  35221. ];
  35222. }
  35223. },
  35224. setColor: function Annotation_setColor(color) {
  35225. var rgbColor = new Uint8Array(3);
  35226. if (!isArray(color)) {
  35227. this.color = rgbColor;
  35228. return;
  35229. }
  35230. switch (color.length) {
  35231. case 0:
  35232. this.color = null;
  35233. break;
  35234. case 1:
  35235. ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  35236. this.color = rgbColor;
  35237. break;
  35238. case 3:
  35239. ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  35240. this.color = rgbColor;
  35241. break;
  35242. case 4:
  35243. ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  35244. this.color = rgbColor;
  35245. break;
  35246. default:
  35247. this.color = rgbColor;
  35248. break;
  35249. }
  35250. },
  35251. setBorderStyle: function Annotation_setBorderStyle(borderStyle) {
  35252. this.borderStyle = new AnnotationBorderStyle();
  35253. if (!isDict(borderStyle)) {
  35254. return;
  35255. }
  35256. if (borderStyle.has('BS')) {
  35257. var dict = borderStyle.get('BS');
  35258. var dictType = dict.get('Type');
  35259. if (!dictType || isName(dictType, 'Border')) {
  35260. this.borderStyle.setWidth(dict.get('W'));
  35261. this.borderStyle.setStyle(dict.get('S'));
  35262. this.borderStyle.setDashArray(dict.getArray('D'));
  35263. }
  35264. } else if (borderStyle.has('Border')) {
  35265. var array = borderStyle.getArray('Border');
  35266. if (isArray(array) && array.length >= 3) {
  35267. this.borderStyle.setHorizontalCornerRadius(array[0]);
  35268. this.borderStyle.setVerticalCornerRadius(array[1]);
  35269. this.borderStyle.setWidth(array[2]);
  35270. if (array.length === 4) {
  35271. this.borderStyle.setDashArray(array[3]);
  35272. }
  35273. }
  35274. } else {
  35275. this.borderStyle.setWidth(0);
  35276. }
  35277. },
  35278. setAppearance: function Annotation_setAppearance(dict) {
  35279. this.appearance = null;
  35280. var appearanceStates = dict.get('AP');
  35281. if (!isDict(appearanceStates)) {
  35282. return;
  35283. }
  35284. var normalAppearanceState = appearanceStates.get('N');
  35285. if (isStream(normalAppearanceState)) {
  35286. this.appearance = normalAppearanceState;
  35287. return;
  35288. }
  35289. if (!isDict(normalAppearanceState)) {
  35290. return;
  35291. }
  35292. var as = dict.get('AS');
  35293. if (!isName(as) || !normalAppearanceState.has(as.name)) {
  35294. return;
  35295. }
  35296. this.appearance = normalAppearanceState.get(as.name);
  35297. },
  35298. _preparePopup: function Annotation_preparePopup(dict) {
  35299. if (!dict.has('C')) {
  35300. this.data.color = null;
  35301. }
  35302. this.data.hasPopup = dict.has('Popup');
  35303. this.data.title = stringToPDFString(dict.get('T') || '');
  35304. this.data.contents = stringToPDFString(dict.get('Contents') || '');
  35305. },
  35306. loadResources: function Annotation_loadResources(keys) {
  35307. return new Promise(function (resolve, reject) {
  35308. this.appearance.dict.getAsync('Resources').then(function (resources) {
  35309. if (!resources) {
  35310. resolve();
  35311. return;
  35312. }
  35313. var objectLoader = new ObjectLoader(resources.map, keys, resources.xref);
  35314. objectLoader.load().then(function () {
  35315. resolve(resources);
  35316. }, reject);
  35317. }, reject);
  35318. }.bind(this));
  35319. },
  35320. getOperatorList: function Annotation_getOperatorList(evaluator, task, renderForms) {
  35321. if (!this.appearance) {
  35322. return Promise.resolve(new OperatorList());
  35323. }
  35324. var data = this.data;
  35325. var appearanceDict = this.appearance.dict;
  35326. var resourcesPromise = this.loadResources([
  35327. 'ExtGState',
  35328. 'ColorSpace',
  35329. 'Pattern',
  35330. 'Shading',
  35331. 'XObject',
  35332. 'Font'
  35333. ]);
  35334. var bbox = appearanceDict.getArray('BBox') || [
  35335. 0,
  35336. 0,
  35337. 1,
  35338. 1
  35339. ];
  35340. var matrix = appearanceDict.getArray('Matrix') || [
  35341. 1,
  35342. 0,
  35343. 0,
  35344. 1,
  35345. 0,
  35346. 0
  35347. ];
  35348. var transform = getTransformMatrix(data.rect, bbox, matrix);
  35349. var self = this;
  35350. return resourcesPromise.then(function (resources) {
  35351. var opList = new OperatorList();
  35352. opList.addOp(OPS.beginAnnotation, [
  35353. data.rect,
  35354. transform,
  35355. matrix
  35356. ]);
  35357. return evaluator.getOperatorList(self.appearance, task, resources, opList).then(function () {
  35358. opList.addOp(OPS.endAnnotation, []);
  35359. self.appearance.reset();
  35360. return opList;
  35361. });
  35362. });
  35363. }
  35364. };
  35365. return Annotation;
  35366. }();
  35367. var AnnotationBorderStyle = function AnnotationBorderStyleClosure() {
  35368. function AnnotationBorderStyle() {
  35369. this.width = 1;
  35370. this.style = AnnotationBorderStyleType.SOLID;
  35371. this.dashArray = [3];
  35372. this.horizontalCornerRadius = 0;
  35373. this.verticalCornerRadius = 0;
  35374. }
  35375. AnnotationBorderStyle.prototype = {
  35376. setWidth: function AnnotationBorderStyle_setWidth(width) {
  35377. if (width === (width | 0)) {
  35378. this.width = width;
  35379. }
  35380. },
  35381. setStyle: function AnnotationBorderStyle_setStyle(style) {
  35382. if (!style) {
  35383. return;
  35384. }
  35385. switch (style.name) {
  35386. case 'S':
  35387. this.style = AnnotationBorderStyleType.SOLID;
  35388. break;
  35389. case 'D':
  35390. this.style = AnnotationBorderStyleType.DASHED;
  35391. break;
  35392. case 'B':
  35393. this.style = AnnotationBorderStyleType.BEVELED;
  35394. break;
  35395. case 'I':
  35396. this.style = AnnotationBorderStyleType.INSET;
  35397. break;
  35398. case 'U':
  35399. this.style = AnnotationBorderStyleType.UNDERLINE;
  35400. break;
  35401. default:
  35402. break;
  35403. }
  35404. },
  35405. setDashArray: function AnnotationBorderStyle_setDashArray(dashArray) {
  35406. if (isArray(dashArray) && dashArray.length > 0) {
  35407. var isValid = true;
  35408. var allZeros = true;
  35409. for (var i = 0, len = dashArray.length; i < len; i++) {
  35410. var element = dashArray[i];
  35411. var validNumber = +element >= 0;
  35412. if (!validNumber) {
  35413. isValid = false;
  35414. break;
  35415. } else if (element > 0) {
  35416. allZeros = false;
  35417. }
  35418. }
  35419. if (isValid && !allZeros) {
  35420. this.dashArray = dashArray;
  35421. } else {
  35422. this.width = 0;
  35423. }
  35424. } else if (dashArray) {
  35425. this.width = 0;
  35426. }
  35427. },
  35428. setHorizontalCornerRadius: function AnnotationBorderStyle_setHorizontalCornerRadius(radius) {
  35429. if (radius === (radius | 0)) {
  35430. this.horizontalCornerRadius = radius;
  35431. }
  35432. },
  35433. setVerticalCornerRadius: function AnnotationBorderStyle_setVerticalCornerRadius(radius) {
  35434. if (radius === (radius | 0)) {
  35435. this.verticalCornerRadius = radius;
  35436. }
  35437. }
  35438. };
  35439. return AnnotationBorderStyle;
  35440. }();
  35441. var WidgetAnnotation = function WidgetAnnotationClosure() {
  35442. function WidgetAnnotation(params) {
  35443. Annotation.call(this, params);
  35444. var dict = params.dict;
  35445. var data = this.data;
  35446. data.annotationType = AnnotationType.WIDGET;
  35447. data.fieldName = this._constructFieldName(dict);
  35448. data.fieldValue = Util.getInheritableProperty(dict, 'V', true);
  35449. data.alternativeText = stringToPDFString(dict.get('TU') || '');
  35450. data.defaultAppearance = Util.getInheritableProperty(dict, 'DA') || '';
  35451. var fieldType = Util.getInheritableProperty(dict, 'FT');
  35452. data.fieldType = isName(fieldType) ? fieldType.name : null;
  35453. this.fieldResources = Util.getInheritableProperty(dict, 'DR') || Dict.empty;
  35454. data.fieldFlags = Util.getInheritableProperty(dict, 'Ff');
  35455. if (!isInt(data.fieldFlags) || data.fieldFlags < 0) {
  35456. data.fieldFlags = 0;
  35457. }
  35458. data.readOnly = this.hasFieldFlag(AnnotationFieldFlag.READONLY);
  35459. if (data.fieldType === 'Sig') {
  35460. this.setFlags(AnnotationFlag.HIDDEN);
  35461. }
  35462. }
  35463. Util.inherit(WidgetAnnotation, Annotation, {
  35464. _constructFieldName: function WidgetAnnotation_constructFieldName(dict) {
  35465. if (!dict.has('T') && !dict.has('Parent')) {
  35466. warn('Unknown field name, falling back to empty field name.');
  35467. return '';
  35468. }
  35469. if (!dict.has('Parent')) {
  35470. return stringToPDFString(dict.get('T'));
  35471. }
  35472. var fieldName = [];
  35473. if (dict.has('T')) {
  35474. fieldName.unshift(stringToPDFString(dict.get('T')));
  35475. }
  35476. var loopDict = dict;
  35477. while (loopDict.has('Parent')) {
  35478. loopDict = loopDict.get('Parent');
  35479. if (loopDict.has('T')) {
  35480. fieldName.unshift(stringToPDFString(loopDict.get('T')));
  35481. }
  35482. }
  35483. return fieldName.join('.');
  35484. },
  35485. hasFieldFlag: function WidgetAnnotation_hasFieldFlag(flag) {
  35486. return !!(this.data.fieldFlags & flag);
  35487. }
  35488. });
  35489. return WidgetAnnotation;
  35490. }();
  35491. var TextWidgetAnnotation = function TextWidgetAnnotationClosure() {
  35492. function TextWidgetAnnotation(params) {
  35493. WidgetAnnotation.call(this, params);
  35494. this.data.fieldValue = stringToPDFString(this.data.fieldValue || '');
  35495. var alignment = Util.getInheritableProperty(params.dict, 'Q');
  35496. if (!isInt(alignment) || alignment < 0 || alignment > 2) {
  35497. alignment = null;
  35498. }
  35499. this.data.textAlignment = alignment;
  35500. var maximumLength = Util.getInheritableProperty(params.dict, 'MaxLen');
  35501. if (!isInt(maximumLength) || maximumLength < 0) {
  35502. maximumLength = null;
  35503. }
  35504. this.data.maxLen = maximumLength;
  35505. this.data.multiLine = this.hasFieldFlag(AnnotationFieldFlag.MULTILINE);
  35506. this.data.comb = this.hasFieldFlag(AnnotationFieldFlag.COMB) && !this.hasFieldFlag(AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== null;
  35507. }
  35508. Util.inherit(TextWidgetAnnotation, WidgetAnnotation, {
  35509. getOperatorList: function TextWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  35510. var operatorList = new OperatorList();
  35511. if (renderForms) {
  35512. return Promise.resolve(operatorList);
  35513. }
  35514. if (this.appearance) {
  35515. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  35516. }
  35517. if (!this.data.defaultAppearance) {
  35518. return Promise.resolve(operatorList);
  35519. }
  35520. var stream = new Stream(stringToBytes(this.data.defaultAppearance));
  35521. return evaluator.getOperatorList(stream, task, this.fieldResources, operatorList).then(function () {
  35522. return operatorList;
  35523. });
  35524. }
  35525. });
  35526. return TextWidgetAnnotation;
  35527. }();
  35528. var ButtonWidgetAnnotation = function ButtonWidgetAnnotationClosure() {
  35529. function ButtonWidgetAnnotation(params) {
  35530. WidgetAnnotation.call(this, params);
  35531. this.data.checkBox = !this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  35532. if (this.data.checkBox) {
  35533. if (!isName(this.data.fieldValue)) {
  35534. return;
  35535. }
  35536. this.data.fieldValue = this.data.fieldValue.name;
  35537. }
  35538. this.data.radioButton = this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  35539. if (this.data.radioButton) {
  35540. this.data.fieldValue = this.data.buttonValue = null;
  35541. var fieldParent = params.dict.get('Parent');
  35542. if (isDict(fieldParent) && fieldParent.has('V')) {
  35543. var fieldParentValue = fieldParent.get('V');
  35544. if (isName(fieldParentValue)) {
  35545. this.data.fieldValue = fieldParentValue.name;
  35546. }
  35547. }
  35548. var appearanceStates = params.dict.get('AP');
  35549. if (!isDict(appearanceStates)) {
  35550. return;
  35551. }
  35552. var normalAppearanceState = appearanceStates.get('N');
  35553. if (!isDict(normalAppearanceState)) {
  35554. return;
  35555. }
  35556. var keys = normalAppearanceState.getKeys();
  35557. for (var i = 0, ii = keys.length; i < ii; i++) {
  35558. if (keys[i] !== 'Off') {
  35559. this.data.buttonValue = keys[i];
  35560. break;
  35561. }
  35562. }
  35563. }
  35564. }
  35565. Util.inherit(ButtonWidgetAnnotation, WidgetAnnotation, {
  35566. getOperatorList: function ButtonWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  35567. var operatorList = new OperatorList();
  35568. if (renderForms) {
  35569. return Promise.resolve(operatorList);
  35570. }
  35571. if (this.appearance) {
  35572. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  35573. }
  35574. return Promise.resolve(operatorList);
  35575. }
  35576. });
  35577. return ButtonWidgetAnnotation;
  35578. }();
  35579. var ChoiceWidgetAnnotation = function ChoiceWidgetAnnotationClosure() {
  35580. function ChoiceWidgetAnnotation(params) {
  35581. WidgetAnnotation.call(this, params);
  35582. this.data.options = [];
  35583. var options = Util.getInheritableProperty(params.dict, 'Opt');
  35584. if (isArray(options)) {
  35585. var xref = params.xref;
  35586. for (var i = 0, ii = options.length; i < ii; i++) {
  35587. var option = xref.fetchIfRef(options[i]);
  35588. var isOptionArray = isArray(option);
  35589. this.data.options[i] = {
  35590. exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option,
  35591. displayValue: isOptionArray ? xref.fetchIfRef(option[1]) : option
  35592. };
  35593. }
  35594. }
  35595. if (!isArray(this.data.fieldValue)) {
  35596. this.data.fieldValue = [this.data.fieldValue];
  35597. }
  35598. this.data.combo = this.hasFieldFlag(AnnotationFieldFlag.COMBO);
  35599. this.data.multiSelect = this.hasFieldFlag(AnnotationFieldFlag.MULTISELECT);
  35600. }
  35601. Util.inherit(ChoiceWidgetAnnotation, WidgetAnnotation, {
  35602. getOperatorList: function ChoiceWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  35603. var operatorList = new OperatorList();
  35604. if (renderForms) {
  35605. return Promise.resolve(operatorList);
  35606. }
  35607. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  35608. }
  35609. });
  35610. return ChoiceWidgetAnnotation;
  35611. }();
  35612. var TextAnnotation = function TextAnnotationClosure() {
  35613. var DEFAULT_ICON_SIZE = 22;
  35614. function TextAnnotation(parameters) {
  35615. Annotation.call(this, parameters);
  35616. this.data.annotationType = AnnotationType.TEXT;
  35617. if (this.data.hasAppearance) {
  35618. this.data.name = 'NoIcon';
  35619. } else {
  35620. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  35621. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  35622. this.data.name = parameters.dict.has('Name') ? parameters.dict.get('Name').name : 'Note';
  35623. }
  35624. this._preparePopup(parameters.dict);
  35625. }
  35626. Util.inherit(TextAnnotation, Annotation, {});
  35627. return TextAnnotation;
  35628. }();
  35629. var LinkAnnotation = function LinkAnnotationClosure() {
  35630. function LinkAnnotation(params) {
  35631. Annotation.call(this, params);
  35632. var data = this.data;
  35633. data.annotationType = AnnotationType.LINK;
  35634. Catalog.parseDestDictionary({
  35635. destDict: params.dict,
  35636. resultObj: data,
  35637. docBaseUrl: params.pdfManager.docBaseUrl
  35638. });
  35639. }
  35640. Util.inherit(LinkAnnotation, Annotation, {});
  35641. return LinkAnnotation;
  35642. }();
  35643. var PopupAnnotation = function PopupAnnotationClosure() {
  35644. function PopupAnnotation(parameters) {
  35645. Annotation.call(this, parameters);
  35646. this.data.annotationType = AnnotationType.POPUP;
  35647. var dict = parameters.dict;
  35648. var parentItem = dict.get('Parent');
  35649. if (!parentItem) {
  35650. warn('Popup annotation has a missing or invalid parent annotation.');
  35651. return;
  35652. }
  35653. this.data.parentId = dict.getRaw('Parent').toString();
  35654. this.data.title = stringToPDFString(parentItem.get('T') || '');
  35655. this.data.contents = stringToPDFString(parentItem.get('Contents') || '');
  35656. if (!parentItem.has('C')) {
  35657. this.data.color = null;
  35658. } else {
  35659. this.setColor(parentItem.getArray('C'));
  35660. this.data.color = this.color;
  35661. }
  35662. if (!this.viewable) {
  35663. var parentFlags = parentItem.get('F');
  35664. if (this._isViewable(parentFlags)) {
  35665. this.setFlags(parentFlags);
  35666. }
  35667. }
  35668. }
  35669. Util.inherit(PopupAnnotation, Annotation, {});
  35670. return PopupAnnotation;
  35671. }();
  35672. var HighlightAnnotation = function HighlightAnnotationClosure() {
  35673. function HighlightAnnotation(parameters) {
  35674. Annotation.call(this, parameters);
  35675. this.data.annotationType = AnnotationType.HIGHLIGHT;
  35676. this._preparePopup(parameters.dict);
  35677. this.data.borderStyle.setWidth(0);
  35678. }
  35679. Util.inherit(HighlightAnnotation, Annotation, {});
  35680. return HighlightAnnotation;
  35681. }();
  35682. var UnderlineAnnotation = function UnderlineAnnotationClosure() {
  35683. function UnderlineAnnotation(parameters) {
  35684. Annotation.call(this, parameters);
  35685. this.data.annotationType = AnnotationType.UNDERLINE;
  35686. this._preparePopup(parameters.dict);
  35687. this.data.borderStyle.setWidth(0);
  35688. }
  35689. Util.inherit(UnderlineAnnotation, Annotation, {});
  35690. return UnderlineAnnotation;
  35691. }();
  35692. var SquigglyAnnotation = function SquigglyAnnotationClosure() {
  35693. function SquigglyAnnotation(parameters) {
  35694. Annotation.call(this, parameters);
  35695. this.data.annotationType = AnnotationType.SQUIGGLY;
  35696. this._preparePopup(parameters.dict);
  35697. this.data.borderStyle.setWidth(0);
  35698. }
  35699. Util.inherit(SquigglyAnnotation, Annotation, {});
  35700. return SquigglyAnnotation;
  35701. }();
  35702. var StrikeOutAnnotation = function StrikeOutAnnotationClosure() {
  35703. function StrikeOutAnnotation(parameters) {
  35704. Annotation.call(this, parameters);
  35705. this.data.annotationType = AnnotationType.STRIKEOUT;
  35706. this._preparePopup(parameters.dict);
  35707. this.data.borderStyle.setWidth(0);
  35708. }
  35709. Util.inherit(StrikeOutAnnotation, Annotation, {});
  35710. return StrikeOutAnnotation;
  35711. }();
  35712. var FileAttachmentAnnotation = function FileAttachmentAnnotationClosure() {
  35713. function FileAttachmentAnnotation(parameters) {
  35714. Annotation.call(this, parameters);
  35715. var file = new FileSpec(parameters.dict.get('FS'), parameters.xref);
  35716. this.data.annotationType = AnnotationType.FILEATTACHMENT;
  35717. this.data.file = file.serializable;
  35718. this._preparePopup(parameters.dict);
  35719. }
  35720. Util.inherit(FileAttachmentAnnotation, Annotation, {});
  35721. return FileAttachmentAnnotation;
  35722. }();
  35723. exports.Annotation = Annotation;
  35724. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  35725. exports.AnnotationFactory = AnnotationFactory;
  35726. /***/ }),
  35727. /* 21 */
  35728. /***/ (function(module, exports, __w_pdfjs_require__) {
  35729. "use strict";
  35730. var sharedUtil = __w_pdfjs_require__(0);
  35731. var warn = sharedUtil.warn;
  35732. var baseTypes = [
  35733. 'BN',
  35734. 'BN',
  35735. 'BN',
  35736. 'BN',
  35737. 'BN',
  35738. 'BN',
  35739. 'BN',
  35740. 'BN',
  35741. 'BN',
  35742. 'S',
  35743. 'B',
  35744. 'S',
  35745. 'WS',
  35746. 'B',
  35747. 'BN',
  35748. 'BN',
  35749. 'BN',
  35750. 'BN',
  35751. 'BN',
  35752. 'BN',
  35753. 'BN',
  35754. 'BN',
  35755. 'BN',
  35756. 'BN',
  35757. 'BN',
  35758. 'BN',
  35759. 'BN',
  35760. 'BN',
  35761. 'B',
  35762. 'B',
  35763. 'B',
  35764. 'S',
  35765. 'WS',
  35766. 'ON',
  35767. 'ON',
  35768. 'ET',
  35769. 'ET',
  35770. 'ET',
  35771. 'ON',
  35772. 'ON',
  35773. 'ON',
  35774. 'ON',
  35775. 'ON',
  35776. 'ES',
  35777. 'CS',
  35778. 'ES',
  35779. 'CS',
  35780. 'CS',
  35781. 'EN',
  35782. 'EN',
  35783. 'EN',
  35784. 'EN',
  35785. 'EN',
  35786. 'EN',
  35787. 'EN',
  35788. 'EN',
  35789. 'EN',
  35790. 'EN',
  35791. 'CS',
  35792. 'ON',
  35793. 'ON',
  35794. 'ON',
  35795. 'ON',
  35796. 'ON',
  35797. 'ON',
  35798. 'L',
  35799. 'L',
  35800. 'L',
  35801. 'L',
  35802. 'L',
  35803. 'L',
  35804. 'L',
  35805. 'L',
  35806. 'L',
  35807. 'L',
  35808. 'L',
  35809. 'L',
  35810. 'L',
  35811. 'L',
  35812. 'L',
  35813. 'L',
  35814. 'L',
  35815. 'L',
  35816. 'L',
  35817. 'L',
  35818. 'L',
  35819. 'L',
  35820. 'L',
  35821. 'L',
  35822. 'L',
  35823. 'L',
  35824. 'ON',
  35825. 'ON',
  35826. 'ON',
  35827. 'ON',
  35828. 'ON',
  35829. 'ON',
  35830. 'L',
  35831. 'L',
  35832. 'L',
  35833. 'L',
  35834. 'L',
  35835. 'L',
  35836. 'L',
  35837. 'L',
  35838. 'L',
  35839. 'L',
  35840. 'L',
  35841. 'L',
  35842. 'L',
  35843. 'L',
  35844. 'L',
  35845. 'L',
  35846. 'L',
  35847. 'L',
  35848. 'L',
  35849. 'L',
  35850. 'L',
  35851. 'L',
  35852. 'L',
  35853. 'L',
  35854. 'L',
  35855. 'L',
  35856. 'ON',
  35857. 'ON',
  35858. 'ON',
  35859. 'ON',
  35860. 'BN',
  35861. 'BN',
  35862. 'BN',
  35863. 'BN',
  35864. 'BN',
  35865. 'BN',
  35866. 'B',
  35867. 'BN',
  35868. 'BN',
  35869. 'BN',
  35870. 'BN',
  35871. 'BN',
  35872. 'BN',
  35873. 'BN',
  35874. 'BN',
  35875. 'BN',
  35876. 'BN',
  35877. 'BN',
  35878. 'BN',
  35879. 'BN',
  35880. 'BN',
  35881. 'BN',
  35882. 'BN',
  35883. 'BN',
  35884. 'BN',
  35885. 'BN',
  35886. 'BN',
  35887. 'BN',
  35888. 'BN',
  35889. 'BN',
  35890. 'BN',
  35891. 'BN',
  35892. 'BN',
  35893. 'CS',
  35894. 'ON',
  35895. 'ET',
  35896. 'ET',
  35897. 'ET',
  35898. 'ET',
  35899. 'ON',
  35900. 'ON',
  35901. 'ON',
  35902. 'ON',
  35903. 'L',
  35904. 'ON',
  35905. 'ON',
  35906. 'BN',
  35907. 'ON',
  35908. 'ON',
  35909. 'ET',
  35910. 'ET',
  35911. 'EN',
  35912. 'EN',
  35913. 'ON',
  35914. 'L',
  35915. 'ON',
  35916. 'ON',
  35917. 'ON',
  35918. 'EN',
  35919. 'L',
  35920. 'ON',
  35921. 'ON',
  35922. 'ON',
  35923. 'ON',
  35924. 'ON',
  35925. 'L',
  35926. 'L',
  35927. 'L',
  35928. 'L',
  35929. 'L',
  35930. 'L',
  35931. 'L',
  35932. 'L',
  35933. 'L',
  35934. 'L',
  35935. 'L',
  35936. 'L',
  35937. 'L',
  35938. 'L',
  35939. 'L',
  35940. 'L',
  35941. 'L',
  35942. 'L',
  35943. 'L',
  35944. 'L',
  35945. 'L',
  35946. 'L',
  35947. 'L',
  35948. 'ON',
  35949. 'L',
  35950. 'L',
  35951. 'L',
  35952. 'L',
  35953. 'L',
  35954. 'L',
  35955. 'L',
  35956. 'L',
  35957. 'L',
  35958. 'L',
  35959. 'L',
  35960. 'L',
  35961. 'L',
  35962. 'L',
  35963. 'L',
  35964. 'L',
  35965. 'L',
  35966. 'L',
  35967. 'L',
  35968. 'L',
  35969. 'L',
  35970. 'L',
  35971. 'L',
  35972. 'L',
  35973. 'L',
  35974. 'L',
  35975. 'L',
  35976. 'L',
  35977. 'L',
  35978. 'L',
  35979. 'L',
  35980. 'ON',
  35981. 'L',
  35982. 'L',
  35983. 'L',
  35984. 'L',
  35985. 'L',
  35986. 'L',
  35987. 'L',
  35988. 'L'
  35989. ];
  35990. var arabicTypes = [
  35991. 'AN',
  35992. 'AN',
  35993. 'AN',
  35994. 'AN',
  35995. 'AN',
  35996. 'AN',
  35997. 'ON',
  35998. 'ON',
  35999. 'AL',
  36000. 'ET',
  36001. 'ET',
  36002. 'AL',
  36003. 'CS',
  36004. 'AL',
  36005. 'ON',
  36006. 'ON',
  36007. 'NSM',
  36008. 'NSM',
  36009. 'NSM',
  36010. 'NSM',
  36011. 'NSM',
  36012. 'NSM',
  36013. 'NSM',
  36014. 'NSM',
  36015. 'NSM',
  36016. 'NSM',
  36017. 'NSM',
  36018. 'AL',
  36019. 'AL',
  36020. '',
  36021. 'AL',
  36022. 'AL',
  36023. 'AL',
  36024. 'AL',
  36025. 'AL',
  36026. 'AL',
  36027. 'AL',
  36028. 'AL',
  36029. 'AL',
  36030. 'AL',
  36031. 'AL',
  36032. 'AL',
  36033. 'AL',
  36034. 'AL',
  36035. 'AL',
  36036. 'AL',
  36037. 'AL',
  36038. 'AL',
  36039. 'AL',
  36040. 'AL',
  36041. 'AL',
  36042. 'AL',
  36043. 'AL',
  36044. 'AL',
  36045. 'AL',
  36046. 'AL',
  36047. 'AL',
  36048. 'AL',
  36049. 'AL',
  36050. 'AL',
  36051. 'AL',
  36052. 'AL',
  36053. 'AL',
  36054. 'AL',
  36055. 'AL',
  36056. 'AL',
  36057. 'AL',
  36058. 'AL',
  36059. 'AL',
  36060. 'AL',
  36061. 'AL',
  36062. 'AL',
  36063. 'AL',
  36064. 'AL',
  36065. 'AL',
  36066. 'NSM',
  36067. 'NSM',
  36068. 'NSM',
  36069. 'NSM',
  36070. 'NSM',
  36071. 'NSM',
  36072. 'NSM',
  36073. 'NSM',
  36074. 'NSM',
  36075. 'NSM',
  36076. 'NSM',
  36077. 'NSM',
  36078. 'NSM',
  36079. 'NSM',
  36080. 'NSM',
  36081. 'NSM',
  36082. 'NSM',
  36083. 'NSM',
  36084. 'NSM',
  36085. 'NSM',
  36086. 'NSM',
  36087. 'AN',
  36088. 'AN',
  36089. 'AN',
  36090. 'AN',
  36091. 'AN',
  36092. 'AN',
  36093. 'AN',
  36094. 'AN',
  36095. 'AN',
  36096. 'AN',
  36097. 'ET',
  36098. 'AN',
  36099. 'AN',
  36100. 'AL',
  36101. 'AL',
  36102. 'AL',
  36103. 'NSM',
  36104. 'AL',
  36105. 'AL',
  36106. 'AL',
  36107. 'AL',
  36108. 'AL',
  36109. 'AL',
  36110. 'AL',
  36111. 'AL',
  36112. 'AL',
  36113. 'AL',
  36114. 'AL',
  36115. 'AL',
  36116. 'AL',
  36117. 'AL',
  36118. 'AL',
  36119. 'AL',
  36120. 'AL',
  36121. 'AL',
  36122. 'AL',
  36123. 'AL',
  36124. 'AL',
  36125. 'AL',
  36126. 'AL',
  36127. 'AL',
  36128. 'AL',
  36129. 'AL',
  36130. 'AL',
  36131. 'AL',
  36132. 'AL',
  36133. 'AL',
  36134. 'AL',
  36135. 'AL',
  36136. 'AL',
  36137. 'AL',
  36138. 'AL',
  36139. 'AL',
  36140. 'AL',
  36141. 'AL',
  36142. 'AL',
  36143. 'AL',
  36144. 'AL',
  36145. 'AL',
  36146. 'AL',
  36147. 'AL',
  36148. 'AL',
  36149. 'AL',
  36150. 'AL',
  36151. 'AL',
  36152. 'AL',
  36153. 'AL',
  36154. 'AL',
  36155. 'AL',
  36156. 'AL',
  36157. 'AL',
  36158. 'AL',
  36159. 'AL',
  36160. 'AL',
  36161. 'AL',
  36162. 'AL',
  36163. 'AL',
  36164. 'AL',
  36165. 'AL',
  36166. 'AL',
  36167. 'AL',
  36168. 'AL',
  36169. 'AL',
  36170. 'AL',
  36171. 'AL',
  36172. 'AL',
  36173. 'AL',
  36174. 'AL',
  36175. 'AL',
  36176. 'AL',
  36177. 'AL',
  36178. 'AL',
  36179. 'AL',
  36180. 'AL',
  36181. 'AL',
  36182. 'AL',
  36183. 'AL',
  36184. 'AL',
  36185. 'AL',
  36186. 'AL',
  36187. 'AL',
  36188. 'AL',
  36189. 'AL',
  36190. 'AL',
  36191. 'AL',
  36192. 'AL',
  36193. 'AL',
  36194. 'AL',
  36195. 'AL',
  36196. 'AL',
  36197. 'AL',
  36198. 'AL',
  36199. 'AL',
  36200. 'AL',
  36201. 'AL',
  36202. 'AL',
  36203. 'AL',
  36204. 'AL',
  36205. 'NSM',
  36206. 'NSM',
  36207. 'NSM',
  36208. 'NSM',
  36209. 'NSM',
  36210. 'NSM',
  36211. 'NSM',
  36212. 'AN',
  36213. 'ON',
  36214. 'NSM',
  36215. 'NSM',
  36216. 'NSM',
  36217. 'NSM',
  36218. 'NSM',
  36219. 'NSM',
  36220. 'AL',
  36221. 'AL',
  36222. 'NSM',
  36223. 'NSM',
  36224. 'ON',
  36225. 'NSM',
  36226. 'NSM',
  36227. 'NSM',
  36228. 'NSM',
  36229. 'AL',
  36230. 'AL',
  36231. 'EN',
  36232. 'EN',
  36233. 'EN',
  36234. 'EN',
  36235. 'EN',
  36236. 'EN',
  36237. 'EN',
  36238. 'EN',
  36239. 'EN',
  36240. 'EN',
  36241. 'AL',
  36242. 'AL',
  36243. 'AL',
  36244. 'AL',
  36245. 'AL',
  36246. 'AL'
  36247. ];
  36248. function isOdd(i) {
  36249. return (i & 1) !== 0;
  36250. }
  36251. function isEven(i) {
  36252. return (i & 1) === 0;
  36253. }
  36254. function findUnequal(arr, start, value) {
  36255. for (var j = start, jj = arr.length; j < jj; ++j) {
  36256. if (arr[j] !== value) {
  36257. return j;
  36258. }
  36259. }
  36260. return j;
  36261. }
  36262. function setValues(arr, start, end, value) {
  36263. for (var j = start; j < end; ++j) {
  36264. arr[j] = value;
  36265. }
  36266. }
  36267. function reverseValues(arr, start, end) {
  36268. for (var i = start, j = end - 1; i < j; ++i, --j) {
  36269. var temp = arr[i];
  36270. arr[i] = arr[j];
  36271. arr[j] = temp;
  36272. }
  36273. }
  36274. function createBidiText(str, isLTR, vertical) {
  36275. return {
  36276. str: str,
  36277. dir: vertical ? 'ttb' : isLTR ? 'ltr' : 'rtl'
  36278. };
  36279. }
  36280. var chars = [];
  36281. var types = [];
  36282. function bidi(str, startLevel, vertical) {
  36283. var isLTR = true;
  36284. var strLength = str.length;
  36285. if (strLength === 0 || vertical) {
  36286. return createBidiText(str, isLTR, vertical);
  36287. }
  36288. chars.length = strLength;
  36289. types.length = strLength;
  36290. var numBidi = 0;
  36291. var i, ii;
  36292. for (i = 0; i < strLength; ++i) {
  36293. chars[i] = str.charAt(i);
  36294. var charCode = str.charCodeAt(i);
  36295. var charType = 'L';
  36296. if (charCode <= 0x00ff) {
  36297. charType = baseTypes[charCode];
  36298. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  36299. charType = 'R';
  36300. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  36301. charType = arabicTypes[charCode & 0xff];
  36302. if (!charType) {
  36303. warn('Bidi: invalid Unicode character ' + charCode.toString(16));
  36304. }
  36305. } else if (0x0700 <= charCode && charCode <= 0x08AC) {
  36306. charType = 'AL';
  36307. }
  36308. if (charType === 'R' || charType === 'AL' || charType === 'AN') {
  36309. numBidi++;
  36310. }
  36311. types[i] = charType;
  36312. }
  36313. if (numBidi === 0) {
  36314. isLTR = true;
  36315. return createBidiText(str, isLTR);
  36316. }
  36317. if (startLevel === -1) {
  36318. if (numBidi / strLength < 0.3) {
  36319. isLTR = true;
  36320. startLevel = 0;
  36321. } else {
  36322. isLTR = false;
  36323. startLevel = 1;
  36324. }
  36325. }
  36326. var levels = [];
  36327. for (i = 0; i < strLength; ++i) {
  36328. levels[i] = startLevel;
  36329. }
  36330. var e = isOdd(startLevel) ? 'R' : 'L';
  36331. var sor = e;
  36332. var eor = sor;
  36333. var lastType = sor;
  36334. for (i = 0; i < strLength; ++i) {
  36335. if (types[i] === 'NSM') {
  36336. types[i] = lastType;
  36337. } else {
  36338. lastType = types[i];
  36339. }
  36340. }
  36341. lastType = sor;
  36342. var t;
  36343. for (i = 0; i < strLength; ++i) {
  36344. t = types[i];
  36345. if (t === 'EN') {
  36346. types[i] = lastType === 'AL' ? 'AN' : 'EN';
  36347. } else if (t === 'R' || t === 'L' || t === 'AL') {
  36348. lastType = t;
  36349. }
  36350. }
  36351. for (i = 0; i < strLength; ++i) {
  36352. t = types[i];
  36353. if (t === 'AL') {
  36354. types[i] = 'R';
  36355. }
  36356. }
  36357. for (i = 1; i < strLength - 1; ++i) {
  36358. if (types[i] === 'ES' && types[i - 1] === 'EN' && types[i + 1] === 'EN') {
  36359. types[i] = 'EN';
  36360. }
  36361. if (types[i] === 'CS' && (types[i - 1] === 'EN' || types[i - 1] === 'AN') && types[i + 1] === types[i - 1]) {
  36362. types[i] = types[i - 1];
  36363. }
  36364. }
  36365. for (i = 0; i < strLength; ++i) {
  36366. if (types[i] === 'EN') {
  36367. var j;
  36368. for (j = i - 1; j >= 0; --j) {
  36369. if (types[j] !== 'ET') {
  36370. break;
  36371. }
  36372. types[j] = 'EN';
  36373. }
  36374. for (j = i + 1; j < strLength; ++j) {
  36375. if (types[j] !== 'ET') {
  36376. break;
  36377. }
  36378. types[j] = 'EN';
  36379. }
  36380. }
  36381. }
  36382. for (i = 0; i < strLength; ++i) {
  36383. t = types[i];
  36384. if (t === 'WS' || t === 'ES' || t === 'ET' || t === 'CS') {
  36385. types[i] = 'ON';
  36386. }
  36387. }
  36388. lastType = sor;
  36389. for (i = 0; i < strLength; ++i) {
  36390. t = types[i];
  36391. if (t === 'EN') {
  36392. types[i] = lastType === 'L' ? 'L' : 'EN';
  36393. } else if (t === 'R' || t === 'L') {
  36394. lastType = t;
  36395. }
  36396. }
  36397. for (i = 0; i < strLength; ++i) {
  36398. if (types[i] === 'ON') {
  36399. var end = findUnequal(types, i + 1, 'ON');
  36400. var before = sor;
  36401. if (i > 0) {
  36402. before = types[i - 1];
  36403. }
  36404. var after = eor;
  36405. if (end + 1 < strLength) {
  36406. after = types[end + 1];
  36407. }
  36408. if (before !== 'L') {
  36409. before = 'R';
  36410. }
  36411. if (after !== 'L') {
  36412. after = 'R';
  36413. }
  36414. if (before === after) {
  36415. setValues(types, i, end, before);
  36416. }
  36417. i = end - 1;
  36418. }
  36419. }
  36420. for (i = 0; i < strLength; ++i) {
  36421. if (types[i] === 'ON') {
  36422. types[i] = e;
  36423. }
  36424. }
  36425. for (i = 0; i < strLength; ++i) {
  36426. t = types[i];
  36427. if (isEven(levels[i])) {
  36428. if (t === 'R') {
  36429. levels[i] += 1;
  36430. } else if (t === 'AN' || t === 'EN') {
  36431. levels[i] += 2;
  36432. }
  36433. } else {
  36434. if (t === 'L' || t === 'AN' || t === 'EN') {
  36435. levels[i] += 1;
  36436. }
  36437. }
  36438. }
  36439. var highestLevel = -1;
  36440. var lowestOddLevel = 99;
  36441. var level;
  36442. for (i = 0, ii = levels.length; i < ii; ++i) {
  36443. level = levels[i];
  36444. if (highestLevel < level) {
  36445. highestLevel = level;
  36446. }
  36447. if (lowestOddLevel > level && isOdd(level)) {
  36448. lowestOddLevel = level;
  36449. }
  36450. }
  36451. for (level = highestLevel; level >= lowestOddLevel; --level) {
  36452. var start = -1;
  36453. for (i = 0, ii = levels.length; i < ii; ++i) {
  36454. if (levels[i] < level) {
  36455. if (start >= 0) {
  36456. reverseValues(chars, start, i);
  36457. start = -1;
  36458. }
  36459. } else if (start < 0) {
  36460. start = i;
  36461. }
  36462. }
  36463. if (start >= 0) {
  36464. reverseValues(chars, start, levels.length);
  36465. }
  36466. }
  36467. for (i = 0, ii = chars.length; i < ii; ++i) {
  36468. var ch = chars[i];
  36469. if (ch === '<' || ch === '>') {
  36470. chars[i] = '';
  36471. }
  36472. }
  36473. return createBidiText(chars.join(''), isLTR);
  36474. }
  36475. exports.bidi = bidi;
  36476. /***/ }),
  36477. /* 22 */
  36478. /***/ (function(module, exports, __w_pdfjs_require__) {
  36479. "use strict";
  36480. var ISOAdobeCharset = [
  36481. '.notdef',
  36482. 'space',
  36483. 'exclam',
  36484. 'quotedbl',
  36485. 'numbersign',
  36486. 'dollar',
  36487. 'percent',
  36488. 'ampersand',
  36489. 'quoteright',
  36490. 'parenleft',
  36491. 'parenright',
  36492. 'asterisk',
  36493. 'plus',
  36494. 'comma',
  36495. 'hyphen',
  36496. 'period',
  36497. 'slash',
  36498. 'zero',
  36499. 'one',
  36500. 'two',
  36501. 'three',
  36502. 'four',
  36503. 'five',
  36504. 'six',
  36505. 'seven',
  36506. 'eight',
  36507. 'nine',
  36508. 'colon',
  36509. 'semicolon',
  36510. 'less',
  36511. 'equal',
  36512. 'greater',
  36513. 'question',
  36514. 'at',
  36515. 'A',
  36516. 'B',
  36517. 'C',
  36518. 'D',
  36519. 'E',
  36520. 'F',
  36521. 'G',
  36522. 'H',
  36523. 'I',
  36524. 'J',
  36525. 'K',
  36526. 'L',
  36527. 'M',
  36528. 'N',
  36529. 'O',
  36530. 'P',
  36531. 'Q',
  36532. 'R',
  36533. 'S',
  36534. 'T',
  36535. 'U',
  36536. 'V',
  36537. 'W',
  36538. 'X',
  36539. 'Y',
  36540. 'Z',
  36541. 'bracketleft',
  36542. 'backslash',
  36543. 'bracketright',
  36544. 'asciicircum',
  36545. 'underscore',
  36546. 'quoteleft',
  36547. 'a',
  36548. 'b',
  36549. 'c',
  36550. 'd',
  36551. 'e',
  36552. 'f',
  36553. 'g',
  36554. 'h',
  36555. 'i',
  36556. 'j',
  36557. 'k',
  36558. 'l',
  36559. 'm',
  36560. 'n',
  36561. 'o',
  36562. 'p',
  36563. 'q',
  36564. 'r',
  36565. 's',
  36566. 't',
  36567. 'u',
  36568. 'v',
  36569. 'w',
  36570. 'x',
  36571. 'y',
  36572. 'z',
  36573. 'braceleft',
  36574. 'bar',
  36575. 'braceright',
  36576. 'asciitilde',
  36577. 'exclamdown',
  36578. 'cent',
  36579. 'sterling',
  36580. 'fraction',
  36581. 'yen',
  36582. 'florin',
  36583. 'section',
  36584. 'currency',
  36585. 'quotesingle',
  36586. 'quotedblleft',
  36587. 'guillemotleft',
  36588. 'guilsinglleft',
  36589. 'guilsinglright',
  36590. 'fi',
  36591. 'fl',
  36592. 'endash',
  36593. 'dagger',
  36594. 'daggerdbl',
  36595. 'periodcentered',
  36596. 'paragraph',
  36597. 'bullet',
  36598. 'quotesinglbase',
  36599. 'quotedblbase',
  36600. 'quotedblright',
  36601. 'guillemotright',
  36602. 'ellipsis',
  36603. 'perthousand',
  36604. 'questiondown',
  36605. 'grave',
  36606. 'acute',
  36607. 'circumflex',
  36608. 'tilde',
  36609. 'macron',
  36610. 'breve',
  36611. 'dotaccent',
  36612. 'dieresis',
  36613. 'ring',
  36614. 'cedilla',
  36615. 'hungarumlaut',
  36616. 'ogonek',
  36617. 'caron',
  36618. 'emdash',
  36619. 'AE',
  36620. 'ordfeminine',
  36621. 'Lslash',
  36622. 'Oslash',
  36623. 'OE',
  36624. 'ordmasculine',
  36625. 'ae',
  36626. 'dotlessi',
  36627. 'lslash',
  36628. 'oslash',
  36629. 'oe',
  36630. 'germandbls',
  36631. 'onesuperior',
  36632. 'logicalnot',
  36633. 'mu',
  36634. 'trademark',
  36635. 'Eth',
  36636. 'onehalf',
  36637. 'plusminus',
  36638. 'Thorn',
  36639. 'onequarter',
  36640. 'divide',
  36641. 'brokenbar',
  36642. 'degree',
  36643. 'thorn',
  36644. 'threequarters',
  36645. 'twosuperior',
  36646. 'registered',
  36647. 'minus',
  36648. 'eth',
  36649. 'multiply',
  36650. 'threesuperior',
  36651. 'copyright',
  36652. 'Aacute',
  36653. 'Acircumflex',
  36654. 'Adieresis',
  36655. 'Agrave',
  36656. 'Aring',
  36657. 'Atilde',
  36658. 'Ccedilla',
  36659. 'Eacute',
  36660. 'Ecircumflex',
  36661. 'Edieresis',
  36662. 'Egrave',
  36663. 'Iacute',
  36664. 'Icircumflex',
  36665. 'Idieresis',
  36666. 'Igrave',
  36667. 'Ntilde',
  36668. 'Oacute',
  36669. 'Ocircumflex',
  36670. 'Odieresis',
  36671. 'Ograve',
  36672. 'Otilde',
  36673. 'Scaron',
  36674. 'Uacute',
  36675. 'Ucircumflex',
  36676. 'Udieresis',
  36677. 'Ugrave',
  36678. 'Yacute',
  36679. 'Ydieresis',
  36680. 'Zcaron',
  36681. 'aacute',
  36682. 'acircumflex',
  36683. 'adieresis',
  36684. 'agrave',
  36685. 'aring',
  36686. 'atilde',
  36687. 'ccedilla',
  36688. 'eacute',
  36689. 'ecircumflex',
  36690. 'edieresis',
  36691. 'egrave',
  36692. 'iacute',
  36693. 'icircumflex',
  36694. 'idieresis',
  36695. 'igrave',
  36696. 'ntilde',
  36697. 'oacute',
  36698. 'ocircumflex',
  36699. 'odieresis',
  36700. 'ograve',
  36701. 'otilde',
  36702. 'scaron',
  36703. 'uacute',
  36704. 'ucircumflex',
  36705. 'udieresis',
  36706. 'ugrave',
  36707. 'yacute',
  36708. 'ydieresis',
  36709. 'zcaron'
  36710. ];
  36711. var ExpertCharset = [
  36712. '.notdef',
  36713. 'space',
  36714. 'exclamsmall',
  36715. 'Hungarumlautsmall',
  36716. 'dollaroldstyle',
  36717. 'dollarsuperior',
  36718. 'ampersandsmall',
  36719. 'Acutesmall',
  36720. 'parenleftsuperior',
  36721. 'parenrightsuperior',
  36722. 'twodotenleader',
  36723. 'onedotenleader',
  36724. 'comma',
  36725. 'hyphen',
  36726. 'period',
  36727. 'fraction',
  36728. 'zerooldstyle',
  36729. 'oneoldstyle',
  36730. 'twooldstyle',
  36731. 'threeoldstyle',
  36732. 'fouroldstyle',
  36733. 'fiveoldstyle',
  36734. 'sixoldstyle',
  36735. 'sevenoldstyle',
  36736. 'eightoldstyle',
  36737. 'nineoldstyle',
  36738. 'colon',
  36739. 'semicolon',
  36740. 'commasuperior',
  36741. 'threequartersemdash',
  36742. 'periodsuperior',
  36743. 'questionsmall',
  36744. 'asuperior',
  36745. 'bsuperior',
  36746. 'centsuperior',
  36747. 'dsuperior',
  36748. 'esuperior',
  36749. 'isuperior',
  36750. 'lsuperior',
  36751. 'msuperior',
  36752. 'nsuperior',
  36753. 'osuperior',
  36754. 'rsuperior',
  36755. 'ssuperior',
  36756. 'tsuperior',
  36757. 'ff',
  36758. 'fi',
  36759. 'fl',
  36760. 'ffi',
  36761. 'ffl',
  36762. 'parenleftinferior',
  36763. 'parenrightinferior',
  36764. 'Circumflexsmall',
  36765. 'hyphensuperior',
  36766. 'Gravesmall',
  36767. 'Asmall',
  36768. 'Bsmall',
  36769. 'Csmall',
  36770. 'Dsmall',
  36771. 'Esmall',
  36772. 'Fsmall',
  36773. 'Gsmall',
  36774. 'Hsmall',
  36775. 'Ismall',
  36776. 'Jsmall',
  36777. 'Ksmall',
  36778. 'Lsmall',
  36779. 'Msmall',
  36780. 'Nsmall',
  36781. 'Osmall',
  36782. 'Psmall',
  36783. 'Qsmall',
  36784. 'Rsmall',
  36785. 'Ssmall',
  36786. 'Tsmall',
  36787. 'Usmall',
  36788. 'Vsmall',
  36789. 'Wsmall',
  36790. 'Xsmall',
  36791. 'Ysmall',
  36792. 'Zsmall',
  36793. 'colonmonetary',
  36794. 'onefitted',
  36795. 'rupiah',
  36796. 'Tildesmall',
  36797. 'exclamdownsmall',
  36798. 'centoldstyle',
  36799. 'Lslashsmall',
  36800. 'Scaronsmall',
  36801. 'Zcaronsmall',
  36802. 'Dieresissmall',
  36803. 'Brevesmall',
  36804. 'Caronsmall',
  36805. 'Dotaccentsmall',
  36806. 'Macronsmall',
  36807. 'figuredash',
  36808. 'hypheninferior',
  36809. 'Ogoneksmall',
  36810. 'Ringsmall',
  36811. 'Cedillasmall',
  36812. 'onequarter',
  36813. 'onehalf',
  36814. 'threequarters',
  36815. 'questiondownsmall',
  36816. 'oneeighth',
  36817. 'threeeighths',
  36818. 'fiveeighths',
  36819. 'seveneighths',
  36820. 'onethird',
  36821. 'twothirds',
  36822. 'zerosuperior',
  36823. 'onesuperior',
  36824. 'twosuperior',
  36825. 'threesuperior',
  36826. 'foursuperior',
  36827. 'fivesuperior',
  36828. 'sixsuperior',
  36829. 'sevensuperior',
  36830. 'eightsuperior',
  36831. 'ninesuperior',
  36832. 'zeroinferior',
  36833. 'oneinferior',
  36834. 'twoinferior',
  36835. 'threeinferior',
  36836. 'fourinferior',
  36837. 'fiveinferior',
  36838. 'sixinferior',
  36839. 'seveninferior',
  36840. 'eightinferior',
  36841. 'nineinferior',
  36842. 'centinferior',
  36843. 'dollarinferior',
  36844. 'periodinferior',
  36845. 'commainferior',
  36846. 'Agravesmall',
  36847. 'Aacutesmall',
  36848. 'Acircumflexsmall',
  36849. 'Atildesmall',
  36850. 'Adieresissmall',
  36851. 'Aringsmall',
  36852. 'AEsmall',
  36853. 'Ccedillasmall',
  36854. 'Egravesmall',
  36855. 'Eacutesmall',
  36856. 'Ecircumflexsmall',
  36857. 'Edieresissmall',
  36858. 'Igravesmall',
  36859. 'Iacutesmall',
  36860. 'Icircumflexsmall',
  36861. 'Idieresissmall',
  36862. 'Ethsmall',
  36863. 'Ntildesmall',
  36864. 'Ogravesmall',
  36865. 'Oacutesmall',
  36866. 'Ocircumflexsmall',
  36867. 'Otildesmall',
  36868. 'Odieresissmall',
  36869. 'OEsmall',
  36870. 'Oslashsmall',
  36871. 'Ugravesmall',
  36872. 'Uacutesmall',
  36873. 'Ucircumflexsmall',
  36874. 'Udieresissmall',
  36875. 'Yacutesmall',
  36876. 'Thornsmall',
  36877. 'Ydieresissmall'
  36878. ];
  36879. var ExpertSubsetCharset = [
  36880. '.notdef',
  36881. 'space',
  36882. 'dollaroldstyle',
  36883. 'dollarsuperior',
  36884. 'parenleftsuperior',
  36885. 'parenrightsuperior',
  36886. 'twodotenleader',
  36887. 'onedotenleader',
  36888. 'comma',
  36889. 'hyphen',
  36890. 'period',
  36891. 'fraction',
  36892. 'zerooldstyle',
  36893. 'oneoldstyle',
  36894. 'twooldstyle',
  36895. 'threeoldstyle',
  36896. 'fouroldstyle',
  36897. 'fiveoldstyle',
  36898. 'sixoldstyle',
  36899. 'sevenoldstyle',
  36900. 'eightoldstyle',
  36901. 'nineoldstyle',
  36902. 'colon',
  36903. 'semicolon',
  36904. 'commasuperior',
  36905. 'threequartersemdash',
  36906. 'periodsuperior',
  36907. 'asuperior',
  36908. 'bsuperior',
  36909. 'centsuperior',
  36910. 'dsuperior',
  36911. 'esuperior',
  36912. 'isuperior',
  36913. 'lsuperior',
  36914. 'msuperior',
  36915. 'nsuperior',
  36916. 'osuperior',
  36917. 'rsuperior',
  36918. 'ssuperior',
  36919. 'tsuperior',
  36920. 'ff',
  36921. 'fi',
  36922. 'fl',
  36923. 'ffi',
  36924. 'ffl',
  36925. 'parenleftinferior',
  36926. 'parenrightinferior',
  36927. 'hyphensuperior',
  36928. 'colonmonetary',
  36929. 'onefitted',
  36930. 'rupiah',
  36931. 'centoldstyle',
  36932. 'figuredash',
  36933. 'hypheninferior',
  36934. 'onequarter',
  36935. 'onehalf',
  36936. 'threequarters',
  36937. 'oneeighth',
  36938. 'threeeighths',
  36939. 'fiveeighths',
  36940. 'seveneighths',
  36941. 'onethird',
  36942. 'twothirds',
  36943. 'zerosuperior',
  36944. 'onesuperior',
  36945. 'twosuperior',
  36946. 'threesuperior',
  36947. 'foursuperior',
  36948. 'fivesuperior',
  36949. 'sixsuperior',
  36950. 'sevensuperior',
  36951. 'eightsuperior',
  36952. 'ninesuperior',
  36953. 'zeroinferior',
  36954. 'oneinferior',
  36955. 'twoinferior',
  36956. 'threeinferior',
  36957. 'fourinferior',
  36958. 'fiveinferior',
  36959. 'sixinferior',
  36960. 'seveninferior',
  36961. 'eightinferior',
  36962. 'nineinferior',
  36963. 'centinferior',
  36964. 'dollarinferior',
  36965. 'periodinferior',
  36966. 'commainferior'
  36967. ];
  36968. exports.ISOAdobeCharset = ISOAdobeCharset;
  36969. exports.ExpertCharset = ExpertCharset;
  36970. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  36971. /***/ }),
  36972. /* 23 */
  36973. /***/ (function(module, exports, __w_pdfjs_require__) {
  36974. "use strict";
  36975. var sharedUtil = __w_pdfjs_require__(0);
  36976. var corePrimitives = __w_pdfjs_require__(1);
  36977. var coreStream = __w_pdfjs_require__(2);
  36978. var coreParser = __w_pdfjs_require__(5);
  36979. var Util = sharedUtil.Util;
  36980. var assert = sharedUtil.assert;
  36981. var warn = sharedUtil.warn;
  36982. var error = sharedUtil.error;
  36983. var isInt = sharedUtil.isInt;
  36984. var isString = sharedUtil.isString;
  36985. var MissingDataException = sharedUtil.MissingDataException;
  36986. var CMapCompressionType = sharedUtil.CMapCompressionType;
  36987. var isEOF = corePrimitives.isEOF;
  36988. var isName = corePrimitives.isName;
  36989. var isCmd = corePrimitives.isCmd;
  36990. var isStream = corePrimitives.isStream;
  36991. var Stream = coreStream.Stream;
  36992. var Lexer = coreParser.Lexer;
  36993. var BUILT_IN_CMAPS = [
  36994. 'Adobe-GB1-UCS2',
  36995. 'Adobe-CNS1-UCS2',
  36996. 'Adobe-Japan1-UCS2',
  36997. 'Adobe-Korea1-UCS2',
  36998. '78-EUC-H',
  36999. '78-EUC-V',
  37000. '78-H',
  37001. '78-RKSJ-H',
  37002. '78-RKSJ-V',
  37003. '78-V',
  37004. '78ms-RKSJ-H',
  37005. '78ms-RKSJ-V',
  37006. '83pv-RKSJ-H',
  37007. '90ms-RKSJ-H',
  37008. '90ms-RKSJ-V',
  37009. '90msp-RKSJ-H',
  37010. '90msp-RKSJ-V',
  37011. '90pv-RKSJ-H',
  37012. '90pv-RKSJ-V',
  37013. 'Add-H',
  37014. 'Add-RKSJ-H',
  37015. 'Add-RKSJ-V',
  37016. 'Add-V',
  37017. 'Adobe-CNS1-0',
  37018. 'Adobe-CNS1-1',
  37019. 'Adobe-CNS1-2',
  37020. 'Adobe-CNS1-3',
  37021. 'Adobe-CNS1-4',
  37022. 'Adobe-CNS1-5',
  37023. 'Adobe-CNS1-6',
  37024. 'Adobe-GB1-0',
  37025. 'Adobe-GB1-1',
  37026. 'Adobe-GB1-2',
  37027. 'Adobe-GB1-3',
  37028. 'Adobe-GB1-4',
  37029. 'Adobe-GB1-5',
  37030. 'Adobe-Japan1-0',
  37031. 'Adobe-Japan1-1',
  37032. 'Adobe-Japan1-2',
  37033. 'Adobe-Japan1-3',
  37034. 'Adobe-Japan1-4',
  37035. 'Adobe-Japan1-5',
  37036. 'Adobe-Japan1-6',
  37037. 'Adobe-Korea1-0',
  37038. 'Adobe-Korea1-1',
  37039. 'Adobe-Korea1-2',
  37040. 'B5-H',
  37041. 'B5-V',
  37042. 'B5pc-H',
  37043. 'B5pc-V',
  37044. 'CNS-EUC-H',
  37045. 'CNS-EUC-V',
  37046. 'CNS1-H',
  37047. 'CNS1-V',
  37048. 'CNS2-H',
  37049. 'CNS2-V',
  37050. 'ETHK-B5-H',
  37051. 'ETHK-B5-V',
  37052. 'ETen-B5-H',
  37053. 'ETen-B5-V',
  37054. 'ETenms-B5-H',
  37055. 'ETenms-B5-V',
  37056. 'EUC-H',
  37057. 'EUC-V',
  37058. 'Ext-H',
  37059. 'Ext-RKSJ-H',
  37060. 'Ext-RKSJ-V',
  37061. 'Ext-V',
  37062. 'GB-EUC-H',
  37063. 'GB-EUC-V',
  37064. 'GB-H',
  37065. 'GB-V',
  37066. 'GBK-EUC-H',
  37067. 'GBK-EUC-V',
  37068. 'GBK2K-H',
  37069. 'GBK2K-V',
  37070. 'GBKp-EUC-H',
  37071. 'GBKp-EUC-V',
  37072. 'GBT-EUC-H',
  37073. 'GBT-EUC-V',
  37074. 'GBT-H',
  37075. 'GBT-V',
  37076. 'GBTpc-EUC-H',
  37077. 'GBTpc-EUC-V',
  37078. 'GBpc-EUC-H',
  37079. 'GBpc-EUC-V',
  37080. 'H',
  37081. 'HKdla-B5-H',
  37082. 'HKdla-B5-V',
  37083. 'HKdlb-B5-H',
  37084. 'HKdlb-B5-V',
  37085. 'HKgccs-B5-H',
  37086. 'HKgccs-B5-V',
  37087. 'HKm314-B5-H',
  37088. 'HKm314-B5-V',
  37089. 'HKm471-B5-H',
  37090. 'HKm471-B5-V',
  37091. 'HKscs-B5-H',
  37092. 'HKscs-B5-V',
  37093. 'Hankaku',
  37094. 'Hiragana',
  37095. 'KSC-EUC-H',
  37096. 'KSC-EUC-V',
  37097. 'KSC-H',
  37098. 'KSC-Johab-H',
  37099. 'KSC-Johab-V',
  37100. 'KSC-V',
  37101. 'KSCms-UHC-H',
  37102. 'KSCms-UHC-HW-H',
  37103. 'KSCms-UHC-HW-V',
  37104. 'KSCms-UHC-V',
  37105. 'KSCpc-EUC-H',
  37106. 'KSCpc-EUC-V',
  37107. 'Katakana',
  37108. 'NWP-H',
  37109. 'NWP-V',
  37110. 'RKSJ-H',
  37111. 'RKSJ-V',
  37112. 'Roman',
  37113. 'UniCNS-UCS2-H',
  37114. 'UniCNS-UCS2-V',
  37115. 'UniCNS-UTF16-H',
  37116. 'UniCNS-UTF16-V',
  37117. 'UniCNS-UTF32-H',
  37118. 'UniCNS-UTF32-V',
  37119. 'UniCNS-UTF8-H',
  37120. 'UniCNS-UTF8-V',
  37121. 'UniGB-UCS2-H',
  37122. 'UniGB-UCS2-V',
  37123. 'UniGB-UTF16-H',
  37124. 'UniGB-UTF16-V',
  37125. 'UniGB-UTF32-H',
  37126. 'UniGB-UTF32-V',
  37127. 'UniGB-UTF8-H',
  37128. 'UniGB-UTF8-V',
  37129. 'UniJIS-UCS2-H',
  37130. 'UniJIS-UCS2-HW-H',
  37131. 'UniJIS-UCS2-HW-V',
  37132. 'UniJIS-UCS2-V',
  37133. 'UniJIS-UTF16-H',
  37134. 'UniJIS-UTF16-V',
  37135. 'UniJIS-UTF32-H',
  37136. 'UniJIS-UTF32-V',
  37137. 'UniJIS-UTF8-H',
  37138. 'UniJIS-UTF8-V',
  37139. 'UniJIS2004-UTF16-H',
  37140. 'UniJIS2004-UTF16-V',
  37141. 'UniJIS2004-UTF32-H',
  37142. 'UniJIS2004-UTF32-V',
  37143. 'UniJIS2004-UTF8-H',
  37144. 'UniJIS2004-UTF8-V',
  37145. 'UniJISPro-UCS2-HW-V',
  37146. 'UniJISPro-UCS2-V',
  37147. 'UniJISPro-UTF8-V',
  37148. 'UniJISX0213-UTF32-H',
  37149. 'UniJISX0213-UTF32-V',
  37150. 'UniJISX02132004-UTF32-H',
  37151. 'UniJISX02132004-UTF32-V',
  37152. 'UniKS-UCS2-H',
  37153. 'UniKS-UCS2-V',
  37154. 'UniKS-UTF16-H',
  37155. 'UniKS-UTF16-V',
  37156. 'UniKS-UTF32-H',
  37157. 'UniKS-UTF32-V',
  37158. 'UniKS-UTF8-H',
  37159. 'UniKS-UTF8-V',
  37160. 'V',
  37161. 'WP-Symbol'
  37162. ];
  37163. var CMap = function CMapClosure() {
  37164. function CMap(builtInCMap) {
  37165. this.codespaceRanges = [
  37166. [],
  37167. [],
  37168. [],
  37169. []
  37170. ];
  37171. this.numCodespaceRanges = 0;
  37172. this._map = [];
  37173. this.name = '';
  37174. this.vertical = false;
  37175. this.useCMap = null;
  37176. this.builtInCMap = builtInCMap;
  37177. }
  37178. CMap.prototype = {
  37179. addCodespaceRange: function (n, low, high) {
  37180. this.codespaceRanges[n - 1].push(low, high);
  37181. this.numCodespaceRanges++;
  37182. },
  37183. mapCidRange: function (low, high, dstLow) {
  37184. while (low <= high) {
  37185. this._map[low++] = dstLow++;
  37186. }
  37187. },
  37188. mapBfRange: function (low, high, dstLow) {
  37189. var lastByte = dstLow.length - 1;
  37190. while (low <= high) {
  37191. this._map[low++] = dstLow;
  37192. dstLow = dstLow.substr(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
  37193. }
  37194. },
  37195. mapBfRangeToArray: function (low, high, array) {
  37196. var i = 0, ii = array.length;
  37197. while (low <= high && i < ii) {
  37198. this._map[low] = array[i++];
  37199. ++low;
  37200. }
  37201. },
  37202. mapOne: function (src, dst) {
  37203. this._map[src] = dst;
  37204. },
  37205. lookup: function (code) {
  37206. return this._map[code];
  37207. },
  37208. contains: function (code) {
  37209. return this._map[code] !== undefined;
  37210. },
  37211. forEach: function (callback) {
  37212. var map = this._map;
  37213. var length = map.length;
  37214. var i;
  37215. if (length <= 0x10000) {
  37216. for (i = 0; i < length; i++) {
  37217. if (map[i] !== undefined) {
  37218. callback(i, map[i]);
  37219. }
  37220. }
  37221. } else {
  37222. for (i in this._map) {
  37223. callback(i, map[i]);
  37224. }
  37225. }
  37226. },
  37227. charCodeOf: function (value) {
  37228. return this._map.indexOf(value);
  37229. },
  37230. getMap: function () {
  37231. return this._map;
  37232. },
  37233. readCharCode: function (str, offset, out) {
  37234. var c = 0;
  37235. var codespaceRanges = this.codespaceRanges;
  37236. var codespaceRangesLen = this.codespaceRanges.length;
  37237. for (var n = 0; n < codespaceRangesLen; n++) {
  37238. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  37239. var codespaceRange = codespaceRanges[n];
  37240. for (var k = 0, kk = codespaceRange.length; k < kk;) {
  37241. var low = codespaceRange[k++];
  37242. var high = codespaceRange[k++];
  37243. if (c >= low && c <= high) {
  37244. out.charcode = c;
  37245. out.length = n + 1;
  37246. return;
  37247. }
  37248. }
  37249. }
  37250. out.charcode = 0;
  37251. out.length = 1;
  37252. },
  37253. get length() {
  37254. return this._map.length;
  37255. },
  37256. get isIdentityCMap() {
  37257. if (!(this.name === 'Identity-H' || this.name === 'Identity-V')) {
  37258. return false;
  37259. }
  37260. if (this._map.length !== 0x10000) {
  37261. return false;
  37262. }
  37263. for (var i = 0; i < 0x10000; i++) {
  37264. if (this._map[i] !== i) {
  37265. return false;
  37266. }
  37267. }
  37268. return true;
  37269. }
  37270. };
  37271. return CMap;
  37272. }();
  37273. var IdentityCMap = function IdentityCMapClosure() {
  37274. function IdentityCMap(vertical, n) {
  37275. CMap.call(this);
  37276. this.vertical = vertical;
  37277. this.addCodespaceRange(n, 0, 0xffff);
  37278. }
  37279. Util.inherit(IdentityCMap, CMap, {});
  37280. IdentityCMap.prototype = {
  37281. addCodespaceRange: CMap.prototype.addCodespaceRange,
  37282. mapCidRange: function (low, high, dstLow) {
  37283. error('should not call mapCidRange');
  37284. },
  37285. mapBfRange: function (low, high, dstLow) {
  37286. error('should not call mapBfRange');
  37287. },
  37288. mapBfRangeToArray: function (low, high, array) {
  37289. error('should not call mapBfRangeToArray');
  37290. },
  37291. mapOne: function (src, dst) {
  37292. error('should not call mapCidOne');
  37293. },
  37294. lookup: function (code) {
  37295. return isInt(code) && code <= 0xffff ? code : undefined;
  37296. },
  37297. contains: function (code) {
  37298. return isInt(code) && code <= 0xffff;
  37299. },
  37300. forEach: function (callback) {
  37301. for (var i = 0; i <= 0xffff; i++) {
  37302. callback(i, i);
  37303. }
  37304. },
  37305. charCodeOf: function (value) {
  37306. return isInt(value) && value <= 0xffff ? value : -1;
  37307. },
  37308. getMap: function () {
  37309. var map = new Array(0x10000);
  37310. for (var i = 0; i <= 0xffff; i++) {
  37311. map[i] = i;
  37312. }
  37313. return map;
  37314. },
  37315. readCharCode: CMap.prototype.readCharCode,
  37316. get length() {
  37317. return 0x10000;
  37318. },
  37319. get isIdentityCMap() {
  37320. error('should not access .isIdentityCMap');
  37321. }
  37322. };
  37323. return IdentityCMap;
  37324. }();
  37325. var BinaryCMapReader = function BinaryCMapReaderClosure() {
  37326. function hexToInt(a, size) {
  37327. var n = 0;
  37328. for (var i = 0; i <= size; i++) {
  37329. n = n << 8 | a[i];
  37330. }
  37331. return n >>> 0;
  37332. }
  37333. function hexToStr(a, size) {
  37334. if (size === 1) {
  37335. return String.fromCharCode(a[0], a[1]);
  37336. }
  37337. if (size === 3) {
  37338. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  37339. }
  37340. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  37341. }
  37342. function addHex(a, b, size) {
  37343. var c = 0;
  37344. for (var i = size; i >= 0; i--) {
  37345. c += a[i] + b[i];
  37346. a[i] = c & 255;
  37347. c >>= 8;
  37348. }
  37349. }
  37350. function incHex(a, size) {
  37351. var c = 1;
  37352. for (var i = size; i >= 0 && c > 0; i--) {
  37353. c += a[i];
  37354. a[i] = c & 255;
  37355. c >>= 8;
  37356. }
  37357. }
  37358. var MAX_NUM_SIZE = 16;
  37359. var MAX_ENCODED_NUM_SIZE = 19;
  37360. function BinaryCMapStream(data) {
  37361. this.buffer = data;
  37362. this.pos = 0;
  37363. this.end = data.length;
  37364. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  37365. }
  37366. BinaryCMapStream.prototype = {
  37367. readByte: function () {
  37368. if (this.pos >= this.end) {
  37369. return -1;
  37370. }
  37371. return this.buffer[this.pos++];
  37372. },
  37373. readNumber: function () {
  37374. var n = 0;
  37375. var last;
  37376. do {
  37377. var b = this.readByte();
  37378. if (b < 0) {
  37379. error('unexpected EOF in bcmap');
  37380. }
  37381. last = !(b & 0x80);
  37382. n = n << 7 | b & 0x7F;
  37383. } while (!last);
  37384. return n;
  37385. },
  37386. readSigned: function () {
  37387. var n = this.readNumber();
  37388. return n & 1 ? ~(n >>> 1) : n >>> 1;
  37389. },
  37390. readHex: function (num, size) {
  37391. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  37392. this.pos += size + 1;
  37393. },
  37394. readHexNumber: function (num, size) {
  37395. var last;
  37396. var stack = this.tmpBuf, sp = 0;
  37397. do {
  37398. var b = this.readByte();
  37399. if (b < 0) {
  37400. error('unexpected EOF in bcmap');
  37401. }
  37402. last = !(b & 0x80);
  37403. stack[sp++] = b & 0x7F;
  37404. } while (!last);
  37405. var i = size, buffer = 0, bufferSize = 0;
  37406. while (i >= 0) {
  37407. while (bufferSize < 8 && stack.length > 0) {
  37408. buffer = stack[--sp] << bufferSize | buffer;
  37409. bufferSize += 7;
  37410. }
  37411. num[i] = buffer & 255;
  37412. i--;
  37413. buffer >>= 8;
  37414. bufferSize -= 8;
  37415. }
  37416. },
  37417. readHexSigned: function (num, size) {
  37418. this.readHexNumber(num, size);
  37419. var sign = num[size] & 1 ? 255 : 0;
  37420. var c = 0;
  37421. for (var i = 0; i <= size; i++) {
  37422. c = (c & 1) << 8 | num[i];
  37423. num[i] = c >> 1 ^ sign;
  37424. }
  37425. },
  37426. readString: function () {
  37427. var len = this.readNumber();
  37428. var s = '';
  37429. for (var i = 0; i < len; i++) {
  37430. s += String.fromCharCode(this.readNumber());
  37431. }
  37432. return s;
  37433. }
  37434. };
  37435. function processBinaryCMap(data, cMap, extend) {
  37436. return new Promise(function (resolve, reject) {
  37437. var stream = new BinaryCMapStream(data);
  37438. var header = stream.readByte();
  37439. cMap.vertical = !!(header & 1);
  37440. var useCMap = null;
  37441. var start = new Uint8Array(MAX_NUM_SIZE);
  37442. var end = new Uint8Array(MAX_NUM_SIZE);
  37443. var char = new Uint8Array(MAX_NUM_SIZE);
  37444. var charCode = new Uint8Array(MAX_NUM_SIZE);
  37445. var tmp = new Uint8Array(MAX_NUM_SIZE);
  37446. var code;
  37447. var b;
  37448. while ((b = stream.readByte()) >= 0) {
  37449. var type = b >> 5;
  37450. if (type === 7) {
  37451. switch (b & 0x1F) {
  37452. case 0:
  37453. stream.readString();
  37454. break;
  37455. case 1:
  37456. useCMap = stream.readString();
  37457. break;
  37458. }
  37459. continue;
  37460. }
  37461. var sequence = !!(b & 0x10);
  37462. var dataSize = b & 15;
  37463. assert(dataSize + 1 <= MAX_NUM_SIZE);
  37464. var ucs2DataSize = 1;
  37465. var subitemsCount = stream.readNumber();
  37466. var i;
  37467. switch (type) {
  37468. case 0:
  37469. stream.readHex(start, dataSize);
  37470. stream.readHexNumber(end, dataSize);
  37471. addHex(end, start, dataSize);
  37472. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  37473. for (i = 1; i < subitemsCount; i++) {
  37474. incHex(end, dataSize);
  37475. stream.readHexNumber(start, dataSize);
  37476. addHex(start, end, dataSize);
  37477. stream.readHexNumber(end, dataSize);
  37478. addHex(end, start, dataSize);
  37479. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  37480. }
  37481. break;
  37482. case 1:
  37483. stream.readHex(start, dataSize);
  37484. stream.readHexNumber(end, dataSize);
  37485. addHex(end, start, dataSize);
  37486. code = stream.readNumber();
  37487. for (i = 1; i < subitemsCount; i++) {
  37488. incHex(end, dataSize);
  37489. stream.readHexNumber(start, dataSize);
  37490. addHex(start, end, dataSize);
  37491. stream.readHexNumber(end, dataSize);
  37492. addHex(end, start, dataSize);
  37493. code = stream.readNumber();
  37494. }
  37495. break;
  37496. case 2:
  37497. stream.readHex(char, dataSize);
  37498. code = stream.readNumber();
  37499. cMap.mapOne(hexToInt(char, dataSize), code);
  37500. for (i = 1; i < subitemsCount; i++) {
  37501. incHex(char, dataSize);
  37502. if (!sequence) {
  37503. stream.readHexNumber(tmp, dataSize);
  37504. addHex(char, tmp, dataSize);
  37505. }
  37506. code = stream.readSigned() + (code + 1);
  37507. cMap.mapOne(hexToInt(char, dataSize), code);
  37508. }
  37509. break;
  37510. case 3:
  37511. stream.readHex(start, dataSize);
  37512. stream.readHexNumber(end, dataSize);
  37513. addHex(end, start, dataSize);
  37514. code = stream.readNumber();
  37515. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  37516. for (i = 1; i < subitemsCount; i++) {
  37517. incHex(end, dataSize);
  37518. if (!sequence) {
  37519. stream.readHexNumber(start, dataSize);
  37520. addHex(start, end, dataSize);
  37521. } else {
  37522. start.set(end);
  37523. }
  37524. stream.readHexNumber(end, dataSize);
  37525. addHex(end, start, dataSize);
  37526. code = stream.readNumber();
  37527. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  37528. }
  37529. break;
  37530. case 4:
  37531. stream.readHex(char, ucs2DataSize);
  37532. stream.readHex(charCode, dataSize);
  37533. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  37534. for (i = 1; i < subitemsCount; i++) {
  37535. incHex(char, ucs2DataSize);
  37536. if (!sequence) {
  37537. stream.readHexNumber(tmp, ucs2DataSize);
  37538. addHex(char, tmp, ucs2DataSize);
  37539. }
  37540. incHex(charCode, dataSize);
  37541. stream.readHexSigned(tmp, dataSize);
  37542. addHex(charCode, tmp, dataSize);
  37543. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  37544. }
  37545. break;
  37546. case 5:
  37547. stream.readHex(start, ucs2DataSize);
  37548. stream.readHexNumber(end, ucs2DataSize);
  37549. addHex(end, start, ucs2DataSize);
  37550. stream.readHex(charCode, dataSize);
  37551. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  37552. for (i = 1; i < subitemsCount; i++) {
  37553. incHex(end, ucs2DataSize);
  37554. if (!sequence) {
  37555. stream.readHexNumber(start, ucs2DataSize);
  37556. addHex(start, end, ucs2DataSize);
  37557. } else {
  37558. start.set(end);
  37559. }
  37560. stream.readHexNumber(end, ucs2DataSize);
  37561. addHex(end, start, ucs2DataSize);
  37562. stream.readHex(charCode, dataSize);
  37563. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  37564. }
  37565. break;
  37566. default:
  37567. reject(new Error('processBinaryCMap: Unknown type: ' + type));
  37568. return;
  37569. }
  37570. }
  37571. if (useCMap) {
  37572. resolve(extend(useCMap));
  37573. return;
  37574. }
  37575. resolve(cMap);
  37576. });
  37577. }
  37578. function BinaryCMapReader() {
  37579. }
  37580. BinaryCMapReader.prototype = { process: processBinaryCMap };
  37581. return BinaryCMapReader;
  37582. }();
  37583. var CMapFactory = function CMapFactoryClosure() {
  37584. function strToInt(str) {
  37585. var a = 0;
  37586. for (var i = 0; i < str.length; i++) {
  37587. a = a << 8 | str.charCodeAt(i);
  37588. }
  37589. return a >>> 0;
  37590. }
  37591. function expectString(obj) {
  37592. if (!isString(obj)) {
  37593. error('Malformed CMap: expected string.');
  37594. }
  37595. }
  37596. function expectInt(obj) {
  37597. if (!isInt(obj)) {
  37598. error('Malformed CMap: expected int.');
  37599. }
  37600. }
  37601. function parseBfChar(cMap, lexer) {
  37602. while (true) {
  37603. var obj = lexer.getObj();
  37604. if (isEOF(obj)) {
  37605. break;
  37606. }
  37607. if (isCmd(obj, 'endbfchar')) {
  37608. return;
  37609. }
  37610. expectString(obj);
  37611. var src = strToInt(obj);
  37612. obj = lexer.getObj();
  37613. expectString(obj);
  37614. var dst = obj;
  37615. cMap.mapOne(src, dst);
  37616. }
  37617. }
  37618. function parseBfRange(cMap, lexer) {
  37619. while (true) {
  37620. var obj = lexer.getObj();
  37621. if (isEOF(obj)) {
  37622. break;
  37623. }
  37624. if (isCmd(obj, 'endbfrange')) {
  37625. return;
  37626. }
  37627. expectString(obj);
  37628. var low = strToInt(obj);
  37629. obj = lexer.getObj();
  37630. expectString(obj);
  37631. var high = strToInt(obj);
  37632. obj = lexer.getObj();
  37633. if (isInt(obj) || isString(obj)) {
  37634. var dstLow = isInt(obj) ? String.fromCharCode(obj) : obj;
  37635. cMap.mapBfRange(low, high, dstLow);
  37636. } else if (isCmd(obj, '[')) {
  37637. obj = lexer.getObj();
  37638. var array = [];
  37639. while (!isCmd(obj, ']') && !isEOF(obj)) {
  37640. array.push(obj);
  37641. obj = lexer.getObj();
  37642. }
  37643. cMap.mapBfRangeToArray(low, high, array);
  37644. } else {
  37645. break;
  37646. }
  37647. }
  37648. error('Invalid bf range.');
  37649. }
  37650. function parseCidChar(cMap, lexer) {
  37651. while (true) {
  37652. var obj = lexer.getObj();
  37653. if (isEOF(obj)) {
  37654. break;
  37655. }
  37656. if (isCmd(obj, 'endcidchar')) {
  37657. return;
  37658. }
  37659. expectString(obj);
  37660. var src = strToInt(obj);
  37661. obj = lexer.getObj();
  37662. expectInt(obj);
  37663. var dst = obj;
  37664. cMap.mapOne(src, dst);
  37665. }
  37666. }
  37667. function parseCidRange(cMap, lexer) {
  37668. while (true) {
  37669. var obj = lexer.getObj();
  37670. if (isEOF(obj)) {
  37671. break;
  37672. }
  37673. if (isCmd(obj, 'endcidrange')) {
  37674. return;
  37675. }
  37676. expectString(obj);
  37677. var low = strToInt(obj);
  37678. obj = lexer.getObj();
  37679. expectString(obj);
  37680. var high = strToInt(obj);
  37681. obj = lexer.getObj();
  37682. expectInt(obj);
  37683. var dstLow = obj;
  37684. cMap.mapCidRange(low, high, dstLow);
  37685. }
  37686. }
  37687. function parseCodespaceRange(cMap, lexer) {
  37688. while (true) {
  37689. var obj = lexer.getObj();
  37690. if (isEOF(obj)) {
  37691. break;
  37692. }
  37693. if (isCmd(obj, 'endcodespacerange')) {
  37694. return;
  37695. }
  37696. if (!isString(obj)) {
  37697. break;
  37698. }
  37699. var low = strToInt(obj);
  37700. obj = lexer.getObj();
  37701. if (!isString(obj)) {
  37702. break;
  37703. }
  37704. var high = strToInt(obj);
  37705. cMap.addCodespaceRange(obj.length, low, high);
  37706. }
  37707. error('Invalid codespace range.');
  37708. }
  37709. function parseWMode(cMap, lexer) {
  37710. var obj = lexer.getObj();
  37711. if (isInt(obj)) {
  37712. cMap.vertical = !!obj;
  37713. }
  37714. }
  37715. function parseCMapName(cMap, lexer) {
  37716. var obj = lexer.getObj();
  37717. if (isName(obj) && isString(obj.name)) {
  37718. cMap.name = obj.name;
  37719. }
  37720. }
  37721. function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  37722. var previous;
  37723. var embededUseCMap;
  37724. objLoop:
  37725. while (true) {
  37726. try {
  37727. var obj = lexer.getObj();
  37728. if (isEOF(obj)) {
  37729. break;
  37730. } else if (isName(obj)) {
  37731. if (obj.name === 'WMode') {
  37732. parseWMode(cMap, lexer);
  37733. } else if (obj.name === 'CMapName') {
  37734. parseCMapName(cMap, lexer);
  37735. }
  37736. previous = obj;
  37737. } else if (isCmd(obj)) {
  37738. switch (obj.cmd) {
  37739. case 'endcmap':
  37740. break objLoop;
  37741. case 'usecmap':
  37742. if (isName(previous)) {
  37743. embededUseCMap = previous.name;
  37744. }
  37745. break;
  37746. case 'begincodespacerange':
  37747. parseCodespaceRange(cMap, lexer);
  37748. break;
  37749. case 'beginbfchar':
  37750. parseBfChar(cMap, lexer);
  37751. break;
  37752. case 'begincidchar':
  37753. parseCidChar(cMap, lexer);
  37754. break;
  37755. case 'beginbfrange':
  37756. parseBfRange(cMap, lexer);
  37757. break;
  37758. case 'begincidrange':
  37759. parseCidRange(cMap, lexer);
  37760. break;
  37761. }
  37762. }
  37763. } catch (ex) {
  37764. if (ex instanceof MissingDataException) {
  37765. throw ex;
  37766. }
  37767. warn('Invalid cMap data: ' + ex);
  37768. continue;
  37769. }
  37770. }
  37771. if (!useCMap && embededUseCMap) {
  37772. useCMap = embededUseCMap;
  37773. }
  37774. if (useCMap) {
  37775. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  37776. }
  37777. return Promise.resolve(cMap);
  37778. }
  37779. function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  37780. return createBuiltInCMap(useCMap, fetchBuiltInCMap).then(function (newCMap) {
  37781. cMap.useCMap = newCMap;
  37782. if (cMap.numCodespaceRanges === 0) {
  37783. var useCodespaceRanges = cMap.useCMap.codespaceRanges;
  37784. for (var i = 0; i < useCodespaceRanges.length; i++) {
  37785. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  37786. }
  37787. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  37788. }
  37789. cMap.useCMap.forEach(function (key, value) {
  37790. if (!cMap.contains(key)) {
  37791. cMap.mapOne(key, cMap.useCMap.lookup(key));
  37792. }
  37793. });
  37794. return cMap;
  37795. });
  37796. }
  37797. function createBuiltInCMap(name, fetchBuiltInCMap) {
  37798. if (name === 'Identity-H') {
  37799. return Promise.resolve(new IdentityCMap(false, 2));
  37800. } else if (name === 'Identity-V') {
  37801. return Promise.resolve(new IdentityCMap(true, 2));
  37802. }
  37803. if (BUILT_IN_CMAPS.indexOf(name) === -1) {
  37804. return Promise.reject(new Error('Unknown cMap name: ' + name));
  37805. }
  37806. assert(fetchBuiltInCMap, 'Built-in CMap parameters are not provided.');
  37807. return fetchBuiltInCMap(name).then(function (data) {
  37808. var cMapData = data.cMapData, compressionType = data.compressionType;
  37809. var cMap = new CMap(true);
  37810. if (compressionType === CMapCompressionType.BINARY) {
  37811. return new BinaryCMapReader().process(cMapData, cMap, function (useCMap) {
  37812. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  37813. });
  37814. }
  37815. assert(compressionType === CMapCompressionType.NONE, 'TODO: Only BINARY/NONE CMap compression is currently supported.');
  37816. var lexer = new Lexer(new Stream(cMapData));
  37817. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  37818. });
  37819. }
  37820. return {
  37821. create: function (params) {
  37822. var encoding = params.encoding;
  37823. var fetchBuiltInCMap = params.fetchBuiltInCMap;
  37824. var useCMap = params.useCMap;
  37825. if (isName(encoding)) {
  37826. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  37827. } else if (isStream(encoding)) {
  37828. var cMap = new CMap();
  37829. var lexer = new Lexer(encoding);
  37830. return parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap).then(function (parsedCMap) {
  37831. if (parsedCMap.isIdentityCMap) {
  37832. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  37833. }
  37834. return parsedCMap;
  37835. });
  37836. }
  37837. return Promise.reject(new Error('Encoding required.'));
  37838. }
  37839. };
  37840. }();
  37841. exports.CMap = CMap;
  37842. exports.CMapFactory = CMapFactory;
  37843. exports.IdentityCMap = IdentityCMap;
  37844. /***/ }),
  37845. /* 24 */
  37846. /***/ (function(module, exports, __w_pdfjs_require__) {
  37847. "use strict";
  37848. var sharedUtil = __w_pdfjs_require__(0);
  37849. var corePrimitives = __w_pdfjs_require__(1);
  37850. var coreStream = __w_pdfjs_require__(2);
  37851. var coreObj = __w_pdfjs_require__(16);
  37852. var coreParser = __w_pdfjs_require__(5);
  37853. var coreCrypto = __w_pdfjs_require__(13);
  37854. var coreEvaluator = __w_pdfjs_require__(14);
  37855. var coreAnnotation = __w_pdfjs_require__(20);
  37856. var OPS = sharedUtil.OPS;
  37857. var MissingDataException = sharedUtil.MissingDataException;
  37858. var Util = sharedUtil.Util;
  37859. var assert = sharedUtil.assert;
  37860. var error = sharedUtil.error;
  37861. var info = sharedUtil.info;
  37862. var isArray = sharedUtil.isArray;
  37863. var isArrayBuffer = sharedUtil.isArrayBuffer;
  37864. var isNum = sharedUtil.isNum;
  37865. var isString = sharedUtil.isString;
  37866. var shadow = sharedUtil.shadow;
  37867. var stringToBytes = sharedUtil.stringToBytes;
  37868. var stringToPDFString = sharedUtil.stringToPDFString;
  37869. var warn = sharedUtil.warn;
  37870. var isSpace = sharedUtil.isSpace;
  37871. var Dict = corePrimitives.Dict;
  37872. var isDict = corePrimitives.isDict;
  37873. var isName = corePrimitives.isName;
  37874. var isStream = corePrimitives.isStream;
  37875. var NullStream = coreStream.NullStream;
  37876. var Stream = coreStream.Stream;
  37877. var StreamsSequenceStream = coreStream.StreamsSequenceStream;
  37878. var Catalog = coreObj.Catalog;
  37879. var ObjectLoader = coreObj.ObjectLoader;
  37880. var XRef = coreObj.XRef;
  37881. var Linearization = coreParser.Linearization;
  37882. var calculateMD5 = coreCrypto.calculateMD5;
  37883. var OperatorList = coreEvaluator.OperatorList;
  37884. var PartialEvaluator = coreEvaluator.PartialEvaluator;
  37885. var AnnotationFactory = coreAnnotation.AnnotationFactory;
  37886. var Page = function PageClosure() {
  37887. var DEFAULT_USER_UNIT = 1.0;
  37888. var LETTER_SIZE_MEDIABOX = [
  37889. 0,
  37890. 0,
  37891. 612,
  37892. 792
  37893. ];
  37894. function isAnnotationRenderable(annotation, intent) {
  37895. return intent === 'display' && annotation.viewable || intent === 'print' && annotation.printable;
  37896. }
  37897. function Page(pdfManager, xref, pageIndex, pageDict, ref, fontCache, builtInCMapCache) {
  37898. this.pdfManager = pdfManager;
  37899. this.pageIndex = pageIndex;
  37900. this.pageDict = pageDict;
  37901. this.xref = xref;
  37902. this.ref = ref;
  37903. this.fontCache = fontCache;
  37904. this.builtInCMapCache = builtInCMapCache;
  37905. this.evaluatorOptions = pdfManager.evaluatorOptions;
  37906. this.resourcesPromise = null;
  37907. var uniquePrefix = 'p' + this.pageIndex + '_';
  37908. var idCounters = { obj: 0 };
  37909. this.idFactory = {
  37910. createObjId: function () {
  37911. return uniquePrefix + ++idCounters.obj;
  37912. }
  37913. };
  37914. }
  37915. Page.prototype = {
  37916. getPageProp: function Page_getPageProp(key) {
  37917. return this.pageDict.get(key);
  37918. },
  37919. getInheritedPageProp: function Page_getInheritedPageProp(key, getArray) {
  37920. var dict = this.pageDict, valueArray = null, loopCount = 0;
  37921. var MAX_LOOP_COUNT = 100;
  37922. getArray = getArray || false;
  37923. while (dict) {
  37924. var value = getArray ? dict.getArray(key) : dict.get(key);
  37925. if (value !== undefined) {
  37926. if (!valueArray) {
  37927. valueArray = [];
  37928. }
  37929. valueArray.push(value);
  37930. }
  37931. if (++loopCount > MAX_LOOP_COUNT) {
  37932. warn('Page_getInheritedPageProp: maximum loop count exceeded.');
  37933. break;
  37934. }
  37935. dict = dict.get('Parent');
  37936. }
  37937. if (!valueArray) {
  37938. return Dict.empty;
  37939. }
  37940. if (valueArray.length === 1 || !isDict(valueArray[0]) || loopCount > MAX_LOOP_COUNT) {
  37941. return valueArray[0];
  37942. }
  37943. return Dict.merge(this.xref, valueArray);
  37944. },
  37945. get content() {
  37946. return this.getPageProp('Contents');
  37947. },
  37948. get resources() {
  37949. return shadow(this, 'resources', this.getInheritedPageProp('Resources'));
  37950. },
  37951. get mediaBox() {
  37952. var mediaBox = this.getInheritedPageProp('MediaBox', true);
  37953. if (!isArray(mediaBox) || mediaBox.length !== 4) {
  37954. return shadow(this, 'mediaBox', LETTER_SIZE_MEDIABOX);
  37955. }
  37956. return shadow(this, 'mediaBox', mediaBox);
  37957. },
  37958. get cropBox() {
  37959. var cropBox = this.getInheritedPageProp('CropBox', true);
  37960. if (!isArray(cropBox) || cropBox.length !== 4) {
  37961. return shadow(this, 'cropBox', this.mediaBox);
  37962. }
  37963. return shadow(this, 'cropBox', cropBox);
  37964. },
  37965. get userUnit() {
  37966. var obj = this.getPageProp('UserUnit');
  37967. if (!isNum(obj) || obj <= 0) {
  37968. obj = DEFAULT_USER_UNIT;
  37969. }
  37970. return shadow(this, 'userUnit', obj);
  37971. },
  37972. get view() {
  37973. var mediaBox = this.mediaBox, cropBox = this.cropBox;
  37974. if (mediaBox === cropBox) {
  37975. return shadow(this, 'view', mediaBox);
  37976. }
  37977. var intersection = Util.intersect(cropBox, mediaBox);
  37978. return shadow(this, 'view', intersection || mediaBox);
  37979. },
  37980. get rotate() {
  37981. var rotate = this.getInheritedPageProp('Rotate') || 0;
  37982. if (rotate % 90 !== 0) {
  37983. rotate = 0;
  37984. } else if (rotate >= 360) {
  37985. rotate = rotate % 360;
  37986. } else if (rotate < 0) {
  37987. rotate = (rotate % 360 + 360) % 360;
  37988. }
  37989. return shadow(this, 'rotate', rotate);
  37990. },
  37991. getContentStream: function Page_getContentStream() {
  37992. var content = this.content;
  37993. var stream;
  37994. if (isArray(content)) {
  37995. var xref = this.xref;
  37996. var i, n = content.length;
  37997. var streams = [];
  37998. for (i = 0; i < n; ++i) {
  37999. streams.push(xref.fetchIfRef(content[i]));
  38000. }
  38001. stream = new StreamsSequenceStream(streams);
  38002. } else if (isStream(content)) {
  38003. stream = content;
  38004. } else {
  38005. stream = new NullStream();
  38006. }
  38007. return stream;
  38008. },
  38009. loadResources: function Page_loadResources(keys) {
  38010. if (!this.resourcesPromise) {
  38011. this.resourcesPromise = this.pdfManager.ensure(this, 'resources');
  38012. }
  38013. return this.resourcesPromise.then(function resourceSuccess() {
  38014. var objectLoader = new ObjectLoader(this.resources.map, keys, this.xref);
  38015. return objectLoader.load();
  38016. }.bind(this));
  38017. },
  38018. getOperatorList: function Page_getOperatorList(handler, task, intent, renderInteractiveForms) {
  38019. var self = this;
  38020. var pdfManager = this.pdfManager;
  38021. var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', []);
  38022. var resourcesPromise = this.loadResources([
  38023. 'ExtGState',
  38024. 'ColorSpace',
  38025. 'Pattern',
  38026. 'Shading',
  38027. 'XObject',
  38028. 'Font'
  38029. ]);
  38030. var partialEvaluator = new PartialEvaluator(pdfManager, this.xref, handler, this.pageIndex, this.idFactory, this.fontCache, this.builtInCMapCache, this.evaluatorOptions);
  38031. var dataPromises = Promise.all([
  38032. contentStreamPromise,
  38033. resourcesPromise
  38034. ]);
  38035. var pageListPromise = dataPromises.then(function (data) {
  38036. var contentStream = data[0];
  38037. var opList = new OperatorList(intent, handler, self.pageIndex);
  38038. handler.send('StartRenderPage', {
  38039. transparency: partialEvaluator.hasBlendModes(self.resources),
  38040. pageIndex: self.pageIndex,
  38041. intent: intent
  38042. });
  38043. return partialEvaluator.getOperatorList(contentStream, task, self.resources, opList).then(function () {
  38044. return opList;
  38045. });
  38046. });
  38047. var annotationsPromise = pdfManager.ensure(this, 'annotations');
  38048. return Promise.all([
  38049. pageListPromise,
  38050. annotationsPromise
  38051. ]).then(function (datas) {
  38052. var pageOpList = datas[0];
  38053. var annotations = datas[1];
  38054. if (annotations.length === 0) {
  38055. pageOpList.flush(true);
  38056. return pageOpList;
  38057. }
  38058. var i, ii, opListPromises = [];
  38059. for (i = 0, ii = annotations.length; i < ii; i++) {
  38060. if (isAnnotationRenderable(annotations[i], intent)) {
  38061. opListPromises.push(annotations[i].getOperatorList(partialEvaluator, task, renderInteractiveForms));
  38062. }
  38063. }
  38064. return Promise.all(opListPromises).then(function (opLists) {
  38065. pageOpList.addOp(OPS.beginAnnotations, []);
  38066. for (i = 0, ii = opLists.length; i < ii; i++) {
  38067. pageOpList.addOpList(opLists[i]);
  38068. }
  38069. pageOpList.addOp(OPS.endAnnotations, []);
  38070. pageOpList.flush(true);
  38071. return pageOpList;
  38072. });
  38073. });
  38074. },
  38075. extractTextContent: function Page_extractTextContent(task, normalizeWhitespace, combineTextItems) {
  38076. var handler = {
  38077. on: function nullHandlerOn() {
  38078. },
  38079. send: function nullHandlerSend() {
  38080. }
  38081. };
  38082. var self = this;
  38083. var pdfManager = this.pdfManager;
  38084. var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', []);
  38085. var resourcesPromise = this.loadResources([
  38086. 'ExtGState',
  38087. 'XObject',
  38088. 'Font'
  38089. ]);
  38090. var dataPromises = Promise.all([
  38091. contentStreamPromise,
  38092. resourcesPromise
  38093. ]);
  38094. return dataPromises.then(function (data) {
  38095. var contentStream = data[0];
  38096. var partialEvaluator = new PartialEvaluator(pdfManager, self.xref, handler, self.pageIndex, self.idFactory, self.fontCache, self.builtInCMapCache, self.evaluatorOptions);
  38097. return partialEvaluator.getTextContent(contentStream, task, self.resources, null, normalizeWhitespace, combineTextItems);
  38098. });
  38099. },
  38100. getAnnotationsData: function Page_getAnnotationsData(intent) {
  38101. var annotations = this.annotations;
  38102. var annotationsData = [];
  38103. for (var i = 0, n = annotations.length; i < n; ++i) {
  38104. if (!intent || isAnnotationRenderable(annotations[i], intent)) {
  38105. annotationsData.push(annotations[i].data);
  38106. }
  38107. }
  38108. return annotationsData;
  38109. },
  38110. get annotations() {
  38111. var annotations = [];
  38112. var annotationRefs = this.getInheritedPageProp('Annots') || [];
  38113. var annotationFactory = new AnnotationFactory();
  38114. for (var i = 0, n = annotationRefs.length; i < n; ++i) {
  38115. var annotationRef = annotationRefs[i];
  38116. var annotation = annotationFactory.create(this.xref, annotationRef, this.pdfManager, this.idFactory);
  38117. if (annotation) {
  38118. annotations.push(annotation);
  38119. }
  38120. }
  38121. return shadow(this, 'annotations', annotations);
  38122. }
  38123. };
  38124. return Page;
  38125. }();
  38126. var PDFDocument = function PDFDocumentClosure() {
  38127. var FINGERPRINT_FIRST_BYTES = 1024;
  38128. var EMPTY_FINGERPRINT = '\x00\x00\x00\x00\x00\x00\x00' + '\x00\x00\x00\x00\x00\x00\x00\x00\x00';
  38129. function PDFDocument(pdfManager, arg) {
  38130. var stream;
  38131. if (isStream(arg)) {
  38132. stream = arg;
  38133. } else if (isArrayBuffer(arg)) {
  38134. stream = new Stream(arg);
  38135. } else {
  38136. error('PDFDocument: Unknown argument type');
  38137. }
  38138. assert(stream.length > 0, 'stream must have data');
  38139. this.pdfManager = pdfManager;
  38140. this.stream = stream;
  38141. this.xref = new XRef(stream, pdfManager);
  38142. }
  38143. function find(stream, needle, limit, backwards) {
  38144. var pos = stream.pos;
  38145. var end = stream.end;
  38146. var strBuf = [];
  38147. if (pos + limit > end) {
  38148. limit = end - pos;
  38149. }
  38150. for (var n = 0; n < limit; ++n) {
  38151. strBuf.push(String.fromCharCode(stream.getByte()));
  38152. }
  38153. var str = strBuf.join('');
  38154. stream.pos = pos;
  38155. var index = backwards ? str.lastIndexOf(needle) : str.indexOf(needle);
  38156. if (index === -1) {
  38157. return false;
  38158. }
  38159. stream.pos += index;
  38160. return true;
  38161. }
  38162. var DocumentInfoValidators = {
  38163. get entries() {
  38164. return shadow(this, 'entries', {
  38165. Title: isString,
  38166. Author: isString,
  38167. Subject: isString,
  38168. Keywords: isString,
  38169. Creator: isString,
  38170. Producer: isString,
  38171. CreationDate: isString,
  38172. ModDate: isString,
  38173. Trapped: isName
  38174. });
  38175. }
  38176. };
  38177. PDFDocument.prototype = {
  38178. parse: function PDFDocument_parse(recoveryMode) {
  38179. this.setup(recoveryMode);
  38180. var version = this.catalog.catDict.get('Version');
  38181. if (isName(version)) {
  38182. this.pdfFormatVersion = version.name;
  38183. }
  38184. try {
  38185. this.acroForm = this.catalog.catDict.get('AcroForm');
  38186. if (this.acroForm) {
  38187. this.xfa = this.acroForm.get('XFA');
  38188. var fields = this.acroForm.get('Fields');
  38189. if ((!fields || !isArray(fields) || fields.length === 0) && !this.xfa) {
  38190. this.acroForm = null;
  38191. }
  38192. }
  38193. } catch (ex) {
  38194. info('Something wrong with AcroForm entry');
  38195. this.acroForm = null;
  38196. }
  38197. },
  38198. get linearization() {
  38199. var linearization = null;
  38200. if (this.stream.length) {
  38201. try {
  38202. linearization = Linearization.create(this.stream);
  38203. } catch (err) {
  38204. if (err instanceof MissingDataException) {
  38205. throw err;
  38206. }
  38207. info(err);
  38208. }
  38209. }
  38210. return shadow(this, 'linearization', linearization);
  38211. },
  38212. get startXRef() {
  38213. var stream = this.stream;
  38214. var startXRef = 0;
  38215. var linearization = this.linearization;
  38216. if (linearization) {
  38217. stream.reset();
  38218. if (find(stream, 'endobj', 1024)) {
  38219. startXRef = stream.pos + 6;
  38220. }
  38221. } else {
  38222. var step = 1024;
  38223. var found = false, pos = stream.end;
  38224. while (!found && pos > 0) {
  38225. pos -= step - 'startxref'.length;
  38226. if (pos < 0) {
  38227. pos = 0;
  38228. }
  38229. stream.pos = pos;
  38230. found = find(stream, 'startxref', step, true);
  38231. }
  38232. if (found) {
  38233. stream.skip(9);
  38234. var ch;
  38235. do {
  38236. ch = stream.getByte();
  38237. } while (isSpace(ch));
  38238. var str = '';
  38239. while (ch >= 0x20 && ch <= 0x39) {
  38240. str += String.fromCharCode(ch);
  38241. ch = stream.getByte();
  38242. }
  38243. startXRef = parseInt(str, 10);
  38244. if (isNaN(startXRef)) {
  38245. startXRef = 0;
  38246. }
  38247. }
  38248. }
  38249. return shadow(this, 'startXRef', startXRef);
  38250. },
  38251. get mainXRefEntriesOffset() {
  38252. var mainXRefEntriesOffset = 0;
  38253. var linearization = this.linearization;
  38254. if (linearization) {
  38255. mainXRefEntriesOffset = linearization.mainXRefEntriesOffset;
  38256. }
  38257. return shadow(this, 'mainXRefEntriesOffset', mainXRefEntriesOffset);
  38258. },
  38259. checkHeader: function PDFDocument_checkHeader() {
  38260. var stream = this.stream;
  38261. stream.reset();
  38262. if (find(stream, '%PDF-', 1024)) {
  38263. stream.moveStart();
  38264. var MAX_VERSION_LENGTH = 12;
  38265. var version = '', ch;
  38266. while ((ch = stream.getByte()) > 0x20) {
  38267. if (version.length >= MAX_VERSION_LENGTH) {
  38268. break;
  38269. }
  38270. version += String.fromCharCode(ch);
  38271. }
  38272. if (!this.pdfFormatVersion) {
  38273. this.pdfFormatVersion = version.substring(5);
  38274. }
  38275. return;
  38276. }
  38277. },
  38278. parseStartXRef: function PDFDocument_parseStartXRef() {
  38279. var startXRef = this.startXRef;
  38280. this.xref.setStartXRef(startXRef);
  38281. },
  38282. setup: function PDFDocument_setup(recoveryMode) {
  38283. this.xref.parse(recoveryMode);
  38284. var self = this;
  38285. var pageFactory = {
  38286. createPage: function (pageIndex, dict, ref, fontCache, builtInCMapCache) {
  38287. return new Page(self.pdfManager, self.xref, pageIndex, dict, ref, fontCache, builtInCMapCache);
  38288. }
  38289. };
  38290. this.catalog = new Catalog(this.pdfManager, this.xref, pageFactory);
  38291. },
  38292. get numPages() {
  38293. var linearization = this.linearization;
  38294. var num = linearization ? linearization.numPages : this.catalog.numPages;
  38295. return shadow(this, 'numPages', num);
  38296. },
  38297. get documentInfo() {
  38298. var docInfo = {
  38299. PDFFormatVersion: this.pdfFormatVersion,
  38300. IsAcroFormPresent: !!this.acroForm,
  38301. IsXFAPresent: !!this.xfa
  38302. };
  38303. var infoDict;
  38304. try {
  38305. infoDict = this.xref.trailer.get('Info');
  38306. } catch (err) {
  38307. info('The document information dictionary is invalid.');
  38308. }
  38309. if (infoDict) {
  38310. var validEntries = DocumentInfoValidators.entries;
  38311. for (var key in validEntries) {
  38312. if (infoDict.has(key)) {
  38313. var value = infoDict.get(key);
  38314. if (validEntries[key](value)) {
  38315. docInfo[key] = typeof value !== 'string' ? value : stringToPDFString(value);
  38316. } else {
  38317. info('Bad value in document info for "' + key + '"');
  38318. }
  38319. }
  38320. }
  38321. }
  38322. return shadow(this, 'documentInfo', docInfo);
  38323. },
  38324. get fingerprint() {
  38325. var xref = this.xref, hash, fileID = '';
  38326. var idArray = xref.trailer.get('ID');
  38327. if (idArray && isArray(idArray) && idArray[0] && isString(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) {
  38328. hash = stringToBytes(idArray[0]);
  38329. } else {
  38330. if (this.stream.ensureRange) {
  38331. this.stream.ensureRange(0, Math.min(FINGERPRINT_FIRST_BYTES, this.stream.end));
  38332. }
  38333. hash = calculateMD5(this.stream.bytes.subarray(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  38334. }
  38335. for (var i = 0, n = hash.length; i < n; i++) {
  38336. var hex = hash[i].toString(16);
  38337. fileID += hex.length === 1 ? '0' + hex : hex;
  38338. }
  38339. return shadow(this, 'fingerprint', fileID);
  38340. },
  38341. getPage: function PDFDocument_getPage(pageIndex) {
  38342. return this.catalog.getPage(pageIndex);
  38343. },
  38344. cleanup: function PDFDocument_cleanup() {
  38345. return this.catalog.cleanup();
  38346. }
  38347. };
  38348. return PDFDocument;
  38349. }();
  38350. exports.Page = Page;
  38351. exports.PDFDocument = PDFDocument;
  38352. /***/ }),
  38353. /* 25 */
  38354. /***/ (function(module, exports, __w_pdfjs_require__) {
  38355. "use strict";
  38356. var sharedUtil = __w_pdfjs_require__(0);
  38357. var coreStream = __w_pdfjs_require__(2);
  38358. var coreGlyphList = __w_pdfjs_require__(7);
  38359. var coreEncodings = __w_pdfjs_require__(4);
  38360. var coreCFFParser = __w_pdfjs_require__(11);
  38361. var Util = sharedUtil.Util;
  38362. var bytesToString = sharedUtil.bytesToString;
  38363. var error = sharedUtil.error;
  38364. var Stream = coreStream.Stream;
  38365. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  38366. var StandardEncoding = coreEncodings.StandardEncoding;
  38367. var CFFParser = coreCFFParser.CFFParser;
  38368. var FontRendererFactory = function FontRendererFactoryClosure() {
  38369. function getLong(data, offset) {
  38370. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  38371. }
  38372. function getUshort(data, offset) {
  38373. return data[offset] << 8 | data[offset + 1];
  38374. }
  38375. function parseCmap(data, start, end) {
  38376. var offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16);
  38377. var format = getUshort(data, start + offset);
  38378. var ranges, p, i;
  38379. if (format === 4) {
  38380. getUshort(data, start + offset + 2);
  38381. var segCount = getUshort(data, start + offset + 6) >> 1;
  38382. p = start + offset + 14;
  38383. ranges = [];
  38384. for (i = 0; i < segCount; i++, p += 2) {
  38385. ranges[i] = { end: getUshort(data, p) };
  38386. }
  38387. p += 2;
  38388. for (i = 0; i < segCount; i++, p += 2) {
  38389. ranges[i].start = getUshort(data, p);
  38390. }
  38391. for (i = 0; i < segCount; i++, p += 2) {
  38392. ranges[i].idDelta = getUshort(data, p);
  38393. }
  38394. for (i = 0; i < segCount; i++, p += 2) {
  38395. var idOffset = getUshort(data, p);
  38396. if (idOffset === 0) {
  38397. continue;
  38398. }
  38399. ranges[i].ids = [];
  38400. for (var j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  38401. ranges[i].ids[j] = getUshort(data, p + idOffset);
  38402. idOffset += 2;
  38403. }
  38404. }
  38405. return ranges;
  38406. } else if (format === 12) {
  38407. getLong(data, start + offset + 4);
  38408. var groups = getLong(data, start + offset + 12);
  38409. p = start + offset + 16;
  38410. ranges = [];
  38411. for (i = 0; i < groups; i++) {
  38412. ranges.push({
  38413. start: getLong(data, p),
  38414. end: getLong(data, p + 4),
  38415. idDelta: getLong(data, p + 8) - getLong(data, p)
  38416. });
  38417. p += 12;
  38418. }
  38419. return ranges;
  38420. }
  38421. error('not supported cmap: ' + format);
  38422. }
  38423. function parseCff(data, start, end, seacAnalysisEnabled) {
  38424. var properties = {};
  38425. var parser = new CFFParser(new Stream(data, start, end - start), properties, seacAnalysisEnabled);
  38426. var cff = parser.parse();
  38427. return {
  38428. glyphs: cff.charStrings.objects,
  38429. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  38430. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects
  38431. };
  38432. }
  38433. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  38434. var itemSize, itemDecode;
  38435. if (isGlyphLocationsLong) {
  38436. itemSize = 4;
  38437. itemDecode = function fontItemDecodeLong(data, offset) {
  38438. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  38439. };
  38440. } else {
  38441. itemSize = 2;
  38442. itemDecode = function fontItemDecode(data, offset) {
  38443. return data[offset] << 9 | data[offset + 1] << 1;
  38444. };
  38445. }
  38446. var glyphs = [];
  38447. var startOffset = itemDecode(loca, 0);
  38448. for (var j = itemSize; j < loca.length; j += itemSize) {
  38449. var endOffset = itemDecode(loca, j);
  38450. glyphs.push(glyf.subarray(startOffset, endOffset));
  38451. startOffset = endOffset;
  38452. }
  38453. return glyphs;
  38454. }
  38455. function lookupCmap(ranges, unicode) {
  38456. var code = unicode.charCodeAt(0), gid = 0;
  38457. var l = 0, r = ranges.length - 1;
  38458. while (l < r) {
  38459. var c = l + r + 1 >> 1;
  38460. if (code < ranges[c].start) {
  38461. r = c - 1;
  38462. } else {
  38463. l = c;
  38464. }
  38465. }
  38466. if (ranges[l].start <= code && code <= ranges[l].end) {
  38467. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xFFFF;
  38468. }
  38469. return {
  38470. charCode: code,
  38471. glyphId: gid
  38472. };
  38473. }
  38474. function compileGlyf(code, cmds, font) {
  38475. function moveTo(x, y) {
  38476. cmds.push({
  38477. cmd: 'moveTo',
  38478. args: [
  38479. x,
  38480. y
  38481. ]
  38482. });
  38483. }
  38484. function lineTo(x, y) {
  38485. cmds.push({
  38486. cmd: 'lineTo',
  38487. args: [
  38488. x,
  38489. y
  38490. ]
  38491. });
  38492. }
  38493. function quadraticCurveTo(xa, ya, x, y) {
  38494. cmds.push({
  38495. cmd: 'quadraticCurveTo',
  38496. args: [
  38497. xa,
  38498. ya,
  38499. x,
  38500. y
  38501. ]
  38502. });
  38503. }
  38504. var i = 0;
  38505. var numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16;
  38506. var flags;
  38507. var x = 0, y = 0;
  38508. i += 10;
  38509. if (numberOfContours < 0) {
  38510. do {
  38511. flags = code[i] << 8 | code[i + 1];
  38512. var glyphIndex = code[i + 2] << 8 | code[i + 3];
  38513. i += 4;
  38514. var arg1, arg2;
  38515. if (flags & 0x01) {
  38516. arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16;
  38517. arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16;
  38518. i += 4;
  38519. } else {
  38520. arg1 = code[i++];
  38521. arg2 = code[i++];
  38522. }
  38523. if (flags & 0x02) {
  38524. x = arg1;
  38525. y = arg2;
  38526. } else {
  38527. x = 0;
  38528. y = 0;
  38529. }
  38530. var scaleX = 1, scaleY = 1, scale01 = 0, scale10 = 0;
  38531. if (flags & 0x08) {
  38532. scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  38533. i += 2;
  38534. } else if (flags & 0x40) {
  38535. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  38536. scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  38537. i += 4;
  38538. } else if (flags & 0x80) {
  38539. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  38540. scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  38541. scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824;
  38542. scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824;
  38543. i += 8;
  38544. }
  38545. var subglyph = font.glyphs[glyphIndex];
  38546. if (subglyph) {
  38547. cmds.push({ cmd: 'save' });
  38548. cmds.push({
  38549. cmd: 'transform',
  38550. args: [
  38551. scaleX,
  38552. scale01,
  38553. scale10,
  38554. scaleY,
  38555. x,
  38556. y
  38557. ]
  38558. });
  38559. compileGlyf(subglyph, cmds, font);
  38560. cmds.push({ cmd: 'restore' });
  38561. }
  38562. } while (flags & 0x20);
  38563. } else {
  38564. var endPtsOfContours = [];
  38565. var j, jj;
  38566. for (j = 0; j < numberOfContours; j++) {
  38567. endPtsOfContours.push(code[i] << 8 | code[i + 1]);
  38568. i += 2;
  38569. }
  38570. var instructionLength = code[i] << 8 | code[i + 1];
  38571. i += 2 + instructionLength;
  38572. var numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
  38573. var points = [];
  38574. while (points.length < numberOfPoints) {
  38575. flags = code[i++];
  38576. var repeat = 1;
  38577. if (flags & 0x08) {
  38578. repeat += code[i++];
  38579. }
  38580. while (repeat-- > 0) {
  38581. points.push({ flags: flags });
  38582. }
  38583. }
  38584. for (j = 0; j < numberOfPoints; j++) {
  38585. switch (points[j].flags & 0x12) {
  38586. case 0x00:
  38587. x += (code[i] << 24 | code[i + 1] << 16) >> 16;
  38588. i += 2;
  38589. break;
  38590. case 0x02:
  38591. x -= code[i++];
  38592. break;
  38593. case 0x12:
  38594. x += code[i++];
  38595. break;
  38596. }
  38597. points[j].x = x;
  38598. }
  38599. for (j = 0; j < numberOfPoints; j++) {
  38600. switch (points[j].flags & 0x24) {
  38601. case 0x00:
  38602. y += (code[i] << 24 | code[i + 1] << 16) >> 16;
  38603. i += 2;
  38604. break;
  38605. case 0x04:
  38606. y -= code[i++];
  38607. break;
  38608. case 0x24:
  38609. y += code[i++];
  38610. break;
  38611. }
  38612. points[j].y = y;
  38613. }
  38614. var startPoint = 0;
  38615. for (i = 0; i < numberOfContours; i++) {
  38616. var endPoint = endPtsOfContours[i];
  38617. var contour = points.slice(startPoint, endPoint + 1);
  38618. if (contour[0].flags & 1) {
  38619. contour.push(contour[0]);
  38620. } else if (contour[contour.length - 1].flags & 1) {
  38621. contour.unshift(contour[contour.length - 1]);
  38622. } else {
  38623. var p = {
  38624. flags: 1,
  38625. x: (contour[0].x + contour[contour.length - 1].x) / 2,
  38626. y: (contour[0].y + contour[contour.length - 1].y) / 2
  38627. };
  38628. contour.unshift(p);
  38629. contour.push(p);
  38630. }
  38631. moveTo(contour[0].x, contour[0].y);
  38632. for (j = 1, jj = contour.length; j < jj; j++) {
  38633. if (contour[j].flags & 1) {
  38634. lineTo(contour[j].x, contour[j].y);
  38635. } else if (contour[j + 1].flags & 1) {
  38636. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  38637. j++;
  38638. } else {
  38639. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  38640. }
  38641. }
  38642. startPoint = endPoint + 1;
  38643. }
  38644. }
  38645. }
  38646. function compileCharString(code, cmds, font) {
  38647. var stack = [];
  38648. var x = 0, y = 0;
  38649. var stems = 0;
  38650. function moveTo(x, y) {
  38651. cmds.push({
  38652. cmd: 'moveTo',
  38653. args: [
  38654. x,
  38655. y
  38656. ]
  38657. });
  38658. }
  38659. function lineTo(x, y) {
  38660. cmds.push({
  38661. cmd: 'lineTo',
  38662. args: [
  38663. x,
  38664. y
  38665. ]
  38666. });
  38667. }
  38668. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  38669. cmds.push({
  38670. cmd: 'bezierCurveTo',
  38671. args: [
  38672. x1,
  38673. y1,
  38674. x2,
  38675. y2,
  38676. x,
  38677. y
  38678. ]
  38679. });
  38680. }
  38681. function parse(code) {
  38682. var i = 0;
  38683. while (i < code.length) {
  38684. var stackClean = false;
  38685. var v = code[i++];
  38686. var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  38687. switch (v) {
  38688. case 1:
  38689. stems += stack.length >> 1;
  38690. stackClean = true;
  38691. break;
  38692. case 3:
  38693. stems += stack.length >> 1;
  38694. stackClean = true;
  38695. break;
  38696. case 4:
  38697. y += stack.pop();
  38698. moveTo(x, y);
  38699. stackClean = true;
  38700. break;
  38701. case 5:
  38702. while (stack.length > 0) {
  38703. x += stack.shift();
  38704. y += stack.shift();
  38705. lineTo(x, y);
  38706. }
  38707. break;
  38708. case 6:
  38709. while (stack.length > 0) {
  38710. x += stack.shift();
  38711. lineTo(x, y);
  38712. if (stack.length === 0) {
  38713. break;
  38714. }
  38715. y += stack.shift();
  38716. lineTo(x, y);
  38717. }
  38718. break;
  38719. case 7:
  38720. while (stack.length > 0) {
  38721. y += stack.shift();
  38722. lineTo(x, y);
  38723. if (stack.length === 0) {
  38724. break;
  38725. }
  38726. x += stack.shift();
  38727. lineTo(x, y);
  38728. }
  38729. break;
  38730. case 8:
  38731. while (stack.length > 0) {
  38732. xa = x + stack.shift();
  38733. ya = y + stack.shift();
  38734. xb = xa + stack.shift();
  38735. yb = ya + stack.shift();
  38736. x = xb + stack.shift();
  38737. y = yb + stack.shift();
  38738. bezierCurveTo(xa, ya, xb, yb, x, y);
  38739. }
  38740. break;
  38741. case 10:
  38742. n = stack.pop() + font.subrsBias;
  38743. subrCode = font.subrs[n];
  38744. if (subrCode) {
  38745. parse(subrCode);
  38746. }
  38747. break;
  38748. case 11:
  38749. return;
  38750. case 12:
  38751. v = code[i++];
  38752. switch (v) {
  38753. case 34:
  38754. xa = x + stack.shift();
  38755. xb = xa + stack.shift();
  38756. y1 = y + stack.shift();
  38757. x = xb + stack.shift();
  38758. bezierCurveTo(xa, y, xb, y1, x, y1);
  38759. xa = x + stack.shift();
  38760. xb = xa + stack.shift();
  38761. x = xb + stack.shift();
  38762. bezierCurveTo(xa, y1, xb, y, x, y);
  38763. break;
  38764. case 35:
  38765. xa = x + stack.shift();
  38766. ya = y + stack.shift();
  38767. xb = xa + stack.shift();
  38768. yb = ya + stack.shift();
  38769. x = xb + stack.shift();
  38770. y = yb + stack.shift();
  38771. bezierCurveTo(xa, ya, xb, yb, x, y);
  38772. xa = x + stack.shift();
  38773. ya = y + stack.shift();
  38774. xb = xa + stack.shift();
  38775. yb = ya + stack.shift();
  38776. x = xb + stack.shift();
  38777. y = yb + stack.shift();
  38778. bezierCurveTo(xa, ya, xb, yb, x, y);
  38779. stack.pop();
  38780. break;
  38781. case 36:
  38782. xa = x + stack.shift();
  38783. y1 = y + stack.shift();
  38784. xb = xa + stack.shift();
  38785. y2 = y1 + stack.shift();
  38786. x = xb + stack.shift();
  38787. bezierCurveTo(xa, y1, xb, y2, x, y2);
  38788. xa = x + stack.shift();
  38789. xb = xa + stack.shift();
  38790. y3 = y2 + stack.shift();
  38791. x = xb + stack.shift();
  38792. bezierCurveTo(xa, y2, xb, y3, x, y);
  38793. break;
  38794. case 37:
  38795. var x0 = x, y0 = y;
  38796. xa = x + stack.shift();
  38797. ya = y + stack.shift();
  38798. xb = xa + stack.shift();
  38799. yb = ya + stack.shift();
  38800. x = xb + stack.shift();
  38801. y = yb + stack.shift();
  38802. bezierCurveTo(xa, ya, xb, yb, x, y);
  38803. xa = x + stack.shift();
  38804. ya = y + stack.shift();
  38805. xb = xa + stack.shift();
  38806. yb = ya + stack.shift();
  38807. x = xb;
  38808. y = yb;
  38809. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  38810. x += stack.shift();
  38811. } else {
  38812. y += stack.shift();
  38813. }
  38814. bezierCurveTo(xa, ya, xb, yb, x, y);
  38815. break;
  38816. default:
  38817. error('unknown operator: 12 ' + v);
  38818. }
  38819. break;
  38820. case 14:
  38821. if (stack.length >= 4) {
  38822. var achar = stack.pop();
  38823. var bchar = stack.pop();
  38824. y = stack.pop();
  38825. x = stack.pop();
  38826. cmds.push({ cmd: 'save' });
  38827. cmds.push({
  38828. cmd: 'translate',
  38829. args: [
  38830. x,
  38831. y
  38832. ]
  38833. });
  38834. var cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[achar]]));
  38835. compileCharString(font.glyphs[cmap.glyphId], cmds, font);
  38836. cmds.push({ cmd: 'restore' });
  38837. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[bchar]]));
  38838. compileCharString(font.glyphs[cmap.glyphId], cmds, font);
  38839. }
  38840. return;
  38841. case 18:
  38842. stems += stack.length >> 1;
  38843. stackClean = true;
  38844. break;
  38845. case 19:
  38846. stems += stack.length >> 1;
  38847. i += stems + 7 >> 3;
  38848. stackClean = true;
  38849. break;
  38850. case 20:
  38851. stems += stack.length >> 1;
  38852. i += stems + 7 >> 3;
  38853. stackClean = true;
  38854. break;
  38855. case 21:
  38856. y += stack.pop();
  38857. x += stack.pop();
  38858. moveTo(x, y);
  38859. stackClean = true;
  38860. break;
  38861. case 22:
  38862. x += stack.pop();
  38863. moveTo(x, y);
  38864. stackClean = true;
  38865. break;
  38866. case 23:
  38867. stems += stack.length >> 1;
  38868. stackClean = true;
  38869. break;
  38870. case 24:
  38871. while (stack.length > 2) {
  38872. xa = x + stack.shift();
  38873. ya = y + stack.shift();
  38874. xb = xa + stack.shift();
  38875. yb = ya + stack.shift();
  38876. x = xb + stack.shift();
  38877. y = yb + stack.shift();
  38878. bezierCurveTo(xa, ya, xb, yb, x, y);
  38879. }
  38880. x += stack.shift();
  38881. y += stack.shift();
  38882. lineTo(x, y);
  38883. break;
  38884. case 25:
  38885. while (stack.length > 6) {
  38886. x += stack.shift();
  38887. y += stack.shift();
  38888. lineTo(x, y);
  38889. }
  38890. xa = x + stack.shift();
  38891. ya = y + stack.shift();
  38892. xb = xa + stack.shift();
  38893. yb = ya + stack.shift();
  38894. x = xb + stack.shift();
  38895. y = yb + stack.shift();
  38896. bezierCurveTo(xa, ya, xb, yb, x, y);
  38897. break;
  38898. case 26:
  38899. if (stack.length % 2) {
  38900. x += stack.shift();
  38901. }
  38902. while (stack.length > 0) {
  38903. xa = x;
  38904. ya = y + stack.shift();
  38905. xb = xa + stack.shift();
  38906. yb = ya + stack.shift();
  38907. x = xb;
  38908. y = yb + stack.shift();
  38909. bezierCurveTo(xa, ya, xb, yb, x, y);
  38910. }
  38911. break;
  38912. case 27:
  38913. if (stack.length % 2) {
  38914. y += stack.shift();
  38915. }
  38916. while (stack.length > 0) {
  38917. xa = x + stack.shift();
  38918. ya = y;
  38919. xb = xa + stack.shift();
  38920. yb = ya + stack.shift();
  38921. x = xb + stack.shift();
  38922. y = yb;
  38923. bezierCurveTo(xa, ya, xb, yb, x, y);
  38924. }
  38925. break;
  38926. case 28:
  38927. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  38928. i += 2;
  38929. break;
  38930. case 29:
  38931. n = stack.pop() + font.gsubrsBias;
  38932. subrCode = font.gsubrs[n];
  38933. if (subrCode) {
  38934. parse(subrCode);
  38935. }
  38936. break;
  38937. case 30:
  38938. while (stack.length > 0) {
  38939. xa = x;
  38940. ya = y + stack.shift();
  38941. xb = xa + stack.shift();
  38942. yb = ya + stack.shift();
  38943. x = xb + stack.shift();
  38944. y = yb + (stack.length === 1 ? stack.shift() : 0);
  38945. bezierCurveTo(xa, ya, xb, yb, x, y);
  38946. if (stack.length === 0) {
  38947. break;
  38948. }
  38949. xa = x + stack.shift();
  38950. ya = y;
  38951. xb = xa + stack.shift();
  38952. yb = ya + stack.shift();
  38953. y = yb + stack.shift();
  38954. x = xb + (stack.length === 1 ? stack.shift() : 0);
  38955. bezierCurveTo(xa, ya, xb, yb, x, y);
  38956. }
  38957. break;
  38958. case 31:
  38959. while (stack.length > 0) {
  38960. xa = x + stack.shift();
  38961. ya = y;
  38962. xb = xa + stack.shift();
  38963. yb = ya + stack.shift();
  38964. y = yb + stack.shift();
  38965. x = xb + (stack.length === 1 ? stack.shift() : 0);
  38966. bezierCurveTo(xa, ya, xb, yb, x, y);
  38967. if (stack.length === 0) {
  38968. break;
  38969. }
  38970. xa = x;
  38971. ya = y + stack.shift();
  38972. xb = xa + stack.shift();
  38973. yb = ya + stack.shift();
  38974. x = xb + stack.shift();
  38975. y = yb + (stack.length === 1 ? stack.shift() : 0);
  38976. bezierCurveTo(xa, ya, xb, yb, x, y);
  38977. }
  38978. break;
  38979. default:
  38980. if (v < 32) {
  38981. error('unknown operator: ' + v);
  38982. }
  38983. if (v < 247) {
  38984. stack.push(v - 139);
  38985. } else if (v < 251) {
  38986. stack.push((v - 247) * 256 + code[i++] + 108);
  38987. } else if (v < 255) {
  38988. stack.push(-(v - 251) * 256 - code[i++] - 108);
  38989. } else {
  38990. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  38991. i += 4;
  38992. }
  38993. break;
  38994. }
  38995. if (stackClean) {
  38996. stack.length = 0;
  38997. }
  38998. }
  38999. }
  39000. parse(code);
  39001. }
  39002. var noop = '';
  39003. function CompiledFont(fontMatrix) {
  39004. this.compiledGlyphs = Object.create(null);
  39005. this.compiledCharCodeToGlyphId = Object.create(null);
  39006. this.fontMatrix = fontMatrix;
  39007. }
  39008. CompiledFont.prototype = {
  39009. getPathJs: function (unicode) {
  39010. var cmap = lookupCmap(this.cmap, unicode);
  39011. var fn = this.compiledGlyphs[cmap.glyphId];
  39012. if (!fn) {
  39013. fn = this.compileGlyph(this.glyphs[cmap.glyphId]);
  39014. this.compiledGlyphs[cmap.glyphId] = fn;
  39015. }
  39016. if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
  39017. this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId;
  39018. }
  39019. return fn;
  39020. },
  39021. compileGlyph: function (code) {
  39022. if (!code || code.length === 0 || code[0] === 14) {
  39023. return noop;
  39024. }
  39025. var cmds = [];
  39026. cmds.push({ cmd: 'save' });
  39027. cmds.push({
  39028. cmd: 'transform',
  39029. args: this.fontMatrix.slice()
  39030. });
  39031. cmds.push({
  39032. cmd: 'scale',
  39033. args: [
  39034. 'size',
  39035. '-size'
  39036. ]
  39037. });
  39038. this.compileGlyphImpl(code, cmds);
  39039. cmds.push({ cmd: 'restore' });
  39040. return cmds;
  39041. },
  39042. compileGlyphImpl: function () {
  39043. error('Children classes should implement this.');
  39044. },
  39045. hasBuiltPath: function (unicode) {
  39046. var cmap = lookupCmap(this.cmap, unicode);
  39047. return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCode] !== undefined;
  39048. }
  39049. };
  39050. function TrueTypeCompiled(glyphs, cmap, fontMatrix) {
  39051. fontMatrix = fontMatrix || [
  39052. 0.000488,
  39053. 0,
  39054. 0,
  39055. 0.000488,
  39056. 0,
  39057. 0
  39058. ];
  39059. CompiledFont.call(this, fontMatrix);
  39060. this.glyphs = glyphs;
  39061. this.cmap = cmap;
  39062. }
  39063. Util.inherit(TrueTypeCompiled, CompiledFont, {
  39064. compileGlyphImpl: function (code, cmds) {
  39065. compileGlyf(code, cmds, this);
  39066. }
  39067. });
  39068. function Type2Compiled(cffInfo, cmap, fontMatrix, glyphNameMap) {
  39069. fontMatrix = fontMatrix || [
  39070. 0.001,
  39071. 0,
  39072. 0,
  39073. 0.001,
  39074. 0,
  39075. 0
  39076. ];
  39077. CompiledFont.call(this, fontMatrix);
  39078. this.glyphs = cffInfo.glyphs;
  39079. this.gsubrs = cffInfo.gsubrs || [];
  39080. this.subrs = cffInfo.subrs || [];
  39081. this.cmap = cmap;
  39082. this.glyphNameMap = glyphNameMap || getGlyphsUnicode();
  39083. this.gsubrsBias = this.gsubrs.length < 1240 ? 107 : this.gsubrs.length < 33900 ? 1131 : 32768;
  39084. this.subrsBias = this.subrs.length < 1240 ? 107 : this.subrs.length < 33900 ? 1131 : 32768;
  39085. }
  39086. Util.inherit(Type2Compiled, CompiledFont, {
  39087. compileGlyphImpl: function (code, cmds) {
  39088. compileCharString(code, cmds, this);
  39089. }
  39090. });
  39091. return {
  39092. create: function FontRendererFactory_create(font, seacAnalysisEnabled) {
  39093. var data = new Uint8Array(font.data);
  39094. var cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  39095. var numTables = getUshort(data, 4);
  39096. for (var i = 0, p = 12; i < numTables; i++, p += 16) {
  39097. var tag = bytesToString(data.subarray(p, p + 4));
  39098. var offset = getLong(data, p + 8);
  39099. var length = getLong(data, p + 12);
  39100. switch (tag) {
  39101. case 'cmap':
  39102. cmap = parseCmap(data, offset, offset + length);
  39103. break;
  39104. case 'glyf':
  39105. glyf = data.subarray(offset, offset + length);
  39106. break;
  39107. case 'loca':
  39108. loca = data.subarray(offset, offset + length);
  39109. break;
  39110. case 'head':
  39111. unitsPerEm = getUshort(data, offset + 18);
  39112. indexToLocFormat = getUshort(data, offset + 50);
  39113. break;
  39114. case 'CFF ':
  39115. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  39116. break;
  39117. }
  39118. }
  39119. if (glyf) {
  39120. var fontMatrix = !unitsPerEm ? font.fontMatrix : [
  39121. 1 / unitsPerEm,
  39122. 0,
  39123. 0,
  39124. 1 / unitsPerEm,
  39125. 0,
  39126. 0
  39127. ];
  39128. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  39129. }
  39130. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  39131. }
  39132. };
  39133. }();
  39134. exports.FontRendererFactory = FontRendererFactory;
  39135. /***/ }),
  39136. /* 26 */
  39137. /***/ (function(module, exports, __w_pdfjs_require__) {
  39138. "use strict";
  39139. var sharedUtil = __w_pdfjs_require__(0);
  39140. var corePrimitives = __w_pdfjs_require__(1);
  39141. var coreStream = __w_pdfjs_require__(2);
  39142. var coreGlyphList = __w_pdfjs_require__(7);
  39143. var coreFontRenderer = __w_pdfjs_require__(25);
  39144. var coreEncodings = __w_pdfjs_require__(4);
  39145. var coreStandardFonts = __w_pdfjs_require__(17);
  39146. var coreUnicode = __w_pdfjs_require__(18);
  39147. var coreType1Parser = __w_pdfjs_require__(35);
  39148. var coreCFFParser = __w_pdfjs_require__(11);
  39149. var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
  39150. var FontType = sharedUtil.FontType;
  39151. var assert = sharedUtil.assert;
  39152. var bytesToString = sharedUtil.bytesToString;
  39153. var error = sharedUtil.error;
  39154. var info = sharedUtil.info;
  39155. var isArray = sharedUtil.isArray;
  39156. var isInt = sharedUtil.isInt;
  39157. var isNum = sharedUtil.isNum;
  39158. var readUint32 = sharedUtil.readUint32;
  39159. var shadow = sharedUtil.shadow;
  39160. var string32 = sharedUtil.string32;
  39161. var warn = sharedUtil.warn;
  39162. var MissingDataException = sharedUtil.MissingDataException;
  39163. var isSpace = sharedUtil.isSpace;
  39164. var Stream = coreStream.Stream;
  39165. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  39166. var getDingbatsGlyphsUnicode = coreGlyphList.getDingbatsGlyphsUnicode;
  39167. var FontRendererFactory = coreFontRenderer.FontRendererFactory;
  39168. var StandardEncoding = coreEncodings.StandardEncoding;
  39169. var MacRomanEncoding = coreEncodings.MacRomanEncoding;
  39170. var SymbolSetEncoding = coreEncodings.SymbolSetEncoding;
  39171. var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding;
  39172. var getEncoding = coreEncodings.getEncoding;
  39173. var getStdFontMap = coreStandardFonts.getStdFontMap;
  39174. var getNonStdFontMap = coreStandardFonts.getNonStdFontMap;
  39175. var getGlyphMapForStandardFonts = coreStandardFonts.getGlyphMapForStandardFonts;
  39176. var getSupplementalGlyphMapForArialBlack = coreStandardFonts.getSupplementalGlyphMapForArialBlack;
  39177. var getUnicodeRangeFor = coreUnicode.getUnicodeRangeFor;
  39178. var mapSpecialUnicodeValues = coreUnicode.mapSpecialUnicodeValues;
  39179. var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph;
  39180. var Type1Parser = coreType1Parser.Type1Parser;
  39181. var CFFStandardStrings = coreCFFParser.CFFStandardStrings;
  39182. var CFFParser = coreCFFParser.CFFParser;
  39183. var CFFCompiler = coreCFFParser.CFFCompiler;
  39184. var CFF = coreCFFParser.CFF;
  39185. var CFFHeader = coreCFFParser.CFFHeader;
  39186. var CFFTopDict = coreCFFParser.CFFTopDict;
  39187. var CFFPrivateDict = coreCFFParser.CFFPrivateDict;
  39188. var CFFStrings = coreCFFParser.CFFStrings;
  39189. var CFFIndex = coreCFFParser.CFFIndex;
  39190. var CFFCharset = coreCFFParser.CFFCharset;
  39191. var PRIVATE_USE_OFFSET_START = 0xE000;
  39192. var PRIVATE_USE_OFFSET_END = 0xF8FF;
  39193. var SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = false;
  39194. var PDF_GLYPH_SPACE_UNITS = 1000;
  39195. var SEAC_ANALYSIS_ENABLED = false;
  39196. var FontFlags = {
  39197. FixedPitch: 1,
  39198. Serif: 2,
  39199. Symbolic: 4,
  39200. Script: 8,
  39201. Nonsymbolic: 32,
  39202. Italic: 64,
  39203. AllCap: 65536,
  39204. SmallCap: 131072,
  39205. ForceBold: 262144
  39206. };
  39207. var MacStandardGlyphOrdering = [
  39208. '.notdef',
  39209. '.null',
  39210. 'nonmarkingreturn',
  39211. 'space',
  39212. 'exclam',
  39213. 'quotedbl',
  39214. 'numbersign',
  39215. 'dollar',
  39216. 'percent',
  39217. 'ampersand',
  39218. 'quotesingle',
  39219. 'parenleft',
  39220. 'parenright',
  39221. 'asterisk',
  39222. 'plus',
  39223. 'comma',
  39224. 'hyphen',
  39225. 'period',
  39226. 'slash',
  39227. 'zero',
  39228. 'one',
  39229. 'two',
  39230. 'three',
  39231. 'four',
  39232. 'five',
  39233. 'six',
  39234. 'seven',
  39235. 'eight',
  39236. 'nine',
  39237. 'colon',
  39238. 'semicolon',
  39239. 'less',
  39240. 'equal',
  39241. 'greater',
  39242. 'question',
  39243. 'at',
  39244. 'A',
  39245. 'B',
  39246. 'C',
  39247. 'D',
  39248. 'E',
  39249. 'F',
  39250. 'G',
  39251. 'H',
  39252. 'I',
  39253. 'J',
  39254. 'K',
  39255. 'L',
  39256. 'M',
  39257. 'N',
  39258. 'O',
  39259. 'P',
  39260. 'Q',
  39261. 'R',
  39262. 'S',
  39263. 'T',
  39264. 'U',
  39265. 'V',
  39266. 'W',
  39267. 'X',
  39268. 'Y',
  39269. 'Z',
  39270. 'bracketleft',
  39271. 'backslash',
  39272. 'bracketright',
  39273. 'asciicircum',
  39274. 'underscore',
  39275. 'grave',
  39276. 'a',
  39277. 'b',
  39278. 'c',
  39279. 'd',
  39280. 'e',
  39281. 'f',
  39282. 'g',
  39283. 'h',
  39284. 'i',
  39285. 'j',
  39286. 'k',
  39287. 'l',
  39288. 'm',
  39289. 'n',
  39290. 'o',
  39291. 'p',
  39292. 'q',
  39293. 'r',
  39294. 's',
  39295. 't',
  39296. 'u',
  39297. 'v',
  39298. 'w',
  39299. 'x',
  39300. 'y',
  39301. 'z',
  39302. 'braceleft',
  39303. 'bar',
  39304. 'braceright',
  39305. 'asciitilde',
  39306. 'Adieresis',
  39307. 'Aring',
  39308. 'Ccedilla',
  39309. 'Eacute',
  39310. 'Ntilde',
  39311. 'Odieresis',
  39312. 'Udieresis',
  39313. 'aacute',
  39314. 'agrave',
  39315. 'acircumflex',
  39316. 'adieresis',
  39317. 'atilde',
  39318. 'aring',
  39319. 'ccedilla',
  39320. 'eacute',
  39321. 'egrave',
  39322. 'ecircumflex',
  39323. 'edieresis',
  39324. 'iacute',
  39325. 'igrave',
  39326. 'icircumflex',
  39327. 'idieresis',
  39328. 'ntilde',
  39329. 'oacute',
  39330. 'ograve',
  39331. 'ocircumflex',
  39332. 'odieresis',
  39333. 'otilde',
  39334. 'uacute',
  39335. 'ugrave',
  39336. 'ucircumflex',
  39337. 'udieresis',
  39338. 'dagger',
  39339. 'degree',
  39340. 'cent',
  39341. 'sterling',
  39342. 'section',
  39343. 'bullet',
  39344. 'paragraph',
  39345. 'germandbls',
  39346. 'registered',
  39347. 'copyright',
  39348. 'trademark',
  39349. 'acute',
  39350. 'dieresis',
  39351. 'notequal',
  39352. 'AE',
  39353. 'Oslash',
  39354. 'infinity',
  39355. 'plusminus',
  39356. 'lessequal',
  39357. 'greaterequal',
  39358. 'yen',
  39359. 'mu',
  39360. 'partialdiff',
  39361. 'summation',
  39362. 'product',
  39363. 'pi',
  39364. 'integral',
  39365. 'ordfeminine',
  39366. 'ordmasculine',
  39367. 'Omega',
  39368. 'ae',
  39369. 'oslash',
  39370. 'questiondown',
  39371. 'exclamdown',
  39372. 'logicalnot',
  39373. 'radical',
  39374. 'florin',
  39375. 'approxequal',
  39376. 'Delta',
  39377. 'guillemotleft',
  39378. 'guillemotright',
  39379. 'ellipsis',
  39380. 'nonbreakingspace',
  39381. 'Agrave',
  39382. 'Atilde',
  39383. 'Otilde',
  39384. 'OE',
  39385. 'oe',
  39386. 'endash',
  39387. 'emdash',
  39388. 'quotedblleft',
  39389. 'quotedblright',
  39390. 'quoteleft',
  39391. 'quoteright',
  39392. 'divide',
  39393. 'lozenge',
  39394. 'ydieresis',
  39395. 'Ydieresis',
  39396. 'fraction',
  39397. 'currency',
  39398. 'guilsinglleft',
  39399. 'guilsinglright',
  39400. 'fi',
  39401. 'fl',
  39402. 'daggerdbl',
  39403. 'periodcentered',
  39404. 'quotesinglbase',
  39405. 'quotedblbase',
  39406. 'perthousand',
  39407. 'Acircumflex',
  39408. 'Ecircumflex',
  39409. 'Aacute',
  39410. 'Edieresis',
  39411. 'Egrave',
  39412. 'Iacute',
  39413. 'Icircumflex',
  39414. 'Idieresis',
  39415. 'Igrave',
  39416. 'Oacute',
  39417. 'Ocircumflex',
  39418. 'apple',
  39419. 'Ograve',
  39420. 'Uacute',
  39421. 'Ucircumflex',
  39422. 'Ugrave',
  39423. 'dotlessi',
  39424. 'circumflex',
  39425. 'tilde',
  39426. 'macron',
  39427. 'breve',
  39428. 'dotaccent',
  39429. 'ring',
  39430. 'cedilla',
  39431. 'hungarumlaut',
  39432. 'ogonek',
  39433. 'caron',
  39434. 'Lslash',
  39435. 'lslash',
  39436. 'Scaron',
  39437. 'scaron',
  39438. 'Zcaron',
  39439. 'zcaron',
  39440. 'brokenbar',
  39441. 'Eth',
  39442. 'eth',
  39443. 'Yacute',
  39444. 'yacute',
  39445. 'Thorn',
  39446. 'thorn',
  39447. 'minus',
  39448. 'multiply',
  39449. 'onesuperior',
  39450. 'twosuperior',
  39451. 'threesuperior',
  39452. 'onehalf',
  39453. 'onequarter',
  39454. 'threequarters',
  39455. 'franc',
  39456. 'Gbreve',
  39457. 'gbreve',
  39458. 'Idotaccent',
  39459. 'Scedilla',
  39460. 'scedilla',
  39461. 'Cacute',
  39462. 'cacute',
  39463. 'Ccaron',
  39464. 'ccaron',
  39465. 'dcroat'
  39466. ];
  39467. function adjustWidths(properties) {
  39468. if (!properties.fontMatrix) {
  39469. return;
  39470. }
  39471. if (properties.fontMatrix[0] === FONT_IDENTITY_MATRIX[0]) {
  39472. return;
  39473. }
  39474. var scale = 0.001 / properties.fontMatrix[0];
  39475. var glyphsWidths = properties.widths;
  39476. for (var glyph in glyphsWidths) {
  39477. glyphsWidths[glyph] *= scale;
  39478. }
  39479. properties.defaultWidth *= scale;
  39480. }
  39481. function adjustToUnicode(properties, builtInEncoding) {
  39482. if (properties.hasIncludedToUnicodeMap) {
  39483. return;
  39484. }
  39485. if (properties.hasEncoding) {
  39486. return;
  39487. }
  39488. if (builtInEncoding === properties.defaultEncoding) {
  39489. return;
  39490. }
  39491. if (properties.toUnicode instanceof IdentityToUnicodeMap) {
  39492. return;
  39493. }
  39494. var toUnicode = [], glyphsUnicodeMap = getGlyphsUnicode();
  39495. for (var charCode in builtInEncoding) {
  39496. var glyphName = builtInEncoding[charCode];
  39497. var unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  39498. if (unicode !== -1) {
  39499. toUnicode[charCode] = String.fromCharCode(unicode);
  39500. }
  39501. }
  39502. properties.toUnicode.amend(toUnicode);
  39503. }
  39504. function getFontType(type, subtype) {
  39505. switch (type) {
  39506. case 'Type1':
  39507. return subtype === 'Type1C' ? FontType.TYPE1C : FontType.TYPE1;
  39508. case 'CIDFontType0':
  39509. return subtype === 'CIDFontType0C' ? FontType.CIDFONTTYPE0C : FontType.CIDFONTTYPE0;
  39510. case 'OpenType':
  39511. return FontType.OPENTYPE;
  39512. case 'TrueType':
  39513. return FontType.TRUETYPE;
  39514. case 'CIDFontType2':
  39515. return FontType.CIDFONTTYPE2;
  39516. case 'MMType1':
  39517. return FontType.MMTYPE1;
  39518. case 'Type0':
  39519. return FontType.TYPE0;
  39520. default:
  39521. return FontType.UNKNOWN;
  39522. }
  39523. }
  39524. function recoverGlyphName(name, glyphsUnicodeMap) {
  39525. if (glyphsUnicodeMap[name] !== undefined) {
  39526. return name;
  39527. }
  39528. var unicode = getUnicodeForGlyph(name, glyphsUnicodeMap);
  39529. if (unicode !== -1) {
  39530. for (var key in glyphsUnicodeMap) {
  39531. if (glyphsUnicodeMap[key] === unicode) {
  39532. return key;
  39533. }
  39534. }
  39535. }
  39536. info('Unable to recover a standard glyph name for: ' + name);
  39537. return name;
  39538. }
  39539. var Glyph = function GlyphClosure() {
  39540. function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  39541. this.fontChar = fontChar;
  39542. this.unicode = unicode;
  39543. this.accent = accent;
  39544. this.width = width;
  39545. this.vmetric = vmetric;
  39546. this.operatorListId = operatorListId;
  39547. this.isSpace = isSpace;
  39548. this.isInFont = isInFont;
  39549. }
  39550. Glyph.prototype.matchesForCache = function (fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  39551. 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;
  39552. };
  39553. return Glyph;
  39554. }();
  39555. var ToUnicodeMap = function ToUnicodeMapClosure() {
  39556. function ToUnicodeMap(cmap) {
  39557. this._map = cmap;
  39558. }
  39559. ToUnicodeMap.prototype = {
  39560. get length() {
  39561. return this._map.length;
  39562. },
  39563. forEach: function (callback) {
  39564. for (var charCode in this._map) {
  39565. callback(charCode, this._map[charCode].charCodeAt(0));
  39566. }
  39567. },
  39568. has: function (i) {
  39569. return this._map[i] !== undefined;
  39570. },
  39571. get: function (i) {
  39572. return this._map[i];
  39573. },
  39574. charCodeOf: function (v) {
  39575. return this._map.indexOf(v);
  39576. },
  39577. amend: function (map) {
  39578. for (var charCode in map) {
  39579. this._map[charCode] = map[charCode];
  39580. }
  39581. }
  39582. };
  39583. return ToUnicodeMap;
  39584. }();
  39585. var IdentityToUnicodeMap = function IdentityToUnicodeMapClosure() {
  39586. function IdentityToUnicodeMap(firstChar, lastChar) {
  39587. this.firstChar = firstChar;
  39588. this.lastChar = lastChar;
  39589. }
  39590. IdentityToUnicodeMap.prototype = {
  39591. get length() {
  39592. return this.lastChar + 1 - this.firstChar;
  39593. },
  39594. forEach: function (callback) {
  39595. for (var i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  39596. callback(i, i);
  39597. }
  39598. },
  39599. has: function (i) {
  39600. return this.firstChar <= i && i <= this.lastChar;
  39601. },
  39602. get: function (i) {
  39603. if (this.firstChar <= i && i <= this.lastChar) {
  39604. return String.fromCharCode(i);
  39605. }
  39606. return undefined;
  39607. },
  39608. charCodeOf: function (v) {
  39609. return isInt(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  39610. },
  39611. amend: function (map) {
  39612. error('Should not call amend()');
  39613. }
  39614. };
  39615. return IdentityToUnicodeMap;
  39616. }();
  39617. var OpenTypeFileBuilder = function OpenTypeFileBuilderClosure() {
  39618. function writeInt16(dest, offset, num) {
  39619. dest[offset] = num >> 8 & 0xFF;
  39620. dest[offset + 1] = num & 0xFF;
  39621. }
  39622. function writeInt32(dest, offset, num) {
  39623. dest[offset] = num >> 24 & 0xFF;
  39624. dest[offset + 1] = num >> 16 & 0xFF;
  39625. dest[offset + 2] = num >> 8 & 0xFF;
  39626. dest[offset + 3] = num & 0xFF;
  39627. }
  39628. function writeData(dest, offset, data) {
  39629. var i, ii;
  39630. if (data instanceof Uint8Array) {
  39631. dest.set(data, offset);
  39632. } else if (typeof data === 'string') {
  39633. for (i = 0, ii = data.length; i < ii; i++) {
  39634. dest[offset++] = data.charCodeAt(i) & 0xFF;
  39635. }
  39636. } else {
  39637. for (i = 0, ii = data.length; i < ii; i++) {
  39638. dest[offset++] = data[i] & 0xFF;
  39639. }
  39640. }
  39641. }
  39642. function OpenTypeFileBuilder(sfnt) {
  39643. this.sfnt = sfnt;
  39644. this.tables = Object.create(null);
  39645. }
  39646. OpenTypeFileBuilder.getSearchParams = function OpenTypeFileBuilder_getSearchParams(entriesCount, entrySize) {
  39647. var maxPower2 = 1, log2 = 0;
  39648. while ((maxPower2 ^ entriesCount) > maxPower2) {
  39649. maxPower2 <<= 1;
  39650. log2++;
  39651. }
  39652. var searchRange = maxPower2 * entrySize;
  39653. return {
  39654. range: searchRange,
  39655. entry: log2,
  39656. rangeShift: entrySize * entriesCount - searchRange
  39657. };
  39658. };
  39659. var OTF_HEADER_SIZE = 12;
  39660. var OTF_TABLE_ENTRY_SIZE = 16;
  39661. OpenTypeFileBuilder.prototype = {
  39662. toArray: function OpenTypeFileBuilder_toArray() {
  39663. var sfnt = this.sfnt;
  39664. var tables = this.tables;
  39665. var tablesNames = Object.keys(tables);
  39666. tablesNames.sort();
  39667. var numTables = tablesNames.length;
  39668. var i, j, jj, table, tableName;
  39669. var offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  39670. var tableOffsets = [offset];
  39671. for (i = 0; i < numTables; i++) {
  39672. table = tables[tablesNames[i]];
  39673. var paddedLength = (table.length + 3 & ~3) >>> 0;
  39674. offset += paddedLength;
  39675. tableOffsets.push(offset);
  39676. }
  39677. var file = new Uint8Array(offset);
  39678. for (i = 0; i < numTables; i++) {
  39679. table = tables[tablesNames[i]];
  39680. writeData(file, tableOffsets[i], table);
  39681. }
  39682. if (sfnt === 'true') {
  39683. sfnt = string32(0x00010000);
  39684. }
  39685. file[0] = sfnt.charCodeAt(0) & 0xFF;
  39686. file[1] = sfnt.charCodeAt(1) & 0xFF;
  39687. file[2] = sfnt.charCodeAt(2) & 0xFF;
  39688. file[3] = sfnt.charCodeAt(3) & 0xFF;
  39689. writeInt16(file, 4, numTables);
  39690. var searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  39691. writeInt16(file, 6, searchParams.range);
  39692. writeInt16(file, 8, searchParams.entry);
  39693. writeInt16(file, 10, searchParams.rangeShift);
  39694. offset = OTF_HEADER_SIZE;
  39695. for (i = 0; i < numTables; i++) {
  39696. tableName = tablesNames[i];
  39697. file[offset] = tableName.charCodeAt(0) & 0xFF;
  39698. file[offset + 1] = tableName.charCodeAt(1) & 0xFF;
  39699. file[offset + 2] = tableName.charCodeAt(2) & 0xFF;
  39700. file[offset + 3] = tableName.charCodeAt(3) & 0xFF;
  39701. var checksum = 0;
  39702. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  39703. var quad = readUint32(file, j);
  39704. checksum = checksum + quad >>> 0;
  39705. }
  39706. writeInt32(file, offset + 4, checksum);
  39707. writeInt32(file, offset + 8, tableOffsets[i]);
  39708. writeInt32(file, offset + 12, tables[tableName].length);
  39709. offset += OTF_TABLE_ENTRY_SIZE;
  39710. }
  39711. return file;
  39712. },
  39713. addTable: function OpenTypeFileBuilder_addTable(tag, data) {
  39714. if (tag in this.tables) {
  39715. throw new Error('Table ' + tag + ' already exists');
  39716. }
  39717. this.tables[tag] = data;
  39718. }
  39719. };
  39720. return OpenTypeFileBuilder;
  39721. }();
  39722. var ProblematicCharRanges = new Int32Array([
  39723. 0x0000,
  39724. 0x0020,
  39725. 0x007F,
  39726. 0x00A1,
  39727. 0x00AD,
  39728. 0x00AE,
  39729. 0x0600,
  39730. 0x0780,
  39731. 0x08A0,
  39732. 0x10A0,
  39733. 0x1780,
  39734. 0x1800,
  39735. 0x1C00,
  39736. 0x1C50,
  39737. 0x2000,
  39738. 0x2010,
  39739. 0x2011,
  39740. 0x2012,
  39741. 0x2028,
  39742. 0x2030,
  39743. 0x205F,
  39744. 0x2070,
  39745. 0x25CC,
  39746. 0x25CD,
  39747. 0x3000,
  39748. 0x3001,
  39749. 0xAA60,
  39750. 0xAA80,
  39751. 0xFFF0,
  39752. 0x10000
  39753. ]);
  39754. var Font = function FontClosure() {
  39755. function Font(name, file, properties) {
  39756. var charCode, glyphName, unicode;
  39757. this.name = name;
  39758. this.loadedName = properties.loadedName;
  39759. this.isType3Font = properties.isType3Font;
  39760. this.sizes = [];
  39761. this.missingFile = false;
  39762. this.glyphCache = Object.create(null);
  39763. this.isSerifFont = !!(properties.flags & FontFlags.Serif);
  39764. this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  39765. this.isMonospace = !!(properties.flags & FontFlags.FixedPitch);
  39766. var type = properties.type;
  39767. var subtype = properties.subtype;
  39768. this.type = type;
  39769. this.fallbackName = this.isMonospace ? 'monospace' : this.isSerifFont ? 'serif' : 'sans-serif';
  39770. this.differences = properties.differences;
  39771. this.widths = properties.widths;
  39772. this.defaultWidth = properties.defaultWidth;
  39773. this.composite = properties.composite;
  39774. this.wideChars = properties.wideChars;
  39775. this.cMap = properties.cMap;
  39776. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  39777. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  39778. this.fontMatrix = properties.fontMatrix;
  39779. this.bbox = properties.bbox;
  39780. this.toUnicode = properties.toUnicode;
  39781. this.toFontChar = [];
  39782. if (properties.type === 'Type3') {
  39783. for (charCode = 0; charCode < 256; charCode++) {
  39784. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  39785. }
  39786. this.fontType = FontType.TYPE3;
  39787. return;
  39788. }
  39789. this.cidEncoding = properties.cidEncoding;
  39790. this.vertical = properties.vertical;
  39791. if (this.vertical) {
  39792. this.vmetrics = properties.vmetrics;
  39793. this.defaultVMetrics = properties.defaultVMetrics;
  39794. }
  39795. var glyphsUnicodeMap;
  39796. if (!file || file.isEmpty) {
  39797. if (file) {
  39798. warn('Font file is empty in "' + name + '" (' + this.loadedName + ')');
  39799. }
  39800. this.missingFile = true;
  39801. var fontName = name.replace(/[,_]/g, '-');
  39802. var stdFontMap = getStdFontMap(), nonStdFontMap = getNonStdFontMap();
  39803. var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  39804. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  39805. this.bold = fontName.search(/bold/gi) !== -1;
  39806. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  39807. this.black = name.search(/Black/g) !== -1;
  39808. this.remeasure = Object.keys(this.widths).length > 0;
  39809. if (isStandardFont && type === 'CIDFontType2' && properties.cidEncoding.indexOf('Identity-') === 0) {
  39810. var GlyphMapForStandardFonts = getGlyphMapForStandardFonts();
  39811. var map = [];
  39812. for (charCode in GlyphMapForStandardFonts) {
  39813. map[+charCode] = GlyphMapForStandardFonts[charCode];
  39814. }
  39815. if (/Arial-?Black/i.test(name)) {
  39816. var SupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack();
  39817. for (charCode in SupplementalGlyphMapForArialBlack) {
  39818. map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
  39819. }
  39820. }
  39821. var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
  39822. if (!isIdentityUnicode) {
  39823. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  39824. map[+charCode] = unicodeCharCode;
  39825. });
  39826. }
  39827. this.toFontChar = map;
  39828. this.toUnicode = new ToUnicodeMap(map);
  39829. } else if (/Symbol/i.test(fontName)) {
  39830. this.toFontChar = buildToFontChar(SymbolSetEncoding, getGlyphsUnicode(), properties.differences);
  39831. } else if (/Dingbats/i.test(fontName)) {
  39832. if (/Wingdings/i.test(name)) {
  39833. warn('Non-embedded Wingdings font, falling back to ZapfDingbats.');
  39834. }
  39835. this.toFontChar = buildToFontChar(ZapfDingbatsEncoding, getDingbatsGlyphsUnicode(), properties.differences);
  39836. } else if (isStandardFont) {
  39837. this.toFontChar = buildToFontChar(properties.defaultEncoding, getGlyphsUnicode(), properties.differences);
  39838. } else {
  39839. glyphsUnicodeMap = getGlyphsUnicode();
  39840. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  39841. if (!this.composite) {
  39842. glyphName = properties.differences[charCode] || properties.defaultEncoding[charCode];
  39843. unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  39844. if (unicode !== -1) {
  39845. unicodeCharCode = unicode;
  39846. }
  39847. }
  39848. this.toFontChar[charCode] = unicodeCharCode;
  39849. }.bind(this));
  39850. }
  39851. this.loadedName = fontName.split('-')[0];
  39852. this.loading = false;
  39853. this.fontType = getFontType(type, subtype);
  39854. return;
  39855. }
  39856. if (subtype === 'Type1C') {
  39857. if (type !== 'Type1' && type !== 'MMType1') {
  39858. if (isTrueTypeFile(file)) {
  39859. subtype = 'TrueType';
  39860. } else {
  39861. type = 'Type1';
  39862. }
  39863. } else if (isOpenTypeFile(file)) {
  39864. type = subtype = 'OpenType';
  39865. }
  39866. }
  39867. if (subtype === 'CIDFontType0C' && type !== 'CIDFontType0') {
  39868. type = 'CIDFontType0';
  39869. }
  39870. if (subtype === 'OpenType') {
  39871. type = 'OpenType';
  39872. }
  39873. if (type === 'CIDFontType0') {
  39874. if (isType1File(file)) {
  39875. subtype = 'CIDFontType0';
  39876. } else if (isOpenTypeFile(file)) {
  39877. type = subtype = 'OpenType';
  39878. } else {
  39879. subtype = 'CIDFontType0C';
  39880. }
  39881. }
  39882. var data;
  39883. switch (type) {
  39884. case 'MMType1':
  39885. info('MMType1 font (' + name + '), falling back to Type1.');
  39886. case 'Type1':
  39887. case 'CIDFontType0':
  39888. this.mimetype = 'font/opentype';
  39889. var cff = subtype === 'Type1C' || subtype === 'CIDFontType0C' ? new CFFFont(file, properties) : new Type1Font(name, file, properties);
  39890. adjustWidths(properties);
  39891. data = this.convert(name, cff, properties);
  39892. break;
  39893. case 'OpenType':
  39894. case 'TrueType':
  39895. case 'CIDFontType2':
  39896. this.mimetype = 'font/opentype';
  39897. data = this.checkAndRepair(name, file, properties);
  39898. if (this.isOpenType) {
  39899. adjustWidths(properties);
  39900. type = 'OpenType';
  39901. }
  39902. break;
  39903. default:
  39904. error('Font ' + type + ' is not supported');
  39905. break;
  39906. }
  39907. this.data = data;
  39908. this.fontType = getFontType(type, subtype);
  39909. this.fontMatrix = properties.fontMatrix;
  39910. this.widths = properties.widths;
  39911. this.defaultWidth = properties.defaultWidth;
  39912. this.toUnicode = properties.toUnicode;
  39913. this.encoding = properties.baseEncoding;
  39914. this.seacMap = properties.seacMap;
  39915. this.loading = true;
  39916. }
  39917. Font.getFontID = function () {
  39918. var ID = 1;
  39919. return function Font_getFontID() {
  39920. return String(ID++);
  39921. };
  39922. }();
  39923. function int16(b0, b1) {
  39924. return (b0 << 8) + b1;
  39925. }
  39926. function signedInt16(b0, b1) {
  39927. var value = (b0 << 8) + b1;
  39928. return value & 1 << 15 ? value - 0x10000 : value;
  39929. }
  39930. function int32(b0, b1, b2, b3) {
  39931. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  39932. }
  39933. function string16(value) {
  39934. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  39935. }
  39936. function safeString16(value) {
  39937. value = value > 0x7FFF ? 0x7FFF : value < -0x8000 ? -0x8000 : value;
  39938. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  39939. }
  39940. function isTrueTypeFile(file) {
  39941. var header = file.peekBytes(4);
  39942. return readUint32(header, 0) === 0x00010000;
  39943. }
  39944. function isOpenTypeFile(file) {
  39945. var header = file.peekBytes(4);
  39946. return bytesToString(header) === 'OTTO';
  39947. }
  39948. function isType1File(file) {
  39949. var header = file.peekBytes(2);
  39950. if (header[0] === 0x25 && header[1] === 0x21) {
  39951. return true;
  39952. }
  39953. if (header[0] === 0x80 && header[1] === 0x01) {
  39954. return true;
  39955. }
  39956. return false;
  39957. }
  39958. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  39959. var toFontChar = [], unicode;
  39960. for (var i = 0, ii = encoding.length; i < ii; i++) {
  39961. unicode = getUnicodeForGlyph(encoding[i], glyphsUnicodeMap);
  39962. if (unicode !== -1) {
  39963. toFontChar[i] = unicode;
  39964. }
  39965. }
  39966. for (var charCode in differences) {
  39967. unicode = getUnicodeForGlyph(differences[charCode], glyphsUnicodeMap);
  39968. if (unicode !== -1) {
  39969. toFontChar[+charCode] = unicode;
  39970. }
  39971. }
  39972. return toFontChar;
  39973. }
  39974. function isProblematicUnicodeLocation(code) {
  39975. var i = 0, j = ProblematicCharRanges.length - 1;
  39976. while (i < j) {
  39977. var c = i + j + 1 >> 1;
  39978. if (code < ProblematicCharRanges[c]) {
  39979. j = c - 1;
  39980. } else {
  39981. i = c;
  39982. }
  39983. }
  39984. return !(i & 1);
  39985. }
  39986. function adjustMapping(charCodeToGlyphId, properties) {
  39987. var toUnicode = properties.toUnicode;
  39988. var isSymbolic = !!(properties.flags & FontFlags.Symbolic);
  39989. var isIdentityUnicode = properties.toUnicode instanceof IdentityToUnicodeMap;
  39990. var newMap = Object.create(null);
  39991. var toFontChar = [];
  39992. var usedFontCharCodes = [];
  39993. var nextAvailableFontCharCode = PRIVATE_USE_OFFSET_START;
  39994. for (var originalCharCode in charCodeToGlyphId) {
  39995. originalCharCode |= 0;
  39996. var glyphId = charCodeToGlyphId[originalCharCode];
  39997. var fontCharCode = originalCharCode;
  39998. var hasUnicodeValue = false;
  39999. if (!isIdentityUnicode && toUnicode.has(originalCharCode)) {
  40000. hasUnicodeValue = true;
  40001. var unicode = toUnicode.get(fontCharCode);
  40002. if (unicode.length === 1) {
  40003. fontCharCode = unicode.charCodeAt(0);
  40004. }
  40005. }
  40006. if ((usedFontCharCodes[fontCharCode] !== undefined || isProblematicUnicodeLocation(fontCharCode) || isSymbolic && !hasUnicodeValue) && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END) {
  40007. do {
  40008. fontCharCode = nextAvailableFontCharCode++;
  40009. if (SKIP_PRIVATE_USE_RANGE_F000_TO_F01F && fontCharCode === 0xF000) {
  40010. fontCharCode = 0xF020;
  40011. nextAvailableFontCharCode = fontCharCode + 1;
  40012. }
  40013. } while (usedFontCharCodes[fontCharCode] !== undefined && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END);
  40014. }
  40015. newMap[fontCharCode] = glyphId;
  40016. toFontChar[originalCharCode] = fontCharCode;
  40017. usedFontCharCodes[fontCharCode] = true;
  40018. }
  40019. return {
  40020. toFontChar: toFontChar,
  40021. charCodeToGlyphId: newMap,
  40022. nextAvailableFontCharCode: nextAvailableFontCharCode
  40023. };
  40024. }
  40025. function getRanges(glyphs, numGlyphs) {
  40026. var codes = [];
  40027. for (var charCode in glyphs) {
  40028. if (glyphs[charCode] >= numGlyphs) {
  40029. continue;
  40030. }
  40031. codes.push({
  40032. fontCharCode: charCode | 0,
  40033. glyphId: glyphs[charCode]
  40034. });
  40035. }
  40036. codes.sort(function fontGetRangesSort(a, b) {
  40037. return a.fontCharCode - b.fontCharCode;
  40038. });
  40039. var ranges = [];
  40040. var length = codes.length;
  40041. for (var n = 0; n < length;) {
  40042. var start = codes[n].fontCharCode;
  40043. var codeIndices = [codes[n].glyphId];
  40044. ++n;
  40045. var end = start;
  40046. while (n < length && end + 1 === codes[n].fontCharCode) {
  40047. codeIndices.push(codes[n].glyphId);
  40048. ++end;
  40049. ++n;
  40050. if (end === 0xFFFF) {
  40051. break;
  40052. }
  40053. }
  40054. ranges.push([
  40055. start,
  40056. end,
  40057. codeIndices
  40058. ]);
  40059. }
  40060. return ranges;
  40061. }
  40062. function createCmapTable(glyphs, numGlyphs) {
  40063. var ranges = getRanges(glyphs, numGlyphs);
  40064. var numTables = ranges[ranges.length - 1][1] > 0xFFFF ? 2 : 1;
  40065. var cmap = '\x00\x00' + string16(numTables) + '\x00\x03' + '\x00\x01' + string32(4 + numTables * 8);
  40066. var i, ii, j, jj;
  40067. for (i = ranges.length - 1; i >= 0; --i) {
  40068. if (ranges[i][0] <= 0xFFFF) {
  40069. break;
  40070. }
  40071. }
  40072. var bmpLength = i + 1;
  40073. if (ranges[i][0] < 0xFFFF && ranges[i][1] === 0xFFFF) {
  40074. ranges[i][1] = 0xFFFE;
  40075. }
  40076. var trailingRangesCount = ranges[i][1] < 0xFFFF ? 1 : 0;
  40077. var segCount = bmpLength + trailingRangesCount;
  40078. var searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2);
  40079. var startCount = '';
  40080. var endCount = '';
  40081. var idDeltas = '';
  40082. var idRangeOffsets = '';
  40083. var glyphsIds = '';
  40084. var bias = 0;
  40085. var range, start, end, codes;
  40086. for (i = 0, ii = bmpLength; i < ii; i++) {
  40087. range = ranges[i];
  40088. start = range[0];
  40089. end = range[1];
  40090. startCount += string16(start);
  40091. endCount += string16(end);
  40092. codes = range[2];
  40093. var contiguous = true;
  40094. for (j = 1, jj = codes.length; j < jj; ++j) {
  40095. if (codes[j] !== codes[j - 1] + 1) {
  40096. contiguous = false;
  40097. break;
  40098. }
  40099. }
  40100. if (!contiguous) {
  40101. var offset = (segCount - i) * 2 + bias * 2;
  40102. bias += end - start + 1;
  40103. idDeltas += string16(0);
  40104. idRangeOffsets += string16(offset);
  40105. for (j = 0, jj = codes.length; j < jj; ++j) {
  40106. glyphsIds += string16(codes[j]);
  40107. }
  40108. } else {
  40109. var startCode = codes[0];
  40110. idDeltas += string16(startCode - start & 0xFFFF);
  40111. idRangeOffsets += string16(0);
  40112. }
  40113. }
  40114. if (trailingRangesCount > 0) {
  40115. endCount += '\xFF\xFF';
  40116. startCount += '\xFF\xFF';
  40117. idDeltas += '\x00\x01';
  40118. idRangeOffsets += '\x00\x00';
  40119. }
  40120. var format314 = '\x00\x00' + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + '\x00\x00' + startCount + idDeltas + idRangeOffsets + glyphsIds;
  40121. var format31012 = '';
  40122. var header31012 = '';
  40123. if (numTables > 1) {
  40124. cmap += '\x00\x03' + '\x00\x0A' + string32(4 + numTables * 8 + 4 + format314.length);
  40125. format31012 = '';
  40126. for (i = 0, ii = ranges.length; i < ii; i++) {
  40127. range = ranges[i];
  40128. start = range[0];
  40129. codes = range[2];
  40130. var code = codes[0];
  40131. for (j = 1, jj = codes.length; j < jj; ++j) {
  40132. if (codes[j] !== codes[j - 1] + 1) {
  40133. end = range[0] + j - 1;
  40134. format31012 += string32(start) + string32(end) + string32(code);
  40135. start = end + 1;
  40136. code = codes[j];
  40137. }
  40138. }
  40139. format31012 += string32(start) + string32(range[1]) + string32(code);
  40140. }
  40141. header31012 = '\x00\x0C' + '\x00\x00' + string32(format31012.length + 16) + '\x00\x00\x00\x00' + string32(format31012.length / 12);
  40142. }
  40143. return cmap + '\x00\x04' + string16(format314.length + 4) + format314 + header31012 + format31012;
  40144. }
  40145. function validateOS2Table(os2) {
  40146. var stream = new Stream(os2.data);
  40147. var version = stream.getUint16();
  40148. stream.getBytes(60);
  40149. var selection = stream.getUint16();
  40150. if (version < 4 && selection & 0x0300) {
  40151. return false;
  40152. }
  40153. var firstChar = stream.getUint16();
  40154. var lastChar = stream.getUint16();
  40155. if (firstChar > lastChar) {
  40156. return false;
  40157. }
  40158. stream.getBytes(6);
  40159. var usWinAscent = stream.getUint16();
  40160. if (usWinAscent === 0) {
  40161. return false;
  40162. }
  40163. os2.data[8] = os2.data[9] = 0;
  40164. return true;
  40165. }
  40166. function createOS2Table(properties, charstrings, override) {
  40167. override = override || {
  40168. unitsPerEm: 0,
  40169. yMax: 0,
  40170. yMin: 0,
  40171. ascent: 0,
  40172. descent: 0
  40173. };
  40174. var ulUnicodeRange1 = 0;
  40175. var ulUnicodeRange2 = 0;
  40176. var ulUnicodeRange3 = 0;
  40177. var ulUnicodeRange4 = 0;
  40178. var firstCharIndex = null;
  40179. var lastCharIndex = 0;
  40180. if (charstrings) {
  40181. for (var code in charstrings) {
  40182. code |= 0;
  40183. if (firstCharIndex > code || !firstCharIndex) {
  40184. firstCharIndex = code;
  40185. }
  40186. if (lastCharIndex < code) {
  40187. lastCharIndex = code;
  40188. }
  40189. var position = getUnicodeRangeFor(code);
  40190. if (position < 32) {
  40191. ulUnicodeRange1 |= 1 << position;
  40192. } else if (position < 64) {
  40193. ulUnicodeRange2 |= 1 << position - 32;
  40194. } else if (position < 96) {
  40195. ulUnicodeRange3 |= 1 << position - 64;
  40196. } else if (position < 123) {
  40197. ulUnicodeRange4 |= 1 << position - 96;
  40198. } else {
  40199. error('Unicode ranges Bits > 123 are reserved for internal usage');
  40200. }
  40201. }
  40202. } else {
  40203. firstCharIndex = 0;
  40204. lastCharIndex = 255;
  40205. }
  40206. var bbox = properties.bbox || [
  40207. 0,
  40208. 0,
  40209. 0,
  40210. 0
  40211. ];
  40212. var unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0];
  40213. var scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  40214. var typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  40215. var typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  40216. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  40217. typoDescent = -typoDescent;
  40218. }
  40219. var winAscent = override.yMax || typoAscent;
  40220. var winDescent = -override.yMin || -typoDescent;
  40221. 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';
  40222. }
  40223. function createPostTable(properties) {
  40224. var angle = Math.floor(properties.italicAngle * Math.pow(2, 16));
  40225. 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';
  40226. }
  40227. function createNameTable(name, proto) {
  40228. if (!proto) {
  40229. proto = [
  40230. [],
  40231. []
  40232. ];
  40233. }
  40234. var strings = [
  40235. proto[0][0] || 'Original licence',
  40236. proto[0][1] || name,
  40237. proto[0][2] || 'Unknown',
  40238. proto[0][3] || 'uniqueID',
  40239. proto[0][4] || name,
  40240. proto[0][5] || 'Version 0.11',
  40241. proto[0][6] || '',
  40242. proto[0][7] || 'Unknown',
  40243. proto[0][8] || 'Unknown',
  40244. proto[0][9] || 'Unknown'
  40245. ];
  40246. var stringsUnicode = [];
  40247. var i, ii, j, jj, str;
  40248. for (i = 0, ii = strings.length; i < ii; i++) {
  40249. str = proto[1][i] || strings[i];
  40250. var strBufUnicode = [];
  40251. for (j = 0, jj = str.length; j < jj; j++) {
  40252. strBufUnicode.push(string16(str.charCodeAt(j)));
  40253. }
  40254. stringsUnicode.push(strBufUnicode.join(''));
  40255. }
  40256. var names = [
  40257. strings,
  40258. stringsUnicode
  40259. ];
  40260. var platforms = [
  40261. '\x00\x01',
  40262. '\x00\x03'
  40263. ];
  40264. var encodings = [
  40265. '\x00\x00',
  40266. '\x00\x01'
  40267. ];
  40268. var languages = [
  40269. '\x00\x00',
  40270. '\x04\x09'
  40271. ];
  40272. var namesRecordCount = strings.length * platforms.length;
  40273. var nameTable = '\x00\x00' + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  40274. var strOffset = 0;
  40275. for (i = 0, ii = platforms.length; i < ii; i++) {
  40276. var strs = names[i];
  40277. for (j = 0, jj = strs.length; j < jj; j++) {
  40278. str = strs[j];
  40279. var nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  40280. nameTable += nameRecord;
  40281. strOffset += str.length;
  40282. }
  40283. }
  40284. nameTable += strings.join('') + stringsUnicode.join('');
  40285. return nameTable;
  40286. }
  40287. Font.prototype = {
  40288. name: null,
  40289. font: null,
  40290. mimetype: null,
  40291. encoding: null,
  40292. get renderer() {
  40293. var renderer = FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED);
  40294. return shadow(this, 'renderer', renderer);
  40295. },
  40296. exportData: function Font_exportData() {
  40297. var data = {};
  40298. for (var i in this) {
  40299. if (this.hasOwnProperty(i)) {
  40300. data[i] = this[i];
  40301. }
  40302. }
  40303. return data;
  40304. },
  40305. checkAndRepair: function Font_checkAndRepair(name, font, properties) {
  40306. function readTableEntry(file) {
  40307. var tag = bytesToString(file.getBytes(4));
  40308. var checksum = file.getInt32() >>> 0;
  40309. var offset = file.getInt32() >>> 0;
  40310. var length = file.getInt32() >>> 0;
  40311. var previousPosition = file.pos;
  40312. file.pos = file.start ? file.start : 0;
  40313. file.skip(offset);
  40314. var data = file.getBytes(length);
  40315. file.pos = previousPosition;
  40316. if (tag === 'head') {
  40317. data[8] = data[9] = data[10] = data[11] = 0;
  40318. data[17] |= 0x20;
  40319. }
  40320. return {
  40321. tag: tag,
  40322. checksum: checksum,
  40323. length: length,
  40324. offset: offset,
  40325. data: data
  40326. };
  40327. }
  40328. function readOpenTypeHeader(ttf) {
  40329. return {
  40330. version: bytesToString(ttf.getBytes(4)),
  40331. numTables: ttf.getUint16(),
  40332. searchRange: ttf.getUint16(),
  40333. entrySelector: ttf.getUint16(),
  40334. rangeShift: ttf.getUint16()
  40335. };
  40336. }
  40337. function readCmapTable(cmap, font, isSymbolicFont, hasEncoding) {
  40338. if (!cmap) {
  40339. warn('No cmap table available.');
  40340. return {
  40341. platformId: -1,
  40342. encodingId: -1,
  40343. mappings: [],
  40344. hasShortCmap: false
  40345. };
  40346. }
  40347. var segment;
  40348. var start = (font.start ? font.start : 0) + cmap.offset;
  40349. font.pos = start;
  40350. font.getUint16();
  40351. var numTables = font.getUint16();
  40352. var potentialTable;
  40353. var canBreak = false;
  40354. for (var i = 0; i < numTables; i++) {
  40355. var platformId = font.getUint16();
  40356. var encodingId = font.getUint16();
  40357. var offset = font.getInt32() >>> 0;
  40358. var useTable = false;
  40359. if (platformId === 0 && encodingId === 0) {
  40360. useTable = true;
  40361. } else if (platformId === 1 && encodingId === 0) {
  40362. useTable = true;
  40363. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  40364. useTable = true;
  40365. if (!isSymbolicFont) {
  40366. canBreak = true;
  40367. }
  40368. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  40369. useTable = true;
  40370. canBreak = true;
  40371. }
  40372. if (useTable) {
  40373. potentialTable = {
  40374. platformId: platformId,
  40375. encodingId: encodingId,
  40376. offset: offset
  40377. };
  40378. }
  40379. if (canBreak) {
  40380. break;
  40381. }
  40382. }
  40383. if (potentialTable) {
  40384. font.pos = start + potentialTable.offset;
  40385. }
  40386. if (!potentialTable || font.peekByte() === -1) {
  40387. warn('Could not find a preferred cmap table.');
  40388. return {
  40389. platformId: -1,
  40390. encodingId: -1,
  40391. mappings: [],
  40392. hasShortCmap: false
  40393. };
  40394. }
  40395. var format = font.getUint16();
  40396. font.getUint16();
  40397. font.getUint16();
  40398. var hasShortCmap = false;
  40399. var mappings = [];
  40400. var j, glyphId;
  40401. if (format === 0) {
  40402. for (j = 0; j < 256; j++) {
  40403. var index = font.getByte();
  40404. if (!index) {
  40405. continue;
  40406. }
  40407. mappings.push({
  40408. charCode: j,
  40409. glyphId: index
  40410. });
  40411. }
  40412. hasShortCmap = true;
  40413. } else if (format === 4) {
  40414. var segCount = font.getUint16() >> 1;
  40415. font.getBytes(6);
  40416. var segIndex, segments = [];
  40417. for (segIndex = 0; segIndex < segCount; segIndex++) {
  40418. segments.push({ end: font.getUint16() });
  40419. }
  40420. font.getUint16();
  40421. for (segIndex = 0; segIndex < segCount; segIndex++) {
  40422. segments[segIndex].start = font.getUint16();
  40423. }
  40424. for (segIndex = 0; segIndex < segCount; segIndex++) {
  40425. segments[segIndex].delta = font.getUint16();
  40426. }
  40427. var offsetsCount = 0;
  40428. for (segIndex = 0; segIndex < segCount; segIndex++) {
  40429. segment = segments[segIndex];
  40430. var rangeOffset = font.getUint16();
  40431. if (!rangeOffset) {
  40432. segment.offsetIndex = -1;
  40433. continue;
  40434. }
  40435. var offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  40436. segment.offsetIndex = offsetIndex;
  40437. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  40438. }
  40439. var offsets = [];
  40440. for (j = 0; j < offsetsCount; j++) {
  40441. offsets.push(font.getUint16());
  40442. }
  40443. for (segIndex = 0; segIndex < segCount; segIndex++) {
  40444. segment = segments[segIndex];
  40445. start = segment.start;
  40446. var end = segment.end;
  40447. var delta = segment.delta;
  40448. offsetIndex = segment.offsetIndex;
  40449. for (j = start; j <= end; j++) {
  40450. if (j === 0xFFFF) {
  40451. continue;
  40452. }
  40453. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  40454. glyphId = glyphId + delta & 0xFFFF;
  40455. if (glyphId === 0) {
  40456. continue;
  40457. }
  40458. mappings.push({
  40459. charCode: j,
  40460. glyphId: glyphId
  40461. });
  40462. }
  40463. }
  40464. } else if (format === 6) {
  40465. var firstCode = font.getUint16();
  40466. var entryCount = font.getUint16();
  40467. for (j = 0; j < entryCount; j++) {
  40468. glyphId = font.getUint16();
  40469. var charCode = firstCode + j;
  40470. mappings.push({
  40471. charCode: charCode,
  40472. glyphId: glyphId
  40473. });
  40474. }
  40475. } else {
  40476. warn('cmap table has unsupported format: ' + format);
  40477. return {
  40478. platformId: -1,
  40479. encodingId: -1,
  40480. mappings: [],
  40481. hasShortCmap: false
  40482. };
  40483. }
  40484. mappings.sort(function (a, b) {
  40485. return a.charCode - b.charCode;
  40486. });
  40487. for (i = 1; i < mappings.length; i++) {
  40488. if (mappings[i - 1].charCode === mappings[i].charCode) {
  40489. mappings.splice(i, 1);
  40490. i--;
  40491. }
  40492. }
  40493. return {
  40494. platformId: potentialTable.platformId,
  40495. encodingId: potentialTable.encodingId,
  40496. mappings: mappings,
  40497. hasShortCmap: hasShortCmap
  40498. };
  40499. }
  40500. function sanitizeMetrics(font, header, metrics, numGlyphs) {
  40501. if (!header) {
  40502. if (metrics) {
  40503. metrics.data = null;
  40504. }
  40505. return;
  40506. }
  40507. font.pos = (font.start ? font.start : 0) + header.offset;
  40508. font.pos += header.length - 2;
  40509. var numOfMetrics = font.getUint16();
  40510. if (numOfMetrics > numGlyphs) {
  40511. info('The numOfMetrics (' + numOfMetrics + ') should not be ' + 'greater than the numGlyphs (' + numGlyphs + ')');
  40512. numOfMetrics = numGlyphs;
  40513. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  40514. header.data[35] = numOfMetrics & 0x00ff;
  40515. }
  40516. var numOfSidebearings = numGlyphs - numOfMetrics;
  40517. var numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  40518. if (numMissing > 0) {
  40519. var entries = new Uint8Array(metrics.length + numMissing * 2);
  40520. entries.set(metrics.data);
  40521. metrics.data = entries;
  40522. }
  40523. }
  40524. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  40525. if (sourceEnd - sourceStart <= 12) {
  40526. return 0;
  40527. }
  40528. var glyf = source.subarray(sourceStart, sourceEnd);
  40529. var contoursCount = glyf[0] << 8 | glyf[1];
  40530. if (contoursCount & 0x8000) {
  40531. dest.set(glyf, destStart);
  40532. return glyf.length;
  40533. }
  40534. var i, j = 10, flagsCount = 0;
  40535. for (i = 0; i < contoursCount; i++) {
  40536. var endPoint = glyf[j] << 8 | glyf[j + 1];
  40537. flagsCount = endPoint + 1;
  40538. j += 2;
  40539. }
  40540. var instructionsStart = j;
  40541. var instructionsLength = glyf[j] << 8 | glyf[j + 1];
  40542. j += 2 + instructionsLength;
  40543. var instructionsEnd = j;
  40544. var coordinatesLength = 0;
  40545. for (i = 0; i < flagsCount; i++) {
  40546. var flag = glyf[j++];
  40547. if (flag & 0xC0) {
  40548. glyf[j - 1] = flag & 0x3F;
  40549. }
  40550. var xyLength = (flag & 2 ? 1 : flag & 16 ? 0 : 2) + (flag & 4 ? 1 : flag & 32 ? 0 : 2);
  40551. coordinatesLength += xyLength;
  40552. if (flag & 8) {
  40553. var repeat = glyf[j++];
  40554. i += repeat;
  40555. coordinatesLength += repeat * xyLength;
  40556. }
  40557. }
  40558. if (coordinatesLength === 0) {
  40559. return 0;
  40560. }
  40561. var glyphDataLength = j + coordinatesLength;
  40562. if (glyphDataLength > glyf.length) {
  40563. return 0;
  40564. }
  40565. if (!hintsValid && instructionsLength > 0) {
  40566. dest.set(glyf.subarray(0, instructionsStart), destStart);
  40567. dest.set([
  40568. 0,
  40569. 0
  40570. ], destStart + instructionsStart);
  40571. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  40572. glyphDataLength -= instructionsLength;
  40573. if (glyf.length - glyphDataLength > 3) {
  40574. glyphDataLength = glyphDataLength + 3 & ~3;
  40575. }
  40576. return glyphDataLength;
  40577. }
  40578. if (glyf.length - glyphDataLength > 3) {
  40579. glyphDataLength = glyphDataLength + 3 & ~3;
  40580. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  40581. return glyphDataLength;
  40582. }
  40583. dest.set(glyf, destStart);
  40584. return glyf.length;
  40585. }
  40586. function sanitizeHead(head, numGlyphs, locaLength) {
  40587. var data = head.data;
  40588. var version = int32(data[0], data[1], data[2], data[3]);
  40589. if (version >> 16 !== 1) {
  40590. info('Attempting to fix invalid version in head table: ' + version);
  40591. data[0] = 0;
  40592. data[1] = 1;
  40593. data[2] = 0;
  40594. data[3] = 0;
  40595. }
  40596. var indexToLocFormat = int16(data[50], data[51]);
  40597. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  40598. info('Attempting to fix invalid indexToLocFormat in head table: ' + indexToLocFormat);
  40599. var numGlyphsPlusOne = numGlyphs + 1;
  40600. if (locaLength === numGlyphsPlusOne << 1) {
  40601. data[50] = 0;
  40602. data[51] = 0;
  40603. } else if (locaLength === numGlyphsPlusOne << 2) {
  40604. data[50] = 0;
  40605. data[51] = 1;
  40606. } else {
  40607. warn('Could not fix indexToLocFormat: ' + indexToLocFormat);
  40608. }
  40609. }
  40610. }
  40611. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry) {
  40612. var itemSize, itemDecode, itemEncode;
  40613. if (isGlyphLocationsLong) {
  40614. itemSize = 4;
  40615. itemDecode = function fontItemDecodeLong(data, offset) {
  40616. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  40617. };
  40618. itemEncode = function fontItemEncodeLong(data, offset, value) {
  40619. data[offset] = value >>> 24 & 0xFF;
  40620. data[offset + 1] = value >> 16 & 0xFF;
  40621. data[offset + 2] = value >> 8 & 0xFF;
  40622. data[offset + 3] = value & 0xFF;
  40623. };
  40624. } else {
  40625. itemSize = 2;
  40626. itemDecode = function fontItemDecode(data, offset) {
  40627. return data[offset] << 9 | data[offset + 1] << 1;
  40628. };
  40629. itemEncode = function fontItemEncode(data, offset, value) {
  40630. data[offset] = value >> 9 & 0xFF;
  40631. data[offset + 1] = value >> 1 & 0xFF;
  40632. };
  40633. }
  40634. var locaData = loca.data;
  40635. var locaDataSize = itemSize * (1 + numGlyphs);
  40636. if (locaData.length !== locaDataSize) {
  40637. locaData = new Uint8Array(locaDataSize);
  40638. locaData.set(loca.data.subarray(0, locaDataSize));
  40639. loca.data = locaData;
  40640. }
  40641. var oldGlyfData = glyf.data;
  40642. var oldGlyfDataLength = oldGlyfData.length;
  40643. var newGlyfData = new Uint8Array(oldGlyfDataLength);
  40644. var startOffset = itemDecode(locaData, 0);
  40645. var writeOffset = 0;
  40646. var missingGlyphData = Object.create(null);
  40647. itemEncode(locaData, 0, writeOffset);
  40648. var i, j;
  40649. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  40650. var endOffset = itemDecode(locaData, j);
  40651. if (endOffset > oldGlyfDataLength && (oldGlyfDataLength + 3 & ~3) === endOffset) {
  40652. endOffset = oldGlyfDataLength;
  40653. }
  40654. if (endOffset > oldGlyfDataLength) {
  40655. itemEncode(locaData, j, writeOffset);
  40656. startOffset = endOffset;
  40657. continue;
  40658. }
  40659. if (startOffset === endOffset) {
  40660. missingGlyphData[i] = true;
  40661. }
  40662. var newLength = sanitizeGlyph(oldGlyfData, startOffset, endOffset, newGlyfData, writeOffset, hintsValid);
  40663. writeOffset += newLength;
  40664. itemEncode(locaData, j, writeOffset);
  40665. startOffset = endOffset;
  40666. }
  40667. if (writeOffset === 0) {
  40668. var simpleGlyph = new Uint8Array([
  40669. 0,
  40670. 1,
  40671. 0,
  40672. 0,
  40673. 0,
  40674. 0,
  40675. 0,
  40676. 0,
  40677. 0,
  40678. 0,
  40679. 0,
  40680. 0,
  40681. 0,
  40682. 0,
  40683. 49,
  40684. 0
  40685. ]);
  40686. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  40687. itemEncode(locaData, j, simpleGlyph.length);
  40688. }
  40689. glyf.data = simpleGlyph;
  40690. return missingGlyphData;
  40691. }
  40692. if (dupFirstEntry) {
  40693. var firstEntryLength = itemDecode(locaData, itemSize);
  40694. if (newGlyfData.length > firstEntryLength + writeOffset) {
  40695. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  40696. } else {
  40697. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  40698. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  40699. }
  40700. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  40701. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  40702. } else {
  40703. glyf.data = newGlyfData.subarray(0, writeOffset);
  40704. }
  40705. return missingGlyphData;
  40706. }
  40707. function readPostScriptTable(post, properties, maxpNumGlyphs) {
  40708. var start = (font.start ? font.start : 0) + post.offset;
  40709. font.pos = start;
  40710. var length = post.length, end = start + length;
  40711. var version = font.getInt32();
  40712. font.getBytes(28);
  40713. var glyphNames;
  40714. var valid = true;
  40715. var i;
  40716. switch (version) {
  40717. case 0x00010000:
  40718. glyphNames = MacStandardGlyphOrdering;
  40719. break;
  40720. case 0x00020000:
  40721. var numGlyphs = font.getUint16();
  40722. if (numGlyphs !== maxpNumGlyphs) {
  40723. valid = false;
  40724. break;
  40725. }
  40726. var glyphNameIndexes = [];
  40727. for (i = 0; i < numGlyphs; ++i) {
  40728. var index = font.getUint16();
  40729. if (index >= 32768) {
  40730. valid = false;
  40731. break;
  40732. }
  40733. glyphNameIndexes.push(index);
  40734. }
  40735. if (!valid) {
  40736. break;
  40737. }
  40738. var customNames = [];
  40739. var strBuf = [];
  40740. while (font.pos < end) {
  40741. var stringLength = font.getByte();
  40742. strBuf.length = stringLength;
  40743. for (i = 0; i < stringLength; ++i) {
  40744. strBuf[i] = String.fromCharCode(font.getByte());
  40745. }
  40746. customNames.push(strBuf.join(''));
  40747. }
  40748. glyphNames = [];
  40749. for (i = 0; i < numGlyphs; ++i) {
  40750. var j = glyphNameIndexes[i];
  40751. if (j < 258) {
  40752. glyphNames.push(MacStandardGlyphOrdering[j]);
  40753. continue;
  40754. }
  40755. glyphNames.push(customNames[j - 258]);
  40756. }
  40757. break;
  40758. case 0x00030000:
  40759. break;
  40760. default:
  40761. warn('Unknown/unsupported post table version ' + version);
  40762. valid = false;
  40763. if (properties.defaultEncoding) {
  40764. glyphNames = properties.defaultEncoding;
  40765. }
  40766. break;
  40767. }
  40768. properties.glyphNames = glyphNames;
  40769. return valid;
  40770. }
  40771. function readNameTable(nameTable) {
  40772. var start = (font.start ? font.start : 0) + nameTable.offset;
  40773. font.pos = start;
  40774. var names = [
  40775. [],
  40776. []
  40777. ];
  40778. var length = nameTable.length, end = start + length;
  40779. var format = font.getUint16();
  40780. var FORMAT_0_HEADER_LENGTH = 6;
  40781. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  40782. return names;
  40783. }
  40784. var numRecords = font.getUint16();
  40785. var stringsStart = font.getUint16();
  40786. var records = [];
  40787. var NAME_RECORD_LENGTH = 12;
  40788. var i, ii;
  40789. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  40790. var r = {
  40791. platform: font.getUint16(),
  40792. encoding: font.getUint16(),
  40793. language: font.getUint16(),
  40794. name: font.getUint16(),
  40795. length: font.getUint16(),
  40796. offset: font.getUint16()
  40797. };
  40798. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  40799. records.push(r);
  40800. }
  40801. }
  40802. for (i = 0, ii = records.length; i < ii; i++) {
  40803. var record = records[i];
  40804. if (record.length <= 0) {
  40805. continue;
  40806. }
  40807. var pos = start + stringsStart + record.offset;
  40808. if (pos + record.length > end) {
  40809. continue;
  40810. }
  40811. font.pos = pos;
  40812. var nameIndex = record.name;
  40813. if (record.encoding) {
  40814. var str = '';
  40815. for (var j = 0, jj = record.length; j < jj; j += 2) {
  40816. str += String.fromCharCode(font.getUint16());
  40817. }
  40818. names[1][nameIndex] = str;
  40819. } else {
  40820. names[0][nameIndex] = bytesToString(font.getBytes(record.length));
  40821. }
  40822. }
  40823. return names;
  40824. }
  40825. var TTOpsStackDeltas = [
  40826. 0,
  40827. 0,
  40828. 0,
  40829. 0,
  40830. 0,
  40831. 0,
  40832. 0,
  40833. 0,
  40834. -2,
  40835. -2,
  40836. -2,
  40837. -2,
  40838. 0,
  40839. 0,
  40840. -2,
  40841. -5,
  40842. -1,
  40843. -1,
  40844. -1,
  40845. -1,
  40846. -1,
  40847. -1,
  40848. -1,
  40849. -1,
  40850. 0,
  40851. 0,
  40852. -1,
  40853. 0,
  40854. -1,
  40855. -1,
  40856. -1,
  40857. -1,
  40858. 1,
  40859. -1,
  40860. -999,
  40861. 0,
  40862. 1,
  40863. 0,
  40864. -1,
  40865. -2,
  40866. 0,
  40867. -1,
  40868. -2,
  40869. -1,
  40870. -1,
  40871. 0,
  40872. -1,
  40873. -1,
  40874. 0,
  40875. 0,
  40876. -999,
  40877. -999,
  40878. -1,
  40879. -1,
  40880. -1,
  40881. -1,
  40882. -2,
  40883. -999,
  40884. -2,
  40885. -2,
  40886. -999,
  40887. 0,
  40888. -2,
  40889. -2,
  40890. 0,
  40891. 0,
  40892. -2,
  40893. 0,
  40894. -2,
  40895. 0,
  40896. 0,
  40897. 0,
  40898. -2,
  40899. -1,
  40900. -1,
  40901. 1,
  40902. 1,
  40903. 0,
  40904. 0,
  40905. -1,
  40906. -1,
  40907. -1,
  40908. -1,
  40909. -1,
  40910. -1,
  40911. -1,
  40912. 0,
  40913. 0,
  40914. -1,
  40915. 0,
  40916. -1,
  40917. -1,
  40918. 0,
  40919. -999,
  40920. -1,
  40921. -1,
  40922. -1,
  40923. -1,
  40924. -1,
  40925. -1,
  40926. 0,
  40927. 0,
  40928. 0,
  40929. 0,
  40930. 0,
  40931. 0,
  40932. 0,
  40933. 0,
  40934. 0,
  40935. 0,
  40936. 0,
  40937. 0,
  40938. -2,
  40939. -999,
  40940. -999,
  40941. -999,
  40942. -999,
  40943. -999,
  40944. -1,
  40945. -1,
  40946. -2,
  40947. -2,
  40948. 0,
  40949. 0,
  40950. 0,
  40951. 0,
  40952. -1,
  40953. -1,
  40954. -999,
  40955. -2,
  40956. -2,
  40957. 0,
  40958. 0,
  40959. -1,
  40960. -2,
  40961. -2,
  40962. 0,
  40963. 0,
  40964. 0,
  40965. -1,
  40966. -1,
  40967. -1,
  40968. -2
  40969. ];
  40970. function sanitizeTTProgram(table, ttContext) {
  40971. var data = table.data;
  40972. var i = 0, j, n, b, funcId, pc, lastEndf = 0, lastDeff = 0;
  40973. var stack = [];
  40974. var callstack = [];
  40975. var functionsCalled = [];
  40976. var tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  40977. var inFDEF = false, ifLevel = 0, inELSE = 0;
  40978. for (var ii = data.length; i < ii;) {
  40979. var op = data[i++];
  40980. if (op === 0x40) {
  40981. n = data[i++];
  40982. if (inFDEF || inELSE) {
  40983. i += n;
  40984. } else {
  40985. for (j = 0; j < n; j++) {
  40986. stack.push(data[i++]);
  40987. }
  40988. }
  40989. } else if (op === 0x41) {
  40990. n = data[i++];
  40991. if (inFDEF || inELSE) {
  40992. i += n * 2;
  40993. } else {
  40994. for (j = 0; j < n; j++) {
  40995. b = data[i++];
  40996. stack.push(b << 8 | data[i++]);
  40997. }
  40998. }
  40999. } else if ((op & 0xF8) === 0xB0) {
  41000. n = op - 0xB0 + 1;
  41001. if (inFDEF || inELSE) {
  41002. i += n;
  41003. } else {
  41004. for (j = 0; j < n; j++) {
  41005. stack.push(data[i++]);
  41006. }
  41007. }
  41008. } else if ((op & 0xF8) === 0xB8) {
  41009. n = op - 0xB8 + 1;
  41010. if (inFDEF || inELSE) {
  41011. i += n * 2;
  41012. } else {
  41013. for (j = 0; j < n; j++) {
  41014. b = data[i++];
  41015. stack.push(b << 8 | data[i++]);
  41016. }
  41017. }
  41018. } else if (op === 0x2B && !tooComplexToFollowFunctions) {
  41019. if (!inFDEF && !inELSE) {
  41020. funcId = stack[stack.length - 1];
  41021. ttContext.functionsUsed[funcId] = true;
  41022. if (funcId in ttContext.functionsStackDeltas) {
  41023. stack.length += ttContext.functionsStackDeltas[funcId];
  41024. } else if (funcId in ttContext.functionsDefined && functionsCalled.indexOf(funcId) < 0) {
  41025. callstack.push({
  41026. data: data,
  41027. i: i,
  41028. stackTop: stack.length - 1
  41029. });
  41030. functionsCalled.push(funcId);
  41031. pc = ttContext.functionsDefined[funcId];
  41032. if (!pc) {
  41033. warn('TT: CALL non-existent function');
  41034. ttContext.hintsValid = false;
  41035. return;
  41036. }
  41037. data = pc.data;
  41038. i = pc.i;
  41039. }
  41040. }
  41041. } else if (op === 0x2C && !tooComplexToFollowFunctions) {
  41042. if (inFDEF || inELSE) {
  41043. warn('TT: nested FDEFs not allowed');
  41044. tooComplexToFollowFunctions = true;
  41045. }
  41046. inFDEF = true;
  41047. lastDeff = i;
  41048. funcId = stack.pop();
  41049. ttContext.functionsDefined[funcId] = {
  41050. data: data,
  41051. i: i
  41052. };
  41053. } else if (op === 0x2D) {
  41054. if (inFDEF) {
  41055. inFDEF = false;
  41056. lastEndf = i;
  41057. } else {
  41058. pc = callstack.pop();
  41059. if (!pc) {
  41060. warn('TT: ENDF bad stack');
  41061. ttContext.hintsValid = false;
  41062. return;
  41063. }
  41064. funcId = functionsCalled.pop();
  41065. data = pc.data;
  41066. i = pc.i;
  41067. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  41068. }
  41069. } else if (op === 0x89) {
  41070. if (inFDEF || inELSE) {
  41071. warn('TT: nested IDEFs not allowed');
  41072. tooComplexToFollowFunctions = true;
  41073. }
  41074. inFDEF = true;
  41075. lastDeff = i;
  41076. } else if (op === 0x58) {
  41077. ++ifLevel;
  41078. } else if (op === 0x1B) {
  41079. inELSE = ifLevel;
  41080. } else if (op === 0x59) {
  41081. if (inELSE === ifLevel) {
  41082. inELSE = 0;
  41083. }
  41084. --ifLevel;
  41085. } else if (op === 0x1C) {
  41086. if (!inFDEF && !inELSE) {
  41087. var offset = stack[stack.length - 1];
  41088. if (offset > 0) {
  41089. i += offset - 1;
  41090. }
  41091. }
  41092. }
  41093. if (!inFDEF && !inELSE) {
  41094. var stackDelta = op <= 0x8E ? TTOpsStackDeltas[op] : op >= 0xC0 && op <= 0xDF ? -1 : op >= 0xE0 ? -2 : 0;
  41095. if (op >= 0x71 && op <= 0x75) {
  41096. n = stack.pop();
  41097. if (!isNaN(n)) {
  41098. stackDelta = -n * 2;
  41099. }
  41100. }
  41101. while (stackDelta < 0 && stack.length > 0) {
  41102. stack.pop();
  41103. stackDelta++;
  41104. }
  41105. while (stackDelta > 0) {
  41106. stack.push(NaN);
  41107. stackDelta--;
  41108. }
  41109. }
  41110. }
  41111. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  41112. var content = [data];
  41113. if (i > data.length) {
  41114. content.push(new Uint8Array(i - data.length));
  41115. }
  41116. if (lastDeff > lastEndf) {
  41117. warn('TT: complementing a missing function tail');
  41118. content.push(new Uint8Array([
  41119. 0x22,
  41120. 0x2D
  41121. ]));
  41122. }
  41123. foldTTTable(table, content);
  41124. }
  41125. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  41126. if (ttContext.tooComplexToFollowFunctions) {
  41127. return;
  41128. }
  41129. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  41130. warn('TT: more functions defined than expected');
  41131. ttContext.hintsValid = false;
  41132. return;
  41133. }
  41134. for (var j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  41135. if (j > maxFunctionDefs) {
  41136. warn('TT: invalid function id: ' + j);
  41137. ttContext.hintsValid = false;
  41138. return;
  41139. }
  41140. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  41141. warn('TT: undefined function: ' + j);
  41142. ttContext.hintsValid = false;
  41143. return;
  41144. }
  41145. }
  41146. }
  41147. function foldTTTable(table, content) {
  41148. if (content.length > 1) {
  41149. var newLength = 0;
  41150. var j, jj;
  41151. for (j = 0, jj = content.length; j < jj; j++) {
  41152. newLength += content[j].length;
  41153. }
  41154. newLength = newLength + 3 & ~3;
  41155. var result = new Uint8Array(newLength);
  41156. var pos = 0;
  41157. for (j = 0, jj = content.length; j < jj; j++) {
  41158. result.set(content[j], pos);
  41159. pos += content[j].length;
  41160. }
  41161. table.data = result;
  41162. table.length = newLength;
  41163. }
  41164. }
  41165. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  41166. var ttContext = {
  41167. functionsDefined: [],
  41168. functionsUsed: [],
  41169. functionsStackDeltas: [],
  41170. tooComplexToFollowFunctions: false,
  41171. hintsValid: true
  41172. };
  41173. if (fpgm) {
  41174. sanitizeTTProgram(fpgm, ttContext);
  41175. }
  41176. if (prep) {
  41177. sanitizeTTProgram(prep, ttContext);
  41178. }
  41179. if (fpgm) {
  41180. checkInvalidFunctions(ttContext, maxFunctionDefs);
  41181. }
  41182. if (cvt && cvt.length & 1) {
  41183. var cvtData = new Uint8Array(cvt.length + 1);
  41184. cvtData.set(cvt.data);
  41185. cvt.data = cvtData;
  41186. }
  41187. return ttContext.hintsValid;
  41188. }
  41189. font = new Stream(new Uint8Array(font.getBytes()));
  41190. var VALID_TABLES = [
  41191. 'OS/2',
  41192. 'cmap',
  41193. 'head',
  41194. 'hhea',
  41195. 'hmtx',
  41196. 'maxp',
  41197. 'name',
  41198. 'post',
  41199. 'loca',
  41200. 'glyf',
  41201. 'fpgm',
  41202. 'prep',
  41203. 'cvt ',
  41204. 'CFF '
  41205. ];
  41206. var header = readOpenTypeHeader(font);
  41207. var numTables = header.numTables;
  41208. var cff, cffFile;
  41209. var tables = Object.create(null);
  41210. tables['OS/2'] = null;
  41211. tables['cmap'] = null;
  41212. tables['head'] = null;
  41213. tables['hhea'] = null;
  41214. tables['hmtx'] = null;
  41215. tables['maxp'] = null;
  41216. tables['name'] = null;
  41217. tables['post'] = null;
  41218. var table;
  41219. for (var i = 0; i < numTables; i++) {
  41220. table = readTableEntry(font);
  41221. if (VALID_TABLES.indexOf(table.tag) < 0) {
  41222. continue;
  41223. }
  41224. if (table.length === 0) {
  41225. continue;
  41226. }
  41227. tables[table.tag] = table;
  41228. }
  41229. var isTrueType = !tables['CFF '];
  41230. if (!isTrueType) {
  41231. if (header.version === 'OTTO' && !properties.composite || !tables['head'] || !tables['hhea'] || !tables['maxp'] || !tables['post']) {
  41232. cffFile = new Stream(tables['CFF '].data);
  41233. cff = new CFFFont(cffFile, properties);
  41234. adjustWidths(properties);
  41235. return this.convert(name, cff, properties);
  41236. }
  41237. delete tables['glyf'];
  41238. delete tables['loca'];
  41239. delete tables['fpgm'];
  41240. delete tables['prep'];
  41241. delete tables['cvt '];
  41242. this.isOpenType = true;
  41243. } else {
  41244. if (!tables['loca']) {
  41245. error('Required "loca" table is not found');
  41246. }
  41247. if (!tables['glyf']) {
  41248. warn('Required "glyf" table is not found -- trying to recover.');
  41249. tables['glyf'] = {
  41250. tag: 'glyf',
  41251. data: new Uint8Array(0)
  41252. };
  41253. }
  41254. this.isOpenType = false;
  41255. }
  41256. if (!tables['maxp']) {
  41257. error('Required "maxp" table is not found');
  41258. }
  41259. font.pos = (font.start || 0) + tables['maxp'].offset;
  41260. var version = font.getInt32();
  41261. var numGlyphs = font.getUint16();
  41262. var maxFunctionDefs = 0;
  41263. if (version >= 0x00010000 && tables['maxp'].length >= 22) {
  41264. font.pos += 8;
  41265. var maxZones = font.getUint16();
  41266. if (maxZones > 2) {
  41267. tables['maxp'].data[14] = 0;
  41268. tables['maxp'].data[15] = 2;
  41269. }
  41270. font.pos += 4;
  41271. maxFunctionDefs = font.getUint16();
  41272. }
  41273. var dupFirstEntry = false;
  41274. if (properties.type === 'CIDFontType2' && properties.toUnicode && properties.toUnicode.get(0) > '\u0000') {
  41275. dupFirstEntry = true;
  41276. numGlyphs++;
  41277. tables['maxp'].data[4] = numGlyphs >> 8;
  41278. tables['maxp'].data[5] = numGlyphs & 255;
  41279. }
  41280. var hintsValid = sanitizeTTPrograms(tables['fpgm'], tables['prep'], tables['cvt '], maxFunctionDefs);
  41281. if (!hintsValid) {
  41282. delete tables['fpgm'];
  41283. delete tables['prep'];
  41284. delete tables['cvt '];
  41285. }
  41286. sanitizeMetrics(font, tables['hhea'], tables['hmtx'], numGlyphs);
  41287. if (!tables['head']) {
  41288. error('Required "head" table is not found');
  41289. }
  41290. sanitizeHead(tables['head'], numGlyphs, isTrueType ? tables['loca'].length : 0);
  41291. var missingGlyphs = Object.create(null);
  41292. if (isTrueType) {
  41293. var isGlyphLocationsLong = int16(tables['head'].data[50], tables['head'].data[51]);
  41294. missingGlyphs = sanitizeGlyphLocations(tables['loca'], tables['glyf'], numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry);
  41295. }
  41296. if (!tables['hhea']) {
  41297. error('Required "hhea" table is not found');
  41298. }
  41299. if (tables['hhea'].data[10] === 0 && tables['hhea'].data[11] === 0) {
  41300. tables['hhea'].data[10] = 0xFF;
  41301. tables['hhea'].data[11] = 0xFF;
  41302. }
  41303. var metricsOverride = {
  41304. unitsPerEm: int16(tables['head'].data[18], tables['head'].data[19]),
  41305. yMax: int16(tables['head'].data[42], tables['head'].data[43]),
  41306. yMin: signedInt16(tables['head'].data[38], tables['head'].data[39]),
  41307. ascent: int16(tables['hhea'].data[4], tables['hhea'].data[5]),
  41308. descent: signedInt16(tables['hhea'].data[6], tables['hhea'].data[7])
  41309. };
  41310. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  41311. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  41312. if (tables['post']) {
  41313. var valid = readPostScriptTable(tables['post'], properties, numGlyphs);
  41314. if (!valid) {
  41315. tables['post'] = null;
  41316. }
  41317. }
  41318. var charCodeToGlyphId = [], charCode;
  41319. var toUnicode = properties.toUnicode, widths = properties.widths;
  41320. var skipToUnicode = toUnicode instanceof IdentityToUnicodeMap || toUnicode.length === 0x10000;
  41321. function hasGlyph(glyphId, charCode, widthCode) {
  41322. if (!missingGlyphs[glyphId]) {
  41323. return true;
  41324. }
  41325. if (!skipToUnicode && charCode >= 0 && toUnicode.has(charCode)) {
  41326. return true;
  41327. }
  41328. if (widths && widthCode >= 0 && isNum(widths[widthCode])) {
  41329. return true;
  41330. }
  41331. return false;
  41332. }
  41333. if (properties.composite) {
  41334. var cidToGidMap = properties.cidToGidMap || [];
  41335. var isCidToGidMapEmpty = cidToGidMap.length === 0;
  41336. properties.cMap.forEach(function (charCode, cid) {
  41337. assert(cid <= 0xffff, 'Max size of CID is 65,535');
  41338. var glyphId = -1;
  41339. if (isCidToGidMapEmpty) {
  41340. glyphId = cid;
  41341. } else if (cidToGidMap[cid] !== undefined) {
  41342. glyphId = cidToGidMap[cid];
  41343. }
  41344. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId, charCode, cid)) {
  41345. charCodeToGlyphId[charCode] = glyphId;
  41346. }
  41347. });
  41348. if (dupFirstEntry && (isCidToGidMapEmpty || !charCodeToGlyphId[0])) {
  41349. charCodeToGlyphId[0] = numGlyphs - 1;
  41350. }
  41351. } else {
  41352. var cmapTable = readCmapTable(tables['cmap'], font, this.isSymbolicFont, properties.hasEncoding);
  41353. var cmapPlatformId = cmapTable.platformId;
  41354. var cmapEncodingId = cmapTable.encodingId;
  41355. var cmapMappings = cmapTable.mappings;
  41356. var cmapMappingsLength = cmapMappings.length;
  41357. if (properties.hasEncoding && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0) || cmapPlatformId === -1 && cmapEncodingId === -1 && !!getEncoding(properties.baseEncodingName)) {
  41358. var baseEncoding = [];
  41359. if (properties.baseEncodingName === 'MacRomanEncoding' || properties.baseEncodingName === 'WinAnsiEncoding') {
  41360. baseEncoding = getEncoding(properties.baseEncodingName);
  41361. }
  41362. var glyphsUnicodeMap = getGlyphsUnicode();
  41363. for (charCode = 0; charCode < 256; charCode++) {
  41364. var glyphName, standardGlyphName;
  41365. if (this.differences && charCode in this.differences) {
  41366. glyphName = this.differences[charCode];
  41367. } else if (charCode in baseEncoding && baseEncoding[charCode] !== '') {
  41368. glyphName = baseEncoding[charCode];
  41369. } else {
  41370. glyphName = StandardEncoding[charCode];
  41371. }
  41372. if (!glyphName) {
  41373. continue;
  41374. }
  41375. standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  41376. var unicodeOrCharCode, isUnicode = false;
  41377. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  41378. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  41379. isUnicode = true;
  41380. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  41381. unicodeOrCharCode = MacRomanEncoding.indexOf(standardGlyphName);
  41382. }
  41383. var found = false;
  41384. for (i = 0; i < cmapMappingsLength; ++i) {
  41385. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  41386. continue;
  41387. }
  41388. var code = isUnicode ? charCode : unicodeOrCharCode;
  41389. if (hasGlyph(cmapMappings[i].glyphId, code, -1)) {
  41390. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  41391. found = true;
  41392. break;
  41393. }
  41394. }
  41395. if (!found && properties.glyphNames) {
  41396. var glyphId = properties.glyphNames.indexOf(glyphName);
  41397. if (glyphId === -1 && standardGlyphName !== glyphName) {
  41398. glyphId = properties.glyphNames.indexOf(standardGlyphName);
  41399. }
  41400. if (glyphId > 0 && hasGlyph(glyphId, -1, -1)) {
  41401. charCodeToGlyphId[charCode] = glyphId;
  41402. found = true;
  41403. }
  41404. }
  41405. if (!found) {
  41406. charCodeToGlyphId[charCode] = 0;
  41407. }
  41408. }
  41409. } else if (cmapPlatformId === 0 && cmapEncodingId === 0) {
  41410. for (i = 0; i < cmapMappingsLength; ++i) {
  41411. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  41412. }
  41413. } else {
  41414. for (i = 0; i < cmapMappingsLength; ++i) {
  41415. charCode = cmapMappings[i].charCode & 0xFF;
  41416. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  41417. }
  41418. }
  41419. }
  41420. if (charCodeToGlyphId.length === 0) {
  41421. charCodeToGlyphId[0] = 0;
  41422. }
  41423. var newMapping = adjustMapping(charCodeToGlyphId, properties);
  41424. this.toFontChar = newMapping.toFontChar;
  41425. tables['cmap'] = {
  41426. tag: 'cmap',
  41427. data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphs)
  41428. };
  41429. if (!tables['OS/2'] || !validateOS2Table(tables['OS/2'])) {
  41430. tables['OS/2'] = {
  41431. tag: 'OS/2',
  41432. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  41433. };
  41434. }
  41435. if (!tables['post']) {
  41436. tables['post'] = {
  41437. tag: 'post',
  41438. data: createPostTable(properties)
  41439. };
  41440. }
  41441. if (!isTrueType) {
  41442. try {
  41443. cffFile = new Stream(tables['CFF '].data);
  41444. var parser = new CFFParser(cffFile, properties, SEAC_ANALYSIS_ENABLED);
  41445. cff = parser.parse();
  41446. var compiler = new CFFCompiler(cff);
  41447. tables['CFF '].data = compiler.compile();
  41448. } catch (e) {
  41449. warn('Failed to compile font ' + properties.loadedName);
  41450. }
  41451. }
  41452. if (!tables['name']) {
  41453. tables['name'] = {
  41454. tag: 'name',
  41455. data: createNameTable(this.name)
  41456. };
  41457. } else {
  41458. var namePrototype = readNameTable(tables['name']);
  41459. tables['name'].data = createNameTable(name, namePrototype);
  41460. }
  41461. var builder = new OpenTypeFileBuilder(header.version);
  41462. for (var tableTag in tables) {
  41463. builder.addTable(tableTag, tables[tableTag].data);
  41464. }
  41465. return builder.toArray();
  41466. },
  41467. convert: function Font_convert(fontName, font, properties) {
  41468. properties.fixedPitch = false;
  41469. if (properties.builtInEncoding) {
  41470. adjustToUnicode(properties, properties.builtInEncoding);
  41471. }
  41472. var mapping = font.getGlyphMapping(properties);
  41473. var newMapping = adjustMapping(mapping, properties);
  41474. this.toFontChar = newMapping.toFontChar;
  41475. var numGlyphs = font.numGlyphs;
  41476. function getCharCodes(charCodeToGlyphId, glyphId) {
  41477. var charCodes = null;
  41478. for (var charCode in charCodeToGlyphId) {
  41479. if (glyphId === charCodeToGlyphId[charCode]) {
  41480. if (!charCodes) {
  41481. charCodes = [];
  41482. }
  41483. charCodes.push(charCode | 0);
  41484. }
  41485. }
  41486. return charCodes;
  41487. }
  41488. function createCharCode(charCodeToGlyphId, glyphId) {
  41489. for (var charCode in charCodeToGlyphId) {
  41490. if (glyphId === charCodeToGlyphId[charCode]) {
  41491. return charCode | 0;
  41492. }
  41493. }
  41494. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  41495. return newMapping.nextAvailableFontCharCode++;
  41496. }
  41497. var seacs = font.seacs;
  41498. if (SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  41499. var matrix = properties.fontMatrix || FONT_IDENTITY_MATRIX;
  41500. var charset = font.getCharset();
  41501. var seacMap = Object.create(null);
  41502. for (var glyphId in seacs) {
  41503. glyphId |= 0;
  41504. var seac = seacs[glyphId];
  41505. var baseGlyphName = StandardEncoding[seac[2]];
  41506. var accentGlyphName = StandardEncoding[seac[3]];
  41507. var baseGlyphId = charset.indexOf(baseGlyphName);
  41508. var accentGlyphId = charset.indexOf(accentGlyphName);
  41509. if (baseGlyphId < 0 || accentGlyphId < 0) {
  41510. continue;
  41511. }
  41512. var accentOffset = {
  41513. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  41514. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  41515. };
  41516. var charCodes = getCharCodes(mapping, glyphId);
  41517. if (!charCodes) {
  41518. continue;
  41519. }
  41520. for (var i = 0, ii = charCodes.length; i < ii; i++) {
  41521. var charCode = charCodes[i];
  41522. var charCodeToGlyphId = newMapping.charCodeToGlyphId;
  41523. var baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  41524. var accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  41525. seacMap[charCode] = {
  41526. baseFontCharCode: baseFontCharCode,
  41527. accentFontCharCode: accentFontCharCode,
  41528. accentOffset: accentOffset
  41529. };
  41530. }
  41531. }
  41532. properties.seacMap = seacMap;
  41533. }
  41534. var unitsPerEm = 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0];
  41535. var builder = new OpenTypeFileBuilder('\x4F\x54\x54\x4F');
  41536. builder.addTable('CFF ', font.data);
  41537. builder.addTable('OS/2', createOS2Table(properties, newMapping.charCodeToGlyphId));
  41538. builder.addTable('cmap', createCmapTable(newMapping.charCodeToGlyphId, numGlyphs));
  41539. 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');
  41540. 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));
  41541. builder.addTable('hmtx', function fontFieldsHmtx() {
  41542. var charstrings = font.charstrings;
  41543. var cffWidths = font.cff ? font.cff.widths : null;
  41544. var hmtx = '\x00\x00\x00\x00';
  41545. for (var i = 1, ii = numGlyphs; i < ii; i++) {
  41546. var width = 0;
  41547. if (charstrings) {
  41548. var charstring = charstrings[i - 1];
  41549. width = 'width' in charstring ? charstring.width : 0;
  41550. } else if (cffWidths) {
  41551. width = Math.ceil(cffWidths[i] || 0);
  41552. }
  41553. hmtx += string16(width) + string16(0);
  41554. }
  41555. return hmtx;
  41556. }());
  41557. builder.addTable('maxp', '\x00\x00\x50\x00' + string16(numGlyphs));
  41558. builder.addTable('name', createNameTable(fontName));
  41559. builder.addTable('post', createPostTable(properties));
  41560. return builder.toArray();
  41561. },
  41562. get spaceWidth() {
  41563. if ('_shadowWidth' in this) {
  41564. return this._shadowWidth;
  41565. }
  41566. var possibleSpaceReplacements = [
  41567. 'space',
  41568. 'minus',
  41569. 'one',
  41570. 'i',
  41571. 'I'
  41572. ];
  41573. var width;
  41574. for (var i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  41575. var glyphName = possibleSpaceReplacements[i];
  41576. if (glyphName in this.widths) {
  41577. width = this.widths[glyphName];
  41578. break;
  41579. }
  41580. var glyphsUnicodeMap = getGlyphsUnicode();
  41581. var glyphUnicode = glyphsUnicodeMap[glyphName];
  41582. var charcode = 0;
  41583. if (this.composite) {
  41584. if (this.cMap.contains(glyphUnicode)) {
  41585. charcode = this.cMap.lookup(glyphUnicode);
  41586. }
  41587. }
  41588. if (!charcode && this.toUnicode) {
  41589. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  41590. }
  41591. if (charcode <= 0) {
  41592. charcode = glyphUnicode;
  41593. }
  41594. width = this.widths[charcode];
  41595. if (width) {
  41596. break;
  41597. }
  41598. }
  41599. width = width || this.defaultWidth;
  41600. this._shadowWidth = width;
  41601. return width;
  41602. },
  41603. charToGlyph: function Font_charToGlyph(charcode, isSpace) {
  41604. var fontCharCode, width, operatorListId;
  41605. var widthCode = charcode;
  41606. if (this.cMap && this.cMap.contains(charcode)) {
  41607. widthCode = this.cMap.lookup(charcode);
  41608. }
  41609. width = this.widths[widthCode];
  41610. width = isNum(width) ? width : this.defaultWidth;
  41611. var vmetric = this.vmetrics && this.vmetrics[widthCode];
  41612. var unicode = this.toUnicode.get(charcode) || charcode;
  41613. if (typeof unicode === 'number') {
  41614. unicode = String.fromCharCode(unicode);
  41615. }
  41616. var isInFont = charcode in this.toFontChar;
  41617. fontCharCode = this.toFontChar[charcode] || charcode;
  41618. if (this.missingFile) {
  41619. fontCharCode = mapSpecialUnicodeValues(fontCharCode);
  41620. }
  41621. if (this.isType3Font) {
  41622. operatorListId = fontCharCode;
  41623. }
  41624. var accent = null;
  41625. if (this.seacMap && this.seacMap[charcode]) {
  41626. isInFont = true;
  41627. var seac = this.seacMap[charcode];
  41628. fontCharCode = seac.baseFontCharCode;
  41629. accent = {
  41630. fontChar: String.fromCharCode(seac.accentFontCharCode),
  41631. offset: seac.accentOffset
  41632. };
  41633. }
  41634. var fontChar = String.fromCharCode(fontCharCode);
  41635. var glyph = this.glyphCache[charcode];
  41636. if (!glyph || !glyph.matchesForCache(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  41637. glyph = new Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  41638. this.glyphCache[charcode] = glyph;
  41639. }
  41640. return glyph;
  41641. },
  41642. charsToGlyphs: function Font_charsToGlyphs(chars) {
  41643. var charsCache = this.charsCache;
  41644. var glyphs, glyph, charcode;
  41645. if (charsCache) {
  41646. glyphs = charsCache[chars];
  41647. if (glyphs) {
  41648. return glyphs;
  41649. }
  41650. }
  41651. if (!charsCache) {
  41652. charsCache = this.charsCache = Object.create(null);
  41653. }
  41654. glyphs = [];
  41655. var charsCacheKey = chars;
  41656. var i = 0, ii;
  41657. if (this.cMap) {
  41658. var c = Object.create(null);
  41659. while (i < chars.length) {
  41660. this.cMap.readCharCode(chars, i, c);
  41661. charcode = c.charcode;
  41662. var length = c.length;
  41663. i += length;
  41664. var isSpace = length === 1 && chars.charCodeAt(i - 1) === 0x20;
  41665. glyph = this.charToGlyph(charcode, isSpace);
  41666. glyphs.push(glyph);
  41667. }
  41668. } else {
  41669. for (i = 0, ii = chars.length; i < ii; ++i) {
  41670. charcode = chars.charCodeAt(i);
  41671. glyph = this.charToGlyph(charcode, charcode === 0x20);
  41672. glyphs.push(glyph);
  41673. }
  41674. }
  41675. return charsCache[charsCacheKey] = glyphs;
  41676. }
  41677. };
  41678. return Font;
  41679. }();
  41680. var ErrorFont = function ErrorFontClosure() {
  41681. function ErrorFont(error) {
  41682. this.error = error;
  41683. this.loadedName = 'g_font_error';
  41684. this.loading = false;
  41685. }
  41686. ErrorFont.prototype = {
  41687. charsToGlyphs: function ErrorFont_charsToGlyphs() {
  41688. return [];
  41689. },
  41690. exportData: function ErrorFont_exportData() {
  41691. return { error: this.error };
  41692. }
  41693. };
  41694. return ErrorFont;
  41695. }();
  41696. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  41697. var charCodeToGlyphId = Object.create(null);
  41698. var glyphId, charCode, baseEncoding;
  41699. var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  41700. if (properties.baseEncodingName) {
  41701. baseEncoding = getEncoding(properties.baseEncodingName);
  41702. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  41703. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  41704. if (glyphId >= 0) {
  41705. charCodeToGlyphId[charCode] = glyphId;
  41706. } else {
  41707. charCodeToGlyphId[charCode] = 0;
  41708. }
  41709. }
  41710. } else if (isSymbolicFont) {
  41711. for (charCode in builtInEncoding) {
  41712. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  41713. }
  41714. } else {
  41715. baseEncoding = StandardEncoding;
  41716. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  41717. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  41718. if (glyphId >= 0) {
  41719. charCodeToGlyphId[charCode] = glyphId;
  41720. } else {
  41721. charCodeToGlyphId[charCode] = 0;
  41722. }
  41723. }
  41724. }
  41725. var differences = properties.differences, glyphsUnicodeMap;
  41726. if (differences) {
  41727. for (charCode in differences) {
  41728. var glyphName = differences[charCode];
  41729. glyphId = glyphNames.indexOf(glyphName);
  41730. if (glyphId === -1) {
  41731. if (!glyphsUnicodeMap) {
  41732. glyphsUnicodeMap = getGlyphsUnicode();
  41733. }
  41734. var standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  41735. if (standardGlyphName !== glyphName) {
  41736. glyphId = glyphNames.indexOf(standardGlyphName);
  41737. }
  41738. }
  41739. if (glyphId >= 0) {
  41740. charCodeToGlyphId[charCode] = glyphId;
  41741. } else {
  41742. charCodeToGlyphId[charCode] = 0;
  41743. }
  41744. }
  41745. }
  41746. return charCodeToGlyphId;
  41747. }
  41748. var Type1Font = function Type1FontClosure() {
  41749. function findBlock(streamBytes, signature, startIndex) {
  41750. var streamBytesLength = streamBytes.length;
  41751. var signatureLength = signature.length;
  41752. var scanLength = streamBytesLength - signatureLength;
  41753. var i = startIndex, j, found = false;
  41754. while (i < scanLength) {
  41755. j = 0;
  41756. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  41757. j++;
  41758. }
  41759. if (j >= signatureLength) {
  41760. i += j;
  41761. while (i < streamBytesLength && isSpace(streamBytes[i])) {
  41762. i++;
  41763. }
  41764. found = true;
  41765. break;
  41766. }
  41767. i++;
  41768. }
  41769. return {
  41770. found: found,
  41771. length: i
  41772. };
  41773. }
  41774. function getHeaderBlock(stream, suggestedLength) {
  41775. var EEXEC_SIGNATURE = [
  41776. 0x65,
  41777. 0x65,
  41778. 0x78,
  41779. 0x65,
  41780. 0x63
  41781. ];
  41782. var streamStartPos = stream.pos;
  41783. var headerBytes, headerBytesLength, block;
  41784. try {
  41785. headerBytes = stream.getBytes(suggestedLength);
  41786. headerBytesLength = headerBytes.length;
  41787. } catch (ex) {
  41788. if (ex instanceof MissingDataException) {
  41789. throw ex;
  41790. }
  41791. }
  41792. if (headerBytesLength === suggestedLength) {
  41793. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  41794. if (block.found && block.length === suggestedLength) {
  41795. return {
  41796. stream: new Stream(headerBytes),
  41797. length: suggestedLength
  41798. };
  41799. }
  41800. }
  41801. warn('Invalid "Length1" property in Type1 font -- trying to recover.');
  41802. stream.pos = streamStartPos;
  41803. var SCAN_BLOCK_LENGTH = 2048;
  41804. var actualLength;
  41805. while (true) {
  41806. var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  41807. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  41808. if (block.length === 0) {
  41809. break;
  41810. }
  41811. stream.pos += block.length;
  41812. if (block.found) {
  41813. actualLength = stream.pos - streamStartPos;
  41814. break;
  41815. }
  41816. }
  41817. stream.pos = streamStartPos;
  41818. if (actualLength) {
  41819. return {
  41820. stream: new Stream(stream.getBytes(actualLength)),
  41821. length: actualLength
  41822. };
  41823. }
  41824. warn('Unable to recover "Length1" property in Type1 font -- using as is.');
  41825. return {
  41826. stream: new Stream(stream.getBytes(suggestedLength)),
  41827. length: suggestedLength
  41828. };
  41829. }
  41830. function getEexecBlock(stream, suggestedLength) {
  41831. var eexecBytes = stream.getBytes();
  41832. return {
  41833. stream: new Stream(eexecBytes),
  41834. length: eexecBytes.length
  41835. };
  41836. }
  41837. function Type1Font(name, file, properties) {
  41838. var PFB_HEADER_SIZE = 6;
  41839. var headerBlockLength = properties.length1;
  41840. var eexecBlockLength = properties.length2;
  41841. var pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  41842. var pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  41843. if (pfbHeaderPresent) {
  41844. file.skip(PFB_HEADER_SIZE);
  41845. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  41846. }
  41847. var headerBlock = getHeaderBlock(file, headerBlockLength);
  41848. headerBlockLength = headerBlock.length;
  41849. var headerBlockParser = new Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED);
  41850. headerBlockParser.extractFontHeader(properties);
  41851. if (pfbHeaderPresent) {
  41852. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  41853. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  41854. }
  41855. var eexecBlock = getEexecBlock(file, eexecBlockLength);
  41856. eexecBlockLength = eexecBlock.length;
  41857. var eexecBlockParser = new Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED);
  41858. var data = eexecBlockParser.extractFontProgram();
  41859. for (var info in data.properties) {
  41860. properties[info] = data.properties[info];
  41861. }
  41862. var charstrings = data.charstrings;
  41863. var type2Charstrings = this.getType2Charstrings(charstrings);
  41864. var subrs = this.getType2Subrs(data.subrs);
  41865. this.charstrings = charstrings;
  41866. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  41867. this.seacs = this.getSeacs(data.charstrings);
  41868. }
  41869. Type1Font.prototype = {
  41870. get numGlyphs() {
  41871. return this.charstrings.length + 1;
  41872. },
  41873. getCharset: function Type1Font_getCharset() {
  41874. var charset = ['.notdef'];
  41875. var charstrings = this.charstrings;
  41876. for (var glyphId = 0; glyphId < charstrings.length; glyphId++) {
  41877. charset.push(charstrings[glyphId].glyphName);
  41878. }
  41879. return charset;
  41880. },
  41881. getGlyphMapping: function Type1Font_getGlyphMapping(properties) {
  41882. var charstrings = this.charstrings;
  41883. var glyphNames = ['.notdef'], glyphId;
  41884. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  41885. glyphNames.push(charstrings[glyphId].glyphName);
  41886. }
  41887. var encoding = properties.builtInEncoding;
  41888. if (encoding) {
  41889. var builtInEncoding = Object.create(null);
  41890. for (var charCode in encoding) {
  41891. glyphId = glyphNames.indexOf(encoding[charCode]);
  41892. if (glyphId >= 0) {
  41893. builtInEncoding[charCode] = glyphId;
  41894. }
  41895. }
  41896. }
  41897. return type1FontGlyphMapping(properties, builtInEncoding, glyphNames);
  41898. },
  41899. getSeacs: function Type1Font_getSeacs(charstrings) {
  41900. var i, ii;
  41901. var seacMap = [];
  41902. for (i = 0, ii = charstrings.length; i < ii; i++) {
  41903. var charstring = charstrings[i];
  41904. if (charstring.seac) {
  41905. seacMap[i + 1] = charstring.seac;
  41906. }
  41907. }
  41908. return seacMap;
  41909. },
  41910. getType2Charstrings: function Type1Font_getType2Charstrings(type1Charstrings) {
  41911. var type2Charstrings = [];
  41912. for (var i = 0, ii = type1Charstrings.length; i < ii; i++) {
  41913. type2Charstrings.push(type1Charstrings[i].charstring);
  41914. }
  41915. return type2Charstrings;
  41916. },
  41917. getType2Subrs: function Type1Font_getType2Subrs(type1Subrs) {
  41918. var bias = 0;
  41919. var count = type1Subrs.length;
  41920. if (count < 1133) {
  41921. bias = 107;
  41922. } else if (count < 33769) {
  41923. bias = 1131;
  41924. } else {
  41925. bias = 32768;
  41926. }
  41927. var type2Subrs = [];
  41928. var i;
  41929. for (i = 0; i < bias; i++) {
  41930. type2Subrs.push([0x0B]);
  41931. }
  41932. for (i = 0; i < count; i++) {
  41933. type2Subrs.push(type1Subrs[i]);
  41934. }
  41935. return type2Subrs;
  41936. },
  41937. wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) {
  41938. var cff = new CFF();
  41939. cff.header = new CFFHeader(1, 0, 4, 4);
  41940. cff.names = [name];
  41941. var topDict = new CFFTopDict();
  41942. topDict.setByName('version', 391);
  41943. topDict.setByName('Notice', 392);
  41944. topDict.setByName('FullName', 393);
  41945. topDict.setByName('FamilyName', 394);
  41946. topDict.setByName('Weight', 395);
  41947. topDict.setByName('Encoding', null);
  41948. topDict.setByName('FontMatrix', properties.fontMatrix);
  41949. topDict.setByName('FontBBox', properties.bbox);
  41950. topDict.setByName('charset', null);
  41951. topDict.setByName('CharStrings', null);
  41952. topDict.setByName('Private', null);
  41953. cff.topDict = topDict;
  41954. var strings = new CFFStrings();
  41955. strings.add('Version 0.11');
  41956. strings.add('See original notice');
  41957. strings.add(name);
  41958. strings.add(name);
  41959. strings.add('Medium');
  41960. cff.strings = strings;
  41961. cff.globalSubrIndex = new CFFIndex();
  41962. var count = glyphs.length;
  41963. var charsetArray = [0];
  41964. var i, ii;
  41965. for (i = 0; i < count; i++) {
  41966. var index = CFFStandardStrings.indexOf(charstrings[i].glyphName);
  41967. if (index === -1) {
  41968. index = 0;
  41969. }
  41970. charsetArray.push(index >> 8 & 0xff, index & 0xff);
  41971. }
  41972. cff.charset = new CFFCharset(false, 0, [], charsetArray);
  41973. var charStringsIndex = new CFFIndex();
  41974. charStringsIndex.add([
  41975. 0x8B,
  41976. 0x0E
  41977. ]);
  41978. for (i = 0; i < count; i++) {
  41979. var glyph = glyphs[i];
  41980. if (glyph.length === 0) {
  41981. charStringsIndex.add([
  41982. 0x8B,
  41983. 0x0E
  41984. ]);
  41985. continue;
  41986. }
  41987. charStringsIndex.add(glyph);
  41988. }
  41989. cff.charStrings = charStringsIndex;
  41990. var privateDict = new CFFPrivateDict();
  41991. privateDict.setByName('Subrs', null);
  41992. var fields = [
  41993. 'BlueValues',
  41994. 'OtherBlues',
  41995. 'FamilyBlues',
  41996. 'FamilyOtherBlues',
  41997. 'StemSnapH',
  41998. 'StemSnapV',
  41999. 'BlueShift',
  42000. 'BlueFuzz',
  42001. 'BlueScale',
  42002. 'LanguageGroup',
  42003. 'ExpansionFactor',
  42004. 'ForceBold',
  42005. 'StdHW',
  42006. 'StdVW'
  42007. ];
  42008. for (i = 0, ii = fields.length; i < ii; i++) {
  42009. var field = fields[i];
  42010. if (!(field in properties.privateData)) {
  42011. continue;
  42012. }
  42013. var value = properties.privateData[field];
  42014. if (isArray(value)) {
  42015. for (var j = value.length - 1; j > 0; j--) {
  42016. value[j] -= value[j - 1];
  42017. }
  42018. }
  42019. privateDict.setByName(field, value);
  42020. }
  42021. cff.topDict.privateDict = privateDict;
  42022. var subrIndex = new CFFIndex();
  42023. for (i = 0, ii = subrs.length; i < ii; i++) {
  42024. subrIndex.add(subrs[i]);
  42025. }
  42026. privateDict.subrsIndex = subrIndex;
  42027. var compiler = new CFFCompiler(cff);
  42028. return compiler.compile();
  42029. }
  42030. };
  42031. return Type1Font;
  42032. }();
  42033. var CFFFont = function CFFFontClosure() {
  42034. function CFFFont(file, properties) {
  42035. this.properties = properties;
  42036. var parser = new CFFParser(file, properties, SEAC_ANALYSIS_ENABLED);
  42037. this.cff = parser.parse();
  42038. var compiler = new CFFCompiler(this.cff);
  42039. this.seacs = this.cff.seacs;
  42040. try {
  42041. this.data = compiler.compile();
  42042. } catch (e) {
  42043. warn('Failed to compile font ' + properties.loadedName);
  42044. this.data = file;
  42045. }
  42046. }
  42047. CFFFont.prototype = {
  42048. get numGlyphs() {
  42049. return this.cff.charStrings.count;
  42050. },
  42051. getCharset: function CFFFont_getCharset() {
  42052. return this.cff.charset.charset;
  42053. },
  42054. getGlyphMapping: function CFFFont_getGlyphMapping() {
  42055. var cff = this.cff;
  42056. var properties = this.properties;
  42057. var charsets = cff.charset.charset;
  42058. var charCodeToGlyphId;
  42059. var glyphId;
  42060. if (properties.composite) {
  42061. charCodeToGlyphId = Object.create(null);
  42062. if (cff.isCIDFont) {
  42063. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  42064. var cid = charsets[glyphId];
  42065. var charCode = properties.cMap.charCodeOf(cid);
  42066. charCodeToGlyphId[charCode] = glyphId;
  42067. }
  42068. } else {
  42069. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  42070. charCodeToGlyphId[glyphId] = glyphId;
  42071. }
  42072. }
  42073. return charCodeToGlyphId;
  42074. }
  42075. var encoding = cff.encoding ? cff.encoding.encoding : null;
  42076. charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets);
  42077. return charCodeToGlyphId;
  42078. }
  42079. };
  42080. return CFFFont;
  42081. }();
  42082. (function checkSeacSupport() {
  42083. if (typeof navigator !== 'undefined' && /Windows/.test(navigator.userAgent)) {
  42084. SEAC_ANALYSIS_ENABLED = true;
  42085. }
  42086. }());
  42087. (function checkChromeWindows() {
  42088. if (typeof navigator !== 'undefined' && /Windows.*Chrome/.test(navigator.userAgent)) {
  42089. SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = true;
  42090. }
  42091. }());
  42092. exports.ErrorFont = ErrorFont;
  42093. exports.Font = Font;
  42094. exports.FontFlags = FontFlags;
  42095. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  42096. exports.ToUnicodeMap = ToUnicodeMap;
  42097. exports.getFontType = getFontType;
  42098. /***/ }),
  42099. /* 27 */
  42100. /***/ (function(module, exports, __w_pdfjs_require__) {
  42101. "use strict";
  42102. var sharedUtil = __w_pdfjs_require__(0);
  42103. var corePrimitives = __w_pdfjs_require__(1);
  42104. var coreColorSpace = __w_pdfjs_require__(3);
  42105. var coreStream = __w_pdfjs_require__(2);
  42106. var coreJpx = __w_pdfjs_require__(15);
  42107. var ImageKind = sharedUtil.ImageKind;
  42108. var assert = sharedUtil.assert;
  42109. var error = sharedUtil.error;
  42110. var info = sharedUtil.info;
  42111. var isArray = sharedUtil.isArray;
  42112. var warn = sharedUtil.warn;
  42113. var Name = corePrimitives.Name;
  42114. var isStream = corePrimitives.isStream;
  42115. var ColorSpace = coreColorSpace.ColorSpace;
  42116. var DecodeStream = coreStream.DecodeStream;
  42117. var JpegStream = coreStream.JpegStream;
  42118. var JpxImage = coreJpx.JpxImage;
  42119. var PDFImage = function PDFImageClosure() {
  42120. function handleImageData(image, nativeDecoder) {
  42121. if (nativeDecoder && nativeDecoder.canDecode(image)) {
  42122. return nativeDecoder.decode(image);
  42123. }
  42124. return Promise.resolve(image);
  42125. }
  42126. function decodeAndClamp(value, addend, coefficient, max) {
  42127. value = addend + value * coefficient;
  42128. return value < 0 ? 0 : value > max ? max : value;
  42129. }
  42130. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  42131. var length = w2 * h2;
  42132. var dest = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
  42133. var xRatio = w1 / w2;
  42134. var yRatio = h1 / h2;
  42135. var i, j, py, newIndex = 0, oldIndex;
  42136. var xScaled = new Uint16Array(w2);
  42137. var w1Scanline = w1;
  42138. for (i = 0; i < w2; i++) {
  42139. xScaled[i] = Math.floor(i * xRatio);
  42140. }
  42141. for (i = 0; i < h2; i++) {
  42142. py = Math.floor(i * yRatio) * w1Scanline;
  42143. for (j = 0; j < w2; j++) {
  42144. oldIndex = py + xScaled[j];
  42145. dest[newIndex++] = src[oldIndex];
  42146. }
  42147. }
  42148. return dest;
  42149. }
  42150. function PDFImage(xref, res, image, inline, smask, mask, isMask) {
  42151. this.image = image;
  42152. var dict = image.dict;
  42153. if (dict.has('Filter')) {
  42154. var filter = dict.get('Filter').name;
  42155. if (filter === 'JPXDecode') {
  42156. var jpxImage = new JpxImage();
  42157. jpxImage.parseImageProperties(image.stream);
  42158. image.stream.reset();
  42159. image.bitsPerComponent = jpxImage.bitsPerComponent;
  42160. image.numComps = jpxImage.componentsCount;
  42161. } else if (filter === 'JBIG2Decode') {
  42162. image.bitsPerComponent = 1;
  42163. image.numComps = 1;
  42164. }
  42165. }
  42166. this.width = dict.get('Width', 'W');
  42167. this.height = dict.get('Height', 'H');
  42168. if (this.width < 1 || this.height < 1) {
  42169. error('Invalid image width: ' + this.width + ' or height: ' + this.height);
  42170. }
  42171. this.interpolate = dict.get('Interpolate', 'I') || false;
  42172. this.imageMask = dict.get('ImageMask', 'IM') || false;
  42173. this.matte = dict.get('Matte') || false;
  42174. var bitsPerComponent = image.bitsPerComponent;
  42175. if (!bitsPerComponent) {
  42176. bitsPerComponent = dict.get('BitsPerComponent', 'BPC');
  42177. if (!bitsPerComponent) {
  42178. if (this.imageMask) {
  42179. bitsPerComponent = 1;
  42180. } else {
  42181. error('Bits per component missing in image: ' + this.imageMask);
  42182. }
  42183. }
  42184. }
  42185. this.bpc = bitsPerComponent;
  42186. if (!this.imageMask) {
  42187. var colorSpace = dict.get('ColorSpace', 'CS');
  42188. if (!colorSpace) {
  42189. info('JPX images (which do not require color spaces)');
  42190. switch (image.numComps) {
  42191. case 1:
  42192. colorSpace = Name.get('DeviceGray');
  42193. break;
  42194. case 3:
  42195. colorSpace = Name.get('DeviceRGB');
  42196. break;
  42197. case 4:
  42198. colorSpace = Name.get('DeviceCMYK');
  42199. break;
  42200. default:
  42201. error('JPX images with ' + this.numComps + ' color components not supported.');
  42202. }
  42203. }
  42204. this.colorSpace = ColorSpace.parse(colorSpace, xref, res);
  42205. this.numComps = this.colorSpace.numComps;
  42206. }
  42207. this.decode = dict.getArray('Decode', 'D');
  42208. this.needsDecode = false;
  42209. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode) || isMask && !ColorSpace.isDefaultDecode(this.decode, 1))) {
  42210. this.needsDecode = true;
  42211. var max = (1 << bitsPerComponent) - 1;
  42212. this.decodeCoefficients = [];
  42213. this.decodeAddends = [];
  42214. for (var i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  42215. var dmin = this.decode[i];
  42216. var dmax = this.decode[i + 1];
  42217. this.decodeCoefficients[j] = dmax - dmin;
  42218. this.decodeAddends[j] = max * dmin;
  42219. }
  42220. }
  42221. if (smask) {
  42222. this.smask = new PDFImage(xref, res, smask, false);
  42223. } else if (mask) {
  42224. if (isStream(mask)) {
  42225. var maskDict = mask.dict, imageMask = maskDict.get('ImageMask', 'IM');
  42226. if (!imageMask) {
  42227. warn('Ignoring /Mask in image without /ImageMask.');
  42228. } else {
  42229. this.mask = new PDFImage(xref, res, mask, false, null, null, true);
  42230. }
  42231. } else {
  42232. this.mask = mask;
  42233. }
  42234. }
  42235. }
  42236. PDFImage.buildImage = function PDFImage_buildImage(handler, xref, res, image, inline, nativeDecoder) {
  42237. var imagePromise = handleImageData(image, nativeDecoder);
  42238. var smaskPromise;
  42239. var maskPromise;
  42240. var smask = image.dict.get('SMask');
  42241. var mask = image.dict.get('Mask');
  42242. if (smask) {
  42243. smaskPromise = handleImageData(smask, nativeDecoder);
  42244. maskPromise = Promise.resolve(null);
  42245. } else {
  42246. smaskPromise = Promise.resolve(null);
  42247. if (mask) {
  42248. if (isStream(mask)) {
  42249. maskPromise = handleImageData(mask, nativeDecoder);
  42250. } else if (isArray(mask)) {
  42251. maskPromise = Promise.resolve(mask);
  42252. } else {
  42253. warn('Unsupported mask format.');
  42254. maskPromise = Promise.resolve(null);
  42255. }
  42256. } else {
  42257. maskPromise = Promise.resolve(null);
  42258. }
  42259. }
  42260. return Promise.all([
  42261. imagePromise,
  42262. smaskPromise,
  42263. maskPromise
  42264. ]).then(function (results) {
  42265. var imageData = results[0];
  42266. var smaskData = results[1];
  42267. var maskData = results[2];
  42268. return new PDFImage(xref, res, imageData, inline, smaskData, maskData);
  42269. });
  42270. };
  42271. PDFImage.createMask = function PDFImage_createMask(imgArray, width, height, imageIsFromDecodeStream, inverseDecode) {
  42272. var computedLength = (width + 7 >> 3) * height;
  42273. var actualLength = imgArray.byteLength;
  42274. var haveFullData = computedLength === actualLength;
  42275. var data, i;
  42276. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  42277. data = imgArray;
  42278. } else if (!inverseDecode) {
  42279. data = new Uint8Array(actualLength);
  42280. data.set(imgArray);
  42281. } else {
  42282. data = new Uint8Array(computedLength);
  42283. data.set(imgArray);
  42284. for (i = actualLength; i < computedLength; i++) {
  42285. data[i] = 0xff;
  42286. }
  42287. }
  42288. if (inverseDecode) {
  42289. for (i = 0; i < actualLength; i++) {
  42290. data[i] = ~data[i];
  42291. }
  42292. }
  42293. return {
  42294. data: data,
  42295. width: width,
  42296. height: height
  42297. };
  42298. };
  42299. PDFImage.prototype = {
  42300. get drawWidth() {
  42301. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  42302. },
  42303. get drawHeight() {
  42304. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  42305. },
  42306. decodeBuffer: function PDFImage_decodeBuffer(buffer) {
  42307. var bpc = this.bpc;
  42308. var numComps = this.numComps;
  42309. var decodeAddends = this.decodeAddends;
  42310. var decodeCoefficients = this.decodeCoefficients;
  42311. var max = (1 << bpc) - 1;
  42312. var i, ii;
  42313. if (bpc === 1) {
  42314. for (i = 0, ii = buffer.length; i < ii; i++) {
  42315. buffer[i] = +!buffer[i];
  42316. }
  42317. return;
  42318. }
  42319. var index = 0;
  42320. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  42321. for (var j = 0; j < numComps; j++) {
  42322. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  42323. index++;
  42324. }
  42325. }
  42326. },
  42327. getComponents: function PDFImage_getComponents(buffer) {
  42328. var bpc = this.bpc;
  42329. if (bpc === 8) {
  42330. return buffer;
  42331. }
  42332. var width = this.width;
  42333. var height = this.height;
  42334. var numComps = this.numComps;
  42335. var length = width * height * numComps;
  42336. var bufferPos = 0;
  42337. var output = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
  42338. var rowComps = width * numComps;
  42339. var max = (1 << bpc) - 1;
  42340. var i = 0, ii, buf;
  42341. if (bpc === 1) {
  42342. var mask, loop1End, loop2End;
  42343. for (var j = 0; j < height; j++) {
  42344. loop1End = i + (rowComps & ~7);
  42345. loop2End = i + rowComps;
  42346. while (i < loop1End) {
  42347. buf = buffer[bufferPos++];
  42348. output[i] = buf >> 7 & 1;
  42349. output[i + 1] = buf >> 6 & 1;
  42350. output[i + 2] = buf >> 5 & 1;
  42351. output[i + 3] = buf >> 4 & 1;
  42352. output[i + 4] = buf >> 3 & 1;
  42353. output[i + 5] = buf >> 2 & 1;
  42354. output[i + 6] = buf >> 1 & 1;
  42355. output[i + 7] = buf & 1;
  42356. i += 8;
  42357. }
  42358. if (i < loop2End) {
  42359. buf = buffer[bufferPos++];
  42360. mask = 128;
  42361. while (i < loop2End) {
  42362. output[i++] = +!!(buf & mask);
  42363. mask >>= 1;
  42364. }
  42365. }
  42366. }
  42367. } else {
  42368. var bits = 0;
  42369. buf = 0;
  42370. for (i = 0, ii = length; i < ii; ++i) {
  42371. if (i % rowComps === 0) {
  42372. buf = 0;
  42373. bits = 0;
  42374. }
  42375. while (bits < bpc) {
  42376. buf = buf << 8 | buffer[bufferPos++];
  42377. bits += 8;
  42378. }
  42379. var remainingBits = bits - bpc;
  42380. var value = buf >> remainingBits;
  42381. output[i] = value < 0 ? 0 : value > max ? max : value;
  42382. buf = buf & (1 << remainingBits) - 1;
  42383. bits = remainingBits;
  42384. }
  42385. }
  42386. return output;
  42387. },
  42388. fillOpacity: function PDFImage_fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  42389. var smask = this.smask;
  42390. var mask = this.mask;
  42391. var alphaBuf, sw, sh, i, ii, j;
  42392. if (smask) {
  42393. sw = smask.width;
  42394. sh = smask.height;
  42395. alphaBuf = new Uint8Array(sw * sh);
  42396. smask.fillGrayBuffer(alphaBuf);
  42397. if (sw !== width || sh !== height) {
  42398. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  42399. }
  42400. } else if (mask) {
  42401. if (mask instanceof PDFImage) {
  42402. sw = mask.width;
  42403. sh = mask.height;
  42404. alphaBuf = new Uint8Array(sw * sh);
  42405. mask.numComps = 1;
  42406. mask.fillGrayBuffer(alphaBuf);
  42407. for (i = 0, ii = sw * sh; i < ii; ++i) {
  42408. alphaBuf[i] = 255 - alphaBuf[i];
  42409. }
  42410. if (sw !== width || sh !== height) {
  42411. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  42412. }
  42413. } else if (isArray(mask)) {
  42414. alphaBuf = new Uint8Array(width * height);
  42415. var numComps = this.numComps;
  42416. for (i = 0, ii = width * height; i < ii; ++i) {
  42417. var opacity = 0;
  42418. var imageOffset = i * numComps;
  42419. for (j = 0; j < numComps; ++j) {
  42420. var color = image[imageOffset + j];
  42421. var maskOffset = j * 2;
  42422. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  42423. opacity = 255;
  42424. break;
  42425. }
  42426. }
  42427. alphaBuf[i] = opacity;
  42428. }
  42429. } else {
  42430. error('Unknown mask format.');
  42431. }
  42432. }
  42433. if (alphaBuf) {
  42434. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  42435. rgbaBuf[j] = alphaBuf[i];
  42436. }
  42437. } else {
  42438. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  42439. rgbaBuf[j] = 255;
  42440. }
  42441. }
  42442. },
  42443. undoPreblend: function PDFImage_undoPreblend(buffer, width, height) {
  42444. var matte = this.smask && this.smask.matte;
  42445. if (!matte) {
  42446. return;
  42447. }
  42448. var matteRgb = this.colorSpace.getRgb(matte, 0);
  42449. var matteR = matteRgb[0];
  42450. var matteG = matteRgb[1];
  42451. var matteB = matteRgb[2];
  42452. var length = width * height * 4;
  42453. var r, g, b;
  42454. for (var i = 0; i < length; i += 4) {
  42455. var alpha = buffer[i + 3];
  42456. if (alpha === 0) {
  42457. buffer[i] = 255;
  42458. buffer[i + 1] = 255;
  42459. buffer[i + 2] = 255;
  42460. continue;
  42461. }
  42462. var k = 255 / alpha;
  42463. r = (buffer[i] - matteR) * k + matteR;
  42464. g = (buffer[i + 1] - matteG) * k + matteG;
  42465. b = (buffer[i + 2] - matteB) * k + matteB;
  42466. buffer[i] = r <= 0 ? 0 : r >= 255 ? 255 : r | 0;
  42467. buffer[i + 1] = g <= 0 ? 0 : g >= 255 ? 255 : g | 0;
  42468. buffer[i + 2] = b <= 0 ? 0 : b >= 255 ? 255 : b | 0;
  42469. }
  42470. },
  42471. createImageData: function PDFImage_createImageData(forceRGBA) {
  42472. var drawWidth = this.drawWidth;
  42473. var drawHeight = this.drawHeight;
  42474. var imgData = {
  42475. width: drawWidth,
  42476. height: drawHeight
  42477. };
  42478. var numComps = this.numComps;
  42479. var originalWidth = this.width;
  42480. var originalHeight = this.height;
  42481. var bpc = this.bpc;
  42482. var rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  42483. var imgArray;
  42484. if (!forceRGBA) {
  42485. var kind;
  42486. if (this.colorSpace.name === 'DeviceGray' && bpc === 1) {
  42487. kind = ImageKind.GRAYSCALE_1BPP;
  42488. } else if (this.colorSpace.name === 'DeviceRGB' && bpc === 8 && !this.needsDecode) {
  42489. kind = ImageKind.RGB_24BPP;
  42490. }
  42491. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  42492. imgData.kind = kind;
  42493. imgArray = this.getImageBytes(originalHeight * rowBytes);
  42494. if (this.image instanceof DecodeStream) {
  42495. imgData.data = imgArray;
  42496. } else {
  42497. var newArray = new Uint8Array(imgArray.length);
  42498. newArray.set(imgArray);
  42499. imgData.data = newArray;
  42500. }
  42501. if (this.needsDecode) {
  42502. assert(kind === ImageKind.GRAYSCALE_1BPP);
  42503. var buffer = imgData.data;
  42504. for (var i = 0, ii = buffer.length; i < ii; i++) {
  42505. buffer[i] ^= 0xff;
  42506. }
  42507. }
  42508. return imgData;
  42509. }
  42510. if (this.image instanceof JpegStream && !this.smask && !this.mask && (this.colorSpace.name === 'DeviceGray' || this.colorSpace.name === 'DeviceRGB' || this.colorSpace.name === 'DeviceCMYK')) {
  42511. imgData.kind = ImageKind.RGB_24BPP;
  42512. imgData.data = this.getImageBytes(originalHeight * rowBytes, drawWidth, drawHeight, true);
  42513. return imgData;
  42514. }
  42515. }
  42516. imgArray = this.getImageBytes(originalHeight * rowBytes);
  42517. var actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  42518. var comps = this.getComponents(imgArray);
  42519. var alpha01, maybeUndoPreblend;
  42520. if (!forceRGBA && !this.smask && !this.mask) {
  42521. imgData.kind = ImageKind.RGB_24BPP;
  42522. imgData.data = new Uint8Array(drawWidth * drawHeight * 3);
  42523. alpha01 = 0;
  42524. maybeUndoPreblend = false;
  42525. } else {
  42526. imgData.kind = ImageKind.RGBA_32BPP;
  42527. imgData.data = new Uint8Array(drawWidth * drawHeight * 4);
  42528. alpha01 = 1;
  42529. maybeUndoPreblend = true;
  42530. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  42531. }
  42532. if (this.needsDecode) {
  42533. this.decodeBuffer(comps);
  42534. }
  42535. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  42536. if (maybeUndoPreblend) {
  42537. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  42538. }
  42539. return imgData;
  42540. },
  42541. fillGrayBuffer: function PDFImage_fillGrayBuffer(buffer) {
  42542. var numComps = this.numComps;
  42543. if (numComps !== 1) {
  42544. error('Reading gray scale from a color image: ' + numComps);
  42545. }
  42546. var width = this.width;
  42547. var height = this.height;
  42548. var bpc = this.bpc;
  42549. var rowBytes = width * numComps * bpc + 7 >> 3;
  42550. var imgArray = this.getImageBytes(height * rowBytes);
  42551. var comps = this.getComponents(imgArray);
  42552. var i, length;
  42553. if (bpc === 1) {
  42554. length = width * height;
  42555. if (this.needsDecode) {
  42556. for (i = 0; i < length; ++i) {
  42557. buffer[i] = comps[i] - 1 & 255;
  42558. }
  42559. } else {
  42560. for (i = 0; i < length; ++i) {
  42561. buffer[i] = -comps[i] & 255;
  42562. }
  42563. }
  42564. return;
  42565. }
  42566. if (this.needsDecode) {
  42567. this.decodeBuffer(comps);
  42568. }
  42569. length = width * height;
  42570. var scale = 255 / ((1 << bpc) - 1);
  42571. for (i = 0; i < length; ++i) {
  42572. buffer[i] = scale * comps[i] | 0;
  42573. }
  42574. },
  42575. getImageBytes: function PDFImage_getImageBytes(length, drawWidth, drawHeight, forceRGB) {
  42576. this.image.reset();
  42577. this.image.drawWidth = drawWidth || this.width;
  42578. this.image.drawHeight = drawHeight || this.height;
  42579. this.image.forceRGB = !!forceRGB;
  42580. return this.image.getBytes(length);
  42581. }
  42582. };
  42583. return PDFImage;
  42584. }();
  42585. exports.PDFImage = PDFImage;
  42586. /***/ }),
  42587. /* 28 */
  42588. /***/ (function(module, exports, __w_pdfjs_require__) {
  42589. "use strict";
  42590. var sharedUtil = __w_pdfjs_require__(0);
  42591. var coreArithmeticDecoder = __w_pdfjs_require__(10);
  42592. var error = sharedUtil.error;
  42593. var log2 = sharedUtil.log2;
  42594. var readInt8 = sharedUtil.readInt8;
  42595. var readUint16 = sharedUtil.readUint16;
  42596. var readUint32 = sharedUtil.readUint32;
  42597. var shadow = sharedUtil.shadow;
  42598. var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder;
  42599. var Jbig2Image = function Jbig2ImageClosure() {
  42600. function ContextCache() {
  42601. }
  42602. ContextCache.prototype = {
  42603. getContexts: function (id) {
  42604. if (id in this) {
  42605. return this[id];
  42606. }
  42607. return this[id] = new Int8Array(1 << 16);
  42608. }
  42609. };
  42610. function DecodingContext(data, start, end) {
  42611. this.data = data;
  42612. this.start = start;
  42613. this.end = end;
  42614. }
  42615. DecodingContext.prototype = {
  42616. get decoder() {
  42617. var decoder = new ArithmeticDecoder(this.data, this.start, this.end);
  42618. return shadow(this, 'decoder', decoder);
  42619. },
  42620. get contextCache() {
  42621. var cache = new ContextCache();
  42622. return shadow(this, 'contextCache', cache);
  42623. }
  42624. };
  42625. function decodeInteger(contextCache, procedure, decoder) {
  42626. var contexts = contextCache.getContexts(procedure);
  42627. var prev = 1;
  42628. function readBits(length) {
  42629. var v = 0;
  42630. for (var i = 0; i < length; i++) {
  42631. var bit = decoder.readBit(contexts, prev);
  42632. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  42633. v = v << 1 | bit;
  42634. }
  42635. return v >>> 0;
  42636. }
  42637. var sign = readBits(1);
  42638. 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);
  42639. return sign === 0 ? value : value > 0 ? -value : null;
  42640. }
  42641. function decodeIAID(contextCache, decoder, codeLength) {
  42642. var contexts = contextCache.getContexts('IAID');
  42643. var prev = 1;
  42644. for (var i = 0; i < codeLength; i++) {
  42645. var bit = decoder.readBit(contexts, prev);
  42646. prev = prev << 1 | bit;
  42647. }
  42648. if (codeLength < 31) {
  42649. return prev & (1 << codeLength) - 1;
  42650. }
  42651. return prev & 0x7FFFFFFF;
  42652. }
  42653. var SegmentTypes = [
  42654. 'SymbolDictionary',
  42655. null,
  42656. null,
  42657. null,
  42658. 'IntermediateTextRegion',
  42659. null,
  42660. 'ImmediateTextRegion',
  42661. 'ImmediateLosslessTextRegion',
  42662. null,
  42663. null,
  42664. null,
  42665. null,
  42666. null,
  42667. null,
  42668. null,
  42669. null,
  42670. 'patternDictionary',
  42671. null,
  42672. null,
  42673. null,
  42674. 'IntermediateHalftoneRegion',
  42675. null,
  42676. 'ImmediateHalftoneRegion',
  42677. 'ImmediateLosslessHalftoneRegion',
  42678. null,
  42679. null,
  42680. null,
  42681. null,
  42682. null,
  42683. null,
  42684. null,
  42685. null,
  42686. null,
  42687. null,
  42688. null,
  42689. null,
  42690. 'IntermediateGenericRegion',
  42691. null,
  42692. 'ImmediateGenericRegion',
  42693. 'ImmediateLosslessGenericRegion',
  42694. 'IntermediateGenericRefinementRegion',
  42695. null,
  42696. 'ImmediateGenericRefinementRegion',
  42697. 'ImmediateLosslessGenericRefinementRegion',
  42698. null,
  42699. null,
  42700. null,
  42701. null,
  42702. 'PageInformation',
  42703. 'EndOfPage',
  42704. 'EndOfStripe',
  42705. 'EndOfFile',
  42706. 'Profiles',
  42707. 'Tables',
  42708. null,
  42709. null,
  42710. null,
  42711. null,
  42712. null,
  42713. null,
  42714. null,
  42715. null,
  42716. 'Extension'
  42717. ];
  42718. var CodingTemplates = [
  42719. [
  42720. {
  42721. x: -1,
  42722. y: -2
  42723. },
  42724. {
  42725. x: 0,
  42726. y: -2
  42727. },
  42728. {
  42729. x: 1,
  42730. y: -2
  42731. },
  42732. {
  42733. x: -2,
  42734. y: -1
  42735. },
  42736. {
  42737. x: -1,
  42738. y: -1
  42739. },
  42740. {
  42741. x: 0,
  42742. y: -1
  42743. },
  42744. {
  42745. x: 1,
  42746. y: -1
  42747. },
  42748. {
  42749. x: 2,
  42750. y: -1
  42751. },
  42752. {
  42753. x: -4,
  42754. y: 0
  42755. },
  42756. {
  42757. x: -3,
  42758. y: 0
  42759. },
  42760. {
  42761. x: -2,
  42762. y: 0
  42763. },
  42764. {
  42765. x: -1,
  42766. y: 0
  42767. }
  42768. ],
  42769. [
  42770. {
  42771. x: -1,
  42772. y: -2
  42773. },
  42774. {
  42775. x: 0,
  42776. y: -2
  42777. },
  42778. {
  42779. x: 1,
  42780. y: -2
  42781. },
  42782. {
  42783. x: 2,
  42784. y: -2
  42785. },
  42786. {
  42787. x: -2,
  42788. y: -1
  42789. },
  42790. {
  42791. x: -1,
  42792. y: -1
  42793. },
  42794. {
  42795. x: 0,
  42796. y: -1
  42797. },
  42798. {
  42799. x: 1,
  42800. y: -1
  42801. },
  42802. {
  42803. x: 2,
  42804. y: -1
  42805. },
  42806. {
  42807. x: -3,
  42808. y: 0
  42809. },
  42810. {
  42811. x: -2,
  42812. y: 0
  42813. },
  42814. {
  42815. x: -1,
  42816. y: 0
  42817. }
  42818. ],
  42819. [
  42820. {
  42821. x: -1,
  42822. y: -2
  42823. },
  42824. {
  42825. x: 0,
  42826. y: -2
  42827. },
  42828. {
  42829. x: 1,
  42830. y: -2
  42831. },
  42832. {
  42833. x: -2,
  42834. y: -1
  42835. },
  42836. {
  42837. x: -1,
  42838. y: -1
  42839. },
  42840. {
  42841. x: 0,
  42842. y: -1
  42843. },
  42844. {
  42845. x: 1,
  42846. y: -1
  42847. },
  42848. {
  42849. x: -2,
  42850. y: 0
  42851. },
  42852. {
  42853. x: -1,
  42854. y: 0
  42855. }
  42856. ],
  42857. [
  42858. {
  42859. x: -3,
  42860. y: -1
  42861. },
  42862. {
  42863. x: -2,
  42864. y: -1
  42865. },
  42866. {
  42867. x: -1,
  42868. y: -1
  42869. },
  42870. {
  42871. x: 0,
  42872. y: -1
  42873. },
  42874. {
  42875. x: 1,
  42876. y: -1
  42877. },
  42878. {
  42879. x: -4,
  42880. y: 0
  42881. },
  42882. {
  42883. x: -3,
  42884. y: 0
  42885. },
  42886. {
  42887. x: -2,
  42888. y: 0
  42889. },
  42890. {
  42891. x: -1,
  42892. y: 0
  42893. }
  42894. ]
  42895. ];
  42896. var RefinementTemplates = [
  42897. {
  42898. coding: [
  42899. {
  42900. x: 0,
  42901. y: -1
  42902. },
  42903. {
  42904. x: 1,
  42905. y: -1
  42906. },
  42907. {
  42908. x: -1,
  42909. y: 0
  42910. }
  42911. ],
  42912. reference: [
  42913. {
  42914. x: 0,
  42915. y: -1
  42916. },
  42917. {
  42918. x: 1,
  42919. y: -1
  42920. },
  42921. {
  42922. x: -1,
  42923. y: 0
  42924. },
  42925. {
  42926. x: 0,
  42927. y: 0
  42928. },
  42929. {
  42930. x: 1,
  42931. y: 0
  42932. },
  42933. {
  42934. x: -1,
  42935. y: 1
  42936. },
  42937. {
  42938. x: 0,
  42939. y: 1
  42940. },
  42941. {
  42942. x: 1,
  42943. y: 1
  42944. }
  42945. ]
  42946. },
  42947. {
  42948. coding: [
  42949. {
  42950. x: -1,
  42951. y: -1
  42952. },
  42953. {
  42954. x: 0,
  42955. y: -1
  42956. },
  42957. {
  42958. x: 1,
  42959. y: -1
  42960. },
  42961. {
  42962. x: -1,
  42963. y: 0
  42964. }
  42965. ],
  42966. reference: [
  42967. {
  42968. x: 0,
  42969. y: -1
  42970. },
  42971. {
  42972. x: -1,
  42973. y: 0
  42974. },
  42975. {
  42976. x: 0,
  42977. y: 0
  42978. },
  42979. {
  42980. x: 1,
  42981. y: 0
  42982. },
  42983. {
  42984. x: 0,
  42985. y: 1
  42986. },
  42987. {
  42988. x: 1,
  42989. y: 1
  42990. }
  42991. ]
  42992. }
  42993. ];
  42994. var ReusedContexts = [
  42995. 0x9B25,
  42996. 0x0795,
  42997. 0x00E5,
  42998. 0x0195
  42999. ];
  43000. var RefinementReusedContexts = [
  43001. 0x0020,
  43002. 0x0008
  43003. ];
  43004. function decodeBitmapTemplate0(width, height, decodingContext) {
  43005. var decoder = decodingContext.decoder;
  43006. var contexts = decodingContext.contextCache.getContexts('GB');
  43007. var contextLabel, i, j, pixel, row, row1, row2, bitmap = [];
  43008. var OLD_PIXEL_MASK = 0x7BF7;
  43009. for (i = 0; i < height; i++) {
  43010. row = bitmap[i] = new Uint8Array(width);
  43011. row1 = i < 1 ? row : bitmap[i - 1];
  43012. row2 = i < 2 ? row : bitmap[i - 2];
  43013. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  43014. for (j = 0; j < width; j++) {
  43015. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  43016. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  43017. }
  43018. }
  43019. return bitmap;
  43020. }
  43021. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  43022. if (mmr) {
  43023. error('JBIG2 error: MMR encoding is not supported');
  43024. }
  43025. 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) {
  43026. return decodeBitmapTemplate0(width, height, decodingContext);
  43027. }
  43028. var useskip = !!skip;
  43029. var template = CodingTemplates[templateIndex].concat(at);
  43030. template.sort(function (a, b) {
  43031. return a.y - b.y || a.x - b.x;
  43032. });
  43033. var templateLength = template.length;
  43034. var templateX = new Int8Array(templateLength);
  43035. var templateY = new Int8Array(templateLength);
  43036. var changingTemplateEntries = [];
  43037. var reuseMask = 0, minX = 0, maxX = 0, minY = 0;
  43038. var c, k;
  43039. for (k = 0; k < templateLength; k++) {
  43040. templateX[k] = template[k].x;
  43041. templateY[k] = template[k].y;
  43042. minX = Math.min(minX, template[k].x);
  43043. maxX = Math.max(maxX, template[k].x);
  43044. minY = Math.min(minY, template[k].y);
  43045. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  43046. reuseMask |= 1 << templateLength - 1 - k;
  43047. } else {
  43048. changingTemplateEntries.push(k);
  43049. }
  43050. }
  43051. var changingEntriesLength = changingTemplateEntries.length;
  43052. var changingTemplateX = new Int8Array(changingEntriesLength);
  43053. var changingTemplateY = new Int8Array(changingEntriesLength);
  43054. var changingTemplateBit = new Uint16Array(changingEntriesLength);
  43055. for (c = 0; c < changingEntriesLength; c++) {
  43056. k = changingTemplateEntries[c];
  43057. changingTemplateX[c] = template[k].x;
  43058. changingTemplateY[c] = template[k].y;
  43059. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  43060. }
  43061. var sbb_left = -minX;
  43062. var sbb_top = -minY;
  43063. var sbb_right = width - maxX;
  43064. var pseudoPixelContext = ReusedContexts[templateIndex];
  43065. var row = new Uint8Array(width);
  43066. var bitmap = [];
  43067. var decoder = decodingContext.decoder;
  43068. var contexts = decodingContext.contextCache.getContexts('GB');
  43069. var ltp = 0, j, i0, j0, contextLabel = 0, bit, shift;
  43070. for (var i = 0; i < height; i++) {
  43071. if (prediction) {
  43072. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  43073. ltp ^= sltp;
  43074. if (ltp) {
  43075. bitmap.push(row);
  43076. continue;
  43077. }
  43078. }
  43079. row = new Uint8Array(row);
  43080. bitmap.push(row);
  43081. for (j = 0; j < width; j++) {
  43082. if (useskip && skip[i][j]) {
  43083. row[j] = 0;
  43084. continue;
  43085. }
  43086. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  43087. contextLabel = contextLabel << 1 & reuseMask;
  43088. for (k = 0; k < changingEntriesLength; k++) {
  43089. i0 = i + changingTemplateY[k];
  43090. j0 = j + changingTemplateX[k];
  43091. bit = bitmap[i0][j0];
  43092. if (bit) {
  43093. bit = changingTemplateBit[k];
  43094. contextLabel |= bit;
  43095. }
  43096. }
  43097. } else {
  43098. contextLabel = 0;
  43099. shift = templateLength - 1;
  43100. for (k = 0; k < templateLength; k++, shift--) {
  43101. j0 = j + templateX[k];
  43102. if (j0 >= 0 && j0 < width) {
  43103. i0 = i + templateY[k];
  43104. if (i0 >= 0) {
  43105. bit = bitmap[i0][j0];
  43106. if (bit) {
  43107. contextLabel |= bit << shift;
  43108. }
  43109. }
  43110. }
  43111. }
  43112. }
  43113. var pixel = decoder.readBit(contexts, contextLabel);
  43114. row[j] = pixel;
  43115. }
  43116. }
  43117. return bitmap;
  43118. }
  43119. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  43120. var codingTemplate = RefinementTemplates[templateIndex].coding;
  43121. if (templateIndex === 0) {
  43122. codingTemplate = codingTemplate.concat([at[0]]);
  43123. }
  43124. var codingTemplateLength = codingTemplate.length;
  43125. var codingTemplateX = new Int32Array(codingTemplateLength);
  43126. var codingTemplateY = new Int32Array(codingTemplateLength);
  43127. var k;
  43128. for (k = 0; k < codingTemplateLength; k++) {
  43129. codingTemplateX[k] = codingTemplate[k].x;
  43130. codingTemplateY[k] = codingTemplate[k].y;
  43131. }
  43132. var referenceTemplate = RefinementTemplates[templateIndex].reference;
  43133. if (templateIndex === 0) {
  43134. referenceTemplate = referenceTemplate.concat([at[1]]);
  43135. }
  43136. var referenceTemplateLength = referenceTemplate.length;
  43137. var referenceTemplateX = new Int32Array(referenceTemplateLength);
  43138. var referenceTemplateY = new Int32Array(referenceTemplateLength);
  43139. for (k = 0; k < referenceTemplateLength; k++) {
  43140. referenceTemplateX[k] = referenceTemplate[k].x;
  43141. referenceTemplateY[k] = referenceTemplate[k].y;
  43142. }
  43143. var referenceWidth = referenceBitmap[0].length;
  43144. var referenceHeight = referenceBitmap.length;
  43145. var pseudoPixelContext = RefinementReusedContexts[templateIndex];
  43146. var bitmap = [];
  43147. var decoder = decodingContext.decoder;
  43148. var contexts = decodingContext.contextCache.getContexts('GR');
  43149. var ltp = 0;
  43150. for (var i = 0; i < height; i++) {
  43151. if (prediction) {
  43152. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  43153. ltp ^= sltp;
  43154. if (ltp) {
  43155. error('JBIG2 error: prediction is not supported');
  43156. }
  43157. }
  43158. var row = new Uint8Array(width);
  43159. bitmap.push(row);
  43160. for (var j = 0; j < width; j++) {
  43161. var i0, j0;
  43162. var contextLabel = 0;
  43163. for (k = 0; k < codingTemplateLength; k++) {
  43164. i0 = i + codingTemplateY[k];
  43165. j0 = j + codingTemplateX[k];
  43166. if (i0 < 0 || j0 < 0 || j0 >= width) {
  43167. contextLabel <<= 1;
  43168. } else {
  43169. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  43170. }
  43171. }
  43172. for (k = 0; k < referenceTemplateLength; k++) {
  43173. i0 = i + referenceTemplateY[k] + offsetY;
  43174. j0 = j + referenceTemplateX[k] + offsetX;
  43175. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  43176. contextLabel <<= 1;
  43177. } else {
  43178. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  43179. }
  43180. }
  43181. var pixel = decoder.readBit(contexts, contextLabel);
  43182. row[j] = pixel;
  43183. }
  43184. }
  43185. return bitmap;
  43186. }
  43187. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext) {
  43188. if (huffman) {
  43189. error('JBIG2 error: huffman is not supported');
  43190. }
  43191. var newSymbols = [];
  43192. var currentHeight = 0;
  43193. var symbolCodeLength = log2(symbols.length + numberOfNewSymbols);
  43194. var decoder = decodingContext.decoder;
  43195. var contextCache = decodingContext.contextCache;
  43196. while (newSymbols.length < numberOfNewSymbols) {
  43197. var deltaHeight = decodeInteger(contextCache, 'IADH', decoder);
  43198. currentHeight += deltaHeight;
  43199. var currentWidth = 0;
  43200. while (true) {
  43201. var deltaWidth = decodeInteger(contextCache, 'IADW', decoder);
  43202. if (deltaWidth === null) {
  43203. break;
  43204. }
  43205. currentWidth += deltaWidth;
  43206. var bitmap;
  43207. if (refinement) {
  43208. var numberOfInstances = decodeInteger(contextCache, 'IAAI', decoder);
  43209. if (numberOfInstances > 1) {
  43210. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext);
  43211. } else {
  43212. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  43213. var rdx = decodeInteger(contextCache, 'IARDX', decoder);
  43214. var rdy = decodeInteger(contextCache, 'IARDY', decoder);
  43215. var symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  43216. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  43217. }
  43218. } else {
  43219. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  43220. }
  43221. newSymbols.push(bitmap);
  43222. }
  43223. }
  43224. var exportedSymbols = [];
  43225. var flags = [], currentFlag = false;
  43226. var totalSymbolsLength = symbols.length + numberOfNewSymbols;
  43227. while (flags.length < totalSymbolsLength) {
  43228. var runLength = decodeInteger(contextCache, 'IAEX', decoder);
  43229. while (runLength--) {
  43230. flags.push(currentFlag);
  43231. }
  43232. currentFlag = !currentFlag;
  43233. }
  43234. for (var i = 0, ii = symbols.length; i < ii; i++) {
  43235. if (flags[i]) {
  43236. exportedSymbols.push(symbols[i]);
  43237. }
  43238. }
  43239. for (var j = 0; j < numberOfNewSymbols; i++, j++) {
  43240. if (flags[i]) {
  43241. exportedSymbols.push(newSymbols[j]);
  43242. }
  43243. }
  43244. return exportedSymbols;
  43245. }
  43246. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext) {
  43247. if (huffman) {
  43248. error('JBIG2 error: huffman is not supported');
  43249. }
  43250. var bitmap = [];
  43251. var i, row;
  43252. for (i = 0; i < height; i++) {
  43253. row = new Uint8Array(width);
  43254. if (defaultPixelValue) {
  43255. for (var j = 0; j < width; j++) {
  43256. row[j] = defaultPixelValue;
  43257. }
  43258. }
  43259. bitmap.push(row);
  43260. }
  43261. var decoder = decodingContext.decoder;
  43262. var contextCache = decodingContext.contextCache;
  43263. var stripT = -decodeInteger(contextCache, 'IADT', decoder);
  43264. var firstS = 0;
  43265. i = 0;
  43266. while (i < numberOfSymbolInstances) {
  43267. var deltaT = decodeInteger(contextCache, 'IADT', decoder);
  43268. stripT += deltaT;
  43269. var deltaFirstS = decodeInteger(contextCache, 'IAFS', decoder);
  43270. firstS += deltaFirstS;
  43271. var currentS = firstS;
  43272. do {
  43273. var currentT = stripSize === 1 ? 0 : decodeInteger(contextCache, 'IAIT', decoder);
  43274. var t = stripSize * stripT + currentT;
  43275. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  43276. var applyRefinement = refinement && decodeInteger(contextCache, 'IARI', decoder);
  43277. var symbolBitmap = inputSymbols[symbolId];
  43278. var symbolWidth = symbolBitmap[0].length;
  43279. var symbolHeight = symbolBitmap.length;
  43280. if (applyRefinement) {
  43281. var rdw = decodeInteger(contextCache, 'IARDW', decoder);
  43282. var rdh = decodeInteger(contextCache, 'IARDH', decoder);
  43283. var rdx = decodeInteger(contextCache, 'IARDX', decoder);
  43284. var rdy = decodeInteger(contextCache, 'IARDY', decoder);
  43285. symbolWidth += rdw;
  43286. symbolHeight += rdh;
  43287. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  43288. }
  43289. var offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight);
  43290. var offsetS = currentS - (referenceCorner & 2 ? symbolWidth : 0);
  43291. var s2, t2, symbolRow;
  43292. if (transposed) {
  43293. for (s2 = 0; s2 < symbolHeight; s2++) {
  43294. row = bitmap[offsetS + s2];
  43295. if (!row) {
  43296. continue;
  43297. }
  43298. symbolRow = symbolBitmap[s2];
  43299. var maxWidth = Math.min(width - offsetT, symbolWidth);
  43300. switch (combinationOperator) {
  43301. case 0:
  43302. for (t2 = 0; t2 < maxWidth; t2++) {
  43303. row[offsetT + t2] |= symbolRow[t2];
  43304. }
  43305. break;
  43306. case 2:
  43307. for (t2 = 0; t2 < maxWidth; t2++) {
  43308. row[offsetT + t2] ^= symbolRow[t2];
  43309. }
  43310. break;
  43311. default:
  43312. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  43313. }
  43314. }
  43315. currentS += symbolHeight - 1;
  43316. } else {
  43317. for (t2 = 0; t2 < symbolHeight; t2++) {
  43318. row = bitmap[offsetT + t2];
  43319. if (!row) {
  43320. continue;
  43321. }
  43322. symbolRow = symbolBitmap[t2];
  43323. switch (combinationOperator) {
  43324. case 0:
  43325. for (s2 = 0; s2 < symbolWidth; s2++) {
  43326. row[offsetS + s2] |= symbolRow[s2];
  43327. }
  43328. break;
  43329. case 2:
  43330. for (s2 = 0; s2 < symbolWidth; s2++) {
  43331. row[offsetS + s2] ^= symbolRow[s2];
  43332. }
  43333. break;
  43334. default:
  43335. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  43336. }
  43337. }
  43338. currentS += symbolWidth - 1;
  43339. }
  43340. i++;
  43341. var deltaS = decodeInteger(contextCache, 'IADS', decoder);
  43342. if (deltaS === null) {
  43343. break;
  43344. }
  43345. currentS += deltaS + dsOffset;
  43346. } while (true);
  43347. }
  43348. return bitmap;
  43349. }
  43350. function readSegmentHeader(data, start) {
  43351. var segmentHeader = {};
  43352. segmentHeader.number = readUint32(data, start);
  43353. var flags = data[start + 4];
  43354. var segmentType = flags & 0x3F;
  43355. if (!SegmentTypes[segmentType]) {
  43356. error('JBIG2 error: invalid segment type: ' + segmentType);
  43357. }
  43358. segmentHeader.type = segmentType;
  43359. segmentHeader.typeName = SegmentTypes[segmentType];
  43360. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  43361. var pageAssociationFieldSize = !!(flags & 0x40);
  43362. var referredFlags = data[start + 5];
  43363. var referredToCount = referredFlags >> 5 & 7;
  43364. var retainBits = [referredFlags & 31];
  43365. var position = start + 6;
  43366. if (referredFlags === 7) {
  43367. referredToCount = readUint32(data, position - 1) & 0x1FFFFFFF;
  43368. position += 3;
  43369. var bytes = referredToCount + 7 >> 3;
  43370. retainBits[0] = data[position++];
  43371. while (--bytes > 0) {
  43372. retainBits.push(data[position++]);
  43373. }
  43374. } else if (referredFlags === 5 || referredFlags === 6) {
  43375. error('JBIG2 error: invalid referred-to flags');
  43376. }
  43377. segmentHeader.retainBits = retainBits;
  43378. var referredToSegmentNumberSize = segmentHeader.number <= 256 ? 1 : segmentHeader.number <= 65536 ? 2 : 4;
  43379. var referredTo = [];
  43380. var i, ii;
  43381. for (i = 0; i < referredToCount; i++) {
  43382. var number = referredToSegmentNumberSize === 1 ? data[position] : referredToSegmentNumberSize === 2 ? readUint16(data, position) : readUint32(data, position);
  43383. referredTo.push(number);
  43384. position += referredToSegmentNumberSize;
  43385. }
  43386. segmentHeader.referredTo = referredTo;
  43387. if (!pageAssociationFieldSize) {
  43388. segmentHeader.pageAssociation = data[position++];
  43389. } else {
  43390. segmentHeader.pageAssociation = readUint32(data, position);
  43391. position += 4;
  43392. }
  43393. segmentHeader.length = readUint32(data, position);
  43394. position += 4;
  43395. if (segmentHeader.length === 0xFFFFFFFF) {
  43396. if (segmentType === 38) {
  43397. var genericRegionInfo = readRegionSegmentInformation(data, position);
  43398. var genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  43399. var genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  43400. var searchPatternLength = 6;
  43401. var searchPattern = new Uint8Array(searchPatternLength);
  43402. if (!genericRegionMmr) {
  43403. searchPattern[0] = 0xFF;
  43404. searchPattern[1] = 0xAC;
  43405. }
  43406. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xFF;
  43407. searchPattern[3] = genericRegionInfo.height >> 16 & 0xFF;
  43408. searchPattern[4] = genericRegionInfo.height >> 8 & 0xFF;
  43409. searchPattern[5] = genericRegionInfo.height & 0xFF;
  43410. for (i = position, ii = data.length; i < ii; i++) {
  43411. var j = 0;
  43412. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  43413. j++;
  43414. }
  43415. if (j === searchPatternLength) {
  43416. segmentHeader.length = i + searchPatternLength;
  43417. break;
  43418. }
  43419. }
  43420. if (segmentHeader.length === 0xFFFFFFFF) {
  43421. error('JBIG2 error: segment end was not found');
  43422. }
  43423. } else {
  43424. error('JBIG2 error: invalid unknown segment length');
  43425. }
  43426. }
  43427. segmentHeader.headerEnd = position;
  43428. return segmentHeader;
  43429. }
  43430. function readSegments(header, data, start, end) {
  43431. var segments = [];
  43432. var position = start;
  43433. while (position < end) {
  43434. var segmentHeader = readSegmentHeader(data, position);
  43435. position = segmentHeader.headerEnd;
  43436. var segment = {
  43437. header: segmentHeader,
  43438. data: data
  43439. };
  43440. if (!header.randomAccess) {
  43441. segment.start = position;
  43442. position += segmentHeader.length;
  43443. segment.end = position;
  43444. }
  43445. segments.push(segment);
  43446. if (segmentHeader.type === 51) {
  43447. break;
  43448. }
  43449. }
  43450. if (header.randomAccess) {
  43451. for (var i = 0, ii = segments.length; i < ii; i++) {
  43452. segments[i].start = position;
  43453. position += segments[i].header.length;
  43454. segments[i].end = position;
  43455. }
  43456. }
  43457. return segments;
  43458. }
  43459. function readRegionSegmentInformation(data, start) {
  43460. return {
  43461. width: readUint32(data, start),
  43462. height: readUint32(data, start + 4),
  43463. x: readUint32(data, start + 8),
  43464. y: readUint32(data, start + 12),
  43465. combinationOperator: data[start + 16] & 7
  43466. };
  43467. }
  43468. var RegionSegmentInformationFieldLength = 17;
  43469. function processSegment(segment, visitor) {
  43470. var header = segment.header;
  43471. var data = segment.data, position = segment.start, end = segment.end;
  43472. var args, at, i, atLength;
  43473. switch (header.type) {
  43474. case 0:
  43475. var dictionary = {};
  43476. var dictionaryFlags = readUint16(data, position);
  43477. dictionary.huffman = !!(dictionaryFlags & 1);
  43478. dictionary.refinement = !!(dictionaryFlags & 2);
  43479. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  43480. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  43481. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  43482. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  43483. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  43484. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  43485. dictionary.template = dictionaryFlags >> 10 & 3;
  43486. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  43487. position += 2;
  43488. if (!dictionary.huffman) {
  43489. atLength = dictionary.template === 0 ? 4 : 1;
  43490. at = [];
  43491. for (i = 0; i < atLength; i++) {
  43492. at.push({
  43493. x: readInt8(data, position),
  43494. y: readInt8(data, position + 1)
  43495. });
  43496. position += 2;
  43497. }
  43498. dictionary.at = at;
  43499. }
  43500. if (dictionary.refinement && !dictionary.refinementTemplate) {
  43501. at = [];
  43502. for (i = 0; i < 2; i++) {
  43503. at.push({
  43504. x: readInt8(data, position),
  43505. y: readInt8(data, position + 1)
  43506. });
  43507. position += 2;
  43508. }
  43509. dictionary.refinementAt = at;
  43510. }
  43511. dictionary.numberOfExportedSymbols = readUint32(data, position);
  43512. position += 4;
  43513. dictionary.numberOfNewSymbols = readUint32(data, position);
  43514. position += 4;
  43515. args = [
  43516. dictionary,
  43517. header.number,
  43518. header.referredTo,
  43519. data,
  43520. position,
  43521. end
  43522. ];
  43523. break;
  43524. case 6:
  43525. case 7:
  43526. var textRegion = {};
  43527. textRegion.info = readRegionSegmentInformation(data, position);
  43528. position += RegionSegmentInformationFieldLength;
  43529. var textRegionSegmentFlags = readUint16(data, position);
  43530. position += 2;
  43531. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  43532. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  43533. textRegion.stripSize = 1 << (textRegionSegmentFlags >> 2 & 3);
  43534. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  43535. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  43536. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  43537. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  43538. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  43539. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  43540. if (textRegion.huffman) {
  43541. var textRegionHuffmanFlags = readUint16(data, position);
  43542. position += 2;
  43543. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  43544. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  43545. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  43546. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  43547. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  43548. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  43549. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  43550. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 14);
  43551. }
  43552. if (textRegion.refinement && !textRegion.refinementTemplate) {
  43553. at = [];
  43554. for (i = 0; i < 2; i++) {
  43555. at.push({
  43556. x: readInt8(data, position),
  43557. y: readInt8(data, position + 1)
  43558. });
  43559. position += 2;
  43560. }
  43561. textRegion.refinementAt = at;
  43562. }
  43563. textRegion.numberOfSymbolInstances = readUint32(data, position);
  43564. position += 4;
  43565. if (textRegion.huffman) {
  43566. error('JBIG2 error: huffman is not supported');
  43567. }
  43568. args = [
  43569. textRegion,
  43570. header.referredTo,
  43571. data,
  43572. position,
  43573. end
  43574. ];
  43575. break;
  43576. case 38:
  43577. case 39:
  43578. var genericRegion = {};
  43579. genericRegion.info = readRegionSegmentInformation(data, position);
  43580. position += RegionSegmentInformationFieldLength;
  43581. var genericRegionSegmentFlags = data[position++];
  43582. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  43583. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  43584. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  43585. if (!genericRegion.mmr) {
  43586. atLength = genericRegion.template === 0 ? 4 : 1;
  43587. at = [];
  43588. for (i = 0; i < atLength; i++) {
  43589. at.push({
  43590. x: readInt8(data, position),
  43591. y: readInt8(data, position + 1)
  43592. });
  43593. position += 2;
  43594. }
  43595. genericRegion.at = at;
  43596. }
  43597. args = [
  43598. genericRegion,
  43599. data,
  43600. position,
  43601. end
  43602. ];
  43603. break;
  43604. case 48:
  43605. var pageInfo = {
  43606. width: readUint32(data, position),
  43607. height: readUint32(data, position + 4),
  43608. resolutionX: readUint32(data, position + 8),
  43609. resolutionY: readUint32(data, position + 12)
  43610. };
  43611. if (pageInfo.height === 0xFFFFFFFF) {
  43612. delete pageInfo.height;
  43613. }
  43614. var pageSegmentFlags = data[position + 16];
  43615. readUint16(data, position + 17);
  43616. pageInfo.lossless = !!(pageSegmentFlags & 1);
  43617. pageInfo.refinement = !!(pageSegmentFlags & 2);
  43618. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  43619. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  43620. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  43621. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  43622. args = [pageInfo];
  43623. break;
  43624. case 49:
  43625. break;
  43626. case 50:
  43627. break;
  43628. case 51:
  43629. break;
  43630. case 62:
  43631. break;
  43632. default:
  43633. error('JBIG2 error: segment type ' + header.typeName + '(' + header.type + ') is not implemented');
  43634. }
  43635. var callbackName = 'on' + header.typeName;
  43636. if (callbackName in visitor) {
  43637. visitor[callbackName].apply(visitor, args);
  43638. }
  43639. }
  43640. function processSegments(segments, visitor) {
  43641. for (var i = 0, ii = segments.length; i < ii; i++) {
  43642. processSegment(segments[i], visitor);
  43643. }
  43644. }
  43645. function parseJbig2(data, start, end) {
  43646. var position = start;
  43647. 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) {
  43648. error('JBIG2 error: invalid header');
  43649. }
  43650. var header = {};
  43651. position += 8;
  43652. var flags = data[position++];
  43653. header.randomAccess = !(flags & 1);
  43654. if (!(flags & 2)) {
  43655. header.numberOfPages = readUint32(data, position);
  43656. position += 4;
  43657. }
  43658. readSegments(header, data, position, end);
  43659. error('Not implemented');
  43660. }
  43661. function parseJbig2Chunks(chunks) {
  43662. var visitor = new SimpleSegmentVisitor();
  43663. for (var i = 0, ii = chunks.length; i < ii; i++) {
  43664. var chunk = chunks[i];
  43665. var segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  43666. processSegments(segments, visitor);
  43667. }
  43668. return visitor.buffer;
  43669. }
  43670. function SimpleSegmentVisitor() {
  43671. }
  43672. SimpleSegmentVisitor.prototype = {
  43673. onPageInformation: function SimpleSegmentVisitor_onPageInformation(info) {
  43674. this.currentPageInfo = info;
  43675. var rowSize = info.width + 7 >> 3;
  43676. var buffer = new Uint8Array(rowSize * info.height);
  43677. if (info.defaultPixelValue) {
  43678. for (var i = 0, ii = buffer.length; i < ii; i++) {
  43679. buffer[i] = 0xFF;
  43680. }
  43681. }
  43682. this.buffer = buffer;
  43683. },
  43684. drawBitmap: function SimpleSegmentVisitor_drawBitmap(regionInfo, bitmap) {
  43685. var pageInfo = this.currentPageInfo;
  43686. var width = regionInfo.width, height = regionInfo.height;
  43687. var rowSize = pageInfo.width + 7 >> 3;
  43688. var combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  43689. var buffer = this.buffer;
  43690. var mask0 = 128 >> (regionInfo.x & 7);
  43691. var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  43692. var i, j, mask, offset;
  43693. switch (combinationOperator) {
  43694. case 0:
  43695. for (i = 0; i < height; i++) {
  43696. mask = mask0;
  43697. offset = offset0;
  43698. for (j = 0; j < width; j++) {
  43699. if (bitmap[i][j]) {
  43700. buffer[offset] |= mask;
  43701. }
  43702. mask >>= 1;
  43703. if (!mask) {
  43704. mask = 128;
  43705. offset++;
  43706. }
  43707. }
  43708. offset0 += rowSize;
  43709. }
  43710. break;
  43711. case 2:
  43712. for (i = 0; i < height; i++) {
  43713. mask = mask0;
  43714. offset = offset0;
  43715. for (j = 0; j < width; j++) {
  43716. if (bitmap[i][j]) {
  43717. buffer[offset] ^= mask;
  43718. }
  43719. mask >>= 1;
  43720. if (!mask) {
  43721. mask = 128;
  43722. offset++;
  43723. }
  43724. }
  43725. offset0 += rowSize;
  43726. }
  43727. break;
  43728. default:
  43729. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  43730. }
  43731. },
  43732. onImmediateGenericRegion: function SimpleSegmentVisitor_onImmediateGenericRegion(region, data, start, end) {
  43733. var regionInfo = region.info;
  43734. var decodingContext = new DecodingContext(data, start, end);
  43735. var bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  43736. this.drawBitmap(regionInfo, bitmap);
  43737. },
  43738. onImmediateLosslessGenericRegion: function SimpleSegmentVisitor_onImmediateLosslessGenericRegion() {
  43739. this.onImmediateGenericRegion.apply(this, arguments);
  43740. },
  43741. onSymbolDictionary: function SimpleSegmentVisitor_onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  43742. var huffmanTables;
  43743. if (dictionary.huffman) {
  43744. error('JBIG2 error: huffman is not supported');
  43745. }
  43746. var symbols = this.symbols;
  43747. if (!symbols) {
  43748. this.symbols = symbols = {};
  43749. }
  43750. var inputSymbols = [];
  43751. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  43752. inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]);
  43753. }
  43754. var decodingContext = new DecodingContext(data, start, end);
  43755. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext);
  43756. },
  43757. onImmediateTextRegion: function SimpleSegmentVisitor_onImmediateTextRegion(region, referredSegments, data, start, end) {
  43758. var regionInfo = region.info;
  43759. var huffmanTables;
  43760. var symbols = this.symbols;
  43761. var inputSymbols = [];
  43762. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  43763. inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]);
  43764. }
  43765. var symbolCodeLength = log2(inputSymbols.length);
  43766. var decodingContext = new DecodingContext(data, start, end);
  43767. 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);
  43768. this.drawBitmap(regionInfo, bitmap);
  43769. },
  43770. onImmediateLosslessTextRegion: function SimpleSegmentVisitor_onImmediateLosslessTextRegion() {
  43771. this.onImmediateTextRegion.apply(this, arguments);
  43772. }
  43773. };
  43774. function Jbig2Image() {
  43775. }
  43776. Jbig2Image.prototype = {
  43777. parseChunks: function Jbig2Image_parseChunks(chunks) {
  43778. return parseJbig2Chunks(chunks);
  43779. }
  43780. };
  43781. return Jbig2Image;
  43782. }();
  43783. exports.Jbig2Image = Jbig2Image;
  43784. /***/ }),
  43785. /* 29 */
  43786. /***/ (function(module, exports, __w_pdfjs_require__) {
  43787. "use strict";
  43788. var sharedUtil = __w_pdfjs_require__(0);
  43789. var error = sharedUtil.error;
  43790. var JpegImage = function JpegImageClosure() {
  43791. var dctZigZag = new Uint8Array([
  43792. 0,
  43793. 1,
  43794. 8,
  43795. 16,
  43796. 9,
  43797. 2,
  43798. 3,
  43799. 10,
  43800. 17,
  43801. 24,
  43802. 32,
  43803. 25,
  43804. 18,
  43805. 11,
  43806. 4,
  43807. 5,
  43808. 12,
  43809. 19,
  43810. 26,
  43811. 33,
  43812. 40,
  43813. 48,
  43814. 41,
  43815. 34,
  43816. 27,
  43817. 20,
  43818. 13,
  43819. 6,
  43820. 7,
  43821. 14,
  43822. 21,
  43823. 28,
  43824. 35,
  43825. 42,
  43826. 49,
  43827. 56,
  43828. 57,
  43829. 50,
  43830. 43,
  43831. 36,
  43832. 29,
  43833. 22,
  43834. 15,
  43835. 23,
  43836. 30,
  43837. 37,
  43838. 44,
  43839. 51,
  43840. 58,
  43841. 59,
  43842. 52,
  43843. 45,
  43844. 38,
  43845. 31,
  43846. 39,
  43847. 46,
  43848. 53,
  43849. 60,
  43850. 61,
  43851. 54,
  43852. 47,
  43853. 55,
  43854. 62,
  43855. 63
  43856. ]);
  43857. var dctCos1 = 4017;
  43858. var dctSin1 = 799;
  43859. var dctCos3 = 3406;
  43860. var dctSin3 = 2276;
  43861. var dctCos6 = 1567;
  43862. var dctSin6 = 3784;
  43863. var dctSqrt2 = 5793;
  43864. var dctSqrt1d2 = 2896;
  43865. function JpegImage() {
  43866. this.decodeTransform = null;
  43867. this.colorTransform = -1;
  43868. }
  43869. function buildHuffmanTable(codeLengths, values) {
  43870. var k = 0, code = [], i, j, length = 16;
  43871. while (length > 0 && !codeLengths[length - 1]) {
  43872. length--;
  43873. }
  43874. code.push({
  43875. children: [],
  43876. index: 0
  43877. });
  43878. var p = code[0], q;
  43879. for (i = 0; i < length; i++) {
  43880. for (j = 0; j < codeLengths[i]; j++) {
  43881. p = code.pop();
  43882. p.children[p.index] = values[k];
  43883. while (p.index > 0) {
  43884. p = code.pop();
  43885. }
  43886. p.index++;
  43887. code.push(p);
  43888. while (code.length <= i) {
  43889. code.push(q = {
  43890. children: [],
  43891. index: 0
  43892. });
  43893. p.children[p.index] = q.children;
  43894. p = q;
  43895. }
  43896. k++;
  43897. }
  43898. if (i + 1 < length) {
  43899. code.push(q = {
  43900. children: [],
  43901. index: 0
  43902. });
  43903. p.children[p.index] = q.children;
  43904. p = q;
  43905. }
  43906. }
  43907. return code[0].children;
  43908. }
  43909. function getBlockBufferOffset(component, row, col) {
  43910. return 64 * ((component.blocksPerLine + 1) * row + col);
  43911. }
  43912. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive) {
  43913. var mcusPerLine = frame.mcusPerLine;
  43914. var progressive = frame.progressive;
  43915. var startOffset = offset, bitsData = 0, bitsCount = 0;
  43916. function readBit() {
  43917. if (bitsCount > 0) {
  43918. bitsCount--;
  43919. return bitsData >> bitsCount & 1;
  43920. }
  43921. bitsData = data[offset++];
  43922. if (bitsData === 0xFF) {
  43923. var nextByte = data[offset++];
  43924. if (nextByte) {
  43925. error('JPEG error: unexpected marker ' + (bitsData << 8 | nextByte).toString(16));
  43926. }
  43927. }
  43928. bitsCount = 7;
  43929. return bitsData >>> 7;
  43930. }
  43931. function decodeHuffman(tree) {
  43932. var node = tree;
  43933. while (true) {
  43934. node = node[readBit()];
  43935. if (typeof node === 'number') {
  43936. return node;
  43937. }
  43938. if (typeof node !== 'object') {
  43939. error('JPEG error: invalid huffman sequence');
  43940. }
  43941. }
  43942. }
  43943. function receive(length) {
  43944. var n = 0;
  43945. while (length > 0) {
  43946. n = n << 1 | readBit();
  43947. length--;
  43948. }
  43949. return n;
  43950. }
  43951. function receiveAndExtend(length) {
  43952. if (length === 1) {
  43953. return readBit() === 1 ? 1 : -1;
  43954. }
  43955. var n = receive(length);
  43956. if (n >= 1 << length - 1) {
  43957. return n;
  43958. }
  43959. return n + (-1 << length) + 1;
  43960. }
  43961. function decodeBaseline(component, offset) {
  43962. var t = decodeHuffman(component.huffmanTableDC);
  43963. var diff = t === 0 ? 0 : receiveAndExtend(t);
  43964. component.blockData[offset] = component.pred += diff;
  43965. var k = 1;
  43966. while (k < 64) {
  43967. var rs = decodeHuffman(component.huffmanTableAC);
  43968. var s = rs & 15, r = rs >> 4;
  43969. if (s === 0) {
  43970. if (r < 15) {
  43971. break;
  43972. }
  43973. k += 16;
  43974. continue;
  43975. }
  43976. k += r;
  43977. var z = dctZigZag[k];
  43978. component.blockData[offset + z] = receiveAndExtend(s);
  43979. k++;
  43980. }
  43981. }
  43982. function decodeDCFirst(component, offset) {
  43983. var t = decodeHuffman(component.huffmanTableDC);
  43984. var diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  43985. component.blockData[offset] = component.pred += diff;
  43986. }
  43987. function decodeDCSuccessive(component, offset) {
  43988. component.blockData[offset] |= readBit() << successive;
  43989. }
  43990. var eobrun = 0;
  43991. function decodeACFirst(component, offset) {
  43992. if (eobrun > 0) {
  43993. eobrun--;
  43994. return;
  43995. }
  43996. var k = spectralStart, e = spectralEnd;
  43997. while (k <= e) {
  43998. var rs = decodeHuffman(component.huffmanTableAC);
  43999. var s = rs & 15, r = rs >> 4;
  44000. if (s === 0) {
  44001. if (r < 15) {
  44002. eobrun = receive(r) + (1 << r) - 1;
  44003. break;
  44004. }
  44005. k += 16;
  44006. continue;
  44007. }
  44008. k += r;
  44009. var z = dctZigZag[k];
  44010. component.blockData[offset + z] = receiveAndExtend(s) * (1 << successive);
  44011. k++;
  44012. }
  44013. }
  44014. var successiveACState = 0, successiveACNextValue;
  44015. function decodeACSuccessive(component, offset) {
  44016. var k = spectralStart;
  44017. var e = spectralEnd;
  44018. var r = 0;
  44019. var s;
  44020. var rs;
  44021. while (k <= e) {
  44022. var z = dctZigZag[k];
  44023. switch (successiveACState) {
  44024. case 0:
  44025. rs = decodeHuffman(component.huffmanTableAC);
  44026. s = rs & 15;
  44027. r = rs >> 4;
  44028. if (s === 0) {
  44029. if (r < 15) {
  44030. eobrun = receive(r) + (1 << r);
  44031. successiveACState = 4;
  44032. } else {
  44033. r = 16;
  44034. successiveACState = 1;
  44035. }
  44036. } else {
  44037. if (s !== 1) {
  44038. error('JPEG error: invalid ACn encoding');
  44039. }
  44040. successiveACNextValue = receiveAndExtend(s);
  44041. successiveACState = r ? 2 : 3;
  44042. }
  44043. continue;
  44044. case 1:
  44045. case 2:
  44046. if (component.blockData[offset + z]) {
  44047. component.blockData[offset + z] += readBit() << successive;
  44048. } else {
  44049. r--;
  44050. if (r === 0) {
  44051. successiveACState = successiveACState === 2 ? 3 : 0;
  44052. }
  44053. }
  44054. break;
  44055. case 3:
  44056. if (component.blockData[offset + z]) {
  44057. component.blockData[offset + z] += readBit() << successive;
  44058. } else {
  44059. component.blockData[offset + z] = successiveACNextValue << successive;
  44060. successiveACState = 0;
  44061. }
  44062. break;
  44063. case 4:
  44064. if (component.blockData[offset + z]) {
  44065. component.blockData[offset + z] += readBit() << successive;
  44066. }
  44067. break;
  44068. }
  44069. k++;
  44070. }
  44071. if (successiveACState === 4) {
  44072. eobrun--;
  44073. if (eobrun === 0) {
  44074. successiveACState = 0;
  44075. }
  44076. }
  44077. }
  44078. function decodeMcu(component, decode, mcu, row, col) {
  44079. var mcuRow = mcu / mcusPerLine | 0;
  44080. var mcuCol = mcu % mcusPerLine;
  44081. var blockRow = mcuRow * component.v + row;
  44082. var blockCol = mcuCol * component.h + col;
  44083. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  44084. decode(component, offset);
  44085. }
  44086. function decodeBlock(component, decode, mcu) {
  44087. var blockRow = mcu / component.blocksPerLine | 0;
  44088. var blockCol = mcu % component.blocksPerLine;
  44089. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  44090. decode(component, offset);
  44091. }
  44092. var componentsLength = components.length;
  44093. var component, i, j, k, n;
  44094. var decodeFn;
  44095. if (progressive) {
  44096. if (spectralStart === 0) {
  44097. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  44098. } else {
  44099. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  44100. }
  44101. } else {
  44102. decodeFn = decodeBaseline;
  44103. }
  44104. var mcu = 0, marker;
  44105. var mcuExpected;
  44106. if (componentsLength === 1) {
  44107. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  44108. } else {
  44109. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  44110. }
  44111. if (!resetInterval) {
  44112. resetInterval = mcuExpected;
  44113. }
  44114. var h, v;
  44115. while (mcu < mcuExpected) {
  44116. for (i = 0; i < componentsLength; i++) {
  44117. components[i].pred = 0;
  44118. }
  44119. eobrun = 0;
  44120. if (componentsLength === 1) {
  44121. component = components[0];
  44122. for (n = 0; n < resetInterval; n++) {
  44123. decodeBlock(component, decodeFn, mcu);
  44124. mcu++;
  44125. }
  44126. } else {
  44127. for (n = 0; n < resetInterval; n++) {
  44128. for (i = 0; i < componentsLength; i++) {
  44129. component = components[i];
  44130. h = component.h;
  44131. v = component.v;
  44132. for (j = 0; j < v; j++) {
  44133. for (k = 0; k < h; k++) {
  44134. decodeMcu(component, decodeFn, mcu, j, k);
  44135. }
  44136. }
  44137. }
  44138. mcu++;
  44139. }
  44140. }
  44141. bitsCount = 0;
  44142. marker = data[offset] << 8 | data[offset + 1];
  44143. while (data[offset] === 0x00 && offset < data.length - 1) {
  44144. offset++;
  44145. marker = data[offset] << 8 | data[offset + 1];
  44146. }
  44147. if (marker <= 0xFF00) {
  44148. error('JPEG error: marker was not found');
  44149. }
  44150. if (marker >= 0xFFD0 && marker <= 0xFFD7) {
  44151. offset += 2;
  44152. } else {
  44153. break;
  44154. }
  44155. }
  44156. return offset - startOffset;
  44157. }
  44158. function quantizeAndInverse(component, blockBufferOffset, p) {
  44159. var qt = component.quantizationTable, blockData = component.blockData;
  44160. var v0, v1, v2, v3, v4, v5, v6, v7;
  44161. var p0, p1, p2, p3, p4, p5, p6, p7;
  44162. var t;
  44163. if (!qt) {
  44164. error('JPEG error: missing required Quantization Table.');
  44165. }
  44166. for (var row = 0; row < 64; row += 8) {
  44167. p0 = blockData[blockBufferOffset + row];
  44168. p1 = blockData[blockBufferOffset + row + 1];
  44169. p2 = blockData[blockBufferOffset + row + 2];
  44170. p3 = blockData[blockBufferOffset + row + 3];
  44171. p4 = blockData[blockBufferOffset + row + 4];
  44172. p5 = blockData[blockBufferOffset + row + 5];
  44173. p6 = blockData[blockBufferOffset + row + 6];
  44174. p7 = blockData[blockBufferOffset + row + 7];
  44175. p0 *= qt[row];
  44176. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  44177. t = dctSqrt2 * p0 + 512 >> 10;
  44178. p[row] = t;
  44179. p[row + 1] = t;
  44180. p[row + 2] = t;
  44181. p[row + 3] = t;
  44182. p[row + 4] = t;
  44183. p[row + 5] = t;
  44184. p[row + 6] = t;
  44185. p[row + 7] = t;
  44186. continue;
  44187. }
  44188. p1 *= qt[row + 1];
  44189. p2 *= qt[row + 2];
  44190. p3 *= qt[row + 3];
  44191. p4 *= qt[row + 4];
  44192. p5 *= qt[row + 5];
  44193. p6 *= qt[row + 6];
  44194. p7 *= qt[row + 7];
  44195. v0 = dctSqrt2 * p0 + 128 >> 8;
  44196. v1 = dctSqrt2 * p4 + 128 >> 8;
  44197. v2 = p2;
  44198. v3 = p6;
  44199. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  44200. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  44201. v5 = p3 << 4;
  44202. v6 = p5 << 4;
  44203. v0 = v0 + v1 + 1 >> 1;
  44204. v1 = v0 - v1;
  44205. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  44206. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  44207. v3 = t;
  44208. v4 = v4 + v6 + 1 >> 1;
  44209. v6 = v4 - v6;
  44210. v7 = v7 + v5 + 1 >> 1;
  44211. v5 = v7 - v5;
  44212. v0 = v0 + v3 + 1 >> 1;
  44213. v3 = v0 - v3;
  44214. v1 = v1 + v2 + 1 >> 1;
  44215. v2 = v1 - v2;
  44216. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  44217. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  44218. v7 = t;
  44219. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  44220. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  44221. v6 = t;
  44222. p[row] = v0 + v7;
  44223. p[row + 7] = v0 - v7;
  44224. p[row + 1] = v1 + v6;
  44225. p[row + 6] = v1 - v6;
  44226. p[row + 2] = v2 + v5;
  44227. p[row + 5] = v2 - v5;
  44228. p[row + 3] = v3 + v4;
  44229. p[row + 4] = v3 - v4;
  44230. }
  44231. for (var col = 0; col < 8; ++col) {
  44232. p0 = p[col];
  44233. p1 = p[col + 8];
  44234. p2 = p[col + 16];
  44235. p3 = p[col + 24];
  44236. p4 = p[col + 32];
  44237. p5 = p[col + 40];
  44238. p6 = p[col + 48];
  44239. p7 = p[col + 56];
  44240. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  44241. t = dctSqrt2 * p0 + 8192 >> 14;
  44242. t = t < -2040 ? 0 : t >= 2024 ? 255 : t + 2056 >> 4;
  44243. blockData[blockBufferOffset + col] = t;
  44244. blockData[blockBufferOffset + col + 8] = t;
  44245. blockData[blockBufferOffset + col + 16] = t;
  44246. blockData[blockBufferOffset + col + 24] = t;
  44247. blockData[blockBufferOffset + col + 32] = t;
  44248. blockData[blockBufferOffset + col + 40] = t;
  44249. blockData[blockBufferOffset + col + 48] = t;
  44250. blockData[blockBufferOffset + col + 56] = t;
  44251. continue;
  44252. }
  44253. v0 = dctSqrt2 * p0 + 2048 >> 12;
  44254. v1 = dctSqrt2 * p4 + 2048 >> 12;
  44255. v2 = p2;
  44256. v3 = p6;
  44257. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  44258. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  44259. v5 = p3;
  44260. v6 = p5;
  44261. v0 = (v0 + v1 + 1 >> 1) + 4112;
  44262. v1 = v0 - v1;
  44263. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  44264. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  44265. v3 = t;
  44266. v4 = v4 + v6 + 1 >> 1;
  44267. v6 = v4 - v6;
  44268. v7 = v7 + v5 + 1 >> 1;
  44269. v5 = v7 - v5;
  44270. v0 = v0 + v3 + 1 >> 1;
  44271. v3 = v0 - v3;
  44272. v1 = v1 + v2 + 1 >> 1;
  44273. v2 = v1 - v2;
  44274. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  44275. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  44276. v7 = t;
  44277. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  44278. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  44279. v6 = t;
  44280. p0 = v0 + v7;
  44281. p7 = v0 - v7;
  44282. p1 = v1 + v6;
  44283. p6 = v1 - v6;
  44284. p2 = v2 + v5;
  44285. p5 = v2 - v5;
  44286. p3 = v3 + v4;
  44287. p4 = v3 - v4;
  44288. p0 = p0 < 16 ? 0 : p0 >= 4080 ? 255 : p0 >> 4;
  44289. p1 = p1 < 16 ? 0 : p1 >= 4080 ? 255 : p1 >> 4;
  44290. p2 = p2 < 16 ? 0 : p2 >= 4080 ? 255 : p2 >> 4;
  44291. p3 = p3 < 16 ? 0 : p3 >= 4080 ? 255 : p3 >> 4;
  44292. p4 = p4 < 16 ? 0 : p4 >= 4080 ? 255 : p4 >> 4;
  44293. p5 = p5 < 16 ? 0 : p5 >= 4080 ? 255 : p5 >> 4;
  44294. p6 = p6 < 16 ? 0 : p6 >= 4080 ? 255 : p6 >> 4;
  44295. p7 = p7 < 16 ? 0 : p7 >= 4080 ? 255 : p7 >> 4;
  44296. blockData[blockBufferOffset + col] = p0;
  44297. blockData[blockBufferOffset + col + 8] = p1;
  44298. blockData[blockBufferOffset + col + 16] = p2;
  44299. blockData[blockBufferOffset + col + 24] = p3;
  44300. blockData[blockBufferOffset + col + 32] = p4;
  44301. blockData[blockBufferOffset + col + 40] = p5;
  44302. blockData[blockBufferOffset + col + 48] = p6;
  44303. blockData[blockBufferOffset + col + 56] = p7;
  44304. }
  44305. }
  44306. function buildComponentData(frame, component) {
  44307. var blocksPerLine = component.blocksPerLine;
  44308. var blocksPerColumn = component.blocksPerColumn;
  44309. var computationBuffer = new Int16Array(64);
  44310. for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  44311. for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  44312. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  44313. quantizeAndInverse(component, offset, computationBuffer);
  44314. }
  44315. }
  44316. return component.blockData;
  44317. }
  44318. function clamp0to255(a) {
  44319. return a <= 0 ? 0 : a >= 255 ? 255 : a;
  44320. }
  44321. JpegImage.prototype = {
  44322. parse: function parse(data) {
  44323. function readUint16() {
  44324. var value = data[offset] << 8 | data[offset + 1];
  44325. offset += 2;
  44326. return value;
  44327. }
  44328. function readDataBlock() {
  44329. var length = readUint16();
  44330. var array = data.subarray(offset, offset + length - 2);
  44331. offset += array.length;
  44332. return array;
  44333. }
  44334. function prepareComponents(frame) {
  44335. var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  44336. var mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  44337. for (var i = 0; i < frame.components.length; i++) {
  44338. component = frame.components[i];
  44339. var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  44340. var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  44341. var blocksPerLineForMcu = mcusPerLine * component.h;
  44342. var blocksPerColumnForMcu = mcusPerColumn * component.v;
  44343. var blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  44344. component.blockData = new Int16Array(blocksBufferSize);
  44345. component.blocksPerLine = blocksPerLine;
  44346. component.blocksPerColumn = blocksPerColumn;
  44347. }
  44348. frame.mcusPerLine = mcusPerLine;
  44349. frame.mcusPerColumn = mcusPerColumn;
  44350. }
  44351. var offset = 0;
  44352. var jfif = null;
  44353. var adobe = null;
  44354. var frame, resetInterval;
  44355. var quantizationTables = [];
  44356. var huffmanTablesAC = [], huffmanTablesDC = [];
  44357. var fileMarker = readUint16();
  44358. if (fileMarker !== 0xFFD8) {
  44359. error('JPEG error: SOI not found');
  44360. }
  44361. fileMarker = readUint16();
  44362. while (fileMarker !== 0xFFD9) {
  44363. var i, j, l;
  44364. switch (fileMarker) {
  44365. case 0xFFE0:
  44366. case 0xFFE1:
  44367. case 0xFFE2:
  44368. case 0xFFE3:
  44369. case 0xFFE4:
  44370. case 0xFFE5:
  44371. case 0xFFE6:
  44372. case 0xFFE7:
  44373. case 0xFFE8:
  44374. case 0xFFE9:
  44375. case 0xFFEA:
  44376. case 0xFFEB:
  44377. case 0xFFEC:
  44378. case 0xFFED:
  44379. case 0xFFEE:
  44380. case 0xFFEF:
  44381. case 0xFFFE:
  44382. var appData = readDataBlock();
  44383. if (fileMarker === 0xFFE0) {
  44384. if (appData[0] === 0x4A && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  44385. jfif = {
  44386. version: {
  44387. major: appData[5],
  44388. minor: appData[6]
  44389. },
  44390. densityUnits: appData[7],
  44391. xDensity: appData[8] << 8 | appData[9],
  44392. yDensity: appData[10] << 8 | appData[11],
  44393. thumbWidth: appData[12],
  44394. thumbHeight: appData[13],
  44395. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  44396. };
  44397. }
  44398. }
  44399. if (fileMarker === 0xFFEE) {
  44400. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6F && appData[3] === 0x62 && appData[4] === 0x65) {
  44401. adobe = {
  44402. version: appData[5] << 8 | appData[6],
  44403. flags0: appData[7] << 8 | appData[8],
  44404. flags1: appData[9] << 8 | appData[10],
  44405. transformCode: appData[11]
  44406. };
  44407. }
  44408. }
  44409. break;
  44410. case 0xFFDB:
  44411. var quantizationTablesLength = readUint16();
  44412. var quantizationTablesEnd = quantizationTablesLength + offset - 2;
  44413. var z;
  44414. while (offset < quantizationTablesEnd) {
  44415. var quantizationTableSpec = data[offset++];
  44416. var tableData = new Uint16Array(64);
  44417. if (quantizationTableSpec >> 4 === 0) {
  44418. for (j = 0; j < 64; j++) {
  44419. z = dctZigZag[j];
  44420. tableData[z] = data[offset++];
  44421. }
  44422. } else if (quantizationTableSpec >> 4 === 1) {
  44423. for (j = 0; j < 64; j++) {
  44424. z = dctZigZag[j];
  44425. tableData[z] = readUint16();
  44426. }
  44427. } else {
  44428. error('JPEG error: DQT - invalid table spec');
  44429. }
  44430. quantizationTables[quantizationTableSpec & 15] = tableData;
  44431. }
  44432. break;
  44433. case 0xFFC0:
  44434. case 0xFFC1:
  44435. case 0xFFC2:
  44436. if (frame) {
  44437. error('JPEG error: Only single frame JPEGs supported');
  44438. }
  44439. readUint16();
  44440. frame = {};
  44441. frame.extended = fileMarker === 0xFFC1;
  44442. frame.progressive = fileMarker === 0xFFC2;
  44443. frame.precision = data[offset++];
  44444. frame.scanLines = readUint16();
  44445. frame.samplesPerLine = readUint16();
  44446. frame.components = [];
  44447. frame.componentIds = {};
  44448. var componentsCount = data[offset++], componentId;
  44449. var maxH = 0, maxV = 0;
  44450. for (i = 0; i < componentsCount; i++) {
  44451. componentId = data[offset];
  44452. var h = data[offset + 1] >> 4;
  44453. var v = data[offset + 1] & 15;
  44454. if (maxH < h) {
  44455. maxH = h;
  44456. }
  44457. if (maxV < v) {
  44458. maxV = v;
  44459. }
  44460. var qId = data[offset + 2];
  44461. l = frame.components.push({
  44462. h: h,
  44463. v: v,
  44464. quantizationId: qId,
  44465. quantizationTable: null
  44466. });
  44467. frame.componentIds[componentId] = l - 1;
  44468. offset += 3;
  44469. }
  44470. frame.maxH = maxH;
  44471. frame.maxV = maxV;
  44472. prepareComponents(frame);
  44473. break;
  44474. case 0xFFC4:
  44475. var huffmanLength = readUint16();
  44476. for (i = 2; i < huffmanLength;) {
  44477. var huffmanTableSpec = data[offset++];
  44478. var codeLengths = new Uint8Array(16);
  44479. var codeLengthSum = 0;
  44480. for (j = 0; j < 16; j++, offset++) {
  44481. codeLengthSum += codeLengths[j] = data[offset];
  44482. }
  44483. var huffmanValues = new Uint8Array(codeLengthSum);
  44484. for (j = 0; j < codeLengthSum; j++, offset++) {
  44485. huffmanValues[j] = data[offset];
  44486. }
  44487. i += 17 + codeLengthSum;
  44488. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  44489. }
  44490. break;
  44491. case 0xFFDD:
  44492. readUint16();
  44493. resetInterval = readUint16();
  44494. break;
  44495. case 0xFFDA:
  44496. readUint16();
  44497. var selectorsCount = data[offset++];
  44498. var components = [], component;
  44499. for (i = 0; i < selectorsCount; i++) {
  44500. var componentIndex = frame.componentIds[data[offset++]];
  44501. component = frame.components[componentIndex];
  44502. var tableSpec = data[offset++];
  44503. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  44504. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  44505. components.push(component);
  44506. }
  44507. var spectralStart = data[offset++];
  44508. var spectralEnd = data[offset++];
  44509. var successiveApproximation = data[offset++];
  44510. var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15);
  44511. offset += processed;
  44512. break;
  44513. case 0xFFFF:
  44514. if (data[offset] !== 0xFF) {
  44515. offset--;
  44516. }
  44517. break;
  44518. default:
  44519. if (data[offset - 3] === 0xFF && data[offset - 2] >= 0xC0 && data[offset - 2] <= 0xFE) {
  44520. offset -= 3;
  44521. break;
  44522. }
  44523. error('JPEG error: unknown marker ' + fileMarker.toString(16));
  44524. }
  44525. fileMarker = readUint16();
  44526. }
  44527. this.width = frame.samplesPerLine;
  44528. this.height = frame.scanLines;
  44529. this.jfif = jfif;
  44530. this.adobe = adobe;
  44531. this.components = [];
  44532. for (i = 0; i < frame.components.length; i++) {
  44533. component = frame.components[i];
  44534. var quantizationTable = quantizationTables[component.quantizationId];
  44535. if (quantizationTable) {
  44536. component.quantizationTable = quantizationTable;
  44537. }
  44538. this.components.push({
  44539. output: buildComponentData(frame, component),
  44540. scaleX: component.h / frame.maxH,
  44541. scaleY: component.v / frame.maxV,
  44542. blocksPerLine: component.blocksPerLine,
  44543. blocksPerColumn: component.blocksPerColumn
  44544. });
  44545. }
  44546. this.numComponents = this.components.length;
  44547. },
  44548. _getLinearizedBlockData: function getLinearizedBlockData(width, height) {
  44549. var scaleX = this.width / width, scaleY = this.height / height;
  44550. var component, componentScaleX, componentScaleY, blocksPerScanline;
  44551. var x, y, i, j, k;
  44552. var index;
  44553. var offset = 0;
  44554. var output;
  44555. var numComponents = this.components.length;
  44556. var dataLength = width * height * numComponents;
  44557. var data = new Uint8Array(dataLength);
  44558. var xScaleBlockOffset = new Uint32Array(width);
  44559. var mask3LSB = 0xfffffff8;
  44560. for (i = 0; i < numComponents; i++) {
  44561. component = this.components[i];
  44562. componentScaleX = component.scaleX * scaleX;
  44563. componentScaleY = component.scaleY * scaleY;
  44564. offset = i;
  44565. output = component.output;
  44566. blocksPerScanline = component.blocksPerLine + 1 << 3;
  44567. for (x = 0; x < width; x++) {
  44568. j = 0 | x * componentScaleX;
  44569. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  44570. }
  44571. for (y = 0; y < height; y++) {
  44572. j = 0 | y * componentScaleY;
  44573. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  44574. for (x = 0; x < width; x++) {
  44575. data[offset] = output[index + xScaleBlockOffset[x]];
  44576. offset += numComponents;
  44577. }
  44578. }
  44579. }
  44580. var transform = this.decodeTransform;
  44581. if (transform) {
  44582. for (i = 0; i < dataLength;) {
  44583. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  44584. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  44585. }
  44586. }
  44587. }
  44588. return data;
  44589. },
  44590. _isColorConversionNeeded: function isColorConversionNeeded() {
  44591. if (this.adobe && this.adobe.transformCode) {
  44592. return true;
  44593. } else if (this.numComponents === 3) {
  44594. if (!this.adobe && this.colorTransform === 0) {
  44595. return false;
  44596. }
  44597. return true;
  44598. }
  44599. if (!this.adobe && this.colorTransform === 1) {
  44600. return true;
  44601. }
  44602. return false;
  44603. },
  44604. _convertYccToRgb: function convertYccToRgb(data) {
  44605. var Y, Cb, Cr;
  44606. for (var i = 0, length = data.length; i < length; i += 3) {
  44607. Y = data[i];
  44608. Cb = data[i + 1];
  44609. Cr = data[i + 2];
  44610. data[i] = clamp0to255(Y - 179.456 + 1.402 * Cr);
  44611. data[i + 1] = clamp0to255(Y + 135.459 - 0.344 * Cb - 0.714 * Cr);
  44612. data[i + 2] = clamp0to255(Y - 226.816 + 1.772 * Cb);
  44613. }
  44614. return data;
  44615. },
  44616. _convertYcckToRgb: function convertYcckToRgb(data) {
  44617. var Y, Cb, Cr, k;
  44618. var offset = 0;
  44619. for (var i = 0, length = data.length; i < length; i += 4) {
  44620. Y = data[i];
  44621. Cb = data[i + 1];
  44622. Cr = data[i + 2];
  44623. k = data[i + 3];
  44624. 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);
  44625. 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);
  44626. 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);
  44627. data[offset++] = clamp0to255(r);
  44628. data[offset++] = clamp0to255(g);
  44629. data[offset++] = clamp0to255(b);
  44630. }
  44631. return data;
  44632. },
  44633. _convertYcckToCmyk: function convertYcckToCmyk(data) {
  44634. var Y, Cb, Cr;
  44635. for (var i = 0, length = data.length; i < length; i += 4) {
  44636. Y = data[i];
  44637. Cb = data[i + 1];
  44638. Cr = data[i + 2];
  44639. data[i] = clamp0to255(434.456 - Y - 1.402 * Cr);
  44640. data[i + 1] = clamp0to255(119.541 - Y + 0.344 * Cb + 0.714 * Cr);
  44641. data[i + 2] = clamp0to255(481.816 - Y - 1.772 * Cb);
  44642. }
  44643. return data;
  44644. },
  44645. _convertCmykToRgb: function convertCmykToRgb(data) {
  44646. var c, m, y, k;
  44647. var offset = 0;
  44648. var min = -255 * 255 * 255;
  44649. var scale = 1 / 255 / 255;
  44650. for (var i = 0, length = data.length; i < length; i += 4) {
  44651. c = data[i];
  44652. m = data[i + 1];
  44653. y = data[i + 2];
  44654. k = data[i + 3];
  44655. 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);
  44656. 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);
  44657. 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);
  44658. data[offset++] = r >= 0 ? 255 : r <= min ? 0 : 255 + r * scale | 0;
  44659. data[offset++] = g >= 0 ? 255 : g <= min ? 0 : 255 + g * scale | 0;
  44660. data[offset++] = b >= 0 ? 255 : b <= min ? 0 : 255 + b * scale | 0;
  44661. }
  44662. return data;
  44663. },
  44664. getData: function getData(width, height, forceRGBoutput) {
  44665. if (this.numComponents > 4) {
  44666. error('JPEG error: Unsupported color mode');
  44667. }
  44668. var data = this._getLinearizedBlockData(width, height);
  44669. if (this.numComponents === 1 && forceRGBoutput) {
  44670. var dataLength = data.length;
  44671. var rgbData = new Uint8Array(dataLength * 3);
  44672. var offset = 0;
  44673. for (var i = 0; i < dataLength; i++) {
  44674. var grayColor = data[i];
  44675. rgbData[offset++] = grayColor;
  44676. rgbData[offset++] = grayColor;
  44677. rgbData[offset++] = grayColor;
  44678. }
  44679. return rgbData;
  44680. } else if (this.numComponents === 3 && this._isColorConversionNeeded()) {
  44681. return this._convertYccToRgb(data);
  44682. } else if (this.numComponents === 4) {
  44683. if (this._isColorConversionNeeded()) {
  44684. if (forceRGBoutput) {
  44685. return this._convertYcckToRgb(data);
  44686. }
  44687. return this._convertYcckToCmyk(data);
  44688. } else if (forceRGBoutput) {
  44689. return this._convertCmykToRgb(data);
  44690. }
  44691. }
  44692. return data;
  44693. }
  44694. };
  44695. return JpegImage;
  44696. }();
  44697. exports.JpegImage = JpegImage;
  44698. /***/ }),
  44699. /* 30 */
  44700. /***/ (function(module, exports, __w_pdfjs_require__) {
  44701. "use strict";
  44702. var sharedUtil = __w_pdfjs_require__(0);
  44703. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  44704. var getMetrics = getLookupTableFactory(function (t) {
  44705. t['Courier'] = 600;
  44706. t['Courier-Bold'] = 600;
  44707. t['Courier-BoldOblique'] = 600;
  44708. t['Courier-Oblique'] = 600;
  44709. t['Helvetica'] = getLookupTableFactory(function (t) {
  44710. t['space'] = 278;
  44711. t['exclam'] = 278;
  44712. t['quotedbl'] = 355;
  44713. t['numbersign'] = 556;
  44714. t['dollar'] = 556;
  44715. t['percent'] = 889;
  44716. t['ampersand'] = 667;
  44717. t['quoteright'] = 222;
  44718. t['parenleft'] = 333;
  44719. t['parenright'] = 333;
  44720. t['asterisk'] = 389;
  44721. t['plus'] = 584;
  44722. t['comma'] = 278;
  44723. t['hyphen'] = 333;
  44724. t['period'] = 278;
  44725. t['slash'] = 278;
  44726. t['zero'] = 556;
  44727. t['one'] = 556;
  44728. t['two'] = 556;
  44729. t['three'] = 556;
  44730. t['four'] = 556;
  44731. t['five'] = 556;
  44732. t['six'] = 556;
  44733. t['seven'] = 556;
  44734. t['eight'] = 556;
  44735. t['nine'] = 556;
  44736. t['colon'] = 278;
  44737. t['semicolon'] = 278;
  44738. t['less'] = 584;
  44739. t['equal'] = 584;
  44740. t['greater'] = 584;
  44741. t['question'] = 556;
  44742. t['at'] = 1015;
  44743. t['A'] = 667;
  44744. t['B'] = 667;
  44745. t['C'] = 722;
  44746. t['D'] = 722;
  44747. t['E'] = 667;
  44748. t['F'] = 611;
  44749. t['G'] = 778;
  44750. t['H'] = 722;
  44751. t['I'] = 278;
  44752. t['J'] = 500;
  44753. t['K'] = 667;
  44754. t['L'] = 556;
  44755. t['M'] = 833;
  44756. t['N'] = 722;
  44757. t['O'] = 778;
  44758. t['P'] = 667;
  44759. t['Q'] = 778;
  44760. t['R'] = 722;
  44761. t['S'] = 667;
  44762. t['T'] = 611;
  44763. t['U'] = 722;
  44764. t['V'] = 667;
  44765. t['W'] = 944;
  44766. t['X'] = 667;
  44767. t['Y'] = 667;
  44768. t['Z'] = 611;
  44769. t['bracketleft'] = 278;
  44770. t['backslash'] = 278;
  44771. t['bracketright'] = 278;
  44772. t['asciicircum'] = 469;
  44773. t['underscore'] = 556;
  44774. t['quoteleft'] = 222;
  44775. t['a'] = 556;
  44776. t['b'] = 556;
  44777. t['c'] = 500;
  44778. t['d'] = 556;
  44779. t['e'] = 556;
  44780. t['f'] = 278;
  44781. t['g'] = 556;
  44782. t['h'] = 556;
  44783. t['i'] = 222;
  44784. t['j'] = 222;
  44785. t['k'] = 500;
  44786. t['l'] = 222;
  44787. t['m'] = 833;
  44788. t['n'] = 556;
  44789. t['o'] = 556;
  44790. t['p'] = 556;
  44791. t['q'] = 556;
  44792. t['r'] = 333;
  44793. t['s'] = 500;
  44794. t['t'] = 278;
  44795. t['u'] = 556;
  44796. t['v'] = 500;
  44797. t['w'] = 722;
  44798. t['x'] = 500;
  44799. t['y'] = 500;
  44800. t['z'] = 500;
  44801. t['braceleft'] = 334;
  44802. t['bar'] = 260;
  44803. t['braceright'] = 334;
  44804. t['asciitilde'] = 584;
  44805. t['exclamdown'] = 333;
  44806. t['cent'] = 556;
  44807. t['sterling'] = 556;
  44808. t['fraction'] = 167;
  44809. t['yen'] = 556;
  44810. t['florin'] = 556;
  44811. t['section'] = 556;
  44812. t['currency'] = 556;
  44813. t['quotesingle'] = 191;
  44814. t['quotedblleft'] = 333;
  44815. t['guillemotleft'] = 556;
  44816. t['guilsinglleft'] = 333;
  44817. t['guilsinglright'] = 333;
  44818. t['fi'] = 500;
  44819. t['fl'] = 500;
  44820. t['endash'] = 556;
  44821. t['dagger'] = 556;
  44822. t['daggerdbl'] = 556;
  44823. t['periodcentered'] = 278;
  44824. t['paragraph'] = 537;
  44825. t['bullet'] = 350;
  44826. t['quotesinglbase'] = 222;
  44827. t['quotedblbase'] = 333;
  44828. t['quotedblright'] = 333;
  44829. t['guillemotright'] = 556;
  44830. t['ellipsis'] = 1000;
  44831. t['perthousand'] = 1000;
  44832. t['questiondown'] = 611;
  44833. t['grave'] = 333;
  44834. t['acute'] = 333;
  44835. t['circumflex'] = 333;
  44836. t['tilde'] = 333;
  44837. t['macron'] = 333;
  44838. t['breve'] = 333;
  44839. t['dotaccent'] = 333;
  44840. t['dieresis'] = 333;
  44841. t['ring'] = 333;
  44842. t['cedilla'] = 333;
  44843. t['hungarumlaut'] = 333;
  44844. t['ogonek'] = 333;
  44845. t['caron'] = 333;
  44846. t['emdash'] = 1000;
  44847. t['AE'] = 1000;
  44848. t['ordfeminine'] = 370;
  44849. t['Lslash'] = 556;
  44850. t['Oslash'] = 778;
  44851. t['OE'] = 1000;
  44852. t['ordmasculine'] = 365;
  44853. t['ae'] = 889;
  44854. t['dotlessi'] = 278;
  44855. t['lslash'] = 222;
  44856. t['oslash'] = 611;
  44857. t['oe'] = 944;
  44858. t['germandbls'] = 611;
  44859. t['Idieresis'] = 278;
  44860. t['eacute'] = 556;
  44861. t['abreve'] = 556;
  44862. t['uhungarumlaut'] = 556;
  44863. t['ecaron'] = 556;
  44864. t['Ydieresis'] = 667;
  44865. t['divide'] = 584;
  44866. t['Yacute'] = 667;
  44867. t['Acircumflex'] = 667;
  44868. t['aacute'] = 556;
  44869. t['Ucircumflex'] = 722;
  44870. t['yacute'] = 500;
  44871. t['scommaaccent'] = 500;
  44872. t['ecircumflex'] = 556;
  44873. t['Uring'] = 722;
  44874. t['Udieresis'] = 722;
  44875. t['aogonek'] = 556;
  44876. t['Uacute'] = 722;
  44877. t['uogonek'] = 556;
  44878. t['Edieresis'] = 667;
  44879. t['Dcroat'] = 722;
  44880. t['commaaccent'] = 250;
  44881. t['copyright'] = 737;
  44882. t['Emacron'] = 667;
  44883. t['ccaron'] = 500;
  44884. t['aring'] = 556;
  44885. t['Ncommaaccent'] = 722;
  44886. t['lacute'] = 222;
  44887. t['agrave'] = 556;
  44888. t['Tcommaaccent'] = 611;
  44889. t['Cacute'] = 722;
  44890. t['atilde'] = 556;
  44891. t['Edotaccent'] = 667;
  44892. t['scaron'] = 500;
  44893. t['scedilla'] = 500;
  44894. t['iacute'] = 278;
  44895. t['lozenge'] = 471;
  44896. t['Rcaron'] = 722;
  44897. t['Gcommaaccent'] = 778;
  44898. t['ucircumflex'] = 556;
  44899. t['acircumflex'] = 556;
  44900. t['Amacron'] = 667;
  44901. t['rcaron'] = 333;
  44902. t['ccedilla'] = 500;
  44903. t['Zdotaccent'] = 611;
  44904. t['Thorn'] = 667;
  44905. t['Omacron'] = 778;
  44906. t['Racute'] = 722;
  44907. t['Sacute'] = 667;
  44908. t['dcaron'] = 643;
  44909. t['Umacron'] = 722;
  44910. t['uring'] = 556;
  44911. t['threesuperior'] = 333;
  44912. t['Ograve'] = 778;
  44913. t['Agrave'] = 667;
  44914. t['Abreve'] = 667;
  44915. t['multiply'] = 584;
  44916. t['uacute'] = 556;
  44917. t['Tcaron'] = 611;
  44918. t['partialdiff'] = 476;
  44919. t['ydieresis'] = 500;
  44920. t['Nacute'] = 722;
  44921. t['icircumflex'] = 278;
  44922. t['Ecircumflex'] = 667;
  44923. t['adieresis'] = 556;
  44924. t['edieresis'] = 556;
  44925. t['cacute'] = 500;
  44926. t['nacute'] = 556;
  44927. t['umacron'] = 556;
  44928. t['Ncaron'] = 722;
  44929. t['Iacute'] = 278;
  44930. t['plusminus'] = 584;
  44931. t['brokenbar'] = 260;
  44932. t['registered'] = 737;
  44933. t['Gbreve'] = 778;
  44934. t['Idotaccent'] = 278;
  44935. t['summation'] = 600;
  44936. t['Egrave'] = 667;
  44937. t['racute'] = 333;
  44938. t['omacron'] = 556;
  44939. t['Zacute'] = 611;
  44940. t['Zcaron'] = 611;
  44941. t['greaterequal'] = 549;
  44942. t['Eth'] = 722;
  44943. t['Ccedilla'] = 722;
  44944. t['lcommaaccent'] = 222;
  44945. t['tcaron'] = 317;
  44946. t['eogonek'] = 556;
  44947. t['Uogonek'] = 722;
  44948. t['Aacute'] = 667;
  44949. t['Adieresis'] = 667;
  44950. t['egrave'] = 556;
  44951. t['zacute'] = 500;
  44952. t['iogonek'] = 222;
  44953. t['Oacute'] = 778;
  44954. t['oacute'] = 556;
  44955. t['amacron'] = 556;
  44956. t['sacute'] = 500;
  44957. t['idieresis'] = 278;
  44958. t['Ocircumflex'] = 778;
  44959. t['Ugrave'] = 722;
  44960. t['Delta'] = 612;
  44961. t['thorn'] = 556;
  44962. t['twosuperior'] = 333;
  44963. t['Odieresis'] = 778;
  44964. t['mu'] = 556;
  44965. t['igrave'] = 278;
  44966. t['ohungarumlaut'] = 556;
  44967. t['Eogonek'] = 667;
  44968. t['dcroat'] = 556;
  44969. t['threequarters'] = 834;
  44970. t['Scedilla'] = 667;
  44971. t['lcaron'] = 299;
  44972. t['Kcommaaccent'] = 667;
  44973. t['Lacute'] = 556;
  44974. t['trademark'] = 1000;
  44975. t['edotaccent'] = 556;
  44976. t['Igrave'] = 278;
  44977. t['Imacron'] = 278;
  44978. t['Lcaron'] = 556;
  44979. t['onehalf'] = 834;
  44980. t['lessequal'] = 549;
  44981. t['ocircumflex'] = 556;
  44982. t['ntilde'] = 556;
  44983. t['Uhungarumlaut'] = 722;
  44984. t['Eacute'] = 667;
  44985. t['emacron'] = 556;
  44986. t['gbreve'] = 556;
  44987. t['onequarter'] = 834;
  44988. t['Scaron'] = 667;
  44989. t['Scommaaccent'] = 667;
  44990. t['Ohungarumlaut'] = 778;
  44991. t['degree'] = 400;
  44992. t['ograve'] = 556;
  44993. t['Ccaron'] = 722;
  44994. t['ugrave'] = 556;
  44995. t['radical'] = 453;
  44996. t['Dcaron'] = 722;
  44997. t['rcommaaccent'] = 333;
  44998. t['Ntilde'] = 722;
  44999. t['otilde'] = 556;
  45000. t['Rcommaaccent'] = 722;
  45001. t['Lcommaaccent'] = 556;
  45002. t['Atilde'] = 667;
  45003. t['Aogonek'] = 667;
  45004. t['Aring'] = 667;
  45005. t['Otilde'] = 778;
  45006. t['zdotaccent'] = 500;
  45007. t['Ecaron'] = 667;
  45008. t['Iogonek'] = 278;
  45009. t['kcommaaccent'] = 500;
  45010. t['minus'] = 584;
  45011. t['Icircumflex'] = 278;
  45012. t['ncaron'] = 556;
  45013. t['tcommaaccent'] = 278;
  45014. t['logicalnot'] = 584;
  45015. t['odieresis'] = 556;
  45016. t['udieresis'] = 556;
  45017. t['notequal'] = 549;
  45018. t['gcommaaccent'] = 556;
  45019. t['eth'] = 556;
  45020. t['zcaron'] = 500;
  45021. t['ncommaaccent'] = 556;
  45022. t['onesuperior'] = 333;
  45023. t['imacron'] = 278;
  45024. t['Euro'] = 556;
  45025. });
  45026. t['Helvetica-Bold'] = getLookupTableFactory(function (t) {
  45027. t['space'] = 278;
  45028. t['exclam'] = 333;
  45029. t['quotedbl'] = 474;
  45030. t['numbersign'] = 556;
  45031. t['dollar'] = 556;
  45032. t['percent'] = 889;
  45033. t['ampersand'] = 722;
  45034. t['quoteright'] = 278;
  45035. t['parenleft'] = 333;
  45036. t['parenright'] = 333;
  45037. t['asterisk'] = 389;
  45038. t['plus'] = 584;
  45039. t['comma'] = 278;
  45040. t['hyphen'] = 333;
  45041. t['period'] = 278;
  45042. t['slash'] = 278;
  45043. t['zero'] = 556;
  45044. t['one'] = 556;
  45045. t['two'] = 556;
  45046. t['three'] = 556;
  45047. t['four'] = 556;
  45048. t['five'] = 556;
  45049. t['six'] = 556;
  45050. t['seven'] = 556;
  45051. t['eight'] = 556;
  45052. t['nine'] = 556;
  45053. t['colon'] = 333;
  45054. t['semicolon'] = 333;
  45055. t['less'] = 584;
  45056. t['equal'] = 584;
  45057. t['greater'] = 584;
  45058. t['question'] = 611;
  45059. t['at'] = 975;
  45060. t['A'] = 722;
  45061. t['B'] = 722;
  45062. t['C'] = 722;
  45063. t['D'] = 722;
  45064. t['E'] = 667;
  45065. t['F'] = 611;
  45066. t['G'] = 778;
  45067. t['H'] = 722;
  45068. t['I'] = 278;
  45069. t['J'] = 556;
  45070. t['K'] = 722;
  45071. t['L'] = 611;
  45072. t['M'] = 833;
  45073. t['N'] = 722;
  45074. t['O'] = 778;
  45075. t['P'] = 667;
  45076. t['Q'] = 778;
  45077. t['R'] = 722;
  45078. t['S'] = 667;
  45079. t['T'] = 611;
  45080. t['U'] = 722;
  45081. t['V'] = 667;
  45082. t['W'] = 944;
  45083. t['X'] = 667;
  45084. t['Y'] = 667;
  45085. t['Z'] = 611;
  45086. t['bracketleft'] = 333;
  45087. t['backslash'] = 278;
  45088. t['bracketright'] = 333;
  45089. t['asciicircum'] = 584;
  45090. t['underscore'] = 556;
  45091. t['quoteleft'] = 278;
  45092. t['a'] = 556;
  45093. t['b'] = 611;
  45094. t['c'] = 556;
  45095. t['d'] = 611;
  45096. t['e'] = 556;
  45097. t['f'] = 333;
  45098. t['g'] = 611;
  45099. t['h'] = 611;
  45100. t['i'] = 278;
  45101. t['j'] = 278;
  45102. t['k'] = 556;
  45103. t['l'] = 278;
  45104. t['m'] = 889;
  45105. t['n'] = 611;
  45106. t['o'] = 611;
  45107. t['p'] = 611;
  45108. t['q'] = 611;
  45109. t['r'] = 389;
  45110. t['s'] = 556;
  45111. t['t'] = 333;
  45112. t['u'] = 611;
  45113. t['v'] = 556;
  45114. t['w'] = 778;
  45115. t['x'] = 556;
  45116. t['y'] = 556;
  45117. t['z'] = 500;
  45118. t['braceleft'] = 389;
  45119. t['bar'] = 280;
  45120. t['braceright'] = 389;
  45121. t['asciitilde'] = 584;
  45122. t['exclamdown'] = 333;
  45123. t['cent'] = 556;
  45124. t['sterling'] = 556;
  45125. t['fraction'] = 167;
  45126. t['yen'] = 556;
  45127. t['florin'] = 556;
  45128. t['section'] = 556;
  45129. t['currency'] = 556;
  45130. t['quotesingle'] = 238;
  45131. t['quotedblleft'] = 500;
  45132. t['guillemotleft'] = 556;
  45133. t['guilsinglleft'] = 333;
  45134. t['guilsinglright'] = 333;
  45135. t['fi'] = 611;
  45136. t['fl'] = 611;
  45137. t['endash'] = 556;
  45138. t['dagger'] = 556;
  45139. t['daggerdbl'] = 556;
  45140. t['periodcentered'] = 278;
  45141. t['paragraph'] = 556;
  45142. t['bullet'] = 350;
  45143. t['quotesinglbase'] = 278;
  45144. t['quotedblbase'] = 500;
  45145. t['quotedblright'] = 500;
  45146. t['guillemotright'] = 556;
  45147. t['ellipsis'] = 1000;
  45148. t['perthousand'] = 1000;
  45149. t['questiondown'] = 611;
  45150. t['grave'] = 333;
  45151. t['acute'] = 333;
  45152. t['circumflex'] = 333;
  45153. t['tilde'] = 333;
  45154. t['macron'] = 333;
  45155. t['breve'] = 333;
  45156. t['dotaccent'] = 333;
  45157. t['dieresis'] = 333;
  45158. t['ring'] = 333;
  45159. t['cedilla'] = 333;
  45160. t['hungarumlaut'] = 333;
  45161. t['ogonek'] = 333;
  45162. t['caron'] = 333;
  45163. t['emdash'] = 1000;
  45164. t['AE'] = 1000;
  45165. t['ordfeminine'] = 370;
  45166. t['Lslash'] = 611;
  45167. t['Oslash'] = 778;
  45168. t['OE'] = 1000;
  45169. t['ordmasculine'] = 365;
  45170. t['ae'] = 889;
  45171. t['dotlessi'] = 278;
  45172. t['lslash'] = 278;
  45173. t['oslash'] = 611;
  45174. t['oe'] = 944;
  45175. t['germandbls'] = 611;
  45176. t['Idieresis'] = 278;
  45177. t['eacute'] = 556;
  45178. t['abreve'] = 556;
  45179. t['uhungarumlaut'] = 611;
  45180. t['ecaron'] = 556;
  45181. t['Ydieresis'] = 667;
  45182. t['divide'] = 584;
  45183. t['Yacute'] = 667;
  45184. t['Acircumflex'] = 722;
  45185. t['aacute'] = 556;
  45186. t['Ucircumflex'] = 722;
  45187. t['yacute'] = 556;
  45188. t['scommaaccent'] = 556;
  45189. t['ecircumflex'] = 556;
  45190. t['Uring'] = 722;
  45191. t['Udieresis'] = 722;
  45192. t['aogonek'] = 556;
  45193. t['Uacute'] = 722;
  45194. t['uogonek'] = 611;
  45195. t['Edieresis'] = 667;
  45196. t['Dcroat'] = 722;
  45197. t['commaaccent'] = 250;
  45198. t['copyright'] = 737;
  45199. t['Emacron'] = 667;
  45200. t['ccaron'] = 556;
  45201. t['aring'] = 556;
  45202. t['Ncommaaccent'] = 722;
  45203. t['lacute'] = 278;
  45204. t['agrave'] = 556;
  45205. t['Tcommaaccent'] = 611;
  45206. t['Cacute'] = 722;
  45207. t['atilde'] = 556;
  45208. t['Edotaccent'] = 667;
  45209. t['scaron'] = 556;
  45210. t['scedilla'] = 556;
  45211. t['iacute'] = 278;
  45212. t['lozenge'] = 494;
  45213. t['Rcaron'] = 722;
  45214. t['Gcommaaccent'] = 778;
  45215. t['ucircumflex'] = 611;
  45216. t['acircumflex'] = 556;
  45217. t['Amacron'] = 722;
  45218. t['rcaron'] = 389;
  45219. t['ccedilla'] = 556;
  45220. t['Zdotaccent'] = 611;
  45221. t['Thorn'] = 667;
  45222. t['Omacron'] = 778;
  45223. t['Racute'] = 722;
  45224. t['Sacute'] = 667;
  45225. t['dcaron'] = 743;
  45226. t['Umacron'] = 722;
  45227. t['uring'] = 611;
  45228. t['threesuperior'] = 333;
  45229. t['Ograve'] = 778;
  45230. t['Agrave'] = 722;
  45231. t['Abreve'] = 722;
  45232. t['multiply'] = 584;
  45233. t['uacute'] = 611;
  45234. t['Tcaron'] = 611;
  45235. t['partialdiff'] = 494;
  45236. t['ydieresis'] = 556;
  45237. t['Nacute'] = 722;
  45238. t['icircumflex'] = 278;
  45239. t['Ecircumflex'] = 667;
  45240. t['adieresis'] = 556;
  45241. t['edieresis'] = 556;
  45242. t['cacute'] = 556;
  45243. t['nacute'] = 611;
  45244. t['umacron'] = 611;
  45245. t['Ncaron'] = 722;
  45246. t['Iacute'] = 278;
  45247. t['plusminus'] = 584;
  45248. t['brokenbar'] = 280;
  45249. t['registered'] = 737;
  45250. t['Gbreve'] = 778;
  45251. t['Idotaccent'] = 278;
  45252. t['summation'] = 600;
  45253. t['Egrave'] = 667;
  45254. t['racute'] = 389;
  45255. t['omacron'] = 611;
  45256. t['Zacute'] = 611;
  45257. t['Zcaron'] = 611;
  45258. t['greaterequal'] = 549;
  45259. t['Eth'] = 722;
  45260. t['Ccedilla'] = 722;
  45261. t['lcommaaccent'] = 278;
  45262. t['tcaron'] = 389;
  45263. t['eogonek'] = 556;
  45264. t['Uogonek'] = 722;
  45265. t['Aacute'] = 722;
  45266. t['Adieresis'] = 722;
  45267. t['egrave'] = 556;
  45268. t['zacute'] = 500;
  45269. t['iogonek'] = 278;
  45270. t['Oacute'] = 778;
  45271. t['oacute'] = 611;
  45272. t['amacron'] = 556;
  45273. t['sacute'] = 556;
  45274. t['idieresis'] = 278;
  45275. t['Ocircumflex'] = 778;
  45276. t['Ugrave'] = 722;
  45277. t['Delta'] = 612;
  45278. t['thorn'] = 611;
  45279. t['twosuperior'] = 333;
  45280. t['Odieresis'] = 778;
  45281. t['mu'] = 611;
  45282. t['igrave'] = 278;
  45283. t['ohungarumlaut'] = 611;
  45284. t['Eogonek'] = 667;
  45285. t['dcroat'] = 611;
  45286. t['threequarters'] = 834;
  45287. t['Scedilla'] = 667;
  45288. t['lcaron'] = 400;
  45289. t['Kcommaaccent'] = 722;
  45290. t['Lacute'] = 611;
  45291. t['trademark'] = 1000;
  45292. t['edotaccent'] = 556;
  45293. t['Igrave'] = 278;
  45294. t['Imacron'] = 278;
  45295. t['Lcaron'] = 611;
  45296. t['onehalf'] = 834;
  45297. t['lessequal'] = 549;
  45298. t['ocircumflex'] = 611;
  45299. t['ntilde'] = 611;
  45300. t['Uhungarumlaut'] = 722;
  45301. t['Eacute'] = 667;
  45302. t['emacron'] = 556;
  45303. t['gbreve'] = 611;
  45304. t['onequarter'] = 834;
  45305. t['Scaron'] = 667;
  45306. t['Scommaaccent'] = 667;
  45307. t['Ohungarumlaut'] = 778;
  45308. t['degree'] = 400;
  45309. t['ograve'] = 611;
  45310. t['Ccaron'] = 722;
  45311. t['ugrave'] = 611;
  45312. t['radical'] = 549;
  45313. t['Dcaron'] = 722;
  45314. t['rcommaaccent'] = 389;
  45315. t['Ntilde'] = 722;
  45316. t['otilde'] = 611;
  45317. t['Rcommaaccent'] = 722;
  45318. t['Lcommaaccent'] = 611;
  45319. t['Atilde'] = 722;
  45320. t['Aogonek'] = 722;
  45321. t['Aring'] = 722;
  45322. t['Otilde'] = 778;
  45323. t['zdotaccent'] = 500;
  45324. t['Ecaron'] = 667;
  45325. t['Iogonek'] = 278;
  45326. t['kcommaaccent'] = 556;
  45327. t['minus'] = 584;
  45328. t['Icircumflex'] = 278;
  45329. t['ncaron'] = 611;
  45330. t['tcommaaccent'] = 333;
  45331. t['logicalnot'] = 584;
  45332. t['odieresis'] = 611;
  45333. t['udieresis'] = 611;
  45334. t['notequal'] = 549;
  45335. t['gcommaaccent'] = 611;
  45336. t['eth'] = 611;
  45337. t['zcaron'] = 500;
  45338. t['ncommaaccent'] = 611;
  45339. t['onesuperior'] = 333;
  45340. t['imacron'] = 278;
  45341. t['Euro'] = 556;
  45342. });
  45343. t['Helvetica-BoldOblique'] = getLookupTableFactory(function (t) {
  45344. t['space'] = 278;
  45345. t['exclam'] = 333;
  45346. t['quotedbl'] = 474;
  45347. t['numbersign'] = 556;
  45348. t['dollar'] = 556;
  45349. t['percent'] = 889;
  45350. t['ampersand'] = 722;
  45351. t['quoteright'] = 278;
  45352. t['parenleft'] = 333;
  45353. t['parenright'] = 333;
  45354. t['asterisk'] = 389;
  45355. t['plus'] = 584;
  45356. t['comma'] = 278;
  45357. t['hyphen'] = 333;
  45358. t['period'] = 278;
  45359. t['slash'] = 278;
  45360. t['zero'] = 556;
  45361. t['one'] = 556;
  45362. t['two'] = 556;
  45363. t['three'] = 556;
  45364. t['four'] = 556;
  45365. t['five'] = 556;
  45366. t['six'] = 556;
  45367. t['seven'] = 556;
  45368. t['eight'] = 556;
  45369. t['nine'] = 556;
  45370. t['colon'] = 333;
  45371. t['semicolon'] = 333;
  45372. t['less'] = 584;
  45373. t['equal'] = 584;
  45374. t['greater'] = 584;
  45375. t['question'] = 611;
  45376. t['at'] = 975;
  45377. t['A'] = 722;
  45378. t['B'] = 722;
  45379. t['C'] = 722;
  45380. t['D'] = 722;
  45381. t['E'] = 667;
  45382. t['F'] = 611;
  45383. t['G'] = 778;
  45384. t['H'] = 722;
  45385. t['I'] = 278;
  45386. t['J'] = 556;
  45387. t['K'] = 722;
  45388. t['L'] = 611;
  45389. t['M'] = 833;
  45390. t['N'] = 722;
  45391. t['O'] = 778;
  45392. t['P'] = 667;
  45393. t['Q'] = 778;
  45394. t['R'] = 722;
  45395. t['S'] = 667;
  45396. t['T'] = 611;
  45397. t['U'] = 722;
  45398. t['V'] = 667;
  45399. t['W'] = 944;
  45400. t['X'] = 667;
  45401. t['Y'] = 667;
  45402. t['Z'] = 611;
  45403. t['bracketleft'] = 333;
  45404. t['backslash'] = 278;
  45405. t['bracketright'] = 333;
  45406. t['asciicircum'] = 584;
  45407. t['underscore'] = 556;
  45408. t['quoteleft'] = 278;
  45409. t['a'] = 556;
  45410. t['b'] = 611;
  45411. t['c'] = 556;
  45412. t['d'] = 611;
  45413. t['e'] = 556;
  45414. t['f'] = 333;
  45415. t['g'] = 611;
  45416. t['h'] = 611;
  45417. t['i'] = 278;
  45418. t['j'] = 278;
  45419. t['k'] = 556;
  45420. t['l'] = 278;
  45421. t['m'] = 889;
  45422. t['n'] = 611;
  45423. t['o'] = 611;
  45424. t['p'] = 611;
  45425. t['q'] = 611;
  45426. t['r'] = 389;
  45427. t['s'] = 556;
  45428. t['t'] = 333;
  45429. t['u'] = 611;
  45430. t['v'] = 556;
  45431. t['w'] = 778;
  45432. t['x'] = 556;
  45433. t['y'] = 556;
  45434. t['z'] = 500;
  45435. t['braceleft'] = 389;
  45436. t['bar'] = 280;
  45437. t['braceright'] = 389;
  45438. t['asciitilde'] = 584;
  45439. t['exclamdown'] = 333;
  45440. t['cent'] = 556;
  45441. t['sterling'] = 556;
  45442. t['fraction'] = 167;
  45443. t['yen'] = 556;
  45444. t['florin'] = 556;
  45445. t['section'] = 556;
  45446. t['currency'] = 556;
  45447. t['quotesingle'] = 238;
  45448. t['quotedblleft'] = 500;
  45449. t['guillemotleft'] = 556;
  45450. t['guilsinglleft'] = 333;
  45451. t['guilsinglright'] = 333;
  45452. t['fi'] = 611;
  45453. t['fl'] = 611;
  45454. t['endash'] = 556;
  45455. t['dagger'] = 556;
  45456. t['daggerdbl'] = 556;
  45457. t['periodcentered'] = 278;
  45458. t['paragraph'] = 556;
  45459. t['bullet'] = 350;
  45460. t['quotesinglbase'] = 278;
  45461. t['quotedblbase'] = 500;
  45462. t['quotedblright'] = 500;
  45463. t['guillemotright'] = 556;
  45464. t['ellipsis'] = 1000;
  45465. t['perthousand'] = 1000;
  45466. t['questiondown'] = 611;
  45467. t['grave'] = 333;
  45468. t['acute'] = 333;
  45469. t['circumflex'] = 333;
  45470. t['tilde'] = 333;
  45471. t['macron'] = 333;
  45472. t['breve'] = 333;
  45473. t['dotaccent'] = 333;
  45474. t['dieresis'] = 333;
  45475. t['ring'] = 333;
  45476. t['cedilla'] = 333;
  45477. t['hungarumlaut'] = 333;
  45478. t['ogonek'] = 333;
  45479. t['caron'] = 333;
  45480. t['emdash'] = 1000;
  45481. t['AE'] = 1000;
  45482. t['ordfeminine'] = 370;
  45483. t['Lslash'] = 611;
  45484. t['Oslash'] = 778;
  45485. t['OE'] = 1000;
  45486. t['ordmasculine'] = 365;
  45487. t['ae'] = 889;
  45488. t['dotlessi'] = 278;
  45489. t['lslash'] = 278;
  45490. t['oslash'] = 611;
  45491. t['oe'] = 944;
  45492. t['germandbls'] = 611;
  45493. t['Idieresis'] = 278;
  45494. t['eacute'] = 556;
  45495. t['abreve'] = 556;
  45496. t['uhungarumlaut'] = 611;
  45497. t['ecaron'] = 556;
  45498. t['Ydieresis'] = 667;
  45499. t['divide'] = 584;
  45500. t['Yacute'] = 667;
  45501. t['Acircumflex'] = 722;
  45502. t['aacute'] = 556;
  45503. t['Ucircumflex'] = 722;
  45504. t['yacute'] = 556;
  45505. t['scommaaccent'] = 556;
  45506. t['ecircumflex'] = 556;
  45507. t['Uring'] = 722;
  45508. t['Udieresis'] = 722;
  45509. t['aogonek'] = 556;
  45510. t['Uacute'] = 722;
  45511. t['uogonek'] = 611;
  45512. t['Edieresis'] = 667;
  45513. t['Dcroat'] = 722;
  45514. t['commaaccent'] = 250;
  45515. t['copyright'] = 737;
  45516. t['Emacron'] = 667;
  45517. t['ccaron'] = 556;
  45518. t['aring'] = 556;
  45519. t['Ncommaaccent'] = 722;
  45520. t['lacute'] = 278;
  45521. t['agrave'] = 556;
  45522. t['Tcommaaccent'] = 611;
  45523. t['Cacute'] = 722;
  45524. t['atilde'] = 556;
  45525. t['Edotaccent'] = 667;
  45526. t['scaron'] = 556;
  45527. t['scedilla'] = 556;
  45528. t['iacute'] = 278;
  45529. t['lozenge'] = 494;
  45530. t['Rcaron'] = 722;
  45531. t['Gcommaaccent'] = 778;
  45532. t['ucircumflex'] = 611;
  45533. t['acircumflex'] = 556;
  45534. t['Amacron'] = 722;
  45535. t['rcaron'] = 389;
  45536. t['ccedilla'] = 556;
  45537. t['Zdotaccent'] = 611;
  45538. t['Thorn'] = 667;
  45539. t['Omacron'] = 778;
  45540. t['Racute'] = 722;
  45541. t['Sacute'] = 667;
  45542. t['dcaron'] = 743;
  45543. t['Umacron'] = 722;
  45544. t['uring'] = 611;
  45545. t['threesuperior'] = 333;
  45546. t['Ograve'] = 778;
  45547. t['Agrave'] = 722;
  45548. t['Abreve'] = 722;
  45549. t['multiply'] = 584;
  45550. t['uacute'] = 611;
  45551. t['Tcaron'] = 611;
  45552. t['partialdiff'] = 494;
  45553. t['ydieresis'] = 556;
  45554. t['Nacute'] = 722;
  45555. t['icircumflex'] = 278;
  45556. t['Ecircumflex'] = 667;
  45557. t['adieresis'] = 556;
  45558. t['edieresis'] = 556;
  45559. t['cacute'] = 556;
  45560. t['nacute'] = 611;
  45561. t['umacron'] = 611;
  45562. t['Ncaron'] = 722;
  45563. t['Iacute'] = 278;
  45564. t['plusminus'] = 584;
  45565. t['brokenbar'] = 280;
  45566. t['registered'] = 737;
  45567. t['Gbreve'] = 778;
  45568. t['Idotaccent'] = 278;
  45569. t['summation'] = 600;
  45570. t['Egrave'] = 667;
  45571. t['racute'] = 389;
  45572. t['omacron'] = 611;
  45573. t['Zacute'] = 611;
  45574. t['Zcaron'] = 611;
  45575. t['greaterequal'] = 549;
  45576. t['Eth'] = 722;
  45577. t['Ccedilla'] = 722;
  45578. t['lcommaaccent'] = 278;
  45579. t['tcaron'] = 389;
  45580. t['eogonek'] = 556;
  45581. t['Uogonek'] = 722;
  45582. t['Aacute'] = 722;
  45583. t['Adieresis'] = 722;
  45584. t['egrave'] = 556;
  45585. t['zacute'] = 500;
  45586. t['iogonek'] = 278;
  45587. t['Oacute'] = 778;
  45588. t['oacute'] = 611;
  45589. t['amacron'] = 556;
  45590. t['sacute'] = 556;
  45591. t['idieresis'] = 278;
  45592. t['Ocircumflex'] = 778;
  45593. t['Ugrave'] = 722;
  45594. t['Delta'] = 612;
  45595. t['thorn'] = 611;
  45596. t['twosuperior'] = 333;
  45597. t['Odieresis'] = 778;
  45598. t['mu'] = 611;
  45599. t['igrave'] = 278;
  45600. t['ohungarumlaut'] = 611;
  45601. t['Eogonek'] = 667;
  45602. t['dcroat'] = 611;
  45603. t['threequarters'] = 834;
  45604. t['Scedilla'] = 667;
  45605. t['lcaron'] = 400;
  45606. t['Kcommaaccent'] = 722;
  45607. t['Lacute'] = 611;
  45608. t['trademark'] = 1000;
  45609. t['edotaccent'] = 556;
  45610. t['Igrave'] = 278;
  45611. t['Imacron'] = 278;
  45612. t['Lcaron'] = 611;
  45613. t['onehalf'] = 834;
  45614. t['lessequal'] = 549;
  45615. t['ocircumflex'] = 611;
  45616. t['ntilde'] = 611;
  45617. t['Uhungarumlaut'] = 722;
  45618. t['Eacute'] = 667;
  45619. t['emacron'] = 556;
  45620. t['gbreve'] = 611;
  45621. t['onequarter'] = 834;
  45622. t['Scaron'] = 667;
  45623. t['Scommaaccent'] = 667;
  45624. t['Ohungarumlaut'] = 778;
  45625. t['degree'] = 400;
  45626. t['ograve'] = 611;
  45627. t['Ccaron'] = 722;
  45628. t['ugrave'] = 611;
  45629. t['radical'] = 549;
  45630. t['Dcaron'] = 722;
  45631. t['rcommaaccent'] = 389;
  45632. t['Ntilde'] = 722;
  45633. t['otilde'] = 611;
  45634. t['Rcommaaccent'] = 722;
  45635. t['Lcommaaccent'] = 611;
  45636. t['Atilde'] = 722;
  45637. t['Aogonek'] = 722;
  45638. t['Aring'] = 722;
  45639. t['Otilde'] = 778;
  45640. t['zdotaccent'] = 500;
  45641. t['Ecaron'] = 667;
  45642. t['Iogonek'] = 278;
  45643. t['kcommaaccent'] = 556;
  45644. t['minus'] = 584;
  45645. t['Icircumflex'] = 278;
  45646. t['ncaron'] = 611;
  45647. t['tcommaaccent'] = 333;
  45648. t['logicalnot'] = 584;
  45649. t['odieresis'] = 611;
  45650. t['udieresis'] = 611;
  45651. t['notequal'] = 549;
  45652. t['gcommaaccent'] = 611;
  45653. t['eth'] = 611;
  45654. t['zcaron'] = 500;
  45655. t['ncommaaccent'] = 611;
  45656. t['onesuperior'] = 333;
  45657. t['imacron'] = 278;
  45658. t['Euro'] = 556;
  45659. });
  45660. t['Helvetica-Oblique'] = getLookupTableFactory(function (t) {
  45661. t['space'] = 278;
  45662. t['exclam'] = 278;
  45663. t['quotedbl'] = 355;
  45664. t['numbersign'] = 556;
  45665. t['dollar'] = 556;
  45666. t['percent'] = 889;
  45667. t['ampersand'] = 667;
  45668. t['quoteright'] = 222;
  45669. t['parenleft'] = 333;
  45670. t['parenright'] = 333;
  45671. t['asterisk'] = 389;
  45672. t['plus'] = 584;
  45673. t['comma'] = 278;
  45674. t['hyphen'] = 333;
  45675. t['period'] = 278;
  45676. t['slash'] = 278;
  45677. t['zero'] = 556;
  45678. t['one'] = 556;
  45679. t['two'] = 556;
  45680. t['three'] = 556;
  45681. t['four'] = 556;
  45682. t['five'] = 556;
  45683. t['six'] = 556;
  45684. t['seven'] = 556;
  45685. t['eight'] = 556;
  45686. t['nine'] = 556;
  45687. t['colon'] = 278;
  45688. t['semicolon'] = 278;
  45689. t['less'] = 584;
  45690. t['equal'] = 584;
  45691. t['greater'] = 584;
  45692. t['question'] = 556;
  45693. t['at'] = 1015;
  45694. t['A'] = 667;
  45695. t['B'] = 667;
  45696. t['C'] = 722;
  45697. t['D'] = 722;
  45698. t['E'] = 667;
  45699. t['F'] = 611;
  45700. t['G'] = 778;
  45701. t['H'] = 722;
  45702. t['I'] = 278;
  45703. t['J'] = 500;
  45704. t['K'] = 667;
  45705. t['L'] = 556;
  45706. t['M'] = 833;
  45707. t['N'] = 722;
  45708. t['O'] = 778;
  45709. t['P'] = 667;
  45710. t['Q'] = 778;
  45711. t['R'] = 722;
  45712. t['S'] = 667;
  45713. t['T'] = 611;
  45714. t['U'] = 722;
  45715. t['V'] = 667;
  45716. t['W'] = 944;
  45717. t['X'] = 667;
  45718. t['Y'] = 667;
  45719. t['Z'] = 611;
  45720. t['bracketleft'] = 278;
  45721. t['backslash'] = 278;
  45722. t['bracketright'] = 278;
  45723. t['asciicircum'] = 469;
  45724. t['underscore'] = 556;
  45725. t['quoteleft'] = 222;
  45726. t['a'] = 556;
  45727. t['b'] = 556;
  45728. t['c'] = 500;
  45729. t['d'] = 556;
  45730. t['e'] = 556;
  45731. t['f'] = 278;
  45732. t['g'] = 556;
  45733. t['h'] = 556;
  45734. t['i'] = 222;
  45735. t['j'] = 222;
  45736. t['k'] = 500;
  45737. t['l'] = 222;
  45738. t['m'] = 833;
  45739. t['n'] = 556;
  45740. t['o'] = 556;
  45741. t['p'] = 556;
  45742. t['q'] = 556;
  45743. t['r'] = 333;
  45744. t['s'] = 500;
  45745. t['t'] = 278;
  45746. t['u'] = 556;
  45747. t['v'] = 500;
  45748. t['w'] = 722;
  45749. t['x'] = 500;
  45750. t['y'] = 500;
  45751. t['z'] = 500;
  45752. t['braceleft'] = 334;
  45753. t['bar'] = 260;
  45754. t['braceright'] = 334;
  45755. t['asciitilde'] = 584;
  45756. t['exclamdown'] = 333;
  45757. t['cent'] = 556;
  45758. t['sterling'] = 556;
  45759. t['fraction'] = 167;
  45760. t['yen'] = 556;
  45761. t['florin'] = 556;
  45762. t['section'] = 556;
  45763. t['currency'] = 556;
  45764. t['quotesingle'] = 191;
  45765. t['quotedblleft'] = 333;
  45766. t['guillemotleft'] = 556;
  45767. t['guilsinglleft'] = 333;
  45768. t['guilsinglright'] = 333;
  45769. t['fi'] = 500;
  45770. t['fl'] = 500;
  45771. t['endash'] = 556;
  45772. t['dagger'] = 556;
  45773. t['daggerdbl'] = 556;
  45774. t['periodcentered'] = 278;
  45775. t['paragraph'] = 537;
  45776. t['bullet'] = 350;
  45777. t['quotesinglbase'] = 222;
  45778. t['quotedblbase'] = 333;
  45779. t['quotedblright'] = 333;
  45780. t['guillemotright'] = 556;
  45781. t['ellipsis'] = 1000;
  45782. t['perthousand'] = 1000;
  45783. t['questiondown'] = 611;
  45784. t['grave'] = 333;
  45785. t['acute'] = 333;
  45786. t['circumflex'] = 333;
  45787. t['tilde'] = 333;
  45788. t['macron'] = 333;
  45789. t['breve'] = 333;
  45790. t['dotaccent'] = 333;
  45791. t['dieresis'] = 333;
  45792. t['ring'] = 333;
  45793. t['cedilla'] = 333;
  45794. t['hungarumlaut'] = 333;
  45795. t['ogonek'] = 333;
  45796. t['caron'] = 333;
  45797. t['emdash'] = 1000;
  45798. t['AE'] = 1000;
  45799. t['ordfeminine'] = 370;
  45800. t['Lslash'] = 556;
  45801. t['Oslash'] = 778;
  45802. t['OE'] = 1000;
  45803. t['ordmasculine'] = 365;
  45804. t['ae'] = 889;
  45805. t['dotlessi'] = 278;
  45806. t['lslash'] = 222;
  45807. t['oslash'] = 611;
  45808. t['oe'] = 944;
  45809. t['germandbls'] = 611;
  45810. t['Idieresis'] = 278;
  45811. t['eacute'] = 556;
  45812. t['abreve'] = 556;
  45813. t['uhungarumlaut'] = 556;
  45814. t['ecaron'] = 556;
  45815. t['Ydieresis'] = 667;
  45816. t['divide'] = 584;
  45817. t['Yacute'] = 667;
  45818. t['Acircumflex'] = 667;
  45819. t['aacute'] = 556;
  45820. t['Ucircumflex'] = 722;
  45821. t['yacute'] = 500;
  45822. t['scommaaccent'] = 500;
  45823. t['ecircumflex'] = 556;
  45824. t['Uring'] = 722;
  45825. t['Udieresis'] = 722;
  45826. t['aogonek'] = 556;
  45827. t['Uacute'] = 722;
  45828. t['uogonek'] = 556;
  45829. t['Edieresis'] = 667;
  45830. t['Dcroat'] = 722;
  45831. t['commaaccent'] = 250;
  45832. t['copyright'] = 737;
  45833. t['Emacron'] = 667;
  45834. t['ccaron'] = 500;
  45835. t['aring'] = 556;
  45836. t['Ncommaaccent'] = 722;
  45837. t['lacute'] = 222;
  45838. t['agrave'] = 556;
  45839. t['Tcommaaccent'] = 611;
  45840. t['Cacute'] = 722;
  45841. t['atilde'] = 556;
  45842. t['Edotaccent'] = 667;
  45843. t['scaron'] = 500;
  45844. t['scedilla'] = 500;
  45845. t['iacute'] = 278;
  45846. t['lozenge'] = 471;
  45847. t['Rcaron'] = 722;
  45848. t['Gcommaaccent'] = 778;
  45849. t['ucircumflex'] = 556;
  45850. t['acircumflex'] = 556;
  45851. t['Amacron'] = 667;
  45852. t['rcaron'] = 333;
  45853. t['ccedilla'] = 500;
  45854. t['Zdotaccent'] = 611;
  45855. t['Thorn'] = 667;
  45856. t['Omacron'] = 778;
  45857. t['Racute'] = 722;
  45858. t['Sacute'] = 667;
  45859. t['dcaron'] = 643;
  45860. t['Umacron'] = 722;
  45861. t['uring'] = 556;
  45862. t['threesuperior'] = 333;
  45863. t['Ograve'] = 778;
  45864. t['Agrave'] = 667;
  45865. t['Abreve'] = 667;
  45866. t['multiply'] = 584;
  45867. t['uacute'] = 556;
  45868. t['Tcaron'] = 611;
  45869. t['partialdiff'] = 476;
  45870. t['ydieresis'] = 500;
  45871. t['Nacute'] = 722;
  45872. t['icircumflex'] = 278;
  45873. t['Ecircumflex'] = 667;
  45874. t['adieresis'] = 556;
  45875. t['edieresis'] = 556;
  45876. t['cacute'] = 500;
  45877. t['nacute'] = 556;
  45878. t['umacron'] = 556;
  45879. t['Ncaron'] = 722;
  45880. t['Iacute'] = 278;
  45881. t['plusminus'] = 584;
  45882. t['brokenbar'] = 260;
  45883. t['registered'] = 737;
  45884. t['Gbreve'] = 778;
  45885. t['Idotaccent'] = 278;
  45886. t['summation'] = 600;
  45887. t['Egrave'] = 667;
  45888. t['racute'] = 333;
  45889. t['omacron'] = 556;
  45890. t['Zacute'] = 611;
  45891. t['Zcaron'] = 611;
  45892. t['greaterequal'] = 549;
  45893. t['Eth'] = 722;
  45894. t['Ccedilla'] = 722;
  45895. t['lcommaaccent'] = 222;
  45896. t['tcaron'] = 317;
  45897. t['eogonek'] = 556;
  45898. t['Uogonek'] = 722;
  45899. t['Aacute'] = 667;
  45900. t['Adieresis'] = 667;
  45901. t['egrave'] = 556;
  45902. t['zacute'] = 500;
  45903. t['iogonek'] = 222;
  45904. t['Oacute'] = 778;
  45905. t['oacute'] = 556;
  45906. t['amacron'] = 556;
  45907. t['sacute'] = 500;
  45908. t['idieresis'] = 278;
  45909. t['Ocircumflex'] = 778;
  45910. t['Ugrave'] = 722;
  45911. t['Delta'] = 612;
  45912. t['thorn'] = 556;
  45913. t['twosuperior'] = 333;
  45914. t['Odieresis'] = 778;
  45915. t['mu'] = 556;
  45916. t['igrave'] = 278;
  45917. t['ohungarumlaut'] = 556;
  45918. t['Eogonek'] = 667;
  45919. t['dcroat'] = 556;
  45920. t['threequarters'] = 834;
  45921. t['Scedilla'] = 667;
  45922. t['lcaron'] = 299;
  45923. t['Kcommaaccent'] = 667;
  45924. t['Lacute'] = 556;
  45925. t['trademark'] = 1000;
  45926. t['edotaccent'] = 556;
  45927. t['Igrave'] = 278;
  45928. t['Imacron'] = 278;
  45929. t['Lcaron'] = 556;
  45930. t['onehalf'] = 834;
  45931. t['lessequal'] = 549;
  45932. t['ocircumflex'] = 556;
  45933. t['ntilde'] = 556;
  45934. t['Uhungarumlaut'] = 722;
  45935. t['Eacute'] = 667;
  45936. t['emacron'] = 556;
  45937. t['gbreve'] = 556;
  45938. t['onequarter'] = 834;
  45939. t['Scaron'] = 667;
  45940. t['Scommaaccent'] = 667;
  45941. t['Ohungarumlaut'] = 778;
  45942. t['degree'] = 400;
  45943. t['ograve'] = 556;
  45944. t['Ccaron'] = 722;
  45945. t['ugrave'] = 556;
  45946. t['radical'] = 453;
  45947. t['Dcaron'] = 722;
  45948. t['rcommaaccent'] = 333;
  45949. t['Ntilde'] = 722;
  45950. t['otilde'] = 556;
  45951. t['Rcommaaccent'] = 722;
  45952. t['Lcommaaccent'] = 556;
  45953. t['Atilde'] = 667;
  45954. t['Aogonek'] = 667;
  45955. t['Aring'] = 667;
  45956. t['Otilde'] = 778;
  45957. t['zdotaccent'] = 500;
  45958. t['Ecaron'] = 667;
  45959. t['Iogonek'] = 278;
  45960. t['kcommaaccent'] = 500;
  45961. t['minus'] = 584;
  45962. t['Icircumflex'] = 278;
  45963. t['ncaron'] = 556;
  45964. t['tcommaaccent'] = 278;
  45965. t['logicalnot'] = 584;
  45966. t['odieresis'] = 556;
  45967. t['udieresis'] = 556;
  45968. t['notequal'] = 549;
  45969. t['gcommaaccent'] = 556;
  45970. t['eth'] = 556;
  45971. t['zcaron'] = 500;
  45972. t['ncommaaccent'] = 556;
  45973. t['onesuperior'] = 333;
  45974. t['imacron'] = 278;
  45975. t['Euro'] = 556;
  45976. });
  45977. t['Symbol'] = getLookupTableFactory(function (t) {
  45978. t['space'] = 250;
  45979. t['exclam'] = 333;
  45980. t['universal'] = 713;
  45981. t['numbersign'] = 500;
  45982. t['existential'] = 549;
  45983. t['percent'] = 833;
  45984. t['ampersand'] = 778;
  45985. t['suchthat'] = 439;
  45986. t['parenleft'] = 333;
  45987. t['parenright'] = 333;
  45988. t['asteriskmath'] = 500;
  45989. t['plus'] = 549;
  45990. t['comma'] = 250;
  45991. t['minus'] = 549;
  45992. t['period'] = 250;
  45993. t['slash'] = 278;
  45994. t['zero'] = 500;
  45995. t['one'] = 500;
  45996. t['two'] = 500;
  45997. t['three'] = 500;
  45998. t['four'] = 500;
  45999. t['five'] = 500;
  46000. t['six'] = 500;
  46001. t['seven'] = 500;
  46002. t['eight'] = 500;
  46003. t['nine'] = 500;
  46004. t['colon'] = 278;
  46005. t['semicolon'] = 278;
  46006. t['less'] = 549;
  46007. t['equal'] = 549;
  46008. t['greater'] = 549;
  46009. t['question'] = 444;
  46010. t['congruent'] = 549;
  46011. t['Alpha'] = 722;
  46012. t['Beta'] = 667;
  46013. t['Chi'] = 722;
  46014. t['Delta'] = 612;
  46015. t['Epsilon'] = 611;
  46016. t['Phi'] = 763;
  46017. t['Gamma'] = 603;
  46018. t['Eta'] = 722;
  46019. t['Iota'] = 333;
  46020. t['theta1'] = 631;
  46021. t['Kappa'] = 722;
  46022. t['Lambda'] = 686;
  46023. t['Mu'] = 889;
  46024. t['Nu'] = 722;
  46025. t['Omicron'] = 722;
  46026. t['Pi'] = 768;
  46027. t['Theta'] = 741;
  46028. t['Rho'] = 556;
  46029. t['Sigma'] = 592;
  46030. t['Tau'] = 611;
  46031. t['Upsilon'] = 690;
  46032. t['sigma1'] = 439;
  46033. t['Omega'] = 768;
  46034. t['Xi'] = 645;
  46035. t['Psi'] = 795;
  46036. t['Zeta'] = 611;
  46037. t['bracketleft'] = 333;
  46038. t['therefore'] = 863;
  46039. t['bracketright'] = 333;
  46040. t['perpendicular'] = 658;
  46041. t['underscore'] = 500;
  46042. t['radicalex'] = 500;
  46043. t['alpha'] = 631;
  46044. t['beta'] = 549;
  46045. t['chi'] = 549;
  46046. t['delta'] = 494;
  46047. t['epsilon'] = 439;
  46048. t['phi'] = 521;
  46049. t['gamma'] = 411;
  46050. t['eta'] = 603;
  46051. t['iota'] = 329;
  46052. t['phi1'] = 603;
  46053. t['kappa'] = 549;
  46054. t['lambda'] = 549;
  46055. t['mu'] = 576;
  46056. t['nu'] = 521;
  46057. t['omicron'] = 549;
  46058. t['pi'] = 549;
  46059. t['theta'] = 521;
  46060. t['rho'] = 549;
  46061. t['sigma'] = 603;
  46062. t['tau'] = 439;
  46063. t['upsilon'] = 576;
  46064. t['omega1'] = 713;
  46065. t['omega'] = 686;
  46066. t['xi'] = 493;
  46067. t['psi'] = 686;
  46068. t['zeta'] = 494;
  46069. t['braceleft'] = 480;
  46070. t['bar'] = 200;
  46071. t['braceright'] = 480;
  46072. t['similar'] = 549;
  46073. t['Euro'] = 750;
  46074. t['Upsilon1'] = 620;
  46075. t['minute'] = 247;
  46076. t['lessequal'] = 549;
  46077. t['fraction'] = 167;
  46078. t['infinity'] = 713;
  46079. t['florin'] = 500;
  46080. t['club'] = 753;
  46081. t['diamond'] = 753;
  46082. t['heart'] = 753;
  46083. t['spade'] = 753;
  46084. t['arrowboth'] = 1042;
  46085. t['arrowleft'] = 987;
  46086. t['arrowup'] = 603;
  46087. t['arrowright'] = 987;
  46088. t['arrowdown'] = 603;
  46089. t['degree'] = 400;
  46090. t['plusminus'] = 549;
  46091. t['second'] = 411;
  46092. t['greaterequal'] = 549;
  46093. t['multiply'] = 549;
  46094. t['proportional'] = 713;
  46095. t['partialdiff'] = 494;
  46096. t['bullet'] = 460;
  46097. t['divide'] = 549;
  46098. t['notequal'] = 549;
  46099. t['equivalence'] = 549;
  46100. t['approxequal'] = 549;
  46101. t['ellipsis'] = 1000;
  46102. t['arrowvertex'] = 603;
  46103. t['arrowhorizex'] = 1000;
  46104. t['carriagereturn'] = 658;
  46105. t['aleph'] = 823;
  46106. t['Ifraktur'] = 686;
  46107. t['Rfraktur'] = 795;
  46108. t['weierstrass'] = 987;
  46109. t['circlemultiply'] = 768;
  46110. t['circleplus'] = 768;
  46111. t['emptyset'] = 823;
  46112. t['intersection'] = 768;
  46113. t['union'] = 768;
  46114. t['propersuperset'] = 713;
  46115. t['reflexsuperset'] = 713;
  46116. t['notsubset'] = 713;
  46117. t['propersubset'] = 713;
  46118. t['reflexsubset'] = 713;
  46119. t['element'] = 713;
  46120. t['notelement'] = 713;
  46121. t['angle'] = 768;
  46122. t['gradient'] = 713;
  46123. t['registerserif'] = 790;
  46124. t['copyrightserif'] = 790;
  46125. t['trademarkserif'] = 890;
  46126. t['product'] = 823;
  46127. t['radical'] = 549;
  46128. t['dotmath'] = 250;
  46129. t['logicalnot'] = 713;
  46130. t['logicaland'] = 603;
  46131. t['logicalor'] = 603;
  46132. t['arrowdblboth'] = 1042;
  46133. t['arrowdblleft'] = 987;
  46134. t['arrowdblup'] = 603;
  46135. t['arrowdblright'] = 987;
  46136. t['arrowdbldown'] = 603;
  46137. t['lozenge'] = 494;
  46138. t['angleleft'] = 329;
  46139. t['registersans'] = 790;
  46140. t['copyrightsans'] = 790;
  46141. t['trademarksans'] = 786;
  46142. t['summation'] = 713;
  46143. t['parenlefttp'] = 384;
  46144. t['parenleftex'] = 384;
  46145. t['parenleftbt'] = 384;
  46146. t['bracketlefttp'] = 384;
  46147. t['bracketleftex'] = 384;
  46148. t['bracketleftbt'] = 384;
  46149. t['bracelefttp'] = 494;
  46150. t['braceleftmid'] = 494;
  46151. t['braceleftbt'] = 494;
  46152. t['braceex'] = 494;
  46153. t['angleright'] = 329;
  46154. t['integral'] = 274;
  46155. t['integraltp'] = 686;
  46156. t['integralex'] = 686;
  46157. t['integralbt'] = 686;
  46158. t['parenrighttp'] = 384;
  46159. t['parenrightex'] = 384;
  46160. t['parenrightbt'] = 384;
  46161. t['bracketrighttp'] = 384;
  46162. t['bracketrightex'] = 384;
  46163. t['bracketrightbt'] = 384;
  46164. t['bracerighttp'] = 494;
  46165. t['bracerightmid'] = 494;
  46166. t['bracerightbt'] = 494;
  46167. t['apple'] = 790;
  46168. });
  46169. t['Times-Roman'] = getLookupTableFactory(function (t) {
  46170. t['space'] = 250;
  46171. t['exclam'] = 333;
  46172. t['quotedbl'] = 408;
  46173. t['numbersign'] = 500;
  46174. t['dollar'] = 500;
  46175. t['percent'] = 833;
  46176. t['ampersand'] = 778;
  46177. t['quoteright'] = 333;
  46178. t['parenleft'] = 333;
  46179. t['parenright'] = 333;
  46180. t['asterisk'] = 500;
  46181. t['plus'] = 564;
  46182. t['comma'] = 250;
  46183. t['hyphen'] = 333;
  46184. t['period'] = 250;
  46185. t['slash'] = 278;
  46186. t['zero'] = 500;
  46187. t['one'] = 500;
  46188. t['two'] = 500;
  46189. t['three'] = 500;
  46190. t['four'] = 500;
  46191. t['five'] = 500;
  46192. t['six'] = 500;
  46193. t['seven'] = 500;
  46194. t['eight'] = 500;
  46195. t['nine'] = 500;
  46196. t['colon'] = 278;
  46197. t['semicolon'] = 278;
  46198. t['less'] = 564;
  46199. t['equal'] = 564;
  46200. t['greater'] = 564;
  46201. t['question'] = 444;
  46202. t['at'] = 921;
  46203. t['A'] = 722;
  46204. t['B'] = 667;
  46205. t['C'] = 667;
  46206. t['D'] = 722;
  46207. t['E'] = 611;
  46208. t['F'] = 556;
  46209. t['G'] = 722;
  46210. t['H'] = 722;
  46211. t['I'] = 333;
  46212. t['J'] = 389;
  46213. t['K'] = 722;
  46214. t['L'] = 611;
  46215. t['M'] = 889;
  46216. t['N'] = 722;
  46217. t['O'] = 722;
  46218. t['P'] = 556;
  46219. t['Q'] = 722;
  46220. t['R'] = 667;
  46221. t['S'] = 556;
  46222. t['T'] = 611;
  46223. t['U'] = 722;
  46224. t['V'] = 722;
  46225. t['W'] = 944;
  46226. t['X'] = 722;
  46227. t['Y'] = 722;
  46228. t['Z'] = 611;
  46229. t['bracketleft'] = 333;
  46230. t['backslash'] = 278;
  46231. t['bracketright'] = 333;
  46232. t['asciicircum'] = 469;
  46233. t['underscore'] = 500;
  46234. t['quoteleft'] = 333;
  46235. t['a'] = 444;
  46236. t['b'] = 500;
  46237. t['c'] = 444;
  46238. t['d'] = 500;
  46239. t['e'] = 444;
  46240. t['f'] = 333;
  46241. t['g'] = 500;
  46242. t['h'] = 500;
  46243. t['i'] = 278;
  46244. t['j'] = 278;
  46245. t['k'] = 500;
  46246. t['l'] = 278;
  46247. t['m'] = 778;
  46248. t['n'] = 500;
  46249. t['o'] = 500;
  46250. t['p'] = 500;
  46251. t['q'] = 500;
  46252. t['r'] = 333;
  46253. t['s'] = 389;
  46254. t['t'] = 278;
  46255. t['u'] = 500;
  46256. t['v'] = 500;
  46257. t['w'] = 722;
  46258. t['x'] = 500;
  46259. t['y'] = 500;
  46260. t['z'] = 444;
  46261. t['braceleft'] = 480;
  46262. t['bar'] = 200;
  46263. t['braceright'] = 480;
  46264. t['asciitilde'] = 541;
  46265. t['exclamdown'] = 333;
  46266. t['cent'] = 500;
  46267. t['sterling'] = 500;
  46268. t['fraction'] = 167;
  46269. t['yen'] = 500;
  46270. t['florin'] = 500;
  46271. t['section'] = 500;
  46272. t['currency'] = 500;
  46273. t['quotesingle'] = 180;
  46274. t['quotedblleft'] = 444;
  46275. t['guillemotleft'] = 500;
  46276. t['guilsinglleft'] = 333;
  46277. t['guilsinglright'] = 333;
  46278. t['fi'] = 556;
  46279. t['fl'] = 556;
  46280. t['endash'] = 500;
  46281. t['dagger'] = 500;
  46282. t['daggerdbl'] = 500;
  46283. t['periodcentered'] = 250;
  46284. t['paragraph'] = 453;
  46285. t['bullet'] = 350;
  46286. t['quotesinglbase'] = 333;
  46287. t['quotedblbase'] = 444;
  46288. t['quotedblright'] = 444;
  46289. t['guillemotright'] = 500;
  46290. t['ellipsis'] = 1000;
  46291. t['perthousand'] = 1000;
  46292. t['questiondown'] = 444;
  46293. t['grave'] = 333;
  46294. t['acute'] = 333;
  46295. t['circumflex'] = 333;
  46296. t['tilde'] = 333;
  46297. t['macron'] = 333;
  46298. t['breve'] = 333;
  46299. t['dotaccent'] = 333;
  46300. t['dieresis'] = 333;
  46301. t['ring'] = 333;
  46302. t['cedilla'] = 333;
  46303. t['hungarumlaut'] = 333;
  46304. t['ogonek'] = 333;
  46305. t['caron'] = 333;
  46306. t['emdash'] = 1000;
  46307. t['AE'] = 889;
  46308. t['ordfeminine'] = 276;
  46309. t['Lslash'] = 611;
  46310. t['Oslash'] = 722;
  46311. t['OE'] = 889;
  46312. t['ordmasculine'] = 310;
  46313. t['ae'] = 667;
  46314. t['dotlessi'] = 278;
  46315. t['lslash'] = 278;
  46316. t['oslash'] = 500;
  46317. t['oe'] = 722;
  46318. t['germandbls'] = 500;
  46319. t['Idieresis'] = 333;
  46320. t['eacute'] = 444;
  46321. t['abreve'] = 444;
  46322. t['uhungarumlaut'] = 500;
  46323. t['ecaron'] = 444;
  46324. t['Ydieresis'] = 722;
  46325. t['divide'] = 564;
  46326. t['Yacute'] = 722;
  46327. t['Acircumflex'] = 722;
  46328. t['aacute'] = 444;
  46329. t['Ucircumflex'] = 722;
  46330. t['yacute'] = 500;
  46331. t['scommaaccent'] = 389;
  46332. t['ecircumflex'] = 444;
  46333. t['Uring'] = 722;
  46334. t['Udieresis'] = 722;
  46335. t['aogonek'] = 444;
  46336. t['Uacute'] = 722;
  46337. t['uogonek'] = 500;
  46338. t['Edieresis'] = 611;
  46339. t['Dcroat'] = 722;
  46340. t['commaaccent'] = 250;
  46341. t['copyright'] = 760;
  46342. t['Emacron'] = 611;
  46343. t['ccaron'] = 444;
  46344. t['aring'] = 444;
  46345. t['Ncommaaccent'] = 722;
  46346. t['lacute'] = 278;
  46347. t['agrave'] = 444;
  46348. t['Tcommaaccent'] = 611;
  46349. t['Cacute'] = 667;
  46350. t['atilde'] = 444;
  46351. t['Edotaccent'] = 611;
  46352. t['scaron'] = 389;
  46353. t['scedilla'] = 389;
  46354. t['iacute'] = 278;
  46355. t['lozenge'] = 471;
  46356. t['Rcaron'] = 667;
  46357. t['Gcommaaccent'] = 722;
  46358. t['ucircumflex'] = 500;
  46359. t['acircumflex'] = 444;
  46360. t['Amacron'] = 722;
  46361. t['rcaron'] = 333;
  46362. t['ccedilla'] = 444;
  46363. t['Zdotaccent'] = 611;
  46364. t['Thorn'] = 556;
  46365. t['Omacron'] = 722;
  46366. t['Racute'] = 667;
  46367. t['Sacute'] = 556;
  46368. t['dcaron'] = 588;
  46369. t['Umacron'] = 722;
  46370. t['uring'] = 500;
  46371. t['threesuperior'] = 300;
  46372. t['Ograve'] = 722;
  46373. t['Agrave'] = 722;
  46374. t['Abreve'] = 722;
  46375. t['multiply'] = 564;
  46376. t['uacute'] = 500;
  46377. t['Tcaron'] = 611;
  46378. t['partialdiff'] = 476;
  46379. t['ydieresis'] = 500;
  46380. t['Nacute'] = 722;
  46381. t['icircumflex'] = 278;
  46382. t['Ecircumflex'] = 611;
  46383. t['adieresis'] = 444;
  46384. t['edieresis'] = 444;
  46385. t['cacute'] = 444;
  46386. t['nacute'] = 500;
  46387. t['umacron'] = 500;
  46388. t['Ncaron'] = 722;
  46389. t['Iacute'] = 333;
  46390. t['plusminus'] = 564;
  46391. t['brokenbar'] = 200;
  46392. t['registered'] = 760;
  46393. t['Gbreve'] = 722;
  46394. t['Idotaccent'] = 333;
  46395. t['summation'] = 600;
  46396. t['Egrave'] = 611;
  46397. t['racute'] = 333;
  46398. t['omacron'] = 500;
  46399. t['Zacute'] = 611;
  46400. t['Zcaron'] = 611;
  46401. t['greaterequal'] = 549;
  46402. t['Eth'] = 722;
  46403. t['Ccedilla'] = 667;
  46404. t['lcommaaccent'] = 278;
  46405. t['tcaron'] = 326;
  46406. t['eogonek'] = 444;
  46407. t['Uogonek'] = 722;
  46408. t['Aacute'] = 722;
  46409. t['Adieresis'] = 722;
  46410. t['egrave'] = 444;
  46411. t['zacute'] = 444;
  46412. t['iogonek'] = 278;
  46413. t['Oacute'] = 722;
  46414. t['oacute'] = 500;
  46415. t['amacron'] = 444;
  46416. t['sacute'] = 389;
  46417. t['idieresis'] = 278;
  46418. t['Ocircumflex'] = 722;
  46419. t['Ugrave'] = 722;
  46420. t['Delta'] = 612;
  46421. t['thorn'] = 500;
  46422. t['twosuperior'] = 300;
  46423. t['Odieresis'] = 722;
  46424. t['mu'] = 500;
  46425. t['igrave'] = 278;
  46426. t['ohungarumlaut'] = 500;
  46427. t['Eogonek'] = 611;
  46428. t['dcroat'] = 500;
  46429. t['threequarters'] = 750;
  46430. t['Scedilla'] = 556;
  46431. t['lcaron'] = 344;
  46432. t['Kcommaaccent'] = 722;
  46433. t['Lacute'] = 611;
  46434. t['trademark'] = 980;
  46435. t['edotaccent'] = 444;
  46436. t['Igrave'] = 333;
  46437. t['Imacron'] = 333;
  46438. t['Lcaron'] = 611;
  46439. t['onehalf'] = 750;
  46440. t['lessequal'] = 549;
  46441. t['ocircumflex'] = 500;
  46442. t['ntilde'] = 500;
  46443. t['Uhungarumlaut'] = 722;
  46444. t['Eacute'] = 611;
  46445. t['emacron'] = 444;
  46446. t['gbreve'] = 500;
  46447. t['onequarter'] = 750;
  46448. t['Scaron'] = 556;
  46449. t['Scommaaccent'] = 556;
  46450. t['Ohungarumlaut'] = 722;
  46451. t['degree'] = 400;
  46452. t['ograve'] = 500;
  46453. t['Ccaron'] = 667;
  46454. t['ugrave'] = 500;
  46455. t['radical'] = 453;
  46456. t['Dcaron'] = 722;
  46457. t['rcommaaccent'] = 333;
  46458. t['Ntilde'] = 722;
  46459. t['otilde'] = 500;
  46460. t['Rcommaaccent'] = 667;
  46461. t['Lcommaaccent'] = 611;
  46462. t['Atilde'] = 722;
  46463. t['Aogonek'] = 722;
  46464. t['Aring'] = 722;
  46465. t['Otilde'] = 722;
  46466. t['zdotaccent'] = 444;
  46467. t['Ecaron'] = 611;
  46468. t['Iogonek'] = 333;
  46469. t['kcommaaccent'] = 500;
  46470. t['minus'] = 564;
  46471. t['Icircumflex'] = 333;
  46472. t['ncaron'] = 500;
  46473. t['tcommaaccent'] = 278;
  46474. t['logicalnot'] = 564;
  46475. t['odieresis'] = 500;
  46476. t['udieresis'] = 500;
  46477. t['notequal'] = 549;
  46478. t['gcommaaccent'] = 500;
  46479. t['eth'] = 500;
  46480. t['zcaron'] = 444;
  46481. t['ncommaaccent'] = 500;
  46482. t['onesuperior'] = 300;
  46483. t['imacron'] = 278;
  46484. t['Euro'] = 500;
  46485. });
  46486. t['Times-Bold'] = getLookupTableFactory(function (t) {
  46487. t['space'] = 250;
  46488. t['exclam'] = 333;
  46489. t['quotedbl'] = 555;
  46490. t['numbersign'] = 500;
  46491. t['dollar'] = 500;
  46492. t['percent'] = 1000;
  46493. t['ampersand'] = 833;
  46494. t['quoteright'] = 333;
  46495. t['parenleft'] = 333;
  46496. t['parenright'] = 333;
  46497. t['asterisk'] = 500;
  46498. t['plus'] = 570;
  46499. t['comma'] = 250;
  46500. t['hyphen'] = 333;
  46501. t['period'] = 250;
  46502. t['slash'] = 278;
  46503. t['zero'] = 500;
  46504. t['one'] = 500;
  46505. t['two'] = 500;
  46506. t['three'] = 500;
  46507. t['four'] = 500;
  46508. t['five'] = 500;
  46509. t['six'] = 500;
  46510. t['seven'] = 500;
  46511. t['eight'] = 500;
  46512. t['nine'] = 500;
  46513. t['colon'] = 333;
  46514. t['semicolon'] = 333;
  46515. t['less'] = 570;
  46516. t['equal'] = 570;
  46517. t['greater'] = 570;
  46518. t['question'] = 500;
  46519. t['at'] = 930;
  46520. t['A'] = 722;
  46521. t['B'] = 667;
  46522. t['C'] = 722;
  46523. t['D'] = 722;
  46524. t['E'] = 667;
  46525. t['F'] = 611;
  46526. t['G'] = 778;
  46527. t['H'] = 778;
  46528. t['I'] = 389;
  46529. t['J'] = 500;
  46530. t['K'] = 778;
  46531. t['L'] = 667;
  46532. t['M'] = 944;
  46533. t['N'] = 722;
  46534. t['O'] = 778;
  46535. t['P'] = 611;
  46536. t['Q'] = 778;
  46537. t['R'] = 722;
  46538. t['S'] = 556;
  46539. t['T'] = 667;
  46540. t['U'] = 722;
  46541. t['V'] = 722;
  46542. t['W'] = 1000;
  46543. t['X'] = 722;
  46544. t['Y'] = 722;
  46545. t['Z'] = 667;
  46546. t['bracketleft'] = 333;
  46547. t['backslash'] = 278;
  46548. t['bracketright'] = 333;
  46549. t['asciicircum'] = 581;
  46550. t['underscore'] = 500;
  46551. t['quoteleft'] = 333;
  46552. t['a'] = 500;
  46553. t['b'] = 556;
  46554. t['c'] = 444;
  46555. t['d'] = 556;
  46556. t['e'] = 444;
  46557. t['f'] = 333;
  46558. t['g'] = 500;
  46559. t['h'] = 556;
  46560. t['i'] = 278;
  46561. t['j'] = 333;
  46562. t['k'] = 556;
  46563. t['l'] = 278;
  46564. t['m'] = 833;
  46565. t['n'] = 556;
  46566. t['o'] = 500;
  46567. t['p'] = 556;
  46568. t['q'] = 556;
  46569. t['r'] = 444;
  46570. t['s'] = 389;
  46571. t['t'] = 333;
  46572. t['u'] = 556;
  46573. t['v'] = 500;
  46574. t['w'] = 722;
  46575. t['x'] = 500;
  46576. t['y'] = 500;
  46577. t['z'] = 444;
  46578. t['braceleft'] = 394;
  46579. t['bar'] = 220;
  46580. t['braceright'] = 394;
  46581. t['asciitilde'] = 520;
  46582. t['exclamdown'] = 333;
  46583. t['cent'] = 500;
  46584. t['sterling'] = 500;
  46585. t['fraction'] = 167;
  46586. t['yen'] = 500;
  46587. t['florin'] = 500;
  46588. t['section'] = 500;
  46589. t['currency'] = 500;
  46590. t['quotesingle'] = 278;
  46591. t['quotedblleft'] = 500;
  46592. t['guillemotleft'] = 500;
  46593. t['guilsinglleft'] = 333;
  46594. t['guilsinglright'] = 333;
  46595. t['fi'] = 556;
  46596. t['fl'] = 556;
  46597. t['endash'] = 500;
  46598. t['dagger'] = 500;
  46599. t['daggerdbl'] = 500;
  46600. t['periodcentered'] = 250;
  46601. t['paragraph'] = 540;
  46602. t['bullet'] = 350;
  46603. t['quotesinglbase'] = 333;
  46604. t['quotedblbase'] = 500;
  46605. t['quotedblright'] = 500;
  46606. t['guillemotright'] = 500;
  46607. t['ellipsis'] = 1000;
  46608. t['perthousand'] = 1000;
  46609. t['questiondown'] = 500;
  46610. t['grave'] = 333;
  46611. t['acute'] = 333;
  46612. t['circumflex'] = 333;
  46613. t['tilde'] = 333;
  46614. t['macron'] = 333;
  46615. t['breve'] = 333;
  46616. t['dotaccent'] = 333;
  46617. t['dieresis'] = 333;
  46618. t['ring'] = 333;
  46619. t['cedilla'] = 333;
  46620. t['hungarumlaut'] = 333;
  46621. t['ogonek'] = 333;
  46622. t['caron'] = 333;
  46623. t['emdash'] = 1000;
  46624. t['AE'] = 1000;
  46625. t['ordfeminine'] = 300;
  46626. t['Lslash'] = 667;
  46627. t['Oslash'] = 778;
  46628. t['OE'] = 1000;
  46629. t['ordmasculine'] = 330;
  46630. t['ae'] = 722;
  46631. t['dotlessi'] = 278;
  46632. t['lslash'] = 278;
  46633. t['oslash'] = 500;
  46634. t['oe'] = 722;
  46635. t['germandbls'] = 556;
  46636. t['Idieresis'] = 389;
  46637. t['eacute'] = 444;
  46638. t['abreve'] = 500;
  46639. t['uhungarumlaut'] = 556;
  46640. t['ecaron'] = 444;
  46641. t['Ydieresis'] = 722;
  46642. t['divide'] = 570;
  46643. t['Yacute'] = 722;
  46644. t['Acircumflex'] = 722;
  46645. t['aacute'] = 500;
  46646. t['Ucircumflex'] = 722;
  46647. t['yacute'] = 500;
  46648. t['scommaaccent'] = 389;
  46649. t['ecircumflex'] = 444;
  46650. t['Uring'] = 722;
  46651. t['Udieresis'] = 722;
  46652. t['aogonek'] = 500;
  46653. t['Uacute'] = 722;
  46654. t['uogonek'] = 556;
  46655. t['Edieresis'] = 667;
  46656. t['Dcroat'] = 722;
  46657. t['commaaccent'] = 250;
  46658. t['copyright'] = 747;
  46659. t['Emacron'] = 667;
  46660. t['ccaron'] = 444;
  46661. t['aring'] = 500;
  46662. t['Ncommaaccent'] = 722;
  46663. t['lacute'] = 278;
  46664. t['agrave'] = 500;
  46665. t['Tcommaaccent'] = 667;
  46666. t['Cacute'] = 722;
  46667. t['atilde'] = 500;
  46668. t['Edotaccent'] = 667;
  46669. t['scaron'] = 389;
  46670. t['scedilla'] = 389;
  46671. t['iacute'] = 278;
  46672. t['lozenge'] = 494;
  46673. t['Rcaron'] = 722;
  46674. t['Gcommaaccent'] = 778;
  46675. t['ucircumflex'] = 556;
  46676. t['acircumflex'] = 500;
  46677. t['Amacron'] = 722;
  46678. t['rcaron'] = 444;
  46679. t['ccedilla'] = 444;
  46680. t['Zdotaccent'] = 667;
  46681. t['Thorn'] = 611;
  46682. t['Omacron'] = 778;
  46683. t['Racute'] = 722;
  46684. t['Sacute'] = 556;
  46685. t['dcaron'] = 672;
  46686. t['Umacron'] = 722;
  46687. t['uring'] = 556;
  46688. t['threesuperior'] = 300;
  46689. t['Ograve'] = 778;
  46690. t['Agrave'] = 722;
  46691. t['Abreve'] = 722;
  46692. t['multiply'] = 570;
  46693. t['uacute'] = 556;
  46694. t['Tcaron'] = 667;
  46695. t['partialdiff'] = 494;
  46696. t['ydieresis'] = 500;
  46697. t['Nacute'] = 722;
  46698. t['icircumflex'] = 278;
  46699. t['Ecircumflex'] = 667;
  46700. t['adieresis'] = 500;
  46701. t['edieresis'] = 444;
  46702. t['cacute'] = 444;
  46703. t['nacute'] = 556;
  46704. t['umacron'] = 556;
  46705. t['Ncaron'] = 722;
  46706. t['Iacute'] = 389;
  46707. t['plusminus'] = 570;
  46708. t['brokenbar'] = 220;
  46709. t['registered'] = 747;
  46710. t['Gbreve'] = 778;
  46711. t['Idotaccent'] = 389;
  46712. t['summation'] = 600;
  46713. t['Egrave'] = 667;
  46714. t['racute'] = 444;
  46715. t['omacron'] = 500;
  46716. t['Zacute'] = 667;
  46717. t['Zcaron'] = 667;
  46718. t['greaterequal'] = 549;
  46719. t['Eth'] = 722;
  46720. t['Ccedilla'] = 722;
  46721. t['lcommaaccent'] = 278;
  46722. t['tcaron'] = 416;
  46723. t['eogonek'] = 444;
  46724. t['Uogonek'] = 722;
  46725. t['Aacute'] = 722;
  46726. t['Adieresis'] = 722;
  46727. t['egrave'] = 444;
  46728. t['zacute'] = 444;
  46729. t['iogonek'] = 278;
  46730. t['Oacute'] = 778;
  46731. t['oacute'] = 500;
  46732. t['amacron'] = 500;
  46733. t['sacute'] = 389;
  46734. t['idieresis'] = 278;
  46735. t['Ocircumflex'] = 778;
  46736. t['Ugrave'] = 722;
  46737. t['Delta'] = 612;
  46738. t['thorn'] = 556;
  46739. t['twosuperior'] = 300;
  46740. t['Odieresis'] = 778;
  46741. t['mu'] = 556;
  46742. t['igrave'] = 278;
  46743. t['ohungarumlaut'] = 500;
  46744. t['Eogonek'] = 667;
  46745. t['dcroat'] = 556;
  46746. t['threequarters'] = 750;
  46747. t['Scedilla'] = 556;
  46748. t['lcaron'] = 394;
  46749. t['Kcommaaccent'] = 778;
  46750. t['Lacute'] = 667;
  46751. t['trademark'] = 1000;
  46752. t['edotaccent'] = 444;
  46753. t['Igrave'] = 389;
  46754. t['Imacron'] = 389;
  46755. t['Lcaron'] = 667;
  46756. t['onehalf'] = 750;
  46757. t['lessequal'] = 549;
  46758. t['ocircumflex'] = 500;
  46759. t['ntilde'] = 556;
  46760. t['Uhungarumlaut'] = 722;
  46761. t['Eacute'] = 667;
  46762. t['emacron'] = 444;
  46763. t['gbreve'] = 500;
  46764. t['onequarter'] = 750;
  46765. t['Scaron'] = 556;
  46766. t['Scommaaccent'] = 556;
  46767. t['Ohungarumlaut'] = 778;
  46768. t['degree'] = 400;
  46769. t['ograve'] = 500;
  46770. t['Ccaron'] = 722;
  46771. t['ugrave'] = 556;
  46772. t['radical'] = 549;
  46773. t['Dcaron'] = 722;
  46774. t['rcommaaccent'] = 444;
  46775. t['Ntilde'] = 722;
  46776. t['otilde'] = 500;
  46777. t['Rcommaaccent'] = 722;
  46778. t['Lcommaaccent'] = 667;
  46779. t['Atilde'] = 722;
  46780. t['Aogonek'] = 722;
  46781. t['Aring'] = 722;
  46782. t['Otilde'] = 778;
  46783. t['zdotaccent'] = 444;
  46784. t['Ecaron'] = 667;
  46785. t['Iogonek'] = 389;
  46786. t['kcommaaccent'] = 556;
  46787. t['minus'] = 570;
  46788. t['Icircumflex'] = 389;
  46789. t['ncaron'] = 556;
  46790. t['tcommaaccent'] = 333;
  46791. t['logicalnot'] = 570;
  46792. t['odieresis'] = 500;
  46793. t['udieresis'] = 556;
  46794. t['notequal'] = 549;
  46795. t['gcommaaccent'] = 500;
  46796. t['eth'] = 500;
  46797. t['zcaron'] = 444;
  46798. t['ncommaaccent'] = 556;
  46799. t['onesuperior'] = 300;
  46800. t['imacron'] = 278;
  46801. t['Euro'] = 500;
  46802. });
  46803. t['Times-BoldItalic'] = getLookupTableFactory(function (t) {
  46804. t['space'] = 250;
  46805. t['exclam'] = 389;
  46806. t['quotedbl'] = 555;
  46807. t['numbersign'] = 500;
  46808. t['dollar'] = 500;
  46809. t['percent'] = 833;
  46810. t['ampersand'] = 778;
  46811. t['quoteright'] = 333;
  46812. t['parenleft'] = 333;
  46813. t['parenright'] = 333;
  46814. t['asterisk'] = 500;
  46815. t['plus'] = 570;
  46816. t['comma'] = 250;
  46817. t['hyphen'] = 333;
  46818. t['period'] = 250;
  46819. t['slash'] = 278;
  46820. t['zero'] = 500;
  46821. t['one'] = 500;
  46822. t['two'] = 500;
  46823. t['three'] = 500;
  46824. t['four'] = 500;
  46825. t['five'] = 500;
  46826. t['six'] = 500;
  46827. t['seven'] = 500;
  46828. t['eight'] = 500;
  46829. t['nine'] = 500;
  46830. t['colon'] = 333;
  46831. t['semicolon'] = 333;
  46832. t['less'] = 570;
  46833. t['equal'] = 570;
  46834. t['greater'] = 570;
  46835. t['question'] = 500;
  46836. t['at'] = 832;
  46837. t['A'] = 667;
  46838. t['B'] = 667;
  46839. t['C'] = 667;
  46840. t['D'] = 722;
  46841. t['E'] = 667;
  46842. t['F'] = 667;
  46843. t['G'] = 722;
  46844. t['H'] = 778;
  46845. t['I'] = 389;
  46846. t['J'] = 500;
  46847. t['K'] = 667;
  46848. t['L'] = 611;
  46849. t['M'] = 889;
  46850. t['N'] = 722;
  46851. t['O'] = 722;
  46852. t['P'] = 611;
  46853. t['Q'] = 722;
  46854. t['R'] = 667;
  46855. t['S'] = 556;
  46856. t['T'] = 611;
  46857. t['U'] = 722;
  46858. t['V'] = 667;
  46859. t['W'] = 889;
  46860. t['X'] = 667;
  46861. t['Y'] = 611;
  46862. t['Z'] = 611;
  46863. t['bracketleft'] = 333;
  46864. t['backslash'] = 278;
  46865. t['bracketright'] = 333;
  46866. t['asciicircum'] = 570;
  46867. t['underscore'] = 500;
  46868. t['quoteleft'] = 333;
  46869. t['a'] = 500;
  46870. t['b'] = 500;
  46871. t['c'] = 444;
  46872. t['d'] = 500;
  46873. t['e'] = 444;
  46874. t['f'] = 333;
  46875. t['g'] = 500;
  46876. t['h'] = 556;
  46877. t['i'] = 278;
  46878. t['j'] = 278;
  46879. t['k'] = 500;
  46880. t['l'] = 278;
  46881. t['m'] = 778;
  46882. t['n'] = 556;
  46883. t['o'] = 500;
  46884. t['p'] = 500;
  46885. t['q'] = 500;
  46886. t['r'] = 389;
  46887. t['s'] = 389;
  46888. t['t'] = 278;
  46889. t['u'] = 556;
  46890. t['v'] = 444;
  46891. t['w'] = 667;
  46892. t['x'] = 500;
  46893. t['y'] = 444;
  46894. t['z'] = 389;
  46895. t['braceleft'] = 348;
  46896. t['bar'] = 220;
  46897. t['braceright'] = 348;
  46898. t['asciitilde'] = 570;
  46899. t['exclamdown'] = 389;
  46900. t['cent'] = 500;
  46901. t['sterling'] = 500;
  46902. t['fraction'] = 167;
  46903. t['yen'] = 500;
  46904. t['florin'] = 500;
  46905. t['section'] = 500;
  46906. t['currency'] = 500;
  46907. t['quotesingle'] = 278;
  46908. t['quotedblleft'] = 500;
  46909. t['guillemotleft'] = 500;
  46910. t['guilsinglleft'] = 333;
  46911. t['guilsinglright'] = 333;
  46912. t['fi'] = 556;
  46913. t['fl'] = 556;
  46914. t['endash'] = 500;
  46915. t['dagger'] = 500;
  46916. t['daggerdbl'] = 500;
  46917. t['periodcentered'] = 250;
  46918. t['paragraph'] = 500;
  46919. t['bullet'] = 350;
  46920. t['quotesinglbase'] = 333;
  46921. t['quotedblbase'] = 500;
  46922. t['quotedblright'] = 500;
  46923. t['guillemotright'] = 500;
  46924. t['ellipsis'] = 1000;
  46925. t['perthousand'] = 1000;
  46926. t['questiondown'] = 500;
  46927. t['grave'] = 333;
  46928. t['acute'] = 333;
  46929. t['circumflex'] = 333;
  46930. t['tilde'] = 333;
  46931. t['macron'] = 333;
  46932. t['breve'] = 333;
  46933. t['dotaccent'] = 333;
  46934. t['dieresis'] = 333;
  46935. t['ring'] = 333;
  46936. t['cedilla'] = 333;
  46937. t['hungarumlaut'] = 333;
  46938. t['ogonek'] = 333;
  46939. t['caron'] = 333;
  46940. t['emdash'] = 1000;
  46941. t['AE'] = 944;
  46942. t['ordfeminine'] = 266;
  46943. t['Lslash'] = 611;
  46944. t['Oslash'] = 722;
  46945. t['OE'] = 944;
  46946. t['ordmasculine'] = 300;
  46947. t['ae'] = 722;
  46948. t['dotlessi'] = 278;
  46949. t['lslash'] = 278;
  46950. t['oslash'] = 500;
  46951. t['oe'] = 722;
  46952. t['germandbls'] = 500;
  46953. t['Idieresis'] = 389;
  46954. t['eacute'] = 444;
  46955. t['abreve'] = 500;
  46956. t['uhungarumlaut'] = 556;
  46957. t['ecaron'] = 444;
  46958. t['Ydieresis'] = 611;
  46959. t['divide'] = 570;
  46960. t['Yacute'] = 611;
  46961. t['Acircumflex'] = 667;
  46962. t['aacute'] = 500;
  46963. t['Ucircumflex'] = 722;
  46964. t['yacute'] = 444;
  46965. t['scommaaccent'] = 389;
  46966. t['ecircumflex'] = 444;
  46967. t['Uring'] = 722;
  46968. t['Udieresis'] = 722;
  46969. t['aogonek'] = 500;
  46970. t['Uacute'] = 722;
  46971. t['uogonek'] = 556;
  46972. t['Edieresis'] = 667;
  46973. t['Dcroat'] = 722;
  46974. t['commaaccent'] = 250;
  46975. t['copyright'] = 747;
  46976. t['Emacron'] = 667;
  46977. t['ccaron'] = 444;
  46978. t['aring'] = 500;
  46979. t['Ncommaaccent'] = 722;
  46980. t['lacute'] = 278;
  46981. t['agrave'] = 500;
  46982. t['Tcommaaccent'] = 611;
  46983. t['Cacute'] = 667;
  46984. t['atilde'] = 500;
  46985. t['Edotaccent'] = 667;
  46986. t['scaron'] = 389;
  46987. t['scedilla'] = 389;
  46988. t['iacute'] = 278;
  46989. t['lozenge'] = 494;
  46990. t['Rcaron'] = 667;
  46991. t['Gcommaaccent'] = 722;
  46992. t['ucircumflex'] = 556;
  46993. t['acircumflex'] = 500;
  46994. t['Amacron'] = 667;
  46995. t['rcaron'] = 389;
  46996. t['ccedilla'] = 444;
  46997. t['Zdotaccent'] = 611;
  46998. t['Thorn'] = 611;
  46999. t['Omacron'] = 722;
  47000. t['Racute'] = 667;
  47001. t['Sacute'] = 556;
  47002. t['dcaron'] = 608;
  47003. t['Umacron'] = 722;
  47004. t['uring'] = 556;
  47005. t['threesuperior'] = 300;
  47006. t['Ograve'] = 722;
  47007. t['Agrave'] = 667;
  47008. t['Abreve'] = 667;
  47009. t['multiply'] = 570;
  47010. t['uacute'] = 556;
  47011. t['Tcaron'] = 611;
  47012. t['partialdiff'] = 494;
  47013. t['ydieresis'] = 444;
  47014. t['Nacute'] = 722;
  47015. t['icircumflex'] = 278;
  47016. t['Ecircumflex'] = 667;
  47017. t['adieresis'] = 500;
  47018. t['edieresis'] = 444;
  47019. t['cacute'] = 444;
  47020. t['nacute'] = 556;
  47021. t['umacron'] = 556;
  47022. t['Ncaron'] = 722;
  47023. t['Iacute'] = 389;
  47024. t['plusminus'] = 570;
  47025. t['brokenbar'] = 220;
  47026. t['registered'] = 747;
  47027. t['Gbreve'] = 722;
  47028. t['Idotaccent'] = 389;
  47029. t['summation'] = 600;
  47030. t['Egrave'] = 667;
  47031. t['racute'] = 389;
  47032. t['omacron'] = 500;
  47033. t['Zacute'] = 611;
  47034. t['Zcaron'] = 611;
  47035. t['greaterequal'] = 549;
  47036. t['Eth'] = 722;
  47037. t['Ccedilla'] = 667;
  47038. t['lcommaaccent'] = 278;
  47039. t['tcaron'] = 366;
  47040. t['eogonek'] = 444;
  47041. t['Uogonek'] = 722;
  47042. t['Aacute'] = 667;
  47043. t['Adieresis'] = 667;
  47044. t['egrave'] = 444;
  47045. t['zacute'] = 389;
  47046. t['iogonek'] = 278;
  47047. t['Oacute'] = 722;
  47048. t['oacute'] = 500;
  47049. t['amacron'] = 500;
  47050. t['sacute'] = 389;
  47051. t['idieresis'] = 278;
  47052. t['Ocircumflex'] = 722;
  47053. t['Ugrave'] = 722;
  47054. t['Delta'] = 612;
  47055. t['thorn'] = 500;
  47056. t['twosuperior'] = 300;
  47057. t['Odieresis'] = 722;
  47058. t['mu'] = 576;
  47059. t['igrave'] = 278;
  47060. t['ohungarumlaut'] = 500;
  47061. t['Eogonek'] = 667;
  47062. t['dcroat'] = 500;
  47063. t['threequarters'] = 750;
  47064. t['Scedilla'] = 556;
  47065. t['lcaron'] = 382;
  47066. t['Kcommaaccent'] = 667;
  47067. t['Lacute'] = 611;
  47068. t['trademark'] = 1000;
  47069. t['edotaccent'] = 444;
  47070. t['Igrave'] = 389;
  47071. t['Imacron'] = 389;
  47072. t['Lcaron'] = 611;
  47073. t['onehalf'] = 750;
  47074. t['lessequal'] = 549;
  47075. t['ocircumflex'] = 500;
  47076. t['ntilde'] = 556;
  47077. t['Uhungarumlaut'] = 722;
  47078. t['Eacute'] = 667;
  47079. t['emacron'] = 444;
  47080. t['gbreve'] = 500;
  47081. t['onequarter'] = 750;
  47082. t['Scaron'] = 556;
  47083. t['Scommaaccent'] = 556;
  47084. t['Ohungarumlaut'] = 722;
  47085. t['degree'] = 400;
  47086. t['ograve'] = 500;
  47087. t['Ccaron'] = 667;
  47088. t['ugrave'] = 556;
  47089. t['radical'] = 549;
  47090. t['Dcaron'] = 722;
  47091. t['rcommaaccent'] = 389;
  47092. t['Ntilde'] = 722;
  47093. t['otilde'] = 500;
  47094. t['Rcommaaccent'] = 667;
  47095. t['Lcommaaccent'] = 611;
  47096. t['Atilde'] = 667;
  47097. t['Aogonek'] = 667;
  47098. t['Aring'] = 667;
  47099. t['Otilde'] = 722;
  47100. t['zdotaccent'] = 389;
  47101. t['Ecaron'] = 667;
  47102. t['Iogonek'] = 389;
  47103. t['kcommaaccent'] = 500;
  47104. t['minus'] = 606;
  47105. t['Icircumflex'] = 389;
  47106. t['ncaron'] = 556;
  47107. t['tcommaaccent'] = 278;
  47108. t['logicalnot'] = 606;
  47109. t['odieresis'] = 500;
  47110. t['udieresis'] = 556;
  47111. t['notequal'] = 549;
  47112. t['gcommaaccent'] = 500;
  47113. t['eth'] = 500;
  47114. t['zcaron'] = 389;
  47115. t['ncommaaccent'] = 556;
  47116. t['onesuperior'] = 300;
  47117. t['imacron'] = 278;
  47118. t['Euro'] = 500;
  47119. });
  47120. t['Times-Italic'] = getLookupTableFactory(function (t) {
  47121. t['space'] = 250;
  47122. t['exclam'] = 333;
  47123. t['quotedbl'] = 420;
  47124. t['numbersign'] = 500;
  47125. t['dollar'] = 500;
  47126. t['percent'] = 833;
  47127. t['ampersand'] = 778;
  47128. t['quoteright'] = 333;
  47129. t['parenleft'] = 333;
  47130. t['parenright'] = 333;
  47131. t['asterisk'] = 500;
  47132. t['plus'] = 675;
  47133. t['comma'] = 250;
  47134. t['hyphen'] = 333;
  47135. t['period'] = 250;
  47136. t['slash'] = 278;
  47137. t['zero'] = 500;
  47138. t['one'] = 500;
  47139. t['two'] = 500;
  47140. t['three'] = 500;
  47141. t['four'] = 500;
  47142. t['five'] = 500;
  47143. t['six'] = 500;
  47144. t['seven'] = 500;
  47145. t['eight'] = 500;
  47146. t['nine'] = 500;
  47147. t['colon'] = 333;
  47148. t['semicolon'] = 333;
  47149. t['less'] = 675;
  47150. t['equal'] = 675;
  47151. t['greater'] = 675;
  47152. t['question'] = 500;
  47153. t['at'] = 920;
  47154. t['A'] = 611;
  47155. t['B'] = 611;
  47156. t['C'] = 667;
  47157. t['D'] = 722;
  47158. t['E'] = 611;
  47159. t['F'] = 611;
  47160. t['G'] = 722;
  47161. t['H'] = 722;
  47162. t['I'] = 333;
  47163. t['J'] = 444;
  47164. t['K'] = 667;
  47165. t['L'] = 556;
  47166. t['M'] = 833;
  47167. t['N'] = 667;
  47168. t['O'] = 722;
  47169. t['P'] = 611;
  47170. t['Q'] = 722;
  47171. t['R'] = 611;
  47172. t['S'] = 500;
  47173. t['T'] = 556;
  47174. t['U'] = 722;
  47175. t['V'] = 611;
  47176. t['W'] = 833;
  47177. t['X'] = 611;
  47178. t['Y'] = 556;
  47179. t['Z'] = 556;
  47180. t['bracketleft'] = 389;
  47181. t['backslash'] = 278;
  47182. t['bracketright'] = 389;
  47183. t['asciicircum'] = 422;
  47184. t['underscore'] = 500;
  47185. t['quoteleft'] = 333;
  47186. t['a'] = 500;
  47187. t['b'] = 500;
  47188. t['c'] = 444;
  47189. t['d'] = 500;
  47190. t['e'] = 444;
  47191. t['f'] = 278;
  47192. t['g'] = 500;
  47193. t['h'] = 500;
  47194. t['i'] = 278;
  47195. t['j'] = 278;
  47196. t['k'] = 444;
  47197. t['l'] = 278;
  47198. t['m'] = 722;
  47199. t['n'] = 500;
  47200. t['o'] = 500;
  47201. t['p'] = 500;
  47202. t['q'] = 500;
  47203. t['r'] = 389;
  47204. t['s'] = 389;
  47205. t['t'] = 278;
  47206. t['u'] = 500;
  47207. t['v'] = 444;
  47208. t['w'] = 667;
  47209. t['x'] = 444;
  47210. t['y'] = 444;
  47211. t['z'] = 389;
  47212. t['braceleft'] = 400;
  47213. t['bar'] = 275;
  47214. t['braceright'] = 400;
  47215. t['asciitilde'] = 541;
  47216. t['exclamdown'] = 389;
  47217. t['cent'] = 500;
  47218. t['sterling'] = 500;
  47219. t['fraction'] = 167;
  47220. t['yen'] = 500;
  47221. t['florin'] = 500;
  47222. t['section'] = 500;
  47223. t['currency'] = 500;
  47224. t['quotesingle'] = 214;
  47225. t['quotedblleft'] = 556;
  47226. t['guillemotleft'] = 500;
  47227. t['guilsinglleft'] = 333;
  47228. t['guilsinglright'] = 333;
  47229. t['fi'] = 500;
  47230. t['fl'] = 500;
  47231. t['endash'] = 500;
  47232. t['dagger'] = 500;
  47233. t['daggerdbl'] = 500;
  47234. t['periodcentered'] = 250;
  47235. t['paragraph'] = 523;
  47236. t['bullet'] = 350;
  47237. t['quotesinglbase'] = 333;
  47238. t['quotedblbase'] = 556;
  47239. t['quotedblright'] = 556;
  47240. t['guillemotright'] = 500;
  47241. t['ellipsis'] = 889;
  47242. t['perthousand'] = 1000;
  47243. t['questiondown'] = 500;
  47244. t['grave'] = 333;
  47245. t['acute'] = 333;
  47246. t['circumflex'] = 333;
  47247. t['tilde'] = 333;
  47248. t['macron'] = 333;
  47249. t['breve'] = 333;
  47250. t['dotaccent'] = 333;
  47251. t['dieresis'] = 333;
  47252. t['ring'] = 333;
  47253. t['cedilla'] = 333;
  47254. t['hungarumlaut'] = 333;
  47255. t['ogonek'] = 333;
  47256. t['caron'] = 333;
  47257. t['emdash'] = 889;
  47258. t['AE'] = 889;
  47259. t['ordfeminine'] = 276;
  47260. t['Lslash'] = 556;
  47261. t['Oslash'] = 722;
  47262. t['OE'] = 944;
  47263. t['ordmasculine'] = 310;
  47264. t['ae'] = 667;
  47265. t['dotlessi'] = 278;
  47266. t['lslash'] = 278;
  47267. t['oslash'] = 500;
  47268. t['oe'] = 667;
  47269. t['germandbls'] = 500;
  47270. t['Idieresis'] = 333;
  47271. t['eacute'] = 444;
  47272. t['abreve'] = 500;
  47273. t['uhungarumlaut'] = 500;
  47274. t['ecaron'] = 444;
  47275. t['Ydieresis'] = 556;
  47276. t['divide'] = 675;
  47277. t['Yacute'] = 556;
  47278. t['Acircumflex'] = 611;
  47279. t['aacute'] = 500;
  47280. t['Ucircumflex'] = 722;
  47281. t['yacute'] = 444;
  47282. t['scommaaccent'] = 389;
  47283. t['ecircumflex'] = 444;
  47284. t['Uring'] = 722;
  47285. t['Udieresis'] = 722;
  47286. t['aogonek'] = 500;
  47287. t['Uacute'] = 722;
  47288. t['uogonek'] = 500;
  47289. t['Edieresis'] = 611;
  47290. t['Dcroat'] = 722;
  47291. t['commaaccent'] = 250;
  47292. t['copyright'] = 760;
  47293. t['Emacron'] = 611;
  47294. t['ccaron'] = 444;
  47295. t['aring'] = 500;
  47296. t['Ncommaaccent'] = 667;
  47297. t['lacute'] = 278;
  47298. t['agrave'] = 500;
  47299. t['Tcommaaccent'] = 556;
  47300. t['Cacute'] = 667;
  47301. t['atilde'] = 500;
  47302. t['Edotaccent'] = 611;
  47303. t['scaron'] = 389;
  47304. t['scedilla'] = 389;
  47305. t['iacute'] = 278;
  47306. t['lozenge'] = 471;
  47307. t['Rcaron'] = 611;
  47308. t['Gcommaaccent'] = 722;
  47309. t['ucircumflex'] = 500;
  47310. t['acircumflex'] = 500;
  47311. t['Amacron'] = 611;
  47312. t['rcaron'] = 389;
  47313. t['ccedilla'] = 444;
  47314. t['Zdotaccent'] = 556;
  47315. t['Thorn'] = 611;
  47316. t['Omacron'] = 722;
  47317. t['Racute'] = 611;
  47318. t['Sacute'] = 500;
  47319. t['dcaron'] = 544;
  47320. t['Umacron'] = 722;
  47321. t['uring'] = 500;
  47322. t['threesuperior'] = 300;
  47323. t['Ograve'] = 722;
  47324. t['Agrave'] = 611;
  47325. t['Abreve'] = 611;
  47326. t['multiply'] = 675;
  47327. t['uacute'] = 500;
  47328. t['Tcaron'] = 556;
  47329. t['partialdiff'] = 476;
  47330. t['ydieresis'] = 444;
  47331. t['Nacute'] = 667;
  47332. t['icircumflex'] = 278;
  47333. t['Ecircumflex'] = 611;
  47334. t['adieresis'] = 500;
  47335. t['edieresis'] = 444;
  47336. t['cacute'] = 444;
  47337. t['nacute'] = 500;
  47338. t['umacron'] = 500;
  47339. t['Ncaron'] = 667;
  47340. t['Iacute'] = 333;
  47341. t['plusminus'] = 675;
  47342. t['brokenbar'] = 275;
  47343. t['registered'] = 760;
  47344. t['Gbreve'] = 722;
  47345. t['Idotaccent'] = 333;
  47346. t['summation'] = 600;
  47347. t['Egrave'] = 611;
  47348. t['racute'] = 389;
  47349. t['omacron'] = 500;
  47350. t['Zacute'] = 556;
  47351. t['Zcaron'] = 556;
  47352. t['greaterequal'] = 549;
  47353. t['Eth'] = 722;
  47354. t['Ccedilla'] = 667;
  47355. t['lcommaaccent'] = 278;
  47356. t['tcaron'] = 300;
  47357. t['eogonek'] = 444;
  47358. t['Uogonek'] = 722;
  47359. t['Aacute'] = 611;
  47360. t['Adieresis'] = 611;
  47361. t['egrave'] = 444;
  47362. t['zacute'] = 389;
  47363. t['iogonek'] = 278;
  47364. t['Oacute'] = 722;
  47365. t['oacute'] = 500;
  47366. t['amacron'] = 500;
  47367. t['sacute'] = 389;
  47368. t['idieresis'] = 278;
  47369. t['Ocircumflex'] = 722;
  47370. t['Ugrave'] = 722;
  47371. t['Delta'] = 612;
  47372. t['thorn'] = 500;
  47373. t['twosuperior'] = 300;
  47374. t['Odieresis'] = 722;
  47375. t['mu'] = 500;
  47376. t['igrave'] = 278;
  47377. t['ohungarumlaut'] = 500;
  47378. t['Eogonek'] = 611;
  47379. t['dcroat'] = 500;
  47380. t['threequarters'] = 750;
  47381. t['Scedilla'] = 500;
  47382. t['lcaron'] = 300;
  47383. t['Kcommaaccent'] = 667;
  47384. t['Lacute'] = 556;
  47385. t['trademark'] = 980;
  47386. t['edotaccent'] = 444;
  47387. t['Igrave'] = 333;
  47388. t['Imacron'] = 333;
  47389. t['Lcaron'] = 611;
  47390. t['onehalf'] = 750;
  47391. t['lessequal'] = 549;
  47392. t['ocircumflex'] = 500;
  47393. t['ntilde'] = 500;
  47394. t['Uhungarumlaut'] = 722;
  47395. t['Eacute'] = 611;
  47396. t['emacron'] = 444;
  47397. t['gbreve'] = 500;
  47398. t['onequarter'] = 750;
  47399. t['Scaron'] = 500;
  47400. t['Scommaaccent'] = 500;
  47401. t['Ohungarumlaut'] = 722;
  47402. t['degree'] = 400;
  47403. t['ograve'] = 500;
  47404. t['Ccaron'] = 667;
  47405. t['ugrave'] = 500;
  47406. t['radical'] = 453;
  47407. t['Dcaron'] = 722;
  47408. t['rcommaaccent'] = 389;
  47409. t['Ntilde'] = 667;
  47410. t['otilde'] = 500;
  47411. t['Rcommaaccent'] = 611;
  47412. t['Lcommaaccent'] = 556;
  47413. t['Atilde'] = 611;
  47414. t['Aogonek'] = 611;
  47415. t['Aring'] = 611;
  47416. t['Otilde'] = 722;
  47417. t['zdotaccent'] = 389;
  47418. t['Ecaron'] = 611;
  47419. t['Iogonek'] = 333;
  47420. t['kcommaaccent'] = 444;
  47421. t['minus'] = 675;
  47422. t['Icircumflex'] = 333;
  47423. t['ncaron'] = 500;
  47424. t['tcommaaccent'] = 278;
  47425. t['logicalnot'] = 675;
  47426. t['odieresis'] = 500;
  47427. t['udieresis'] = 500;
  47428. t['notequal'] = 549;
  47429. t['gcommaaccent'] = 500;
  47430. t['eth'] = 500;
  47431. t['zcaron'] = 389;
  47432. t['ncommaaccent'] = 500;
  47433. t['onesuperior'] = 300;
  47434. t['imacron'] = 278;
  47435. t['Euro'] = 500;
  47436. });
  47437. t['ZapfDingbats'] = getLookupTableFactory(function (t) {
  47438. t['space'] = 278;
  47439. t['a1'] = 974;
  47440. t['a2'] = 961;
  47441. t['a202'] = 974;
  47442. t['a3'] = 980;
  47443. t['a4'] = 719;
  47444. t['a5'] = 789;
  47445. t['a119'] = 790;
  47446. t['a118'] = 791;
  47447. t['a117'] = 690;
  47448. t['a11'] = 960;
  47449. t['a12'] = 939;
  47450. t['a13'] = 549;
  47451. t['a14'] = 855;
  47452. t['a15'] = 911;
  47453. t['a16'] = 933;
  47454. t['a105'] = 911;
  47455. t['a17'] = 945;
  47456. t['a18'] = 974;
  47457. t['a19'] = 755;
  47458. t['a20'] = 846;
  47459. t['a21'] = 762;
  47460. t['a22'] = 761;
  47461. t['a23'] = 571;
  47462. t['a24'] = 677;
  47463. t['a25'] = 763;
  47464. t['a26'] = 760;
  47465. t['a27'] = 759;
  47466. t['a28'] = 754;
  47467. t['a6'] = 494;
  47468. t['a7'] = 552;
  47469. t['a8'] = 537;
  47470. t['a9'] = 577;
  47471. t['a10'] = 692;
  47472. t['a29'] = 786;
  47473. t['a30'] = 788;
  47474. t['a31'] = 788;
  47475. t['a32'] = 790;
  47476. t['a33'] = 793;
  47477. t['a34'] = 794;
  47478. t['a35'] = 816;
  47479. t['a36'] = 823;
  47480. t['a37'] = 789;
  47481. t['a38'] = 841;
  47482. t['a39'] = 823;
  47483. t['a40'] = 833;
  47484. t['a41'] = 816;
  47485. t['a42'] = 831;
  47486. t['a43'] = 923;
  47487. t['a44'] = 744;
  47488. t['a45'] = 723;
  47489. t['a46'] = 749;
  47490. t['a47'] = 790;
  47491. t['a48'] = 792;
  47492. t['a49'] = 695;
  47493. t['a50'] = 776;
  47494. t['a51'] = 768;
  47495. t['a52'] = 792;
  47496. t['a53'] = 759;
  47497. t['a54'] = 707;
  47498. t['a55'] = 708;
  47499. t['a56'] = 682;
  47500. t['a57'] = 701;
  47501. t['a58'] = 826;
  47502. t['a59'] = 815;
  47503. t['a60'] = 789;
  47504. t['a61'] = 789;
  47505. t['a62'] = 707;
  47506. t['a63'] = 687;
  47507. t['a64'] = 696;
  47508. t['a65'] = 689;
  47509. t['a66'] = 786;
  47510. t['a67'] = 787;
  47511. t['a68'] = 713;
  47512. t['a69'] = 791;
  47513. t['a70'] = 785;
  47514. t['a71'] = 791;
  47515. t['a72'] = 873;
  47516. t['a73'] = 761;
  47517. t['a74'] = 762;
  47518. t['a203'] = 762;
  47519. t['a75'] = 759;
  47520. t['a204'] = 759;
  47521. t['a76'] = 892;
  47522. t['a77'] = 892;
  47523. t['a78'] = 788;
  47524. t['a79'] = 784;
  47525. t['a81'] = 438;
  47526. t['a82'] = 138;
  47527. t['a83'] = 277;
  47528. t['a84'] = 415;
  47529. t['a97'] = 392;
  47530. t['a98'] = 392;
  47531. t['a99'] = 668;
  47532. t['a100'] = 668;
  47533. t['a89'] = 390;
  47534. t['a90'] = 390;
  47535. t['a93'] = 317;
  47536. t['a94'] = 317;
  47537. t['a91'] = 276;
  47538. t['a92'] = 276;
  47539. t['a205'] = 509;
  47540. t['a85'] = 509;
  47541. t['a206'] = 410;
  47542. t['a86'] = 410;
  47543. t['a87'] = 234;
  47544. t['a88'] = 234;
  47545. t['a95'] = 334;
  47546. t['a96'] = 334;
  47547. t['a101'] = 732;
  47548. t['a102'] = 544;
  47549. t['a103'] = 544;
  47550. t['a104'] = 910;
  47551. t['a106'] = 667;
  47552. t['a107'] = 760;
  47553. t['a108'] = 760;
  47554. t['a112'] = 776;
  47555. t['a111'] = 595;
  47556. t['a110'] = 694;
  47557. t['a109'] = 626;
  47558. t['a120'] = 788;
  47559. t['a121'] = 788;
  47560. t['a122'] = 788;
  47561. t['a123'] = 788;
  47562. t['a124'] = 788;
  47563. t['a125'] = 788;
  47564. t['a126'] = 788;
  47565. t['a127'] = 788;
  47566. t['a128'] = 788;
  47567. t['a129'] = 788;
  47568. t['a130'] = 788;
  47569. t['a131'] = 788;
  47570. t['a132'] = 788;
  47571. t['a133'] = 788;
  47572. t['a134'] = 788;
  47573. t['a135'] = 788;
  47574. t['a136'] = 788;
  47575. t['a137'] = 788;
  47576. t['a138'] = 788;
  47577. t['a139'] = 788;
  47578. t['a140'] = 788;
  47579. t['a141'] = 788;
  47580. t['a142'] = 788;
  47581. t['a143'] = 788;
  47582. t['a144'] = 788;
  47583. t['a145'] = 788;
  47584. t['a146'] = 788;
  47585. t['a147'] = 788;
  47586. t['a148'] = 788;
  47587. t['a149'] = 788;
  47588. t['a150'] = 788;
  47589. t['a151'] = 788;
  47590. t['a152'] = 788;
  47591. t['a153'] = 788;
  47592. t['a154'] = 788;
  47593. t['a155'] = 788;
  47594. t['a156'] = 788;
  47595. t['a157'] = 788;
  47596. t['a158'] = 788;
  47597. t['a159'] = 788;
  47598. t['a160'] = 894;
  47599. t['a161'] = 838;
  47600. t['a163'] = 1016;
  47601. t['a164'] = 458;
  47602. t['a196'] = 748;
  47603. t['a165'] = 924;
  47604. t['a192'] = 748;
  47605. t['a166'] = 918;
  47606. t['a167'] = 927;
  47607. t['a168'] = 928;
  47608. t['a169'] = 928;
  47609. t['a170'] = 834;
  47610. t['a171'] = 873;
  47611. t['a172'] = 828;
  47612. t['a173'] = 924;
  47613. t['a162'] = 924;
  47614. t['a174'] = 917;
  47615. t['a175'] = 930;
  47616. t['a176'] = 931;
  47617. t['a177'] = 463;
  47618. t['a178'] = 883;
  47619. t['a179'] = 836;
  47620. t['a193'] = 836;
  47621. t['a180'] = 867;
  47622. t['a199'] = 867;
  47623. t['a181'] = 696;
  47624. t['a200'] = 696;
  47625. t['a182'] = 874;
  47626. t['a201'] = 874;
  47627. t['a183'] = 760;
  47628. t['a184'] = 946;
  47629. t['a197'] = 771;
  47630. t['a185'] = 865;
  47631. t['a194'] = 771;
  47632. t['a198'] = 888;
  47633. t['a186'] = 967;
  47634. t['a195'] = 888;
  47635. t['a187'] = 831;
  47636. t['a188'] = 873;
  47637. t['a189'] = 927;
  47638. t['a190'] = 970;
  47639. t['a191'] = 918;
  47640. });
  47641. });
  47642. exports.getMetrics = getMetrics;
  47643. /***/ }),
  47644. /* 31 */
  47645. /***/ (function(module, exports, __w_pdfjs_require__) {
  47646. "use strict";
  47647. var sharedUtil = __w_pdfjs_require__(0);
  47648. var Uint32ArrayView = sharedUtil.Uint32ArrayView;
  47649. var MurmurHash3_64 = function MurmurHash3_64Closure(seed) {
  47650. var MASK_HIGH = 0xffff0000;
  47651. var MASK_LOW = 0xffff;
  47652. function MurmurHash3_64(seed) {
  47653. var SEED = 0xc3d2e1f0;
  47654. this.h1 = seed ? seed & 0xffffffff : SEED;
  47655. this.h2 = seed ? seed & 0xffffffff : SEED;
  47656. }
  47657. var alwaysUseUint32ArrayView = false;
  47658. try {
  47659. new Uint32Array(new Uint8Array(5).buffer, 0, 1);
  47660. } catch (e) {
  47661. alwaysUseUint32ArrayView = true;
  47662. }
  47663. MurmurHash3_64.prototype = {
  47664. update: function MurmurHash3_64_update(input) {
  47665. var useUint32ArrayView = alwaysUseUint32ArrayView;
  47666. var i;
  47667. if (typeof input === 'string') {
  47668. var data = new Uint8Array(input.length * 2);
  47669. var length = 0;
  47670. for (i = 0; i < input.length; i++) {
  47671. var code = input.charCodeAt(i);
  47672. if (code <= 0xff) {
  47673. data[length++] = code;
  47674. } else {
  47675. data[length++] = code >>> 8;
  47676. data[length++] = code & 0xff;
  47677. }
  47678. }
  47679. } else if (input instanceof Uint8Array) {
  47680. data = input;
  47681. length = data.length;
  47682. } else if (typeof input === 'object' && 'length' in input) {
  47683. data = input;
  47684. length = data.length;
  47685. useUint32ArrayView = true;
  47686. } else {
  47687. throw new Error('Wrong data format in MurmurHash3_64_update. ' + 'Input must be a string or array.');
  47688. }
  47689. var blockCounts = length >> 2;
  47690. var tailLength = length - blockCounts * 4;
  47691. var dataUint32 = useUint32ArrayView ? new Uint32ArrayView(data, blockCounts) : new Uint32Array(data.buffer, 0, blockCounts);
  47692. var k1 = 0;
  47693. var k2 = 0;
  47694. var h1 = this.h1;
  47695. var h2 = this.h2;
  47696. var C1 = 0xcc9e2d51;
  47697. var C2 = 0x1b873593;
  47698. var C1_LOW = C1 & MASK_LOW;
  47699. var C2_LOW = C2 & MASK_LOW;
  47700. for (i = 0; i < blockCounts; i++) {
  47701. if (i & 1) {
  47702. k1 = dataUint32[i];
  47703. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  47704. k1 = k1 << 15 | k1 >>> 17;
  47705. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  47706. h1 ^= k1;
  47707. h1 = h1 << 13 | h1 >>> 19;
  47708. h1 = h1 * 5 + 0xe6546b64;
  47709. } else {
  47710. k2 = dataUint32[i];
  47711. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  47712. k2 = k2 << 15 | k2 >>> 17;
  47713. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  47714. h2 ^= k2;
  47715. h2 = h2 << 13 | h2 >>> 19;
  47716. h2 = h2 * 5 + 0xe6546b64;
  47717. }
  47718. }
  47719. k1 = 0;
  47720. switch (tailLength) {
  47721. case 3:
  47722. k1 ^= data[blockCounts * 4 + 2] << 16;
  47723. case 2:
  47724. k1 ^= data[blockCounts * 4 + 1] << 8;
  47725. case 1:
  47726. k1 ^= data[blockCounts * 4];
  47727. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  47728. k1 = k1 << 15 | k1 >>> 17;
  47729. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  47730. if (blockCounts & 1) {
  47731. h1 ^= k1;
  47732. } else {
  47733. h2 ^= k1;
  47734. }
  47735. }
  47736. this.h1 = h1;
  47737. this.h2 = h2;
  47738. return this;
  47739. },
  47740. hexdigest: function MurmurHash3_64_hexdigest() {
  47741. var h1 = this.h1;
  47742. var h2 = this.h2;
  47743. h1 ^= h2 >>> 1;
  47744. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  47745. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  47746. h1 ^= h2 >>> 1;
  47747. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  47748. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  47749. h1 ^= h2 >>> 1;
  47750. for (var i = 0, arr = [
  47751. h1,
  47752. h2
  47753. ], str = ''; i < arr.length; i++) {
  47754. var hex = (arr[i] >>> 0).toString(16);
  47755. while (hex.length < 8) {
  47756. hex = '0' + hex;
  47757. }
  47758. str += hex;
  47759. }
  47760. return str;
  47761. }
  47762. };
  47763. return MurmurHash3_64;
  47764. }();
  47765. exports.MurmurHash3_64 = MurmurHash3_64;
  47766. /***/ }),
  47767. /* 32 */
  47768. /***/ (function(module, exports, __w_pdfjs_require__) {
  47769. "use strict";
  47770. var sharedUtil = __w_pdfjs_require__(0);
  47771. var corePrimitives = __w_pdfjs_require__(1);
  47772. var coreFunction = __w_pdfjs_require__(6);
  47773. var coreColorSpace = __w_pdfjs_require__(3);
  47774. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  47775. var MissingDataException = sharedUtil.MissingDataException;
  47776. var Util = sharedUtil.Util;
  47777. var assert = sharedUtil.assert;
  47778. var error = sharedUtil.error;
  47779. var info = sharedUtil.info;
  47780. var warn = sharedUtil.warn;
  47781. var isStream = corePrimitives.isStream;
  47782. var PDFFunction = coreFunction.PDFFunction;
  47783. var ColorSpace = coreColorSpace.ColorSpace;
  47784. var ShadingType = {
  47785. FUNCTION_BASED: 1,
  47786. AXIAL: 2,
  47787. RADIAL: 3,
  47788. FREE_FORM_MESH: 4,
  47789. LATTICE_FORM_MESH: 5,
  47790. COONS_PATCH_MESH: 6,
  47791. TENSOR_PATCH_MESH: 7
  47792. };
  47793. var Pattern = function PatternClosure() {
  47794. function Pattern() {
  47795. error('should not call Pattern constructor');
  47796. }
  47797. Pattern.prototype = {
  47798. getPattern: function Pattern_getPattern(ctx) {
  47799. error('Should not call Pattern.getStyle: ' + ctx);
  47800. }
  47801. };
  47802. Pattern.parseShading = function Pattern_parseShading(shading, matrix, xref, res, handler) {
  47803. var dict = isStream(shading) ? shading.dict : shading;
  47804. var type = dict.get('ShadingType');
  47805. try {
  47806. switch (type) {
  47807. case ShadingType.AXIAL:
  47808. case ShadingType.RADIAL:
  47809. return new Shadings.RadialAxial(dict, matrix, xref, res);
  47810. case ShadingType.FREE_FORM_MESH:
  47811. case ShadingType.LATTICE_FORM_MESH:
  47812. case ShadingType.COONS_PATCH_MESH:
  47813. case ShadingType.TENSOR_PATCH_MESH:
  47814. return new Shadings.Mesh(shading, matrix, xref, res);
  47815. default:
  47816. throw new Error('Unsupported ShadingType: ' + type);
  47817. }
  47818. } catch (ex) {
  47819. if (ex instanceof MissingDataException) {
  47820. throw ex;
  47821. }
  47822. handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.shadingPattern });
  47823. warn(ex);
  47824. return new Shadings.Dummy();
  47825. }
  47826. };
  47827. return Pattern;
  47828. }();
  47829. var Shadings = {};
  47830. Shadings.SMALL_NUMBER = 1e-6;
  47831. Shadings.RadialAxial = function RadialAxialClosure() {
  47832. function RadialAxial(dict, matrix, xref, res) {
  47833. this.matrix = matrix;
  47834. this.coordsArr = dict.getArray('Coords');
  47835. this.shadingType = dict.get('ShadingType');
  47836. this.type = 'Pattern';
  47837. var cs = dict.get('ColorSpace', 'CS');
  47838. cs = ColorSpace.parse(cs, xref, res);
  47839. this.cs = cs;
  47840. var t0 = 0.0, t1 = 1.0;
  47841. if (dict.has('Domain')) {
  47842. var domainArr = dict.getArray('Domain');
  47843. t0 = domainArr[0];
  47844. t1 = domainArr[1];
  47845. }
  47846. var extendStart = false, extendEnd = false;
  47847. if (dict.has('Extend')) {
  47848. var extendArr = dict.getArray('Extend');
  47849. extendStart = extendArr[0];
  47850. extendEnd = extendArr[1];
  47851. }
  47852. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  47853. var x1 = this.coordsArr[0];
  47854. var y1 = this.coordsArr[1];
  47855. var r1 = this.coordsArr[2];
  47856. var x2 = this.coordsArr[3];
  47857. var y2 = this.coordsArr[4];
  47858. var r2 = this.coordsArr[5];
  47859. var distance = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  47860. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  47861. warn('Unsupported radial gradient.');
  47862. }
  47863. }
  47864. this.extendStart = extendStart;
  47865. this.extendEnd = extendEnd;
  47866. var fnObj = dict.get('Function');
  47867. var fn = PDFFunction.parseArray(xref, fnObj);
  47868. var diff = t1 - t0;
  47869. var step = diff / 10;
  47870. var colorStops = this.colorStops = [];
  47871. if (t0 >= t1 || step <= 0) {
  47872. info('Bad shading domain.');
  47873. return;
  47874. }
  47875. var color = new Float32Array(cs.numComps), ratio = new Float32Array(1);
  47876. var rgbColor;
  47877. for (var i = t0; i <= t1; i += step) {
  47878. ratio[0] = i;
  47879. fn(ratio, 0, color, 0);
  47880. rgbColor = cs.getRgb(color, 0);
  47881. var cssColor = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  47882. colorStops.push([
  47883. (i - t0) / diff,
  47884. cssColor
  47885. ]);
  47886. }
  47887. var background = 'transparent';
  47888. if (dict.has('Background')) {
  47889. rgbColor = cs.getRgb(dict.get('Background'), 0);
  47890. background = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  47891. }
  47892. if (!extendStart) {
  47893. colorStops.unshift([
  47894. 0,
  47895. background
  47896. ]);
  47897. colorStops[1][0] += Shadings.SMALL_NUMBER;
  47898. }
  47899. if (!extendEnd) {
  47900. colorStops[colorStops.length - 1][0] -= Shadings.SMALL_NUMBER;
  47901. colorStops.push([
  47902. 1,
  47903. background
  47904. ]);
  47905. }
  47906. this.colorStops = colorStops;
  47907. }
  47908. RadialAxial.prototype = {
  47909. getIR: function RadialAxial_getIR() {
  47910. var coordsArr = this.coordsArr;
  47911. var shadingType = this.shadingType;
  47912. var type, p0, p1, r0, r1;
  47913. if (shadingType === ShadingType.AXIAL) {
  47914. p0 = [
  47915. coordsArr[0],
  47916. coordsArr[1]
  47917. ];
  47918. p1 = [
  47919. coordsArr[2],
  47920. coordsArr[3]
  47921. ];
  47922. r0 = null;
  47923. r1 = null;
  47924. type = 'axial';
  47925. } else if (shadingType === ShadingType.RADIAL) {
  47926. p0 = [
  47927. coordsArr[0],
  47928. coordsArr[1]
  47929. ];
  47930. p1 = [
  47931. coordsArr[3],
  47932. coordsArr[4]
  47933. ];
  47934. r0 = coordsArr[2];
  47935. r1 = coordsArr[5];
  47936. type = 'radial';
  47937. } else {
  47938. error('getPattern type unknown: ' + shadingType);
  47939. }
  47940. var matrix = this.matrix;
  47941. if (matrix) {
  47942. p0 = Util.applyTransform(p0, matrix);
  47943. p1 = Util.applyTransform(p1, matrix);
  47944. if (shadingType === ShadingType.RADIAL) {
  47945. var scale = Util.singularValueDecompose2dScale(matrix);
  47946. r0 *= scale[0];
  47947. r1 *= scale[1];
  47948. }
  47949. }
  47950. return [
  47951. 'RadialAxial',
  47952. type,
  47953. this.colorStops,
  47954. p0,
  47955. p1,
  47956. r0,
  47957. r1
  47958. ];
  47959. }
  47960. };
  47961. return RadialAxial;
  47962. }();
  47963. Shadings.Mesh = function MeshClosure() {
  47964. function MeshStreamReader(stream, context) {
  47965. this.stream = stream;
  47966. this.context = context;
  47967. this.buffer = 0;
  47968. this.bufferLength = 0;
  47969. var numComps = context.numComps;
  47970. this.tmpCompsBuf = new Float32Array(numComps);
  47971. var csNumComps = context.colorSpace.numComps;
  47972. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  47973. }
  47974. MeshStreamReader.prototype = {
  47975. get hasData() {
  47976. if (this.stream.end) {
  47977. return this.stream.pos < this.stream.end;
  47978. }
  47979. if (this.bufferLength > 0) {
  47980. return true;
  47981. }
  47982. var nextByte = this.stream.getByte();
  47983. if (nextByte < 0) {
  47984. return false;
  47985. }
  47986. this.buffer = nextByte;
  47987. this.bufferLength = 8;
  47988. return true;
  47989. },
  47990. readBits: function MeshStreamReader_readBits(n) {
  47991. var buffer = this.buffer;
  47992. var bufferLength = this.bufferLength;
  47993. if (n === 32) {
  47994. if (bufferLength === 0) {
  47995. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  47996. }
  47997. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  47998. var nextByte = this.stream.getByte();
  47999. this.buffer = nextByte & (1 << bufferLength) - 1;
  48000. return (buffer << 8 - bufferLength | (nextByte & 0xFF) >> bufferLength) >>> 0;
  48001. }
  48002. if (n === 8 && bufferLength === 0) {
  48003. return this.stream.getByte();
  48004. }
  48005. while (bufferLength < n) {
  48006. buffer = buffer << 8 | this.stream.getByte();
  48007. bufferLength += 8;
  48008. }
  48009. bufferLength -= n;
  48010. this.bufferLength = bufferLength;
  48011. this.buffer = buffer & (1 << bufferLength) - 1;
  48012. return buffer >> bufferLength;
  48013. },
  48014. align: function MeshStreamReader_align() {
  48015. this.buffer = 0;
  48016. this.bufferLength = 0;
  48017. },
  48018. readFlag: function MeshStreamReader_readFlag() {
  48019. return this.readBits(this.context.bitsPerFlag);
  48020. },
  48021. readCoordinate: function MeshStreamReader_readCoordinate() {
  48022. var bitsPerCoordinate = this.context.bitsPerCoordinate;
  48023. var xi = this.readBits(bitsPerCoordinate);
  48024. var yi = this.readBits(bitsPerCoordinate);
  48025. var decode = this.context.decode;
  48026. var scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  48027. return [
  48028. xi * scale * (decode[1] - decode[0]) + decode[0],
  48029. yi * scale * (decode[3] - decode[2]) + decode[2]
  48030. ];
  48031. },
  48032. readComponents: function MeshStreamReader_readComponents() {
  48033. var numComps = this.context.numComps;
  48034. var bitsPerComponent = this.context.bitsPerComponent;
  48035. var scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  48036. var decode = this.context.decode;
  48037. var components = this.tmpCompsBuf;
  48038. for (var i = 0, j = 4; i < numComps; i++, j += 2) {
  48039. var ci = this.readBits(bitsPerComponent);
  48040. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  48041. }
  48042. var color = this.tmpCsCompsBuf;
  48043. if (this.context.colorFn) {
  48044. this.context.colorFn(components, 0, color, 0);
  48045. }
  48046. return this.context.colorSpace.getRgb(color, 0);
  48047. }
  48048. };
  48049. function decodeType4Shading(mesh, reader) {
  48050. var coords = mesh.coords;
  48051. var colors = mesh.colors;
  48052. var operators = [];
  48053. var ps = [];
  48054. var verticesLeft = 0;
  48055. while (reader.hasData) {
  48056. var f = reader.readFlag();
  48057. var coord = reader.readCoordinate();
  48058. var color = reader.readComponents();
  48059. if (verticesLeft === 0) {
  48060. assert(0 <= f && f <= 2, 'Unknown type4 flag');
  48061. switch (f) {
  48062. case 0:
  48063. verticesLeft = 3;
  48064. break;
  48065. case 1:
  48066. ps.push(ps[ps.length - 2], ps[ps.length - 1]);
  48067. verticesLeft = 1;
  48068. break;
  48069. case 2:
  48070. ps.push(ps[ps.length - 3], ps[ps.length - 1]);
  48071. verticesLeft = 1;
  48072. break;
  48073. }
  48074. operators.push(f);
  48075. }
  48076. ps.push(coords.length);
  48077. coords.push(coord);
  48078. colors.push(color);
  48079. verticesLeft--;
  48080. reader.align();
  48081. }
  48082. mesh.figures.push({
  48083. type: 'triangles',
  48084. coords: new Int32Array(ps),
  48085. colors: new Int32Array(ps)
  48086. });
  48087. }
  48088. function decodeType5Shading(mesh, reader, verticesPerRow) {
  48089. var coords = mesh.coords;
  48090. var colors = mesh.colors;
  48091. var ps = [];
  48092. while (reader.hasData) {
  48093. var coord = reader.readCoordinate();
  48094. var color = reader.readComponents();
  48095. ps.push(coords.length);
  48096. coords.push(coord);
  48097. colors.push(color);
  48098. }
  48099. mesh.figures.push({
  48100. type: 'lattice',
  48101. coords: new Int32Array(ps),
  48102. colors: new Int32Array(ps),
  48103. verticesPerRow: verticesPerRow
  48104. });
  48105. }
  48106. var MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3;
  48107. var MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20;
  48108. var TRIANGLE_DENSITY = 20;
  48109. var getB = function getBClosure() {
  48110. function buildB(count) {
  48111. var lut = [];
  48112. for (var i = 0; i <= count; i++) {
  48113. var t = i / count, t_ = 1 - t;
  48114. lut.push(new Float32Array([
  48115. t_ * t_ * t_,
  48116. 3 * t * t_ * t_,
  48117. 3 * t * t * t_,
  48118. t * t * t
  48119. ]));
  48120. }
  48121. return lut;
  48122. }
  48123. var cache = [];
  48124. return function getB(count) {
  48125. if (!cache[count]) {
  48126. cache[count] = buildB(count);
  48127. }
  48128. return cache[count];
  48129. };
  48130. }();
  48131. function buildFigureFromPatch(mesh, index) {
  48132. var figure = mesh.figures[index];
  48133. assert(figure.type === 'patch', 'Unexpected patch mesh figure');
  48134. var coords = mesh.coords, colors = mesh.colors;
  48135. var pi = figure.coords;
  48136. var ci = figure.colors;
  48137. var figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  48138. var figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  48139. var figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  48140. var figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  48141. var splitXBy = Math.ceil((figureMaxX - figureMinX) * TRIANGLE_DENSITY / (mesh.bounds[2] - mesh.bounds[0]));
  48142. splitXBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  48143. var splitYBy = Math.ceil((figureMaxY - figureMinY) * TRIANGLE_DENSITY / (mesh.bounds[3] - mesh.bounds[1]));
  48144. splitYBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  48145. var verticesPerRow = splitXBy + 1;
  48146. var figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  48147. var figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  48148. var k = 0;
  48149. var cl = new Uint8Array(3), cr = new Uint8Array(3);
  48150. var c0 = colors[ci[0]], c1 = colors[ci[1]], c2 = colors[ci[2]], c3 = colors[ci[3]];
  48151. var bRow = getB(splitYBy), bCol = getB(splitXBy);
  48152. for (var row = 0; row <= splitYBy; row++) {
  48153. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  48154. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  48155. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  48156. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  48157. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  48158. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  48159. for (var col = 0; col <= splitXBy; col++, k++) {
  48160. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  48161. continue;
  48162. }
  48163. var x = 0, y = 0;
  48164. var q = 0;
  48165. for (var i = 0; i <= 3; i++) {
  48166. for (var j = 0; j <= 3; j++, q++) {
  48167. var m = bRow[row][i] * bCol[col][j];
  48168. x += coords[pi[q]][0] * m;
  48169. y += coords[pi[q]][1] * m;
  48170. }
  48171. }
  48172. figureCoords[k] = coords.length;
  48173. coords.push([
  48174. x,
  48175. y
  48176. ]);
  48177. figureColors[k] = colors.length;
  48178. var newColor = new Uint8Array(3);
  48179. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  48180. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  48181. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  48182. colors.push(newColor);
  48183. }
  48184. }
  48185. figureCoords[0] = pi[0];
  48186. figureColors[0] = ci[0];
  48187. figureCoords[splitXBy] = pi[3];
  48188. figureColors[splitXBy] = ci[1];
  48189. figureCoords[verticesPerRow * splitYBy] = pi[12];
  48190. figureColors[verticesPerRow * splitYBy] = ci[2];
  48191. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  48192. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  48193. mesh.figures[index] = {
  48194. type: 'lattice',
  48195. coords: figureCoords,
  48196. colors: figureColors,
  48197. verticesPerRow: verticesPerRow
  48198. };
  48199. }
  48200. function decodeType6Shading(mesh, reader) {
  48201. var coords = mesh.coords;
  48202. var colors = mesh.colors;
  48203. var ps = new Int32Array(16);
  48204. var cs = new Int32Array(4);
  48205. while (reader.hasData) {
  48206. var f = reader.readFlag();
  48207. assert(0 <= f && f <= 3, 'Unknown type6 flag');
  48208. var i, ii;
  48209. var pi = coords.length;
  48210. for (i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  48211. coords.push(reader.readCoordinate());
  48212. }
  48213. var ci = colors.length;
  48214. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  48215. colors.push(reader.readComponents());
  48216. }
  48217. var tmp1, tmp2, tmp3, tmp4;
  48218. switch (f) {
  48219. case 0:
  48220. ps[12] = pi + 3;
  48221. ps[13] = pi + 4;
  48222. ps[14] = pi + 5;
  48223. ps[15] = pi + 6;
  48224. ps[8] = pi + 2;
  48225. ps[11] = pi + 7;
  48226. ps[4] = pi + 1;
  48227. ps[7] = pi + 8;
  48228. ps[0] = pi;
  48229. ps[1] = pi + 11;
  48230. ps[2] = pi + 10;
  48231. ps[3] = pi + 9;
  48232. cs[2] = ci + 1;
  48233. cs[3] = ci + 2;
  48234. cs[0] = ci;
  48235. cs[1] = ci + 3;
  48236. break;
  48237. case 1:
  48238. tmp1 = ps[12];
  48239. tmp2 = ps[13];
  48240. tmp3 = ps[14];
  48241. tmp4 = ps[15];
  48242. ps[12] = tmp4;
  48243. ps[13] = pi + 0;
  48244. ps[14] = pi + 1;
  48245. ps[15] = pi + 2;
  48246. ps[8] = tmp3;
  48247. ps[11] = pi + 3;
  48248. ps[4] = tmp2;
  48249. ps[7] = pi + 4;
  48250. ps[0] = tmp1;
  48251. ps[1] = pi + 7;
  48252. ps[2] = pi + 6;
  48253. ps[3] = pi + 5;
  48254. tmp1 = cs[2];
  48255. tmp2 = cs[3];
  48256. cs[2] = tmp2;
  48257. cs[3] = ci;
  48258. cs[0] = tmp1;
  48259. cs[1] = ci + 1;
  48260. break;
  48261. case 2:
  48262. tmp1 = ps[15];
  48263. tmp2 = ps[11];
  48264. ps[12] = ps[3];
  48265. ps[13] = pi + 0;
  48266. ps[14] = pi + 1;
  48267. ps[15] = pi + 2;
  48268. ps[8] = ps[7];
  48269. ps[11] = pi + 3;
  48270. ps[4] = tmp2;
  48271. ps[7] = pi + 4;
  48272. ps[0] = tmp1;
  48273. ps[1] = pi + 7;
  48274. ps[2] = pi + 6;
  48275. ps[3] = pi + 5;
  48276. tmp1 = cs[3];
  48277. cs[2] = cs[1];
  48278. cs[3] = ci;
  48279. cs[0] = tmp1;
  48280. cs[1] = ci + 1;
  48281. break;
  48282. case 3:
  48283. ps[12] = ps[0];
  48284. ps[13] = pi + 0;
  48285. ps[14] = pi + 1;
  48286. ps[15] = pi + 2;
  48287. ps[8] = ps[1];
  48288. ps[11] = pi + 3;
  48289. ps[4] = ps[2];
  48290. ps[7] = pi + 4;
  48291. ps[0] = ps[3];
  48292. ps[1] = pi + 7;
  48293. ps[2] = pi + 6;
  48294. ps[3] = pi + 5;
  48295. cs[2] = cs[0];
  48296. cs[3] = ci;
  48297. cs[0] = cs[1];
  48298. cs[1] = ci + 1;
  48299. break;
  48300. }
  48301. ps[5] = coords.length;
  48302. coords.push([
  48303. (-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,
  48304. (-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
  48305. ]);
  48306. ps[6] = coords.length;
  48307. coords.push([
  48308. (-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,
  48309. (-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
  48310. ]);
  48311. ps[9] = coords.length;
  48312. coords.push([
  48313. (-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,
  48314. (-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
  48315. ]);
  48316. ps[10] = coords.length;
  48317. coords.push([
  48318. (-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,
  48319. (-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
  48320. ]);
  48321. mesh.figures.push({
  48322. type: 'patch',
  48323. coords: new Int32Array(ps),
  48324. colors: new Int32Array(cs)
  48325. });
  48326. }
  48327. }
  48328. function decodeType7Shading(mesh, reader) {
  48329. var coords = mesh.coords;
  48330. var colors = mesh.colors;
  48331. var ps = new Int32Array(16);
  48332. var cs = new Int32Array(4);
  48333. while (reader.hasData) {
  48334. var f = reader.readFlag();
  48335. assert(0 <= f && f <= 3, 'Unknown type7 flag');
  48336. var i, ii;
  48337. var pi = coords.length;
  48338. for (i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  48339. coords.push(reader.readCoordinate());
  48340. }
  48341. var ci = colors.length;
  48342. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  48343. colors.push(reader.readComponents());
  48344. }
  48345. var tmp1, tmp2, tmp3, tmp4;
  48346. switch (f) {
  48347. case 0:
  48348. ps[12] = pi + 3;
  48349. ps[13] = pi + 4;
  48350. ps[14] = pi + 5;
  48351. ps[15] = pi + 6;
  48352. ps[8] = pi + 2;
  48353. ps[9] = pi + 13;
  48354. ps[10] = pi + 14;
  48355. ps[11] = pi + 7;
  48356. ps[4] = pi + 1;
  48357. ps[5] = pi + 12;
  48358. ps[6] = pi + 15;
  48359. ps[7] = pi + 8;
  48360. ps[0] = pi;
  48361. ps[1] = pi + 11;
  48362. ps[2] = pi + 10;
  48363. ps[3] = pi + 9;
  48364. cs[2] = ci + 1;
  48365. cs[3] = ci + 2;
  48366. cs[0] = ci;
  48367. cs[1] = ci + 3;
  48368. break;
  48369. case 1:
  48370. tmp1 = ps[12];
  48371. tmp2 = ps[13];
  48372. tmp3 = ps[14];
  48373. tmp4 = ps[15];
  48374. ps[12] = tmp4;
  48375. ps[13] = pi + 0;
  48376. ps[14] = pi + 1;
  48377. ps[15] = pi + 2;
  48378. ps[8] = tmp3;
  48379. ps[9] = pi + 9;
  48380. ps[10] = pi + 10;
  48381. ps[11] = pi + 3;
  48382. ps[4] = tmp2;
  48383. ps[5] = pi + 8;
  48384. ps[6] = pi + 11;
  48385. ps[7] = pi + 4;
  48386. ps[0] = tmp1;
  48387. ps[1] = pi + 7;
  48388. ps[2] = pi + 6;
  48389. ps[3] = pi + 5;
  48390. tmp1 = cs[2];
  48391. tmp2 = cs[3];
  48392. cs[2] = tmp2;
  48393. cs[3] = ci;
  48394. cs[0] = tmp1;
  48395. cs[1] = ci + 1;
  48396. break;
  48397. case 2:
  48398. tmp1 = ps[15];
  48399. tmp2 = ps[11];
  48400. ps[12] = ps[3];
  48401. ps[13] = pi + 0;
  48402. ps[14] = pi + 1;
  48403. ps[15] = pi + 2;
  48404. ps[8] = ps[7];
  48405. ps[9] = pi + 9;
  48406. ps[10] = pi + 10;
  48407. ps[11] = pi + 3;
  48408. ps[4] = tmp2;
  48409. ps[5] = pi + 8;
  48410. ps[6] = pi + 11;
  48411. ps[7] = pi + 4;
  48412. ps[0] = tmp1;
  48413. ps[1] = pi + 7;
  48414. ps[2] = pi + 6;
  48415. ps[3] = pi + 5;
  48416. tmp1 = cs[3];
  48417. cs[2] = cs[1];
  48418. cs[3] = ci;
  48419. cs[0] = tmp1;
  48420. cs[1] = ci + 1;
  48421. break;
  48422. case 3:
  48423. ps[12] = ps[0];
  48424. ps[13] = pi + 0;
  48425. ps[14] = pi + 1;
  48426. ps[15] = pi + 2;
  48427. ps[8] = ps[1];
  48428. ps[9] = pi + 9;
  48429. ps[10] = pi + 10;
  48430. ps[11] = pi + 3;
  48431. ps[4] = ps[2];
  48432. ps[5] = pi + 8;
  48433. ps[6] = pi + 11;
  48434. ps[7] = pi + 4;
  48435. ps[0] = ps[3];
  48436. ps[1] = pi + 7;
  48437. ps[2] = pi + 6;
  48438. ps[3] = pi + 5;
  48439. cs[2] = cs[0];
  48440. cs[3] = ci;
  48441. cs[0] = cs[1];
  48442. cs[1] = ci + 1;
  48443. break;
  48444. }
  48445. mesh.figures.push({
  48446. type: 'patch',
  48447. coords: new Int32Array(ps),
  48448. colors: new Int32Array(cs)
  48449. });
  48450. }
  48451. }
  48452. function updateBounds(mesh) {
  48453. var minX = mesh.coords[0][0], minY = mesh.coords[0][1], maxX = minX, maxY = minY;
  48454. for (var i = 1, ii = mesh.coords.length; i < ii; i++) {
  48455. var x = mesh.coords[i][0], y = mesh.coords[i][1];
  48456. minX = minX > x ? x : minX;
  48457. minY = minY > y ? y : minY;
  48458. maxX = maxX < x ? x : maxX;
  48459. maxY = maxY < y ? y : maxY;
  48460. }
  48461. mesh.bounds = [
  48462. minX,
  48463. minY,
  48464. maxX,
  48465. maxY
  48466. ];
  48467. }
  48468. function packData(mesh) {
  48469. var i, ii, j, jj;
  48470. var coords = mesh.coords;
  48471. var coordsPacked = new Float32Array(coords.length * 2);
  48472. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  48473. var xy = coords[i];
  48474. coordsPacked[j++] = xy[0];
  48475. coordsPacked[j++] = xy[1];
  48476. }
  48477. mesh.coords = coordsPacked;
  48478. var colors = mesh.colors;
  48479. var colorsPacked = new Uint8Array(colors.length * 3);
  48480. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  48481. var c = colors[i];
  48482. colorsPacked[j++] = c[0];
  48483. colorsPacked[j++] = c[1];
  48484. colorsPacked[j++] = c[2];
  48485. }
  48486. mesh.colors = colorsPacked;
  48487. var figures = mesh.figures;
  48488. for (i = 0, ii = figures.length; i < ii; i++) {
  48489. var figure = figures[i], ps = figure.coords, cs = figure.colors;
  48490. for (j = 0, jj = ps.length; j < jj; j++) {
  48491. ps[j] *= 2;
  48492. cs[j] *= 3;
  48493. }
  48494. }
  48495. }
  48496. function Mesh(stream, matrix, xref, res) {
  48497. assert(isStream(stream), 'Mesh data is not a stream');
  48498. var dict = stream.dict;
  48499. this.matrix = matrix;
  48500. this.shadingType = dict.get('ShadingType');
  48501. this.type = 'Pattern';
  48502. this.bbox = dict.getArray('BBox');
  48503. var cs = dict.get('ColorSpace', 'CS');
  48504. cs = ColorSpace.parse(cs, xref, res);
  48505. this.cs = cs;
  48506. this.background = dict.has('Background') ? cs.getRgb(dict.get('Background'), 0) : null;
  48507. var fnObj = dict.get('Function');
  48508. var fn = fnObj ? PDFFunction.parseArray(xref, fnObj) : null;
  48509. this.coords = [];
  48510. this.colors = [];
  48511. this.figures = [];
  48512. var decodeContext = {
  48513. bitsPerCoordinate: dict.get('BitsPerCoordinate'),
  48514. bitsPerComponent: dict.get('BitsPerComponent'),
  48515. bitsPerFlag: dict.get('BitsPerFlag'),
  48516. decode: dict.getArray('Decode'),
  48517. colorFn: fn,
  48518. colorSpace: cs,
  48519. numComps: fn ? 1 : cs.numComps
  48520. };
  48521. var reader = new MeshStreamReader(stream, decodeContext);
  48522. var patchMesh = false;
  48523. switch (this.shadingType) {
  48524. case ShadingType.FREE_FORM_MESH:
  48525. decodeType4Shading(this, reader);
  48526. break;
  48527. case ShadingType.LATTICE_FORM_MESH:
  48528. var verticesPerRow = dict.get('VerticesPerRow') | 0;
  48529. assert(verticesPerRow >= 2, 'Invalid VerticesPerRow');
  48530. decodeType5Shading(this, reader, verticesPerRow);
  48531. break;
  48532. case ShadingType.COONS_PATCH_MESH:
  48533. decodeType6Shading(this, reader);
  48534. patchMesh = true;
  48535. break;
  48536. case ShadingType.TENSOR_PATCH_MESH:
  48537. decodeType7Shading(this, reader);
  48538. patchMesh = true;
  48539. break;
  48540. default:
  48541. error('Unsupported mesh type.');
  48542. break;
  48543. }
  48544. if (patchMesh) {
  48545. updateBounds(this);
  48546. for (var i = 0, ii = this.figures.length; i < ii; i++) {
  48547. buildFigureFromPatch(this, i);
  48548. }
  48549. }
  48550. updateBounds(this);
  48551. packData(this);
  48552. }
  48553. Mesh.prototype = {
  48554. getIR: function Mesh_getIR() {
  48555. return [
  48556. 'Mesh',
  48557. this.shadingType,
  48558. this.coords,
  48559. this.colors,
  48560. this.figures,
  48561. this.bounds,
  48562. this.matrix,
  48563. this.bbox,
  48564. this.background
  48565. ];
  48566. }
  48567. };
  48568. return Mesh;
  48569. }();
  48570. Shadings.Dummy = function DummyClosure() {
  48571. function Dummy() {
  48572. this.type = 'Pattern';
  48573. }
  48574. Dummy.prototype = {
  48575. getIR: function Dummy_getIR() {
  48576. return ['Dummy'];
  48577. }
  48578. };
  48579. return Dummy;
  48580. }();
  48581. function getTilingPatternIR(operatorList, dict, args) {
  48582. var matrix = dict.getArray('Matrix');
  48583. var bbox = dict.getArray('BBox');
  48584. var xstep = dict.get('XStep');
  48585. var ystep = dict.get('YStep');
  48586. var paintType = dict.get('PaintType');
  48587. var tilingType = dict.get('TilingType');
  48588. return [
  48589. 'TilingPattern',
  48590. args,
  48591. operatorList,
  48592. matrix,
  48593. bbox,
  48594. xstep,
  48595. ystep,
  48596. paintType,
  48597. tilingType
  48598. ];
  48599. }
  48600. exports.Pattern = Pattern;
  48601. exports.getTilingPatternIR = getTilingPatternIR;
  48602. /***/ }),
  48603. /* 33 */
  48604. /***/ (function(module, exports, __w_pdfjs_require__) {
  48605. "use strict";
  48606. var sharedUtil = __w_pdfjs_require__(0);
  48607. var coreStream = __w_pdfjs_require__(2);
  48608. var coreChunkedStream = __w_pdfjs_require__(12);
  48609. var coreDocument = __w_pdfjs_require__(24);
  48610. var warn = sharedUtil.warn;
  48611. var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
  48612. var shadow = sharedUtil.shadow;
  48613. var NotImplementedException = sharedUtil.NotImplementedException;
  48614. var MissingDataException = sharedUtil.MissingDataException;
  48615. var createPromiseCapability = sharedUtil.createPromiseCapability;
  48616. var Util = sharedUtil.Util;
  48617. var Stream = coreStream.Stream;
  48618. var ChunkedStreamManager = coreChunkedStream.ChunkedStreamManager;
  48619. var PDFDocument = coreDocument.PDFDocument;
  48620. var BasePdfManager = function BasePdfManagerClosure() {
  48621. function BasePdfManager() {
  48622. throw new Error('Cannot initialize BaseManagerManager');
  48623. }
  48624. BasePdfManager.prototype = {
  48625. get docId() {
  48626. return this._docId;
  48627. },
  48628. get password() {
  48629. return this._password;
  48630. },
  48631. get docBaseUrl() {
  48632. var docBaseUrl = null;
  48633. if (this._docBaseUrl) {
  48634. var absoluteUrl = createValidAbsoluteUrl(this._docBaseUrl);
  48635. if (absoluteUrl) {
  48636. docBaseUrl = absoluteUrl.href;
  48637. } else {
  48638. warn('Invalid absolute docBaseUrl: "' + this._docBaseUrl + '".');
  48639. }
  48640. }
  48641. return shadow(this, 'docBaseUrl', docBaseUrl);
  48642. },
  48643. onLoadedStream: function BasePdfManager_onLoadedStream() {
  48644. throw new NotImplementedException();
  48645. },
  48646. ensureDoc: function BasePdfManager_ensureDoc(prop, args) {
  48647. return this.ensure(this.pdfDocument, prop, args);
  48648. },
  48649. ensureXRef: function BasePdfManager_ensureXRef(prop, args) {
  48650. return this.ensure(this.pdfDocument.xref, prop, args);
  48651. },
  48652. ensureCatalog: function BasePdfManager_ensureCatalog(prop, args) {
  48653. return this.ensure(this.pdfDocument.catalog, prop, args);
  48654. },
  48655. getPage: function BasePdfManager_getPage(pageIndex) {
  48656. return this.pdfDocument.getPage(pageIndex);
  48657. },
  48658. cleanup: function BasePdfManager_cleanup() {
  48659. return this.pdfDocument.cleanup();
  48660. },
  48661. ensure: function BasePdfManager_ensure(obj, prop, args) {
  48662. return new NotImplementedException();
  48663. },
  48664. requestRange: function BasePdfManager_requestRange(begin, end) {
  48665. return new NotImplementedException();
  48666. },
  48667. requestLoadedStream: function BasePdfManager_requestLoadedStream() {
  48668. return new NotImplementedException();
  48669. },
  48670. sendProgressiveData: function BasePdfManager_sendProgressiveData(chunk) {
  48671. return new NotImplementedException();
  48672. },
  48673. updatePassword: function BasePdfManager_updatePassword(password) {
  48674. this._password = password;
  48675. },
  48676. terminate: function BasePdfManager_terminate() {
  48677. return new NotImplementedException();
  48678. }
  48679. };
  48680. return BasePdfManager;
  48681. }();
  48682. var LocalPdfManager = function LocalPdfManagerClosure() {
  48683. function LocalPdfManager(docId, data, password, evaluatorOptions, docBaseUrl) {
  48684. this._docId = docId;
  48685. this._password = password;
  48686. this._docBaseUrl = docBaseUrl;
  48687. this.evaluatorOptions = evaluatorOptions;
  48688. var stream = new Stream(data);
  48689. this.pdfDocument = new PDFDocument(this, stream);
  48690. this._loadedStreamCapability = createPromiseCapability();
  48691. this._loadedStreamCapability.resolve(stream);
  48692. }
  48693. Util.inherit(LocalPdfManager, BasePdfManager, {
  48694. ensure: function LocalPdfManager_ensure(obj, prop, args) {
  48695. return new Promise(function (resolve, reject) {
  48696. try {
  48697. var value = obj[prop];
  48698. var result;
  48699. if (typeof value === 'function') {
  48700. result = value.apply(obj, args);
  48701. } else {
  48702. result = value;
  48703. }
  48704. resolve(result);
  48705. } catch (e) {
  48706. reject(e);
  48707. }
  48708. });
  48709. },
  48710. requestRange: function LocalPdfManager_requestRange(begin, end) {
  48711. return Promise.resolve();
  48712. },
  48713. requestLoadedStream: function LocalPdfManager_requestLoadedStream() {
  48714. },
  48715. onLoadedStream: function LocalPdfManager_onLoadedStream() {
  48716. return this._loadedStreamCapability.promise;
  48717. },
  48718. terminate: function LocalPdfManager_terminate() {
  48719. }
  48720. });
  48721. return LocalPdfManager;
  48722. }();
  48723. var NetworkPdfManager = function NetworkPdfManagerClosure() {
  48724. function NetworkPdfManager(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {
  48725. this._docId = docId;
  48726. this._password = args.password;
  48727. this._docBaseUrl = docBaseUrl;
  48728. this.msgHandler = args.msgHandler;
  48729. this.evaluatorOptions = evaluatorOptions;
  48730. var params = {
  48731. msgHandler: args.msgHandler,
  48732. url: args.url,
  48733. length: args.length,
  48734. disableAutoFetch: args.disableAutoFetch,
  48735. rangeChunkSize: args.rangeChunkSize
  48736. };
  48737. this.streamManager = new ChunkedStreamManager(pdfNetworkStream, params);
  48738. this.pdfDocument = new PDFDocument(this, this.streamManager.getStream());
  48739. }
  48740. Util.inherit(NetworkPdfManager, BasePdfManager, {
  48741. ensure: function NetworkPdfManager_ensure(obj, prop, args) {
  48742. var pdfManager = this;
  48743. return new Promise(function (resolve, reject) {
  48744. function ensureHelper() {
  48745. try {
  48746. var result;
  48747. var value = obj[prop];
  48748. if (typeof value === 'function') {
  48749. result = value.apply(obj, args);
  48750. } else {
  48751. result = value;
  48752. }
  48753. resolve(result);
  48754. } catch (e) {
  48755. if (!(e instanceof MissingDataException)) {
  48756. reject(e);
  48757. return;
  48758. }
  48759. pdfManager.streamManager.requestRange(e.begin, e.end).then(ensureHelper, reject);
  48760. }
  48761. }
  48762. ensureHelper();
  48763. });
  48764. },
  48765. requestRange: function NetworkPdfManager_requestRange(begin, end) {
  48766. return this.streamManager.requestRange(begin, end);
  48767. },
  48768. requestLoadedStream: function NetworkPdfManager_requestLoadedStream() {
  48769. this.streamManager.requestAllChunks();
  48770. },
  48771. sendProgressiveData: function NetworkPdfManager_sendProgressiveData(chunk) {
  48772. this.streamManager.onReceiveData({ chunk: chunk });
  48773. },
  48774. onLoadedStream: function NetworkPdfManager_onLoadedStream() {
  48775. return this.streamManager.onLoadedStream();
  48776. },
  48777. terminate: function NetworkPdfManager_terminate() {
  48778. this.streamManager.abort();
  48779. }
  48780. });
  48781. return NetworkPdfManager;
  48782. }();
  48783. exports.LocalPdfManager = LocalPdfManager;
  48784. exports.NetworkPdfManager = NetworkPdfManager;
  48785. /***/ }),
  48786. /* 34 */
  48787. /***/ (function(module, exports, __w_pdfjs_require__) {
  48788. "use strict";
  48789. var sharedUtil = __w_pdfjs_require__(0);
  48790. var corePrimitives = __w_pdfjs_require__(1);
  48791. var error = sharedUtil.error;
  48792. var isSpace = sharedUtil.isSpace;
  48793. var EOF = corePrimitives.EOF;
  48794. var PostScriptParser = function PostScriptParserClosure() {
  48795. function PostScriptParser(lexer) {
  48796. this.lexer = lexer;
  48797. this.operators = [];
  48798. this.token = null;
  48799. this.prev = null;
  48800. }
  48801. PostScriptParser.prototype = {
  48802. nextToken: function PostScriptParser_nextToken() {
  48803. this.prev = this.token;
  48804. this.token = this.lexer.getToken();
  48805. },
  48806. accept: function PostScriptParser_accept(type) {
  48807. if (this.token.type === type) {
  48808. this.nextToken();
  48809. return true;
  48810. }
  48811. return false;
  48812. },
  48813. expect: function PostScriptParser_expect(type) {
  48814. if (this.accept(type)) {
  48815. return true;
  48816. }
  48817. error('Unexpected symbol: found ' + this.token.type + ' expected ' + type + '.');
  48818. },
  48819. parse: function PostScriptParser_parse() {
  48820. this.nextToken();
  48821. this.expect(PostScriptTokenTypes.LBRACE);
  48822. this.parseBlock();
  48823. this.expect(PostScriptTokenTypes.RBRACE);
  48824. return this.operators;
  48825. },
  48826. parseBlock: function PostScriptParser_parseBlock() {
  48827. while (true) {
  48828. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  48829. this.operators.push(this.prev.value);
  48830. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  48831. this.operators.push(this.prev.value);
  48832. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  48833. this.parseCondition();
  48834. } else {
  48835. return;
  48836. }
  48837. }
  48838. },
  48839. parseCondition: function PostScriptParser_parseCondition() {
  48840. var conditionLocation = this.operators.length;
  48841. this.operators.push(null, null);
  48842. this.parseBlock();
  48843. this.expect(PostScriptTokenTypes.RBRACE);
  48844. if (this.accept(PostScriptTokenTypes.IF)) {
  48845. this.operators[conditionLocation] = this.operators.length;
  48846. this.operators[conditionLocation + 1] = 'jz';
  48847. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  48848. var jumpLocation = this.operators.length;
  48849. this.operators.push(null, null);
  48850. var endOfTrue = this.operators.length;
  48851. this.parseBlock();
  48852. this.expect(PostScriptTokenTypes.RBRACE);
  48853. this.expect(PostScriptTokenTypes.IFELSE);
  48854. this.operators[jumpLocation] = this.operators.length;
  48855. this.operators[jumpLocation + 1] = 'j';
  48856. this.operators[conditionLocation] = endOfTrue;
  48857. this.operators[conditionLocation + 1] = 'jz';
  48858. } else {
  48859. error('PS Function: error parsing conditional.');
  48860. }
  48861. }
  48862. };
  48863. return PostScriptParser;
  48864. }();
  48865. var PostScriptTokenTypes = {
  48866. LBRACE: 0,
  48867. RBRACE: 1,
  48868. NUMBER: 2,
  48869. OPERATOR: 3,
  48870. IF: 4,
  48871. IFELSE: 5
  48872. };
  48873. var PostScriptToken = function PostScriptTokenClosure() {
  48874. function PostScriptToken(type, value) {
  48875. this.type = type;
  48876. this.value = value;
  48877. }
  48878. var opCache = Object.create(null);
  48879. PostScriptToken.getOperator = function PostScriptToken_getOperator(op) {
  48880. var opValue = opCache[op];
  48881. if (opValue) {
  48882. return opValue;
  48883. }
  48884. return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  48885. };
  48886. PostScriptToken.LBRACE = new PostScriptToken(PostScriptTokenTypes.LBRACE, '{');
  48887. PostScriptToken.RBRACE = new PostScriptToken(PostScriptTokenTypes.RBRACE, '}');
  48888. PostScriptToken.IF = new PostScriptToken(PostScriptTokenTypes.IF, 'IF');
  48889. PostScriptToken.IFELSE = new PostScriptToken(PostScriptTokenTypes.IFELSE, 'IFELSE');
  48890. return PostScriptToken;
  48891. }();
  48892. var PostScriptLexer = function PostScriptLexerClosure() {
  48893. function PostScriptLexer(stream) {
  48894. this.stream = stream;
  48895. this.nextChar();
  48896. this.strBuf = [];
  48897. }
  48898. PostScriptLexer.prototype = {
  48899. nextChar: function PostScriptLexer_nextChar() {
  48900. return this.currentChar = this.stream.getByte();
  48901. },
  48902. getToken: function PostScriptLexer_getToken() {
  48903. var comment = false;
  48904. var ch = this.currentChar;
  48905. while (true) {
  48906. if (ch < 0) {
  48907. return EOF;
  48908. }
  48909. if (comment) {
  48910. if (ch === 0x0A || ch === 0x0D) {
  48911. comment = false;
  48912. }
  48913. } else if (ch === 0x25) {
  48914. comment = true;
  48915. } else if (!isSpace(ch)) {
  48916. break;
  48917. }
  48918. ch = this.nextChar();
  48919. }
  48920. switch (ch | 0) {
  48921. case 0x30:
  48922. case 0x31:
  48923. case 0x32:
  48924. case 0x33:
  48925. case 0x34:
  48926. case 0x35:
  48927. case 0x36:
  48928. case 0x37:
  48929. case 0x38:
  48930. case 0x39:
  48931. case 0x2B:
  48932. case 0x2D:
  48933. case 0x2E:
  48934. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  48935. case 0x7B:
  48936. this.nextChar();
  48937. return PostScriptToken.LBRACE;
  48938. case 0x7D:
  48939. this.nextChar();
  48940. return PostScriptToken.RBRACE;
  48941. }
  48942. var strBuf = this.strBuf;
  48943. strBuf.length = 0;
  48944. strBuf[0] = String.fromCharCode(ch);
  48945. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5A || ch >= 0x61 && ch <= 0x7A)) {
  48946. strBuf.push(String.fromCharCode(ch));
  48947. }
  48948. var str = strBuf.join('');
  48949. switch (str.toLowerCase()) {
  48950. case 'if':
  48951. return PostScriptToken.IF;
  48952. case 'ifelse':
  48953. return PostScriptToken.IFELSE;
  48954. default:
  48955. return PostScriptToken.getOperator(str);
  48956. }
  48957. },
  48958. getNumber: function PostScriptLexer_getNumber() {
  48959. var ch = this.currentChar;
  48960. var strBuf = this.strBuf;
  48961. strBuf.length = 0;
  48962. strBuf[0] = String.fromCharCode(ch);
  48963. while ((ch = this.nextChar()) >= 0) {
  48964. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2D || ch === 0x2E) {
  48965. strBuf.push(String.fromCharCode(ch));
  48966. } else {
  48967. break;
  48968. }
  48969. }
  48970. var value = parseFloat(strBuf.join(''));
  48971. if (isNaN(value)) {
  48972. error('Invalid floating point number: ' + value);
  48973. }
  48974. return value;
  48975. }
  48976. };
  48977. return PostScriptLexer;
  48978. }();
  48979. exports.PostScriptLexer = PostScriptLexer;
  48980. exports.PostScriptParser = PostScriptParser;
  48981. /***/ }),
  48982. /* 35 */
  48983. /***/ (function(module, exports, __w_pdfjs_require__) {
  48984. "use strict";
  48985. var sharedUtil = __w_pdfjs_require__(0);
  48986. var coreStream = __w_pdfjs_require__(2);
  48987. var coreEncodings = __w_pdfjs_require__(4);
  48988. var warn = sharedUtil.warn;
  48989. var isSpace = sharedUtil.isSpace;
  48990. var Stream = coreStream.Stream;
  48991. var getEncoding = coreEncodings.getEncoding;
  48992. var HINTING_ENABLED = false;
  48993. var Type1CharString = function Type1CharStringClosure() {
  48994. var COMMAND_MAP = {
  48995. 'hstem': [1],
  48996. 'vstem': [3],
  48997. 'vmoveto': [4],
  48998. 'rlineto': [5],
  48999. 'hlineto': [6],
  49000. 'vlineto': [7],
  49001. 'rrcurveto': [8],
  49002. 'callsubr': [10],
  49003. 'flex': [
  49004. 12,
  49005. 35
  49006. ],
  49007. 'drop': [
  49008. 12,
  49009. 18
  49010. ],
  49011. 'endchar': [14],
  49012. 'rmoveto': [21],
  49013. 'hmoveto': [22],
  49014. 'vhcurveto': [30],
  49015. 'hvcurveto': [31]
  49016. };
  49017. function Type1CharString() {
  49018. this.width = 0;
  49019. this.lsb = 0;
  49020. this.flexing = false;
  49021. this.output = [];
  49022. this.stack = [];
  49023. }
  49024. Type1CharString.prototype = {
  49025. convert: function Type1CharString_convert(encoded, subrs, seacAnalysisEnabled) {
  49026. var count = encoded.length;
  49027. var error = false;
  49028. var wx, sbx, subrNumber;
  49029. for (var i = 0; i < count; i++) {
  49030. var value = encoded[i];
  49031. if (value < 32) {
  49032. if (value === 12) {
  49033. value = (value << 8) + encoded[++i];
  49034. }
  49035. switch (value) {
  49036. case 1:
  49037. if (!HINTING_ENABLED) {
  49038. this.stack = [];
  49039. break;
  49040. }
  49041. error = this.executeCommand(2, COMMAND_MAP.hstem);
  49042. break;
  49043. case 3:
  49044. if (!HINTING_ENABLED) {
  49045. this.stack = [];
  49046. break;
  49047. }
  49048. error = this.executeCommand(2, COMMAND_MAP.vstem);
  49049. break;
  49050. case 4:
  49051. if (this.flexing) {
  49052. if (this.stack.length < 1) {
  49053. error = true;
  49054. break;
  49055. }
  49056. var dy = this.stack.pop();
  49057. this.stack.push(0, dy);
  49058. break;
  49059. }
  49060. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  49061. break;
  49062. case 5:
  49063. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  49064. break;
  49065. case 6:
  49066. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  49067. break;
  49068. case 7:
  49069. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  49070. break;
  49071. case 8:
  49072. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  49073. break;
  49074. case 9:
  49075. this.stack = [];
  49076. break;
  49077. case 10:
  49078. if (this.stack.length < 1) {
  49079. error = true;
  49080. break;
  49081. }
  49082. subrNumber = this.stack.pop();
  49083. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  49084. break;
  49085. case 11:
  49086. return error;
  49087. case 13:
  49088. if (this.stack.length < 2) {
  49089. error = true;
  49090. break;
  49091. }
  49092. wx = this.stack.pop();
  49093. sbx = this.stack.pop();
  49094. this.lsb = sbx;
  49095. this.width = wx;
  49096. this.stack.push(wx, sbx);
  49097. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  49098. break;
  49099. case 14:
  49100. this.output.push(COMMAND_MAP.endchar[0]);
  49101. break;
  49102. case 21:
  49103. if (this.flexing) {
  49104. break;
  49105. }
  49106. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  49107. break;
  49108. case 22:
  49109. if (this.flexing) {
  49110. this.stack.push(0);
  49111. break;
  49112. }
  49113. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  49114. break;
  49115. case 30:
  49116. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  49117. break;
  49118. case 31:
  49119. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  49120. break;
  49121. case (12 << 8) + 0:
  49122. this.stack = [];
  49123. break;
  49124. case (12 << 8) + 1:
  49125. if (!HINTING_ENABLED) {
  49126. this.stack = [];
  49127. break;
  49128. }
  49129. error = this.executeCommand(2, COMMAND_MAP.vstem);
  49130. break;
  49131. case (12 << 8) + 2:
  49132. if (!HINTING_ENABLED) {
  49133. this.stack = [];
  49134. break;
  49135. }
  49136. error = this.executeCommand(2, COMMAND_MAP.hstem);
  49137. break;
  49138. case (12 << 8) + 6:
  49139. if (seacAnalysisEnabled) {
  49140. this.seac = this.stack.splice(-4, 4);
  49141. error = this.executeCommand(0, COMMAND_MAP.endchar);
  49142. } else {
  49143. error = this.executeCommand(4, COMMAND_MAP.endchar);
  49144. }
  49145. break;
  49146. case (12 << 8) + 7:
  49147. if (this.stack.length < 4) {
  49148. error = true;
  49149. break;
  49150. }
  49151. this.stack.pop();
  49152. wx = this.stack.pop();
  49153. var sby = this.stack.pop();
  49154. sbx = this.stack.pop();
  49155. this.lsb = sbx;
  49156. this.width = wx;
  49157. this.stack.push(wx, sbx, sby);
  49158. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  49159. break;
  49160. case (12 << 8) + 12:
  49161. if (this.stack.length < 2) {
  49162. error = true;
  49163. break;
  49164. }
  49165. var num2 = this.stack.pop();
  49166. var num1 = this.stack.pop();
  49167. this.stack.push(num1 / num2);
  49168. break;
  49169. case (12 << 8) + 16:
  49170. if (this.stack.length < 2) {
  49171. error = true;
  49172. break;
  49173. }
  49174. subrNumber = this.stack.pop();
  49175. var numArgs = this.stack.pop();
  49176. if (subrNumber === 0 && numArgs === 3) {
  49177. var flexArgs = this.stack.splice(this.stack.length - 17, 17);
  49178. 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]);
  49179. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  49180. this.flexing = false;
  49181. this.stack.push(flexArgs[15], flexArgs[16]);
  49182. } else if (subrNumber === 1 && numArgs === 0) {
  49183. this.flexing = true;
  49184. }
  49185. break;
  49186. case (12 << 8) + 17:
  49187. break;
  49188. case (12 << 8) + 33:
  49189. this.stack = [];
  49190. break;
  49191. default:
  49192. warn('Unknown type 1 charstring command of "' + value + '"');
  49193. break;
  49194. }
  49195. if (error) {
  49196. break;
  49197. }
  49198. continue;
  49199. } else if (value <= 246) {
  49200. value = value - 139;
  49201. } else if (value <= 250) {
  49202. value = (value - 247) * 256 + encoded[++i] + 108;
  49203. } else if (value <= 254) {
  49204. value = -((value - 251) * 256) - encoded[++i] - 108;
  49205. } else {
  49206. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  49207. }
  49208. this.stack.push(value);
  49209. }
  49210. return error;
  49211. },
  49212. executeCommand: function (howManyArgs, command, keepStack) {
  49213. var stackLength = this.stack.length;
  49214. if (howManyArgs > stackLength) {
  49215. return true;
  49216. }
  49217. var start = stackLength - howManyArgs;
  49218. for (var i = start; i < stackLength; i++) {
  49219. var value = this.stack[i];
  49220. if (value === (value | 0)) {
  49221. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  49222. } else {
  49223. value = 65536 * value | 0;
  49224. this.output.push(255, value >> 24 & 0xFF, value >> 16 & 0xFF, value >> 8 & 0xFF, value & 0xFF);
  49225. }
  49226. }
  49227. this.output.push.apply(this.output, command);
  49228. if (keepStack) {
  49229. this.stack.splice(start, howManyArgs);
  49230. } else {
  49231. this.stack.length = 0;
  49232. }
  49233. return false;
  49234. }
  49235. };
  49236. return Type1CharString;
  49237. }();
  49238. var Type1Parser = function Type1ParserClosure() {
  49239. var EEXEC_ENCRYPT_KEY = 55665;
  49240. var CHAR_STRS_ENCRYPT_KEY = 4330;
  49241. function isHexDigit(code) {
  49242. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  49243. }
  49244. function decrypt(data, key, discardNumber) {
  49245. if (discardNumber >= data.length) {
  49246. return new Uint8Array(0);
  49247. }
  49248. var r = key | 0, c1 = 52845, c2 = 22719, i, j;
  49249. for (i = 0; i < discardNumber; i++) {
  49250. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  49251. }
  49252. var count = data.length - discardNumber;
  49253. var decrypted = new Uint8Array(count);
  49254. for (i = discardNumber, j = 0; j < count; i++, j++) {
  49255. var value = data[i];
  49256. decrypted[j] = value ^ r >> 8;
  49257. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  49258. }
  49259. return decrypted;
  49260. }
  49261. function decryptAscii(data, key, discardNumber) {
  49262. var r = key | 0, c1 = 52845, c2 = 22719;
  49263. var count = data.length, maybeLength = count >>> 1;
  49264. var decrypted = new Uint8Array(maybeLength);
  49265. var i, j;
  49266. for (i = 0, j = 0; i < count; i++) {
  49267. var digit1 = data[i];
  49268. if (!isHexDigit(digit1)) {
  49269. continue;
  49270. }
  49271. i++;
  49272. var digit2;
  49273. while (i < count && !isHexDigit(digit2 = data[i])) {
  49274. i++;
  49275. }
  49276. if (i < count) {
  49277. var value = parseInt(String.fromCharCode(digit1, digit2), 16);
  49278. decrypted[j++] = value ^ r >> 8;
  49279. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  49280. }
  49281. }
  49282. return Array.prototype.slice.call(decrypted, discardNumber, j);
  49283. }
  49284. function isSpecial(c) {
  49285. return c === 0x2F || c === 0x5B || c === 0x5D || c === 0x7B || c === 0x7D || c === 0x28 || c === 0x29;
  49286. }
  49287. function Type1Parser(stream, encrypted, seacAnalysisEnabled) {
  49288. if (encrypted) {
  49289. var data = stream.getBytes();
  49290. var isBinary = !(isHexDigit(data[0]) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]));
  49291. stream = new Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  49292. }
  49293. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  49294. this.stream = stream;
  49295. this.nextChar();
  49296. }
  49297. Type1Parser.prototype = {
  49298. readNumberArray: function Type1Parser_readNumberArray() {
  49299. this.getToken();
  49300. var array = [];
  49301. while (true) {
  49302. var token = this.getToken();
  49303. if (token === null || token === ']' || token === '}') {
  49304. break;
  49305. }
  49306. array.push(parseFloat(token || 0));
  49307. }
  49308. return array;
  49309. },
  49310. readNumber: function Type1Parser_readNumber() {
  49311. var token = this.getToken();
  49312. return parseFloat(token || 0);
  49313. },
  49314. readInt: function Type1Parser_readInt() {
  49315. var token = this.getToken();
  49316. return parseInt(token || 0, 10) | 0;
  49317. },
  49318. readBoolean: function Type1Parser_readBoolean() {
  49319. var token = this.getToken();
  49320. return token === 'true' ? 1 : 0;
  49321. },
  49322. nextChar: function Type1_nextChar() {
  49323. return this.currentChar = this.stream.getByte();
  49324. },
  49325. getToken: function Type1Parser_getToken() {
  49326. var comment = false;
  49327. var ch = this.currentChar;
  49328. while (true) {
  49329. if (ch === -1) {
  49330. return null;
  49331. }
  49332. if (comment) {
  49333. if (ch === 0x0A || ch === 0x0D) {
  49334. comment = false;
  49335. }
  49336. } else if (ch === 0x25) {
  49337. comment = true;
  49338. } else if (!isSpace(ch)) {
  49339. break;
  49340. }
  49341. ch = this.nextChar();
  49342. }
  49343. if (isSpecial(ch)) {
  49344. this.nextChar();
  49345. return String.fromCharCode(ch);
  49346. }
  49347. var token = '';
  49348. do {
  49349. token += String.fromCharCode(ch);
  49350. ch = this.nextChar();
  49351. } while (ch >= 0 && !isSpace(ch) && !isSpecial(ch));
  49352. return token;
  49353. },
  49354. extractFontProgram: function Type1Parser_extractFontProgram() {
  49355. var stream = this.stream;
  49356. var subrs = [], charstrings = [];
  49357. var privateData = Object.create(null);
  49358. privateData['lenIV'] = 4;
  49359. var program = {
  49360. subrs: [],
  49361. charstrings: [],
  49362. properties: { 'privateData': privateData }
  49363. };
  49364. var token, length, data, lenIV, encoded;
  49365. while ((token = this.getToken()) !== null) {
  49366. if (token !== '/') {
  49367. continue;
  49368. }
  49369. token = this.getToken();
  49370. switch (token) {
  49371. case 'CharStrings':
  49372. this.getToken();
  49373. this.getToken();
  49374. this.getToken();
  49375. this.getToken();
  49376. while (true) {
  49377. token = this.getToken();
  49378. if (token === null || token === 'end') {
  49379. break;
  49380. }
  49381. if (token !== '/') {
  49382. continue;
  49383. }
  49384. var glyph = this.getToken();
  49385. length = this.readInt();
  49386. this.getToken();
  49387. data = stream.makeSubStream(stream.pos, length);
  49388. lenIV = program.properties.privateData['lenIV'];
  49389. encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV);
  49390. stream.skip(length);
  49391. this.nextChar();
  49392. token = this.getToken();
  49393. if (token === 'noaccess') {
  49394. this.getToken();
  49395. }
  49396. charstrings.push({
  49397. glyph: glyph,
  49398. encoded: encoded
  49399. });
  49400. }
  49401. break;
  49402. case 'Subrs':
  49403. this.readInt();
  49404. this.getToken();
  49405. while ((token = this.getToken()) === 'dup') {
  49406. var index = this.readInt();
  49407. length = this.readInt();
  49408. this.getToken();
  49409. data = stream.makeSubStream(stream.pos, length);
  49410. lenIV = program.properties.privateData['lenIV'];
  49411. encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV);
  49412. stream.skip(length);
  49413. this.nextChar();
  49414. token = this.getToken();
  49415. if (token === 'noaccess') {
  49416. this.getToken();
  49417. }
  49418. subrs[index] = encoded;
  49419. }
  49420. break;
  49421. case 'BlueValues':
  49422. case 'OtherBlues':
  49423. case 'FamilyBlues':
  49424. case 'FamilyOtherBlues':
  49425. var blueArray = this.readNumberArray();
  49426. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  49427. program.properties.privateData[token] = blueArray;
  49428. }
  49429. break;
  49430. case 'StemSnapH':
  49431. case 'StemSnapV':
  49432. program.properties.privateData[token] = this.readNumberArray();
  49433. break;
  49434. case 'StdHW':
  49435. case 'StdVW':
  49436. program.properties.privateData[token] = this.readNumberArray()[0];
  49437. break;
  49438. case 'BlueShift':
  49439. case 'lenIV':
  49440. case 'BlueFuzz':
  49441. case 'BlueScale':
  49442. case 'LanguageGroup':
  49443. case 'ExpansionFactor':
  49444. program.properties.privateData[token] = this.readNumber();
  49445. break;
  49446. case 'ForceBold':
  49447. program.properties.privateData[token] = this.readBoolean();
  49448. break;
  49449. }
  49450. }
  49451. for (var i = 0; i < charstrings.length; i++) {
  49452. glyph = charstrings[i].glyph;
  49453. encoded = charstrings[i].encoded;
  49454. var charString = new Type1CharString();
  49455. var error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  49456. var output = charString.output;
  49457. if (error) {
  49458. output = [14];
  49459. }
  49460. program.charstrings.push({
  49461. glyphName: glyph,
  49462. charstring: output,
  49463. width: charString.width,
  49464. lsb: charString.lsb,
  49465. seac: charString.seac
  49466. });
  49467. }
  49468. return program;
  49469. },
  49470. extractFontHeader: function Type1Parser_extractFontHeader(properties) {
  49471. var token;
  49472. while ((token = this.getToken()) !== null) {
  49473. if (token !== '/') {
  49474. continue;
  49475. }
  49476. token = this.getToken();
  49477. switch (token) {
  49478. case 'FontMatrix':
  49479. var matrix = this.readNumberArray();
  49480. properties.fontMatrix = matrix;
  49481. break;
  49482. case 'Encoding':
  49483. var encodingArg = this.getToken();
  49484. var encoding;
  49485. if (!/^\d+$/.test(encodingArg)) {
  49486. encoding = getEncoding(encodingArg);
  49487. } else {
  49488. encoding = [];
  49489. var size = parseInt(encodingArg, 10) | 0;
  49490. this.getToken();
  49491. for (var j = 0; j < size; j++) {
  49492. token = this.getToken();
  49493. while (token !== 'dup' && token !== 'def') {
  49494. token = this.getToken();
  49495. if (token === null) {
  49496. return;
  49497. }
  49498. }
  49499. if (token === 'def') {
  49500. break;
  49501. }
  49502. var index = this.readInt();
  49503. this.getToken();
  49504. var glyph = this.getToken();
  49505. encoding[index] = glyph;
  49506. this.getToken();
  49507. }
  49508. }
  49509. properties.builtInEncoding = encoding;
  49510. break;
  49511. case 'FontBBox':
  49512. var fontBBox = this.readNumberArray();
  49513. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  49514. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  49515. properties.ascentScaled = true;
  49516. break;
  49517. }
  49518. }
  49519. }
  49520. };
  49521. return Type1Parser;
  49522. }();
  49523. exports.Type1Parser = Type1Parser;
  49524. /***/ }),
  49525. /* 36 */
  49526. /***/ (function(module, exports, __w_pdfjs_require__) {
  49527. "use strict";
  49528. /* WEBPACK VAR INJECTION */(function(global) {
  49529. if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) {
  49530. var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this;
  49531. var userAgent = typeof navigator !== 'undefined' && navigator.userAgent || '';
  49532. var isAndroid = /Android/.test(userAgent);
  49533. var isAndroidPre3 = /Android\s[0-2][^\d]/.test(userAgent);
  49534. var isAndroidPre5 = /Android\s[0-4][^\d]/.test(userAgent);
  49535. var isChrome = userAgent.indexOf('Chrom') >= 0;
  49536. var isChromeWithRangeBug = /Chrome\/(39|40)\./.test(userAgent);
  49537. var isIOSChrome = userAgent.indexOf('CriOS') >= 0;
  49538. var isIE = userAgent.indexOf('Trident') >= 0;
  49539. var isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent);
  49540. var isOpera = userAgent.indexOf('Opera') >= 0;
  49541. var isSafari = /Safari\//.test(userAgent) && !/(Chrome\/|Android\s)/.test(userAgent);
  49542. var hasDOM = typeof window === 'object' && typeof document === 'object';
  49543. if (typeof PDFJS === 'undefined') {
  49544. globalScope.PDFJS = {};
  49545. }
  49546. PDFJS.compatibilityChecked = true;
  49547. (function checkTypedArrayCompatibility() {
  49548. if (typeof Uint8Array !== 'undefined') {
  49549. if (typeof Uint8Array.prototype.subarray === 'undefined') {
  49550. Uint8Array.prototype.subarray = function subarray(start, end) {
  49551. return new Uint8Array(this.slice(start, end));
  49552. };
  49553. Float32Array.prototype.subarray = function subarray(start, end) {
  49554. return new Float32Array(this.slice(start, end));
  49555. };
  49556. }
  49557. if (typeof Float64Array === 'undefined') {
  49558. globalScope.Float64Array = Float32Array;
  49559. }
  49560. return;
  49561. }
  49562. function subarray(start, end) {
  49563. return new TypedArray(this.slice(start, end));
  49564. }
  49565. function setArrayOffset(array, offset) {
  49566. if (arguments.length < 2) {
  49567. offset = 0;
  49568. }
  49569. for (var i = 0, n = array.length; i < n; ++i, ++offset) {
  49570. this[offset] = array[i] & 0xFF;
  49571. }
  49572. }
  49573. function TypedArray(arg1) {
  49574. var result, i, n;
  49575. if (typeof arg1 === 'number') {
  49576. result = [];
  49577. for (i = 0; i < arg1; ++i) {
  49578. result[i] = 0;
  49579. }
  49580. } else if ('slice' in arg1) {
  49581. result = arg1.slice(0);
  49582. } else {
  49583. result = [];
  49584. for (i = 0, n = arg1.length; i < n; ++i) {
  49585. result[i] = arg1[i];
  49586. }
  49587. }
  49588. result.subarray = subarray;
  49589. result.buffer = result;
  49590. result.byteLength = result.length;
  49591. result.set = setArrayOffset;
  49592. if (typeof arg1 === 'object' && arg1.buffer) {
  49593. result.buffer = arg1.buffer;
  49594. }
  49595. return result;
  49596. }
  49597. globalScope.Uint8Array = TypedArray;
  49598. globalScope.Int8Array = TypedArray;
  49599. globalScope.Uint32Array = TypedArray;
  49600. globalScope.Int32Array = TypedArray;
  49601. globalScope.Uint16Array = TypedArray;
  49602. globalScope.Float32Array = TypedArray;
  49603. globalScope.Float64Array = TypedArray;
  49604. }());
  49605. (function normalizeURLObject() {
  49606. if (!globalScope.URL) {
  49607. globalScope.URL = globalScope.webkitURL;
  49608. }
  49609. }());
  49610. (function checkObjectDefinePropertyCompatibility() {
  49611. if (typeof Object.defineProperty !== 'undefined') {
  49612. var definePropertyPossible = true;
  49613. try {
  49614. if (hasDOM) {
  49615. Object.defineProperty(new Image(), 'id', { value: 'test' });
  49616. }
  49617. var Test = function Test() {
  49618. };
  49619. Test.prototype = {
  49620. get id() {
  49621. }
  49622. };
  49623. Object.defineProperty(new Test(), 'id', {
  49624. value: '',
  49625. configurable: true,
  49626. enumerable: true,
  49627. writable: false
  49628. });
  49629. } catch (e) {
  49630. definePropertyPossible = false;
  49631. }
  49632. if (definePropertyPossible) {
  49633. return;
  49634. }
  49635. }
  49636. Object.defineProperty = function objectDefineProperty(obj, name, def) {
  49637. delete obj[name];
  49638. if ('get' in def) {
  49639. obj.__defineGetter__(name, def['get']);
  49640. }
  49641. if ('set' in def) {
  49642. obj.__defineSetter__(name, def['set']);
  49643. }
  49644. if ('value' in def) {
  49645. obj.__defineSetter__(name, function objectDefinePropertySetter(value) {
  49646. this.__defineGetter__(name, function objectDefinePropertyGetter() {
  49647. return value;
  49648. });
  49649. return value;
  49650. });
  49651. obj[name] = def.value;
  49652. }
  49653. };
  49654. }());
  49655. (function checkXMLHttpRequestResponseCompatibility() {
  49656. if (typeof XMLHttpRequest === 'undefined') {
  49657. return;
  49658. }
  49659. var xhrPrototype = XMLHttpRequest.prototype;
  49660. var xhr = new XMLHttpRequest();
  49661. if (!('overrideMimeType' in xhr)) {
  49662. Object.defineProperty(xhrPrototype, 'overrideMimeType', {
  49663. value: function xmlHttpRequestOverrideMimeType(mimeType) {
  49664. }
  49665. });
  49666. }
  49667. if ('responseType' in xhr) {
  49668. return;
  49669. }
  49670. Object.defineProperty(xhrPrototype, 'responseType', {
  49671. get: function xmlHttpRequestGetResponseType() {
  49672. return this._responseType || 'text';
  49673. },
  49674. set: function xmlHttpRequestSetResponseType(value) {
  49675. if (value === 'text' || value === 'arraybuffer') {
  49676. this._responseType = value;
  49677. if (value === 'arraybuffer' && typeof this.overrideMimeType === 'function') {
  49678. this.overrideMimeType('text/plain; charset=x-user-defined');
  49679. }
  49680. }
  49681. }
  49682. });
  49683. if (typeof VBArray !== 'undefined') {
  49684. Object.defineProperty(xhrPrototype, 'response', {
  49685. get: function xmlHttpRequestResponseGet() {
  49686. if (this.responseType === 'arraybuffer') {
  49687. return new Uint8Array(new VBArray(this.responseBody).toArray());
  49688. }
  49689. return this.responseText;
  49690. }
  49691. });
  49692. return;
  49693. }
  49694. Object.defineProperty(xhrPrototype, 'response', {
  49695. get: function xmlHttpRequestResponseGet() {
  49696. if (this.responseType !== 'arraybuffer') {
  49697. return this.responseText;
  49698. }
  49699. var text = this.responseText;
  49700. var i, n = text.length;
  49701. var result = new Uint8Array(n);
  49702. for (i = 0; i < n; ++i) {
  49703. result[i] = text.charCodeAt(i) & 0xFF;
  49704. }
  49705. return result.buffer;
  49706. }
  49707. });
  49708. }());
  49709. (function checkWindowBtoaCompatibility() {
  49710. if ('btoa' in globalScope) {
  49711. return;
  49712. }
  49713. var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  49714. globalScope.btoa = function (chars) {
  49715. var buffer = '';
  49716. var i, n;
  49717. for (i = 0, n = chars.length; i < n; i += 3) {
  49718. var b1 = chars.charCodeAt(i) & 0xFF;
  49719. var b2 = chars.charCodeAt(i + 1) & 0xFF;
  49720. var b3 = chars.charCodeAt(i + 2) & 0xFF;
  49721. var d1 = b1 >> 2, d2 = (b1 & 3) << 4 | b2 >> 4;
  49722. var d3 = i + 1 < n ? (b2 & 0xF) << 2 | b3 >> 6 : 64;
  49723. var d4 = i + 2 < n ? b3 & 0x3F : 64;
  49724. buffer += digits.charAt(d1) + digits.charAt(d2) + digits.charAt(d3) + digits.charAt(d4);
  49725. }
  49726. return buffer;
  49727. };
  49728. }());
  49729. (function checkWindowAtobCompatibility() {
  49730. if ('atob' in globalScope) {
  49731. return;
  49732. }
  49733. var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  49734. globalScope.atob = function (input) {
  49735. input = input.replace(/=+$/, '');
  49736. if (input.length % 4 === 1) {
  49737. throw new Error('bad atob input');
  49738. }
  49739. for (var bc = 0, bs, buffer, idx = 0, output = ''; buffer = input.charAt(idx++); ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer, bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0) {
  49740. buffer = digits.indexOf(buffer);
  49741. }
  49742. return output;
  49743. };
  49744. }());
  49745. (function checkFunctionPrototypeBindCompatibility() {
  49746. if (typeof Function.prototype.bind !== 'undefined') {
  49747. return;
  49748. }
  49749. Function.prototype.bind = function functionPrototypeBind(obj) {
  49750. var fn = this, headArgs = Array.prototype.slice.call(arguments, 1);
  49751. var bound = function functionPrototypeBindBound() {
  49752. var args = headArgs.concat(Array.prototype.slice.call(arguments));
  49753. return fn.apply(obj, args);
  49754. };
  49755. return bound;
  49756. };
  49757. }());
  49758. (function checkDatasetProperty() {
  49759. if (!hasDOM) {
  49760. return;
  49761. }
  49762. var div = document.createElement('div');
  49763. if ('dataset' in div) {
  49764. return;
  49765. }
  49766. Object.defineProperty(HTMLElement.prototype, 'dataset', {
  49767. get: function () {
  49768. if (this._dataset) {
  49769. return this._dataset;
  49770. }
  49771. var dataset = {};
  49772. for (var j = 0, jj = this.attributes.length; j < jj; j++) {
  49773. var attribute = this.attributes[j];
  49774. if (attribute.name.substring(0, 5) !== 'data-') {
  49775. continue;
  49776. }
  49777. var key = attribute.name.substring(5).replace(/\-([a-z])/g, function (all, ch) {
  49778. return ch.toUpperCase();
  49779. });
  49780. dataset[key] = attribute.value;
  49781. }
  49782. Object.defineProperty(this, '_dataset', {
  49783. value: dataset,
  49784. writable: false,
  49785. enumerable: false
  49786. });
  49787. return dataset;
  49788. },
  49789. enumerable: true
  49790. });
  49791. }());
  49792. (function checkClassListProperty() {
  49793. function changeList(element, itemName, add, remove) {
  49794. var s = element.className || '';
  49795. var list = s.split(/\s+/g);
  49796. if (list[0] === '') {
  49797. list.shift();
  49798. }
  49799. var index = list.indexOf(itemName);
  49800. if (index < 0 && add) {
  49801. list.push(itemName);
  49802. }
  49803. if (index >= 0 && remove) {
  49804. list.splice(index, 1);
  49805. }
  49806. element.className = list.join(' ');
  49807. return index >= 0;
  49808. }
  49809. if (!hasDOM) {
  49810. return;
  49811. }
  49812. var div = document.createElement('div');
  49813. if ('classList' in div) {
  49814. return;
  49815. }
  49816. var classListPrototype = {
  49817. add: function (name) {
  49818. changeList(this.element, name, true, false);
  49819. },
  49820. contains: function (name) {
  49821. return changeList(this.element, name, false, false);
  49822. },
  49823. remove: function (name) {
  49824. changeList(this.element, name, false, true);
  49825. },
  49826. toggle: function (name) {
  49827. changeList(this.element, name, true, true);
  49828. }
  49829. };
  49830. Object.defineProperty(HTMLElement.prototype, 'classList', {
  49831. get: function () {
  49832. if (this._classList) {
  49833. return this._classList;
  49834. }
  49835. var classList = Object.create(classListPrototype, {
  49836. element: {
  49837. value: this,
  49838. writable: false,
  49839. enumerable: true
  49840. }
  49841. });
  49842. Object.defineProperty(this, '_classList', {
  49843. value: classList,
  49844. writable: false,
  49845. enumerable: false
  49846. });
  49847. return classList;
  49848. },
  49849. enumerable: true
  49850. });
  49851. }());
  49852. (function checkWorkerConsoleCompatibility() {
  49853. if (typeof importScripts === 'undefined' || 'console' in globalScope) {
  49854. return;
  49855. }
  49856. var consoleTimer = {};
  49857. var workerConsole = {
  49858. log: function log() {
  49859. var args = Array.prototype.slice.call(arguments);
  49860. globalScope.postMessage({
  49861. targetName: 'main',
  49862. action: 'console_log',
  49863. data: args
  49864. });
  49865. },
  49866. error: function error() {
  49867. var args = Array.prototype.slice.call(arguments);
  49868. globalScope.postMessage({
  49869. targetName: 'main',
  49870. action: 'console_error',
  49871. data: args
  49872. });
  49873. },
  49874. time: function time(name) {
  49875. consoleTimer[name] = Date.now();
  49876. },
  49877. timeEnd: function timeEnd(name) {
  49878. var time = consoleTimer[name];
  49879. if (!time) {
  49880. throw new Error('Unknown timer name ' + name);
  49881. }
  49882. this.log('Timer:', name, Date.now() - time);
  49883. }
  49884. };
  49885. globalScope.console = workerConsole;
  49886. }());
  49887. (function checkConsoleCompatibility() {
  49888. if (!hasDOM) {
  49889. return;
  49890. }
  49891. if (!('console' in window)) {
  49892. window.console = {
  49893. log: function () {
  49894. },
  49895. error: function () {
  49896. },
  49897. warn: function () {
  49898. }
  49899. };
  49900. return;
  49901. }
  49902. if (!('bind' in console.log)) {
  49903. console.log = function (fn) {
  49904. return function (msg) {
  49905. return fn(msg);
  49906. };
  49907. }(console.log);
  49908. console.error = function (fn) {
  49909. return function (msg) {
  49910. return fn(msg);
  49911. };
  49912. }(console.error);
  49913. console.warn = function (fn) {
  49914. return function (msg) {
  49915. return fn(msg);
  49916. };
  49917. }(console.warn);
  49918. return;
  49919. }
  49920. }());
  49921. (function checkOnClickCompatibility() {
  49922. function ignoreIfTargetDisabled(event) {
  49923. if (isDisabled(event.target)) {
  49924. event.stopPropagation();
  49925. }
  49926. }
  49927. function isDisabled(node) {
  49928. return node.disabled || node.parentNode && isDisabled(node.parentNode);
  49929. }
  49930. if (isOpera) {
  49931. document.addEventListener('click', ignoreIfTargetDisabled, true);
  49932. }
  49933. }());
  49934. (function checkOnBlobSupport() {
  49935. if (isIE || isIOSChrome) {
  49936. PDFJS.disableCreateObjectURL = true;
  49937. }
  49938. }());
  49939. (function checkNavigatorLanguage() {
  49940. if (typeof navigator === 'undefined') {
  49941. return;
  49942. }
  49943. if ('language' in navigator) {
  49944. return;
  49945. }
  49946. PDFJS.locale = navigator.userLanguage || 'en-US';
  49947. }());
  49948. (function checkRangeRequests() {
  49949. if (isSafari || isAndroidPre3 || isChromeWithRangeBug || isIOS) {
  49950. PDFJS.disableRange = true;
  49951. PDFJS.disableStream = true;
  49952. }
  49953. }());
  49954. (function checkHistoryManipulation() {
  49955. if (!hasDOM) {
  49956. return;
  49957. }
  49958. if (!history.pushState || isAndroidPre3) {
  49959. PDFJS.disableHistory = true;
  49960. }
  49961. }());
  49962. (function checkSetPresenceInImageData() {
  49963. if (!hasDOM) {
  49964. return;
  49965. }
  49966. if (window.CanvasPixelArray) {
  49967. if (typeof window.CanvasPixelArray.prototype.set !== 'function') {
  49968. window.CanvasPixelArray.prototype.set = function (arr) {
  49969. for (var i = 0, ii = this.length; i < ii; i++) {
  49970. this[i] = arr[i];
  49971. }
  49972. };
  49973. }
  49974. } else {
  49975. var polyfill = false, versionMatch;
  49976. if (isChrome) {
  49977. versionMatch = userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
  49978. polyfill = versionMatch && parseInt(versionMatch[2]) < 21;
  49979. } else if (isAndroid) {
  49980. polyfill = isAndroidPre5;
  49981. } else if (isSafari) {
  49982. versionMatch = userAgent.match(/Version\/([0-9]+)\.([0-9]+)\.([0-9]+) Safari\//);
  49983. polyfill = versionMatch && parseInt(versionMatch[1]) < 6;
  49984. }
  49985. if (polyfill) {
  49986. var contextPrototype = window.CanvasRenderingContext2D.prototype;
  49987. var createImageData = contextPrototype.createImageData;
  49988. contextPrototype.createImageData = function (w, h) {
  49989. var imageData = createImageData.call(this, w, h);
  49990. imageData.data.set = function (arr) {
  49991. for (var i = 0, ii = this.length; i < ii; i++) {
  49992. this[i] = arr[i];
  49993. }
  49994. };
  49995. return imageData;
  49996. };
  49997. contextPrototype = null;
  49998. }
  49999. }
  50000. }());
  50001. (function checkRequestAnimationFrame() {
  50002. function fakeRequestAnimationFrame(callback) {
  50003. window.setTimeout(callback, 20);
  50004. }
  50005. if (!hasDOM) {
  50006. return;
  50007. }
  50008. if (isIOS) {
  50009. window.requestAnimationFrame = fakeRequestAnimationFrame;
  50010. return;
  50011. }
  50012. if ('requestAnimationFrame' in window) {
  50013. return;
  50014. }
  50015. window.requestAnimationFrame = window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || fakeRequestAnimationFrame;
  50016. }());
  50017. (function checkCanvasSizeLimitation() {
  50018. if (isIOS || isAndroid) {
  50019. PDFJS.maxCanvasPixels = 5242880;
  50020. }
  50021. }());
  50022. (function checkFullscreenSupport() {
  50023. if (!hasDOM) {
  50024. return;
  50025. }
  50026. if (isIE && window.parent !== window) {
  50027. PDFJS.disableFullscreen = true;
  50028. }
  50029. }());
  50030. (function checkCurrentScript() {
  50031. if (!hasDOM) {
  50032. return;
  50033. }
  50034. if ('currentScript' in document) {
  50035. return;
  50036. }
  50037. Object.defineProperty(document, 'currentScript', {
  50038. get: function () {
  50039. var scripts = document.getElementsByTagName('script');
  50040. return scripts[scripts.length - 1];
  50041. },
  50042. enumerable: true,
  50043. configurable: true
  50044. });
  50045. }());
  50046. (function checkInputTypeNumberAssign() {
  50047. if (!hasDOM) {
  50048. return;
  50049. }
  50050. var el = document.createElement('input');
  50051. try {
  50052. el.type = 'number';
  50053. } catch (ex) {
  50054. var inputProto = el.constructor.prototype;
  50055. var typeProperty = Object.getOwnPropertyDescriptor(inputProto, 'type');
  50056. Object.defineProperty(inputProto, 'type', {
  50057. get: function () {
  50058. return typeProperty.get.call(this);
  50059. },
  50060. set: function (value) {
  50061. typeProperty.set.call(this, value === 'number' ? 'text' : value);
  50062. },
  50063. enumerable: true,
  50064. configurable: true
  50065. });
  50066. }
  50067. }());
  50068. (function checkDocumentReadyState() {
  50069. if (!hasDOM) {
  50070. return;
  50071. }
  50072. if (!document.attachEvent) {
  50073. return;
  50074. }
  50075. var documentProto = document.constructor.prototype;
  50076. var readyStateProto = Object.getOwnPropertyDescriptor(documentProto, 'readyState');
  50077. Object.defineProperty(documentProto, 'readyState', {
  50078. get: function () {
  50079. var value = readyStateProto.get.call(this);
  50080. return value === 'interactive' ? 'loading' : value;
  50081. },
  50082. set: function (value) {
  50083. readyStateProto.set.call(this, value);
  50084. },
  50085. enumerable: true,
  50086. configurable: true
  50087. });
  50088. }());
  50089. (function checkChildNodeRemove() {
  50090. if (!hasDOM) {
  50091. return;
  50092. }
  50093. if (typeof Element.prototype.remove !== 'undefined') {
  50094. return;
  50095. }
  50096. Element.prototype.remove = function () {
  50097. if (this.parentNode) {
  50098. this.parentNode.removeChild(this);
  50099. }
  50100. };
  50101. }());
  50102. (function checkPromise() {
  50103. if (globalScope.Promise) {
  50104. if (typeof globalScope.Promise.all !== 'function') {
  50105. globalScope.Promise.all = function (iterable) {
  50106. var count = 0, results = [], resolve, reject;
  50107. var promise = new globalScope.Promise(function (resolve_, reject_) {
  50108. resolve = resolve_;
  50109. reject = reject_;
  50110. });
  50111. iterable.forEach(function (p, i) {
  50112. count++;
  50113. p.then(function (result) {
  50114. results[i] = result;
  50115. count--;
  50116. if (count === 0) {
  50117. resolve(results);
  50118. }
  50119. }, reject);
  50120. });
  50121. if (count === 0) {
  50122. resolve(results);
  50123. }
  50124. return promise;
  50125. };
  50126. }
  50127. if (typeof globalScope.Promise.resolve !== 'function') {
  50128. globalScope.Promise.resolve = function (value) {
  50129. return new globalScope.Promise(function (resolve) {
  50130. resolve(value);
  50131. });
  50132. };
  50133. }
  50134. if (typeof globalScope.Promise.reject !== 'function') {
  50135. globalScope.Promise.reject = function (reason) {
  50136. return new globalScope.Promise(function (resolve, reject) {
  50137. reject(reason);
  50138. });
  50139. };
  50140. }
  50141. if (typeof globalScope.Promise.prototype.catch !== 'function') {
  50142. globalScope.Promise.prototype.catch = function (onReject) {
  50143. return globalScope.Promise.prototype.then(undefined, onReject);
  50144. };
  50145. }
  50146. return;
  50147. }
  50148. var STATUS_PENDING = 0;
  50149. var STATUS_RESOLVED = 1;
  50150. var STATUS_REJECTED = 2;
  50151. var REJECTION_TIMEOUT = 500;
  50152. var HandlerManager = {
  50153. handlers: [],
  50154. running: false,
  50155. unhandledRejections: [],
  50156. pendingRejectionCheck: false,
  50157. scheduleHandlers: function scheduleHandlers(promise) {
  50158. if (promise._status === STATUS_PENDING) {
  50159. return;
  50160. }
  50161. this.handlers = this.handlers.concat(promise._handlers);
  50162. promise._handlers = [];
  50163. if (this.running) {
  50164. return;
  50165. }
  50166. this.running = true;
  50167. setTimeout(this.runHandlers.bind(this), 0);
  50168. },
  50169. runHandlers: function runHandlers() {
  50170. var RUN_TIMEOUT = 1;
  50171. var timeoutAt = Date.now() + RUN_TIMEOUT;
  50172. while (this.handlers.length > 0) {
  50173. var handler = this.handlers.shift();
  50174. var nextStatus = handler.thisPromise._status;
  50175. var nextValue = handler.thisPromise._value;
  50176. try {
  50177. if (nextStatus === STATUS_RESOLVED) {
  50178. if (typeof handler.onResolve === 'function') {
  50179. nextValue = handler.onResolve(nextValue);
  50180. }
  50181. } else if (typeof handler.onReject === 'function') {
  50182. nextValue = handler.onReject(nextValue);
  50183. nextStatus = STATUS_RESOLVED;
  50184. if (handler.thisPromise._unhandledRejection) {
  50185. this.removeUnhandeledRejection(handler.thisPromise);
  50186. }
  50187. }
  50188. } catch (ex) {
  50189. nextStatus = STATUS_REJECTED;
  50190. nextValue = ex;
  50191. }
  50192. handler.nextPromise._updateStatus(nextStatus, nextValue);
  50193. if (Date.now() >= timeoutAt) {
  50194. break;
  50195. }
  50196. }
  50197. if (this.handlers.length > 0) {
  50198. setTimeout(this.runHandlers.bind(this), 0);
  50199. return;
  50200. }
  50201. this.running = false;
  50202. },
  50203. addUnhandledRejection: function addUnhandledRejection(promise) {
  50204. this.unhandledRejections.push({
  50205. promise: promise,
  50206. time: Date.now()
  50207. });
  50208. this.scheduleRejectionCheck();
  50209. },
  50210. removeUnhandeledRejection: function removeUnhandeledRejection(promise) {
  50211. promise._unhandledRejection = false;
  50212. for (var i = 0; i < this.unhandledRejections.length; i++) {
  50213. if (this.unhandledRejections[i].promise === promise) {
  50214. this.unhandledRejections.splice(i);
  50215. i--;
  50216. }
  50217. }
  50218. },
  50219. scheduleRejectionCheck: function scheduleRejectionCheck() {
  50220. if (this.pendingRejectionCheck) {
  50221. return;
  50222. }
  50223. this.pendingRejectionCheck = true;
  50224. setTimeout(function rejectionCheck() {
  50225. this.pendingRejectionCheck = false;
  50226. var now = Date.now();
  50227. for (var i = 0; i < this.unhandledRejections.length; i++) {
  50228. if (now - this.unhandledRejections[i].time > REJECTION_TIMEOUT) {
  50229. var unhandled = this.unhandledRejections[i].promise._value;
  50230. var msg = 'Unhandled rejection: ' + unhandled;
  50231. if (unhandled.stack) {
  50232. msg += '\n' + unhandled.stack;
  50233. }
  50234. try {
  50235. throw new Error(msg);
  50236. } catch (_) {
  50237. console.warn(msg);
  50238. }
  50239. this.unhandledRejections.splice(i);
  50240. i--;
  50241. }
  50242. }
  50243. if (this.unhandledRejections.length) {
  50244. this.scheduleRejectionCheck();
  50245. }
  50246. }.bind(this), REJECTION_TIMEOUT);
  50247. }
  50248. };
  50249. var Promise = function Promise(resolver) {
  50250. this._status = STATUS_PENDING;
  50251. this._handlers = [];
  50252. try {
  50253. resolver.call(this, this._resolve.bind(this), this._reject.bind(this));
  50254. } catch (e) {
  50255. this._reject(e);
  50256. }
  50257. };
  50258. Promise.all = function Promise_all(promises) {
  50259. var resolveAll, rejectAll;
  50260. var deferred = new Promise(function (resolve, reject) {
  50261. resolveAll = resolve;
  50262. rejectAll = reject;
  50263. });
  50264. var unresolved = promises.length;
  50265. var results = [];
  50266. if (unresolved === 0) {
  50267. resolveAll(results);
  50268. return deferred;
  50269. }
  50270. function reject(reason) {
  50271. if (deferred._status === STATUS_REJECTED) {
  50272. return;
  50273. }
  50274. results = [];
  50275. rejectAll(reason);
  50276. }
  50277. for (var i = 0, ii = promises.length; i < ii; ++i) {
  50278. var promise = promises[i];
  50279. var resolve = function (i) {
  50280. return function (value) {
  50281. if (deferred._status === STATUS_REJECTED) {
  50282. return;
  50283. }
  50284. results[i] = value;
  50285. unresolved--;
  50286. if (unresolved === 0) {
  50287. resolveAll(results);
  50288. }
  50289. };
  50290. }(i);
  50291. if (Promise.isPromise(promise)) {
  50292. promise.then(resolve, reject);
  50293. } else {
  50294. resolve(promise);
  50295. }
  50296. }
  50297. return deferred;
  50298. };
  50299. Promise.isPromise = function Promise_isPromise(value) {
  50300. return value && typeof value.then === 'function';
  50301. };
  50302. Promise.resolve = function Promise_resolve(value) {
  50303. return new Promise(function (resolve) {
  50304. resolve(value);
  50305. });
  50306. };
  50307. Promise.reject = function Promise_reject(reason) {
  50308. return new Promise(function (resolve, reject) {
  50309. reject(reason);
  50310. });
  50311. };
  50312. Promise.prototype = {
  50313. _status: null,
  50314. _value: null,
  50315. _handlers: null,
  50316. _unhandledRejection: null,
  50317. _updateStatus: function Promise__updateStatus(status, value) {
  50318. if (this._status === STATUS_RESOLVED || this._status === STATUS_REJECTED) {
  50319. return;
  50320. }
  50321. if (status === STATUS_RESOLVED && Promise.isPromise(value)) {
  50322. value.then(this._updateStatus.bind(this, STATUS_RESOLVED), this._updateStatus.bind(this, STATUS_REJECTED));
  50323. return;
  50324. }
  50325. this._status = status;
  50326. this._value = value;
  50327. if (status === STATUS_REJECTED && this._handlers.length === 0) {
  50328. this._unhandledRejection = true;
  50329. HandlerManager.addUnhandledRejection(this);
  50330. }
  50331. HandlerManager.scheduleHandlers(this);
  50332. },
  50333. _resolve: function Promise_resolve(value) {
  50334. this._updateStatus(STATUS_RESOLVED, value);
  50335. },
  50336. _reject: function Promise_reject(reason) {
  50337. this._updateStatus(STATUS_REJECTED, reason);
  50338. },
  50339. then: function Promise_then(onResolve, onReject) {
  50340. var nextPromise = new Promise(function (resolve, reject) {
  50341. this.resolve = resolve;
  50342. this.reject = reject;
  50343. });
  50344. this._handlers.push({
  50345. thisPromise: this,
  50346. onResolve: onResolve,
  50347. onReject: onReject,
  50348. nextPromise: nextPromise
  50349. });
  50350. HandlerManager.scheduleHandlers(this);
  50351. return nextPromise;
  50352. },
  50353. catch: function Promise_catch(onReject) {
  50354. return this.then(undefined, onReject);
  50355. }
  50356. };
  50357. globalScope.Promise = Promise;
  50358. }());
  50359. (function checkWeakMap() {
  50360. if (globalScope.WeakMap) {
  50361. return;
  50362. }
  50363. var id = 0;
  50364. function WeakMap() {
  50365. this.id = '$weakmap' + id++;
  50366. }
  50367. WeakMap.prototype = {
  50368. has: function (obj) {
  50369. return !!Object.getOwnPropertyDescriptor(obj, this.id);
  50370. },
  50371. get: function (obj, defaultValue) {
  50372. return this.has(obj) ? obj[this.id] : defaultValue;
  50373. },
  50374. set: function (obj, value) {
  50375. Object.defineProperty(obj, this.id, {
  50376. value: value,
  50377. enumerable: false,
  50378. configurable: true
  50379. });
  50380. },
  50381. delete: function (obj) {
  50382. delete obj[this.id];
  50383. }
  50384. };
  50385. globalScope.WeakMap = WeakMap;
  50386. }());
  50387. (function checkURLConstructor() {
  50388. var hasWorkingUrl = false;
  50389. try {
  50390. if (typeof URL === 'function' && typeof URL.prototype === 'object' && 'origin' in URL.prototype) {
  50391. var u = new URL('b', 'http://a');
  50392. u.pathname = 'c%20d';
  50393. hasWorkingUrl = u.href === 'http://a/c%20d';
  50394. }
  50395. } catch (e) {
  50396. }
  50397. if (hasWorkingUrl) {
  50398. return;
  50399. }
  50400. var relative = Object.create(null);
  50401. relative['ftp'] = 21;
  50402. relative['file'] = 0;
  50403. relative['gopher'] = 70;
  50404. relative['http'] = 80;
  50405. relative['https'] = 443;
  50406. relative['ws'] = 80;
  50407. relative['wss'] = 443;
  50408. var relativePathDotMapping = Object.create(null);
  50409. relativePathDotMapping['%2e'] = '.';
  50410. relativePathDotMapping['.%2e'] = '..';
  50411. relativePathDotMapping['%2e.'] = '..';
  50412. relativePathDotMapping['%2e%2e'] = '..';
  50413. function isRelativeScheme(scheme) {
  50414. return relative[scheme] !== undefined;
  50415. }
  50416. function invalid() {
  50417. clear.call(this);
  50418. this._isInvalid = true;
  50419. }
  50420. function IDNAToASCII(h) {
  50421. if (h === '') {
  50422. invalid.call(this);
  50423. }
  50424. return h.toLowerCase();
  50425. }
  50426. function percentEscape(c) {
  50427. var unicode = c.charCodeAt(0);
  50428. if (unicode > 0x20 && unicode < 0x7F && [
  50429. 0x22,
  50430. 0x23,
  50431. 0x3C,
  50432. 0x3E,
  50433. 0x3F,
  50434. 0x60
  50435. ].indexOf(unicode) === -1) {
  50436. return c;
  50437. }
  50438. return encodeURIComponent(c);
  50439. }
  50440. function percentEscapeQuery(c) {
  50441. var unicode = c.charCodeAt(0);
  50442. if (unicode > 0x20 && unicode < 0x7F && [
  50443. 0x22,
  50444. 0x23,
  50445. 0x3C,
  50446. 0x3E,
  50447. 0x60
  50448. ].indexOf(unicode) === -1) {
  50449. return c;
  50450. }
  50451. return encodeURIComponent(c);
  50452. }
  50453. var EOF, ALPHA = /[a-zA-Z]/, ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/;
  50454. function parse(input, stateOverride, base) {
  50455. function err(message) {
  50456. errors.push(message);
  50457. }
  50458. var state = stateOverride || 'scheme start', cursor = 0, buffer = '', seenAt = false, seenBracket = false, errors = [];
  50459. loop:
  50460. while ((input[cursor - 1] !== EOF || cursor === 0) && !this._isInvalid) {
  50461. var c = input[cursor];
  50462. switch (state) {
  50463. case 'scheme start':
  50464. if (c && ALPHA.test(c)) {
  50465. buffer += c.toLowerCase();
  50466. state = 'scheme';
  50467. } else if (!stateOverride) {
  50468. buffer = '';
  50469. state = 'no scheme';
  50470. continue;
  50471. } else {
  50472. err('Invalid scheme.');
  50473. break loop;
  50474. }
  50475. break;
  50476. case 'scheme':
  50477. if (c && ALPHANUMERIC.test(c)) {
  50478. buffer += c.toLowerCase();
  50479. } else if (c === ':') {
  50480. this._scheme = buffer;
  50481. buffer = '';
  50482. if (stateOverride) {
  50483. break loop;
  50484. }
  50485. if (isRelativeScheme(this._scheme)) {
  50486. this._isRelative = true;
  50487. }
  50488. if (this._scheme === 'file') {
  50489. state = 'relative';
  50490. } else if (this._isRelative && base && base._scheme === this._scheme) {
  50491. state = 'relative or authority';
  50492. } else if (this._isRelative) {
  50493. state = 'authority first slash';
  50494. } else {
  50495. state = 'scheme data';
  50496. }
  50497. } else if (!stateOverride) {
  50498. buffer = '';
  50499. cursor = 0;
  50500. state = 'no scheme';
  50501. continue;
  50502. } else if (EOF === c) {
  50503. break loop;
  50504. } else {
  50505. err('Code point not allowed in scheme: ' + c);
  50506. break loop;
  50507. }
  50508. break;
  50509. case 'scheme data':
  50510. if (c === '?') {
  50511. this._query = '?';
  50512. state = 'query';
  50513. } else if (c === '#') {
  50514. this._fragment = '#';
  50515. state = 'fragment';
  50516. } else {
  50517. if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) {
  50518. this._schemeData += percentEscape(c);
  50519. }
  50520. }
  50521. break;
  50522. case 'no scheme':
  50523. if (!base || !isRelativeScheme(base._scheme)) {
  50524. err('Missing scheme.');
  50525. invalid.call(this);
  50526. } else {
  50527. state = 'relative';
  50528. continue;
  50529. }
  50530. break;
  50531. case 'relative or authority':
  50532. if (c === '/' && input[cursor + 1] === '/') {
  50533. state = 'authority ignore slashes';
  50534. } else {
  50535. err('Expected /, got: ' + c);
  50536. state = 'relative';
  50537. continue;
  50538. }
  50539. break;
  50540. case 'relative':
  50541. this._isRelative = true;
  50542. if ('file' !== this._scheme) {
  50543. this._scheme = base._scheme;
  50544. }
  50545. if (EOF === c) {
  50546. this._host = base._host;
  50547. this._port = base._port;
  50548. this._path = base._path.slice();
  50549. this._query = base._query;
  50550. this._username = base._username;
  50551. this._password = base._password;
  50552. break loop;
  50553. } else if (c === '/' || c === '\\') {
  50554. if (c === '\\') {
  50555. err('\\ is an invalid code point.');
  50556. }
  50557. state = 'relative slash';
  50558. } else if (c === '?') {
  50559. this._host = base._host;
  50560. this._port = base._port;
  50561. this._path = base._path.slice();
  50562. this._query = '?';
  50563. this._username = base._username;
  50564. this._password = base._password;
  50565. state = 'query';
  50566. } else if (c === '#') {
  50567. this._host = base._host;
  50568. this._port = base._port;
  50569. this._path = base._path.slice();
  50570. this._query = base._query;
  50571. this._fragment = '#';
  50572. this._username = base._username;
  50573. this._password = base._password;
  50574. state = 'fragment';
  50575. } else {
  50576. var nextC = input[cursor + 1];
  50577. var nextNextC = input[cursor + 2];
  50578. if ('file' !== this._scheme || !ALPHA.test(c) || nextC !== ':' && nextC !== '|' || EOF !== nextNextC && '/' !== nextNextC && '\\' !== nextNextC && '?' !== nextNextC && '#' !== nextNextC) {
  50579. this._host = base._host;
  50580. this._port = base._port;
  50581. this._username = base._username;
  50582. this._password = base._password;
  50583. this._path = base._path.slice();
  50584. this._path.pop();
  50585. }
  50586. state = 'relative path';
  50587. continue;
  50588. }
  50589. break;
  50590. case 'relative slash':
  50591. if (c === '/' || c === '\\') {
  50592. if (c === '\\') {
  50593. err('\\ is an invalid code point.');
  50594. }
  50595. if (this._scheme === 'file') {
  50596. state = 'file host';
  50597. } else {
  50598. state = 'authority ignore slashes';
  50599. }
  50600. } else {
  50601. if ('file' !== this._scheme) {
  50602. this._host = base._host;
  50603. this._port = base._port;
  50604. this._username = base._username;
  50605. this._password = base._password;
  50606. }
  50607. state = 'relative path';
  50608. continue;
  50609. }
  50610. break;
  50611. case 'authority first slash':
  50612. if (c === '/') {
  50613. state = 'authority second slash';
  50614. } else {
  50615. err('Expected \'/\', got: ' + c);
  50616. state = 'authority ignore slashes';
  50617. continue;
  50618. }
  50619. break;
  50620. case 'authority second slash':
  50621. state = 'authority ignore slashes';
  50622. if ('/' !== c) {
  50623. err('Expected \'/\', got: ' + c);
  50624. continue;
  50625. }
  50626. break;
  50627. case 'authority ignore slashes':
  50628. if ('/' !== c && '\\' !== c) {
  50629. state = 'authority';
  50630. continue;
  50631. } else {
  50632. err('Expected authority, got: ' + c);
  50633. }
  50634. break;
  50635. case 'authority':
  50636. if (c === '@') {
  50637. if (seenAt) {
  50638. err('@ already seen.');
  50639. buffer += '%40';
  50640. }
  50641. seenAt = true;
  50642. for (var i = 0; i < buffer.length; i++) {
  50643. var cp = buffer[i];
  50644. if (cp === '\t' || cp === '\n' || cp === '\r') {
  50645. err('Invalid whitespace in authority.');
  50646. continue;
  50647. }
  50648. if (cp === ':' && this._password === null) {
  50649. this._password = '';
  50650. continue;
  50651. }
  50652. var tempC = percentEscape(cp);
  50653. if (null !== this._password) {
  50654. this._password += tempC;
  50655. } else {
  50656. this._username += tempC;
  50657. }
  50658. }
  50659. buffer = '';
  50660. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  50661. cursor -= buffer.length;
  50662. buffer = '';
  50663. state = 'host';
  50664. continue;
  50665. } else {
  50666. buffer += c;
  50667. }
  50668. break;
  50669. case 'file host':
  50670. if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  50671. if (buffer.length === 2 && ALPHA.test(buffer[0]) && (buffer[1] === ':' || buffer[1] === '|')) {
  50672. state = 'relative path';
  50673. } else if (buffer.length === 0) {
  50674. state = 'relative path start';
  50675. } else {
  50676. this._host = IDNAToASCII.call(this, buffer);
  50677. buffer = '';
  50678. state = 'relative path start';
  50679. }
  50680. continue;
  50681. } else if (c === '\t' || c === '\n' || c === '\r') {
  50682. err('Invalid whitespace in file host.');
  50683. } else {
  50684. buffer += c;
  50685. }
  50686. break;
  50687. case 'host':
  50688. case 'hostname':
  50689. if (c === ':' && !seenBracket) {
  50690. this._host = IDNAToASCII.call(this, buffer);
  50691. buffer = '';
  50692. state = 'port';
  50693. if (stateOverride === 'hostname') {
  50694. break loop;
  50695. }
  50696. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  50697. this._host = IDNAToASCII.call(this, buffer);
  50698. buffer = '';
  50699. state = 'relative path start';
  50700. if (stateOverride) {
  50701. break loop;
  50702. }
  50703. continue;
  50704. } else if ('\t' !== c && '\n' !== c && '\r' !== c) {
  50705. if (c === '[') {
  50706. seenBracket = true;
  50707. } else if (c === ']') {
  50708. seenBracket = false;
  50709. }
  50710. buffer += c;
  50711. } else {
  50712. err('Invalid code point in host/hostname: ' + c);
  50713. }
  50714. break;
  50715. case 'port':
  50716. if (/[0-9]/.test(c)) {
  50717. buffer += c;
  50718. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#' || stateOverride) {
  50719. if ('' !== buffer) {
  50720. var temp = parseInt(buffer, 10);
  50721. if (temp !== relative[this._scheme]) {
  50722. this._port = temp + '';
  50723. }
  50724. buffer = '';
  50725. }
  50726. if (stateOverride) {
  50727. break loop;
  50728. }
  50729. state = 'relative path start';
  50730. continue;
  50731. } else if (c === '\t' || c === '\n' || c === '\r') {
  50732. err('Invalid code point in port: ' + c);
  50733. } else {
  50734. invalid.call(this);
  50735. }
  50736. break;
  50737. case 'relative path start':
  50738. if (c === '\\') {
  50739. err('\'\\\' not allowed in path.');
  50740. }
  50741. state = 'relative path';
  50742. if ('/' !== c && '\\' !== c) {
  50743. continue;
  50744. }
  50745. break;
  50746. case 'relative path':
  50747. if (c === EOF || c === '/' || c === '\\' || !stateOverride && (c === '?' || c === '#')) {
  50748. if (c === '\\') {
  50749. err('\\ not allowed in relative path.');
  50750. }
  50751. var tmp;
  50752. if (tmp = relativePathDotMapping[buffer.toLowerCase()]) {
  50753. buffer = tmp;
  50754. }
  50755. if (buffer === '..') {
  50756. this._path.pop();
  50757. if ('/' !== c && '\\' !== c) {
  50758. this._path.push('');
  50759. }
  50760. } else if (buffer === '.' && '/' !== c && '\\' !== c) {
  50761. this._path.push('');
  50762. } else if ('.' !== buffer) {
  50763. if (this._scheme === 'file' && this._path.length === 0 && buffer.length === 2 && ALPHA.test(buffer[0]) && buffer[1] === '|') {
  50764. buffer = buffer[0] + ':';
  50765. }
  50766. this._path.push(buffer);
  50767. }
  50768. buffer = '';
  50769. if (c === '?') {
  50770. this._query = '?';
  50771. state = 'query';
  50772. } else if (c === '#') {
  50773. this._fragment = '#';
  50774. state = 'fragment';
  50775. }
  50776. } else if ('\t' !== c && '\n' !== c && '\r' !== c) {
  50777. buffer += percentEscape(c);
  50778. }
  50779. break;
  50780. case 'query':
  50781. if (!stateOverride && c === '#') {
  50782. this._fragment = '#';
  50783. state = 'fragment';
  50784. } else if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) {
  50785. this._query += percentEscapeQuery(c);
  50786. }
  50787. break;
  50788. case 'fragment':
  50789. if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) {
  50790. this._fragment += c;
  50791. }
  50792. break;
  50793. }
  50794. cursor++;
  50795. }
  50796. }
  50797. function clear() {
  50798. this._scheme = '';
  50799. this._schemeData = '';
  50800. this._username = '';
  50801. this._password = null;
  50802. this._host = '';
  50803. this._port = '';
  50804. this._path = [];
  50805. this._query = '';
  50806. this._fragment = '';
  50807. this._isInvalid = false;
  50808. this._isRelative = false;
  50809. }
  50810. function JURL(url, base) {
  50811. if (base !== undefined && !(base instanceof JURL)) {
  50812. base = new JURL(String(base));
  50813. }
  50814. this._url = url;
  50815. clear.call(this);
  50816. var input = url.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g, '');
  50817. parse.call(this, input, null, base);
  50818. }
  50819. JURL.prototype = {
  50820. toString: function () {
  50821. return this.href;
  50822. },
  50823. get href() {
  50824. if (this._isInvalid) {
  50825. return this._url;
  50826. }
  50827. var authority = '';
  50828. if ('' !== this._username || null !== this._password) {
  50829. authority = this._username + (null !== this._password ? ':' + this._password : '') + '@';
  50830. }
  50831. return this.protocol + (this._isRelative ? '//' + authority + this.host : '') + this.pathname + this._query + this._fragment;
  50832. },
  50833. set href(href) {
  50834. clear.call(this);
  50835. parse.call(this, href);
  50836. },
  50837. get protocol() {
  50838. return this._scheme + ':';
  50839. },
  50840. set protocol(protocol) {
  50841. if (this._isInvalid) {
  50842. return;
  50843. }
  50844. parse.call(this, protocol + ':', 'scheme start');
  50845. },
  50846. get host() {
  50847. return this._isInvalid ? '' : this._port ? this._host + ':' + this._port : this._host;
  50848. },
  50849. set host(host) {
  50850. if (this._isInvalid || !this._isRelative) {
  50851. return;
  50852. }
  50853. parse.call(this, host, 'host');
  50854. },
  50855. get hostname() {
  50856. return this._host;
  50857. },
  50858. set hostname(hostname) {
  50859. if (this._isInvalid || !this._isRelative) {
  50860. return;
  50861. }
  50862. parse.call(this, hostname, 'hostname');
  50863. },
  50864. get port() {
  50865. return this._port;
  50866. },
  50867. set port(port) {
  50868. if (this._isInvalid || !this._isRelative) {
  50869. return;
  50870. }
  50871. parse.call(this, port, 'port');
  50872. },
  50873. get pathname() {
  50874. return this._isInvalid ? '' : this._isRelative ? '/' + this._path.join('/') : this._schemeData;
  50875. },
  50876. set pathname(pathname) {
  50877. if (this._isInvalid || !this._isRelative) {
  50878. return;
  50879. }
  50880. this._path = [];
  50881. parse.call(this, pathname, 'relative path start');
  50882. },
  50883. get search() {
  50884. return this._isInvalid || !this._query || this._query === '?' ? '' : this._query;
  50885. },
  50886. set search(search) {
  50887. if (this._isInvalid || !this._isRelative) {
  50888. return;
  50889. }
  50890. this._query = '?';
  50891. if (search[0] === '?') {
  50892. search = search.slice(1);
  50893. }
  50894. parse.call(this, search, 'query');
  50895. },
  50896. get hash() {
  50897. return this._isInvalid || !this._fragment || this._fragment === '#' ? '' : this._fragment;
  50898. },
  50899. set hash(hash) {
  50900. if (this._isInvalid) {
  50901. return;
  50902. }
  50903. this._fragment = '#';
  50904. if (hash[0] === '#') {
  50905. hash = hash.slice(1);
  50906. }
  50907. parse.call(this, hash, 'fragment');
  50908. },
  50909. get origin() {
  50910. var host;
  50911. if (this._isInvalid || !this._scheme) {
  50912. return '';
  50913. }
  50914. switch (this._scheme) {
  50915. case 'data':
  50916. case 'file':
  50917. case 'javascript':
  50918. case 'mailto':
  50919. return 'null';
  50920. }
  50921. host = this.host;
  50922. if (!host) {
  50923. return '';
  50924. }
  50925. return this._scheme + '://' + host;
  50926. }
  50927. };
  50928. var OriginalURL = globalScope.URL;
  50929. if (OriginalURL) {
  50930. JURL.createObjectURL = function (blob) {
  50931. return OriginalURL.createObjectURL.apply(OriginalURL, arguments);
  50932. };
  50933. JURL.revokeObjectURL = function (url) {
  50934. OriginalURL.revokeObjectURL(url);
  50935. };
  50936. }
  50937. globalScope.URL = JURL;
  50938. }());
  50939. }
  50940. /* WEBPACK VAR INJECTION */}.call(exports, __w_pdfjs_require__(9)))
  50941. /***/ }),
  50942. /* 37 */
  50943. /***/ (function(module, exports, __w_pdfjs_require__) {
  50944. "use strict";
  50945. var pdfjsVersion = '1.7.341';
  50946. var pdfjsBuild = '1eb96d7c';
  50947. var pdfjsCoreWorker = __w_pdfjs_require__(8);
  50948. {
  50949. __w_pdfjs_require__(19);
  50950. }
  50951. exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
  50952. /***/ })
  50953. /******/ ]);
  50954. });