pdf.worker.js 1.1 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111
  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. /******/
  29. /******/ // The require function
  30. /******/ function __w_pdfjs_require__(moduleId) {
  31. /******/
  32. /******/ // Check if module is in cache
  33. /******/ if(installedModules[moduleId])
  34. /******/ return installedModules[moduleId].exports;
  35. /******/
  36. /******/ // Create a new module (and put it into the cache)
  37. /******/ var module = installedModules[moduleId] = {
  38. /******/ i: moduleId,
  39. /******/ l: false,
  40. /******/ exports: {}
  41. /******/ };
  42. /******/
  43. /******/ // Execute the module function
  44. /******/ modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__);
  45. /******/
  46. /******/ // Flag the module as loaded
  47. /******/ module.l = true;
  48. /******/
  49. /******/ // Return the exports of the module
  50. /******/ return module.exports;
  51. /******/ }
  52. /******/
  53. /******/
  54. /******/ // expose the modules object (__webpack_modules__)
  55. /******/ __w_pdfjs_require__.m = modules;
  56. /******/
  57. /******/ // expose the module cache
  58. /******/ __w_pdfjs_require__.c = installedModules;
  59. /******/
  60. /******/ // identity function for calling harmony imports with the correct context
  61. /******/ __w_pdfjs_require__.i = function(value) { return value; };
  62. /******/
  63. /******/ // define getter function for harmony exports
  64. /******/ __w_pdfjs_require__.d = function(exports, name, getter) {
  65. /******/ if(!__w_pdfjs_require__.o(exports, name)) {
  66. /******/ Object.defineProperty(exports, name, {
  67. /******/ configurable: false,
  68. /******/ enumerable: true,
  69. /******/ get: getter
  70. /******/ });
  71. /******/ }
  72. /******/ };
  73. /******/
  74. /******/ // getDefaultExport function for compatibility with non-harmony modules
  75. /******/ __w_pdfjs_require__.n = function(module) {
  76. /******/ var getter = module && module.__esModule ?
  77. /******/ function getDefault() { return module['default']; } :
  78. /******/ function getModuleExports() { return module; };
  79. /******/ __w_pdfjs_require__.d(getter, 'a', getter);
  80. /******/ return getter;
  81. /******/ };
  82. /******/
  83. /******/ // Object.prototype.hasOwnProperty.call
  84. /******/ __w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  85. /******/
  86. /******/ // __webpack_public_path__
  87. /******/ __w_pdfjs_require__.p = "";
  88. /******/
  89. /******/ // Load entry module and return exports
  90. /******/ return __w_pdfjs_require__(__w_pdfjs_require__.s = 36);
  91. /******/ })
  92. /************************************************************************/
  93. /******/ ([
  94. /* 0 */
  95. /***/ (function(module, exports, __w_pdfjs_require__) {
  96. "use strict";
  97. /* WEBPACK VAR INJECTION */(function(global) {
  98. var compatibility = __w_pdfjs_require__(37);
  99. var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this;
  100. var FONT_IDENTITY_MATRIX = [
  101. 0.001,
  102. 0,
  103. 0,
  104. 0.001,
  105. 0,
  106. 0
  107. ];
  108. var TextRenderingMode = {
  109. FILL: 0,
  110. STROKE: 1,
  111. FILL_STROKE: 2,
  112. INVISIBLE: 3,
  113. FILL_ADD_TO_PATH: 4,
  114. STROKE_ADD_TO_PATH: 5,
  115. FILL_STROKE_ADD_TO_PATH: 6,
  116. ADD_TO_PATH: 7,
  117. FILL_STROKE_MASK: 3,
  118. ADD_TO_PATH_FLAG: 4
  119. };
  120. var ImageKind = {
  121. GRAYSCALE_1BPP: 1,
  122. RGB_24BPP: 2,
  123. RGBA_32BPP: 3
  124. };
  125. var AnnotationType = {
  126. TEXT: 1,
  127. LINK: 2,
  128. FREETEXT: 3,
  129. LINE: 4,
  130. SQUARE: 5,
  131. CIRCLE: 6,
  132. POLYGON: 7,
  133. POLYLINE: 8,
  134. HIGHLIGHT: 9,
  135. UNDERLINE: 10,
  136. SQUIGGLY: 11,
  137. STRIKEOUT: 12,
  138. STAMP: 13,
  139. CARET: 14,
  140. INK: 15,
  141. POPUP: 16,
  142. FILEATTACHMENT: 17,
  143. SOUND: 18,
  144. MOVIE: 19,
  145. WIDGET: 20,
  146. SCREEN: 21,
  147. PRINTERMARK: 22,
  148. TRAPNET: 23,
  149. WATERMARK: 24,
  150. THREED: 25,
  151. REDACT: 26
  152. };
  153. var AnnotationFlag = {
  154. INVISIBLE: 0x01,
  155. HIDDEN: 0x02,
  156. PRINT: 0x04,
  157. NOZOOM: 0x08,
  158. NOROTATE: 0x10,
  159. NOVIEW: 0x20,
  160. READONLY: 0x40,
  161. LOCKED: 0x80,
  162. TOGGLENOVIEW: 0x100,
  163. LOCKEDCONTENTS: 0x200
  164. };
  165. var AnnotationFieldFlag = {
  166. READONLY: 0x0000001,
  167. REQUIRED: 0x0000002,
  168. NOEXPORT: 0x0000004,
  169. MULTILINE: 0x0001000,
  170. PASSWORD: 0x0002000,
  171. NOTOGGLETOOFF: 0x0004000,
  172. RADIO: 0x0008000,
  173. PUSHBUTTON: 0x0010000,
  174. COMBO: 0x0020000,
  175. EDIT: 0x0040000,
  176. SORT: 0x0080000,
  177. FILESELECT: 0x0100000,
  178. MULTISELECT: 0x0200000,
  179. DONOTSPELLCHECK: 0x0400000,
  180. DONOTSCROLL: 0x0800000,
  181. COMB: 0x1000000,
  182. RICHTEXT: 0x2000000,
  183. RADIOSINUNISON: 0x2000000,
  184. COMMITONSELCHANGE: 0x4000000
  185. };
  186. var AnnotationBorderStyleType = {
  187. SOLID: 1,
  188. DASHED: 2,
  189. BEVELED: 3,
  190. INSET: 4,
  191. UNDERLINE: 5
  192. };
  193. var StreamType = {
  194. UNKNOWN: 0,
  195. FLATE: 1,
  196. LZW: 2,
  197. DCT: 3,
  198. JPX: 4,
  199. JBIG: 5,
  200. A85: 6,
  201. AHX: 7,
  202. CCF: 8,
  203. RL: 9
  204. };
  205. var FontType = {
  206. UNKNOWN: 0,
  207. TYPE1: 1,
  208. TYPE1C: 2,
  209. CIDFONTTYPE0: 3,
  210. CIDFONTTYPE0C: 4,
  211. TRUETYPE: 5,
  212. CIDFONTTYPE2: 6,
  213. TYPE3: 7,
  214. OPENTYPE: 8,
  215. TYPE0: 9,
  216. MMTYPE1: 10
  217. };
  218. var VERBOSITY_LEVELS = {
  219. errors: 0,
  220. warnings: 1,
  221. infos: 5
  222. };
  223. var CMapCompressionType = {
  224. NONE: 0,
  225. BINARY: 1,
  226. STREAM: 2
  227. };
  228. var OPS = {
  229. dependency: 1,
  230. setLineWidth: 2,
  231. setLineCap: 3,
  232. setLineJoin: 4,
  233. setMiterLimit: 5,
  234. setDash: 6,
  235. setRenderingIntent: 7,
  236. setFlatness: 8,
  237. setGState: 9,
  238. save: 10,
  239. restore: 11,
  240. transform: 12,
  241. moveTo: 13,
  242. lineTo: 14,
  243. curveTo: 15,
  244. curveTo2: 16,
  245. curveTo3: 17,
  246. closePath: 18,
  247. rectangle: 19,
  248. stroke: 20,
  249. closeStroke: 21,
  250. fill: 22,
  251. eoFill: 23,
  252. fillStroke: 24,
  253. eoFillStroke: 25,
  254. closeFillStroke: 26,
  255. closeEOFillStroke: 27,
  256. endPath: 28,
  257. clip: 29,
  258. eoClip: 30,
  259. beginText: 31,
  260. endText: 32,
  261. setCharSpacing: 33,
  262. setWordSpacing: 34,
  263. setHScale: 35,
  264. setLeading: 36,
  265. setFont: 37,
  266. setTextRenderingMode: 38,
  267. setTextRise: 39,
  268. moveText: 40,
  269. setLeadingMoveText: 41,
  270. setTextMatrix: 42,
  271. nextLine: 43,
  272. showText: 44,
  273. showSpacedText: 45,
  274. nextLineShowText: 46,
  275. nextLineSetSpacingShowText: 47,
  276. setCharWidth: 48,
  277. setCharWidthAndBounds: 49,
  278. setStrokeColorSpace: 50,
  279. setFillColorSpace: 51,
  280. setStrokeColor: 52,
  281. setStrokeColorN: 53,
  282. setFillColor: 54,
  283. setFillColorN: 55,
  284. setStrokeGray: 56,
  285. setFillGray: 57,
  286. setStrokeRGBColor: 58,
  287. setFillRGBColor: 59,
  288. setStrokeCMYKColor: 60,
  289. setFillCMYKColor: 61,
  290. shadingFill: 62,
  291. beginInlineImage: 63,
  292. beginImageData: 64,
  293. endInlineImage: 65,
  294. paintXObject: 66,
  295. markPoint: 67,
  296. markPointProps: 68,
  297. beginMarkedContent: 69,
  298. beginMarkedContentProps: 70,
  299. endMarkedContent: 71,
  300. beginCompat: 72,
  301. endCompat: 73,
  302. paintFormXObjectBegin: 74,
  303. paintFormXObjectEnd: 75,
  304. beginGroup: 76,
  305. endGroup: 77,
  306. beginAnnotations: 78,
  307. endAnnotations: 79,
  308. beginAnnotation: 80,
  309. endAnnotation: 81,
  310. paintJpegXObject: 82,
  311. paintImageMaskXObject: 83,
  312. paintImageMaskXObjectGroup: 84,
  313. paintImageXObject: 85,
  314. paintInlineImageXObject: 86,
  315. paintInlineImageXObjectGroup: 87,
  316. paintImageXObjectRepeat: 88,
  317. paintImageMaskXObjectRepeat: 89,
  318. paintSolidColorImageMask: 90,
  319. constructPath: 91
  320. };
  321. var verbosity = VERBOSITY_LEVELS.warnings;
  322. function setVerbosityLevel(level) {
  323. verbosity = level;
  324. }
  325. function getVerbosityLevel() {
  326. return verbosity;
  327. }
  328. function info(msg) {
  329. if (verbosity >= VERBOSITY_LEVELS.infos) {
  330. console.log('Info: ' + msg);
  331. }
  332. }
  333. function warn(msg) {
  334. if (verbosity >= VERBOSITY_LEVELS.warnings) {
  335. console.log('Warning: ' + msg);
  336. }
  337. }
  338. function deprecated(details) {
  339. console.log('Deprecated API usage: ' + details);
  340. }
  341. function error(msg) {
  342. if (verbosity >= VERBOSITY_LEVELS.errors) {
  343. console.log('Error: ' + msg);
  344. console.log(backtrace());
  345. }
  346. throw new Error(msg);
  347. }
  348. function backtrace() {
  349. try {
  350. throw new Error();
  351. } catch (e) {
  352. return e.stack ? e.stack.split('\n').slice(2).join('\n') : '';
  353. }
  354. }
  355. function assert(cond, msg) {
  356. if (!cond) {
  357. error(msg);
  358. }
  359. }
  360. var UNSUPPORTED_FEATURES = {
  361. unknown: 'unknown',
  362. forms: 'forms',
  363. javaScript: 'javaScript',
  364. smask: 'smask',
  365. shadingPattern: 'shadingPattern',
  366. font: 'font'
  367. };
  368. function isSameOrigin(baseUrl, otherUrl) {
  369. try {
  370. var base = new URL(baseUrl);
  371. if (!base.origin || base.origin === 'null') {
  372. return false;
  373. }
  374. } catch (e) {
  375. return false;
  376. }
  377. var other = new URL(otherUrl, base);
  378. return base.origin === other.origin;
  379. }
  380. function isValidProtocol(url) {
  381. if (!url) {
  382. return false;
  383. }
  384. switch (url.protocol) {
  385. case 'http:':
  386. case 'https:':
  387. case 'ftp:':
  388. case 'mailto:':
  389. case 'tel:':
  390. return true;
  391. default:
  392. return false;
  393. }
  394. }
  395. function createValidAbsoluteUrl(url, baseUrl) {
  396. if (!url) {
  397. return null;
  398. }
  399. try {
  400. var absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  401. if (isValidProtocol(absoluteUrl)) {
  402. return absoluteUrl;
  403. }
  404. } catch (ex) {
  405. }
  406. return null;
  407. }
  408. function shadow(obj, prop, value) {
  409. Object.defineProperty(obj, prop, {
  410. value: value,
  411. enumerable: true,
  412. configurable: true,
  413. writable: false
  414. });
  415. return value;
  416. }
  417. function getLookupTableFactory(initializer) {
  418. var lookup;
  419. return function () {
  420. if (initializer) {
  421. lookup = Object.create(null);
  422. initializer(lookup);
  423. initializer = null;
  424. }
  425. return lookup;
  426. };
  427. }
  428. var PasswordResponses = {
  429. NEED_PASSWORD: 1,
  430. INCORRECT_PASSWORD: 2
  431. };
  432. var PasswordException = function PasswordExceptionClosure() {
  433. function PasswordException(msg, code) {
  434. this.name = 'PasswordException';
  435. this.message = msg;
  436. this.code = code;
  437. }
  438. PasswordException.prototype = new Error();
  439. PasswordException.constructor = PasswordException;
  440. return PasswordException;
  441. }();
  442. var UnknownErrorException = function UnknownErrorExceptionClosure() {
  443. function UnknownErrorException(msg, details) {
  444. this.name = 'UnknownErrorException';
  445. this.message = msg;
  446. this.details = details;
  447. }
  448. UnknownErrorException.prototype = new Error();
  449. UnknownErrorException.constructor = UnknownErrorException;
  450. return UnknownErrorException;
  451. }();
  452. var InvalidPDFException = function InvalidPDFExceptionClosure() {
  453. function InvalidPDFException(msg) {
  454. this.name = 'InvalidPDFException';
  455. this.message = msg;
  456. }
  457. InvalidPDFException.prototype = new Error();
  458. InvalidPDFException.constructor = InvalidPDFException;
  459. return InvalidPDFException;
  460. }();
  461. var MissingPDFException = function MissingPDFExceptionClosure() {
  462. function MissingPDFException(msg) {
  463. this.name = 'MissingPDFException';
  464. this.message = msg;
  465. }
  466. MissingPDFException.prototype = new Error();
  467. MissingPDFException.constructor = MissingPDFException;
  468. return MissingPDFException;
  469. }();
  470. var UnexpectedResponseException = function UnexpectedResponseExceptionClosure() {
  471. function UnexpectedResponseException(msg, status) {
  472. this.name = 'UnexpectedResponseException';
  473. this.message = msg;
  474. this.status = status;
  475. }
  476. UnexpectedResponseException.prototype = new Error();
  477. UnexpectedResponseException.constructor = UnexpectedResponseException;
  478. return UnexpectedResponseException;
  479. }();
  480. var NotImplementedException = function NotImplementedExceptionClosure() {
  481. function NotImplementedException(msg) {
  482. this.message = msg;
  483. }
  484. NotImplementedException.prototype = new Error();
  485. NotImplementedException.prototype.name = 'NotImplementedException';
  486. NotImplementedException.constructor = NotImplementedException;
  487. return NotImplementedException;
  488. }();
  489. var MissingDataException = function MissingDataExceptionClosure() {
  490. function MissingDataException(begin, end) {
  491. this.begin = begin;
  492. this.end = end;
  493. this.message = 'Missing data [' + begin + ', ' + end + ')';
  494. }
  495. MissingDataException.prototype = new Error();
  496. MissingDataException.prototype.name = 'MissingDataException';
  497. MissingDataException.constructor = MissingDataException;
  498. return MissingDataException;
  499. }();
  500. var XRefParseException = function XRefParseExceptionClosure() {
  501. function XRefParseException(msg) {
  502. this.message = msg;
  503. }
  504. XRefParseException.prototype = new Error();
  505. XRefParseException.prototype.name = 'XRefParseException';
  506. XRefParseException.constructor = XRefParseException;
  507. return XRefParseException;
  508. }();
  509. var NullCharactersRegExp = /\x00/g;
  510. function removeNullCharacters(str) {
  511. if (typeof str !== 'string') {
  512. warn('The argument for removeNullCharacters must be a string.');
  513. return str;
  514. }
  515. return str.replace(NullCharactersRegExp, '');
  516. }
  517. function bytesToString(bytes) {
  518. assert(bytes !== null && typeof bytes === 'object' && bytes.length !== undefined, 'Invalid argument for bytesToString');
  519. var length = bytes.length;
  520. var MAX_ARGUMENT_COUNT = 8192;
  521. if (length < MAX_ARGUMENT_COUNT) {
  522. return String.fromCharCode.apply(null, bytes);
  523. }
  524. var strBuf = [];
  525. for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  526. var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  527. var chunk = bytes.subarray(i, chunkEnd);
  528. strBuf.push(String.fromCharCode.apply(null, chunk));
  529. }
  530. return strBuf.join('');
  531. }
  532. function stringToBytes(str) {
  533. assert(typeof str === 'string', 'Invalid argument for stringToBytes');
  534. var length = str.length;
  535. var bytes = new Uint8Array(length);
  536. for (var i = 0; i < length; ++i) {
  537. bytes[i] = str.charCodeAt(i) & 0xFF;
  538. }
  539. return bytes;
  540. }
  541. function arrayByteLength(arr) {
  542. if (arr.length !== undefined) {
  543. return arr.length;
  544. }
  545. assert(arr.byteLength !== undefined);
  546. return arr.byteLength;
  547. }
  548. function arraysToBytes(arr) {
  549. if (arr.length === 1 && arr[0] instanceof Uint8Array) {
  550. return arr[0];
  551. }
  552. var resultLength = 0;
  553. var i, ii = arr.length;
  554. var item, itemLength;
  555. for (i = 0; i < ii; i++) {
  556. item = arr[i];
  557. itemLength = arrayByteLength(item);
  558. resultLength += itemLength;
  559. }
  560. var pos = 0;
  561. var data = new Uint8Array(resultLength);
  562. for (i = 0; i < ii; i++) {
  563. item = arr[i];
  564. if (!(item instanceof Uint8Array)) {
  565. if (typeof item === 'string') {
  566. item = stringToBytes(item);
  567. } else {
  568. item = new Uint8Array(item);
  569. }
  570. }
  571. itemLength = item.byteLength;
  572. data.set(item, pos);
  573. pos += itemLength;
  574. }
  575. return data;
  576. }
  577. function string32(value) {
  578. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  579. }
  580. function log2(x) {
  581. var n = 1, i = 0;
  582. while (x > n) {
  583. n <<= 1;
  584. i++;
  585. }
  586. return i;
  587. }
  588. function readInt8(data, start) {
  589. return data[start] << 24 >> 24;
  590. }
  591. function readUint16(data, offset) {
  592. return data[offset] << 8 | data[offset + 1];
  593. }
  594. function readUint32(data, offset) {
  595. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  596. }
  597. function isLittleEndian() {
  598. var buffer8 = new Uint8Array(2);
  599. buffer8[0] = 1;
  600. var buffer16 = new Uint16Array(buffer8.buffer);
  601. return buffer16[0] === 1;
  602. }
  603. function isEvalSupported() {
  604. try {
  605. new Function('');
  606. return true;
  607. } catch (e) {
  608. return false;
  609. }
  610. }
  611. var Uint32ArrayView = function Uint32ArrayViewClosure() {
  612. function Uint32ArrayView(buffer, length) {
  613. this.buffer = buffer;
  614. this.byteLength = buffer.length;
  615. this.length = length === undefined ? this.byteLength >> 2 : length;
  616. ensureUint32ArrayViewProps(this.length);
  617. }
  618. Uint32ArrayView.prototype = Object.create(null);
  619. var uint32ArrayViewSetters = 0;
  620. function createUint32ArrayProp(index) {
  621. return {
  622. get: function () {
  623. var buffer = this.buffer, offset = index << 2;
  624. return (buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24) >>> 0;
  625. },
  626. set: function (value) {
  627. var buffer = this.buffer, offset = index << 2;
  628. buffer[offset] = value & 255;
  629. buffer[offset + 1] = value >> 8 & 255;
  630. buffer[offset + 2] = value >> 16 & 255;
  631. buffer[offset + 3] = value >>> 24 & 255;
  632. }
  633. };
  634. }
  635. function ensureUint32ArrayViewProps(length) {
  636. while (uint32ArrayViewSetters < length) {
  637. Object.defineProperty(Uint32ArrayView.prototype, uint32ArrayViewSetters, createUint32ArrayProp(uint32ArrayViewSetters));
  638. uint32ArrayViewSetters++;
  639. }
  640. }
  641. return Uint32ArrayView;
  642. }();
  643. exports.Uint32ArrayView = Uint32ArrayView;
  644. var IDENTITY_MATRIX = [
  645. 1,
  646. 0,
  647. 0,
  648. 1,
  649. 0,
  650. 0
  651. ];
  652. var Util = function UtilClosure() {
  653. function Util() {
  654. }
  655. var rgbBuf = [
  656. 'rgb(',
  657. 0,
  658. ',',
  659. 0,
  660. ',',
  661. 0,
  662. ')'
  663. ];
  664. Util.makeCssRgb = function Util_makeCssRgb(r, g, b) {
  665. rgbBuf[1] = r;
  666. rgbBuf[3] = g;
  667. rgbBuf[5] = b;
  668. return rgbBuf.join('');
  669. };
  670. Util.transform = function Util_transform(m1, m2) {
  671. return [
  672. m1[0] * m2[0] + m1[2] * m2[1],
  673. m1[1] * m2[0] + m1[3] * m2[1],
  674. m1[0] * m2[2] + m1[2] * m2[3],
  675. m1[1] * m2[2] + m1[3] * m2[3],
  676. m1[0] * m2[4] + m1[2] * m2[5] + m1[4],
  677. m1[1] * m2[4] + m1[3] * m2[5] + m1[5]
  678. ];
  679. };
  680. Util.applyTransform = function Util_applyTransform(p, m) {
  681. var xt = p[0] * m[0] + p[1] * m[2] + m[4];
  682. var yt = p[0] * m[1] + p[1] * m[3] + m[5];
  683. return [
  684. xt,
  685. yt
  686. ];
  687. };
  688. Util.applyInverseTransform = function Util_applyInverseTransform(p, m) {
  689. var d = m[0] * m[3] - m[1] * m[2];
  690. var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  691. var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  692. return [
  693. xt,
  694. yt
  695. ];
  696. };
  697. Util.getAxialAlignedBoundingBox = function Util_getAxialAlignedBoundingBox(r, m) {
  698. var p1 = Util.applyTransform(r, m);
  699. var p2 = Util.applyTransform(r.slice(2, 4), m);
  700. var p3 = Util.applyTransform([
  701. r[0],
  702. r[3]
  703. ], m);
  704. var p4 = Util.applyTransform([
  705. r[2],
  706. r[1]
  707. ], m);
  708. return [
  709. Math.min(p1[0], p2[0], p3[0], p4[0]),
  710. Math.min(p1[1], p2[1], p3[1], p4[1]),
  711. Math.max(p1[0], p2[0], p3[0], p4[0]),
  712. Math.max(p1[1], p2[1], p3[1], p4[1])
  713. ];
  714. };
  715. Util.inverseTransform = function Util_inverseTransform(m) {
  716. var d = m[0] * m[3] - m[1] * m[2];
  717. return [
  718. m[3] / d,
  719. -m[1] / d,
  720. -m[2] / d,
  721. m[0] / d,
  722. (m[2] * m[5] - m[4] * m[3]) / d,
  723. (m[4] * m[1] - m[5] * m[0]) / d
  724. ];
  725. };
  726. Util.apply3dTransform = function Util_apply3dTransform(m, v) {
  727. return [
  728. m[0] * v[0] + m[1] * v[1] + m[2] * v[2],
  729. m[3] * v[0] + m[4] * v[1] + m[5] * v[2],
  730. m[6] * v[0] + m[7] * v[1] + m[8] * v[2]
  731. ];
  732. };
  733. Util.singularValueDecompose2dScale = function Util_singularValueDecompose2dScale(m) {
  734. var transpose = [
  735. m[0],
  736. m[2],
  737. m[1],
  738. m[3]
  739. ];
  740. var a = m[0] * transpose[0] + m[1] * transpose[2];
  741. var b = m[0] * transpose[1] + m[1] * transpose[3];
  742. var c = m[2] * transpose[0] + m[3] * transpose[2];
  743. var d = m[2] * transpose[1] + m[3] * transpose[3];
  744. var first = (a + d) / 2;
  745. var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
  746. var sx = first + second || 1;
  747. var sy = first - second || 1;
  748. return [
  749. Math.sqrt(sx),
  750. Math.sqrt(sy)
  751. ];
  752. };
  753. Util.normalizeRect = function Util_normalizeRect(rect) {
  754. var r = rect.slice(0);
  755. if (rect[0] > rect[2]) {
  756. r[0] = rect[2];
  757. r[2] = rect[0];
  758. }
  759. if (rect[1] > rect[3]) {
  760. r[1] = rect[3];
  761. r[3] = rect[1];
  762. }
  763. return r;
  764. };
  765. Util.intersect = function Util_intersect(rect1, rect2) {
  766. function compare(a, b) {
  767. return a - b;
  768. }
  769. var orderedX = [
  770. rect1[0],
  771. rect1[2],
  772. rect2[0],
  773. rect2[2]
  774. ].sort(compare), orderedY = [
  775. rect1[1],
  776. rect1[3],
  777. rect2[1],
  778. rect2[3]
  779. ].sort(compare), result = [];
  780. rect1 = Util.normalizeRect(rect1);
  781. rect2 = Util.normalizeRect(rect2);
  782. if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
  783. result[0] = orderedX[1];
  784. result[2] = orderedX[2];
  785. } else {
  786. return false;
  787. }
  788. if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
  789. result[1] = orderedY[1];
  790. result[3] = orderedY[2];
  791. } else {
  792. return false;
  793. }
  794. return result;
  795. };
  796. Util.sign = function Util_sign(num) {
  797. return num < 0 ? -1 : 1;
  798. };
  799. var ROMAN_NUMBER_MAP = [
  800. '',
  801. 'C',
  802. 'CC',
  803. 'CCC',
  804. 'CD',
  805. 'D',
  806. 'DC',
  807. 'DCC',
  808. 'DCCC',
  809. 'CM',
  810. '',
  811. 'X',
  812. 'XX',
  813. 'XXX',
  814. 'XL',
  815. 'L',
  816. 'LX',
  817. 'LXX',
  818. 'LXXX',
  819. 'XC',
  820. '',
  821. 'I',
  822. 'II',
  823. 'III',
  824. 'IV',
  825. 'V',
  826. 'VI',
  827. 'VII',
  828. 'VIII',
  829. 'IX'
  830. ];
  831. Util.toRoman = function Util_toRoman(number, lowerCase) {
  832. assert(isInt(number) && number > 0, 'The number should be a positive integer.');
  833. var pos, romanBuf = [];
  834. while (number >= 1000) {
  835. number -= 1000;
  836. romanBuf.push('M');
  837. }
  838. pos = number / 100 | 0;
  839. number %= 100;
  840. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  841. pos = number / 10 | 0;
  842. number %= 10;
  843. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  844. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  845. var romanStr = romanBuf.join('');
  846. return lowerCase ? romanStr.toLowerCase() : romanStr;
  847. };
  848. Util.appendToArray = function Util_appendToArray(arr1, arr2) {
  849. Array.prototype.push.apply(arr1, arr2);
  850. };
  851. Util.prependToArray = function Util_prependToArray(arr1, arr2) {
  852. Array.prototype.unshift.apply(arr1, arr2);
  853. };
  854. Util.extendObj = function extendObj(obj1, obj2) {
  855. for (var key in obj2) {
  856. obj1[key] = obj2[key];
  857. }
  858. };
  859. Util.getInheritableProperty = function Util_getInheritableProperty(dict, name, getArray) {
  860. while (dict && !dict.has(name)) {
  861. dict = dict.get('Parent');
  862. }
  863. if (!dict) {
  864. return null;
  865. }
  866. return getArray ? dict.getArray(name) : dict.get(name);
  867. };
  868. Util.inherit = function Util_inherit(sub, base, prototype) {
  869. sub.prototype = Object.create(base.prototype);
  870. sub.prototype.constructor = sub;
  871. for (var prop in prototype) {
  872. sub.prototype[prop] = prototype[prop];
  873. }
  874. };
  875. Util.loadScript = function Util_loadScript(src, callback) {
  876. var script = document.createElement('script');
  877. var loaded = false;
  878. script.setAttribute('src', src);
  879. if (callback) {
  880. script.onload = function () {
  881. if (!loaded) {
  882. callback();
  883. }
  884. loaded = true;
  885. };
  886. }
  887. document.getElementsByTagName('head')[0].appendChild(script);
  888. };
  889. return Util;
  890. }();
  891. var PageViewport = function PageViewportClosure() {
  892. function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) {
  893. this.viewBox = viewBox;
  894. this.scale = scale;
  895. this.rotation = rotation;
  896. this.offsetX = offsetX;
  897. this.offsetY = offsetY;
  898. var centerX = (viewBox[2] + viewBox[0]) / 2;
  899. var centerY = (viewBox[3] + viewBox[1]) / 2;
  900. var rotateA, rotateB, rotateC, rotateD;
  901. rotation = rotation % 360;
  902. rotation = rotation < 0 ? rotation + 360 : rotation;
  903. switch (rotation) {
  904. case 180:
  905. rotateA = -1;
  906. rotateB = 0;
  907. rotateC = 0;
  908. rotateD = 1;
  909. break;
  910. case 90:
  911. rotateA = 0;
  912. rotateB = 1;
  913. rotateC = 1;
  914. rotateD = 0;
  915. break;
  916. case 270:
  917. rotateA = 0;
  918. rotateB = -1;
  919. rotateC = -1;
  920. rotateD = 0;
  921. break;
  922. default:
  923. rotateA = 1;
  924. rotateB = 0;
  925. rotateC = 0;
  926. rotateD = -1;
  927. break;
  928. }
  929. if (dontFlip) {
  930. rotateC = -rotateC;
  931. rotateD = -rotateD;
  932. }
  933. var offsetCanvasX, offsetCanvasY;
  934. var width, height;
  935. if (rotateA === 0) {
  936. offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;
  937. offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;
  938. width = Math.abs(viewBox[3] - viewBox[1]) * scale;
  939. height = Math.abs(viewBox[2] - viewBox[0]) * scale;
  940. } else {
  941. offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;
  942. offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;
  943. width = Math.abs(viewBox[2] - viewBox[0]) * scale;
  944. height = Math.abs(viewBox[3] - viewBox[1]) * scale;
  945. }
  946. this.transform = [
  947. rotateA * scale,
  948. rotateB * scale,
  949. rotateC * scale,
  950. rotateD * scale,
  951. offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY,
  952. offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY
  953. ];
  954. this.width = width;
  955. this.height = height;
  956. this.fontScale = scale;
  957. }
  958. PageViewport.prototype = {
  959. clone: function PageViewPort_clone(args) {
  960. args = args || {};
  961. var scale = 'scale' in args ? args.scale : this.scale;
  962. var rotation = 'rotation' in args ? args.rotation : this.rotation;
  963. return new PageViewport(this.viewBox.slice(), scale, rotation, this.offsetX, this.offsetY, args.dontFlip);
  964. },
  965. convertToViewportPoint: function PageViewport_convertToViewportPoint(x, y) {
  966. return Util.applyTransform([
  967. x,
  968. y
  969. ], this.transform);
  970. },
  971. convertToViewportRectangle: function PageViewport_convertToViewportRectangle(rect) {
  972. var tl = Util.applyTransform([
  973. rect[0],
  974. rect[1]
  975. ], this.transform);
  976. var br = Util.applyTransform([
  977. rect[2],
  978. rect[3]
  979. ], this.transform);
  980. return [
  981. tl[0],
  982. tl[1],
  983. br[0],
  984. br[1]
  985. ];
  986. },
  987. convertToPdfPoint: function PageViewport_convertToPdfPoint(x, y) {
  988. return Util.applyInverseTransform([
  989. x,
  990. y
  991. ], this.transform);
  992. }
  993. };
  994. return PageViewport;
  995. }();
  996. var PDFStringTranslateTable = [
  997. 0,
  998. 0,
  999. 0,
  1000. 0,
  1001. 0,
  1002. 0,
  1003. 0,
  1004. 0,
  1005. 0,
  1006. 0,
  1007. 0,
  1008. 0,
  1009. 0,
  1010. 0,
  1011. 0,
  1012. 0,
  1013. 0,
  1014. 0,
  1015. 0,
  1016. 0,
  1017. 0,
  1018. 0,
  1019. 0,
  1020. 0,
  1021. 0x2D8,
  1022. 0x2C7,
  1023. 0x2C6,
  1024. 0x2D9,
  1025. 0x2DD,
  1026. 0x2DB,
  1027. 0x2DA,
  1028. 0x2DC,
  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. 0,
  1111. 0,
  1112. 0,
  1113. 0,
  1114. 0,
  1115. 0,
  1116. 0,
  1117. 0,
  1118. 0,
  1119. 0,
  1120. 0,
  1121. 0,
  1122. 0,
  1123. 0,
  1124. 0,
  1125. 0x2022,
  1126. 0x2020,
  1127. 0x2021,
  1128. 0x2026,
  1129. 0x2014,
  1130. 0x2013,
  1131. 0x192,
  1132. 0x2044,
  1133. 0x2039,
  1134. 0x203A,
  1135. 0x2212,
  1136. 0x2030,
  1137. 0x201E,
  1138. 0x201C,
  1139. 0x201D,
  1140. 0x2018,
  1141. 0x2019,
  1142. 0x201A,
  1143. 0x2122,
  1144. 0xFB01,
  1145. 0xFB02,
  1146. 0x141,
  1147. 0x152,
  1148. 0x160,
  1149. 0x178,
  1150. 0x17D,
  1151. 0x131,
  1152. 0x142,
  1153. 0x153,
  1154. 0x161,
  1155. 0x17E,
  1156. 0,
  1157. 0x20AC
  1158. ];
  1159. function stringToPDFString(str) {
  1160. var i, n = str.length, strBuf = [];
  1161. if (str[0] === '\xFE' && str[1] === '\xFF') {
  1162. for (i = 2; i < n; i += 2) {
  1163. strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
  1164. }
  1165. } else {
  1166. for (i = 0; i < n; ++i) {
  1167. var code = PDFStringTranslateTable[str.charCodeAt(i)];
  1168. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1169. }
  1170. }
  1171. return strBuf.join('');
  1172. }
  1173. function stringToUTF8String(str) {
  1174. return decodeURIComponent(escape(str));
  1175. }
  1176. function utf8StringToString(str) {
  1177. return unescape(encodeURIComponent(str));
  1178. }
  1179. function isEmptyObj(obj) {
  1180. for (var key in obj) {
  1181. return false;
  1182. }
  1183. return true;
  1184. }
  1185. function isBool(v) {
  1186. return typeof v === 'boolean';
  1187. }
  1188. function isInt(v) {
  1189. return typeof v === 'number' && (v | 0) === v;
  1190. }
  1191. function isNum(v) {
  1192. return typeof v === 'number';
  1193. }
  1194. function isString(v) {
  1195. return typeof v === 'string';
  1196. }
  1197. function isArray(v) {
  1198. return v instanceof Array;
  1199. }
  1200. function isArrayBuffer(v) {
  1201. return typeof v === 'object' && v !== null && v.byteLength !== undefined;
  1202. }
  1203. function isSpace(ch) {
  1204. return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A;
  1205. }
  1206. function isNodeJS() {
  1207. if (typeof __pdfjsdev_webpack__ === 'undefined') {
  1208. return typeof process === 'object' && process + '' === '[object process]';
  1209. }
  1210. return false;
  1211. }
  1212. function createPromiseCapability() {
  1213. var capability = {};
  1214. capability.promise = new Promise(function (resolve, reject) {
  1215. capability.resolve = resolve;
  1216. capability.reject = reject;
  1217. });
  1218. return capability;
  1219. }
  1220. var StatTimer = function StatTimerClosure() {
  1221. function rpad(str, pad, length) {
  1222. while (str.length < length) {
  1223. str += pad;
  1224. }
  1225. return str;
  1226. }
  1227. function StatTimer() {
  1228. this.started = Object.create(null);
  1229. this.times = [];
  1230. this.enabled = true;
  1231. }
  1232. StatTimer.prototype = {
  1233. time: function StatTimer_time(name) {
  1234. if (!this.enabled) {
  1235. return;
  1236. }
  1237. if (name in this.started) {
  1238. warn('Timer is already running for ' + name);
  1239. }
  1240. this.started[name] = Date.now();
  1241. },
  1242. timeEnd: function StatTimer_timeEnd(name) {
  1243. if (!this.enabled) {
  1244. return;
  1245. }
  1246. if (!(name in this.started)) {
  1247. warn('Timer has not been started for ' + name);
  1248. }
  1249. this.times.push({
  1250. 'name': name,
  1251. 'start': this.started[name],
  1252. 'end': Date.now()
  1253. });
  1254. delete this.started[name];
  1255. },
  1256. toString: function StatTimer_toString() {
  1257. var i, ii;
  1258. var times = this.times;
  1259. var out = '';
  1260. var longest = 0;
  1261. for (i = 0, ii = times.length; i < ii; ++i) {
  1262. var name = times[i]['name'];
  1263. if (name.length > longest) {
  1264. longest = name.length;
  1265. }
  1266. }
  1267. for (i = 0, ii = times.length; i < ii; ++i) {
  1268. var span = times[i];
  1269. var duration = span.end - span.start;
  1270. out += rpad(span['name'], ' ', longest) + ' ' + duration + 'ms\n';
  1271. }
  1272. return out;
  1273. }
  1274. };
  1275. return StatTimer;
  1276. }();
  1277. var createBlob = function createBlob(data, contentType) {
  1278. if (typeof Blob !== 'undefined') {
  1279. return new Blob([data], { type: contentType });
  1280. }
  1281. warn('The "Blob" constructor is not supported.');
  1282. };
  1283. var createObjectURL = function createObjectURLClosure() {
  1284. var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  1285. return function createObjectURL(data, contentType, forceDataSchema) {
  1286. if (!forceDataSchema && typeof URL !== 'undefined' && URL.createObjectURL) {
  1287. var blob = createBlob(data, contentType);
  1288. return URL.createObjectURL(blob);
  1289. }
  1290. var buffer = 'data:' + contentType + ';base64,';
  1291. for (var i = 0, ii = data.length; i < ii; i += 3) {
  1292. var b1 = data[i] & 0xFF;
  1293. var b2 = data[i + 1] & 0xFF;
  1294. var b3 = data[i + 2] & 0xFF;
  1295. var d1 = b1 >> 2, d2 = (b1 & 3) << 4 | b2 >> 4;
  1296. var d3 = i + 1 < ii ? (b2 & 0xF) << 2 | b3 >> 6 : 64;
  1297. var d4 = i + 2 < ii ? b3 & 0x3F : 64;
  1298. buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
  1299. }
  1300. return buffer;
  1301. };
  1302. }();
  1303. function MessageHandler(sourceName, targetName, comObj) {
  1304. this.sourceName = sourceName;
  1305. this.targetName = targetName;
  1306. this.comObj = comObj;
  1307. this.callbackIndex = 1;
  1308. this.postMessageTransfers = true;
  1309. var callbacksCapabilities = this.callbacksCapabilities = Object.create(null);
  1310. var ah = this.actionHandler = Object.create(null);
  1311. this._onComObjOnMessage = function messageHandlerComObjOnMessage(event) {
  1312. var data = event.data;
  1313. if (data.targetName !== this.sourceName) {
  1314. return;
  1315. }
  1316. if (data.isReply) {
  1317. var callbackId = data.callbackId;
  1318. if (data.callbackId in callbacksCapabilities) {
  1319. var callback = callbacksCapabilities[callbackId];
  1320. delete callbacksCapabilities[callbackId];
  1321. if ('error' in data) {
  1322. callback.reject(data.error);
  1323. } else {
  1324. callback.resolve(data.data);
  1325. }
  1326. } else {
  1327. error('Cannot resolve callback ' + callbackId);
  1328. }
  1329. } else if (data.action in ah) {
  1330. var action = ah[data.action];
  1331. if (data.callbackId) {
  1332. var sourceName = this.sourceName;
  1333. var targetName = data.sourceName;
  1334. Promise.resolve().then(function () {
  1335. return action[0].call(action[1], data.data);
  1336. }).then(function (result) {
  1337. comObj.postMessage({
  1338. sourceName: sourceName,
  1339. targetName: targetName,
  1340. isReply: true,
  1341. callbackId: data.callbackId,
  1342. data: result
  1343. });
  1344. }, function (reason) {
  1345. if (reason instanceof Error) {
  1346. reason = reason + '';
  1347. }
  1348. comObj.postMessage({
  1349. sourceName: sourceName,
  1350. targetName: targetName,
  1351. isReply: true,
  1352. callbackId: data.callbackId,
  1353. error: reason
  1354. });
  1355. });
  1356. } else {
  1357. action[0].call(action[1], data.data);
  1358. }
  1359. } else {
  1360. error('Unknown action from worker: ' + data.action);
  1361. }
  1362. }.bind(this);
  1363. comObj.addEventListener('message', this._onComObjOnMessage);
  1364. }
  1365. MessageHandler.prototype = {
  1366. on: function messageHandlerOn(actionName, handler, scope) {
  1367. var ah = this.actionHandler;
  1368. if (ah[actionName]) {
  1369. error('There is already an actionName called "' + actionName + '"');
  1370. }
  1371. ah[actionName] = [
  1372. handler,
  1373. scope
  1374. ];
  1375. },
  1376. send: function messageHandlerSend(actionName, data, transfers) {
  1377. var message = {
  1378. sourceName: this.sourceName,
  1379. targetName: this.targetName,
  1380. action: actionName,
  1381. data: data
  1382. };
  1383. this.postMessage(message, transfers);
  1384. },
  1385. sendWithPromise: function messageHandlerSendWithPromise(actionName, data, transfers) {
  1386. var callbackId = this.callbackIndex++;
  1387. var message = {
  1388. sourceName: this.sourceName,
  1389. targetName: this.targetName,
  1390. action: actionName,
  1391. data: data,
  1392. callbackId: callbackId
  1393. };
  1394. var capability = createPromiseCapability();
  1395. this.callbacksCapabilities[callbackId] = capability;
  1396. try {
  1397. this.postMessage(message, transfers);
  1398. } catch (e) {
  1399. capability.reject(e);
  1400. }
  1401. return capability.promise;
  1402. },
  1403. postMessage: function (message, transfers) {
  1404. if (transfers && this.postMessageTransfers) {
  1405. this.comObj.postMessage(message, transfers);
  1406. } else {
  1407. this.comObj.postMessage(message);
  1408. }
  1409. },
  1410. destroy: function () {
  1411. this.comObj.removeEventListener('message', this._onComObjOnMessage);
  1412. }
  1413. };
  1414. function loadJpegStream(id, imageUrl, objs) {
  1415. var img = new Image();
  1416. img.onload = function loadJpegStream_onloadClosure() {
  1417. objs.resolve(id, img);
  1418. };
  1419. img.onerror = function loadJpegStream_onerrorClosure() {
  1420. objs.resolve(id, null);
  1421. warn('Error during JPEG image loading');
  1422. };
  1423. img.src = imageUrl;
  1424. }
  1425. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  1426. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  1427. exports.OPS = OPS;
  1428. exports.VERBOSITY_LEVELS = VERBOSITY_LEVELS;
  1429. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  1430. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  1431. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  1432. exports.AnnotationFlag = AnnotationFlag;
  1433. exports.AnnotationType = AnnotationType;
  1434. exports.FontType = FontType;
  1435. exports.ImageKind = ImageKind;
  1436. exports.CMapCompressionType = CMapCompressionType;
  1437. exports.InvalidPDFException = InvalidPDFException;
  1438. exports.MessageHandler = MessageHandler;
  1439. exports.MissingDataException = MissingDataException;
  1440. exports.MissingPDFException = MissingPDFException;
  1441. exports.NotImplementedException = NotImplementedException;
  1442. exports.PageViewport = PageViewport;
  1443. exports.PasswordException = PasswordException;
  1444. exports.PasswordResponses = PasswordResponses;
  1445. exports.StatTimer = StatTimer;
  1446. exports.StreamType = StreamType;
  1447. exports.TextRenderingMode = TextRenderingMode;
  1448. exports.UnexpectedResponseException = UnexpectedResponseException;
  1449. exports.UnknownErrorException = UnknownErrorException;
  1450. exports.Util = Util;
  1451. exports.XRefParseException = XRefParseException;
  1452. exports.arrayByteLength = arrayByteLength;
  1453. exports.arraysToBytes = arraysToBytes;
  1454. exports.assert = assert;
  1455. exports.bytesToString = bytesToString;
  1456. exports.createBlob = createBlob;
  1457. exports.createPromiseCapability = createPromiseCapability;
  1458. exports.createObjectURL = createObjectURL;
  1459. exports.deprecated = deprecated;
  1460. exports.error = error;
  1461. exports.getLookupTableFactory = getLookupTableFactory;
  1462. exports.getVerbosityLevel = getVerbosityLevel;
  1463. exports.globalScope = globalScope;
  1464. exports.info = info;
  1465. exports.isArray = isArray;
  1466. exports.isArrayBuffer = isArrayBuffer;
  1467. exports.isBool = isBool;
  1468. exports.isEmptyObj = isEmptyObj;
  1469. exports.isInt = isInt;
  1470. exports.isNum = isNum;
  1471. exports.isString = isString;
  1472. exports.isSpace = isSpace;
  1473. exports.isNodeJS = isNodeJS;
  1474. exports.isSameOrigin = isSameOrigin;
  1475. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  1476. exports.isLittleEndian = isLittleEndian;
  1477. exports.isEvalSupported = isEvalSupported;
  1478. exports.loadJpegStream = loadJpegStream;
  1479. exports.log2 = log2;
  1480. exports.readInt8 = readInt8;
  1481. exports.readUint16 = readUint16;
  1482. exports.readUint32 = readUint32;
  1483. exports.removeNullCharacters = removeNullCharacters;
  1484. exports.setVerbosityLevel = setVerbosityLevel;
  1485. exports.shadow = shadow;
  1486. exports.string32 = string32;
  1487. exports.stringToBytes = stringToBytes;
  1488. exports.stringToPDFString = stringToPDFString;
  1489. exports.stringToUTF8String = stringToUTF8String;
  1490. exports.utf8StringToString = utf8StringToString;
  1491. exports.warn = warn;
  1492. /* WEBPACK VAR INJECTION */}.call(exports, __w_pdfjs_require__(9)))
  1493. /***/ }),
  1494. /* 1 */
  1495. /***/ (function(module, exports, __w_pdfjs_require__) {
  1496. "use strict";
  1497. var sharedUtil = __w_pdfjs_require__(0);
  1498. var isArray = sharedUtil.isArray;
  1499. var EOF = {};
  1500. var Name = function NameClosure() {
  1501. function Name(name) {
  1502. this.name = name;
  1503. }
  1504. Name.prototype = {};
  1505. var nameCache = Object.create(null);
  1506. Name.get = function Name_get(name) {
  1507. var nameValue = nameCache[name];
  1508. return nameValue ? nameValue : nameCache[name] = new Name(name);
  1509. };
  1510. return Name;
  1511. }();
  1512. var Cmd = function CmdClosure() {
  1513. function Cmd(cmd) {
  1514. this.cmd = cmd;
  1515. }
  1516. Cmd.prototype = {};
  1517. var cmdCache = Object.create(null);
  1518. Cmd.get = function Cmd_get(cmd) {
  1519. var cmdValue = cmdCache[cmd];
  1520. return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd);
  1521. };
  1522. return Cmd;
  1523. }();
  1524. var Dict = function DictClosure() {
  1525. var nonSerializable = function nonSerializableClosure() {
  1526. return nonSerializable;
  1527. };
  1528. function Dict(xref) {
  1529. this.map = Object.create(null);
  1530. this.xref = xref;
  1531. this.objId = null;
  1532. this.suppressEncryption = false;
  1533. this.__nonSerializable__ = nonSerializable;
  1534. }
  1535. Dict.prototype = {
  1536. assignXref: function Dict_assignXref(newXref) {
  1537. this.xref = newXref;
  1538. },
  1539. get: function Dict_get(key1, key2, key3) {
  1540. var value;
  1541. var xref = this.xref, suppressEncryption = this.suppressEncryption;
  1542. if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map || typeof key2 === 'undefined') {
  1543. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  1544. }
  1545. if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map || typeof key3 === 'undefined') {
  1546. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  1547. }
  1548. value = this.map[key3] || null;
  1549. return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
  1550. },
  1551. getAsync: function Dict_getAsync(key1, key2, key3) {
  1552. var value;
  1553. var xref = this.xref, suppressEncryption = this.suppressEncryption;
  1554. if (typeof (value = this.map[key1]) !== 'undefined' || key1 in this.map || typeof key2 === 'undefined') {
  1555. if (xref) {
  1556. return xref.fetchIfRefAsync(value, suppressEncryption);
  1557. }
  1558. return Promise.resolve(value);
  1559. }
  1560. if (typeof (value = this.map[key2]) !== 'undefined' || key2 in this.map || typeof key3 === 'undefined') {
  1561. if (xref) {
  1562. return xref.fetchIfRefAsync(value, suppressEncryption);
  1563. }
  1564. return Promise.resolve(value);
  1565. }
  1566. value = this.map[key3] || null;
  1567. if (xref) {
  1568. return xref.fetchIfRefAsync(value, suppressEncryption);
  1569. }
  1570. return Promise.resolve(value);
  1571. },
  1572. getArray: function Dict_getArray(key1, key2, key3) {
  1573. var value = this.get(key1, key2, key3);
  1574. var xref = this.xref, suppressEncryption = this.suppressEncryption;
  1575. if (!isArray(value) || !xref) {
  1576. return value;
  1577. }
  1578. value = value.slice();
  1579. for (var i = 0, ii = value.length; i < ii; i++) {
  1580. if (!isRef(value[i])) {
  1581. continue;
  1582. }
  1583. value[i] = xref.fetch(value[i], suppressEncryption);
  1584. }
  1585. return value;
  1586. },
  1587. getRaw: function Dict_getRaw(key) {
  1588. return this.map[key];
  1589. },
  1590. getKeys: function Dict_getKeys() {
  1591. return Object.keys(this.map);
  1592. },
  1593. set: function Dict_set(key, value) {
  1594. this.map[key] = value;
  1595. },
  1596. has: function Dict_has(key) {
  1597. return key in this.map;
  1598. },
  1599. forEach: function Dict_forEach(callback) {
  1600. for (var key in this.map) {
  1601. callback(key, this.get(key));
  1602. }
  1603. }
  1604. };
  1605. Dict.empty = new Dict(null);
  1606. Dict.merge = function Dict_merge(xref, dictArray) {
  1607. var mergedDict = new Dict(xref);
  1608. for (var i = 0, ii = dictArray.length; i < ii; i++) {
  1609. var dict = dictArray[i];
  1610. if (!isDict(dict)) {
  1611. continue;
  1612. }
  1613. for (var keyName in dict.map) {
  1614. if (mergedDict.map[keyName]) {
  1615. continue;
  1616. }
  1617. mergedDict.map[keyName] = dict.map[keyName];
  1618. }
  1619. }
  1620. return mergedDict;
  1621. };
  1622. return Dict;
  1623. }();
  1624. var Ref = function RefClosure() {
  1625. function Ref(num, gen) {
  1626. this.num = num;
  1627. this.gen = gen;
  1628. }
  1629. Ref.prototype = {
  1630. toString: function Ref_toString() {
  1631. var str = this.num + 'R';
  1632. if (this.gen !== 0) {
  1633. str += this.gen;
  1634. }
  1635. return str;
  1636. }
  1637. };
  1638. return Ref;
  1639. }();
  1640. var RefSet = function RefSetClosure() {
  1641. function RefSet() {
  1642. this.dict = Object.create(null);
  1643. }
  1644. RefSet.prototype = {
  1645. has: function RefSet_has(ref) {
  1646. return ref.toString() in this.dict;
  1647. },
  1648. put: function RefSet_put(ref) {
  1649. this.dict[ref.toString()] = true;
  1650. },
  1651. remove: function RefSet_remove(ref) {
  1652. delete this.dict[ref.toString()];
  1653. }
  1654. };
  1655. return RefSet;
  1656. }();
  1657. var RefSetCache = function RefSetCacheClosure() {
  1658. function RefSetCache() {
  1659. this.dict = Object.create(null);
  1660. }
  1661. RefSetCache.prototype = {
  1662. get: function RefSetCache_get(ref) {
  1663. return this.dict[ref.toString()];
  1664. },
  1665. has: function RefSetCache_has(ref) {
  1666. return ref.toString() in this.dict;
  1667. },
  1668. put: function RefSetCache_put(ref, obj) {
  1669. this.dict[ref.toString()] = obj;
  1670. },
  1671. putAlias: function RefSetCache_putAlias(ref, aliasRef) {
  1672. this.dict[ref.toString()] = this.get(aliasRef);
  1673. },
  1674. forEach: function RefSetCache_forEach(fn, thisArg) {
  1675. for (var i in this.dict) {
  1676. fn.call(thisArg, this.dict[i]);
  1677. }
  1678. },
  1679. clear: function RefSetCache_clear() {
  1680. this.dict = Object.create(null);
  1681. }
  1682. };
  1683. return RefSetCache;
  1684. }();
  1685. function isEOF(v) {
  1686. return v === EOF;
  1687. }
  1688. function isName(v, name) {
  1689. return v instanceof Name && (name === undefined || v.name === name);
  1690. }
  1691. function isCmd(v, cmd) {
  1692. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  1693. }
  1694. function isDict(v, type) {
  1695. return v instanceof Dict && (type === undefined || isName(v.get('Type'), type));
  1696. }
  1697. function isRef(v) {
  1698. return v instanceof Ref;
  1699. }
  1700. function isRefsEqual(v1, v2) {
  1701. return v1.num === v2.num && v1.gen === v2.gen;
  1702. }
  1703. function isStream(v) {
  1704. return typeof v === 'object' && v !== null && v.getBytes !== undefined;
  1705. }
  1706. exports.EOF = EOF;
  1707. exports.Cmd = Cmd;
  1708. exports.Dict = Dict;
  1709. exports.Name = Name;
  1710. exports.Ref = Ref;
  1711. exports.RefSet = RefSet;
  1712. exports.RefSetCache = RefSetCache;
  1713. exports.isEOF = isEOF;
  1714. exports.isCmd = isCmd;
  1715. exports.isDict = isDict;
  1716. exports.isName = isName;
  1717. exports.isRef = isRef;
  1718. exports.isRefsEqual = isRefsEqual;
  1719. exports.isStream = isStream;
  1720. /***/ }),
  1721. /* 2 */
  1722. /***/ (function(module, exports, __w_pdfjs_require__) {
  1723. "use strict";
  1724. var sharedUtil = __w_pdfjs_require__(0);
  1725. var corePrimitives = __w_pdfjs_require__(1);
  1726. var coreJbig2 = __w_pdfjs_require__(28);
  1727. var coreJpg = __w_pdfjs_require__(29);
  1728. var coreJpx = __w_pdfjs_require__(15);
  1729. var Util = sharedUtil.Util;
  1730. var error = sharedUtil.error;
  1731. var info = sharedUtil.info;
  1732. var isInt = sharedUtil.isInt;
  1733. var isArray = sharedUtil.isArray;
  1734. var createObjectURL = sharedUtil.createObjectURL;
  1735. var shadow = sharedUtil.shadow;
  1736. var isSpace = sharedUtil.isSpace;
  1737. var Dict = corePrimitives.Dict;
  1738. var isDict = corePrimitives.isDict;
  1739. var isStream = corePrimitives.isStream;
  1740. var Jbig2Image = coreJbig2.Jbig2Image;
  1741. var JpegImage = coreJpg.JpegImage;
  1742. var JpxImage = coreJpx.JpxImage;
  1743. var Stream = function StreamClosure() {
  1744. function Stream(arrayBuffer, start, length, dict) {
  1745. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  1746. this.start = start || 0;
  1747. this.pos = this.start;
  1748. this.end = start + length || this.bytes.length;
  1749. this.dict = dict;
  1750. }
  1751. Stream.prototype = {
  1752. get length() {
  1753. return this.end - this.start;
  1754. },
  1755. get isEmpty() {
  1756. return this.length === 0;
  1757. },
  1758. getByte: function Stream_getByte() {
  1759. if (this.pos >= this.end) {
  1760. return -1;
  1761. }
  1762. return this.bytes[this.pos++];
  1763. },
  1764. getUint16: function Stream_getUint16() {
  1765. var b0 = this.getByte();
  1766. var b1 = this.getByte();
  1767. if (b0 === -1 || b1 === -1) {
  1768. return -1;
  1769. }
  1770. return (b0 << 8) + b1;
  1771. },
  1772. getInt32: function Stream_getInt32() {
  1773. var b0 = this.getByte();
  1774. var b1 = this.getByte();
  1775. var b2 = this.getByte();
  1776. var b3 = this.getByte();
  1777. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  1778. },
  1779. getBytes: function Stream_getBytes(length) {
  1780. var bytes = this.bytes;
  1781. var pos = this.pos;
  1782. var strEnd = this.end;
  1783. if (!length) {
  1784. return bytes.subarray(pos, strEnd);
  1785. }
  1786. var end = pos + length;
  1787. if (end > strEnd) {
  1788. end = strEnd;
  1789. }
  1790. this.pos = end;
  1791. return bytes.subarray(pos, end);
  1792. },
  1793. peekByte: function Stream_peekByte() {
  1794. var peekedByte = this.getByte();
  1795. this.pos--;
  1796. return peekedByte;
  1797. },
  1798. peekBytes: function Stream_peekBytes(length) {
  1799. var bytes = this.getBytes(length);
  1800. this.pos -= bytes.length;
  1801. return bytes;
  1802. },
  1803. skip: function Stream_skip(n) {
  1804. if (!n) {
  1805. n = 1;
  1806. }
  1807. this.pos += n;
  1808. },
  1809. reset: function Stream_reset() {
  1810. this.pos = this.start;
  1811. },
  1812. moveStart: function Stream_moveStart() {
  1813. this.start = this.pos;
  1814. },
  1815. makeSubStream: function Stream_makeSubStream(start, length, dict) {
  1816. return new Stream(this.bytes.buffer, start, length, dict);
  1817. }
  1818. };
  1819. return Stream;
  1820. }();
  1821. var StringStream = function StringStreamClosure() {
  1822. function StringStream(str) {
  1823. var length = str.length;
  1824. var bytes = new Uint8Array(length);
  1825. for (var n = 0; n < length; ++n) {
  1826. bytes[n] = str.charCodeAt(n);
  1827. }
  1828. Stream.call(this, bytes);
  1829. }
  1830. StringStream.prototype = Stream.prototype;
  1831. return StringStream;
  1832. }();
  1833. var DecodeStream = function DecodeStreamClosure() {
  1834. var emptyBuffer = new Uint8Array(0);
  1835. function DecodeStream(maybeMinBufferLength) {
  1836. this.pos = 0;
  1837. this.bufferLength = 0;
  1838. this.eof = false;
  1839. this.buffer = emptyBuffer;
  1840. this.minBufferLength = 512;
  1841. if (maybeMinBufferLength) {
  1842. while (this.minBufferLength < maybeMinBufferLength) {
  1843. this.minBufferLength *= 2;
  1844. }
  1845. }
  1846. }
  1847. DecodeStream.prototype = {
  1848. get isEmpty() {
  1849. while (!this.eof && this.bufferLength === 0) {
  1850. this.readBlock();
  1851. }
  1852. return this.bufferLength === 0;
  1853. },
  1854. ensureBuffer: function DecodeStream_ensureBuffer(requested) {
  1855. var buffer = this.buffer;
  1856. if (requested <= buffer.byteLength) {
  1857. return buffer;
  1858. }
  1859. var size = this.minBufferLength;
  1860. while (size < requested) {
  1861. size *= 2;
  1862. }
  1863. var buffer2 = new Uint8Array(size);
  1864. buffer2.set(buffer);
  1865. return this.buffer = buffer2;
  1866. },
  1867. getByte: function DecodeStream_getByte() {
  1868. var pos = this.pos;
  1869. while (this.bufferLength <= pos) {
  1870. if (this.eof) {
  1871. return -1;
  1872. }
  1873. this.readBlock();
  1874. }
  1875. return this.buffer[this.pos++];
  1876. },
  1877. getUint16: function DecodeStream_getUint16() {
  1878. var b0 = this.getByte();
  1879. var b1 = this.getByte();
  1880. if (b0 === -1 || b1 === -1) {
  1881. return -1;
  1882. }
  1883. return (b0 << 8) + b1;
  1884. },
  1885. getInt32: function DecodeStream_getInt32() {
  1886. var b0 = this.getByte();
  1887. var b1 = this.getByte();
  1888. var b2 = this.getByte();
  1889. var b3 = this.getByte();
  1890. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  1891. },
  1892. getBytes: function DecodeStream_getBytes(length) {
  1893. var end, pos = this.pos;
  1894. if (length) {
  1895. this.ensureBuffer(pos + length);
  1896. end = pos + length;
  1897. while (!this.eof && this.bufferLength < end) {
  1898. this.readBlock();
  1899. }
  1900. var bufEnd = this.bufferLength;
  1901. if (end > bufEnd) {
  1902. end = bufEnd;
  1903. }
  1904. } else {
  1905. while (!this.eof) {
  1906. this.readBlock();
  1907. }
  1908. end = this.bufferLength;
  1909. }
  1910. this.pos = end;
  1911. return this.buffer.subarray(pos, end);
  1912. },
  1913. peekByte: function DecodeStream_peekByte() {
  1914. var peekedByte = this.getByte();
  1915. this.pos--;
  1916. return peekedByte;
  1917. },
  1918. peekBytes: function DecodeStream_peekBytes(length) {
  1919. var bytes = this.getBytes(length);
  1920. this.pos -= bytes.length;
  1921. return bytes;
  1922. },
  1923. makeSubStream: function DecodeStream_makeSubStream(start, length, dict) {
  1924. var end = start + length;
  1925. while (this.bufferLength <= end && !this.eof) {
  1926. this.readBlock();
  1927. }
  1928. return new Stream(this.buffer, start, length, dict);
  1929. },
  1930. skip: function DecodeStream_skip(n) {
  1931. if (!n) {
  1932. n = 1;
  1933. }
  1934. this.pos += n;
  1935. },
  1936. reset: function DecodeStream_reset() {
  1937. this.pos = 0;
  1938. },
  1939. getBaseStreams: function DecodeStream_getBaseStreams() {
  1940. if (this.str && this.str.getBaseStreams) {
  1941. return this.str.getBaseStreams();
  1942. }
  1943. return [];
  1944. }
  1945. };
  1946. return DecodeStream;
  1947. }();
  1948. var StreamsSequenceStream = function StreamsSequenceStreamClosure() {
  1949. function StreamsSequenceStream(streams) {
  1950. this.streams = streams;
  1951. DecodeStream.call(this, null);
  1952. }
  1953. StreamsSequenceStream.prototype = Object.create(DecodeStream.prototype);
  1954. StreamsSequenceStream.prototype.readBlock = function streamSequenceStreamReadBlock() {
  1955. var streams = this.streams;
  1956. if (streams.length === 0) {
  1957. this.eof = true;
  1958. return;
  1959. }
  1960. var stream = streams.shift();
  1961. var chunk = stream.getBytes();
  1962. var bufferLength = this.bufferLength;
  1963. var newLength = bufferLength + chunk.length;
  1964. var buffer = this.ensureBuffer(newLength);
  1965. buffer.set(chunk, bufferLength);
  1966. this.bufferLength = newLength;
  1967. };
  1968. StreamsSequenceStream.prototype.getBaseStreams = function StreamsSequenceStream_getBaseStreams() {
  1969. var baseStreams = [];
  1970. for (var i = 0, ii = this.streams.length; i < ii; i++) {
  1971. var stream = this.streams[i];
  1972. if (stream.getBaseStreams) {
  1973. Util.appendToArray(baseStreams, stream.getBaseStreams());
  1974. }
  1975. }
  1976. return baseStreams;
  1977. };
  1978. return StreamsSequenceStream;
  1979. }();
  1980. var FlateStream = function FlateStreamClosure() {
  1981. var codeLenCodeMap = new Int32Array([
  1982. 16,
  1983. 17,
  1984. 18,
  1985. 0,
  1986. 8,
  1987. 7,
  1988. 9,
  1989. 6,
  1990. 10,
  1991. 5,
  1992. 11,
  1993. 4,
  1994. 12,
  1995. 3,
  1996. 13,
  1997. 2,
  1998. 14,
  1999. 1,
  2000. 15
  2001. ]);
  2002. var lengthDecode = new Int32Array([
  2003. 0x00003,
  2004. 0x00004,
  2005. 0x00005,
  2006. 0x00006,
  2007. 0x00007,
  2008. 0x00008,
  2009. 0x00009,
  2010. 0x0000a,
  2011. 0x1000b,
  2012. 0x1000d,
  2013. 0x1000f,
  2014. 0x10011,
  2015. 0x20013,
  2016. 0x20017,
  2017. 0x2001b,
  2018. 0x2001f,
  2019. 0x30023,
  2020. 0x3002b,
  2021. 0x30033,
  2022. 0x3003b,
  2023. 0x40043,
  2024. 0x40053,
  2025. 0x40063,
  2026. 0x40073,
  2027. 0x50083,
  2028. 0x500a3,
  2029. 0x500c3,
  2030. 0x500e3,
  2031. 0x00102,
  2032. 0x00102,
  2033. 0x00102
  2034. ]);
  2035. var distDecode = new Int32Array([
  2036. 0x00001,
  2037. 0x00002,
  2038. 0x00003,
  2039. 0x00004,
  2040. 0x10005,
  2041. 0x10007,
  2042. 0x20009,
  2043. 0x2000d,
  2044. 0x30011,
  2045. 0x30019,
  2046. 0x40021,
  2047. 0x40031,
  2048. 0x50041,
  2049. 0x50061,
  2050. 0x60081,
  2051. 0x600c1,
  2052. 0x70101,
  2053. 0x70181,
  2054. 0x80201,
  2055. 0x80301,
  2056. 0x90401,
  2057. 0x90601,
  2058. 0xa0801,
  2059. 0xa0c01,
  2060. 0xb1001,
  2061. 0xb1801,
  2062. 0xc2001,
  2063. 0xc3001,
  2064. 0xd4001,
  2065. 0xd6001
  2066. ]);
  2067. var fixedLitCodeTab = [
  2068. new Int32Array([
  2069. 0x70100,
  2070. 0x80050,
  2071. 0x80010,
  2072. 0x80118,
  2073. 0x70110,
  2074. 0x80070,
  2075. 0x80030,
  2076. 0x900c0,
  2077. 0x70108,
  2078. 0x80060,
  2079. 0x80020,
  2080. 0x900a0,
  2081. 0x80000,
  2082. 0x80080,
  2083. 0x80040,
  2084. 0x900e0,
  2085. 0x70104,
  2086. 0x80058,
  2087. 0x80018,
  2088. 0x90090,
  2089. 0x70114,
  2090. 0x80078,
  2091. 0x80038,
  2092. 0x900d0,
  2093. 0x7010c,
  2094. 0x80068,
  2095. 0x80028,
  2096. 0x900b0,
  2097. 0x80008,
  2098. 0x80088,
  2099. 0x80048,
  2100. 0x900f0,
  2101. 0x70102,
  2102. 0x80054,
  2103. 0x80014,
  2104. 0x8011c,
  2105. 0x70112,
  2106. 0x80074,
  2107. 0x80034,
  2108. 0x900c8,
  2109. 0x7010a,
  2110. 0x80064,
  2111. 0x80024,
  2112. 0x900a8,
  2113. 0x80004,
  2114. 0x80084,
  2115. 0x80044,
  2116. 0x900e8,
  2117. 0x70106,
  2118. 0x8005c,
  2119. 0x8001c,
  2120. 0x90098,
  2121. 0x70116,
  2122. 0x8007c,
  2123. 0x8003c,
  2124. 0x900d8,
  2125. 0x7010e,
  2126. 0x8006c,
  2127. 0x8002c,
  2128. 0x900b8,
  2129. 0x8000c,
  2130. 0x8008c,
  2131. 0x8004c,
  2132. 0x900f8,
  2133. 0x70101,
  2134. 0x80052,
  2135. 0x80012,
  2136. 0x8011a,
  2137. 0x70111,
  2138. 0x80072,
  2139. 0x80032,
  2140. 0x900c4,
  2141. 0x70109,
  2142. 0x80062,
  2143. 0x80022,
  2144. 0x900a4,
  2145. 0x80002,
  2146. 0x80082,
  2147. 0x80042,
  2148. 0x900e4,
  2149. 0x70105,
  2150. 0x8005a,
  2151. 0x8001a,
  2152. 0x90094,
  2153. 0x70115,
  2154. 0x8007a,
  2155. 0x8003a,
  2156. 0x900d4,
  2157. 0x7010d,
  2158. 0x8006a,
  2159. 0x8002a,
  2160. 0x900b4,
  2161. 0x8000a,
  2162. 0x8008a,
  2163. 0x8004a,
  2164. 0x900f4,
  2165. 0x70103,
  2166. 0x80056,
  2167. 0x80016,
  2168. 0x8011e,
  2169. 0x70113,
  2170. 0x80076,
  2171. 0x80036,
  2172. 0x900cc,
  2173. 0x7010b,
  2174. 0x80066,
  2175. 0x80026,
  2176. 0x900ac,
  2177. 0x80006,
  2178. 0x80086,
  2179. 0x80046,
  2180. 0x900ec,
  2181. 0x70107,
  2182. 0x8005e,
  2183. 0x8001e,
  2184. 0x9009c,
  2185. 0x70117,
  2186. 0x8007e,
  2187. 0x8003e,
  2188. 0x900dc,
  2189. 0x7010f,
  2190. 0x8006e,
  2191. 0x8002e,
  2192. 0x900bc,
  2193. 0x8000e,
  2194. 0x8008e,
  2195. 0x8004e,
  2196. 0x900fc,
  2197. 0x70100,
  2198. 0x80051,
  2199. 0x80011,
  2200. 0x80119,
  2201. 0x70110,
  2202. 0x80071,
  2203. 0x80031,
  2204. 0x900c2,
  2205. 0x70108,
  2206. 0x80061,
  2207. 0x80021,
  2208. 0x900a2,
  2209. 0x80001,
  2210. 0x80081,
  2211. 0x80041,
  2212. 0x900e2,
  2213. 0x70104,
  2214. 0x80059,
  2215. 0x80019,
  2216. 0x90092,
  2217. 0x70114,
  2218. 0x80079,
  2219. 0x80039,
  2220. 0x900d2,
  2221. 0x7010c,
  2222. 0x80069,
  2223. 0x80029,
  2224. 0x900b2,
  2225. 0x80009,
  2226. 0x80089,
  2227. 0x80049,
  2228. 0x900f2,
  2229. 0x70102,
  2230. 0x80055,
  2231. 0x80015,
  2232. 0x8011d,
  2233. 0x70112,
  2234. 0x80075,
  2235. 0x80035,
  2236. 0x900ca,
  2237. 0x7010a,
  2238. 0x80065,
  2239. 0x80025,
  2240. 0x900aa,
  2241. 0x80005,
  2242. 0x80085,
  2243. 0x80045,
  2244. 0x900ea,
  2245. 0x70106,
  2246. 0x8005d,
  2247. 0x8001d,
  2248. 0x9009a,
  2249. 0x70116,
  2250. 0x8007d,
  2251. 0x8003d,
  2252. 0x900da,
  2253. 0x7010e,
  2254. 0x8006d,
  2255. 0x8002d,
  2256. 0x900ba,
  2257. 0x8000d,
  2258. 0x8008d,
  2259. 0x8004d,
  2260. 0x900fa,
  2261. 0x70101,
  2262. 0x80053,
  2263. 0x80013,
  2264. 0x8011b,
  2265. 0x70111,
  2266. 0x80073,
  2267. 0x80033,
  2268. 0x900c6,
  2269. 0x70109,
  2270. 0x80063,
  2271. 0x80023,
  2272. 0x900a6,
  2273. 0x80003,
  2274. 0x80083,
  2275. 0x80043,
  2276. 0x900e6,
  2277. 0x70105,
  2278. 0x8005b,
  2279. 0x8001b,
  2280. 0x90096,
  2281. 0x70115,
  2282. 0x8007b,
  2283. 0x8003b,
  2284. 0x900d6,
  2285. 0x7010d,
  2286. 0x8006b,
  2287. 0x8002b,
  2288. 0x900b6,
  2289. 0x8000b,
  2290. 0x8008b,
  2291. 0x8004b,
  2292. 0x900f6,
  2293. 0x70103,
  2294. 0x80057,
  2295. 0x80017,
  2296. 0x8011f,
  2297. 0x70113,
  2298. 0x80077,
  2299. 0x80037,
  2300. 0x900ce,
  2301. 0x7010b,
  2302. 0x80067,
  2303. 0x80027,
  2304. 0x900ae,
  2305. 0x80007,
  2306. 0x80087,
  2307. 0x80047,
  2308. 0x900ee,
  2309. 0x70107,
  2310. 0x8005f,
  2311. 0x8001f,
  2312. 0x9009e,
  2313. 0x70117,
  2314. 0x8007f,
  2315. 0x8003f,
  2316. 0x900de,
  2317. 0x7010f,
  2318. 0x8006f,
  2319. 0x8002f,
  2320. 0x900be,
  2321. 0x8000f,
  2322. 0x8008f,
  2323. 0x8004f,
  2324. 0x900fe,
  2325. 0x70100,
  2326. 0x80050,
  2327. 0x80010,
  2328. 0x80118,
  2329. 0x70110,
  2330. 0x80070,
  2331. 0x80030,
  2332. 0x900c1,
  2333. 0x70108,
  2334. 0x80060,
  2335. 0x80020,
  2336. 0x900a1,
  2337. 0x80000,
  2338. 0x80080,
  2339. 0x80040,
  2340. 0x900e1,
  2341. 0x70104,
  2342. 0x80058,
  2343. 0x80018,
  2344. 0x90091,
  2345. 0x70114,
  2346. 0x80078,
  2347. 0x80038,
  2348. 0x900d1,
  2349. 0x7010c,
  2350. 0x80068,
  2351. 0x80028,
  2352. 0x900b1,
  2353. 0x80008,
  2354. 0x80088,
  2355. 0x80048,
  2356. 0x900f1,
  2357. 0x70102,
  2358. 0x80054,
  2359. 0x80014,
  2360. 0x8011c,
  2361. 0x70112,
  2362. 0x80074,
  2363. 0x80034,
  2364. 0x900c9,
  2365. 0x7010a,
  2366. 0x80064,
  2367. 0x80024,
  2368. 0x900a9,
  2369. 0x80004,
  2370. 0x80084,
  2371. 0x80044,
  2372. 0x900e9,
  2373. 0x70106,
  2374. 0x8005c,
  2375. 0x8001c,
  2376. 0x90099,
  2377. 0x70116,
  2378. 0x8007c,
  2379. 0x8003c,
  2380. 0x900d9,
  2381. 0x7010e,
  2382. 0x8006c,
  2383. 0x8002c,
  2384. 0x900b9,
  2385. 0x8000c,
  2386. 0x8008c,
  2387. 0x8004c,
  2388. 0x900f9,
  2389. 0x70101,
  2390. 0x80052,
  2391. 0x80012,
  2392. 0x8011a,
  2393. 0x70111,
  2394. 0x80072,
  2395. 0x80032,
  2396. 0x900c5,
  2397. 0x70109,
  2398. 0x80062,
  2399. 0x80022,
  2400. 0x900a5,
  2401. 0x80002,
  2402. 0x80082,
  2403. 0x80042,
  2404. 0x900e5,
  2405. 0x70105,
  2406. 0x8005a,
  2407. 0x8001a,
  2408. 0x90095,
  2409. 0x70115,
  2410. 0x8007a,
  2411. 0x8003a,
  2412. 0x900d5,
  2413. 0x7010d,
  2414. 0x8006a,
  2415. 0x8002a,
  2416. 0x900b5,
  2417. 0x8000a,
  2418. 0x8008a,
  2419. 0x8004a,
  2420. 0x900f5,
  2421. 0x70103,
  2422. 0x80056,
  2423. 0x80016,
  2424. 0x8011e,
  2425. 0x70113,
  2426. 0x80076,
  2427. 0x80036,
  2428. 0x900cd,
  2429. 0x7010b,
  2430. 0x80066,
  2431. 0x80026,
  2432. 0x900ad,
  2433. 0x80006,
  2434. 0x80086,
  2435. 0x80046,
  2436. 0x900ed,
  2437. 0x70107,
  2438. 0x8005e,
  2439. 0x8001e,
  2440. 0x9009d,
  2441. 0x70117,
  2442. 0x8007e,
  2443. 0x8003e,
  2444. 0x900dd,
  2445. 0x7010f,
  2446. 0x8006e,
  2447. 0x8002e,
  2448. 0x900bd,
  2449. 0x8000e,
  2450. 0x8008e,
  2451. 0x8004e,
  2452. 0x900fd,
  2453. 0x70100,
  2454. 0x80051,
  2455. 0x80011,
  2456. 0x80119,
  2457. 0x70110,
  2458. 0x80071,
  2459. 0x80031,
  2460. 0x900c3,
  2461. 0x70108,
  2462. 0x80061,
  2463. 0x80021,
  2464. 0x900a3,
  2465. 0x80001,
  2466. 0x80081,
  2467. 0x80041,
  2468. 0x900e3,
  2469. 0x70104,
  2470. 0x80059,
  2471. 0x80019,
  2472. 0x90093,
  2473. 0x70114,
  2474. 0x80079,
  2475. 0x80039,
  2476. 0x900d3,
  2477. 0x7010c,
  2478. 0x80069,
  2479. 0x80029,
  2480. 0x900b3,
  2481. 0x80009,
  2482. 0x80089,
  2483. 0x80049,
  2484. 0x900f3,
  2485. 0x70102,
  2486. 0x80055,
  2487. 0x80015,
  2488. 0x8011d,
  2489. 0x70112,
  2490. 0x80075,
  2491. 0x80035,
  2492. 0x900cb,
  2493. 0x7010a,
  2494. 0x80065,
  2495. 0x80025,
  2496. 0x900ab,
  2497. 0x80005,
  2498. 0x80085,
  2499. 0x80045,
  2500. 0x900eb,
  2501. 0x70106,
  2502. 0x8005d,
  2503. 0x8001d,
  2504. 0x9009b,
  2505. 0x70116,
  2506. 0x8007d,
  2507. 0x8003d,
  2508. 0x900db,
  2509. 0x7010e,
  2510. 0x8006d,
  2511. 0x8002d,
  2512. 0x900bb,
  2513. 0x8000d,
  2514. 0x8008d,
  2515. 0x8004d,
  2516. 0x900fb,
  2517. 0x70101,
  2518. 0x80053,
  2519. 0x80013,
  2520. 0x8011b,
  2521. 0x70111,
  2522. 0x80073,
  2523. 0x80033,
  2524. 0x900c7,
  2525. 0x70109,
  2526. 0x80063,
  2527. 0x80023,
  2528. 0x900a7,
  2529. 0x80003,
  2530. 0x80083,
  2531. 0x80043,
  2532. 0x900e7,
  2533. 0x70105,
  2534. 0x8005b,
  2535. 0x8001b,
  2536. 0x90097,
  2537. 0x70115,
  2538. 0x8007b,
  2539. 0x8003b,
  2540. 0x900d7,
  2541. 0x7010d,
  2542. 0x8006b,
  2543. 0x8002b,
  2544. 0x900b7,
  2545. 0x8000b,
  2546. 0x8008b,
  2547. 0x8004b,
  2548. 0x900f7,
  2549. 0x70103,
  2550. 0x80057,
  2551. 0x80017,
  2552. 0x8011f,
  2553. 0x70113,
  2554. 0x80077,
  2555. 0x80037,
  2556. 0x900cf,
  2557. 0x7010b,
  2558. 0x80067,
  2559. 0x80027,
  2560. 0x900af,
  2561. 0x80007,
  2562. 0x80087,
  2563. 0x80047,
  2564. 0x900ef,
  2565. 0x70107,
  2566. 0x8005f,
  2567. 0x8001f,
  2568. 0x9009f,
  2569. 0x70117,
  2570. 0x8007f,
  2571. 0x8003f,
  2572. 0x900df,
  2573. 0x7010f,
  2574. 0x8006f,
  2575. 0x8002f,
  2576. 0x900bf,
  2577. 0x8000f,
  2578. 0x8008f,
  2579. 0x8004f,
  2580. 0x900ff
  2581. ]),
  2582. 9
  2583. ];
  2584. var fixedDistCodeTab = [
  2585. new Int32Array([
  2586. 0x50000,
  2587. 0x50010,
  2588. 0x50008,
  2589. 0x50018,
  2590. 0x50004,
  2591. 0x50014,
  2592. 0x5000c,
  2593. 0x5001c,
  2594. 0x50002,
  2595. 0x50012,
  2596. 0x5000a,
  2597. 0x5001a,
  2598. 0x50006,
  2599. 0x50016,
  2600. 0x5000e,
  2601. 0x00000,
  2602. 0x50001,
  2603. 0x50011,
  2604. 0x50009,
  2605. 0x50019,
  2606. 0x50005,
  2607. 0x50015,
  2608. 0x5000d,
  2609. 0x5001d,
  2610. 0x50003,
  2611. 0x50013,
  2612. 0x5000b,
  2613. 0x5001b,
  2614. 0x50007,
  2615. 0x50017,
  2616. 0x5000f,
  2617. 0x00000
  2618. ]),
  2619. 5
  2620. ];
  2621. function FlateStream(str, maybeLength) {
  2622. this.str = str;
  2623. this.dict = str.dict;
  2624. var cmf = str.getByte();
  2625. var flg = str.getByte();
  2626. if (cmf === -1 || flg === -1) {
  2627. error('Invalid header in flate stream: ' + cmf + ', ' + flg);
  2628. }
  2629. if ((cmf & 0x0f) !== 0x08) {
  2630. error('Unknown compression method in flate stream: ' + cmf + ', ' + flg);
  2631. }
  2632. if (((cmf << 8) + flg) % 31 !== 0) {
  2633. error('Bad FCHECK in flate stream: ' + cmf + ', ' + flg);
  2634. }
  2635. if (flg & 0x20) {
  2636. error('FDICT bit set in flate stream: ' + cmf + ', ' + flg);
  2637. }
  2638. this.codeSize = 0;
  2639. this.codeBuf = 0;
  2640. DecodeStream.call(this, maybeLength);
  2641. }
  2642. FlateStream.prototype = Object.create(DecodeStream.prototype);
  2643. FlateStream.prototype.getBits = function FlateStream_getBits(bits) {
  2644. var str = this.str;
  2645. var codeSize = this.codeSize;
  2646. var codeBuf = this.codeBuf;
  2647. var b;
  2648. while (codeSize < bits) {
  2649. if ((b = str.getByte()) === -1) {
  2650. error('Bad encoding in flate stream');
  2651. }
  2652. codeBuf |= b << codeSize;
  2653. codeSize += 8;
  2654. }
  2655. b = codeBuf & (1 << bits) - 1;
  2656. this.codeBuf = codeBuf >> bits;
  2657. this.codeSize = codeSize -= bits;
  2658. return b;
  2659. };
  2660. FlateStream.prototype.getCode = function FlateStream_getCode(table) {
  2661. var str = this.str;
  2662. var codes = table[0];
  2663. var maxLen = table[1];
  2664. var codeSize = this.codeSize;
  2665. var codeBuf = this.codeBuf;
  2666. var b;
  2667. while (codeSize < maxLen) {
  2668. if ((b = str.getByte()) === -1) {
  2669. break;
  2670. }
  2671. codeBuf |= b << codeSize;
  2672. codeSize += 8;
  2673. }
  2674. var code = codes[codeBuf & (1 << maxLen) - 1];
  2675. var codeLen = code >> 16;
  2676. var codeVal = code & 0xffff;
  2677. if (codeLen < 1 || codeSize < codeLen) {
  2678. error('Bad encoding in flate stream');
  2679. }
  2680. this.codeBuf = codeBuf >> codeLen;
  2681. this.codeSize = codeSize - codeLen;
  2682. return codeVal;
  2683. };
  2684. FlateStream.prototype.generateHuffmanTable = function flateStreamGenerateHuffmanTable(lengths) {
  2685. var n = lengths.length;
  2686. var maxLen = 0;
  2687. var i;
  2688. for (i = 0; i < n; ++i) {
  2689. if (lengths[i] > maxLen) {
  2690. maxLen = lengths[i];
  2691. }
  2692. }
  2693. var size = 1 << maxLen;
  2694. var codes = new Int32Array(size);
  2695. for (var len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  2696. for (var val = 0; val < n; ++val) {
  2697. if (lengths[val] === len) {
  2698. var code2 = 0;
  2699. var t = code;
  2700. for (i = 0; i < len; ++i) {
  2701. code2 = code2 << 1 | t & 1;
  2702. t >>= 1;
  2703. }
  2704. for (i = code2; i < size; i += skip) {
  2705. codes[i] = len << 16 | val;
  2706. }
  2707. ++code;
  2708. }
  2709. }
  2710. }
  2711. return [
  2712. codes,
  2713. maxLen
  2714. ];
  2715. };
  2716. FlateStream.prototype.readBlock = function FlateStream_readBlock() {
  2717. var buffer, len;
  2718. var str = this.str;
  2719. var hdr = this.getBits(3);
  2720. if (hdr & 1) {
  2721. this.eof = true;
  2722. }
  2723. hdr >>= 1;
  2724. if (hdr === 0) {
  2725. var b;
  2726. if ((b = str.getByte()) === -1) {
  2727. error('Bad block header in flate stream');
  2728. }
  2729. var blockLen = b;
  2730. if ((b = str.getByte()) === -1) {
  2731. error('Bad block header in flate stream');
  2732. }
  2733. blockLen |= b << 8;
  2734. if ((b = str.getByte()) === -1) {
  2735. error('Bad block header in flate stream');
  2736. }
  2737. var check = b;
  2738. if ((b = str.getByte()) === -1) {
  2739. error('Bad block header in flate stream');
  2740. }
  2741. check |= b << 8;
  2742. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  2743. error('Bad uncompressed block length in flate stream');
  2744. }
  2745. this.codeBuf = 0;
  2746. this.codeSize = 0;
  2747. var bufferLength = this.bufferLength;
  2748. buffer = this.ensureBuffer(bufferLength + blockLen);
  2749. var end = bufferLength + blockLen;
  2750. this.bufferLength = end;
  2751. if (blockLen === 0) {
  2752. if (str.peekByte() === -1) {
  2753. this.eof = true;
  2754. }
  2755. } else {
  2756. for (var n = bufferLength; n < end; ++n) {
  2757. if ((b = str.getByte()) === -1) {
  2758. this.eof = true;
  2759. break;
  2760. }
  2761. buffer[n] = b;
  2762. }
  2763. }
  2764. return;
  2765. }
  2766. var litCodeTable;
  2767. var distCodeTable;
  2768. if (hdr === 1) {
  2769. litCodeTable = fixedLitCodeTab;
  2770. distCodeTable = fixedDistCodeTab;
  2771. } else if (hdr === 2) {
  2772. var numLitCodes = this.getBits(5) + 257;
  2773. var numDistCodes = this.getBits(5) + 1;
  2774. var numCodeLenCodes = this.getBits(4) + 4;
  2775. var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  2776. var i;
  2777. for (i = 0; i < numCodeLenCodes; ++i) {
  2778. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  2779. }
  2780. var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  2781. len = 0;
  2782. i = 0;
  2783. var codes = numLitCodes + numDistCodes;
  2784. var codeLengths = new Uint8Array(codes);
  2785. var bitsLength, bitsOffset, what;
  2786. while (i < codes) {
  2787. var code = this.getCode(codeLenCodeTab);
  2788. if (code === 16) {
  2789. bitsLength = 2;
  2790. bitsOffset = 3;
  2791. what = len;
  2792. } else if (code === 17) {
  2793. bitsLength = 3;
  2794. bitsOffset = 3;
  2795. what = len = 0;
  2796. } else if (code === 18) {
  2797. bitsLength = 7;
  2798. bitsOffset = 11;
  2799. what = len = 0;
  2800. } else {
  2801. codeLengths[i++] = len = code;
  2802. continue;
  2803. }
  2804. var repeatLength = this.getBits(bitsLength) + bitsOffset;
  2805. while (repeatLength-- > 0) {
  2806. codeLengths[i++] = what;
  2807. }
  2808. }
  2809. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  2810. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  2811. } else {
  2812. error('Unknown block type in flate stream');
  2813. }
  2814. buffer = this.buffer;
  2815. var limit = buffer ? buffer.length : 0;
  2816. var pos = this.bufferLength;
  2817. while (true) {
  2818. var code1 = this.getCode(litCodeTable);
  2819. if (code1 < 256) {
  2820. if (pos + 1 >= limit) {
  2821. buffer = this.ensureBuffer(pos + 1);
  2822. limit = buffer.length;
  2823. }
  2824. buffer[pos++] = code1;
  2825. continue;
  2826. }
  2827. if (code1 === 256) {
  2828. this.bufferLength = pos;
  2829. return;
  2830. }
  2831. code1 -= 257;
  2832. code1 = lengthDecode[code1];
  2833. var code2 = code1 >> 16;
  2834. if (code2 > 0) {
  2835. code2 = this.getBits(code2);
  2836. }
  2837. len = (code1 & 0xffff) + code2;
  2838. code1 = this.getCode(distCodeTable);
  2839. code1 = distDecode[code1];
  2840. code2 = code1 >> 16;
  2841. if (code2 > 0) {
  2842. code2 = this.getBits(code2);
  2843. }
  2844. var dist = (code1 & 0xffff) + code2;
  2845. if (pos + len >= limit) {
  2846. buffer = this.ensureBuffer(pos + len);
  2847. limit = buffer.length;
  2848. }
  2849. for (var k = 0; k < len; ++k, ++pos) {
  2850. buffer[pos] = buffer[pos - dist];
  2851. }
  2852. }
  2853. };
  2854. return FlateStream;
  2855. }();
  2856. var PredictorStream = function PredictorStreamClosure() {
  2857. function PredictorStream(str, maybeLength, params) {
  2858. if (!isDict(params)) {
  2859. return str;
  2860. }
  2861. var predictor = this.predictor = params.get('Predictor') || 1;
  2862. if (predictor <= 1) {
  2863. return str;
  2864. }
  2865. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  2866. error('Unsupported predictor: ' + predictor);
  2867. }
  2868. if (predictor === 2) {
  2869. this.readBlock = this.readBlockTiff;
  2870. } else {
  2871. this.readBlock = this.readBlockPng;
  2872. }
  2873. this.str = str;
  2874. this.dict = str.dict;
  2875. var colors = this.colors = params.get('Colors') || 1;
  2876. var bits = this.bits = params.get('BitsPerComponent') || 8;
  2877. var columns = this.columns = params.get('Columns') || 1;
  2878. this.pixBytes = colors * bits + 7 >> 3;
  2879. this.rowBytes = columns * colors * bits + 7 >> 3;
  2880. DecodeStream.call(this, maybeLength);
  2881. return this;
  2882. }
  2883. PredictorStream.prototype = Object.create(DecodeStream.prototype);
  2884. PredictorStream.prototype.readBlockTiff = function predictorStreamReadBlockTiff() {
  2885. var rowBytes = this.rowBytes;
  2886. var bufferLength = this.bufferLength;
  2887. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  2888. var bits = this.bits;
  2889. var colors = this.colors;
  2890. var rawBytes = this.str.getBytes(rowBytes);
  2891. this.eof = !rawBytes.length;
  2892. if (this.eof) {
  2893. return;
  2894. }
  2895. var inbuf = 0, outbuf = 0;
  2896. var inbits = 0, outbits = 0;
  2897. var pos = bufferLength;
  2898. var i;
  2899. if (bits === 1 && colors === 1) {
  2900. for (i = 0; i < rowBytes; ++i) {
  2901. var c = rawBytes[i] ^ inbuf;
  2902. c ^= c >> 1;
  2903. c ^= c >> 2;
  2904. c ^= c >> 4;
  2905. inbuf = (c & 1) << 7;
  2906. buffer[pos++] = c;
  2907. }
  2908. } else if (bits === 8) {
  2909. for (i = 0; i < colors; ++i) {
  2910. buffer[pos++] = rawBytes[i];
  2911. }
  2912. for (; i < rowBytes; ++i) {
  2913. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  2914. pos++;
  2915. }
  2916. } else {
  2917. var compArray = new Uint8Array(colors + 1);
  2918. var bitMask = (1 << bits) - 1;
  2919. var j = 0, k = bufferLength;
  2920. var columns = this.columns;
  2921. for (i = 0; i < columns; ++i) {
  2922. for (var kk = 0; kk < colors; ++kk) {
  2923. if (inbits < bits) {
  2924. inbuf = inbuf << 8 | rawBytes[j++] & 0xFF;
  2925. inbits += 8;
  2926. }
  2927. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  2928. inbits -= bits;
  2929. outbuf = outbuf << bits | compArray[kk];
  2930. outbits += bits;
  2931. if (outbits >= 8) {
  2932. buffer[k++] = outbuf >> outbits - 8 & 0xFF;
  2933. outbits -= 8;
  2934. }
  2935. }
  2936. }
  2937. if (outbits > 0) {
  2938. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  2939. }
  2940. }
  2941. this.bufferLength += rowBytes;
  2942. };
  2943. PredictorStream.prototype.readBlockPng = function predictorStreamReadBlockPng() {
  2944. var rowBytes = this.rowBytes;
  2945. var pixBytes = this.pixBytes;
  2946. var predictor = this.str.getByte();
  2947. var rawBytes = this.str.getBytes(rowBytes);
  2948. this.eof = !rawBytes.length;
  2949. if (this.eof) {
  2950. return;
  2951. }
  2952. var bufferLength = this.bufferLength;
  2953. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  2954. var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  2955. if (prevRow.length === 0) {
  2956. prevRow = new Uint8Array(rowBytes);
  2957. }
  2958. var i, j = bufferLength, up, c;
  2959. switch (predictor) {
  2960. case 0:
  2961. for (i = 0; i < rowBytes; ++i) {
  2962. buffer[j++] = rawBytes[i];
  2963. }
  2964. break;
  2965. case 1:
  2966. for (i = 0; i < pixBytes; ++i) {
  2967. buffer[j++] = rawBytes[i];
  2968. }
  2969. for (; i < rowBytes; ++i) {
  2970. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xFF;
  2971. j++;
  2972. }
  2973. break;
  2974. case 2:
  2975. for (i = 0; i < rowBytes; ++i) {
  2976. buffer[j++] = prevRow[i] + rawBytes[i] & 0xFF;
  2977. }
  2978. break;
  2979. case 3:
  2980. for (i = 0; i < pixBytes; ++i) {
  2981. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  2982. }
  2983. for (; i < rowBytes; ++i) {
  2984. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xFF;
  2985. j++;
  2986. }
  2987. break;
  2988. case 4:
  2989. for (i = 0; i < pixBytes; ++i) {
  2990. up = prevRow[i];
  2991. c = rawBytes[i];
  2992. buffer[j++] = up + c;
  2993. }
  2994. for (; i < rowBytes; ++i) {
  2995. up = prevRow[i];
  2996. var upLeft = prevRow[i - pixBytes];
  2997. var left = buffer[j - pixBytes];
  2998. var p = left + up - upLeft;
  2999. var pa = p - left;
  3000. if (pa < 0) {
  3001. pa = -pa;
  3002. }
  3003. var pb = p - up;
  3004. if (pb < 0) {
  3005. pb = -pb;
  3006. }
  3007. var pc = p - upLeft;
  3008. if (pc < 0) {
  3009. pc = -pc;
  3010. }
  3011. c = rawBytes[i];
  3012. if (pa <= pb && pa <= pc) {
  3013. buffer[j++] = left + c;
  3014. } else if (pb <= pc) {
  3015. buffer[j++] = up + c;
  3016. } else {
  3017. buffer[j++] = upLeft + c;
  3018. }
  3019. }
  3020. break;
  3021. default:
  3022. error('Unsupported predictor: ' + predictor);
  3023. }
  3024. this.bufferLength += rowBytes;
  3025. };
  3026. return PredictorStream;
  3027. }();
  3028. var JpegStream = function JpegStreamClosure() {
  3029. function JpegStream(stream, maybeLength, dict, params) {
  3030. var ch;
  3031. while ((ch = stream.getByte()) !== -1) {
  3032. if (ch === 0xFF) {
  3033. stream.skip(-1);
  3034. break;
  3035. }
  3036. }
  3037. this.stream = stream;
  3038. this.maybeLength = maybeLength;
  3039. this.dict = dict;
  3040. this.params = params;
  3041. DecodeStream.call(this, maybeLength);
  3042. }
  3043. JpegStream.prototype = Object.create(DecodeStream.prototype);
  3044. Object.defineProperty(JpegStream.prototype, 'bytes', {
  3045. get: function JpegStream_bytes() {
  3046. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  3047. },
  3048. configurable: true
  3049. });
  3050. JpegStream.prototype.ensureBuffer = function JpegStream_ensureBuffer(req) {
  3051. if (this.bufferLength) {
  3052. return;
  3053. }
  3054. var jpegImage = new JpegImage();
  3055. var decodeArr = this.dict.getArray('Decode', 'D');
  3056. if (this.forceRGB && isArray(decodeArr)) {
  3057. var bitsPerComponent = this.dict.get('BitsPerComponent') || 8;
  3058. var decodeArrLength = decodeArr.length;
  3059. var transform = new Int32Array(decodeArrLength);
  3060. var transformNeeded = false;
  3061. var maxValue = (1 << bitsPerComponent) - 1;
  3062. for (var i = 0; i < decodeArrLength; i += 2) {
  3063. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  3064. transform[i + 1] = decodeArr[i] * maxValue | 0;
  3065. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  3066. transformNeeded = true;
  3067. }
  3068. }
  3069. if (transformNeeded) {
  3070. jpegImage.decodeTransform = transform;
  3071. }
  3072. }
  3073. if (isDict(this.params)) {
  3074. var colorTransform = this.params.get('ColorTransform');
  3075. if (isInt(colorTransform)) {
  3076. jpegImage.colorTransform = colorTransform;
  3077. }
  3078. }
  3079. jpegImage.parse(this.bytes);
  3080. var data = jpegImage.getData(this.drawWidth, this.drawHeight, this.forceRGB);
  3081. this.buffer = data;
  3082. this.bufferLength = data.length;
  3083. this.eof = true;
  3084. };
  3085. JpegStream.prototype.getBytes = function JpegStream_getBytes(length) {
  3086. this.ensureBuffer();
  3087. return this.buffer;
  3088. };
  3089. JpegStream.prototype.getIR = function JpegStream_getIR(forceDataSchema) {
  3090. return createObjectURL(this.bytes, 'image/jpeg', forceDataSchema);
  3091. };
  3092. return JpegStream;
  3093. }();
  3094. var JpxStream = function JpxStreamClosure() {
  3095. function JpxStream(stream, maybeLength, dict, params) {
  3096. this.stream = stream;
  3097. this.maybeLength = maybeLength;
  3098. this.dict = dict;
  3099. this.params = params;
  3100. DecodeStream.call(this, maybeLength);
  3101. }
  3102. JpxStream.prototype = Object.create(DecodeStream.prototype);
  3103. Object.defineProperty(JpxStream.prototype, 'bytes', {
  3104. get: function JpxStream_bytes() {
  3105. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  3106. },
  3107. configurable: true
  3108. });
  3109. JpxStream.prototype.ensureBuffer = function JpxStream_ensureBuffer(req) {
  3110. if (this.bufferLength) {
  3111. return;
  3112. }
  3113. var jpxImage = new JpxImage();
  3114. jpxImage.parse(this.bytes);
  3115. var width = jpxImage.width;
  3116. var height = jpxImage.height;
  3117. var componentsCount = jpxImage.componentsCount;
  3118. var tileCount = jpxImage.tiles.length;
  3119. if (tileCount === 1) {
  3120. this.buffer = jpxImage.tiles[0].items;
  3121. } else {
  3122. var data = new Uint8Array(width * height * componentsCount);
  3123. for (var k = 0; k < tileCount; k++) {
  3124. var tileComponents = jpxImage.tiles[k];
  3125. var tileWidth = tileComponents.width;
  3126. var tileHeight = tileComponents.height;
  3127. var tileLeft = tileComponents.left;
  3128. var tileTop = tileComponents.top;
  3129. var src = tileComponents.items;
  3130. var srcPosition = 0;
  3131. var dataPosition = (width * tileTop + tileLeft) * componentsCount;
  3132. var imgRowSize = width * componentsCount;
  3133. var tileRowSize = tileWidth * componentsCount;
  3134. for (var j = 0; j < tileHeight; j++) {
  3135. var rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  3136. data.set(rowBytes, dataPosition);
  3137. srcPosition += tileRowSize;
  3138. dataPosition += imgRowSize;
  3139. }
  3140. }
  3141. this.buffer = data;
  3142. }
  3143. this.bufferLength = this.buffer.length;
  3144. this.eof = true;
  3145. };
  3146. return JpxStream;
  3147. }();
  3148. var Jbig2Stream = function Jbig2StreamClosure() {
  3149. function Jbig2Stream(stream, maybeLength, dict, params) {
  3150. this.stream = stream;
  3151. this.maybeLength = maybeLength;
  3152. this.dict = dict;
  3153. this.params = params;
  3154. DecodeStream.call(this, maybeLength);
  3155. }
  3156. Jbig2Stream.prototype = Object.create(DecodeStream.prototype);
  3157. Object.defineProperty(Jbig2Stream.prototype, 'bytes', {
  3158. get: function Jbig2Stream_bytes() {
  3159. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  3160. },
  3161. configurable: true
  3162. });
  3163. Jbig2Stream.prototype.ensureBuffer = function Jbig2Stream_ensureBuffer(req) {
  3164. if (this.bufferLength) {
  3165. return;
  3166. }
  3167. var jbig2Image = new Jbig2Image();
  3168. var chunks = [];
  3169. if (isDict(this.params)) {
  3170. var globalsStream = this.params.get('JBIG2Globals');
  3171. if (isStream(globalsStream)) {
  3172. var globals = globalsStream.getBytes();
  3173. chunks.push({
  3174. data: globals,
  3175. start: 0,
  3176. end: globals.length
  3177. });
  3178. }
  3179. }
  3180. chunks.push({
  3181. data: this.bytes,
  3182. start: 0,
  3183. end: this.bytes.length
  3184. });
  3185. var data = jbig2Image.parseChunks(chunks);
  3186. var dataLength = data.length;
  3187. for (var i = 0; i < dataLength; i++) {
  3188. data[i] ^= 0xFF;
  3189. }
  3190. this.buffer = data;
  3191. this.bufferLength = dataLength;
  3192. this.eof = true;
  3193. };
  3194. return Jbig2Stream;
  3195. }();
  3196. var DecryptStream = function DecryptStreamClosure() {
  3197. function DecryptStream(str, maybeLength, decrypt) {
  3198. this.str = str;
  3199. this.dict = str.dict;
  3200. this.decrypt = decrypt;
  3201. this.nextChunk = null;
  3202. this.initialized = false;
  3203. DecodeStream.call(this, maybeLength);
  3204. }
  3205. var chunkSize = 512;
  3206. DecryptStream.prototype = Object.create(DecodeStream.prototype);
  3207. DecryptStream.prototype.readBlock = function DecryptStream_readBlock() {
  3208. var chunk;
  3209. if (this.initialized) {
  3210. chunk = this.nextChunk;
  3211. } else {
  3212. chunk = this.str.getBytes(chunkSize);
  3213. this.initialized = true;
  3214. }
  3215. if (!chunk || chunk.length === 0) {
  3216. this.eof = true;
  3217. return;
  3218. }
  3219. this.nextChunk = this.str.getBytes(chunkSize);
  3220. var hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  3221. var decrypt = this.decrypt;
  3222. chunk = decrypt(chunk, !hasMoreData);
  3223. var bufferLength = this.bufferLength;
  3224. var i, n = chunk.length;
  3225. var buffer = this.ensureBuffer(bufferLength + n);
  3226. for (i = 0; i < n; i++) {
  3227. buffer[bufferLength++] = chunk[i];
  3228. }
  3229. this.bufferLength = bufferLength;
  3230. };
  3231. return DecryptStream;
  3232. }();
  3233. var Ascii85Stream = function Ascii85StreamClosure() {
  3234. function Ascii85Stream(str, maybeLength) {
  3235. this.str = str;
  3236. this.dict = str.dict;
  3237. this.input = new Uint8Array(5);
  3238. if (maybeLength) {
  3239. maybeLength = 0.8 * maybeLength;
  3240. }
  3241. DecodeStream.call(this, maybeLength);
  3242. }
  3243. Ascii85Stream.prototype = Object.create(DecodeStream.prototype);
  3244. Ascii85Stream.prototype.readBlock = function Ascii85Stream_readBlock() {
  3245. var TILDA_CHAR = 0x7E;
  3246. var Z_LOWER_CHAR = 0x7A;
  3247. var EOF = -1;
  3248. var str = this.str;
  3249. var c = str.getByte();
  3250. while (isSpace(c)) {
  3251. c = str.getByte();
  3252. }
  3253. if (c === EOF || c === TILDA_CHAR) {
  3254. this.eof = true;
  3255. return;
  3256. }
  3257. var bufferLength = this.bufferLength, buffer;
  3258. var i;
  3259. if (c === Z_LOWER_CHAR) {
  3260. buffer = this.ensureBuffer(bufferLength + 4);
  3261. for (i = 0; i < 4; ++i) {
  3262. buffer[bufferLength + i] = 0;
  3263. }
  3264. this.bufferLength += 4;
  3265. } else {
  3266. var input = this.input;
  3267. input[0] = c;
  3268. for (i = 1; i < 5; ++i) {
  3269. c = str.getByte();
  3270. while (isSpace(c)) {
  3271. c = str.getByte();
  3272. }
  3273. input[i] = c;
  3274. if (c === EOF || c === TILDA_CHAR) {
  3275. break;
  3276. }
  3277. }
  3278. buffer = this.ensureBuffer(bufferLength + i - 1);
  3279. this.bufferLength += i - 1;
  3280. if (i < 5) {
  3281. for (; i < 5; ++i) {
  3282. input[i] = 0x21 + 84;
  3283. }
  3284. this.eof = true;
  3285. }
  3286. var t = 0;
  3287. for (i = 0; i < 5; ++i) {
  3288. t = t * 85 + (input[i] - 0x21);
  3289. }
  3290. for (i = 3; i >= 0; --i) {
  3291. buffer[bufferLength + i] = t & 0xFF;
  3292. t >>= 8;
  3293. }
  3294. }
  3295. };
  3296. return Ascii85Stream;
  3297. }();
  3298. var AsciiHexStream = function AsciiHexStreamClosure() {
  3299. function AsciiHexStream(str, maybeLength) {
  3300. this.str = str;
  3301. this.dict = str.dict;
  3302. this.firstDigit = -1;
  3303. if (maybeLength) {
  3304. maybeLength = 0.5 * maybeLength;
  3305. }
  3306. DecodeStream.call(this, maybeLength);
  3307. }
  3308. AsciiHexStream.prototype = Object.create(DecodeStream.prototype);
  3309. AsciiHexStream.prototype.readBlock = function AsciiHexStream_readBlock() {
  3310. var UPSTREAM_BLOCK_SIZE = 8000;
  3311. var bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  3312. if (!bytes.length) {
  3313. this.eof = true;
  3314. return;
  3315. }
  3316. var maxDecodeLength = bytes.length + 1 >> 1;
  3317. var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  3318. var bufferLength = this.bufferLength;
  3319. var firstDigit = this.firstDigit;
  3320. for (var i = 0, ii = bytes.length; i < ii; i++) {
  3321. var ch = bytes[i], digit;
  3322. if (ch >= 0x30 && ch <= 0x39) {
  3323. digit = ch & 0x0F;
  3324. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  3325. digit = (ch & 0x0F) + 9;
  3326. } else if (ch === 0x3E) {
  3327. this.eof = true;
  3328. break;
  3329. } else {
  3330. continue;
  3331. }
  3332. if (firstDigit < 0) {
  3333. firstDigit = digit;
  3334. } else {
  3335. buffer[bufferLength++] = firstDigit << 4 | digit;
  3336. firstDigit = -1;
  3337. }
  3338. }
  3339. if (firstDigit >= 0 && this.eof) {
  3340. buffer[bufferLength++] = firstDigit << 4;
  3341. firstDigit = -1;
  3342. }
  3343. this.firstDigit = firstDigit;
  3344. this.bufferLength = bufferLength;
  3345. };
  3346. return AsciiHexStream;
  3347. }();
  3348. var RunLengthStream = function RunLengthStreamClosure() {
  3349. function RunLengthStream(str, maybeLength) {
  3350. this.str = str;
  3351. this.dict = str.dict;
  3352. DecodeStream.call(this, maybeLength);
  3353. }
  3354. RunLengthStream.prototype = Object.create(DecodeStream.prototype);
  3355. RunLengthStream.prototype.readBlock = function RunLengthStream_readBlock() {
  3356. var repeatHeader = this.str.getBytes(2);
  3357. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  3358. this.eof = true;
  3359. return;
  3360. }
  3361. var buffer;
  3362. var bufferLength = this.bufferLength;
  3363. var n = repeatHeader[0];
  3364. if (n < 128) {
  3365. buffer = this.ensureBuffer(bufferLength + n + 1);
  3366. buffer[bufferLength++] = repeatHeader[1];
  3367. if (n > 0) {
  3368. var source = this.str.getBytes(n);
  3369. buffer.set(source, bufferLength);
  3370. bufferLength += n;
  3371. }
  3372. } else {
  3373. n = 257 - n;
  3374. var b = repeatHeader[1];
  3375. buffer = this.ensureBuffer(bufferLength + n + 1);
  3376. for (var i = 0; i < n; i++) {
  3377. buffer[bufferLength++] = b;
  3378. }
  3379. }
  3380. this.bufferLength = bufferLength;
  3381. };
  3382. return RunLengthStream;
  3383. }();
  3384. var CCITTFaxStream = function CCITTFaxStreamClosure() {
  3385. var ccittEOL = -2;
  3386. var ccittEOF = -1;
  3387. var twoDimPass = 0;
  3388. var twoDimHoriz = 1;
  3389. var twoDimVert0 = 2;
  3390. var twoDimVertR1 = 3;
  3391. var twoDimVertL1 = 4;
  3392. var twoDimVertR2 = 5;
  3393. var twoDimVertL2 = 6;
  3394. var twoDimVertR3 = 7;
  3395. var twoDimVertL3 = 8;
  3396. var twoDimTable = [
  3397. [
  3398. -1,
  3399. -1
  3400. ],
  3401. [
  3402. -1,
  3403. -1
  3404. ],
  3405. [
  3406. 7,
  3407. twoDimVertL3
  3408. ],
  3409. [
  3410. 7,
  3411. twoDimVertR3
  3412. ],
  3413. [
  3414. 6,
  3415. twoDimVertL2
  3416. ],
  3417. [
  3418. 6,
  3419. twoDimVertL2
  3420. ],
  3421. [
  3422. 6,
  3423. twoDimVertR2
  3424. ],
  3425. [
  3426. 6,
  3427. twoDimVertR2
  3428. ],
  3429. [
  3430. 4,
  3431. twoDimPass
  3432. ],
  3433. [
  3434. 4,
  3435. twoDimPass
  3436. ],
  3437. [
  3438. 4,
  3439. twoDimPass
  3440. ],
  3441. [
  3442. 4,
  3443. twoDimPass
  3444. ],
  3445. [
  3446. 4,
  3447. twoDimPass
  3448. ],
  3449. [
  3450. 4,
  3451. twoDimPass
  3452. ],
  3453. [
  3454. 4,
  3455. twoDimPass
  3456. ],
  3457. [
  3458. 4,
  3459. twoDimPass
  3460. ],
  3461. [
  3462. 3,
  3463. twoDimHoriz
  3464. ],
  3465. [
  3466. 3,
  3467. twoDimHoriz
  3468. ],
  3469. [
  3470. 3,
  3471. twoDimHoriz
  3472. ],
  3473. [
  3474. 3,
  3475. twoDimHoriz
  3476. ],
  3477. [
  3478. 3,
  3479. twoDimHoriz
  3480. ],
  3481. [
  3482. 3,
  3483. twoDimHoriz
  3484. ],
  3485. [
  3486. 3,
  3487. twoDimHoriz
  3488. ],
  3489. [
  3490. 3,
  3491. twoDimHoriz
  3492. ],
  3493. [
  3494. 3,
  3495. twoDimHoriz
  3496. ],
  3497. [
  3498. 3,
  3499. twoDimHoriz
  3500. ],
  3501. [
  3502. 3,
  3503. twoDimHoriz
  3504. ],
  3505. [
  3506. 3,
  3507. twoDimHoriz
  3508. ],
  3509. [
  3510. 3,
  3511. twoDimHoriz
  3512. ],
  3513. [
  3514. 3,
  3515. twoDimHoriz
  3516. ],
  3517. [
  3518. 3,
  3519. twoDimHoriz
  3520. ],
  3521. [
  3522. 3,
  3523. twoDimHoriz
  3524. ],
  3525. [
  3526. 3,
  3527. twoDimVertL1
  3528. ],
  3529. [
  3530. 3,
  3531. twoDimVertL1
  3532. ],
  3533. [
  3534. 3,
  3535. twoDimVertL1
  3536. ],
  3537. [
  3538. 3,
  3539. twoDimVertL1
  3540. ],
  3541. [
  3542. 3,
  3543. twoDimVertL1
  3544. ],
  3545. [
  3546. 3,
  3547. twoDimVertL1
  3548. ],
  3549. [
  3550. 3,
  3551. twoDimVertL1
  3552. ],
  3553. [
  3554. 3,
  3555. twoDimVertL1
  3556. ],
  3557. [
  3558. 3,
  3559. twoDimVertL1
  3560. ],
  3561. [
  3562. 3,
  3563. twoDimVertL1
  3564. ],
  3565. [
  3566. 3,
  3567. twoDimVertL1
  3568. ],
  3569. [
  3570. 3,
  3571. twoDimVertL1
  3572. ],
  3573. [
  3574. 3,
  3575. twoDimVertL1
  3576. ],
  3577. [
  3578. 3,
  3579. twoDimVertL1
  3580. ],
  3581. [
  3582. 3,
  3583. twoDimVertL1
  3584. ],
  3585. [
  3586. 3,
  3587. twoDimVertL1
  3588. ],
  3589. [
  3590. 3,
  3591. twoDimVertR1
  3592. ],
  3593. [
  3594. 3,
  3595. twoDimVertR1
  3596. ],
  3597. [
  3598. 3,
  3599. twoDimVertR1
  3600. ],
  3601. [
  3602. 3,
  3603. twoDimVertR1
  3604. ],
  3605. [
  3606. 3,
  3607. twoDimVertR1
  3608. ],
  3609. [
  3610. 3,
  3611. twoDimVertR1
  3612. ],
  3613. [
  3614. 3,
  3615. twoDimVertR1
  3616. ],
  3617. [
  3618. 3,
  3619. twoDimVertR1
  3620. ],
  3621. [
  3622. 3,
  3623. twoDimVertR1
  3624. ],
  3625. [
  3626. 3,
  3627. twoDimVertR1
  3628. ],
  3629. [
  3630. 3,
  3631. twoDimVertR1
  3632. ],
  3633. [
  3634. 3,
  3635. twoDimVertR1
  3636. ],
  3637. [
  3638. 3,
  3639. twoDimVertR1
  3640. ],
  3641. [
  3642. 3,
  3643. twoDimVertR1
  3644. ],
  3645. [
  3646. 3,
  3647. twoDimVertR1
  3648. ],
  3649. [
  3650. 3,
  3651. twoDimVertR1
  3652. ],
  3653. [
  3654. 1,
  3655. twoDimVert0
  3656. ],
  3657. [
  3658. 1,
  3659. twoDimVert0
  3660. ],
  3661. [
  3662. 1,
  3663. twoDimVert0
  3664. ],
  3665. [
  3666. 1,
  3667. twoDimVert0
  3668. ],
  3669. [
  3670. 1,
  3671. twoDimVert0
  3672. ],
  3673. [
  3674. 1,
  3675. twoDimVert0
  3676. ],
  3677. [
  3678. 1,
  3679. twoDimVert0
  3680. ],
  3681. [
  3682. 1,
  3683. twoDimVert0
  3684. ],
  3685. [
  3686. 1,
  3687. twoDimVert0
  3688. ],
  3689. [
  3690. 1,
  3691. twoDimVert0
  3692. ],
  3693. [
  3694. 1,
  3695. twoDimVert0
  3696. ],
  3697. [
  3698. 1,
  3699. twoDimVert0
  3700. ],
  3701. [
  3702. 1,
  3703. twoDimVert0
  3704. ],
  3705. [
  3706. 1,
  3707. twoDimVert0
  3708. ],
  3709. [
  3710. 1,
  3711. twoDimVert0
  3712. ],
  3713. [
  3714. 1,
  3715. twoDimVert0
  3716. ],
  3717. [
  3718. 1,
  3719. twoDimVert0
  3720. ],
  3721. [
  3722. 1,
  3723. twoDimVert0
  3724. ],
  3725. [
  3726. 1,
  3727. twoDimVert0
  3728. ],
  3729. [
  3730. 1,
  3731. twoDimVert0
  3732. ],
  3733. [
  3734. 1,
  3735. twoDimVert0
  3736. ],
  3737. [
  3738. 1,
  3739. twoDimVert0
  3740. ],
  3741. [
  3742. 1,
  3743. twoDimVert0
  3744. ],
  3745. [
  3746. 1,
  3747. twoDimVert0
  3748. ],
  3749. [
  3750. 1,
  3751. twoDimVert0
  3752. ],
  3753. [
  3754. 1,
  3755. twoDimVert0
  3756. ],
  3757. [
  3758. 1,
  3759. twoDimVert0
  3760. ],
  3761. [
  3762. 1,
  3763. twoDimVert0
  3764. ],
  3765. [
  3766. 1,
  3767. twoDimVert0
  3768. ],
  3769. [
  3770. 1,
  3771. twoDimVert0
  3772. ],
  3773. [
  3774. 1,
  3775. twoDimVert0
  3776. ],
  3777. [
  3778. 1,
  3779. twoDimVert0
  3780. ],
  3781. [
  3782. 1,
  3783. twoDimVert0
  3784. ],
  3785. [
  3786. 1,
  3787. twoDimVert0
  3788. ],
  3789. [
  3790. 1,
  3791. twoDimVert0
  3792. ],
  3793. [
  3794. 1,
  3795. twoDimVert0
  3796. ],
  3797. [
  3798. 1,
  3799. twoDimVert0
  3800. ],
  3801. [
  3802. 1,
  3803. twoDimVert0
  3804. ],
  3805. [
  3806. 1,
  3807. twoDimVert0
  3808. ],
  3809. [
  3810. 1,
  3811. twoDimVert0
  3812. ],
  3813. [
  3814. 1,
  3815. twoDimVert0
  3816. ],
  3817. [
  3818. 1,
  3819. twoDimVert0
  3820. ],
  3821. [
  3822. 1,
  3823. twoDimVert0
  3824. ],
  3825. [
  3826. 1,
  3827. twoDimVert0
  3828. ],
  3829. [
  3830. 1,
  3831. twoDimVert0
  3832. ],
  3833. [
  3834. 1,
  3835. twoDimVert0
  3836. ],
  3837. [
  3838. 1,
  3839. twoDimVert0
  3840. ],
  3841. [
  3842. 1,
  3843. twoDimVert0
  3844. ],
  3845. [
  3846. 1,
  3847. twoDimVert0
  3848. ],
  3849. [
  3850. 1,
  3851. twoDimVert0
  3852. ],
  3853. [
  3854. 1,
  3855. twoDimVert0
  3856. ],
  3857. [
  3858. 1,
  3859. twoDimVert0
  3860. ],
  3861. [
  3862. 1,
  3863. twoDimVert0
  3864. ],
  3865. [
  3866. 1,
  3867. twoDimVert0
  3868. ],
  3869. [
  3870. 1,
  3871. twoDimVert0
  3872. ],
  3873. [
  3874. 1,
  3875. twoDimVert0
  3876. ],
  3877. [
  3878. 1,
  3879. twoDimVert0
  3880. ],
  3881. [
  3882. 1,
  3883. twoDimVert0
  3884. ],
  3885. [
  3886. 1,
  3887. twoDimVert0
  3888. ],
  3889. [
  3890. 1,
  3891. twoDimVert0
  3892. ],
  3893. [
  3894. 1,
  3895. twoDimVert0
  3896. ],
  3897. [
  3898. 1,
  3899. twoDimVert0
  3900. ],
  3901. [
  3902. 1,
  3903. twoDimVert0
  3904. ],
  3905. [
  3906. 1,
  3907. twoDimVert0
  3908. ]
  3909. ];
  3910. var whiteTable1 = [
  3911. [
  3912. -1,
  3913. -1
  3914. ],
  3915. [
  3916. 12,
  3917. ccittEOL
  3918. ],
  3919. [
  3920. -1,
  3921. -1
  3922. ],
  3923. [
  3924. -1,
  3925. -1
  3926. ],
  3927. [
  3928. -1,
  3929. -1
  3930. ],
  3931. [
  3932. -1,
  3933. -1
  3934. ],
  3935. [
  3936. -1,
  3937. -1
  3938. ],
  3939. [
  3940. -1,
  3941. -1
  3942. ],
  3943. [
  3944. -1,
  3945. -1
  3946. ],
  3947. [
  3948. -1,
  3949. -1
  3950. ],
  3951. [
  3952. -1,
  3953. -1
  3954. ],
  3955. [
  3956. -1,
  3957. -1
  3958. ],
  3959. [
  3960. -1,
  3961. -1
  3962. ],
  3963. [
  3964. -1,
  3965. -1
  3966. ],
  3967. [
  3968. -1,
  3969. -1
  3970. ],
  3971. [
  3972. -1,
  3973. -1
  3974. ],
  3975. [
  3976. 11,
  3977. 1792
  3978. ],
  3979. [
  3980. 11,
  3981. 1792
  3982. ],
  3983. [
  3984. 12,
  3985. 1984
  3986. ],
  3987. [
  3988. 12,
  3989. 2048
  3990. ],
  3991. [
  3992. 12,
  3993. 2112
  3994. ],
  3995. [
  3996. 12,
  3997. 2176
  3998. ],
  3999. [
  4000. 12,
  4001. 2240
  4002. ],
  4003. [
  4004. 12,
  4005. 2304
  4006. ],
  4007. [
  4008. 11,
  4009. 1856
  4010. ],
  4011. [
  4012. 11,
  4013. 1856
  4014. ],
  4015. [
  4016. 11,
  4017. 1920
  4018. ],
  4019. [
  4020. 11,
  4021. 1920
  4022. ],
  4023. [
  4024. 12,
  4025. 2368
  4026. ],
  4027. [
  4028. 12,
  4029. 2432
  4030. ],
  4031. [
  4032. 12,
  4033. 2496
  4034. ],
  4035. [
  4036. 12,
  4037. 2560
  4038. ]
  4039. ];
  4040. var whiteTable2 = [
  4041. [
  4042. -1,
  4043. -1
  4044. ],
  4045. [
  4046. -1,
  4047. -1
  4048. ],
  4049. [
  4050. -1,
  4051. -1
  4052. ],
  4053. [
  4054. -1,
  4055. -1
  4056. ],
  4057. [
  4058. 8,
  4059. 29
  4060. ],
  4061. [
  4062. 8,
  4063. 29
  4064. ],
  4065. [
  4066. 8,
  4067. 30
  4068. ],
  4069. [
  4070. 8,
  4071. 30
  4072. ],
  4073. [
  4074. 8,
  4075. 45
  4076. ],
  4077. [
  4078. 8,
  4079. 45
  4080. ],
  4081. [
  4082. 8,
  4083. 46
  4084. ],
  4085. [
  4086. 8,
  4087. 46
  4088. ],
  4089. [
  4090. 7,
  4091. 22
  4092. ],
  4093. [
  4094. 7,
  4095. 22
  4096. ],
  4097. [
  4098. 7,
  4099. 22
  4100. ],
  4101. [
  4102. 7,
  4103. 22
  4104. ],
  4105. [
  4106. 7,
  4107. 23
  4108. ],
  4109. [
  4110. 7,
  4111. 23
  4112. ],
  4113. [
  4114. 7,
  4115. 23
  4116. ],
  4117. [
  4118. 7,
  4119. 23
  4120. ],
  4121. [
  4122. 8,
  4123. 47
  4124. ],
  4125. [
  4126. 8,
  4127. 47
  4128. ],
  4129. [
  4130. 8,
  4131. 48
  4132. ],
  4133. [
  4134. 8,
  4135. 48
  4136. ],
  4137. [
  4138. 6,
  4139. 13
  4140. ],
  4141. [
  4142. 6,
  4143. 13
  4144. ],
  4145. [
  4146. 6,
  4147. 13
  4148. ],
  4149. [
  4150. 6,
  4151. 13
  4152. ],
  4153. [
  4154. 6,
  4155. 13
  4156. ],
  4157. [
  4158. 6,
  4159. 13
  4160. ],
  4161. [
  4162. 6,
  4163. 13
  4164. ],
  4165. [
  4166. 6,
  4167. 13
  4168. ],
  4169. [
  4170. 7,
  4171. 20
  4172. ],
  4173. [
  4174. 7,
  4175. 20
  4176. ],
  4177. [
  4178. 7,
  4179. 20
  4180. ],
  4181. [
  4182. 7,
  4183. 20
  4184. ],
  4185. [
  4186. 8,
  4187. 33
  4188. ],
  4189. [
  4190. 8,
  4191. 33
  4192. ],
  4193. [
  4194. 8,
  4195. 34
  4196. ],
  4197. [
  4198. 8,
  4199. 34
  4200. ],
  4201. [
  4202. 8,
  4203. 35
  4204. ],
  4205. [
  4206. 8,
  4207. 35
  4208. ],
  4209. [
  4210. 8,
  4211. 36
  4212. ],
  4213. [
  4214. 8,
  4215. 36
  4216. ],
  4217. [
  4218. 8,
  4219. 37
  4220. ],
  4221. [
  4222. 8,
  4223. 37
  4224. ],
  4225. [
  4226. 8,
  4227. 38
  4228. ],
  4229. [
  4230. 8,
  4231. 38
  4232. ],
  4233. [
  4234. 7,
  4235. 19
  4236. ],
  4237. [
  4238. 7,
  4239. 19
  4240. ],
  4241. [
  4242. 7,
  4243. 19
  4244. ],
  4245. [
  4246. 7,
  4247. 19
  4248. ],
  4249. [
  4250. 8,
  4251. 31
  4252. ],
  4253. [
  4254. 8,
  4255. 31
  4256. ],
  4257. [
  4258. 8,
  4259. 32
  4260. ],
  4261. [
  4262. 8,
  4263. 32
  4264. ],
  4265. [
  4266. 6,
  4267. 1
  4268. ],
  4269. [
  4270. 6,
  4271. 1
  4272. ],
  4273. [
  4274. 6,
  4275. 1
  4276. ],
  4277. [
  4278. 6,
  4279. 1
  4280. ],
  4281. [
  4282. 6,
  4283. 1
  4284. ],
  4285. [
  4286. 6,
  4287. 1
  4288. ],
  4289. [
  4290. 6,
  4291. 1
  4292. ],
  4293. [
  4294. 6,
  4295. 1
  4296. ],
  4297. [
  4298. 6,
  4299. 12
  4300. ],
  4301. [
  4302. 6,
  4303. 12
  4304. ],
  4305. [
  4306. 6,
  4307. 12
  4308. ],
  4309. [
  4310. 6,
  4311. 12
  4312. ],
  4313. [
  4314. 6,
  4315. 12
  4316. ],
  4317. [
  4318. 6,
  4319. 12
  4320. ],
  4321. [
  4322. 6,
  4323. 12
  4324. ],
  4325. [
  4326. 6,
  4327. 12
  4328. ],
  4329. [
  4330. 8,
  4331. 53
  4332. ],
  4333. [
  4334. 8,
  4335. 53
  4336. ],
  4337. [
  4338. 8,
  4339. 54
  4340. ],
  4341. [
  4342. 8,
  4343. 54
  4344. ],
  4345. [
  4346. 7,
  4347. 26
  4348. ],
  4349. [
  4350. 7,
  4351. 26
  4352. ],
  4353. [
  4354. 7,
  4355. 26
  4356. ],
  4357. [
  4358. 7,
  4359. 26
  4360. ],
  4361. [
  4362. 8,
  4363. 39
  4364. ],
  4365. [
  4366. 8,
  4367. 39
  4368. ],
  4369. [
  4370. 8,
  4371. 40
  4372. ],
  4373. [
  4374. 8,
  4375. 40
  4376. ],
  4377. [
  4378. 8,
  4379. 41
  4380. ],
  4381. [
  4382. 8,
  4383. 41
  4384. ],
  4385. [
  4386. 8,
  4387. 42
  4388. ],
  4389. [
  4390. 8,
  4391. 42
  4392. ],
  4393. [
  4394. 8,
  4395. 43
  4396. ],
  4397. [
  4398. 8,
  4399. 43
  4400. ],
  4401. [
  4402. 8,
  4403. 44
  4404. ],
  4405. [
  4406. 8,
  4407. 44
  4408. ],
  4409. [
  4410. 7,
  4411. 21
  4412. ],
  4413. [
  4414. 7,
  4415. 21
  4416. ],
  4417. [
  4418. 7,
  4419. 21
  4420. ],
  4421. [
  4422. 7,
  4423. 21
  4424. ],
  4425. [
  4426. 7,
  4427. 28
  4428. ],
  4429. [
  4430. 7,
  4431. 28
  4432. ],
  4433. [
  4434. 7,
  4435. 28
  4436. ],
  4437. [
  4438. 7,
  4439. 28
  4440. ],
  4441. [
  4442. 8,
  4443. 61
  4444. ],
  4445. [
  4446. 8,
  4447. 61
  4448. ],
  4449. [
  4450. 8,
  4451. 62
  4452. ],
  4453. [
  4454. 8,
  4455. 62
  4456. ],
  4457. [
  4458. 8,
  4459. 63
  4460. ],
  4461. [
  4462. 8,
  4463. 63
  4464. ],
  4465. [
  4466. 8,
  4467. 0
  4468. ],
  4469. [
  4470. 8,
  4471. 0
  4472. ],
  4473. [
  4474. 8,
  4475. 320
  4476. ],
  4477. [
  4478. 8,
  4479. 320
  4480. ],
  4481. [
  4482. 8,
  4483. 384
  4484. ],
  4485. [
  4486. 8,
  4487. 384
  4488. ],
  4489. [
  4490. 5,
  4491. 10
  4492. ],
  4493. [
  4494. 5,
  4495. 10
  4496. ],
  4497. [
  4498. 5,
  4499. 10
  4500. ],
  4501. [
  4502. 5,
  4503. 10
  4504. ],
  4505. [
  4506. 5,
  4507. 10
  4508. ],
  4509. [
  4510. 5,
  4511. 10
  4512. ],
  4513. [
  4514. 5,
  4515. 10
  4516. ],
  4517. [
  4518. 5,
  4519. 10
  4520. ],
  4521. [
  4522. 5,
  4523. 10
  4524. ],
  4525. [
  4526. 5,
  4527. 10
  4528. ],
  4529. [
  4530. 5,
  4531. 10
  4532. ],
  4533. [
  4534. 5,
  4535. 10
  4536. ],
  4537. [
  4538. 5,
  4539. 10
  4540. ],
  4541. [
  4542. 5,
  4543. 10
  4544. ],
  4545. [
  4546. 5,
  4547. 10
  4548. ],
  4549. [
  4550. 5,
  4551. 10
  4552. ],
  4553. [
  4554. 5,
  4555. 11
  4556. ],
  4557. [
  4558. 5,
  4559. 11
  4560. ],
  4561. [
  4562. 5,
  4563. 11
  4564. ],
  4565. [
  4566. 5,
  4567. 11
  4568. ],
  4569. [
  4570. 5,
  4571. 11
  4572. ],
  4573. [
  4574. 5,
  4575. 11
  4576. ],
  4577. [
  4578. 5,
  4579. 11
  4580. ],
  4581. [
  4582. 5,
  4583. 11
  4584. ],
  4585. [
  4586. 5,
  4587. 11
  4588. ],
  4589. [
  4590. 5,
  4591. 11
  4592. ],
  4593. [
  4594. 5,
  4595. 11
  4596. ],
  4597. [
  4598. 5,
  4599. 11
  4600. ],
  4601. [
  4602. 5,
  4603. 11
  4604. ],
  4605. [
  4606. 5,
  4607. 11
  4608. ],
  4609. [
  4610. 5,
  4611. 11
  4612. ],
  4613. [
  4614. 5,
  4615. 11
  4616. ],
  4617. [
  4618. 7,
  4619. 27
  4620. ],
  4621. [
  4622. 7,
  4623. 27
  4624. ],
  4625. [
  4626. 7,
  4627. 27
  4628. ],
  4629. [
  4630. 7,
  4631. 27
  4632. ],
  4633. [
  4634. 8,
  4635. 59
  4636. ],
  4637. [
  4638. 8,
  4639. 59
  4640. ],
  4641. [
  4642. 8,
  4643. 60
  4644. ],
  4645. [
  4646. 8,
  4647. 60
  4648. ],
  4649. [
  4650. 9,
  4651. 1472
  4652. ],
  4653. [
  4654. 9,
  4655. 1536
  4656. ],
  4657. [
  4658. 9,
  4659. 1600
  4660. ],
  4661. [
  4662. 9,
  4663. 1728
  4664. ],
  4665. [
  4666. 7,
  4667. 18
  4668. ],
  4669. [
  4670. 7,
  4671. 18
  4672. ],
  4673. [
  4674. 7,
  4675. 18
  4676. ],
  4677. [
  4678. 7,
  4679. 18
  4680. ],
  4681. [
  4682. 7,
  4683. 24
  4684. ],
  4685. [
  4686. 7,
  4687. 24
  4688. ],
  4689. [
  4690. 7,
  4691. 24
  4692. ],
  4693. [
  4694. 7,
  4695. 24
  4696. ],
  4697. [
  4698. 8,
  4699. 49
  4700. ],
  4701. [
  4702. 8,
  4703. 49
  4704. ],
  4705. [
  4706. 8,
  4707. 50
  4708. ],
  4709. [
  4710. 8,
  4711. 50
  4712. ],
  4713. [
  4714. 8,
  4715. 51
  4716. ],
  4717. [
  4718. 8,
  4719. 51
  4720. ],
  4721. [
  4722. 8,
  4723. 52
  4724. ],
  4725. [
  4726. 8,
  4727. 52
  4728. ],
  4729. [
  4730. 7,
  4731. 25
  4732. ],
  4733. [
  4734. 7,
  4735. 25
  4736. ],
  4737. [
  4738. 7,
  4739. 25
  4740. ],
  4741. [
  4742. 7,
  4743. 25
  4744. ],
  4745. [
  4746. 8,
  4747. 55
  4748. ],
  4749. [
  4750. 8,
  4751. 55
  4752. ],
  4753. [
  4754. 8,
  4755. 56
  4756. ],
  4757. [
  4758. 8,
  4759. 56
  4760. ],
  4761. [
  4762. 8,
  4763. 57
  4764. ],
  4765. [
  4766. 8,
  4767. 57
  4768. ],
  4769. [
  4770. 8,
  4771. 58
  4772. ],
  4773. [
  4774. 8,
  4775. 58
  4776. ],
  4777. [
  4778. 6,
  4779. 192
  4780. ],
  4781. [
  4782. 6,
  4783. 192
  4784. ],
  4785. [
  4786. 6,
  4787. 192
  4788. ],
  4789. [
  4790. 6,
  4791. 192
  4792. ],
  4793. [
  4794. 6,
  4795. 192
  4796. ],
  4797. [
  4798. 6,
  4799. 192
  4800. ],
  4801. [
  4802. 6,
  4803. 192
  4804. ],
  4805. [
  4806. 6,
  4807. 192
  4808. ],
  4809. [
  4810. 6,
  4811. 1664
  4812. ],
  4813. [
  4814. 6,
  4815. 1664
  4816. ],
  4817. [
  4818. 6,
  4819. 1664
  4820. ],
  4821. [
  4822. 6,
  4823. 1664
  4824. ],
  4825. [
  4826. 6,
  4827. 1664
  4828. ],
  4829. [
  4830. 6,
  4831. 1664
  4832. ],
  4833. [
  4834. 6,
  4835. 1664
  4836. ],
  4837. [
  4838. 6,
  4839. 1664
  4840. ],
  4841. [
  4842. 8,
  4843. 448
  4844. ],
  4845. [
  4846. 8,
  4847. 448
  4848. ],
  4849. [
  4850. 8,
  4851. 512
  4852. ],
  4853. [
  4854. 8,
  4855. 512
  4856. ],
  4857. [
  4858. 9,
  4859. 704
  4860. ],
  4861. [
  4862. 9,
  4863. 768
  4864. ],
  4865. [
  4866. 8,
  4867. 640
  4868. ],
  4869. [
  4870. 8,
  4871. 640
  4872. ],
  4873. [
  4874. 8,
  4875. 576
  4876. ],
  4877. [
  4878. 8,
  4879. 576
  4880. ],
  4881. [
  4882. 9,
  4883. 832
  4884. ],
  4885. [
  4886. 9,
  4887. 896
  4888. ],
  4889. [
  4890. 9,
  4891. 960
  4892. ],
  4893. [
  4894. 9,
  4895. 1024
  4896. ],
  4897. [
  4898. 9,
  4899. 1088
  4900. ],
  4901. [
  4902. 9,
  4903. 1152
  4904. ],
  4905. [
  4906. 9,
  4907. 1216
  4908. ],
  4909. [
  4910. 9,
  4911. 1280
  4912. ],
  4913. [
  4914. 9,
  4915. 1344
  4916. ],
  4917. [
  4918. 9,
  4919. 1408
  4920. ],
  4921. [
  4922. 7,
  4923. 256
  4924. ],
  4925. [
  4926. 7,
  4927. 256
  4928. ],
  4929. [
  4930. 7,
  4931. 256
  4932. ],
  4933. [
  4934. 7,
  4935. 256
  4936. ],
  4937. [
  4938. 4,
  4939. 2
  4940. ],
  4941. [
  4942. 4,
  4943. 2
  4944. ],
  4945. [
  4946. 4,
  4947. 2
  4948. ],
  4949. [
  4950. 4,
  4951. 2
  4952. ],
  4953. [
  4954. 4,
  4955. 2
  4956. ],
  4957. [
  4958. 4,
  4959. 2
  4960. ],
  4961. [
  4962. 4,
  4963. 2
  4964. ],
  4965. [
  4966. 4,
  4967. 2
  4968. ],
  4969. [
  4970. 4,
  4971. 2
  4972. ],
  4973. [
  4974. 4,
  4975. 2
  4976. ],
  4977. [
  4978. 4,
  4979. 2
  4980. ],
  4981. [
  4982. 4,
  4983. 2
  4984. ],
  4985. [
  4986. 4,
  4987. 2
  4988. ],
  4989. [
  4990. 4,
  4991. 2
  4992. ],
  4993. [
  4994. 4,
  4995. 2
  4996. ],
  4997. [
  4998. 4,
  4999. 2
  5000. ],
  5001. [
  5002. 4,
  5003. 2
  5004. ],
  5005. [
  5006. 4,
  5007. 2
  5008. ],
  5009. [
  5010. 4,
  5011. 2
  5012. ],
  5013. [
  5014. 4,
  5015. 2
  5016. ],
  5017. [
  5018. 4,
  5019. 2
  5020. ],
  5021. [
  5022. 4,
  5023. 2
  5024. ],
  5025. [
  5026. 4,
  5027. 2
  5028. ],
  5029. [
  5030. 4,
  5031. 2
  5032. ],
  5033. [
  5034. 4,
  5035. 2
  5036. ],
  5037. [
  5038. 4,
  5039. 2
  5040. ],
  5041. [
  5042. 4,
  5043. 2
  5044. ],
  5045. [
  5046. 4,
  5047. 2
  5048. ],
  5049. [
  5050. 4,
  5051. 2
  5052. ],
  5053. [
  5054. 4,
  5055. 2
  5056. ],
  5057. [
  5058. 4,
  5059. 2
  5060. ],
  5061. [
  5062. 4,
  5063. 2
  5064. ],
  5065. [
  5066. 4,
  5067. 3
  5068. ],
  5069. [
  5070. 4,
  5071. 3
  5072. ],
  5073. [
  5074. 4,
  5075. 3
  5076. ],
  5077. [
  5078. 4,
  5079. 3
  5080. ],
  5081. [
  5082. 4,
  5083. 3
  5084. ],
  5085. [
  5086. 4,
  5087. 3
  5088. ],
  5089. [
  5090. 4,
  5091. 3
  5092. ],
  5093. [
  5094. 4,
  5095. 3
  5096. ],
  5097. [
  5098. 4,
  5099. 3
  5100. ],
  5101. [
  5102. 4,
  5103. 3
  5104. ],
  5105. [
  5106. 4,
  5107. 3
  5108. ],
  5109. [
  5110. 4,
  5111. 3
  5112. ],
  5113. [
  5114. 4,
  5115. 3
  5116. ],
  5117. [
  5118. 4,
  5119. 3
  5120. ],
  5121. [
  5122. 4,
  5123. 3
  5124. ],
  5125. [
  5126. 4,
  5127. 3
  5128. ],
  5129. [
  5130. 4,
  5131. 3
  5132. ],
  5133. [
  5134. 4,
  5135. 3
  5136. ],
  5137. [
  5138. 4,
  5139. 3
  5140. ],
  5141. [
  5142. 4,
  5143. 3
  5144. ],
  5145. [
  5146. 4,
  5147. 3
  5148. ],
  5149. [
  5150. 4,
  5151. 3
  5152. ],
  5153. [
  5154. 4,
  5155. 3
  5156. ],
  5157. [
  5158. 4,
  5159. 3
  5160. ],
  5161. [
  5162. 4,
  5163. 3
  5164. ],
  5165. [
  5166. 4,
  5167. 3
  5168. ],
  5169. [
  5170. 4,
  5171. 3
  5172. ],
  5173. [
  5174. 4,
  5175. 3
  5176. ],
  5177. [
  5178. 4,
  5179. 3
  5180. ],
  5181. [
  5182. 4,
  5183. 3
  5184. ],
  5185. [
  5186. 4,
  5187. 3
  5188. ],
  5189. [
  5190. 4,
  5191. 3
  5192. ],
  5193. [
  5194. 5,
  5195. 128
  5196. ],
  5197. [
  5198. 5,
  5199. 128
  5200. ],
  5201. [
  5202. 5,
  5203. 128
  5204. ],
  5205. [
  5206. 5,
  5207. 128
  5208. ],
  5209. [
  5210. 5,
  5211. 128
  5212. ],
  5213. [
  5214. 5,
  5215. 128
  5216. ],
  5217. [
  5218. 5,
  5219. 128
  5220. ],
  5221. [
  5222. 5,
  5223. 128
  5224. ],
  5225. [
  5226. 5,
  5227. 128
  5228. ],
  5229. [
  5230. 5,
  5231. 128
  5232. ],
  5233. [
  5234. 5,
  5235. 128
  5236. ],
  5237. [
  5238. 5,
  5239. 128
  5240. ],
  5241. [
  5242. 5,
  5243. 128
  5244. ],
  5245. [
  5246. 5,
  5247. 128
  5248. ],
  5249. [
  5250. 5,
  5251. 128
  5252. ],
  5253. [
  5254. 5,
  5255. 128
  5256. ],
  5257. [
  5258. 5,
  5259. 8
  5260. ],
  5261. [
  5262. 5,
  5263. 8
  5264. ],
  5265. [
  5266. 5,
  5267. 8
  5268. ],
  5269. [
  5270. 5,
  5271. 8
  5272. ],
  5273. [
  5274. 5,
  5275. 8
  5276. ],
  5277. [
  5278. 5,
  5279. 8
  5280. ],
  5281. [
  5282. 5,
  5283. 8
  5284. ],
  5285. [
  5286. 5,
  5287. 8
  5288. ],
  5289. [
  5290. 5,
  5291. 8
  5292. ],
  5293. [
  5294. 5,
  5295. 8
  5296. ],
  5297. [
  5298. 5,
  5299. 8
  5300. ],
  5301. [
  5302. 5,
  5303. 8
  5304. ],
  5305. [
  5306. 5,
  5307. 8
  5308. ],
  5309. [
  5310. 5,
  5311. 8
  5312. ],
  5313. [
  5314. 5,
  5315. 8
  5316. ],
  5317. [
  5318. 5,
  5319. 8
  5320. ],
  5321. [
  5322. 5,
  5323. 9
  5324. ],
  5325. [
  5326. 5,
  5327. 9
  5328. ],
  5329. [
  5330. 5,
  5331. 9
  5332. ],
  5333. [
  5334. 5,
  5335. 9
  5336. ],
  5337. [
  5338. 5,
  5339. 9
  5340. ],
  5341. [
  5342. 5,
  5343. 9
  5344. ],
  5345. [
  5346. 5,
  5347. 9
  5348. ],
  5349. [
  5350. 5,
  5351. 9
  5352. ],
  5353. [
  5354. 5,
  5355. 9
  5356. ],
  5357. [
  5358. 5,
  5359. 9
  5360. ],
  5361. [
  5362. 5,
  5363. 9
  5364. ],
  5365. [
  5366. 5,
  5367. 9
  5368. ],
  5369. [
  5370. 5,
  5371. 9
  5372. ],
  5373. [
  5374. 5,
  5375. 9
  5376. ],
  5377. [
  5378. 5,
  5379. 9
  5380. ],
  5381. [
  5382. 5,
  5383. 9
  5384. ],
  5385. [
  5386. 6,
  5387. 16
  5388. ],
  5389. [
  5390. 6,
  5391. 16
  5392. ],
  5393. [
  5394. 6,
  5395. 16
  5396. ],
  5397. [
  5398. 6,
  5399. 16
  5400. ],
  5401. [
  5402. 6,
  5403. 16
  5404. ],
  5405. [
  5406. 6,
  5407. 16
  5408. ],
  5409. [
  5410. 6,
  5411. 16
  5412. ],
  5413. [
  5414. 6,
  5415. 16
  5416. ],
  5417. [
  5418. 6,
  5419. 17
  5420. ],
  5421. [
  5422. 6,
  5423. 17
  5424. ],
  5425. [
  5426. 6,
  5427. 17
  5428. ],
  5429. [
  5430. 6,
  5431. 17
  5432. ],
  5433. [
  5434. 6,
  5435. 17
  5436. ],
  5437. [
  5438. 6,
  5439. 17
  5440. ],
  5441. [
  5442. 6,
  5443. 17
  5444. ],
  5445. [
  5446. 6,
  5447. 17
  5448. ],
  5449. [
  5450. 4,
  5451. 4
  5452. ],
  5453. [
  5454. 4,
  5455. 4
  5456. ],
  5457. [
  5458. 4,
  5459. 4
  5460. ],
  5461. [
  5462. 4,
  5463. 4
  5464. ],
  5465. [
  5466. 4,
  5467. 4
  5468. ],
  5469. [
  5470. 4,
  5471. 4
  5472. ],
  5473. [
  5474. 4,
  5475. 4
  5476. ],
  5477. [
  5478. 4,
  5479. 4
  5480. ],
  5481. [
  5482. 4,
  5483. 4
  5484. ],
  5485. [
  5486. 4,
  5487. 4
  5488. ],
  5489. [
  5490. 4,
  5491. 4
  5492. ],
  5493. [
  5494. 4,
  5495. 4
  5496. ],
  5497. [
  5498. 4,
  5499. 4
  5500. ],
  5501. [
  5502. 4,
  5503. 4
  5504. ],
  5505. [
  5506. 4,
  5507. 4
  5508. ],
  5509. [
  5510. 4,
  5511. 4
  5512. ],
  5513. [
  5514. 4,
  5515. 4
  5516. ],
  5517. [
  5518. 4,
  5519. 4
  5520. ],
  5521. [
  5522. 4,
  5523. 4
  5524. ],
  5525. [
  5526. 4,
  5527. 4
  5528. ],
  5529. [
  5530. 4,
  5531. 4
  5532. ],
  5533. [
  5534. 4,
  5535. 4
  5536. ],
  5537. [
  5538. 4,
  5539. 4
  5540. ],
  5541. [
  5542. 4,
  5543. 4
  5544. ],
  5545. [
  5546. 4,
  5547. 4
  5548. ],
  5549. [
  5550. 4,
  5551. 4
  5552. ],
  5553. [
  5554. 4,
  5555. 4
  5556. ],
  5557. [
  5558. 4,
  5559. 4
  5560. ],
  5561. [
  5562. 4,
  5563. 4
  5564. ],
  5565. [
  5566. 4,
  5567. 4
  5568. ],
  5569. [
  5570. 4,
  5571. 4
  5572. ],
  5573. [
  5574. 4,
  5575. 4
  5576. ],
  5577. [
  5578. 4,
  5579. 5
  5580. ],
  5581. [
  5582. 4,
  5583. 5
  5584. ],
  5585. [
  5586. 4,
  5587. 5
  5588. ],
  5589. [
  5590. 4,
  5591. 5
  5592. ],
  5593. [
  5594. 4,
  5595. 5
  5596. ],
  5597. [
  5598. 4,
  5599. 5
  5600. ],
  5601. [
  5602. 4,
  5603. 5
  5604. ],
  5605. [
  5606. 4,
  5607. 5
  5608. ],
  5609. [
  5610. 4,
  5611. 5
  5612. ],
  5613. [
  5614. 4,
  5615. 5
  5616. ],
  5617. [
  5618. 4,
  5619. 5
  5620. ],
  5621. [
  5622. 4,
  5623. 5
  5624. ],
  5625. [
  5626. 4,
  5627. 5
  5628. ],
  5629. [
  5630. 4,
  5631. 5
  5632. ],
  5633. [
  5634. 4,
  5635. 5
  5636. ],
  5637. [
  5638. 4,
  5639. 5
  5640. ],
  5641. [
  5642. 4,
  5643. 5
  5644. ],
  5645. [
  5646. 4,
  5647. 5
  5648. ],
  5649. [
  5650. 4,
  5651. 5
  5652. ],
  5653. [
  5654. 4,
  5655. 5
  5656. ],
  5657. [
  5658. 4,
  5659. 5
  5660. ],
  5661. [
  5662. 4,
  5663. 5
  5664. ],
  5665. [
  5666. 4,
  5667. 5
  5668. ],
  5669. [
  5670. 4,
  5671. 5
  5672. ],
  5673. [
  5674. 4,
  5675. 5
  5676. ],
  5677. [
  5678. 4,
  5679. 5
  5680. ],
  5681. [
  5682. 4,
  5683. 5
  5684. ],
  5685. [
  5686. 4,
  5687. 5
  5688. ],
  5689. [
  5690. 4,
  5691. 5
  5692. ],
  5693. [
  5694. 4,
  5695. 5
  5696. ],
  5697. [
  5698. 4,
  5699. 5
  5700. ],
  5701. [
  5702. 4,
  5703. 5
  5704. ],
  5705. [
  5706. 6,
  5707. 14
  5708. ],
  5709. [
  5710. 6,
  5711. 14
  5712. ],
  5713. [
  5714. 6,
  5715. 14
  5716. ],
  5717. [
  5718. 6,
  5719. 14
  5720. ],
  5721. [
  5722. 6,
  5723. 14
  5724. ],
  5725. [
  5726. 6,
  5727. 14
  5728. ],
  5729. [
  5730. 6,
  5731. 14
  5732. ],
  5733. [
  5734. 6,
  5735. 14
  5736. ],
  5737. [
  5738. 6,
  5739. 15
  5740. ],
  5741. [
  5742. 6,
  5743. 15
  5744. ],
  5745. [
  5746. 6,
  5747. 15
  5748. ],
  5749. [
  5750. 6,
  5751. 15
  5752. ],
  5753. [
  5754. 6,
  5755. 15
  5756. ],
  5757. [
  5758. 6,
  5759. 15
  5760. ],
  5761. [
  5762. 6,
  5763. 15
  5764. ],
  5765. [
  5766. 6,
  5767. 15
  5768. ],
  5769. [
  5770. 5,
  5771. 64
  5772. ],
  5773. [
  5774. 5,
  5775. 64
  5776. ],
  5777. [
  5778. 5,
  5779. 64
  5780. ],
  5781. [
  5782. 5,
  5783. 64
  5784. ],
  5785. [
  5786. 5,
  5787. 64
  5788. ],
  5789. [
  5790. 5,
  5791. 64
  5792. ],
  5793. [
  5794. 5,
  5795. 64
  5796. ],
  5797. [
  5798. 5,
  5799. 64
  5800. ],
  5801. [
  5802. 5,
  5803. 64
  5804. ],
  5805. [
  5806. 5,
  5807. 64
  5808. ],
  5809. [
  5810. 5,
  5811. 64
  5812. ],
  5813. [
  5814. 5,
  5815. 64
  5816. ],
  5817. [
  5818. 5,
  5819. 64
  5820. ],
  5821. [
  5822. 5,
  5823. 64
  5824. ],
  5825. [
  5826. 5,
  5827. 64
  5828. ],
  5829. [
  5830. 5,
  5831. 64
  5832. ],
  5833. [
  5834. 4,
  5835. 6
  5836. ],
  5837. [
  5838. 4,
  5839. 6
  5840. ],
  5841. [
  5842. 4,
  5843. 6
  5844. ],
  5845. [
  5846. 4,
  5847. 6
  5848. ],
  5849. [
  5850. 4,
  5851. 6
  5852. ],
  5853. [
  5854. 4,
  5855. 6
  5856. ],
  5857. [
  5858. 4,
  5859. 6
  5860. ],
  5861. [
  5862. 4,
  5863. 6
  5864. ],
  5865. [
  5866. 4,
  5867. 6
  5868. ],
  5869. [
  5870. 4,
  5871. 6
  5872. ],
  5873. [
  5874. 4,
  5875. 6
  5876. ],
  5877. [
  5878. 4,
  5879. 6
  5880. ],
  5881. [
  5882. 4,
  5883. 6
  5884. ],
  5885. [
  5886. 4,
  5887. 6
  5888. ],
  5889. [
  5890. 4,
  5891. 6
  5892. ],
  5893. [
  5894. 4,
  5895. 6
  5896. ],
  5897. [
  5898. 4,
  5899. 6
  5900. ],
  5901. [
  5902. 4,
  5903. 6
  5904. ],
  5905. [
  5906. 4,
  5907. 6
  5908. ],
  5909. [
  5910. 4,
  5911. 6
  5912. ],
  5913. [
  5914. 4,
  5915. 6
  5916. ],
  5917. [
  5918. 4,
  5919. 6
  5920. ],
  5921. [
  5922. 4,
  5923. 6
  5924. ],
  5925. [
  5926. 4,
  5927. 6
  5928. ],
  5929. [
  5930. 4,
  5931. 6
  5932. ],
  5933. [
  5934. 4,
  5935. 6
  5936. ],
  5937. [
  5938. 4,
  5939. 6
  5940. ],
  5941. [
  5942. 4,
  5943. 6
  5944. ],
  5945. [
  5946. 4,
  5947. 6
  5948. ],
  5949. [
  5950. 4,
  5951. 6
  5952. ],
  5953. [
  5954. 4,
  5955. 6
  5956. ],
  5957. [
  5958. 4,
  5959. 6
  5960. ],
  5961. [
  5962. 4,
  5963. 7
  5964. ],
  5965. [
  5966. 4,
  5967. 7
  5968. ],
  5969. [
  5970. 4,
  5971. 7
  5972. ],
  5973. [
  5974. 4,
  5975. 7
  5976. ],
  5977. [
  5978. 4,
  5979. 7
  5980. ],
  5981. [
  5982. 4,
  5983. 7
  5984. ],
  5985. [
  5986. 4,
  5987. 7
  5988. ],
  5989. [
  5990. 4,
  5991. 7
  5992. ],
  5993. [
  5994. 4,
  5995. 7
  5996. ],
  5997. [
  5998. 4,
  5999. 7
  6000. ],
  6001. [
  6002. 4,
  6003. 7
  6004. ],
  6005. [
  6006. 4,
  6007. 7
  6008. ],
  6009. [
  6010. 4,
  6011. 7
  6012. ],
  6013. [
  6014. 4,
  6015. 7
  6016. ],
  6017. [
  6018. 4,
  6019. 7
  6020. ],
  6021. [
  6022. 4,
  6023. 7
  6024. ],
  6025. [
  6026. 4,
  6027. 7
  6028. ],
  6029. [
  6030. 4,
  6031. 7
  6032. ],
  6033. [
  6034. 4,
  6035. 7
  6036. ],
  6037. [
  6038. 4,
  6039. 7
  6040. ],
  6041. [
  6042. 4,
  6043. 7
  6044. ],
  6045. [
  6046. 4,
  6047. 7
  6048. ],
  6049. [
  6050. 4,
  6051. 7
  6052. ],
  6053. [
  6054. 4,
  6055. 7
  6056. ],
  6057. [
  6058. 4,
  6059. 7
  6060. ],
  6061. [
  6062. 4,
  6063. 7
  6064. ],
  6065. [
  6066. 4,
  6067. 7
  6068. ],
  6069. [
  6070. 4,
  6071. 7
  6072. ],
  6073. [
  6074. 4,
  6075. 7
  6076. ],
  6077. [
  6078. 4,
  6079. 7
  6080. ],
  6081. [
  6082. 4,
  6083. 7
  6084. ],
  6085. [
  6086. 4,
  6087. 7
  6088. ]
  6089. ];
  6090. var blackTable1 = [
  6091. [
  6092. -1,
  6093. -1
  6094. ],
  6095. [
  6096. -1,
  6097. -1
  6098. ],
  6099. [
  6100. 12,
  6101. ccittEOL
  6102. ],
  6103. [
  6104. 12,
  6105. ccittEOL
  6106. ],
  6107. [
  6108. -1,
  6109. -1
  6110. ],
  6111. [
  6112. -1,
  6113. -1
  6114. ],
  6115. [
  6116. -1,
  6117. -1
  6118. ],
  6119. [
  6120. -1,
  6121. -1
  6122. ],
  6123. [
  6124. -1,
  6125. -1
  6126. ],
  6127. [
  6128. -1,
  6129. -1
  6130. ],
  6131. [
  6132. -1,
  6133. -1
  6134. ],
  6135. [
  6136. -1,
  6137. -1
  6138. ],
  6139. [
  6140. -1,
  6141. -1
  6142. ],
  6143. [
  6144. -1,
  6145. -1
  6146. ],
  6147. [
  6148. -1,
  6149. -1
  6150. ],
  6151. [
  6152. -1,
  6153. -1
  6154. ],
  6155. [
  6156. -1,
  6157. -1
  6158. ],
  6159. [
  6160. -1,
  6161. -1
  6162. ],
  6163. [
  6164. -1,
  6165. -1
  6166. ],
  6167. [
  6168. -1,
  6169. -1
  6170. ],
  6171. [
  6172. -1,
  6173. -1
  6174. ],
  6175. [
  6176. -1,
  6177. -1
  6178. ],
  6179. [
  6180. -1,
  6181. -1
  6182. ],
  6183. [
  6184. -1,
  6185. -1
  6186. ],
  6187. [
  6188. -1,
  6189. -1
  6190. ],
  6191. [
  6192. -1,
  6193. -1
  6194. ],
  6195. [
  6196. -1,
  6197. -1
  6198. ],
  6199. [
  6200. -1,
  6201. -1
  6202. ],
  6203. [
  6204. -1,
  6205. -1
  6206. ],
  6207. [
  6208. -1,
  6209. -1
  6210. ],
  6211. [
  6212. -1,
  6213. -1
  6214. ],
  6215. [
  6216. -1,
  6217. -1
  6218. ],
  6219. [
  6220. 11,
  6221. 1792
  6222. ],
  6223. [
  6224. 11,
  6225. 1792
  6226. ],
  6227. [
  6228. 11,
  6229. 1792
  6230. ],
  6231. [
  6232. 11,
  6233. 1792
  6234. ],
  6235. [
  6236. 12,
  6237. 1984
  6238. ],
  6239. [
  6240. 12,
  6241. 1984
  6242. ],
  6243. [
  6244. 12,
  6245. 2048
  6246. ],
  6247. [
  6248. 12,
  6249. 2048
  6250. ],
  6251. [
  6252. 12,
  6253. 2112
  6254. ],
  6255. [
  6256. 12,
  6257. 2112
  6258. ],
  6259. [
  6260. 12,
  6261. 2176
  6262. ],
  6263. [
  6264. 12,
  6265. 2176
  6266. ],
  6267. [
  6268. 12,
  6269. 2240
  6270. ],
  6271. [
  6272. 12,
  6273. 2240
  6274. ],
  6275. [
  6276. 12,
  6277. 2304
  6278. ],
  6279. [
  6280. 12,
  6281. 2304
  6282. ],
  6283. [
  6284. 11,
  6285. 1856
  6286. ],
  6287. [
  6288. 11,
  6289. 1856
  6290. ],
  6291. [
  6292. 11,
  6293. 1856
  6294. ],
  6295. [
  6296. 11,
  6297. 1856
  6298. ],
  6299. [
  6300. 11,
  6301. 1920
  6302. ],
  6303. [
  6304. 11,
  6305. 1920
  6306. ],
  6307. [
  6308. 11,
  6309. 1920
  6310. ],
  6311. [
  6312. 11,
  6313. 1920
  6314. ],
  6315. [
  6316. 12,
  6317. 2368
  6318. ],
  6319. [
  6320. 12,
  6321. 2368
  6322. ],
  6323. [
  6324. 12,
  6325. 2432
  6326. ],
  6327. [
  6328. 12,
  6329. 2432
  6330. ],
  6331. [
  6332. 12,
  6333. 2496
  6334. ],
  6335. [
  6336. 12,
  6337. 2496
  6338. ],
  6339. [
  6340. 12,
  6341. 2560
  6342. ],
  6343. [
  6344. 12,
  6345. 2560
  6346. ],
  6347. [
  6348. 10,
  6349. 18
  6350. ],
  6351. [
  6352. 10,
  6353. 18
  6354. ],
  6355. [
  6356. 10,
  6357. 18
  6358. ],
  6359. [
  6360. 10,
  6361. 18
  6362. ],
  6363. [
  6364. 10,
  6365. 18
  6366. ],
  6367. [
  6368. 10,
  6369. 18
  6370. ],
  6371. [
  6372. 10,
  6373. 18
  6374. ],
  6375. [
  6376. 10,
  6377. 18
  6378. ],
  6379. [
  6380. 12,
  6381. 52
  6382. ],
  6383. [
  6384. 12,
  6385. 52
  6386. ],
  6387. [
  6388. 13,
  6389. 640
  6390. ],
  6391. [
  6392. 13,
  6393. 704
  6394. ],
  6395. [
  6396. 13,
  6397. 768
  6398. ],
  6399. [
  6400. 13,
  6401. 832
  6402. ],
  6403. [
  6404. 12,
  6405. 55
  6406. ],
  6407. [
  6408. 12,
  6409. 55
  6410. ],
  6411. [
  6412. 12,
  6413. 56
  6414. ],
  6415. [
  6416. 12,
  6417. 56
  6418. ],
  6419. [
  6420. 13,
  6421. 1280
  6422. ],
  6423. [
  6424. 13,
  6425. 1344
  6426. ],
  6427. [
  6428. 13,
  6429. 1408
  6430. ],
  6431. [
  6432. 13,
  6433. 1472
  6434. ],
  6435. [
  6436. 12,
  6437. 59
  6438. ],
  6439. [
  6440. 12,
  6441. 59
  6442. ],
  6443. [
  6444. 12,
  6445. 60
  6446. ],
  6447. [
  6448. 12,
  6449. 60
  6450. ],
  6451. [
  6452. 13,
  6453. 1536
  6454. ],
  6455. [
  6456. 13,
  6457. 1600
  6458. ],
  6459. [
  6460. 11,
  6461. 24
  6462. ],
  6463. [
  6464. 11,
  6465. 24
  6466. ],
  6467. [
  6468. 11,
  6469. 24
  6470. ],
  6471. [
  6472. 11,
  6473. 24
  6474. ],
  6475. [
  6476. 11,
  6477. 25
  6478. ],
  6479. [
  6480. 11,
  6481. 25
  6482. ],
  6483. [
  6484. 11,
  6485. 25
  6486. ],
  6487. [
  6488. 11,
  6489. 25
  6490. ],
  6491. [
  6492. 13,
  6493. 1664
  6494. ],
  6495. [
  6496. 13,
  6497. 1728
  6498. ],
  6499. [
  6500. 12,
  6501. 320
  6502. ],
  6503. [
  6504. 12,
  6505. 320
  6506. ],
  6507. [
  6508. 12,
  6509. 384
  6510. ],
  6511. [
  6512. 12,
  6513. 384
  6514. ],
  6515. [
  6516. 12,
  6517. 448
  6518. ],
  6519. [
  6520. 12,
  6521. 448
  6522. ],
  6523. [
  6524. 13,
  6525. 512
  6526. ],
  6527. [
  6528. 13,
  6529. 576
  6530. ],
  6531. [
  6532. 12,
  6533. 53
  6534. ],
  6535. [
  6536. 12,
  6537. 53
  6538. ],
  6539. [
  6540. 12,
  6541. 54
  6542. ],
  6543. [
  6544. 12,
  6545. 54
  6546. ],
  6547. [
  6548. 13,
  6549. 896
  6550. ],
  6551. [
  6552. 13,
  6553. 960
  6554. ],
  6555. [
  6556. 13,
  6557. 1024
  6558. ],
  6559. [
  6560. 13,
  6561. 1088
  6562. ],
  6563. [
  6564. 13,
  6565. 1152
  6566. ],
  6567. [
  6568. 13,
  6569. 1216
  6570. ],
  6571. [
  6572. 10,
  6573. 64
  6574. ],
  6575. [
  6576. 10,
  6577. 64
  6578. ],
  6579. [
  6580. 10,
  6581. 64
  6582. ],
  6583. [
  6584. 10,
  6585. 64
  6586. ],
  6587. [
  6588. 10,
  6589. 64
  6590. ],
  6591. [
  6592. 10,
  6593. 64
  6594. ],
  6595. [
  6596. 10,
  6597. 64
  6598. ],
  6599. [
  6600. 10,
  6601. 64
  6602. ]
  6603. ];
  6604. var blackTable2 = [
  6605. [
  6606. 8,
  6607. 13
  6608. ],
  6609. [
  6610. 8,
  6611. 13
  6612. ],
  6613. [
  6614. 8,
  6615. 13
  6616. ],
  6617. [
  6618. 8,
  6619. 13
  6620. ],
  6621. [
  6622. 8,
  6623. 13
  6624. ],
  6625. [
  6626. 8,
  6627. 13
  6628. ],
  6629. [
  6630. 8,
  6631. 13
  6632. ],
  6633. [
  6634. 8,
  6635. 13
  6636. ],
  6637. [
  6638. 8,
  6639. 13
  6640. ],
  6641. [
  6642. 8,
  6643. 13
  6644. ],
  6645. [
  6646. 8,
  6647. 13
  6648. ],
  6649. [
  6650. 8,
  6651. 13
  6652. ],
  6653. [
  6654. 8,
  6655. 13
  6656. ],
  6657. [
  6658. 8,
  6659. 13
  6660. ],
  6661. [
  6662. 8,
  6663. 13
  6664. ],
  6665. [
  6666. 8,
  6667. 13
  6668. ],
  6669. [
  6670. 11,
  6671. 23
  6672. ],
  6673. [
  6674. 11,
  6675. 23
  6676. ],
  6677. [
  6678. 12,
  6679. 50
  6680. ],
  6681. [
  6682. 12,
  6683. 51
  6684. ],
  6685. [
  6686. 12,
  6687. 44
  6688. ],
  6689. [
  6690. 12,
  6691. 45
  6692. ],
  6693. [
  6694. 12,
  6695. 46
  6696. ],
  6697. [
  6698. 12,
  6699. 47
  6700. ],
  6701. [
  6702. 12,
  6703. 57
  6704. ],
  6705. [
  6706. 12,
  6707. 58
  6708. ],
  6709. [
  6710. 12,
  6711. 61
  6712. ],
  6713. [
  6714. 12,
  6715. 256
  6716. ],
  6717. [
  6718. 10,
  6719. 16
  6720. ],
  6721. [
  6722. 10,
  6723. 16
  6724. ],
  6725. [
  6726. 10,
  6727. 16
  6728. ],
  6729. [
  6730. 10,
  6731. 16
  6732. ],
  6733. [
  6734. 10,
  6735. 17
  6736. ],
  6737. [
  6738. 10,
  6739. 17
  6740. ],
  6741. [
  6742. 10,
  6743. 17
  6744. ],
  6745. [
  6746. 10,
  6747. 17
  6748. ],
  6749. [
  6750. 12,
  6751. 48
  6752. ],
  6753. [
  6754. 12,
  6755. 49
  6756. ],
  6757. [
  6758. 12,
  6759. 62
  6760. ],
  6761. [
  6762. 12,
  6763. 63
  6764. ],
  6765. [
  6766. 12,
  6767. 30
  6768. ],
  6769. [
  6770. 12,
  6771. 31
  6772. ],
  6773. [
  6774. 12,
  6775. 32
  6776. ],
  6777. [
  6778. 12,
  6779. 33
  6780. ],
  6781. [
  6782. 12,
  6783. 40
  6784. ],
  6785. [
  6786. 12,
  6787. 41
  6788. ],
  6789. [
  6790. 11,
  6791. 22
  6792. ],
  6793. [
  6794. 11,
  6795. 22
  6796. ],
  6797. [
  6798. 8,
  6799. 14
  6800. ],
  6801. [
  6802. 8,
  6803. 14
  6804. ],
  6805. [
  6806. 8,
  6807. 14
  6808. ],
  6809. [
  6810. 8,
  6811. 14
  6812. ],
  6813. [
  6814. 8,
  6815. 14
  6816. ],
  6817. [
  6818. 8,
  6819. 14
  6820. ],
  6821. [
  6822. 8,
  6823. 14
  6824. ],
  6825. [
  6826. 8,
  6827. 14
  6828. ],
  6829. [
  6830. 8,
  6831. 14
  6832. ],
  6833. [
  6834. 8,
  6835. 14
  6836. ],
  6837. [
  6838. 8,
  6839. 14
  6840. ],
  6841. [
  6842. 8,
  6843. 14
  6844. ],
  6845. [
  6846. 8,
  6847. 14
  6848. ],
  6849. [
  6850. 8,
  6851. 14
  6852. ],
  6853. [
  6854. 8,
  6855. 14
  6856. ],
  6857. [
  6858. 8,
  6859. 14
  6860. ],
  6861. [
  6862. 7,
  6863. 10
  6864. ],
  6865. [
  6866. 7,
  6867. 10
  6868. ],
  6869. [
  6870. 7,
  6871. 10
  6872. ],
  6873. [
  6874. 7,
  6875. 10
  6876. ],
  6877. [
  6878. 7,
  6879. 10
  6880. ],
  6881. [
  6882. 7,
  6883. 10
  6884. ],
  6885. [
  6886. 7,
  6887. 10
  6888. ],
  6889. [
  6890. 7,
  6891. 10
  6892. ],
  6893. [
  6894. 7,
  6895. 10
  6896. ],
  6897. [
  6898. 7,
  6899. 10
  6900. ],
  6901. [
  6902. 7,
  6903. 10
  6904. ],
  6905. [
  6906. 7,
  6907. 10
  6908. ],
  6909. [
  6910. 7,
  6911. 10
  6912. ],
  6913. [
  6914. 7,
  6915. 10
  6916. ],
  6917. [
  6918. 7,
  6919. 10
  6920. ],
  6921. [
  6922. 7,
  6923. 10
  6924. ],
  6925. [
  6926. 7,
  6927. 10
  6928. ],
  6929. [
  6930. 7,
  6931. 10
  6932. ],
  6933. [
  6934. 7,
  6935. 10
  6936. ],
  6937. [
  6938. 7,
  6939. 10
  6940. ],
  6941. [
  6942. 7,
  6943. 10
  6944. ],
  6945. [
  6946. 7,
  6947. 10
  6948. ],
  6949. [
  6950. 7,
  6951. 10
  6952. ],
  6953. [
  6954. 7,
  6955. 10
  6956. ],
  6957. [
  6958. 7,
  6959. 10
  6960. ],
  6961. [
  6962. 7,
  6963. 10
  6964. ],
  6965. [
  6966. 7,
  6967. 10
  6968. ],
  6969. [
  6970. 7,
  6971. 10
  6972. ],
  6973. [
  6974. 7,
  6975. 10
  6976. ],
  6977. [
  6978. 7,
  6979. 10
  6980. ],
  6981. [
  6982. 7,
  6983. 10
  6984. ],
  6985. [
  6986. 7,
  6987. 10
  6988. ],
  6989. [
  6990. 7,
  6991. 11
  6992. ],
  6993. [
  6994. 7,
  6995. 11
  6996. ],
  6997. [
  6998. 7,
  6999. 11
  7000. ],
  7001. [
  7002. 7,
  7003. 11
  7004. ],
  7005. [
  7006. 7,
  7007. 11
  7008. ],
  7009. [
  7010. 7,
  7011. 11
  7012. ],
  7013. [
  7014. 7,
  7015. 11
  7016. ],
  7017. [
  7018. 7,
  7019. 11
  7020. ],
  7021. [
  7022. 7,
  7023. 11
  7024. ],
  7025. [
  7026. 7,
  7027. 11
  7028. ],
  7029. [
  7030. 7,
  7031. 11
  7032. ],
  7033. [
  7034. 7,
  7035. 11
  7036. ],
  7037. [
  7038. 7,
  7039. 11
  7040. ],
  7041. [
  7042. 7,
  7043. 11
  7044. ],
  7045. [
  7046. 7,
  7047. 11
  7048. ],
  7049. [
  7050. 7,
  7051. 11
  7052. ],
  7053. [
  7054. 7,
  7055. 11
  7056. ],
  7057. [
  7058. 7,
  7059. 11
  7060. ],
  7061. [
  7062. 7,
  7063. 11
  7064. ],
  7065. [
  7066. 7,
  7067. 11
  7068. ],
  7069. [
  7070. 7,
  7071. 11
  7072. ],
  7073. [
  7074. 7,
  7075. 11
  7076. ],
  7077. [
  7078. 7,
  7079. 11
  7080. ],
  7081. [
  7082. 7,
  7083. 11
  7084. ],
  7085. [
  7086. 7,
  7087. 11
  7088. ],
  7089. [
  7090. 7,
  7091. 11
  7092. ],
  7093. [
  7094. 7,
  7095. 11
  7096. ],
  7097. [
  7098. 7,
  7099. 11
  7100. ],
  7101. [
  7102. 7,
  7103. 11
  7104. ],
  7105. [
  7106. 7,
  7107. 11
  7108. ],
  7109. [
  7110. 7,
  7111. 11
  7112. ],
  7113. [
  7114. 7,
  7115. 11
  7116. ],
  7117. [
  7118. 9,
  7119. 15
  7120. ],
  7121. [
  7122. 9,
  7123. 15
  7124. ],
  7125. [
  7126. 9,
  7127. 15
  7128. ],
  7129. [
  7130. 9,
  7131. 15
  7132. ],
  7133. [
  7134. 9,
  7135. 15
  7136. ],
  7137. [
  7138. 9,
  7139. 15
  7140. ],
  7141. [
  7142. 9,
  7143. 15
  7144. ],
  7145. [
  7146. 9,
  7147. 15
  7148. ],
  7149. [
  7150. 12,
  7151. 128
  7152. ],
  7153. [
  7154. 12,
  7155. 192
  7156. ],
  7157. [
  7158. 12,
  7159. 26
  7160. ],
  7161. [
  7162. 12,
  7163. 27
  7164. ],
  7165. [
  7166. 12,
  7167. 28
  7168. ],
  7169. [
  7170. 12,
  7171. 29
  7172. ],
  7173. [
  7174. 11,
  7175. 19
  7176. ],
  7177. [
  7178. 11,
  7179. 19
  7180. ],
  7181. [
  7182. 11,
  7183. 20
  7184. ],
  7185. [
  7186. 11,
  7187. 20
  7188. ],
  7189. [
  7190. 12,
  7191. 34
  7192. ],
  7193. [
  7194. 12,
  7195. 35
  7196. ],
  7197. [
  7198. 12,
  7199. 36
  7200. ],
  7201. [
  7202. 12,
  7203. 37
  7204. ],
  7205. [
  7206. 12,
  7207. 38
  7208. ],
  7209. [
  7210. 12,
  7211. 39
  7212. ],
  7213. [
  7214. 11,
  7215. 21
  7216. ],
  7217. [
  7218. 11,
  7219. 21
  7220. ],
  7221. [
  7222. 12,
  7223. 42
  7224. ],
  7225. [
  7226. 12,
  7227. 43
  7228. ],
  7229. [
  7230. 10,
  7231. 0
  7232. ],
  7233. [
  7234. 10,
  7235. 0
  7236. ],
  7237. [
  7238. 10,
  7239. 0
  7240. ],
  7241. [
  7242. 10,
  7243. 0
  7244. ],
  7245. [
  7246. 7,
  7247. 12
  7248. ],
  7249. [
  7250. 7,
  7251. 12
  7252. ],
  7253. [
  7254. 7,
  7255. 12
  7256. ],
  7257. [
  7258. 7,
  7259. 12
  7260. ],
  7261. [
  7262. 7,
  7263. 12
  7264. ],
  7265. [
  7266. 7,
  7267. 12
  7268. ],
  7269. [
  7270. 7,
  7271. 12
  7272. ],
  7273. [
  7274. 7,
  7275. 12
  7276. ],
  7277. [
  7278. 7,
  7279. 12
  7280. ],
  7281. [
  7282. 7,
  7283. 12
  7284. ],
  7285. [
  7286. 7,
  7287. 12
  7288. ],
  7289. [
  7290. 7,
  7291. 12
  7292. ],
  7293. [
  7294. 7,
  7295. 12
  7296. ],
  7297. [
  7298. 7,
  7299. 12
  7300. ],
  7301. [
  7302. 7,
  7303. 12
  7304. ],
  7305. [
  7306. 7,
  7307. 12
  7308. ],
  7309. [
  7310. 7,
  7311. 12
  7312. ],
  7313. [
  7314. 7,
  7315. 12
  7316. ],
  7317. [
  7318. 7,
  7319. 12
  7320. ],
  7321. [
  7322. 7,
  7323. 12
  7324. ],
  7325. [
  7326. 7,
  7327. 12
  7328. ],
  7329. [
  7330. 7,
  7331. 12
  7332. ],
  7333. [
  7334. 7,
  7335. 12
  7336. ],
  7337. [
  7338. 7,
  7339. 12
  7340. ],
  7341. [
  7342. 7,
  7343. 12
  7344. ],
  7345. [
  7346. 7,
  7347. 12
  7348. ],
  7349. [
  7350. 7,
  7351. 12
  7352. ],
  7353. [
  7354. 7,
  7355. 12
  7356. ],
  7357. [
  7358. 7,
  7359. 12
  7360. ],
  7361. [
  7362. 7,
  7363. 12
  7364. ],
  7365. [
  7366. 7,
  7367. 12
  7368. ],
  7369. [
  7370. 7,
  7371. 12
  7372. ]
  7373. ];
  7374. var blackTable3 = [
  7375. [
  7376. -1,
  7377. -1
  7378. ],
  7379. [
  7380. -1,
  7381. -1
  7382. ],
  7383. [
  7384. -1,
  7385. -1
  7386. ],
  7387. [
  7388. -1,
  7389. -1
  7390. ],
  7391. [
  7392. 6,
  7393. 9
  7394. ],
  7395. [
  7396. 6,
  7397. 8
  7398. ],
  7399. [
  7400. 5,
  7401. 7
  7402. ],
  7403. [
  7404. 5,
  7405. 7
  7406. ],
  7407. [
  7408. 4,
  7409. 6
  7410. ],
  7411. [
  7412. 4,
  7413. 6
  7414. ],
  7415. [
  7416. 4,
  7417. 6
  7418. ],
  7419. [
  7420. 4,
  7421. 6
  7422. ],
  7423. [
  7424. 4,
  7425. 5
  7426. ],
  7427. [
  7428. 4,
  7429. 5
  7430. ],
  7431. [
  7432. 4,
  7433. 5
  7434. ],
  7435. [
  7436. 4,
  7437. 5
  7438. ],
  7439. [
  7440. 3,
  7441. 1
  7442. ],
  7443. [
  7444. 3,
  7445. 1
  7446. ],
  7447. [
  7448. 3,
  7449. 1
  7450. ],
  7451. [
  7452. 3,
  7453. 1
  7454. ],
  7455. [
  7456. 3,
  7457. 1
  7458. ],
  7459. [
  7460. 3,
  7461. 1
  7462. ],
  7463. [
  7464. 3,
  7465. 1
  7466. ],
  7467. [
  7468. 3,
  7469. 1
  7470. ],
  7471. [
  7472. 3,
  7473. 4
  7474. ],
  7475. [
  7476. 3,
  7477. 4
  7478. ],
  7479. [
  7480. 3,
  7481. 4
  7482. ],
  7483. [
  7484. 3,
  7485. 4
  7486. ],
  7487. [
  7488. 3,
  7489. 4
  7490. ],
  7491. [
  7492. 3,
  7493. 4
  7494. ],
  7495. [
  7496. 3,
  7497. 4
  7498. ],
  7499. [
  7500. 3,
  7501. 4
  7502. ],
  7503. [
  7504. 2,
  7505. 3
  7506. ],
  7507. [
  7508. 2,
  7509. 3
  7510. ],
  7511. [
  7512. 2,
  7513. 3
  7514. ],
  7515. [
  7516. 2,
  7517. 3
  7518. ],
  7519. [
  7520. 2,
  7521. 3
  7522. ],
  7523. [
  7524. 2,
  7525. 3
  7526. ],
  7527. [
  7528. 2,
  7529. 3
  7530. ],
  7531. [
  7532. 2,
  7533. 3
  7534. ],
  7535. [
  7536. 2,
  7537. 3
  7538. ],
  7539. [
  7540. 2,
  7541. 3
  7542. ],
  7543. [
  7544. 2,
  7545. 3
  7546. ],
  7547. [
  7548. 2,
  7549. 3
  7550. ],
  7551. [
  7552. 2,
  7553. 3
  7554. ],
  7555. [
  7556. 2,
  7557. 3
  7558. ],
  7559. [
  7560. 2,
  7561. 3
  7562. ],
  7563. [
  7564. 2,
  7565. 3
  7566. ],
  7567. [
  7568. 2,
  7569. 2
  7570. ],
  7571. [
  7572. 2,
  7573. 2
  7574. ],
  7575. [
  7576. 2,
  7577. 2
  7578. ],
  7579. [
  7580. 2,
  7581. 2
  7582. ],
  7583. [
  7584. 2,
  7585. 2
  7586. ],
  7587. [
  7588. 2,
  7589. 2
  7590. ],
  7591. [
  7592. 2,
  7593. 2
  7594. ],
  7595. [
  7596. 2,
  7597. 2
  7598. ],
  7599. [
  7600. 2,
  7601. 2
  7602. ],
  7603. [
  7604. 2,
  7605. 2
  7606. ],
  7607. [
  7608. 2,
  7609. 2
  7610. ],
  7611. [
  7612. 2,
  7613. 2
  7614. ],
  7615. [
  7616. 2,
  7617. 2
  7618. ],
  7619. [
  7620. 2,
  7621. 2
  7622. ],
  7623. [
  7624. 2,
  7625. 2
  7626. ],
  7627. [
  7628. 2,
  7629. 2
  7630. ]
  7631. ];
  7632. function CCITTFaxStream(str, maybeLength, params) {
  7633. this.str = str;
  7634. this.dict = str.dict;
  7635. params = params || Dict.empty;
  7636. this.encoding = params.get('K') || 0;
  7637. this.eoline = params.get('EndOfLine') || false;
  7638. this.byteAlign = params.get('EncodedByteAlign') || false;
  7639. this.columns = params.get('Columns') || 1728;
  7640. this.rows = params.get('Rows') || 0;
  7641. var eoblock = params.get('EndOfBlock');
  7642. if (eoblock === null || eoblock === undefined) {
  7643. eoblock = true;
  7644. }
  7645. this.eoblock = eoblock;
  7646. this.black = params.get('BlackIs1') || false;
  7647. this.codingLine = new Uint32Array(this.columns + 1);
  7648. this.refLine = new Uint32Array(this.columns + 2);
  7649. this.codingLine[0] = this.columns;
  7650. this.codingPos = 0;
  7651. this.row = 0;
  7652. this.nextLine2D = this.encoding < 0;
  7653. this.inputBits = 0;
  7654. this.inputBuf = 0;
  7655. this.outputBits = 0;
  7656. var code1;
  7657. while ((code1 = this.lookBits(12)) === 0) {
  7658. this.eatBits(1);
  7659. }
  7660. if (code1 === 1) {
  7661. this.eatBits(12);
  7662. }
  7663. if (this.encoding > 0) {
  7664. this.nextLine2D = !this.lookBits(1);
  7665. this.eatBits(1);
  7666. }
  7667. DecodeStream.call(this, maybeLength);
  7668. }
  7669. CCITTFaxStream.prototype = Object.create(DecodeStream.prototype);
  7670. CCITTFaxStream.prototype.readBlock = function CCITTFaxStream_readBlock() {
  7671. while (!this.eof) {
  7672. var c = this.lookChar();
  7673. this.ensureBuffer(this.bufferLength + 1);
  7674. this.buffer[this.bufferLength++] = c;
  7675. }
  7676. };
  7677. CCITTFaxStream.prototype.addPixels = function ccittFaxStreamAddPixels(a1, blackPixels) {
  7678. var codingLine = this.codingLine;
  7679. var codingPos = this.codingPos;
  7680. if (a1 > codingLine[codingPos]) {
  7681. if (a1 > this.columns) {
  7682. info('row is wrong length');
  7683. this.err = true;
  7684. a1 = this.columns;
  7685. }
  7686. if (codingPos & 1 ^ blackPixels) {
  7687. ++codingPos;
  7688. }
  7689. codingLine[codingPos] = a1;
  7690. }
  7691. this.codingPos = codingPos;
  7692. };
  7693. CCITTFaxStream.prototype.addPixelsNeg = function ccittFaxStreamAddPixelsNeg(a1, blackPixels) {
  7694. var codingLine = this.codingLine;
  7695. var codingPos = this.codingPos;
  7696. if (a1 > codingLine[codingPos]) {
  7697. if (a1 > this.columns) {
  7698. info('row is wrong length');
  7699. this.err = true;
  7700. a1 = this.columns;
  7701. }
  7702. if (codingPos & 1 ^ blackPixels) {
  7703. ++codingPos;
  7704. }
  7705. codingLine[codingPos] = a1;
  7706. } else if (a1 < codingLine[codingPos]) {
  7707. if (a1 < 0) {
  7708. info('invalid code');
  7709. this.err = true;
  7710. a1 = 0;
  7711. }
  7712. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  7713. --codingPos;
  7714. }
  7715. codingLine[codingPos] = a1;
  7716. }
  7717. this.codingPos = codingPos;
  7718. };
  7719. CCITTFaxStream.prototype.lookChar = function CCITTFaxStream_lookChar() {
  7720. var refLine = this.refLine;
  7721. var codingLine = this.codingLine;
  7722. var columns = this.columns;
  7723. var refPos, blackPixels, bits, i;
  7724. if (this.outputBits === 0) {
  7725. if (this.eof) {
  7726. return null;
  7727. }
  7728. this.err = false;
  7729. var code1, code2, code3;
  7730. if (this.nextLine2D) {
  7731. for (i = 0; codingLine[i] < columns; ++i) {
  7732. refLine[i] = codingLine[i];
  7733. }
  7734. refLine[i++] = columns;
  7735. refLine[i] = columns;
  7736. codingLine[0] = 0;
  7737. this.codingPos = 0;
  7738. refPos = 0;
  7739. blackPixels = 0;
  7740. while (codingLine[this.codingPos] < columns) {
  7741. code1 = this.getTwoDimCode();
  7742. switch (code1) {
  7743. case twoDimPass:
  7744. this.addPixels(refLine[refPos + 1], blackPixels);
  7745. if (refLine[refPos + 1] < columns) {
  7746. refPos += 2;
  7747. }
  7748. break;
  7749. case twoDimHoriz:
  7750. code1 = code2 = 0;
  7751. if (blackPixels) {
  7752. do {
  7753. code1 += code3 = this.getBlackCode();
  7754. } while (code3 >= 64);
  7755. do {
  7756. code2 += code3 = this.getWhiteCode();
  7757. } while (code3 >= 64);
  7758. } else {
  7759. do {
  7760. code1 += code3 = this.getWhiteCode();
  7761. } while (code3 >= 64);
  7762. do {
  7763. code2 += code3 = this.getBlackCode();
  7764. } while (code3 >= 64);
  7765. }
  7766. this.addPixels(codingLine[this.codingPos] + code1, blackPixels);
  7767. if (codingLine[this.codingPos] < columns) {
  7768. this.addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  7769. }
  7770. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7771. refPos += 2;
  7772. }
  7773. break;
  7774. case twoDimVertR3:
  7775. this.addPixels(refLine[refPos] + 3, blackPixels);
  7776. blackPixels ^= 1;
  7777. if (codingLine[this.codingPos] < columns) {
  7778. ++refPos;
  7779. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7780. refPos += 2;
  7781. }
  7782. }
  7783. break;
  7784. case twoDimVertR2:
  7785. this.addPixels(refLine[refPos] + 2, blackPixels);
  7786. blackPixels ^= 1;
  7787. if (codingLine[this.codingPos] < columns) {
  7788. ++refPos;
  7789. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7790. refPos += 2;
  7791. }
  7792. }
  7793. break;
  7794. case twoDimVertR1:
  7795. this.addPixels(refLine[refPos] + 1, blackPixels);
  7796. blackPixels ^= 1;
  7797. if (codingLine[this.codingPos] < columns) {
  7798. ++refPos;
  7799. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7800. refPos += 2;
  7801. }
  7802. }
  7803. break;
  7804. case twoDimVert0:
  7805. this.addPixels(refLine[refPos], blackPixels);
  7806. blackPixels ^= 1;
  7807. if (codingLine[this.codingPos] < columns) {
  7808. ++refPos;
  7809. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7810. refPos += 2;
  7811. }
  7812. }
  7813. break;
  7814. case twoDimVertL3:
  7815. this.addPixelsNeg(refLine[refPos] - 3, blackPixels);
  7816. blackPixels ^= 1;
  7817. if (codingLine[this.codingPos] < columns) {
  7818. if (refPos > 0) {
  7819. --refPos;
  7820. } else {
  7821. ++refPos;
  7822. }
  7823. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7824. refPos += 2;
  7825. }
  7826. }
  7827. break;
  7828. case twoDimVertL2:
  7829. this.addPixelsNeg(refLine[refPos] - 2, blackPixels);
  7830. blackPixels ^= 1;
  7831. if (codingLine[this.codingPos] < columns) {
  7832. if (refPos > 0) {
  7833. --refPos;
  7834. } else {
  7835. ++refPos;
  7836. }
  7837. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7838. refPos += 2;
  7839. }
  7840. }
  7841. break;
  7842. case twoDimVertL1:
  7843. this.addPixelsNeg(refLine[refPos] - 1, blackPixels);
  7844. blackPixels ^= 1;
  7845. if (codingLine[this.codingPos] < columns) {
  7846. if (refPos > 0) {
  7847. --refPos;
  7848. } else {
  7849. ++refPos;
  7850. }
  7851. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7852. refPos += 2;
  7853. }
  7854. }
  7855. break;
  7856. case ccittEOF:
  7857. this.addPixels(columns, 0);
  7858. this.eof = true;
  7859. break;
  7860. default:
  7861. info('bad 2d code');
  7862. this.addPixels(columns, 0);
  7863. this.err = true;
  7864. }
  7865. }
  7866. } else {
  7867. codingLine[0] = 0;
  7868. this.codingPos = 0;
  7869. blackPixels = 0;
  7870. while (codingLine[this.codingPos] < columns) {
  7871. code1 = 0;
  7872. if (blackPixels) {
  7873. do {
  7874. code1 += code3 = this.getBlackCode();
  7875. } while (code3 >= 64);
  7876. } else {
  7877. do {
  7878. code1 += code3 = this.getWhiteCode();
  7879. } while (code3 >= 64);
  7880. }
  7881. this.addPixels(codingLine[this.codingPos] + code1, blackPixels);
  7882. blackPixels ^= 1;
  7883. }
  7884. }
  7885. var gotEOL = false;
  7886. if (this.byteAlign) {
  7887. this.inputBits &= ~7;
  7888. }
  7889. if (!this.eoblock && this.row === this.rows - 1) {
  7890. this.eof = true;
  7891. } else {
  7892. code1 = this.lookBits(12);
  7893. if (this.eoline) {
  7894. while (code1 !== ccittEOF && code1 !== 1) {
  7895. this.eatBits(1);
  7896. code1 = this.lookBits(12);
  7897. }
  7898. } else {
  7899. while (code1 === 0) {
  7900. this.eatBits(1);
  7901. code1 = this.lookBits(12);
  7902. }
  7903. }
  7904. if (code1 === 1) {
  7905. this.eatBits(12);
  7906. gotEOL = true;
  7907. } else if (code1 === ccittEOF) {
  7908. this.eof = true;
  7909. }
  7910. }
  7911. if (!this.eof && this.encoding > 0) {
  7912. this.nextLine2D = !this.lookBits(1);
  7913. this.eatBits(1);
  7914. }
  7915. if (this.eoblock && gotEOL && this.byteAlign) {
  7916. code1 = this.lookBits(12);
  7917. if (code1 === 1) {
  7918. this.eatBits(12);
  7919. if (this.encoding > 0) {
  7920. this.lookBits(1);
  7921. this.eatBits(1);
  7922. }
  7923. if (this.encoding >= 0) {
  7924. for (i = 0; i < 4; ++i) {
  7925. code1 = this.lookBits(12);
  7926. if (code1 !== 1) {
  7927. info('bad rtc code: ' + code1);
  7928. }
  7929. this.eatBits(12);
  7930. if (this.encoding > 0) {
  7931. this.lookBits(1);
  7932. this.eatBits(1);
  7933. }
  7934. }
  7935. }
  7936. this.eof = true;
  7937. }
  7938. } else if (this.err && this.eoline) {
  7939. while (true) {
  7940. code1 = this.lookBits(13);
  7941. if (code1 === ccittEOF) {
  7942. this.eof = true;
  7943. return null;
  7944. }
  7945. if (code1 >> 1 === 1) {
  7946. break;
  7947. }
  7948. this.eatBits(1);
  7949. }
  7950. this.eatBits(12);
  7951. if (this.encoding > 0) {
  7952. this.eatBits(1);
  7953. this.nextLine2D = !(code1 & 1);
  7954. }
  7955. }
  7956. if (codingLine[0] > 0) {
  7957. this.outputBits = codingLine[this.codingPos = 0];
  7958. } else {
  7959. this.outputBits = codingLine[this.codingPos = 1];
  7960. }
  7961. this.row++;
  7962. }
  7963. var c;
  7964. if (this.outputBits >= 8) {
  7965. c = this.codingPos & 1 ? 0 : 0xFF;
  7966. this.outputBits -= 8;
  7967. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  7968. this.codingPos++;
  7969. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  7970. }
  7971. } else {
  7972. bits = 8;
  7973. c = 0;
  7974. do {
  7975. if (this.outputBits > bits) {
  7976. c <<= bits;
  7977. if (!(this.codingPos & 1)) {
  7978. c |= 0xFF >> 8 - bits;
  7979. }
  7980. this.outputBits -= bits;
  7981. bits = 0;
  7982. } else {
  7983. c <<= this.outputBits;
  7984. if (!(this.codingPos & 1)) {
  7985. c |= 0xFF >> 8 - this.outputBits;
  7986. }
  7987. bits -= this.outputBits;
  7988. this.outputBits = 0;
  7989. if (codingLine[this.codingPos] < columns) {
  7990. this.codingPos++;
  7991. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  7992. } else if (bits > 0) {
  7993. c <<= bits;
  7994. bits = 0;
  7995. }
  7996. }
  7997. } while (bits);
  7998. }
  7999. if (this.black) {
  8000. c ^= 0xFF;
  8001. }
  8002. return c;
  8003. };
  8004. CCITTFaxStream.prototype.findTableCode = function ccittFaxStreamFindTableCode(start, end, table, limit) {
  8005. var limitValue = limit || 0;
  8006. for (var i = start; i <= end; ++i) {
  8007. var code = this.lookBits(i);
  8008. if (code === ccittEOF) {
  8009. return [
  8010. true,
  8011. 1,
  8012. false
  8013. ];
  8014. }
  8015. if (i < end) {
  8016. code <<= end - i;
  8017. }
  8018. if (!limitValue || code >= limitValue) {
  8019. var p = table[code - limitValue];
  8020. if (p[0] === i) {
  8021. this.eatBits(i);
  8022. return [
  8023. true,
  8024. p[1],
  8025. true
  8026. ];
  8027. }
  8028. }
  8029. }
  8030. return [
  8031. false,
  8032. 0,
  8033. false
  8034. ];
  8035. };
  8036. CCITTFaxStream.prototype.getTwoDimCode = function ccittFaxStreamGetTwoDimCode() {
  8037. var code = 0;
  8038. var p;
  8039. if (this.eoblock) {
  8040. code = this.lookBits(7);
  8041. p = twoDimTable[code];
  8042. if (p && p[0] > 0) {
  8043. this.eatBits(p[0]);
  8044. return p[1];
  8045. }
  8046. } else {
  8047. var result = this.findTableCode(1, 7, twoDimTable);
  8048. if (result[0] && result[2]) {
  8049. return result[1];
  8050. }
  8051. }
  8052. info('Bad two dim code');
  8053. return ccittEOF;
  8054. };
  8055. CCITTFaxStream.prototype.getWhiteCode = function ccittFaxStreamGetWhiteCode() {
  8056. var code = 0;
  8057. var p;
  8058. if (this.eoblock) {
  8059. code = this.lookBits(12);
  8060. if (code === ccittEOF) {
  8061. return 1;
  8062. }
  8063. if (code >> 5 === 0) {
  8064. p = whiteTable1[code];
  8065. } else {
  8066. p = whiteTable2[code >> 3];
  8067. }
  8068. if (p[0] > 0) {
  8069. this.eatBits(p[0]);
  8070. return p[1];
  8071. }
  8072. } else {
  8073. var result = this.findTableCode(1, 9, whiteTable2);
  8074. if (result[0]) {
  8075. return result[1];
  8076. }
  8077. result = this.findTableCode(11, 12, whiteTable1);
  8078. if (result[0]) {
  8079. return result[1];
  8080. }
  8081. }
  8082. info('bad white code');
  8083. this.eatBits(1);
  8084. return 1;
  8085. };
  8086. CCITTFaxStream.prototype.getBlackCode = function ccittFaxStreamGetBlackCode() {
  8087. var code, p;
  8088. if (this.eoblock) {
  8089. code = this.lookBits(13);
  8090. if (code === ccittEOF) {
  8091. return 1;
  8092. }
  8093. if (code >> 7 === 0) {
  8094. p = blackTable1[code];
  8095. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  8096. p = blackTable2[(code >> 1) - 64];
  8097. } else {
  8098. p = blackTable3[code >> 7];
  8099. }
  8100. if (p[0] > 0) {
  8101. this.eatBits(p[0]);
  8102. return p[1];
  8103. }
  8104. } else {
  8105. var result = this.findTableCode(2, 6, blackTable3);
  8106. if (result[0]) {
  8107. return result[1];
  8108. }
  8109. result = this.findTableCode(7, 12, blackTable2, 64);
  8110. if (result[0]) {
  8111. return result[1];
  8112. }
  8113. result = this.findTableCode(10, 13, blackTable1);
  8114. if (result[0]) {
  8115. return result[1];
  8116. }
  8117. }
  8118. info('bad black code');
  8119. this.eatBits(1);
  8120. return 1;
  8121. };
  8122. CCITTFaxStream.prototype.lookBits = function CCITTFaxStream_lookBits(n) {
  8123. var c;
  8124. while (this.inputBits < n) {
  8125. if ((c = this.str.getByte()) === -1) {
  8126. if (this.inputBits === 0) {
  8127. return ccittEOF;
  8128. }
  8129. return this.inputBuf << n - this.inputBits & 0xFFFF >> 16 - n;
  8130. }
  8131. this.inputBuf = this.inputBuf << 8 | c;
  8132. this.inputBits += 8;
  8133. }
  8134. return this.inputBuf >> this.inputBits - n & 0xFFFF >> 16 - n;
  8135. };
  8136. CCITTFaxStream.prototype.eatBits = function CCITTFaxStream_eatBits(n) {
  8137. if ((this.inputBits -= n) < 0) {
  8138. this.inputBits = 0;
  8139. }
  8140. };
  8141. return CCITTFaxStream;
  8142. }();
  8143. var LZWStream = function LZWStreamClosure() {
  8144. function LZWStream(str, maybeLength, earlyChange) {
  8145. this.str = str;
  8146. this.dict = str.dict;
  8147. this.cachedData = 0;
  8148. this.bitsCached = 0;
  8149. var maxLzwDictionarySize = 4096;
  8150. var lzwState = {
  8151. earlyChange: earlyChange,
  8152. codeLength: 9,
  8153. nextCode: 258,
  8154. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  8155. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  8156. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  8157. currentSequence: new Uint8Array(maxLzwDictionarySize),
  8158. currentSequenceLength: 0
  8159. };
  8160. for (var i = 0; i < 256; ++i) {
  8161. lzwState.dictionaryValues[i] = i;
  8162. lzwState.dictionaryLengths[i] = 1;
  8163. }
  8164. this.lzwState = lzwState;
  8165. DecodeStream.call(this, maybeLength);
  8166. }
  8167. LZWStream.prototype = Object.create(DecodeStream.prototype);
  8168. LZWStream.prototype.readBits = function LZWStream_readBits(n) {
  8169. var bitsCached = this.bitsCached;
  8170. var cachedData = this.cachedData;
  8171. while (bitsCached < n) {
  8172. var c = this.str.getByte();
  8173. if (c === -1) {
  8174. this.eof = true;
  8175. return null;
  8176. }
  8177. cachedData = cachedData << 8 | c;
  8178. bitsCached += 8;
  8179. }
  8180. this.bitsCached = bitsCached -= n;
  8181. this.cachedData = cachedData;
  8182. this.lastCode = null;
  8183. return cachedData >>> bitsCached & (1 << n) - 1;
  8184. };
  8185. LZWStream.prototype.readBlock = function LZWStream_readBlock() {
  8186. var blockSize = 512;
  8187. var estimatedDecodedSize = blockSize * 2, decodedSizeDelta = blockSize;
  8188. var i, j, q;
  8189. var lzwState = this.lzwState;
  8190. if (!lzwState) {
  8191. return;
  8192. }
  8193. var earlyChange = lzwState.earlyChange;
  8194. var nextCode = lzwState.nextCode;
  8195. var dictionaryValues = lzwState.dictionaryValues;
  8196. var dictionaryLengths = lzwState.dictionaryLengths;
  8197. var dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  8198. var codeLength = lzwState.codeLength;
  8199. var prevCode = lzwState.prevCode;
  8200. var currentSequence = lzwState.currentSequence;
  8201. var currentSequenceLength = lzwState.currentSequenceLength;
  8202. var decodedLength = 0;
  8203. var currentBufferLength = this.bufferLength;
  8204. var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  8205. for (i = 0; i < blockSize; i++) {
  8206. var code = this.readBits(codeLength);
  8207. var hasPrev = currentSequenceLength > 0;
  8208. if (code < 256) {
  8209. currentSequence[0] = code;
  8210. currentSequenceLength = 1;
  8211. } else if (code >= 258) {
  8212. if (code < nextCode) {
  8213. currentSequenceLength = dictionaryLengths[code];
  8214. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  8215. currentSequence[j] = dictionaryValues[q];
  8216. q = dictionaryPrevCodes[q];
  8217. }
  8218. } else {
  8219. currentSequence[currentSequenceLength++] = currentSequence[0];
  8220. }
  8221. } else if (code === 256) {
  8222. codeLength = 9;
  8223. nextCode = 258;
  8224. currentSequenceLength = 0;
  8225. continue;
  8226. } else {
  8227. this.eof = true;
  8228. delete this.lzwState;
  8229. break;
  8230. }
  8231. if (hasPrev) {
  8232. dictionaryPrevCodes[nextCode] = prevCode;
  8233. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  8234. dictionaryValues[nextCode] = currentSequence[0];
  8235. nextCode++;
  8236. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  8237. }
  8238. prevCode = code;
  8239. decodedLength += currentSequenceLength;
  8240. if (estimatedDecodedSize < decodedLength) {
  8241. do {
  8242. estimatedDecodedSize += decodedSizeDelta;
  8243. } while (estimatedDecodedSize < decodedLength);
  8244. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  8245. }
  8246. for (j = 0; j < currentSequenceLength; j++) {
  8247. buffer[currentBufferLength++] = currentSequence[j];
  8248. }
  8249. }
  8250. lzwState.nextCode = nextCode;
  8251. lzwState.codeLength = codeLength;
  8252. lzwState.prevCode = prevCode;
  8253. lzwState.currentSequenceLength = currentSequenceLength;
  8254. this.bufferLength = currentBufferLength;
  8255. };
  8256. return LZWStream;
  8257. }();
  8258. var NullStream = function NullStreamClosure() {
  8259. function NullStream() {
  8260. Stream.call(this, new Uint8Array(0));
  8261. }
  8262. NullStream.prototype = Stream.prototype;
  8263. return NullStream;
  8264. }();
  8265. exports.Ascii85Stream = Ascii85Stream;
  8266. exports.AsciiHexStream = AsciiHexStream;
  8267. exports.CCITTFaxStream = CCITTFaxStream;
  8268. exports.DecryptStream = DecryptStream;
  8269. exports.DecodeStream = DecodeStream;
  8270. exports.FlateStream = FlateStream;
  8271. exports.Jbig2Stream = Jbig2Stream;
  8272. exports.JpegStream = JpegStream;
  8273. exports.JpxStream = JpxStream;
  8274. exports.NullStream = NullStream;
  8275. exports.PredictorStream = PredictorStream;
  8276. exports.RunLengthStream = RunLengthStream;
  8277. exports.Stream = Stream;
  8278. exports.StreamsSequenceStream = StreamsSequenceStream;
  8279. exports.StringStream = StringStream;
  8280. exports.LZWStream = LZWStream;
  8281. /***/ }),
  8282. /* 3 */
  8283. /***/ (function(module, exports, __w_pdfjs_require__) {
  8284. "use strict";
  8285. var sharedUtil = __w_pdfjs_require__(0);
  8286. var corePrimitives = __w_pdfjs_require__(1);
  8287. var coreFunction = __w_pdfjs_require__(6);
  8288. var error = sharedUtil.error;
  8289. var info = sharedUtil.info;
  8290. var isArray = sharedUtil.isArray;
  8291. var isString = sharedUtil.isString;
  8292. var shadow = sharedUtil.shadow;
  8293. var warn = sharedUtil.warn;
  8294. var isDict = corePrimitives.isDict;
  8295. var isName = corePrimitives.isName;
  8296. var isStream = corePrimitives.isStream;
  8297. var PDFFunction = coreFunction.PDFFunction;
  8298. var ColorSpace = function ColorSpaceClosure() {
  8299. function resizeRgbImage(src, bpc, w1, h1, w2, h2, alpha01, dest) {
  8300. var COMPONENTS = 3;
  8301. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  8302. var xRatio = w1 / w2;
  8303. var yRatio = h1 / h2;
  8304. var i, j, py, newIndex = 0, oldIndex;
  8305. var xScaled = new Uint16Array(w2);
  8306. var w1Scanline = w1 * COMPONENTS;
  8307. for (i = 0; i < w2; i++) {
  8308. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  8309. }
  8310. for (i = 0; i < h2; i++) {
  8311. py = Math.floor(i * yRatio) * w1Scanline;
  8312. for (j = 0; j < w2; j++) {
  8313. oldIndex = py + xScaled[j];
  8314. dest[newIndex++] = src[oldIndex++];
  8315. dest[newIndex++] = src[oldIndex++];
  8316. dest[newIndex++] = src[oldIndex++];
  8317. newIndex += alpha01;
  8318. }
  8319. }
  8320. }
  8321. function ColorSpace() {
  8322. error('should not call ColorSpace constructor');
  8323. }
  8324. ColorSpace.prototype = {
  8325. getRgb: function ColorSpace_getRgb(src, srcOffset) {
  8326. var rgb = new Uint8Array(3);
  8327. this.getRgbItem(src, srcOffset, rgb, 0);
  8328. return rgb;
  8329. },
  8330. getRgbItem: function ColorSpace_getRgbItem(src, srcOffset, dest, destOffset) {
  8331. error('Should not call ColorSpace.getRgbItem');
  8332. },
  8333. getRgbBuffer: function ColorSpace_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8334. error('Should not call ColorSpace.getRgbBuffer');
  8335. },
  8336. getOutputLength: function ColorSpace_getOutputLength(inputLength, alpha01) {
  8337. error('Should not call ColorSpace.getOutputLength');
  8338. },
  8339. isPassthrough: function ColorSpace_isPassthrough(bits) {
  8340. return false;
  8341. },
  8342. fillRgb: function ColorSpace_fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  8343. var count = originalWidth * originalHeight;
  8344. var rgbBuf = null;
  8345. var numComponentColors = 1 << bpc;
  8346. var needsResizing = originalHeight !== height || originalWidth !== width;
  8347. var i, ii;
  8348. if (this.isPassthrough(bpc)) {
  8349. rgbBuf = comps;
  8350. } else if (this.numComps === 1 && count > numComponentColors && this.name !== 'DeviceGray' && this.name !== 'DeviceRGB') {
  8351. var allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  8352. var key;
  8353. for (i = 0; i < numComponentColors; i++) {
  8354. allColors[i] = i;
  8355. }
  8356. var colorMap = new Uint8Array(numComponentColors * 3);
  8357. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  8358. var destPos, rgbPos;
  8359. if (!needsResizing) {
  8360. destPos = 0;
  8361. for (i = 0; i < count; ++i) {
  8362. key = comps[i] * 3;
  8363. dest[destPos++] = colorMap[key];
  8364. dest[destPos++] = colorMap[key + 1];
  8365. dest[destPos++] = colorMap[key + 2];
  8366. destPos += alpha01;
  8367. }
  8368. } else {
  8369. rgbBuf = new Uint8Array(count * 3);
  8370. rgbPos = 0;
  8371. for (i = 0; i < count; ++i) {
  8372. key = comps[i] * 3;
  8373. rgbBuf[rgbPos++] = colorMap[key];
  8374. rgbBuf[rgbPos++] = colorMap[key + 1];
  8375. rgbBuf[rgbPos++] = colorMap[key + 2];
  8376. }
  8377. }
  8378. } else {
  8379. if (!needsResizing) {
  8380. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  8381. } else {
  8382. rgbBuf = new Uint8Array(count * 3);
  8383. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  8384. }
  8385. }
  8386. if (rgbBuf) {
  8387. if (needsResizing) {
  8388. resizeRgbImage(rgbBuf, bpc, originalWidth, originalHeight, width, height, alpha01, dest);
  8389. } else {
  8390. rgbPos = 0;
  8391. destPos = 0;
  8392. for (i = 0, ii = width * actualHeight; i < ii; i++) {
  8393. dest[destPos++] = rgbBuf[rgbPos++];
  8394. dest[destPos++] = rgbBuf[rgbPos++];
  8395. dest[destPos++] = rgbBuf[rgbPos++];
  8396. destPos += alpha01;
  8397. }
  8398. }
  8399. }
  8400. },
  8401. usesZeroToOneRange: true
  8402. };
  8403. ColorSpace.parse = function ColorSpace_parse(cs, xref, res) {
  8404. var IR = ColorSpace.parseToIR(cs, xref, res);
  8405. if (IR instanceof AlternateCS) {
  8406. return IR;
  8407. }
  8408. return ColorSpace.fromIR(IR);
  8409. };
  8410. ColorSpace.fromIR = function ColorSpace_fromIR(IR) {
  8411. var name = isArray(IR) ? IR[0] : IR;
  8412. var whitePoint, blackPoint, gamma;
  8413. switch (name) {
  8414. case 'DeviceGrayCS':
  8415. return this.singletons.gray;
  8416. case 'DeviceRgbCS':
  8417. return this.singletons.rgb;
  8418. case 'DeviceCmykCS':
  8419. return this.singletons.cmyk;
  8420. case 'CalGrayCS':
  8421. whitePoint = IR[1];
  8422. blackPoint = IR[2];
  8423. gamma = IR[3];
  8424. return new CalGrayCS(whitePoint, blackPoint, gamma);
  8425. case 'CalRGBCS':
  8426. whitePoint = IR[1];
  8427. blackPoint = IR[2];
  8428. gamma = IR[3];
  8429. var matrix = IR[4];
  8430. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  8431. case 'PatternCS':
  8432. var basePatternCS = IR[1];
  8433. if (basePatternCS) {
  8434. basePatternCS = ColorSpace.fromIR(basePatternCS);
  8435. }
  8436. return new PatternCS(basePatternCS);
  8437. case 'IndexedCS':
  8438. var baseIndexedCS = IR[1];
  8439. var hiVal = IR[2];
  8440. var lookup = IR[3];
  8441. return new IndexedCS(ColorSpace.fromIR(baseIndexedCS), hiVal, lookup);
  8442. case 'AlternateCS':
  8443. var numComps = IR[1];
  8444. var alt = IR[2];
  8445. var tintFnIR = IR[3];
  8446. return new AlternateCS(numComps, ColorSpace.fromIR(alt), PDFFunction.fromIR(tintFnIR));
  8447. case 'LabCS':
  8448. whitePoint = IR[1];
  8449. blackPoint = IR[2];
  8450. var range = IR[3];
  8451. return new LabCS(whitePoint, blackPoint, range);
  8452. default:
  8453. error('Unknown name ' + name);
  8454. }
  8455. return null;
  8456. };
  8457. ColorSpace.parseToIR = function ColorSpace_parseToIR(cs, xref, res) {
  8458. if (isName(cs)) {
  8459. var colorSpaces = res.get('ColorSpace');
  8460. if (isDict(colorSpaces)) {
  8461. var refcs = colorSpaces.get(cs.name);
  8462. if (refcs) {
  8463. cs = refcs;
  8464. }
  8465. }
  8466. }
  8467. cs = xref.fetchIfRef(cs);
  8468. if (isName(cs)) {
  8469. switch (cs.name) {
  8470. case 'DeviceGray':
  8471. case 'G':
  8472. return 'DeviceGrayCS';
  8473. case 'DeviceRGB':
  8474. case 'RGB':
  8475. return 'DeviceRgbCS';
  8476. case 'DeviceCMYK':
  8477. case 'CMYK':
  8478. return 'DeviceCmykCS';
  8479. case 'Pattern':
  8480. return [
  8481. 'PatternCS',
  8482. null
  8483. ];
  8484. default:
  8485. error('unrecognized colorspace ' + cs.name);
  8486. }
  8487. } else if (isArray(cs)) {
  8488. var mode = xref.fetchIfRef(cs[0]).name;
  8489. var numComps, params, alt, whitePoint, blackPoint, gamma;
  8490. switch (mode) {
  8491. case 'DeviceGray':
  8492. case 'G':
  8493. return 'DeviceGrayCS';
  8494. case 'DeviceRGB':
  8495. case 'RGB':
  8496. return 'DeviceRgbCS';
  8497. case 'DeviceCMYK':
  8498. case 'CMYK':
  8499. return 'DeviceCmykCS';
  8500. case 'CalGray':
  8501. params = xref.fetchIfRef(cs[1]);
  8502. whitePoint = params.getArray('WhitePoint');
  8503. blackPoint = params.getArray('BlackPoint');
  8504. gamma = params.get('Gamma');
  8505. return [
  8506. 'CalGrayCS',
  8507. whitePoint,
  8508. blackPoint,
  8509. gamma
  8510. ];
  8511. case 'CalRGB':
  8512. params = xref.fetchIfRef(cs[1]);
  8513. whitePoint = params.getArray('WhitePoint');
  8514. blackPoint = params.getArray('BlackPoint');
  8515. gamma = params.getArray('Gamma');
  8516. var matrix = params.getArray('Matrix');
  8517. return [
  8518. 'CalRGBCS',
  8519. whitePoint,
  8520. blackPoint,
  8521. gamma,
  8522. matrix
  8523. ];
  8524. case 'ICCBased':
  8525. var stream = xref.fetchIfRef(cs[1]);
  8526. var dict = stream.dict;
  8527. numComps = dict.get('N');
  8528. alt = dict.get('Alternate');
  8529. if (alt) {
  8530. var altIR = ColorSpace.parseToIR(alt, xref, res);
  8531. var altCS = ColorSpace.fromIR(altIR);
  8532. if (altCS.numComps === numComps) {
  8533. return altIR;
  8534. }
  8535. warn('ICCBased color space: Ignoring incorrect /Alternate entry.');
  8536. }
  8537. if (numComps === 1) {
  8538. return 'DeviceGrayCS';
  8539. } else if (numComps === 3) {
  8540. return 'DeviceRgbCS';
  8541. } else if (numComps === 4) {
  8542. return 'DeviceCmykCS';
  8543. }
  8544. break;
  8545. case 'Pattern':
  8546. var basePatternCS = cs[1] || null;
  8547. if (basePatternCS) {
  8548. basePatternCS = ColorSpace.parseToIR(basePatternCS, xref, res);
  8549. }
  8550. return [
  8551. 'PatternCS',
  8552. basePatternCS
  8553. ];
  8554. case 'Indexed':
  8555. case 'I':
  8556. var baseIndexedCS = ColorSpace.parseToIR(cs[1], xref, res);
  8557. var hiVal = xref.fetchIfRef(cs[2]) + 1;
  8558. var lookup = xref.fetchIfRef(cs[3]);
  8559. if (isStream(lookup)) {
  8560. lookup = lookup.getBytes();
  8561. }
  8562. return [
  8563. 'IndexedCS',
  8564. baseIndexedCS,
  8565. hiVal,
  8566. lookup
  8567. ];
  8568. case 'Separation':
  8569. case 'DeviceN':
  8570. var name = xref.fetchIfRef(cs[1]);
  8571. numComps = isArray(name) ? name.length : 1;
  8572. alt = ColorSpace.parseToIR(cs[2], xref, res);
  8573. var tintFnIR = PDFFunction.getIR(xref, xref.fetchIfRef(cs[3]));
  8574. return [
  8575. 'AlternateCS',
  8576. numComps,
  8577. alt,
  8578. tintFnIR
  8579. ];
  8580. case 'Lab':
  8581. params = xref.fetchIfRef(cs[1]);
  8582. whitePoint = params.getArray('WhitePoint');
  8583. blackPoint = params.getArray('BlackPoint');
  8584. var range = params.getArray('Range');
  8585. return [
  8586. 'LabCS',
  8587. whitePoint,
  8588. blackPoint,
  8589. range
  8590. ];
  8591. default:
  8592. error('unimplemented color space object "' + mode + '"');
  8593. }
  8594. } else {
  8595. error('unrecognized color space object: "' + cs + '"');
  8596. }
  8597. return null;
  8598. };
  8599. ColorSpace.isDefaultDecode = function ColorSpace_isDefaultDecode(decode, n) {
  8600. if (!isArray(decode)) {
  8601. return true;
  8602. }
  8603. if (n * 2 !== decode.length) {
  8604. warn('The decode map is not the correct length');
  8605. return true;
  8606. }
  8607. for (var i = 0, ii = decode.length; i < ii; i += 2) {
  8608. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  8609. return false;
  8610. }
  8611. }
  8612. return true;
  8613. };
  8614. ColorSpace.singletons = {
  8615. get gray() {
  8616. return shadow(this, 'gray', new DeviceGrayCS());
  8617. },
  8618. get rgb() {
  8619. return shadow(this, 'rgb', new DeviceRgbCS());
  8620. },
  8621. get cmyk() {
  8622. return shadow(this, 'cmyk', new DeviceCmykCS());
  8623. }
  8624. };
  8625. return ColorSpace;
  8626. }();
  8627. var AlternateCS = function AlternateCSClosure() {
  8628. function AlternateCS(numComps, base, tintFn) {
  8629. this.name = 'Alternate';
  8630. this.numComps = numComps;
  8631. this.defaultColor = new Float32Array(numComps);
  8632. for (var i = 0; i < numComps; ++i) {
  8633. this.defaultColor[i] = 1;
  8634. }
  8635. this.base = base;
  8636. this.tintFn = tintFn;
  8637. this.tmpBuf = new Float32Array(base.numComps);
  8638. }
  8639. AlternateCS.prototype = {
  8640. getRgb: ColorSpace.prototype.getRgb,
  8641. getRgbItem: function AlternateCS_getRgbItem(src, srcOffset, dest, destOffset) {
  8642. var tmpBuf = this.tmpBuf;
  8643. this.tintFn(src, srcOffset, tmpBuf, 0);
  8644. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  8645. },
  8646. getRgbBuffer: function AlternateCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8647. var tintFn = this.tintFn;
  8648. var base = this.base;
  8649. var scale = 1 / ((1 << bits) - 1);
  8650. var baseNumComps = base.numComps;
  8651. var usesZeroToOneRange = base.usesZeroToOneRange;
  8652. var isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  8653. var pos = isPassthrough ? destOffset : 0;
  8654. var baseBuf = isPassthrough ? dest : new Uint8Array(baseNumComps * count);
  8655. var numComps = this.numComps;
  8656. var scaled = new Float32Array(numComps);
  8657. var tinted = new Float32Array(baseNumComps);
  8658. var i, j;
  8659. for (i = 0; i < count; i++) {
  8660. for (j = 0; j < numComps; j++) {
  8661. scaled[j] = src[srcOffset++] * scale;
  8662. }
  8663. tintFn(scaled, 0, tinted, 0);
  8664. if (usesZeroToOneRange) {
  8665. for (j = 0; j < baseNumComps; j++) {
  8666. baseBuf[pos++] = tinted[j] * 255;
  8667. }
  8668. } else {
  8669. base.getRgbItem(tinted, 0, baseBuf, pos);
  8670. pos += baseNumComps;
  8671. }
  8672. }
  8673. if (!isPassthrough) {
  8674. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  8675. }
  8676. },
  8677. getOutputLength: function AlternateCS_getOutputLength(inputLength, alpha01) {
  8678. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  8679. },
  8680. isPassthrough: ColorSpace.prototype.isPassthrough,
  8681. fillRgb: ColorSpace.prototype.fillRgb,
  8682. isDefaultDecode: function AlternateCS_isDefaultDecode(decodeMap) {
  8683. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  8684. },
  8685. usesZeroToOneRange: true
  8686. };
  8687. return AlternateCS;
  8688. }();
  8689. var PatternCS = function PatternCSClosure() {
  8690. function PatternCS(baseCS) {
  8691. this.name = 'Pattern';
  8692. this.base = baseCS;
  8693. }
  8694. PatternCS.prototype = {};
  8695. return PatternCS;
  8696. }();
  8697. var IndexedCS = function IndexedCSClosure() {
  8698. function IndexedCS(base, highVal, lookup) {
  8699. this.name = 'Indexed';
  8700. this.numComps = 1;
  8701. this.defaultColor = new Uint8Array(this.numComps);
  8702. this.base = base;
  8703. this.highVal = highVal;
  8704. var baseNumComps = base.numComps;
  8705. var length = baseNumComps * highVal;
  8706. if (isStream(lookup)) {
  8707. this.lookup = new Uint8Array(length);
  8708. var bytes = lookup.getBytes(length);
  8709. this.lookup.set(bytes);
  8710. } else if (isString(lookup)) {
  8711. this.lookup = new Uint8Array(length);
  8712. for (var i = 0; i < length; ++i) {
  8713. this.lookup[i] = lookup.charCodeAt(i);
  8714. }
  8715. } else if (lookup instanceof Uint8Array || lookup instanceof Array) {
  8716. this.lookup = lookup;
  8717. } else {
  8718. error('Unrecognized lookup table: ' + lookup);
  8719. }
  8720. }
  8721. IndexedCS.prototype = {
  8722. getRgb: ColorSpace.prototype.getRgb,
  8723. getRgbItem: function IndexedCS_getRgbItem(src, srcOffset, dest, destOffset) {
  8724. var numComps = this.base.numComps;
  8725. var start = src[srcOffset] * numComps;
  8726. this.base.getRgbItem(this.lookup, start, dest, destOffset);
  8727. },
  8728. getRgbBuffer: function IndexedCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8729. var base = this.base;
  8730. var numComps = base.numComps;
  8731. var outputDelta = base.getOutputLength(numComps, alpha01);
  8732. var lookup = this.lookup;
  8733. for (var i = 0; i < count; ++i) {
  8734. var lookupPos = src[srcOffset++] * numComps;
  8735. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  8736. destOffset += outputDelta;
  8737. }
  8738. },
  8739. getOutputLength: function IndexedCS_getOutputLength(inputLength, alpha01) {
  8740. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  8741. },
  8742. isPassthrough: ColorSpace.prototype.isPassthrough,
  8743. fillRgb: ColorSpace.prototype.fillRgb,
  8744. isDefaultDecode: function IndexedCS_isDefaultDecode(decodeMap) {
  8745. return true;
  8746. },
  8747. usesZeroToOneRange: true
  8748. };
  8749. return IndexedCS;
  8750. }();
  8751. var DeviceGrayCS = function DeviceGrayCSClosure() {
  8752. function DeviceGrayCS() {
  8753. this.name = 'DeviceGray';
  8754. this.numComps = 1;
  8755. this.defaultColor = new Float32Array(this.numComps);
  8756. }
  8757. DeviceGrayCS.prototype = {
  8758. getRgb: ColorSpace.prototype.getRgb,
  8759. getRgbItem: function DeviceGrayCS_getRgbItem(src, srcOffset, dest, destOffset) {
  8760. var c = src[srcOffset] * 255 | 0;
  8761. c = c < 0 ? 0 : c > 255 ? 255 : c;
  8762. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  8763. },
  8764. getRgbBuffer: function DeviceGrayCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8765. var scale = 255 / ((1 << bits) - 1);
  8766. var j = srcOffset, q = destOffset;
  8767. for (var i = 0; i < count; ++i) {
  8768. var c = scale * src[j++] | 0;
  8769. dest[q++] = c;
  8770. dest[q++] = c;
  8771. dest[q++] = c;
  8772. q += alpha01;
  8773. }
  8774. },
  8775. getOutputLength: function DeviceGrayCS_getOutputLength(inputLength, alpha01) {
  8776. return inputLength * (3 + alpha01);
  8777. },
  8778. isPassthrough: ColorSpace.prototype.isPassthrough,
  8779. fillRgb: ColorSpace.prototype.fillRgb,
  8780. isDefaultDecode: function DeviceGrayCS_isDefaultDecode(decodeMap) {
  8781. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  8782. },
  8783. usesZeroToOneRange: true
  8784. };
  8785. return DeviceGrayCS;
  8786. }();
  8787. var DeviceRgbCS = function DeviceRgbCSClosure() {
  8788. function DeviceRgbCS() {
  8789. this.name = 'DeviceRGB';
  8790. this.numComps = 3;
  8791. this.defaultColor = new Float32Array(this.numComps);
  8792. }
  8793. DeviceRgbCS.prototype = {
  8794. getRgb: ColorSpace.prototype.getRgb,
  8795. getRgbItem: function DeviceRgbCS_getRgbItem(src, srcOffset, dest, destOffset) {
  8796. var r = src[srcOffset] * 255 | 0;
  8797. var g = src[srcOffset + 1] * 255 | 0;
  8798. var b = src[srcOffset + 2] * 255 | 0;
  8799. dest[destOffset] = r < 0 ? 0 : r > 255 ? 255 : r;
  8800. dest[destOffset + 1] = g < 0 ? 0 : g > 255 ? 255 : g;
  8801. dest[destOffset + 2] = b < 0 ? 0 : b > 255 ? 255 : b;
  8802. },
  8803. getRgbBuffer: function DeviceRgbCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8804. if (bits === 8 && alpha01 === 0) {
  8805. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  8806. return;
  8807. }
  8808. var scale = 255 / ((1 << bits) - 1);
  8809. var j = srcOffset, q = destOffset;
  8810. for (var i = 0; i < count; ++i) {
  8811. dest[q++] = scale * src[j++] | 0;
  8812. dest[q++] = scale * src[j++] | 0;
  8813. dest[q++] = scale * src[j++] | 0;
  8814. q += alpha01;
  8815. }
  8816. },
  8817. getOutputLength: function DeviceRgbCS_getOutputLength(inputLength, alpha01) {
  8818. return inputLength * (3 + alpha01) / 3 | 0;
  8819. },
  8820. isPassthrough: function DeviceRgbCS_isPassthrough(bits) {
  8821. return bits === 8;
  8822. },
  8823. fillRgb: ColorSpace.prototype.fillRgb,
  8824. isDefaultDecode: function DeviceRgbCS_isDefaultDecode(decodeMap) {
  8825. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  8826. },
  8827. usesZeroToOneRange: true
  8828. };
  8829. return DeviceRgbCS;
  8830. }();
  8831. var DeviceCmykCS = function DeviceCmykCSClosure() {
  8832. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  8833. var c = src[srcOffset + 0] * srcScale;
  8834. var m = src[srcOffset + 1] * srcScale;
  8835. var y = src[srcOffset + 2] * srcScale;
  8836. var k = src[srcOffset + 3] * srcScale;
  8837. 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;
  8838. 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;
  8839. 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;
  8840. dest[destOffset] = r > 255 ? 255 : r < 0 ? 0 : r;
  8841. dest[destOffset + 1] = g > 255 ? 255 : g < 0 ? 0 : g;
  8842. dest[destOffset + 2] = b > 255 ? 255 : b < 0 ? 0 : b;
  8843. }
  8844. function DeviceCmykCS() {
  8845. this.name = 'DeviceCMYK';
  8846. this.numComps = 4;
  8847. this.defaultColor = new Float32Array(this.numComps);
  8848. this.defaultColor[3] = 1;
  8849. }
  8850. DeviceCmykCS.prototype = {
  8851. getRgb: ColorSpace.prototype.getRgb,
  8852. getRgbItem: function DeviceCmykCS_getRgbItem(src, srcOffset, dest, destOffset) {
  8853. convertToRgb(src, srcOffset, 1, dest, destOffset);
  8854. },
  8855. getRgbBuffer: function DeviceCmykCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8856. var scale = 1 / ((1 << bits) - 1);
  8857. for (var i = 0; i < count; i++) {
  8858. convertToRgb(src, srcOffset, scale, dest, destOffset);
  8859. srcOffset += 4;
  8860. destOffset += 3 + alpha01;
  8861. }
  8862. },
  8863. getOutputLength: function DeviceCmykCS_getOutputLength(inputLength, alpha01) {
  8864. return inputLength / 4 * (3 + alpha01) | 0;
  8865. },
  8866. isPassthrough: ColorSpace.prototype.isPassthrough,
  8867. fillRgb: ColorSpace.prototype.fillRgb,
  8868. isDefaultDecode: function DeviceCmykCS_isDefaultDecode(decodeMap) {
  8869. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  8870. },
  8871. usesZeroToOneRange: true
  8872. };
  8873. return DeviceCmykCS;
  8874. }();
  8875. var CalGrayCS = function CalGrayCSClosure() {
  8876. function CalGrayCS(whitePoint, blackPoint, gamma) {
  8877. this.name = 'CalGray';
  8878. this.numComps = 1;
  8879. this.defaultColor = new Float32Array(this.numComps);
  8880. if (!whitePoint) {
  8881. error('WhitePoint missing - required for color space CalGray');
  8882. }
  8883. blackPoint = blackPoint || [
  8884. 0,
  8885. 0,
  8886. 0
  8887. ];
  8888. gamma = gamma || 1;
  8889. this.XW = whitePoint[0];
  8890. this.YW = whitePoint[1];
  8891. this.ZW = whitePoint[2];
  8892. this.XB = blackPoint[0];
  8893. this.YB = blackPoint[1];
  8894. this.ZB = blackPoint[2];
  8895. this.G = gamma;
  8896. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  8897. error('Invalid WhitePoint components for ' + this.name + ', no fallback available');
  8898. }
  8899. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  8900. info('Invalid BlackPoint for ' + this.name + ', falling back to default');
  8901. this.XB = this.YB = this.ZB = 0;
  8902. }
  8903. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  8904. warn(this.name + ', BlackPoint: XB: ' + this.XB + ', YB: ' + this.YB + ', ZB: ' + this.ZB + ', only default values are supported.');
  8905. }
  8906. if (this.G < 1) {
  8907. info('Invalid Gamma: ' + this.G + ' for ' + this.name + ', falling back to default');
  8908. this.G = 1;
  8909. }
  8910. }
  8911. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  8912. var A = src[srcOffset] * scale;
  8913. var AG = Math.pow(A, cs.G);
  8914. var L = cs.YW * AG;
  8915. var val = Math.max(295.8 * Math.pow(L, 0.333333333333333333) - 40.8, 0) | 0;
  8916. dest[destOffset] = val;
  8917. dest[destOffset + 1] = val;
  8918. dest[destOffset + 2] = val;
  8919. }
  8920. CalGrayCS.prototype = {
  8921. getRgb: ColorSpace.prototype.getRgb,
  8922. getRgbItem: function CalGrayCS_getRgbItem(src, srcOffset, dest, destOffset) {
  8923. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  8924. },
  8925. getRgbBuffer: function CalGrayCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  8926. var scale = 1 / ((1 << bits) - 1);
  8927. for (var i = 0; i < count; ++i) {
  8928. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  8929. srcOffset += 1;
  8930. destOffset += 3 + alpha01;
  8931. }
  8932. },
  8933. getOutputLength: function CalGrayCS_getOutputLength(inputLength, alpha01) {
  8934. return inputLength * (3 + alpha01);
  8935. },
  8936. isPassthrough: ColorSpace.prototype.isPassthrough,
  8937. fillRgb: ColorSpace.prototype.fillRgb,
  8938. isDefaultDecode: function CalGrayCS_isDefaultDecode(decodeMap) {
  8939. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  8940. },
  8941. usesZeroToOneRange: true
  8942. };
  8943. return CalGrayCS;
  8944. }();
  8945. var CalRGBCS = function CalRGBCSClosure() {
  8946. var BRADFORD_SCALE_MATRIX = new Float32Array([
  8947. 0.8951,
  8948. 0.2664,
  8949. -0.1614,
  8950. -0.7502,
  8951. 1.7135,
  8952. 0.0367,
  8953. 0.0389,
  8954. -0.0685,
  8955. 1.0296
  8956. ]);
  8957. var BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([
  8958. 0.9869929,
  8959. -0.1470543,
  8960. 0.1599627,
  8961. 0.4323053,
  8962. 0.5183603,
  8963. 0.0492912,
  8964. -0.0085287,
  8965. 0.0400428,
  8966. 0.9684867
  8967. ]);
  8968. var SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([
  8969. 3.2404542,
  8970. -1.5371385,
  8971. -0.4985314,
  8972. -0.9692660,
  8973. 1.8760108,
  8974. 0.0415560,
  8975. 0.0556434,
  8976. -0.2040259,
  8977. 1.0572252
  8978. ]);
  8979. var FLAT_WHITEPOINT_MATRIX = new Float32Array([
  8980. 1,
  8981. 1,
  8982. 1
  8983. ]);
  8984. var tempNormalizeMatrix = new Float32Array(3);
  8985. var tempConvertMatrix1 = new Float32Array(3);
  8986. var tempConvertMatrix2 = new Float32Array(3);
  8987. var DECODE_L_CONSTANT = Math.pow((8 + 16) / 116, 3) / 8.0;
  8988. function CalRGBCS(whitePoint, blackPoint, gamma, matrix) {
  8989. this.name = 'CalRGB';
  8990. this.numComps = 3;
  8991. this.defaultColor = new Float32Array(this.numComps);
  8992. if (!whitePoint) {
  8993. error('WhitePoint missing - required for color space CalRGB');
  8994. }
  8995. blackPoint = blackPoint || new Float32Array(3);
  8996. gamma = gamma || new Float32Array([
  8997. 1,
  8998. 1,
  8999. 1
  9000. ]);
  9001. matrix = matrix || new Float32Array([
  9002. 1,
  9003. 0,
  9004. 0,
  9005. 0,
  9006. 1,
  9007. 0,
  9008. 0,
  9009. 0,
  9010. 1
  9011. ]);
  9012. var XW = whitePoint[0];
  9013. var YW = whitePoint[1];
  9014. var ZW = whitePoint[2];
  9015. this.whitePoint = whitePoint;
  9016. var XB = blackPoint[0];
  9017. var YB = blackPoint[1];
  9018. var ZB = blackPoint[2];
  9019. this.blackPoint = blackPoint;
  9020. this.GR = gamma[0];
  9021. this.GG = gamma[1];
  9022. this.GB = gamma[2];
  9023. this.MXA = matrix[0];
  9024. this.MYA = matrix[1];
  9025. this.MZA = matrix[2];
  9026. this.MXB = matrix[3];
  9027. this.MYB = matrix[4];
  9028. this.MZB = matrix[5];
  9029. this.MXC = matrix[6];
  9030. this.MYC = matrix[7];
  9031. this.MZC = matrix[8];
  9032. if (XW < 0 || ZW < 0 || YW !== 1) {
  9033. error('Invalid WhitePoint components for ' + this.name + ', no fallback available');
  9034. }
  9035. if (XB < 0 || YB < 0 || ZB < 0) {
  9036. info('Invalid BlackPoint for ' + this.name + ' [' + XB + ', ' + YB + ', ' + ZB + '], falling back to default');
  9037. this.blackPoint = new Float32Array(3);
  9038. }
  9039. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  9040. info('Invalid Gamma [' + this.GR + ', ' + this.GG + ', ' + this.GB + '] for ' + this.name + ', falling back to default');
  9041. this.GR = this.GG = this.GB = 1;
  9042. }
  9043. 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) {
  9044. 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');
  9045. this.MXA = this.MYB = this.MZC = 1;
  9046. this.MXB = this.MYA = this.MZA = this.MXC = this.MYC = this.MZB = 0;
  9047. }
  9048. }
  9049. function matrixProduct(a, b, result) {
  9050. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  9051. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  9052. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  9053. }
  9054. function convertToFlat(sourceWhitePoint, LMS, result) {
  9055. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  9056. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  9057. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  9058. }
  9059. function convertToD65(sourceWhitePoint, LMS, result) {
  9060. var D65X = 0.95047;
  9061. var D65Y = 1;
  9062. var D65Z = 1.08883;
  9063. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  9064. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  9065. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  9066. }
  9067. function sRGBTransferFunction(color) {
  9068. if (color <= 0.0031308) {
  9069. return adjustToRange(0, 1, 12.92 * color);
  9070. }
  9071. return adjustToRange(0, 1, (1 + 0.055) * Math.pow(color, 1 / 2.4) - 0.055);
  9072. }
  9073. function adjustToRange(min, max, value) {
  9074. return Math.max(min, Math.min(max, value));
  9075. }
  9076. function decodeL(L) {
  9077. if (L < 0) {
  9078. return -decodeL(-L);
  9079. }
  9080. if (L > 8.0) {
  9081. return Math.pow((L + 16) / 116, 3);
  9082. }
  9083. return L * DECODE_L_CONSTANT;
  9084. }
  9085. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  9086. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  9087. result[0] = XYZ_Flat[0];
  9088. result[1] = XYZ_Flat[1];
  9089. result[2] = XYZ_Flat[2];
  9090. return;
  9091. }
  9092. var zeroDecodeL = decodeL(0);
  9093. var X_DST = zeroDecodeL;
  9094. var X_SRC = decodeL(sourceBlackPoint[0]);
  9095. var Y_DST = zeroDecodeL;
  9096. var Y_SRC = decodeL(sourceBlackPoint[1]);
  9097. var Z_DST = zeroDecodeL;
  9098. var Z_SRC = decodeL(sourceBlackPoint[2]);
  9099. var X_Scale = (1 - X_DST) / (1 - X_SRC);
  9100. var X_Offset = 1 - X_Scale;
  9101. var Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  9102. var Y_Offset = 1 - Y_Scale;
  9103. var Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  9104. var Z_Offset = 1 - Z_Scale;
  9105. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  9106. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  9107. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  9108. }
  9109. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  9110. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  9111. result[0] = XYZ_In[0];
  9112. result[1] = XYZ_In[1];
  9113. result[2] = XYZ_In[2];
  9114. return;
  9115. }
  9116. var LMS = result;
  9117. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  9118. var LMS_Flat = tempNormalizeMatrix;
  9119. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  9120. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  9121. }
  9122. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  9123. var LMS = result;
  9124. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  9125. var LMS_D65 = tempNormalizeMatrix;
  9126. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  9127. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  9128. }
  9129. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  9130. var A = adjustToRange(0, 1, src[srcOffset] * scale);
  9131. var B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  9132. var C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  9133. var AGR = Math.pow(A, cs.GR);
  9134. var BGG = Math.pow(B, cs.GG);
  9135. var CGB = Math.pow(C, cs.GB);
  9136. var X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  9137. var Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  9138. var Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  9139. var XYZ = tempConvertMatrix1;
  9140. XYZ[0] = X;
  9141. XYZ[1] = Y;
  9142. XYZ[2] = Z;
  9143. var XYZ_Flat = tempConvertMatrix2;
  9144. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  9145. var XYZ_Black = tempConvertMatrix1;
  9146. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  9147. var XYZ_D65 = tempConvertMatrix2;
  9148. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  9149. var SRGB = tempConvertMatrix1;
  9150. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  9151. var sR = sRGBTransferFunction(SRGB[0]);
  9152. var sG = sRGBTransferFunction(SRGB[1]);
  9153. var sB = sRGBTransferFunction(SRGB[2]);
  9154. dest[destOffset] = Math.round(sR * 255);
  9155. dest[destOffset + 1] = Math.round(sG * 255);
  9156. dest[destOffset + 2] = Math.round(sB * 255);
  9157. }
  9158. CalRGBCS.prototype = {
  9159. getRgb: function CalRGBCS_getRgb(src, srcOffset) {
  9160. var rgb = new Uint8Array(3);
  9161. this.getRgbItem(src, srcOffset, rgb, 0);
  9162. return rgb;
  9163. },
  9164. getRgbItem: function CalRGBCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9165. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  9166. },
  9167. getRgbBuffer: function CalRGBCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9168. var scale = 1 / ((1 << bits) - 1);
  9169. for (var i = 0; i < count; ++i) {
  9170. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  9171. srcOffset += 3;
  9172. destOffset += 3 + alpha01;
  9173. }
  9174. },
  9175. getOutputLength: function CalRGBCS_getOutputLength(inputLength, alpha01) {
  9176. return inputLength * (3 + alpha01) / 3 | 0;
  9177. },
  9178. isPassthrough: ColorSpace.prototype.isPassthrough,
  9179. fillRgb: ColorSpace.prototype.fillRgb,
  9180. isDefaultDecode: function CalRGBCS_isDefaultDecode(decodeMap) {
  9181. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  9182. },
  9183. usesZeroToOneRange: true
  9184. };
  9185. return CalRGBCS;
  9186. }();
  9187. var LabCS = function LabCSClosure() {
  9188. function LabCS(whitePoint, blackPoint, range) {
  9189. this.name = 'Lab';
  9190. this.numComps = 3;
  9191. this.defaultColor = new Float32Array(this.numComps);
  9192. if (!whitePoint) {
  9193. error('WhitePoint missing - required for color space Lab');
  9194. }
  9195. blackPoint = blackPoint || [
  9196. 0,
  9197. 0,
  9198. 0
  9199. ];
  9200. range = range || [
  9201. -100,
  9202. 100,
  9203. -100,
  9204. 100
  9205. ];
  9206. this.XW = whitePoint[0];
  9207. this.YW = whitePoint[1];
  9208. this.ZW = whitePoint[2];
  9209. this.amin = range[0];
  9210. this.amax = range[1];
  9211. this.bmin = range[2];
  9212. this.bmax = range[3];
  9213. this.XB = blackPoint[0];
  9214. this.YB = blackPoint[1];
  9215. this.ZB = blackPoint[2];
  9216. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  9217. error('Invalid WhitePoint components, no fallback available');
  9218. }
  9219. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  9220. info('Invalid BlackPoint, falling back to default');
  9221. this.XB = this.YB = this.ZB = 0;
  9222. }
  9223. if (this.amin > this.amax || this.bmin > this.bmax) {
  9224. info('Invalid Range, falling back to defaults');
  9225. this.amin = -100;
  9226. this.amax = 100;
  9227. this.bmin = -100;
  9228. this.bmax = 100;
  9229. }
  9230. }
  9231. function fn_g(x) {
  9232. var result;
  9233. if (x >= 6 / 29) {
  9234. result = x * x * x;
  9235. } else {
  9236. result = 108 / 841 * (x - 4 / 29);
  9237. }
  9238. return result;
  9239. }
  9240. function decode(value, high1, low2, high2) {
  9241. return low2 + value * (high2 - low2) / high1;
  9242. }
  9243. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  9244. var Ls = src[srcOffset];
  9245. var as = src[srcOffset + 1];
  9246. var bs = src[srcOffset + 2];
  9247. if (maxVal !== false) {
  9248. Ls = decode(Ls, maxVal, 0, 100);
  9249. as = decode(as, maxVal, cs.amin, cs.amax);
  9250. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  9251. }
  9252. as = as > cs.amax ? cs.amax : as < cs.amin ? cs.amin : as;
  9253. bs = bs > cs.bmax ? cs.bmax : bs < cs.bmin ? cs.bmin : bs;
  9254. var M = (Ls + 16) / 116;
  9255. var L = M + as / 500;
  9256. var N = M - bs / 200;
  9257. var X = cs.XW * fn_g(L);
  9258. var Y = cs.YW * fn_g(M);
  9259. var Z = cs.ZW * fn_g(N);
  9260. var r, g, b;
  9261. if (cs.ZW < 1) {
  9262. r = X * 3.1339 + Y * -1.6170 + Z * -0.4906;
  9263. g = X * -0.9785 + Y * 1.9160 + Z * 0.0333;
  9264. b = X * 0.0720 + Y * -0.2290 + Z * 1.4057;
  9265. } else {
  9266. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  9267. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  9268. b = X * 0.0557 + Y * -0.2040 + Z * 1.0570;
  9269. }
  9270. dest[destOffset] = r <= 0 ? 0 : r >= 1 ? 255 : Math.sqrt(r) * 255 | 0;
  9271. dest[destOffset + 1] = g <= 0 ? 0 : g >= 1 ? 255 : Math.sqrt(g) * 255 | 0;
  9272. dest[destOffset + 2] = b <= 0 ? 0 : b >= 1 ? 255 : Math.sqrt(b) * 255 | 0;
  9273. }
  9274. LabCS.prototype = {
  9275. getRgb: ColorSpace.prototype.getRgb,
  9276. getRgbItem: function LabCS_getRgbItem(src, srcOffset, dest, destOffset) {
  9277. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  9278. },
  9279. getRgbBuffer: function LabCS_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  9280. var maxVal = (1 << bits) - 1;
  9281. for (var i = 0; i < count; i++) {
  9282. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  9283. srcOffset += 3;
  9284. destOffset += 3 + alpha01;
  9285. }
  9286. },
  9287. getOutputLength: function LabCS_getOutputLength(inputLength, alpha01) {
  9288. return inputLength * (3 + alpha01) / 3 | 0;
  9289. },
  9290. isPassthrough: ColorSpace.prototype.isPassthrough,
  9291. fillRgb: ColorSpace.prototype.fillRgb,
  9292. isDefaultDecode: function LabCS_isDefaultDecode(decodeMap) {
  9293. return true;
  9294. },
  9295. usesZeroToOneRange: false
  9296. };
  9297. return LabCS;
  9298. }();
  9299. exports.ColorSpace = ColorSpace;
  9300. /***/ }),
  9301. /* 4 */
  9302. /***/ (function(module, exports, __w_pdfjs_require__) {
  9303. "use strict";
  9304. var ExpertEncoding = [
  9305. '',
  9306. '',
  9307. '',
  9308. '',
  9309. '',
  9310. '',
  9311. '',
  9312. '',
  9313. '',
  9314. '',
  9315. '',
  9316. '',
  9317. '',
  9318. '',
  9319. '',
  9320. '',
  9321. '',
  9322. '',
  9323. '',
  9324. '',
  9325. '',
  9326. '',
  9327. '',
  9328. '',
  9329. '',
  9330. '',
  9331. '',
  9332. '',
  9333. '',
  9334. '',
  9335. '',
  9336. '',
  9337. 'space',
  9338. 'exclamsmall',
  9339. 'Hungarumlautsmall',
  9340. '',
  9341. 'dollaroldstyle',
  9342. 'dollarsuperior',
  9343. 'ampersandsmall',
  9344. 'Acutesmall',
  9345. 'parenleftsuperior',
  9346. 'parenrightsuperior',
  9347. 'twodotenleader',
  9348. 'onedotenleader',
  9349. 'comma',
  9350. 'hyphen',
  9351. 'period',
  9352. 'fraction',
  9353. 'zerooldstyle',
  9354. 'oneoldstyle',
  9355. 'twooldstyle',
  9356. 'threeoldstyle',
  9357. 'fouroldstyle',
  9358. 'fiveoldstyle',
  9359. 'sixoldstyle',
  9360. 'sevenoldstyle',
  9361. 'eightoldstyle',
  9362. 'nineoldstyle',
  9363. 'colon',
  9364. 'semicolon',
  9365. 'commasuperior',
  9366. 'threequartersemdash',
  9367. 'periodsuperior',
  9368. 'questionsmall',
  9369. '',
  9370. 'asuperior',
  9371. 'bsuperior',
  9372. 'centsuperior',
  9373. 'dsuperior',
  9374. 'esuperior',
  9375. '',
  9376. '',
  9377. 'isuperior',
  9378. '',
  9379. '',
  9380. 'lsuperior',
  9381. 'msuperior',
  9382. 'nsuperior',
  9383. 'osuperior',
  9384. '',
  9385. '',
  9386. 'rsuperior',
  9387. 'ssuperior',
  9388. 'tsuperior',
  9389. '',
  9390. 'ff',
  9391. 'fi',
  9392. 'fl',
  9393. 'ffi',
  9394. 'ffl',
  9395. 'parenleftinferior',
  9396. '',
  9397. 'parenrightinferior',
  9398. 'Circumflexsmall',
  9399. 'hyphensuperior',
  9400. 'Gravesmall',
  9401. 'Asmall',
  9402. 'Bsmall',
  9403. 'Csmall',
  9404. 'Dsmall',
  9405. 'Esmall',
  9406. 'Fsmall',
  9407. 'Gsmall',
  9408. 'Hsmall',
  9409. 'Ismall',
  9410. 'Jsmall',
  9411. 'Ksmall',
  9412. 'Lsmall',
  9413. 'Msmall',
  9414. 'Nsmall',
  9415. 'Osmall',
  9416. 'Psmall',
  9417. 'Qsmall',
  9418. 'Rsmall',
  9419. 'Ssmall',
  9420. 'Tsmall',
  9421. 'Usmall',
  9422. 'Vsmall',
  9423. 'Wsmall',
  9424. 'Xsmall',
  9425. 'Ysmall',
  9426. 'Zsmall',
  9427. 'colonmonetary',
  9428. 'onefitted',
  9429. 'rupiah',
  9430. 'Tildesmall',
  9431. '',
  9432. '',
  9433. '',
  9434. '',
  9435. '',
  9436. '',
  9437. '',
  9438. '',
  9439. '',
  9440. '',
  9441. '',
  9442. '',
  9443. '',
  9444. '',
  9445. '',
  9446. '',
  9447. '',
  9448. '',
  9449. '',
  9450. '',
  9451. '',
  9452. '',
  9453. '',
  9454. '',
  9455. '',
  9456. '',
  9457. '',
  9458. '',
  9459. '',
  9460. '',
  9461. '',
  9462. '',
  9463. '',
  9464. '',
  9465. 'exclamdownsmall',
  9466. 'centoldstyle',
  9467. 'Lslashsmall',
  9468. '',
  9469. '',
  9470. 'Scaronsmall',
  9471. 'Zcaronsmall',
  9472. 'Dieresissmall',
  9473. 'Brevesmall',
  9474. 'Caronsmall',
  9475. '',
  9476. 'Dotaccentsmall',
  9477. '',
  9478. '',
  9479. 'Macronsmall',
  9480. '',
  9481. '',
  9482. 'figuredash',
  9483. 'hypheninferior',
  9484. '',
  9485. '',
  9486. 'Ogoneksmall',
  9487. 'Ringsmall',
  9488. 'Cedillasmall',
  9489. '',
  9490. '',
  9491. '',
  9492. 'onequarter',
  9493. 'onehalf',
  9494. 'threequarters',
  9495. 'questiondownsmall',
  9496. 'oneeighth',
  9497. 'threeeighths',
  9498. 'fiveeighths',
  9499. 'seveneighths',
  9500. 'onethird',
  9501. 'twothirds',
  9502. '',
  9503. '',
  9504. 'zerosuperior',
  9505. 'onesuperior',
  9506. 'twosuperior',
  9507. 'threesuperior',
  9508. 'foursuperior',
  9509. 'fivesuperior',
  9510. 'sixsuperior',
  9511. 'sevensuperior',
  9512. 'eightsuperior',
  9513. 'ninesuperior',
  9514. 'zeroinferior',
  9515. 'oneinferior',
  9516. 'twoinferior',
  9517. 'threeinferior',
  9518. 'fourinferior',
  9519. 'fiveinferior',
  9520. 'sixinferior',
  9521. 'seveninferior',
  9522. 'eightinferior',
  9523. 'nineinferior',
  9524. 'centinferior',
  9525. 'dollarinferior',
  9526. 'periodinferior',
  9527. 'commainferior',
  9528. 'Agravesmall',
  9529. 'Aacutesmall',
  9530. 'Acircumflexsmall',
  9531. 'Atildesmall',
  9532. 'Adieresissmall',
  9533. 'Aringsmall',
  9534. 'AEsmall',
  9535. 'Ccedillasmall',
  9536. 'Egravesmall',
  9537. 'Eacutesmall',
  9538. 'Ecircumflexsmall',
  9539. 'Edieresissmall',
  9540. 'Igravesmall',
  9541. 'Iacutesmall',
  9542. 'Icircumflexsmall',
  9543. 'Idieresissmall',
  9544. 'Ethsmall',
  9545. 'Ntildesmall',
  9546. 'Ogravesmall',
  9547. 'Oacutesmall',
  9548. 'Ocircumflexsmall',
  9549. 'Otildesmall',
  9550. 'Odieresissmall',
  9551. 'OEsmall',
  9552. 'Oslashsmall',
  9553. 'Ugravesmall',
  9554. 'Uacutesmall',
  9555. 'Ucircumflexsmall',
  9556. 'Udieresissmall',
  9557. 'Yacutesmall',
  9558. 'Thornsmall',
  9559. 'Ydieresissmall'
  9560. ];
  9561. var MacExpertEncoding = [
  9562. '',
  9563. '',
  9564. '',
  9565. '',
  9566. '',
  9567. '',
  9568. '',
  9569. '',
  9570. '',
  9571. '',
  9572. '',
  9573. '',
  9574. '',
  9575. '',
  9576. '',
  9577. '',
  9578. '',
  9579. '',
  9580. '',
  9581. '',
  9582. '',
  9583. '',
  9584. '',
  9585. '',
  9586. '',
  9587. '',
  9588. '',
  9589. '',
  9590. '',
  9591. '',
  9592. '',
  9593. '',
  9594. 'space',
  9595. 'exclamsmall',
  9596. 'Hungarumlautsmall',
  9597. 'centoldstyle',
  9598. 'dollaroldstyle',
  9599. 'dollarsuperior',
  9600. 'ampersandsmall',
  9601. 'Acutesmall',
  9602. 'parenleftsuperior',
  9603. 'parenrightsuperior',
  9604. 'twodotenleader',
  9605. 'onedotenleader',
  9606. 'comma',
  9607. 'hyphen',
  9608. 'period',
  9609. 'fraction',
  9610. 'zerooldstyle',
  9611. 'oneoldstyle',
  9612. 'twooldstyle',
  9613. 'threeoldstyle',
  9614. 'fouroldstyle',
  9615. 'fiveoldstyle',
  9616. 'sixoldstyle',
  9617. 'sevenoldstyle',
  9618. 'eightoldstyle',
  9619. 'nineoldstyle',
  9620. 'colon',
  9621. 'semicolon',
  9622. '',
  9623. 'threequartersemdash',
  9624. '',
  9625. 'questionsmall',
  9626. '',
  9627. '',
  9628. '',
  9629. '',
  9630. 'Ethsmall',
  9631. '',
  9632. '',
  9633. 'onequarter',
  9634. 'onehalf',
  9635. 'threequarters',
  9636. 'oneeighth',
  9637. 'threeeighths',
  9638. 'fiveeighths',
  9639. 'seveneighths',
  9640. 'onethird',
  9641. 'twothirds',
  9642. '',
  9643. '',
  9644. '',
  9645. '',
  9646. '',
  9647. '',
  9648. 'ff',
  9649. 'fi',
  9650. 'fl',
  9651. 'ffi',
  9652. 'ffl',
  9653. 'parenleftinferior',
  9654. '',
  9655. 'parenrightinferior',
  9656. 'Circumflexsmall',
  9657. 'hypheninferior',
  9658. 'Gravesmall',
  9659. 'Asmall',
  9660. 'Bsmall',
  9661. 'Csmall',
  9662. 'Dsmall',
  9663. 'Esmall',
  9664. 'Fsmall',
  9665. 'Gsmall',
  9666. 'Hsmall',
  9667. 'Ismall',
  9668. 'Jsmall',
  9669. 'Ksmall',
  9670. 'Lsmall',
  9671. 'Msmall',
  9672. 'Nsmall',
  9673. 'Osmall',
  9674. 'Psmall',
  9675. 'Qsmall',
  9676. 'Rsmall',
  9677. 'Ssmall',
  9678. 'Tsmall',
  9679. 'Usmall',
  9680. 'Vsmall',
  9681. 'Wsmall',
  9682. 'Xsmall',
  9683. 'Ysmall',
  9684. 'Zsmall',
  9685. 'colonmonetary',
  9686. 'onefitted',
  9687. 'rupiah',
  9688. 'Tildesmall',
  9689. '',
  9690. '',
  9691. 'asuperior',
  9692. 'centsuperior',
  9693. '',
  9694. '',
  9695. '',
  9696. '',
  9697. 'Aacutesmall',
  9698. 'Agravesmall',
  9699. 'Acircumflexsmall',
  9700. 'Adieresissmall',
  9701. 'Atildesmall',
  9702. 'Aringsmall',
  9703. 'Ccedillasmall',
  9704. 'Eacutesmall',
  9705. 'Egravesmall',
  9706. 'Ecircumflexsmall',
  9707. 'Edieresissmall',
  9708. 'Iacutesmall',
  9709. 'Igravesmall',
  9710. 'Icircumflexsmall',
  9711. 'Idieresissmall',
  9712. 'Ntildesmall',
  9713. 'Oacutesmall',
  9714. 'Ogravesmall',
  9715. 'Ocircumflexsmall',
  9716. 'Odieresissmall',
  9717. 'Otildesmall',
  9718. 'Uacutesmall',
  9719. 'Ugravesmall',
  9720. 'Ucircumflexsmall',
  9721. 'Udieresissmall',
  9722. '',
  9723. 'eightsuperior',
  9724. 'fourinferior',
  9725. 'threeinferior',
  9726. 'sixinferior',
  9727. 'eightinferior',
  9728. 'seveninferior',
  9729. 'Scaronsmall',
  9730. '',
  9731. 'centinferior',
  9732. 'twoinferior',
  9733. '',
  9734. 'Dieresissmall',
  9735. '',
  9736. 'Caronsmall',
  9737. 'osuperior',
  9738. 'fiveinferior',
  9739. '',
  9740. 'commainferior',
  9741. 'periodinferior',
  9742. 'Yacutesmall',
  9743. '',
  9744. 'dollarinferior',
  9745. '',
  9746. 'Thornsmall',
  9747. '',
  9748. 'nineinferior',
  9749. 'zeroinferior',
  9750. 'Zcaronsmall',
  9751. 'AEsmall',
  9752. 'Oslashsmall',
  9753. 'questiondownsmall',
  9754. 'oneinferior',
  9755. 'Lslashsmall',
  9756. '',
  9757. '',
  9758. '',
  9759. '',
  9760. '',
  9761. '',
  9762. 'Cedillasmall',
  9763. '',
  9764. '',
  9765. '',
  9766. '',
  9767. '',
  9768. 'OEsmall',
  9769. 'figuredash',
  9770. 'hyphensuperior',
  9771. '',
  9772. '',
  9773. '',
  9774. '',
  9775. 'exclamdownsmall',
  9776. '',
  9777. 'Ydieresissmall',
  9778. '',
  9779. 'onesuperior',
  9780. 'twosuperior',
  9781. 'threesuperior',
  9782. 'foursuperior',
  9783. 'fivesuperior',
  9784. 'sixsuperior',
  9785. 'sevensuperior',
  9786. 'ninesuperior',
  9787. 'zerosuperior',
  9788. '',
  9789. 'esuperior',
  9790. 'rsuperior',
  9791. 'tsuperior',
  9792. '',
  9793. '',
  9794. 'isuperior',
  9795. 'ssuperior',
  9796. 'dsuperior',
  9797. '',
  9798. '',
  9799. '',
  9800. '',
  9801. '',
  9802. 'lsuperior',
  9803. 'Ogoneksmall',
  9804. 'Brevesmall',
  9805. 'Macronsmall',
  9806. 'bsuperior',
  9807. 'nsuperior',
  9808. 'msuperior',
  9809. 'commasuperior',
  9810. 'periodsuperior',
  9811. 'Dotaccentsmall',
  9812. 'Ringsmall'
  9813. ];
  9814. var MacRomanEncoding = [
  9815. '',
  9816. '',
  9817. '',
  9818. '',
  9819. '',
  9820. '',
  9821. '',
  9822. '',
  9823. '',
  9824. '',
  9825. '',
  9826. '',
  9827. '',
  9828. '',
  9829. '',
  9830. '',
  9831. '',
  9832. '',
  9833. '',
  9834. '',
  9835. '',
  9836. '',
  9837. '',
  9838. '',
  9839. '',
  9840. '',
  9841. '',
  9842. '',
  9843. '',
  9844. '',
  9845. '',
  9846. '',
  9847. 'space',
  9848. 'exclam',
  9849. 'quotedbl',
  9850. 'numbersign',
  9851. 'dollar',
  9852. 'percent',
  9853. 'ampersand',
  9854. 'quotesingle',
  9855. 'parenleft',
  9856. 'parenright',
  9857. 'asterisk',
  9858. 'plus',
  9859. 'comma',
  9860. 'hyphen',
  9861. 'period',
  9862. 'slash',
  9863. 'zero',
  9864. 'one',
  9865. 'two',
  9866. 'three',
  9867. 'four',
  9868. 'five',
  9869. 'six',
  9870. 'seven',
  9871. 'eight',
  9872. 'nine',
  9873. 'colon',
  9874. 'semicolon',
  9875. 'less',
  9876. 'equal',
  9877. 'greater',
  9878. 'question',
  9879. 'at',
  9880. 'A',
  9881. 'B',
  9882. 'C',
  9883. 'D',
  9884. 'E',
  9885. 'F',
  9886. 'G',
  9887. 'H',
  9888. 'I',
  9889. 'J',
  9890. 'K',
  9891. 'L',
  9892. 'M',
  9893. 'N',
  9894. 'O',
  9895. 'P',
  9896. 'Q',
  9897. 'R',
  9898. 'S',
  9899. 'T',
  9900. 'U',
  9901. 'V',
  9902. 'W',
  9903. 'X',
  9904. 'Y',
  9905. 'Z',
  9906. 'bracketleft',
  9907. 'backslash',
  9908. 'bracketright',
  9909. 'asciicircum',
  9910. 'underscore',
  9911. 'grave',
  9912. 'a',
  9913. 'b',
  9914. 'c',
  9915. 'd',
  9916. 'e',
  9917. 'f',
  9918. 'g',
  9919. 'h',
  9920. 'i',
  9921. 'j',
  9922. 'k',
  9923. 'l',
  9924. 'm',
  9925. 'n',
  9926. 'o',
  9927. 'p',
  9928. 'q',
  9929. 'r',
  9930. 's',
  9931. 't',
  9932. 'u',
  9933. 'v',
  9934. 'w',
  9935. 'x',
  9936. 'y',
  9937. 'z',
  9938. 'braceleft',
  9939. 'bar',
  9940. 'braceright',
  9941. 'asciitilde',
  9942. '',
  9943. 'Adieresis',
  9944. 'Aring',
  9945. 'Ccedilla',
  9946. 'Eacute',
  9947. 'Ntilde',
  9948. 'Odieresis',
  9949. 'Udieresis',
  9950. 'aacute',
  9951. 'agrave',
  9952. 'acircumflex',
  9953. 'adieresis',
  9954. 'atilde',
  9955. 'aring',
  9956. 'ccedilla',
  9957. 'eacute',
  9958. 'egrave',
  9959. 'ecircumflex',
  9960. 'edieresis',
  9961. 'iacute',
  9962. 'igrave',
  9963. 'icircumflex',
  9964. 'idieresis',
  9965. 'ntilde',
  9966. 'oacute',
  9967. 'ograve',
  9968. 'ocircumflex',
  9969. 'odieresis',
  9970. 'otilde',
  9971. 'uacute',
  9972. 'ugrave',
  9973. 'ucircumflex',
  9974. 'udieresis',
  9975. 'dagger',
  9976. 'degree',
  9977. 'cent',
  9978. 'sterling',
  9979. 'section',
  9980. 'bullet',
  9981. 'paragraph',
  9982. 'germandbls',
  9983. 'registered',
  9984. 'copyright',
  9985. 'trademark',
  9986. 'acute',
  9987. 'dieresis',
  9988. 'notequal',
  9989. 'AE',
  9990. 'Oslash',
  9991. 'infinity',
  9992. 'plusminus',
  9993. 'lessequal',
  9994. 'greaterequal',
  9995. 'yen',
  9996. 'mu',
  9997. 'partialdiff',
  9998. 'summation',
  9999. 'product',
  10000. 'pi',
  10001. 'integral',
  10002. 'ordfeminine',
  10003. 'ordmasculine',
  10004. 'Omega',
  10005. 'ae',
  10006. 'oslash',
  10007. 'questiondown',
  10008. 'exclamdown',
  10009. 'logicalnot',
  10010. 'radical',
  10011. 'florin',
  10012. 'approxequal',
  10013. 'Delta',
  10014. 'guillemotleft',
  10015. 'guillemotright',
  10016. 'ellipsis',
  10017. 'space',
  10018. 'Agrave',
  10019. 'Atilde',
  10020. 'Otilde',
  10021. 'OE',
  10022. 'oe',
  10023. 'endash',
  10024. 'emdash',
  10025. 'quotedblleft',
  10026. 'quotedblright',
  10027. 'quoteleft',
  10028. 'quoteright',
  10029. 'divide',
  10030. 'lozenge',
  10031. 'ydieresis',
  10032. 'Ydieresis',
  10033. 'fraction',
  10034. 'currency',
  10035. 'guilsinglleft',
  10036. 'guilsinglright',
  10037. 'fi',
  10038. 'fl',
  10039. 'daggerdbl',
  10040. 'periodcentered',
  10041. 'quotesinglbase',
  10042. 'quotedblbase',
  10043. 'perthousand',
  10044. 'Acircumflex',
  10045. 'Ecircumflex',
  10046. 'Aacute',
  10047. 'Edieresis',
  10048. 'Egrave',
  10049. 'Iacute',
  10050. 'Icircumflex',
  10051. 'Idieresis',
  10052. 'Igrave',
  10053. 'Oacute',
  10054. 'Ocircumflex',
  10055. 'apple',
  10056. 'Ograve',
  10057. 'Uacute',
  10058. 'Ucircumflex',
  10059. 'Ugrave',
  10060. 'dotlessi',
  10061. 'circumflex',
  10062. 'tilde',
  10063. 'macron',
  10064. 'breve',
  10065. 'dotaccent',
  10066. 'ring',
  10067. 'cedilla',
  10068. 'hungarumlaut',
  10069. 'ogonek',
  10070. 'caron'
  10071. ];
  10072. var StandardEncoding = [
  10073. '',
  10074. '',
  10075. '',
  10076. '',
  10077. '',
  10078. '',
  10079. '',
  10080. '',
  10081. '',
  10082. '',
  10083. '',
  10084. '',
  10085. '',
  10086. '',
  10087. '',
  10088. '',
  10089. '',
  10090. '',
  10091. '',
  10092. '',
  10093. '',
  10094. '',
  10095. '',
  10096. '',
  10097. '',
  10098. '',
  10099. '',
  10100. '',
  10101. '',
  10102. '',
  10103. '',
  10104. '',
  10105. 'space',
  10106. 'exclam',
  10107. 'quotedbl',
  10108. 'numbersign',
  10109. 'dollar',
  10110. 'percent',
  10111. 'ampersand',
  10112. 'quoteright',
  10113. 'parenleft',
  10114. 'parenright',
  10115. 'asterisk',
  10116. 'plus',
  10117. 'comma',
  10118. 'hyphen',
  10119. 'period',
  10120. 'slash',
  10121. 'zero',
  10122. 'one',
  10123. 'two',
  10124. 'three',
  10125. 'four',
  10126. 'five',
  10127. 'six',
  10128. 'seven',
  10129. 'eight',
  10130. 'nine',
  10131. 'colon',
  10132. 'semicolon',
  10133. 'less',
  10134. 'equal',
  10135. 'greater',
  10136. 'question',
  10137. 'at',
  10138. 'A',
  10139. 'B',
  10140. 'C',
  10141. 'D',
  10142. 'E',
  10143. 'F',
  10144. 'G',
  10145. 'H',
  10146. 'I',
  10147. 'J',
  10148. 'K',
  10149. 'L',
  10150. 'M',
  10151. 'N',
  10152. 'O',
  10153. 'P',
  10154. 'Q',
  10155. 'R',
  10156. 'S',
  10157. 'T',
  10158. 'U',
  10159. 'V',
  10160. 'W',
  10161. 'X',
  10162. 'Y',
  10163. 'Z',
  10164. 'bracketleft',
  10165. 'backslash',
  10166. 'bracketright',
  10167. 'asciicircum',
  10168. 'underscore',
  10169. 'quoteleft',
  10170. 'a',
  10171. 'b',
  10172. 'c',
  10173. 'd',
  10174. 'e',
  10175. 'f',
  10176. 'g',
  10177. 'h',
  10178. 'i',
  10179. 'j',
  10180. 'k',
  10181. 'l',
  10182. 'm',
  10183. 'n',
  10184. 'o',
  10185. 'p',
  10186. 'q',
  10187. 'r',
  10188. 's',
  10189. 't',
  10190. 'u',
  10191. 'v',
  10192. 'w',
  10193. 'x',
  10194. 'y',
  10195. 'z',
  10196. 'braceleft',
  10197. 'bar',
  10198. 'braceright',
  10199. 'asciitilde',
  10200. '',
  10201. '',
  10202. '',
  10203. '',
  10204. '',
  10205. '',
  10206. '',
  10207. '',
  10208. '',
  10209. '',
  10210. '',
  10211. '',
  10212. '',
  10213. '',
  10214. '',
  10215. '',
  10216. '',
  10217. '',
  10218. '',
  10219. '',
  10220. '',
  10221. '',
  10222. '',
  10223. '',
  10224. '',
  10225. '',
  10226. '',
  10227. '',
  10228. '',
  10229. '',
  10230. '',
  10231. '',
  10232. '',
  10233. '',
  10234. 'exclamdown',
  10235. 'cent',
  10236. 'sterling',
  10237. 'fraction',
  10238. 'yen',
  10239. 'florin',
  10240. 'section',
  10241. 'currency',
  10242. 'quotesingle',
  10243. 'quotedblleft',
  10244. 'guillemotleft',
  10245. 'guilsinglleft',
  10246. 'guilsinglright',
  10247. 'fi',
  10248. 'fl',
  10249. '',
  10250. 'endash',
  10251. 'dagger',
  10252. 'daggerdbl',
  10253. 'periodcentered',
  10254. '',
  10255. 'paragraph',
  10256. 'bullet',
  10257. 'quotesinglbase',
  10258. 'quotedblbase',
  10259. 'quotedblright',
  10260. 'guillemotright',
  10261. 'ellipsis',
  10262. 'perthousand',
  10263. '',
  10264. 'questiondown',
  10265. '',
  10266. 'grave',
  10267. 'acute',
  10268. 'circumflex',
  10269. 'tilde',
  10270. 'macron',
  10271. 'breve',
  10272. 'dotaccent',
  10273. 'dieresis',
  10274. '',
  10275. 'ring',
  10276. 'cedilla',
  10277. '',
  10278. 'hungarumlaut',
  10279. 'ogonek',
  10280. 'caron',
  10281. 'emdash',
  10282. '',
  10283. '',
  10284. '',
  10285. '',
  10286. '',
  10287. '',
  10288. '',
  10289. '',
  10290. '',
  10291. '',
  10292. '',
  10293. '',
  10294. '',
  10295. '',
  10296. '',
  10297. '',
  10298. 'AE',
  10299. '',
  10300. 'ordfeminine',
  10301. '',
  10302. '',
  10303. '',
  10304. '',
  10305. 'Lslash',
  10306. 'Oslash',
  10307. 'OE',
  10308. 'ordmasculine',
  10309. '',
  10310. '',
  10311. '',
  10312. '',
  10313. '',
  10314. 'ae',
  10315. '',
  10316. '',
  10317. '',
  10318. 'dotlessi',
  10319. '',
  10320. '',
  10321. 'lslash',
  10322. 'oslash',
  10323. 'oe',
  10324. 'germandbls'
  10325. ];
  10326. var WinAnsiEncoding = [
  10327. '',
  10328. '',
  10329. '',
  10330. '',
  10331. '',
  10332. '',
  10333. '',
  10334. '',
  10335. '',
  10336. '',
  10337. '',
  10338. '',
  10339. '',
  10340. '',
  10341. '',
  10342. '',
  10343. '',
  10344. '',
  10345. '',
  10346. '',
  10347. '',
  10348. '',
  10349. '',
  10350. '',
  10351. '',
  10352. '',
  10353. '',
  10354. '',
  10355. '',
  10356. '',
  10357. '',
  10358. '',
  10359. 'space',
  10360. 'exclam',
  10361. 'quotedbl',
  10362. 'numbersign',
  10363. 'dollar',
  10364. 'percent',
  10365. 'ampersand',
  10366. 'quotesingle',
  10367. 'parenleft',
  10368. 'parenright',
  10369. 'asterisk',
  10370. 'plus',
  10371. 'comma',
  10372. 'hyphen',
  10373. 'period',
  10374. 'slash',
  10375. 'zero',
  10376. 'one',
  10377. 'two',
  10378. 'three',
  10379. 'four',
  10380. 'five',
  10381. 'six',
  10382. 'seven',
  10383. 'eight',
  10384. 'nine',
  10385. 'colon',
  10386. 'semicolon',
  10387. 'less',
  10388. 'equal',
  10389. 'greater',
  10390. 'question',
  10391. 'at',
  10392. 'A',
  10393. 'B',
  10394. 'C',
  10395. 'D',
  10396. 'E',
  10397. 'F',
  10398. 'G',
  10399. 'H',
  10400. 'I',
  10401. 'J',
  10402. 'K',
  10403. 'L',
  10404. 'M',
  10405. 'N',
  10406. 'O',
  10407. 'P',
  10408. 'Q',
  10409. 'R',
  10410. 'S',
  10411. 'T',
  10412. 'U',
  10413. 'V',
  10414. 'W',
  10415. 'X',
  10416. 'Y',
  10417. 'Z',
  10418. 'bracketleft',
  10419. 'backslash',
  10420. 'bracketright',
  10421. 'asciicircum',
  10422. 'underscore',
  10423. 'grave',
  10424. 'a',
  10425. 'b',
  10426. 'c',
  10427. 'd',
  10428. 'e',
  10429. 'f',
  10430. 'g',
  10431. 'h',
  10432. 'i',
  10433. 'j',
  10434. 'k',
  10435. 'l',
  10436. 'm',
  10437. 'n',
  10438. 'o',
  10439. 'p',
  10440. 'q',
  10441. 'r',
  10442. 's',
  10443. 't',
  10444. 'u',
  10445. 'v',
  10446. 'w',
  10447. 'x',
  10448. 'y',
  10449. 'z',
  10450. 'braceleft',
  10451. 'bar',
  10452. 'braceright',
  10453. 'asciitilde',
  10454. 'bullet',
  10455. 'Euro',
  10456. 'bullet',
  10457. 'quotesinglbase',
  10458. 'florin',
  10459. 'quotedblbase',
  10460. 'ellipsis',
  10461. 'dagger',
  10462. 'daggerdbl',
  10463. 'circumflex',
  10464. 'perthousand',
  10465. 'Scaron',
  10466. 'guilsinglleft',
  10467. 'OE',
  10468. 'bullet',
  10469. 'Zcaron',
  10470. 'bullet',
  10471. 'bullet',
  10472. 'quoteleft',
  10473. 'quoteright',
  10474. 'quotedblleft',
  10475. 'quotedblright',
  10476. 'bullet',
  10477. 'endash',
  10478. 'emdash',
  10479. 'tilde',
  10480. 'trademark',
  10481. 'scaron',
  10482. 'guilsinglright',
  10483. 'oe',
  10484. 'bullet',
  10485. 'zcaron',
  10486. 'Ydieresis',
  10487. 'space',
  10488. 'exclamdown',
  10489. 'cent',
  10490. 'sterling',
  10491. 'currency',
  10492. 'yen',
  10493. 'brokenbar',
  10494. 'section',
  10495. 'dieresis',
  10496. 'copyright',
  10497. 'ordfeminine',
  10498. 'guillemotleft',
  10499. 'logicalnot',
  10500. 'hyphen',
  10501. 'registered',
  10502. 'macron',
  10503. 'degree',
  10504. 'plusminus',
  10505. 'twosuperior',
  10506. 'threesuperior',
  10507. 'acute',
  10508. 'mu',
  10509. 'paragraph',
  10510. 'periodcentered',
  10511. 'cedilla',
  10512. 'onesuperior',
  10513. 'ordmasculine',
  10514. 'guillemotright',
  10515. 'onequarter',
  10516. 'onehalf',
  10517. 'threequarters',
  10518. 'questiondown',
  10519. 'Agrave',
  10520. 'Aacute',
  10521. 'Acircumflex',
  10522. 'Atilde',
  10523. 'Adieresis',
  10524. 'Aring',
  10525. 'AE',
  10526. 'Ccedilla',
  10527. 'Egrave',
  10528. 'Eacute',
  10529. 'Ecircumflex',
  10530. 'Edieresis',
  10531. 'Igrave',
  10532. 'Iacute',
  10533. 'Icircumflex',
  10534. 'Idieresis',
  10535. 'Eth',
  10536. 'Ntilde',
  10537. 'Ograve',
  10538. 'Oacute',
  10539. 'Ocircumflex',
  10540. 'Otilde',
  10541. 'Odieresis',
  10542. 'multiply',
  10543. 'Oslash',
  10544. 'Ugrave',
  10545. 'Uacute',
  10546. 'Ucircumflex',
  10547. 'Udieresis',
  10548. 'Yacute',
  10549. 'Thorn',
  10550. 'germandbls',
  10551. 'agrave',
  10552. 'aacute',
  10553. 'acircumflex',
  10554. 'atilde',
  10555. 'adieresis',
  10556. 'aring',
  10557. 'ae',
  10558. 'ccedilla',
  10559. 'egrave',
  10560. 'eacute',
  10561. 'ecircumflex',
  10562. 'edieresis',
  10563. 'igrave',
  10564. 'iacute',
  10565. 'icircumflex',
  10566. 'idieresis',
  10567. 'eth',
  10568. 'ntilde',
  10569. 'ograve',
  10570. 'oacute',
  10571. 'ocircumflex',
  10572. 'otilde',
  10573. 'odieresis',
  10574. 'divide',
  10575. 'oslash',
  10576. 'ugrave',
  10577. 'uacute',
  10578. 'ucircumflex',
  10579. 'udieresis',
  10580. 'yacute',
  10581. 'thorn',
  10582. 'ydieresis'
  10583. ];
  10584. var SymbolSetEncoding = [
  10585. '',
  10586. '',
  10587. '',
  10588. '',
  10589. '',
  10590. '',
  10591. '',
  10592. '',
  10593. '',
  10594. '',
  10595. '',
  10596. '',
  10597. '',
  10598. '',
  10599. '',
  10600. '',
  10601. '',
  10602. '',
  10603. '',
  10604. '',
  10605. '',
  10606. '',
  10607. '',
  10608. '',
  10609. '',
  10610. '',
  10611. '',
  10612. '',
  10613. '',
  10614. '',
  10615. '',
  10616. '',
  10617. 'space',
  10618. 'exclam',
  10619. 'universal',
  10620. 'numbersign',
  10621. 'existential',
  10622. 'percent',
  10623. 'ampersand',
  10624. 'suchthat',
  10625. 'parenleft',
  10626. 'parenright',
  10627. 'asteriskmath',
  10628. 'plus',
  10629. 'comma',
  10630. 'minus',
  10631. 'period',
  10632. 'slash',
  10633. 'zero',
  10634. 'one',
  10635. 'two',
  10636. 'three',
  10637. 'four',
  10638. 'five',
  10639. 'six',
  10640. 'seven',
  10641. 'eight',
  10642. 'nine',
  10643. 'colon',
  10644. 'semicolon',
  10645. 'less',
  10646. 'equal',
  10647. 'greater',
  10648. 'question',
  10649. 'congruent',
  10650. 'Alpha',
  10651. 'Beta',
  10652. 'Chi',
  10653. 'Delta',
  10654. 'Epsilon',
  10655. 'Phi',
  10656. 'Gamma',
  10657. 'Eta',
  10658. 'Iota',
  10659. 'theta1',
  10660. 'Kappa',
  10661. 'Lambda',
  10662. 'Mu',
  10663. 'Nu',
  10664. 'Omicron',
  10665. 'Pi',
  10666. 'Theta',
  10667. 'Rho',
  10668. 'Sigma',
  10669. 'Tau',
  10670. 'Upsilon',
  10671. 'sigma1',
  10672. 'Omega',
  10673. 'Xi',
  10674. 'Psi',
  10675. 'Zeta',
  10676. 'bracketleft',
  10677. 'therefore',
  10678. 'bracketright',
  10679. 'perpendicular',
  10680. 'underscore',
  10681. 'radicalex',
  10682. 'alpha',
  10683. 'beta',
  10684. 'chi',
  10685. 'delta',
  10686. 'epsilon',
  10687. 'phi',
  10688. 'gamma',
  10689. 'eta',
  10690. 'iota',
  10691. 'phi1',
  10692. 'kappa',
  10693. 'lambda',
  10694. 'mu',
  10695. 'nu',
  10696. 'omicron',
  10697. 'pi',
  10698. 'theta',
  10699. 'rho',
  10700. 'sigma',
  10701. 'tau',
  10702. 'upsilon',
  10703. 'omega1',
  10704. 'omega',
  10705. 'xi',
  10706. 'psi',
  10707. 'zeta',
  10708. 'braceleft',
  10709. 'bar',
  10710. 'braceright',
  10711. 'similar',
  10712. '',
  10713. '',
  10714. '',
  10715. '',
  10716. '',
  10717. '',
  10718. '',
  10719. '',
  10720. '',
  10721. '',
  10722. '',
  10723. '',
  10724. '',
  10725. '',
  10726. '',
  10727. '',
  10728. '',
  10729. '',
  10730. '',
  10731. '',
  10732. '',
  10733. '',
  10734. '',
  10735. '',
  10736. '',
  10737. '',
  10738. '',
  10739. '',
  10740. '',
  10741. '',
  10742. '',
  10743. '',
  10744. '',
  10745. 'Euro',
  10746. 'Upsilon1',
  10747. 'minute',
  10748. 'lessequal',
  10749. 'fraction',
  10750. 'infinity',
  10751. 'florin',
  10752. 'club',
  10753. 'diamond',
  10754. 'heart',
  10755. 'spade',
  10756. 'arrowboth',
  10757. 'arrowleft',
  10758. 'arrowup',
  10759. 'arrowright',
  10760. 'arrowdown',
  10761. 'degree',
  10762. 'plusminus',
  10763. 'second',
  10764. 'greaterequal',
  10765. 'multiply',
  10766. 'proportional',
  10767. 'partialdiff',
  10768. 'bullet',
  10769. 'divide',
  10770. 'notequal',
  10771. 'equivalence',
  10772. 'approxequal',
  10773. 'ellipsis',
  10774. 'arrowvertex',
  10775. 'arrowhorizex',
  10776. 'carriagereturn',
  10777. 'aleph',
  10778. 'Ifraktur',
  10779. 'Rfraktur',
  10780. 'weierstrass',
  10781. 'circlemultiply',
  10782. 'circleplus',
  10783. 'emptyset',
  10784. 'intersection',
  10785. 'union',
  10786. 'propersuperset',
  10787. 'reflexsuperset',
  10788. 'notsubset',
  10789. 'propersubset',
  10790. 'reflexsubset',
  10791. 'element',
  10792. 'notelement',
  10793. 'angle',
  10794. 'gradient',
  10795. 'registerserif',
  10796. 'copyrightserif',
  10797. 'trademarkserif',
  10798. 'product',
  10799. 'radical',
  10800. 'dotmath',
  10801. 'logicalnot',
  10802. 'logicaland',
  10803. 'logicalor',
  10804. 'arrowdblboth',
  10805. 'arrowdblleft',
  10806. 'arrowdblup',
  10807. 'arrowdblright',
  10808. 'arrowdbldown',
  10809. 'lozenge',
  10810. 'angleleft',
  10811. 'registersans',
  10812. 'copyrightsans',
  10813. 'trademarksans',
  10814. 'summation',
  10815. 'parenlefttp',
  10816. 'parenleftex',
  10817. 'parenleftbt',
  10818. 'bracketlefttp',
  10819. 'bracketleftex',
  10820. 'bracketleftbt',
  10821. 'bracelefttp',
  10822. 'braceleftmid',
  10823. 'braceleftbt',
  10824. 'braceex',
  10825. '',
  10826. 'angleright',
  10827. 'integral',
  10828. 'integraltp',
  10829. 'integralex',
  10830. 'integralbt',
  10831. 'parenrighttp',
  10832. 'parenrightex',
  10833. 'parenrightbt',
  10834. 'bracketrighttp',
  10835. 'bracketrightex',
  10836. 'bracketrightbt',
  10837. 'bracerighttp',
  10838. 'bracerightmid',
  10839. 'bracerightbt'
  10840. ];
  10841. var ZapfDingbatsEncoding = [
  10842. '',
  10843. '',
  10844. '',
  10845. '',
  10846. '',
  10847. '',
  10848. '',
  10849. '',
  10850. '',
  10851. '',
  10852. '',
  10853. '',
  10854. '',
  10855. '',
  10856. '',
  10857. '',
  10858. '',
  10859. '',
  10860. '',
  10861. '',
  10862. '',
  10863. '',
  10864. '',
  10865. '',
  10866. '',
  10867. '',
  10868. '',
  10869. '',
  10870. '',
  10871. '',
  10872. '',
  10873. '',
  10874. 'space',
  10875. 'a1',
  10876. 'a2',
  10877. 'a202',
  10878. 'a3',
  10879. 'a4',
  10880. 'a5',
  10881. 'a119',
  10882. 'a118',
  10883. 'a117',
  10884. 'a11',
  10885. 'a12',
  10886. 'a13',
  10887. 'a14',
  10888. 'a15',
  10889. 'a16',
  10890. 'a105',
  10891. 'a17',
  10892. 'a18',
  10893. 'a19',
  10894. 'a20',
  10895. 'a21',
  10896. 'a22',
  10897. 'a23',
  10898. 'a24',
  10899. 'a25',
  10900. 'a26',
  10901. 'a27',
  10902. 'a28',
  10903. 'a6',
  10904. 'a7',
  10905. 'a8',
  10906. 'a9',
  10907. 'a10',
  10908. 'a29',
  10909. 'a30',
  10910. 'a31',
  10911. 'a32',
  10912. 'a33',
  10913. 'a34',
  10914. 'a35',
  10915. 'a36',
  10916. 'a37',
  10917. 'a38',
  10918. 'a39',
  10919. 'a40',
  10920. 'a41',
  10921. 'a42',
  10922. 'a43',
  10923. 'a44',
  10924. 'a45',
  10925. 'a46',
  10926. 'a47',
  10927. 'a48',
  10928. 'a49',
  10929. 'a50',
  10930. 'a51',
  10931. 'a52',
  10932. 'a53',
  10933. 'a54',
  10934. 'a55',
  10935. 'a56',
  10936. 'a57',
  10937. 'a58',
  10938. 'a59',
  10939. 'a60',
  10940. 'a61',
  10941. 'a62',
  10942. 'a63',
  10943. 'a64',
  10944. 'a65',
  10945. 'a66',
  10946. 'a67',
  10947. 'a68',
  10948. 'a69',
  10949. 'a70',
  10950. 'a71',
  10951. 'a72',
  10952. 'a73',
  10953. 'a74',
  10954. 'a203',
  10955. 'a75',
  10956. 'a204',
  10957. 'a76',
  10958. 'a77',
  10959. 'a78',
  10960. 'a79',
  10961. 'a81',
  10962. 'a82',
  10963. 'a83',
  10964. 'a84',
  10965. 'a97',
  10966. 'a98',
  10967. 'a99',
  10968. 'a100',
  10969. '',
  10970. 'a89',
  10971. 'a90',
  10972. 'a93',
  10973. 'a94',
  10974. 'a91',
  10975. 'a92',
  10976. 'a205',
  10977. 'a85',
  10978. 'a206',
  10979. 'a86',
  10980. 'a87',
  10981. 'a88',
  10982. 'a95',
  10983. 'a96',
  10984. '',
  10985. '',
  10986. '',
  10987. '',
  10988. '',
  10989. '',
  10990. '',
  10991. '',
  10992. '',
  10993. '',
  10994. '',
  10995. '',
  10996. '',
  10997. '',
  10998. '',
  10999. '',
  11000. '',
  11001. '',
  11002. '',
  11003. 'a101',
  11004. 'a102',
  11005. 'a103',
  11006. 'a104',
  11007. 'a106',
  11008. 'a107',
  11009. 'a108',
  11010. 'a112',
  11011. 'a111',
  11012. 'a110',
  11013. 'a109',
  11014. 'a120',
  11015. 'a121',
  11016. 'a122',
  11017. 'a123',
  11018. 'a124',
  11019. 'a125',
  11020. 'a126',
  11021. 'a127',
  11022. 'a128',
  11023. 'a129',
  11024. 'a130',
  11025. 'a131',
  11026. 'a132',
  11027. 'a133',
  11028. 'a134',
  11029. 'a135',
  11030. 'a136',
  11031. 'a137',
  11032. 'a138',
  11033. 'a139',
  11034. 'a140',
  11035. 'a141',
  11036. 'a142',
  11037. 'a143',
  11038. 'a144',
  11039. 'a145',
  11040. 'a146',
  11041. 'a147',
  11042. 'a148',
  11043. 'a149',
  11044. 'a150',
  11045. 'a151',
  11046. 'a152',
  11047. 'a153',
  11048. 'a154',
  11049. 'a155',
  11050. 'a156',
  11051. 'a157',
  11052. 'a158',
  11053. 'a159',
  11054. 'a160',
  11055. 'a161',
  11056. 'a163',
  11057. 'a164',
  11058. 'a196',
  11059. 'a165',
  11060. 'a192',
  11061. 'a166',
  11062. 'a167',
  11063. 'a168',
  11064. 'a169',
  11065. 'a170',
  11066. 'a171',
  11067. 'a172',
  11068. 'a173',
  11069. 'a162',
  11070. 'a174',
  11071. 'a175',
  11072. 'a176',
  11073. 'a177',
  11074. 'a178',
  11075. 'a179',
  11076. 'a193',
  11077. 'a180',
  11078. 'a199',
  11079. 'a181',
  11080. 'a200',
  11081. 'a182',
  11082. '',
  11083. 'a201',
  11084. 'a183',
  11085. 'a184',
  11086. 'a197',
  11087. 'a185',
  11088. 'a194',
  11089. 'a198',
  11090. 'a186',
  11091. 'a195',
  11092. 'a187',
  11093. 'a188',
  11094. 'a189',
  11095. 'a190',
  11096. 'a191'
  11097. ];
  11098. function getEncoding(encodingName) {
  11099. switch (encodingName) {
  11100. case 'WinAnsiEncoding':
  11101. return WinAnsiEncoding;
  11102. case 'StandardEncoding':
  11103. return StandardEncoding;
  11104. case 'MacRomanEncoding':
  11105. return MacRomanEncoding;
  11106. case 'SymbolSetEncoding':
  11107. return SymbolSetEncoding;
  11108. case 'ZapfDingbatsEncoding':
  11109. return ZapfDingbatsEncoding;
  11110. case 'ExpertEncoding':
  11111. return ExpertEncoding;
  11112. case 'MacExpertEncoding':
  11113. return MacExpertEncoding;
  11114. default:
  11115. return null;
  11116. }
  11117. }
  11118. exports.WinAnsiEncoding = WinAnsiEncoding;
  11119. exports.StandardEncoding = StandardEncoding;
  11120. exports.MacRomanEncoding = MacRomanEncoding;
  11121. exports.SymbolSetEncoding = SymbolSetEncoding;
  11122. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  11123. exports.ExpertEncoding = ExpertEncoding;
  11124. exports.getEncoding = getEncoding;
  11125. /***/ }),
  11126. /* 5 */
  11127. /***/ (function(module, exports, __w_pdfjs_require__) {
  11128. "use strict";
  11129. var sharedUtil = __w_pdfjs_require__(0);
  11130. var corePrimitives = __w_pdfjs_require__(1);
  11131. var coreStream = __w_pdfjs_require__(2);
  11132. var MissingDataException = sharedUtil.MissingDataException;
  11133. var StreamType = sharedUtil.StreamType;
  11134. var assert = sharedUtil.assert;
  11135. var error = sharedUtil.error;
  11136. var info = sharedUtil.info;
  11137. var isArray = sharedUtil.isArray;
  11138. var isInt = sharedUtil.isInt;
  11139. var isNum = sharedUtil.isNum;
  11140. var isString = sharedUtil.isString;
  11141. var warn = sharedUtil.warn;
  11142. var EOF = corePrimitives.EOF;
  11143. var Cmd = corePrimitives.Cmd;
  11144. var Dict = corePrimitives.Dict;
  11145. var Name = corePrimitives.Name;
  11146. var Ref = corePrimitives.Ref;
  11147. var isEOF = corePrimitives.isEOF;
  11148. var isCmd = corePrimitives.isCmd;
  11149. var isDict = corePrimitives.isDict;
  11150. var isName = corePrimitives.isName;
  11151. var Ascii85Stream = coreStream.Ascii85Stream;
  11152. var AsciiHexStream = coreStream.AsciiHexStream;
  11153. var CCITTFaxStream = coreStream.CCITTFaxStream;
  11154. var FlateStream = coreStream.FlateStream;
  11155. var Jbig2Stream = coreStream.Jbig2Stream;
  11156. var JpegStream = coreStream.JpegStream;
  11157. var JpxStream = coreStream.JpxStream;
  11158. var LZWStream = coreStream.LZWStream;
  11159. var NullStream = coreStream.NullStream;
  11160. var PredictorStream = coreStream.PredictorStream;
  11161. var RunLengthStream = coreStream.RunLengthStream;
  11162. var MAX_LENGTH_TO_CACHE = 1000;
  11163. var Parser = function ParserClosure() {
  11164. function Parser(lexer, allowStreams, xref, recoveryMode) {
  11165. this.lexer = lexer;
  11166. this.allowStreams = allowStreams;
  11167. this.xref = xref;
  11168. this.recoveryMode = recoveryMode || false;
  11169. this.imageCache = Object.create(null);
  11170. this.refill();
  11171. }
  11172. Parser.prototype = {
  11173. refill: function Parser_refill() {
  11174. this.buf1 = this.lexer.getObj();
  11175. this.buf2 = this.lexer.getObj();
  11176. },
  11177. shift: function Parser_shift() {
  11178. if (isCmd(this.buf2, 'ID')) {
  11179. this.buf1 = this.buf2;
  11180. this.buf2 = null;
  11181. } else {
  11182. this.buf1 = this.buf2;
  11183. this.buf2 = this.lexer.getObj();
  11184. }
  11185. },
  11186. tryShift: function Parser_tryShift() {
  11187. try {
  11188. this.shift();
  11189. return true;
  11190. } catch (e) {
  11191. if (e instanceof MissingDataException) {
  11192. throw e;
  11193. }
  11194. return false;
  11195. }
  11196. },
  11197. getObj: function Parser_getObj(cipherTransform) {
  11198. var buf1 = this.buf1;
  11199. this.shift();
  11200. if (buf1 instanceof Cmd) {
  11201. switch (buf1.cmd) {
  11202. case 'BI':
  11203. return this.makeInlineImage(cipherTransform);
  11204. case '[':
  11205. var array = [];
  11206. while (!isCmd(this.buf1, ']') && !isEOF(this.buf1)) {
  11207. array.push(this.getObj(cipherTransform));
  11208. }
  11209. if (isEOF(this.buf1)) {
  11210. if (!this.recoveryMode) {
  11211. error('End of file inside array');
  11212. }
  11213. return array;
  11214. }
  11215. this.shift();
  11216. return array;
  11217. case '<<':
  11218. var dict = new Dict(this.xref);
  11219. while (!isCmd(this.buf1, '>>') && !isEOF(this.buf1)) {
  11220. if (!isName(this.buf1)) {
  11221. info('Malformed dictionary: key must be a name object');
  11222. this.shift();
  11223. continue;
  11224. }
  11225. var key = this.buf1.name;
  11226. this.shift();
  11227. if (isEOF(this.buf1)) {
  11228. break;
  11229. }
  11230. dict.set(key, this.getObj(cipherTransform));
  11231. }
  11232. if (isEOF(this.buf1)) {
  11233. if (!this.recoveryMode) {
  11234. error('End of file inside dictionary');
  11235. }
  11236. return dict;
  11237. }
  11238. if (isCmd(this.buf2, 'stream')) {
  11239. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  11240. }
  11241. this.shift();
  11242. return dict;
  11243. default:
  11244. return buf1;
  11245. }
  11246. }
  11247. if (isInt(buf1)) {
  11248. var num = buf1;
  11249. if (isInt(this.buf1) && isCmd(this.buf2, 'R')) {
  11250. var ref = new Ref(num, this.buf1);
  11251. this.shift();
  11252. this.shift();
  11253. return ref;
  11254. }
  11255. return num;
  11256. }
  11257. if (isString(buf1)) {
  11258. var str = buf1;
  11259. if (cipherTransform) {
  11260. str = cipherTransform.decryptString(str);
  11261. }
  11262. return str;
  11263. }
  11264. return buf1;
  11265. },
  11266. findDefaultInlineStreamEnd: function Parser_findDefaultInlineStreamEnd(stream) {
  11267. var E = 0x45, I = 0x49, SPACE = 0x20, LF = 0xA, CR = 0xD;
  11268. var startPos = stream.pos, state = 0, ch, i, n, followingBytes;
  11269. while ((ch = stream.getByte()) !== -1) {
  11270. if (state === 0) {
  11271. state = ch === E ? 1 : 0;
  11272. } else if (state === 1) {
  11273. state = ch === I ? 2 : 0;
  11274. } else {
  11275. assert(state === 2);
  11276. if (ch === SPACE || ch === LF || ch === CR) {
  11277. n = 5;
  11278. followingBytes = stream.peekBytes(n);
  11279. for (i = 0; i < n; i++) {
  11280. ch = followingBytes[i];
  11281. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7F)) {
  11282. state = 0;
  11283. break;
  11284. }
  11285. }
  11286. if (state === 2) {
  11287. break;
  11288. }
  11289. } else {
  11290. state = 0;
  11291. }
  11292. }
  11293. }
  11294. return stream.pos - 4 - startPos;
  11295. },
  11296. findDCTDecodeInlineStreamEnd: function Parser_findDCTDecodeInlineStreamEnd(stream) {
  11297. var startPos = stream.pos, foundEOI = false, b, markerLength, length;
  11298. while ((b = stream.getByte()) !== -1) {
  11299. if (b !== 0xFF) {
  11300. continue;
  11301. }
  11302. switch (stream.getByte()) {
  11303. case 0x00:
  11304. break;
  11305. case 0xFF:
  11306. stream.skip(-1);
  11307. break;
  11308. case 0xD9:
  11309. foundEOI = true;
  11310. break;
  11311. case 0xC0:
  11312. case 0xC1:
  11313. case 0xC2:
  11314. case 0xC3:
  11315. case 0xC5:
  11316. case 0xC6:
  11317. case 0xC7:
  11318. case 0xC9:
  11319. case 0xCA:
  11320. case 0xCB:
  11321. case 0xCD:
  11322. case 0xCE:
  11323. case 0xCF:
  11324. case 0xC4:
  11325. case 0xCC:
  11326. case 0xDA:
  11327. case 0xDB:
  11328. case 0xDC:
  11329. case 0xDD:
  11330. case 0xDE:
  11331. case 0xDF:
  11332. case 0xE0:
  11333. case 0xE1:
  11334. case 0xE2:
  11335. case 0xE3:
  11336. case 0xE4:
  11337. case 0xE5:
  11338. case 0xE6:
  11339. case 0xE7:
  11340. case 0xE8:
  11341. case 0xE9:
  11342. case 0xEA:
  11343. case 0xEB:
  11344. case 0xEC:
  11345. case 0xED:
  11346. case 0xEE:
  11347. case 0xEF:
  11348. case 0xFE:
  11349. markerLength = stream.getUint16();
  11350. if (markerLength > 2) {
  11351. stream.skip(markerLength - 2);
  11352. } else {
  11353. stream.skip(-2);
  11354. }
  11355. break;
  11356. }
  11357. if (foundEOI) {
  11358. break;
  11359. }
  11360. }
  11361. length = stream.pos - startPos;
  11362. if (b === -1) {
  11363. warn('Inline DCTDecode image stream: ' + 'EOI marker not found, searching for /EI/ instead.');
  11364. stream.skip(-length);
  11365. return this.findDefaultInlineStreamEnd(stream);
  11366. }
  11367. this.inlineStreamSkipEI(stream);
  11368. return length;
  11369. },
  11370. findASCII85DecodeInlineStreamEnd: function Parser_findASCII85DecodeInlineStreamEnd(stream) {
  11371. var TILDE = 0x7E, GT = 0x3E;
  11372. var startPos = stream.pos, ch, length;
  11373. while ((ch = stream.getByte()) !== -1) {
  11374. if (ch === TILDE && stream.peekByte() === GT) {
  11375. stream.skip();
  11376. break;
  11377. }
  11378. }
  11379. length = stream.pos - startPos;
  11380. if (ch === -1) {
  11381. warn('Inline ASCII85Decode image stream: ' + 'EOD marker not found, searching for /EI/ instead.');
  11382. stream.skip(-length);
  11383. return this.findDefaultInlineStreamEnd(stream);
  11384. }
  11385. this.inlineStreamSkipEI(stream);
  11386. return length;
  11387. },
  11388. findASCIIHexDecodeInlineStreamEnd: function Parser_findASCIIHexDecodeInlineStreamEnd(stream) {
  11389. var GT = 0x3E;
  11390. var startPos = stream.pos, ch, length;
  11391. while ((ch = stream.getByte()) !== -1) {
  11392. if (ch === GT) {
  11393. break;
  11394. }
  11395. }
  11396. length = stream.pos - startPos;
  11397. if (ch === -1) {
  11398. warn('Inline ASCIIHexDecode image stream: ' + 'EOD marker not found, searching for /EI/ instead.');
  11399. stream.skip(-length);
  11400. return this.findDefaultInlineStreamEnd(stream);
  11401. }
  11402. this.inlineStreamSkipEI(stream);
  11403. return length;
  11404. },
  11405. inlineStreamSkipEI: function Parser_inlineStreamSkipEI(stream) {
  11406. var E = 0x45, I = 0x49;
  11407. var state = 0, ch;
  11408. while ((ch = stream.getByte()) !== -1) {
  11409. if (state === 0) {
  11410. state = ch === E ? 1 : 0;
  11411. } else if (state === 1) {
  11412. state = ch === I ? 2 : 0;
  11413. } else if (state === 2) {
  11414. break;
  11415. }
  11416. }
  11417. },
  11418. makeInlineImage: function Parser_makeInlineImage(cipherTransform) {
  11419. var lexer = this.lexer;
  11420. var stream = lexer.stream;
  11421. var dict = new Dict(this.xref);
  11422. while (!isCmd(this.buf1, 'ID') && !isEOF(this.buf1)) {
  11423. if (!isName(this.buf1)) {
  11424. error('Dictionary key must be a name object');
  11425. }
  11426. var key = this.buf1.name;
  11427. this.shift();
  11428. if (isEOF(this.buf1)) {
  11429. break;
  11430. }
  11431. dict.set(key, this.getObj(cipherTransform));
  11432. }
  11433. var filter = dict.get('Filter', 'F'), filterName;
  11434. if (isName(filter)) {
  11435. filterName = filter.name;
  11436. } else if (isArray(filter)) {
  11437. var filterZero = this.xref.fetchIfRef(filter[0]);
  11438. if (isName(filterZero)) {
  11439. filterName = filterZero.name;
  11440. }
  11441. }
  11442. var startPos = stream.pos, length, i, ii;
  11443. if (filterName === 'DCTDecode' || filterName === 'DCT') {
  11444. length = this.findDCTDecodeInlineStreamEnd(stream);
  11445. } else if (filterName === 'ASCII85Decide' || filterName === 'A85') {
  11446. length = this.findASCII85DecodeInlineStreamEnd(stream);
  11447. } else if (filterName === 'ASCIIHexDecode' || filterName === 'AHx') {
  11448. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  11449. } else {
  11450. length = this.findDefaultInlineStreamEnd(stream);
  11451. }
  11452. var imageStream = stream.makeSubStream(startPos, length, dict);
  11453. var adler32;
  11454. if (length < MAX_LENGTH_TO_CACHE) {
  11455. var imageBytes = imageStream.getBytes();
  11456. imageStream.reset();
  11457. var a = 1;
  11458. var b = 0;
  11459. for (i = 0, ii = imageBytes.length; i < ii; ++i) {
  11460. a += imageBytes[i] & 0xff;
  11461. b += a;
  11462. }
  11463. adler32 = b % 65521 << 16 | a % 65521;
  11464. if (this.imageCache.adler32 === adler32) {
  11465. this.buf2 = Cmd.get('EI');
  11466. this.shift();
  11467. this.imageCache[adler32].reset();
  11468. return this.imageCache[adler32];
  11469. }
  11470. }
  11471. if (cipherTransform) {
  11472. imageStream = cipherTransform.createStream(imageStream, length);
  11473. }
  11474. imageStream = this.filter(imageStream, dict, length);
  11475. imageStream.dict = dict;
  11476. if (adler32 !== undefined) {
  11477. imageStream.cacheKey = 'inline_' + length + '_' + adler32;
  11478. this.imageCache[adler32] = imageStream;
  11479. }
  11480. this.buf2 = Cmd.get('EI');
  11481. this.shift();
  11482. return imageStream;
  11483. },
  11484. makeStream: function Parser_makeStream(dict, cipherTransform) {
  11485. var lexer = this.lexer;
  11486. var stream = lexer.stream;
  11487. lexer.skipToNextLine();
  11488. var pos = stream.pos - 1;
  11489. var length = dict.get('Length');
  11490. if (!isInt(length)) {
  11491. info('Bad ' + length + ' attribute in stream');
  11492. length = 0;
  11493. }
  11494. stream.pos = pos + length;
  11495. lexer.nextChar();
  11496. if (this.tryShift() && isCmd(this.buf2, 'endstream')) {
  11497. this.shift();
  11498. } else {
  11499. stream.pos = pos;
  11500. var SCAN_BLOCK_SIZE = 2048;
  11501. var ENDSTREAM_SIGNATURE_LENGTH = 9;
  11502. var ENDSTREAM_SIGNATURE = [
  11503. 0x65,
  11504. 0x6E,
  11505. 0x64,
  11506. 0x73,
  11507. 0x74,
  11508. 0x72,
  11509. 0x65,
  11510. 0x61,
  11511. 0x6D
  11512. ];
  11513. var skipped = 0, found = false, i, j;
  11514. while (stream.pos < stream.end) {
  11515. var scanBytes = stream.peekBytes(SCAN_BLOCK_SIZE);
  11516. var scanLength = scanBytes.length - ENDSTREAM_SIGNATURE_LENGTH;
  11517. if (scanLength <= 0) {
  11518. break;
  11519. }
  11520. found = false;
  11521. i = 0;
  11522. while (i < scanLength) {
  11523. j = 0;
  11524. while (j < ENDSTREAM_SIGNATURE_LENGTH && scanBytes[i + j] === ENDSTREAM_SIGNATURE[j]) {
  11525. j++;
  11526. }
  11527. if (j >= ENDSTREAM_SIGNATURE_LENGTH) {
  11528. found = true;
  11529. break;
  11530. }
  11531. i++;
  11532. }
  11533. if (found) {
  11534. skipped += i;
  11535. stream.pos += i;
  11536. break;
  11537. }
  11538. skipped += scanLength;
  11539. stream.pos += scanLength;
  11540. }
  11541. if (!found) {
  11542. error('Missing endstream');
  11543. }
  11544. length = skipped;
  11545. lexer.nextChar();
  11546. this.shift();
  11547. this.shift();
  11548. }
  11549. this.shift();
  11550. stream = stream.makeSubStream(pos, length, dict);
  11551. if (cipherTransform) {
  11552. stream = cipherTransform.createStream(stream, length);
  11553. }
  11554. stream = this.filter(stream, dict, length);
  11555. stream.dict = dict;
  11556. return stream;
  11557. },
  11558. filter: function Parser_filter(stream, dict, length) {
  11559. var filter = dict.get('Filter', 'F');
  11560. var params = dict.get('DecodeParms', 'DP');
  11561. if (isName(filter)) {
  11562. if (isArray(params)) {
  11563. params = this.xref.fetchIfRef(params[0]);
  11564. }
  11565. return this.makeFilter(stream, filter.name, length, params);
  11566. }
  11567. var maybeLength = length;
  11568. if (isArray(filter)) {
  11569. var filterArray = filter;
  11570. var paramsArray = params;
  11571. for (var i = 0, ii = filterArray.length; i < ii; ++i) {
  11572. filter = this.xref.fetchIfRef(filterArray[i]);
  11573. if (!isName(filter)) {
  11574. error('Bad filter name: ' + filter);
  11575. }
  11576. params = null;
  11577. if (isArray(paramsArray) && i in paramsArray) {
  11578. params = this.xref.fetchIfRef(paramsArray[i]);
  11579. }
  11580. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  11581. maybeLength = null;
  11582. }
  11583. }
  11584. return stream;
  11585. },
  11586. makeFilter: function Parser_makeFilter(stream, name, maybeLength, params) {
  11587. if (maybeLength === 0) {
  11588. warn('Empty "' + name + '" stream.');
  11589. return new NullStream(stream);
  11590. }
  11591. try {
  11592. var xrefStreamStats = this.xref.stats.streamTypes;
  11593. if (name === 'FlateDecode' || name === 'Fl') {
  11594. xrefStreamStats[StreamType.FLATE] = true;
  11595. if (params) {
  11596. return new PredictorStream(new FlateStream(stream, maybeLength), maybeLength, params);
  11597. }
  11598. return new FlateStream(stream, maybeLength);
  11599. }
  11600. if (name === 'LZWDecode' || name === 'LZW') {
  11601. xrefStreamStats[StreamType.LZW] = true;
  11602. var earlyChange = 1;
  11603. if (params) {
  11604. if (params.has('EarlyChange')) {
  11605. earlyChange = params.get('EarlyChange');
  11606. }
  11607. return new PredictorStream(new LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  11608. }
  11609. return new LZWStream(stream, maybeLength, earlyChange);
  11610. }
  11611. if (name === 'DCTDecode' || name === 'DCT') {
  11612. xrefStreamStats[StreamType.DCT] = true;
  11613. return new JpegStream(stream, maybeLength, stream.dict, params);
  11614. }
  11615. if (name === 'JPXDecode' || name === 'JPX') {
  11616. xrefStreamStats[StreamType.JPX] = true;
  11617. return new JpxStream(stream, maybeLength, stream.dict, params);
  11618. }
  11619. if (name === 'ASCII85Decode' || name === 'A85') {
  11620. xrefStreamStats[StreamType.A85] = true;
  11621. return new Ascii85Stream(stream, maybeLength);
  11622. }
  11623. if (name === 'ASCIIHexDecode' || name === 'AHx') {
  11624. xrefStreamStats[StreamType.AHX] = true;
  11625. return new AsciiHexStream(stream, maybeLength);
  11626. }
  11627. if (name === 'CCITTFaxDecode' || name === 'CCF') {
  11628. xrefStreamStats[StreamType.CCF] = true;
  11629. return new CCITTFaxStream(stream, maybeLength, params);
  11630. }
  11631. if (name === 'RunLengthDecode' || name === 'RL') {
  11632. xrefStreamStats[StreamType.RL] = true;
  11633. return new RunLengthStream(stream, maybeLength);
  11634. }
  11635. if (name === 'JBIG2Decode') {
  11636. xrefStreamStats[StreamType.JBIG] = true;
  11637. return new Jbig2Stream(stream, maybeLength, stream.dict, params);
  11638. }
  11639. warn('filter "' + name + '" not supported yet');
  11640. return stream;
  11641. } catch (ex) {
  11642. if (ex instanceof MissingDataException) {
  11643. throw ex;
  11644. }
  11645. warn('Invalid stream: \"' + ex + '\"');
  11646. return new NullStream(stream);
  11647. }
  11648. }
  11649. };
  11650. return Parser;
  11651. }();
  11652. var Lexer = function LexerClosure() {
  11653. function Lexer(stream, knownCommands) {
  11654. this.stream = stream;
  11655. this.nextChar();
  11656. this.strBuf = [];
  11657. this.knownCommands = knownCommands;
  11658. }
  11659. var specialChars = [
  11660. 1,
  11661. 0,
  11662. 0,
  11663. 0,
  11664. 0,
  11665. 0,
  11666. 0,
  11667. 0,
  11668. 0,
  11669. 1,
  11670. 1,
  11671. 0,
  11672. 1,
  11673. 1,
  11674. 0,
  11675. 0,
  11676. 0,
  11677. 0,
  11678. 0,
  11679. 0,
  11680. 0,
  11681. 0,
  11682. 0,
  11683. 0,
  11684. 0,
  11685. 0,
  11686. 0,
  11687. 0,
  11688. 0,
  11689. 0,
  11690. 0,
  11691. 0,
  11692. 1,
  11693. 0,
  11694. 0,
  11695. 0,
  11696. 0,
  11697. 2,
  11698. 0,
  11699. 0,
  11700. 2,
  11701. 2,
  11702. 0,
  11703. 0,
  11704. 0,
  11705. 0,
  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. 2,
  11721. 0,
  11722. 2,
  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. 0,
  11737. 0,
  11738. 0,
  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. 2,
  11752. 0,
  11753. 2,
  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. 0,
  11769. 0,
  11770. 0,
  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. 2,
  11784. 0,
  11785. 2,
  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. 0,
  11902. 0,
  11903. 0,
  11904. 0,
  11905. 0,
  11906. 0,
  11907. 0,
  11908. 0,
  11909. 0,
  11910. 0,
  11911. 0,
  11912. 0,
  11913. 0,
  11914. 0,
  11915. 0
  11916. ];
  11917. function toHexDigit(ch) {
  11918. if (ch >= 0x30 && ch <= 0x39) {
  11919. return ch & 0x0F;
  11920. }
  11921. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  11922. return (ch & 0x0F) + 9;
  11923. }
  11924. return -1;
  11925. }
  11926. Lexer.prototype = {
  11927. nextChar: function Lexer_nextChar() {
  11928. return this.currentChar = this.stream.getByte();
  11929. },
  11930. peekChar: function Lexer_peekChar() {
  11931. return this.stream.peekByte();
  11932. },
  11933. getNumber: function Lexer_getNumber() {
  11934. var ch = this.currentChar;
  11935. var eNotation = false;
  11936. var divideBy = 0;
  11937. var sign = 1;
  11938. if (ch === 0x2D) {
  11939. sign = -1;
  11940. ch = this.nextChar();
  11941. if (ch === 0x2D) {
  11942. ch = this.nextChar();
  11943. }
  11944. } else if (ch === 0x2B) {
  11945. ch = this.nextChar();
  11946. }
  11947. if (ch === 0x2E) {
  11948. divideBy = 10;
  11949. ch = this.nextChar();
  11950. }
  11951. if (ch < 0x30 || ch > 0x39) {
  11952. error('Invalid number: ' + String.fromCharCode(ch));
  11953. return 0;
  11954. }
  11955. var baseValue = ch - 0x30;
  11956. var powerValue = 0;
  11957. var powerValueSign = 1;
  11958. while ((ch = this.nextChar()) >= 0) {
  11959. if (0x30 <= ch && ch <= 0x39) {
  11960. var currentDigit = ch - 0x30;
  11961. if (eNotation) {
  11962. powerValue = powerValue * 10 + currentDigit;
  11963. } else {
  11964. if (divideBy !== 0) {
  11965. divideBy *= 10;
  11966. }
  11967. baseValue = baseValue * 10 + currentDigit;
  11968. }
  11969. } else if (ch === 0x2E) {
  11970. if (divideBy === 0) {
  11971. divideBy = 1;
  11972. } else {
  11973. break;
  11974. }
  11975. } else if (ch === 0x2D) {
  11976. warn('Badly formatted number');
  11977. } else if (ch === 0x45 || ch === 0x65) {
  11978. ch = this.peekChar();
  11979. if (ch === 0x2B || ch === 0x2D) {
  11980. powerValueSign = ch === 0x2D ? -1 : 1;
  11981. this.nextChar();
  11982. } else if (ch < 0x30 || ch > 0x39) {
  11983. break;
  11984. }
  11985. eNotation = true;
  11986. } else {
  11987. break;
  11988. }
  11989. }
  11990. if (divideBy !== 0) {
  11991. baseValue /= divideBy;
  11992. }
  11993. if (eNotation) {
  11994. baseValue *= Math.pow(10, powerValueSign * powerValue);
  11995. }
  11996. return sign * baseValue;
  11997. },
  11998. getString: function Lexer_getString() {
  11999. var numParen = 1;
  12000. var done = false;
  12001. var strBuf = this.strBuf;
  12002. strBuf.length = 0;
  12003. var ch = this.nextChar();
  12004. while (true) {
  12005. var charBuffered = false;
  12006. switch (ch | 0) {
  12007. case -1:
  12008. warn('Unterminated string');
  12009. done = true;
  12010. break;
  12011. case 0x28:
  12012. ++numParen;
  12013. strBuf.push('(');
  12014. break;
  12015. case 0x29:
  12016. if (--numParen === 0) {
  12017. this.nextChar();
  12018. done = true;
  12019. } else {
  12020. strBuf.push(')');
  12021. }
  12022. break;
  12023. case 0x5C:
  12024. ch = this.nextChar();
  12025. switch (ch) {
  12026. case -1:
  12027. warn('Unterminated string');
  12028. done = true;
  12029. break;
  12030. case 0x6E:
  12031. strBuf.push('\n');
  12032. break;
  12033. case 0x72:
  12034. strBuf.push('\r');
  12035. break;
  12036. case 0x74:
  12037. strBuf.push('\t');
  12038. break;
  12039. case 0x62:
  12040. strBuf.push('\b');
  12041. break;
  12042. case 0x66:
  12043. strBuf.push('\f');
  12044. break;
  12045. case 0x5C:
  12046. case 0x28:
  12047. case 0x29:
  12048. strBuf.push(String.fromCharCode(ch));
  12049. break;
  12050. case 0x30:
  12051. case 0x31:
  12052. case 0x32:
  12053. case 0x33:
  12054. case 0x34:
  12055. case 0x35:
  12056. case 0x36:
  12057. case 0x37:
  12058. var x = ch & 0x0F;
  12059. ch = this.nextChar();
  12060. charBuffered = true;
  12061. if (ch >= 0x30 && ch <= 0x37) {
  12062. x = (x << 3) + (ch & 0x0F);
  12063. ch = this.nextChar();
  12064. if (ch >= 0x30 && ch <= 0x37) {
  12065. charBuffered = false;
  12066. x = (x << 3) + (ch & 0x0F);
  12067. }
  12068. }
  12069. strBuf.push(String.fromCharCode(x));
  12070. break;
  12071. case 0x0D:
  12072. if (this.peekChar() === 0x0A) {
  12073. this.nextChar();
  12074. }
  12075. break;
  12076. case 0x0A:
  12077. break;
  12078. default:
  12079. strBuf.push(String.fromCharCode(ch));
  12080. break;
  12081. }
  12082. break;
  12083. default:
  12084. strBuf.push(String.fromCharCode(ch));
  12085. break;
  12086. }
  12087. if (done) {
  12088. break;
  12089. }
  12090. if (!charBuffered) {
  12091. ch = this.nextChar();
  12092. }
  12093. }
  12094. return strBuf.join('');
  12095. },
  12096. getName: function Lexer_getName() {
  12097. var ch, previousCh;
  12098. var strBuf = this.strBuf;
  12099. strBuf.length = 0;
  12100. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  12101. if (ch === 0x23) {
  12102. ch = this.nextChar();
  12103. if (specialChars[ch]) {
  12104. warn('Lexer_getName: ' + 'NUMBER SIGN (#) should be followed by a hexadecimal number.');
  12105. strBuf.push('#');
  12106. break;
  12107. }
  12108. var x = toHexDigit(ch);
  12109. if (x !== -1) {
  12110. previousCh = ch;
  12111. ch = this.nextChar();
  12112. var x2 = toHexDigit(ch);
  12113. if (x2 === -1) {
  12114. warn('Lexer_getName: Illegal digit (' + String.fromCharCode(ch) + ') in hexadecimal number.');
  12115. strBuf.push('#', String.fromCharCode(previousCh));
  12116. if (specialChars[ch]) {
  12117. break;
  12118. }
  12119. strBuf.push(String.fromCharCode(ch));
  12120. continue;
  12121. }
  12122. strBuf.push(String.fromCharCode(x << 4 | x2));
  12123. } else {
  12124. strBuf.push('#', String.fromCharCode(ch));
  12125. }
  12126. } else {
  12127. strBuf.push(String.fromCharCode(ch));
  12128. }
  12129. }
  12130. if (strBuf.length > 127) {
  12131. warn('name token is longer than allowed by the spec: ' + strBuf.length);
  12132. }
  12133. return Name.get(strBuf.join(''));
  12134. },
  12135. getHexString: function Lexer_getHexString() {
  12136. var strBuf = this.strBuf;
  12137. strBuf.length = 0;
  12138. var ch = this.currentChar;
  12139. var isFirstHex = true;
  12140. var firstDigit;
  12141. var secondDigit;
  12142. while (true) {
  12143. if (ch < 0) {
  12144. warn('Unterminated hex string');
  12145. break;
  12146. } else if (ch === 0x3E) {
  12147. this.nextChar();
  12148. break;
  12149. } else if (specialChars[ch] === 1) {
  12150. ch = this.nextChar();
  12151. continue;
  12152. } else {
  12153. if (isFirstHex) {
  12154. firstDigit = toHexDigit(ch);
  12155. if (firstDigit === -1) {
  12156. warn('Ignoring invalid character "' + ch + '" in hex string');
  12157. ch = this.nextChar();
  12158. continue;
  12159. }
  12160. } else {
  12161. secondDigit = toHexDigit(ch);
  12162. if (secondDigit === -1) {
  12163. warn('Ignoring invalid character "' + ch + '" in hex string');
  12164. ch = this.nextChar();
  12165. continue;
  12166. }
  12167. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  12168. }
  12169. isFirstHex = !isFirstHex;
  12170. ch = this.nextChar();
  12171. }
  12172. }
  12173. return strBuf.join('');
  12174. },
  12175. getObj: function Lexer_getObj() {
  12176. var comment = false;
  12177. var ch = this.currentChar;
  12178. while (true) {
  12179. if (ch < 0) {
  12180. return EOF;
  12181. }
  12182. if (comment) {
  12183. if (ch === 0x0A || ch === 0x0D) {
  12184. comment = false;
  12185. }
  12186. } else if (ch === 0x25) {
  12187. comment = true;
  12188. } else if (specialChars[ch] !== 1) {
  12189. break;
  12190. }
  12191. ch = this.nextChar();
  12192. }
  12193. switch (ch | 0) {
  12194. case 0x30:
  12195. case 0x31:
  12196. case 0x32:
  12197. case 0x33:
  12198. case 0x34:
  12199. case 0x35:
  12200. case 0x36:
  12201. case 0x37:
  12202. case 0x38:
  12203. case 0x39:
  12204. case 0x2B:
  12205. case 0x2D:
  12206. case 0x2E:
  12207. return this.getNumber();
  12208. case 0x28:
  12209. return this.getString();
  12210. case 0x2F:
  12211. return this.getName();
  12212. case 0x5B:
  12213. this.nextChar();
  12214. return Cmd.get('[');
  12215. case 0x5D:
  12216. this.nextChar();
  12217. return Cmd.get(']');
  12218. case 0x3C:
  12219. ch = this.nextChar();
  12220. if (ch === 0x3C) {
  12221. this.nextChar();
  12222. return Cmd.get('<<');
  12223. }
  12224. return this.getHexString();
  12225. case 0x3E:
  12226. ch = this.nextChar();
  12227. if (ch === 0x3E) {
  12228. this.nextChar();
  12229. return Cmd.get('>>');
  12230. }
  12231. return Cmd.get('>');
  12232. case 0x7B:
  12233. this.nextChar();
  12234. return Cmd.get('{');
  12235. case 0x7D:
  12236. this.nextChar();
  12237. return Cmd.get('}');
  12238. case 0x29:
  12239. this.nextChar();
  12240. error('Illegal character: ' + ch);
  12241. break;
  12242. }
  12243. var str = String.fromCharCode(ch);
  12244. var knownCommands = this.knownCommands;
  12245. var knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  12246. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  12247. var possibleCommand = str + String.fromCharCode(ch);
  12248. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  12249. break;
  12250. }
  12251. if (str.length === 128) {
  12252. error('Command token too long: ' + str.length);
  12253. }
  12254. str = possibleCommand;
  12255. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  12256. }
  12257. if (str === 'true') {
  12258. return true;
  12259. }
  12260. if (str === 'false') {
  12261. return false;
  12262. }
  12263. if (str === 'null') {
  12264. return null;
  12265. }
  12266. return Cmd.get(str);
  12267. },
  12268. skipToNextLine: function Lexer_skipToNextLine() {
  12269. var ch = this.currentChar;
  12270. while (ch >= 0) {
  12271. if (ch === 0x0D) {
  12272. ch = this.nextChar();
  12273. if (ch === 0x0A) {
  12274. this.nextChar();
  12275. }
  12276. break;
  12277. } else if (ch === 0x0A) {
  12278. this.nextChar();
  12279. break;
  12280. }
  12281. ch = this.nextChar();
  12282. }
  12283. }
  12284. };
  12285. return Lexer;
  12286. }();
  12287. var Linearization = {
  12288. create: function LinearizationCreate(stream) {
  12289. function getInt(name, allowZeroValue) {
  12290. var obj = linDict.get(name);
  12291. if (isInt(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  12292. return obj;
  12293. }
  12294. throw new Error('The "' + name + '" parameter in the linearization ' + 'dictionary is invalid.');
  12295. }
  12296. function getHints() {
  12297. var hints = linDict.get('H'), hintsLength, item;
  12298. if (isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  12299. for (var index = 0; index < hintsLength; index++) {
  12300. if (!(isInt(item = hints[index]) && item > 0)) {
  12301. throw new Error('Hint (' + index + ') in the linearization dictionary is invalid.');
  12302. }
  12303. }
  12304. return hints;
  12305. }
  12306. throw new Error('Hint array in the linearization dictionary is invalid.');
  12307. }
  12308. var parser = new Parser(new Lexer(stream), false, null);
  12309. var obj1 = parser.getObj();
  12310. var obj2 = parser.getObj();
  12311. var obj3 = parser.getObj();
  12312. var linDict = parser.getObj();
  12313. var obj, length;
  12314. if (!(isInt(obj1) && isInt(obj2) && isCmd(obj3, 'obj') && isDict(linDict) && isNum(obj = linDict.get('Linearized')) && obj > 0)) {
  12315. return null;
  12316. } else if ((length = getInt('L')) !== stream.length) {
  12317. throw new Error('The "L" parameter in the linearization dictionary ' + 'does not equal the stream length.');
  12318. }
  12319. return {
  12320. length: length,
  12321. hints: getHints(),
  12322. objectNumberFirst: getInt('O'),
  12323. endFirst: getInt('E'),
  12324. numPages: getInt('N'),
  12325. mainXRefEntriesOffset: getInt('T'),
  12326. pageFirst: linDict.has('P') ? getInt('P', true) : 0
  12327. };
  12328. }
  12329. };
  12330. exports.Lexer = Lexer;
  12331. exports.Linearization = Linearization;
  12332. exports.Parser = Parser;
  12333. /***/ }),
  12334. /* 6 */
  12335. /***/ (function(module, exports, __w_pdfjs_require__) {
  12336. "use strict";
  12337. var sharedUtil = __w_pdfjs_require__(0);
  12338. var corePrimitives = __w_pdfjs_require__(1);
  12339. var corePsParser = __w_pdfjs_require__(34);
  12340. var error = sharedUtil.error;
  12341. var info = sharedUtil.info;
  12342. var isArray = sharedUtil.isArray;
  12343. var isBool = sharedUtil.isBool;
  12344. var isDict = corePrimitives.isDict;
  12345. var isStream = corePrimitives.isStream;
  12346. var PostScriptLexer = corePsParser.PostScriptLexer;
  12347. var PostScriptParser = corePsParser.PostScriptParser;
  12348. var PDFFunction = function PDFFunctionClosure() {
  12349. var CONSTRUCT_SAMPLED = 0;
  12350. var CONSTRUCT_INTERPOLATED = 2;
  12351. var CONSTRUCT_STICHED = 3;
  12352. var CONSTRUCT_POSTSCRIPT = 4;
  12353. return {
  12354. getSampleArray: function PDFFunction_getSampleArray(size, outputSize, bps, str) {
  12355. var i, ii;
  12356. var length = 1;
  12357. for (i = 0, ii = size.length; i < ii; i++) {
  12358. length *= size[i];
  12359. }
  12360. length *= outputSize;
  12361. var array = new Array(length);
  12362. var codeSize = 0;
  12363. var codeBuf = 0;
  12364. var sampleMul = 1.0 / (Math.pow(2.0, bps) - 1);
  12365. var strBytes = str.getBytes((length * bps + 7) / 8);
  12366. var strIdx = 0;
  12367. for (i = 0; i < length; i++) {
  12368. while (codeSize < bps) {
  12369. codeBuf <<= 8;
  12370. codeBuf |= strBytes[strIdx++];
  12371. codeSize += 8;
  12372. }
  12373. codeSize -= bps;
  12374. array[i] = (codeBuf >> codeSize) * sampleMul;
  12375. codeBuf &= (1 << codeSize) - 1;
  12376. }
  12377. return array;
  12378. },
  12379. getIR: function PDFFunction_getIR(xref, fn) {
  12380. var dict = fn.dict;
  12381. if (!dict) {
  12382. dict = fn;
  12383. }
  12384. var types = [
  12385. this.constructSampled,
  12386. null,
  12387. this.constructInterpolated,
  12388. this.constructStiched,
  12389. this.constructPostScript
  12390. ];
  12391. var typeNum = dict.get('FunctionType');
  12392. var typeFn = types[typeNum];
  12393. if (!typeFn) {
  12394. error('Unknown type of function');
  12395. }
  12396. return typeFn.call(this, fn, dict, xref);
  12397. },
  12398. fromIR: function PDFFunction_fromIR(IR) {
  12399. var type = IR[0];
  12400. switch (type) {
  12401. case CONSTRUCT_SAMPLED:
  12402. return this.constructSampledFromIR(IR);
  12403. case CONSTRUCT_INTERPOLATED:
  12404. return this.constructInterpolatedFromIR(IR);
  12405. case CONSTRUCT_STICHED:
  12406. return this.constructStichedFromIR(IR);
  12407. default:
  12408. return this.constructPostScriptFromIR(IR);
  12409. }
  12410. },
  12411. parse: function PDFFunction_parse(xref, fn) {
  12412. var IR = this.getIR(xref, fn);
  12413. return this.fromIR(IR);
  12414. },
  12415. parseArray: function PDFFunction_parseArray(xref, fnObj) {
  12416. if (!isArray(fnObj)) {
  12417. return this.parse(xref, fnObj);
  12418. }
  12419. var fnArray = [];
  12420. for (var j = 0, jj = fnObj.length; j < jj; j++) {
  12421. var obj = xref.fetchIfRef(fnObj[j]);
  12422. fnArray.push(PDFFunction.parse(xref, obj));
  12423. }
  12424. return function (src, srcOffset, dest, destOffset) {
  12425. for (var i = 0, ii = fnArray.length; i < ii; i++) {
  12426. fnArray[i](src, srcOffset, dest, destOffset + i);
  12427. }
  12428. };
  12429. },
  12430. constructSampled: function PDFFunction_constructSampled(str, dict) {
  12431. function toMultiArray(arr) {
  12432. var inputLength = arr.length;
  12433. var out = [];
  12434. var index = 0;
  12435. for (var i = 0; i < inputLength; i += 2) {
  12436. out[index] = [
  12437. arr[i],
  12438. arr[i + 1]
  12439. ];
  12440. ++index;
  12441. }
  12442. return out;
  12443. }
  12444. var domain = dict.getArray('Domain');
  12445. var range = dict.getArray('Range');
  12446. if (!domain || !range) {
  12447. error('No domain or range');
  12448. }
  12449. var inputSize = domain.length / 2;
  12450. var outputSize = range.length / 2;
  12451. domain = toMultiArray(domain);
  12452. range = toMultiArray(range);
  12453. var size = dict.get('Size');
  12454. var bps = dict.get('BitsPerSample');
  12455. var order = dict.get('Order') || 1;
  12456. if (order !== 1) {
  12457. info('No support for cubic spline interpolation: ' + order);
  12458. }
  12459. var encode = dict.getArray('Encode');
  12460. if (!encode) {
  12461. encode = [];
  12462. for (var i = 0; i < inputSize; ++i) {
  12463. encode.push(0);
  12464. encode.push(size[i] - 1);
  12465. }
  12466. }
  12467. encode = toMultiArray(encode);
  12468. var decode = dict.getArray('Decode');
  12469. if (!decode) {
  12470. decode = range;
  12471. } else {
  12472. decode = toMultiArray(decode);
  12473. }
  12474. var samples = this.getSampleArray(size, outputSize, bps, str);
  12475. return [
  12476. CONSTRUCT_SAMPLED,
  12477. inputSize,
  12478. domain,
  12479. encode,
  12480. decode,
  12481. samples,
  12482. size,
  12483. outputSize,
  12484. Math.pow(2, bps) - 1,
  12485. range
  12486. ];
  12487. },
  12488. constructSampledFromIR: function PDFFunction_constructSampledFromIR(IR) {
  12489. function interpolate(x, xmin, xmax, ymin, ymax) {
  12490. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  12491. }
  12492. return function constructSampledFromIRResult(src, srcOffset, dest, destOffset) {
  12493. var m = IR[1];
  12494. var domain = IR[2];
  12495. var encode = IR[3];
  12496. var decode = IR[4];
  12497. var samples = IR[5];
  12498. var size = IR[6];
  12499. var n = IR[7];
  12500. var range = IR[9];
  12501. var cubeVertices = 1 << m;
  12502. var cubeN = new Float64Array(cubeVertices);
  12503. var cubeVertex = new Uint32Array(cubeVertices);
  12504. var i, j;
  12505. for (j = 0; j < cubeVertices; j++) {
  12506. cubeN[j] = 1;
  12507. }
  12508. var k = n, pos = 1;
  12509. for (i = 0; i < m; ++i) {
  12510. var domain_2i = domain[i][0];
  12511. var domain_2i_1 = domain[i][1];
  12512. var xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  12513. var e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  12514. var size_i = size[i];
  12515. e = Math.min(Math.max(e, 0), size_i - 1);
  12516. var e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  12517. var n0 = e0 + 1 - e;
  12518. var n1 = e - e0;
  12519. var offset0 = e0 * k;
  12520. var offset1 = offset0 + k;
  12521. for (j = 0; j < cubeVertices; j++) {
  12522. if (j & pos) {
  12523. cubeN[j] *= n1;
  12524. cubeVertex[j] += offset1;
  12525. } else {
  12526. cubeN[j] *= n0;
  12527. cubeVertex[j] += offset0;
  12528. }
  12529. }
  12530. k *= size_i;
  12531. pos <<= 1;
  12532. }
  12533. for (j = 0; j < n; ++j) {
  12534. var rj = 0;
  12535. for (i = 0; i < cubeVertices; i++) {
  12536. rj += samples[cubeVertex[i] + j] * cubeN[i];
  12537. }
  12538. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  12539. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  12540. }
  12541. };
  12542. },
  12543. constructInterpolated: function PDFFunction_constructInterpolated(str, dict) {
  12544. var c0 = dict.getArray('C0') || [0];
  12545. var c1 = dict.getArray('C1') || [1];
  12546. var n = dict.get('N');
  12547. if (!isArray(c0) || !isArray(c1)) {
  12548. error('Illegal dictionary for interpolated function');
  12549. }
  12550. var length = c0.length;
  12551. var diff = [];
  12552. for (var i = 0; i < length; ++i) {
  12553. diff.push(c1[i] - c0[i]);
  12554. }
  12555. return [
  12556. CONSTRUCT_INTERPOLATED,
  12557. c0,
  12558. diff,
  12559. n
  12560. ];
  12561. },
  12562. constructInterpolatedFromIR: function PDFFunction_constructInterpolatedFromIR(IR) {
  12563. var c0 = IR[1];
  12564. var diff = IR[2];
  12565. var n = IR[3];
  12566. var length = diff.length;
  12567. return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOffset) {
  12568. var x = n === 1 ? src[srcOffset] : Math.pow(src[srcOffset], n);
  12569. for (var j = 0; j < length; ++j) {
  12570. dest[destOffset + j] = c0[j] + x * diff[j];
  12571. }
  12572. };
  12573. },
  12574. constructStiched: function PDFFunction_constructStiched(fn, dict, xref) {
  12575. var domain = dict.getArray('Domain');
  12576. if (!domain) {
  12577. error('No domain');
  12578. }
  12579. var inputSize = domain.length / 2;
  12580. if (inputSize !== 1) {
  12581. error('Bad domain for stiched function');
  12582. }
  12583. var fnRefs = dict.get('Functions');
  12584. var fns = [];
  12585. for (var i = 0, ii = fnRefs.length; i < ii; ++i) {
  12586. fns.push(PDFFunction.getIR(xref, xref.fetchIfRef(fnRefs[i])));
  12587. }
  12588. var bounds = dict.getArray('Bounds');
  12589. var encode = dict.getArray('Encode');
  12590. return [
  12591. CONSTRUCT_STICHED,
  12592. domain,
  12593. bounds,
  12594. encode,
  12595. fns
  12596. ];
  12597. },
  12598. constructStichedFromIR: function PDFFunction_constructStichedFromIR(IR) {
  12599. var domain = IR[1];
  12600. var bounds = IR[2];
  12601. var encode = IR[3];
  12602. var fnsIR = IR[4];
  12603. var fns = [];
  12604. var tmpBuf = new Float32Array(1);
  12605. for (var i = 0, ii = fnsIR.length; i < ii; i++) {
  12606. fns.push(PDFFunction.fromIR(fnsIR[i]));
  12607. }
  12608. return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) {
  12609. var clip = function constructStichedFromIRClip(v, min, max) {
  12610. if (v > max) {
  12611. v = max;
  12612. } else if (v < min) {
  12613. v = min;
  12614. }
  12615. return v;
  12616. };
  12617. var v = clip(src[srcOffset], domain[0], domain[1]);
  12618. for (var i = 0, ii = bounds.length; i < ii; ++i) {
  12619. if (v < bounds[i]) {
  12620. break;
  12621. }
  12622. }
  12623. var dmin = domain[0];
  12624. if (i > 0) {
  12625. dmin = bounds[i - 1];
  12626. }
  12627. var dmax = domain[1];
  12628. if (i < bounds.length) {
  12629. dmax = bounds[i];
  12630. }
  12631. var rmin = encode[2 * i];
  12632. var rmax = encode[2 * i + 1];
  12633. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  12634. fns[i](tmpBuf, 0, dest, destOffset);
  12635. };
  12636. },
  12637. constructPostScript: function PDFFunction_constructPostScript(fn, dict, xref) {
  12638. var domain = dict.getArray('Domain');
  12639. var range = dict.getArray('Range');
  12640. if (!domain) {
  12641. error('No domain.');
  12642. }
  12643. if (!range) {
  12644. error('No range.');
  12645. }
  12646. var lexer = new PostScriptLexer(fn);
  12647. var parser = new PostScriptParser(lexer);
  12648. var code = parser.parse();
  12649. return [
  12650. CONSTRUCT_POSTSCRIPT,
  12651. domain,
  12652. range,
  12653. code
  12654. ];
  12655. },
  12656. constructPostScriptFromIR: function PDFFunction_constructPostScriptFromIR(IR) {
  12657. var domain = IR[1];
  12658. var range = IR[2];
  12659. var code = IR[3];
  12660. var compiled = new PostScriptCompiler().compile(code, domain, range);
  12661. if (compiled) {
  12662. return new Function('src', 'srcOffset', 'dest', 'destOffset', compiled);
  12663. }
  12664. info('Unable to compile PS function');
  12665. var numOutputs = range.length >> 1;
  12666. var numInputs = domain.length >> 1;
  12667. var evaluator = new PostScriptEvaluator(code);
  12668. var cache = Object.create(null);
  12669. var MAX_CACHE_SIZE = 2048 * 4;
  12670. var cache_available = MAX_CACHE_SIZE;
  12671. var tmpBuf = new Float32Array(numInputs);
  12672. return function constructPostScriptFromIRResult(src, srcOffset, dest, destOffset) {
  12673. var i, value;
  12674. var key = '';
  12675. var input = tmpBuf;
  12676. for (i = 0; i < numInputs; i++) {
  12677. value = src[srcOffset + i];
  12678. input[i] = value;
  12679. key += value + '_';
  12680. }
  12681. var cachedValue = cache[key];
  12682. if (cachedValue !== undefined) {
  12683. dest.set(cachedValue, destOffset);
  12684. return;
  12685. }
  12686. var output = new Float32Array(numOutputs);
  12687. var stack = evaluator.execute(input);
  12688. var stackIndex = stack.length - numOutputs;
  12689. for (i = 0; i < numOutputs; i++) {
  12690. value = stack[stackIndex + i];
  12691. var bound = range[i * 2];
  12692. if (value < bound) {
  12693. value = bound;
  12694. } else {
  12695. bound = range[i * 2 + 1];
  12696. if (value > bound) {
  12697. value = bound;
  12698. }
  12699. }
  12700. output[i] = value;
  12701. }
  12702. if (cache_available > 0) {
  12703. cache_available--;
  12704. cache[key] = output;
  12705. }
  12706. dest.set(output, destOffset);
  12707. };
  12708. }
  12709. };
  12710. }();
  12711. function isPDFFunction(v) {
  12712. var fnDict;
  12713. if (typeof v !== 'object') {
  12714. return false;
  12715. } else if (isDict(v)) {
  12716. fnDict = v;
  12717. } else if (isStream(v)) {
  12718. fnDict = v.dict;
  12719. } else {
  12720. return false;
  12721. }
  12722. return fnDict.has('FunctionType');
  12723. }
  12724. var PostScriptStack = function PostScriptStackClosure() {
  12725. var MAX_STACK_SIZE = 100;
  12726. function PostScriptStack(initialStack) {
  12727. this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
  12728. }
  12729. PostScriptStack.prototype = {
  12730. push: function PostScriptStack_push(value) {
  12731. if (this.stack.length >= MAX_STACK_SIZE) {
  12732. error('PostScript function stack overflow.');
  12733. }
  12734. this.stack.push(value);
  12735. },
  12736. pop: function PostScriptStack_pop() {
  12737. if (this.stack.length <= 0) {
  12738. error('PostScript function stack underflow.');
  12739. }
  12740. return this.stack.pop();
  12741. },
  12742. copy: function PostScriptStack_copy(n) {
  12743. if (this.stack.length + n >= MAX_STACK_SIZE) {
  12744. error('PostScript function stack overflow.');
  12745. }
  12746. var stack = this.stack;
  12747. for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  12748. stack.push(stack[i]);
  12749. }
  12750. },
  12751. index: function PostScriptStack_index(n) {
  12752. this.push(this.stack[this.stack.length - n - 1]);
  12753. },
  12754. roll: function PostScriptStack_roll(n, p) {
  12755. var stack = this.stack;
  12756. var l = stack.length - n;
  12757. var r = stack.length - 1, c = l + (p - Math.floor(p / n) * n), i, j, t;
  12758. for (i = l, j = r; i < j; i++, j--) {
  12759. t = stack[i];
  12760. stack[i] = stack[j];
  12761. stack[j] = t;
  12762. }
  12763. for (i = l, j = c - 1; i < j; i++, j--) {
  12764. t = stack[i];
  12765. stack[i] = stack[j];
  12766. stack[j] = t;
  12767. }
  12768. for (i = c, j = r; i < j; i++, j--) {
  12769. t = stack[i];
  12770. stack[i] = stack[j];
  12771. stack[j] = t;
  12772. }
  12773. }
  12774. };
  12775. return PostScriptStack;
  12776. }();
  12777. var PostScriptEvaluator = function PostScriptEvaluatorClosure() {
  12778. function PostScriptEvaluator(operators) {
  12779. this.operators = operators;
  12780. }
  12781. PostScriptEvaluator.prototype = {
  12782. execute: function PostScriptEvaluator_execute(initialStack) {
  12783. var stack = new PostScriptStack(initialStack);
  12784. var counter = 0;
  12785. var operators = this.operators;
  12786. var length = operators.length;
  12787. var operator, a, b;
  12788. while (counter < length) {
  12789. operator = operators[counter++];
  12790. if (typeof operator === 'number') {
  12791. stack.push(operator);
  12792. continue;
  12793. }
  12794. switch (operator) {
  12795. case 'jz':
  12796. b = stack.pop();
  12797. a = stack.pop();
  12798. if (!a) {
  12799. counter = b;
  12800. }
  12801. break;
  12802. case 'j':
  12803. a = stack.pop();
  12804. counter = a;
  12805. break;
  12806. case 'abs':
  12807. a = stack.pop();
  12808. stack.push(Math.abs(a));
  12809. break;
  12810. case 'add':
  12811. b = stack.pop();
  12812. a = stack.pop();
  12813. stack.push(a + b);
  12814. break;
  12815. case 'and':
  12816. b = stack.pop();
  12817. a = stack.pop();
  12818. if (isBool(a) && isBool(b)) {
  12819. stack.push(a && b);
  12820. } else {
  12821. stack.push(a & b);
  12822. }
  12823. break;
  12824. case 'atan':
  12825. a = stack.pop();
  12826. stack.push(Math.atan(a));
  12827. break;
  12828. case 'bitshift':
  12829. b = stack.pop();
  12830. a = stack.pop();
  12831. if (a > 0) {
  12832. stack.push(a << b);
  12833. } else {
  12834. stack.push(a >> b);
  12835. }
  12836. break;
  12837. case 'ceiling':
  12838. a = stack.pop();
  12839. stack.push(Math.ceil(a));
  12840. break;
  12841. case 'copy':
  12842. a = stack.pop();
  12843. stack.copy(a);
  12844. break;
  12845. case 'cos':
  12846. a = stack.pop();
  12847. stack.push(Math.cos(a));
  12848. break;
  12849. case 'cvi':
  12850. a = stack.pop() | 0;
  12851. stack.push(a);
  12852. break;
  12853. case 'cvr':
  12854. break;
  12855. case 'div':
  12856. b = stack.pop();
  12857. a = stack.pop();
  12858. stack.push(a / b);
  12859. break;
  12860. case 'dup':
  12861. stack.copy(1);
  12862. break;
  12863. case 'eq':
  12864. b = stack.pop();
  12865. a = stack.pop();
  12866. stack.push(a === b);
  12867. break;
  12868. case 'exch':
  12869. stack.roll(2, 1);
  12870. break;
  12871. case 'exp':
  12872. b = stack.pop();
  12873. a = stack.pop();
  12874. stack.push(Math.pow(a, b));
  12875. break;
  12876. case 'false':
  12877. stack.push(false);
  12878. break;
  12879. case 'floor':
  12880. a = stack.pop();
  12881. stack.push(Math.floor(a));
  12882. break;
  12883. case 'ge':
  12884. b = stack.pop();
  12885. a = stack.pop();
  12886. stack.push(a >= b);
  12887. break;
  12888. case 'gt':
  12889. b = stack.pop();
  12890. a = stack.pop();
  12891. stack.push(a > b);
  12892. break;
  12893. case 'idiv':
  12894. b = stack.pop();
  12895. a = stack.pop();
  12896. stack.push(a / b | 0);
  12897. break;
  12898. case 'index':
  12899. a = stack.pop();
  12900. stack.index(a);
  12901. break;
  12902. case 'le':
  12903. b = stack.pop();
  12904. a = stack.pop();
  12905. stack.push(a <= b);
  12906. break;
  12907. case 'ln':
  12908. a = stack.pop();
  12909. stack.push(Math.log(a));
  12910. break;
  12911. case 'log':
  12912. a = stack.pop();
  12913. stack.push(Math.log(a) / Math.LN10);
  12914. break;
  12915. case 'lt':
  12916. b = stack.pop();
  12917. a = stack.pop();
  12918. stack.push(a < b);
  12919. break;
  12920. case 'mod':
  12921. b = stack.pop();
  12922. a = stack.pop();
  12923. stack.push(a % b);
  12924. break;
  12925. case 'mul':
  12926. b = stack.pop();
  12927. a = stack.pop();
  12928. stack.push(a * b);
  12929. break;
  12930. case 'ne':
  12931. b = stack.pop();
  12932. a = stack.pop();
  12933. stack.push(a !== b);
  12934. break;
  12935. case 'neg':
  12936. a = stack.pop();
  12937. stack.push(-a);
  12938. break;
  12939. case 'not':
  12940. a = stack.pop();
  12941. if (isBool(a)) {
  12942. stack.push(!a);
  12943. } else {
  12944. stack.push(~a);
  12945. }
  12946. break;
  12947. case 'or':
  12948. b = stack.pop();
  12949. a = stack.pop();
  12950. if (isBool(a) && isBool(b)) {
  12951. stack.push(a || b);
  12952. } else {
  12953. stack.push(a | b);
  12954. }
  12955. break;
  12956. case 'pop':
  12957. stack.pop();
  12958. break;
  12959. case 'roll':
  12960. b = stack.pop();
  12961. a = stack.pop();
  12962. stack.roll(a, b);
  12963. break;
  12964. case 'round':
  12965. a = stack.pop();
  12966. stack.push(Math.round(a));
  12967. break;
  12968. case 'sin':
  12969. a = stack.pop();
  12970. stack.push(Math.sin(a));
  12971. break;
  12972. case 'sqrt':
  12973. a = stack.pop();
  12974. stack.push(Math.sqrt(a));
  12975. break;
  12976. case 'sub':
  12977. b = stack.pop();
  12978. a = stack.pop();
  12979. stack.push(a - b);
  12980. break;
  12981. case 'true':
  12982. stack.push(true);
  12983. break;
  12984. case 'truncate':
  12985. a = stack.pop();
  12986. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  12987. stack.push(a);
  12988. break;
  12989. case 'xor':
  12990. b = stack.pop();
  12991. a = stack.pop();
  12992. if (isBool(a) && isBool(b)) {
  12993. stack.push(a !== b);
  12994. } else {
  12995. stack.push(a ^ b);
  12996. }
  12997. break;
  12998. default:
  12999. error('Unknown operator ' + operator);
  13000. break;
  13001. }
  13002. }
  13003. return stack.stack;
  13004. }
  13005. };
  13006. return PostScriptEvaluator;
  13007. }();
  13008. var PostScriptCompiler = function PostScriptCompilerClosure() {
  13009. function AstNode(type) {
  13010. this.type = type;
  13011. }
  13012. AstNode.prototype.visit = function (visitor) {
  13013. throw new Error('abstract method');
  13014. };
  13015. function AstArgument(index, min, max) {
  13016. AstNode.call(this, 'args');
  13017. this.index = index;
  13018. this.min = min;
  13019. this.max = max;
  13020. }
  13021. AstArgument.prototype = Object.create(AstNode.prototype);
  13022. AstArgument.prototype.visit = function (visitor) {
  13023. visitor.visitArgument(this);
  13024. };
  13025. function AstLiteral(number) {
  13026. AstNode.call(this, 'literal');
  13027. this.number = number;
  13028. this.min = number;
  13029. this.max = number;
  13030. }
  13031. AstLiteral.prototype = Object.create(AstNode.prototype);
  13032. AstLiteral.prototype.visit = function (visitor) {
  13033. visitor.visitLiteral(this);
  13034. };
  13035. function AstBinaryOperation(op, arg1, arg2, min, max) {
  13036. AstNode.call(this, 'binary');
  13037. this.op = op;
  13038. this.arg1 = arg1;
  13039. this.arg2 = arg2;
  13040. this.min = min;
  13041. this.max = max;
  13042. }
  13043. AstBinaryOperation.prototype = Object.create(AstNode.prototype);
  13044. AstBinaryOperation.prototype.visit = function (visitor) {
  13045. visitor.visitBinaryOperation(this);
  13046. };
  13047. function AstMin(arg, max) {
  13048. AstNode.call(this, 'max');
  13049. this.arg = arg;
  13050. this.min = arg.min;
  13051. this.max = max;
  13052. }
  13053. AstMin.prototype = Object.create(AstNode.prototype);
  13054. AstMin.prototype.visit = function (visitor) {
  13055. visitor.visitMin(this);
  13056. };
  13057. function AstVariable(index, min, max) {
  13058. AstNode.call(this, 'var');
  13059. this.index = index;
  13060. this.min = min;
  13061. this.max = max;
  13062. }
  13063. AstVariable.prototype = Object.create(AstNode.prototype);
  13064. AstVariable.prototype.visit = function (visitor) {
  13065. visitor.visitVariable(this);
  13066. };
  13067. function AstVariableDefinition(variable, arg) {
  13068. AstNode.call(this, 'definition');
  13069. this.variable = variable;
  13070. this.arg = arg;
  13071. }
  13072. AstVariableDefinition.prototype = Object.create(AstNode.prototype);
  13073. AstVariableDefinition.prototype.visit = function (visitor) {
  13074. visitor.visitVariableDefinition(this);
  13075. };
  13076. function ExpressionBuilderVisitor() {
  13077. this.parts = [];
  13078. }
  13079. ExpressionBuilderVisitor.prototype = {
  13080. visitArgument: function (arg) {
  13081. this.parts.push('Math.max(', arg.min, ', Math.min(', arg.max, ', src[srcOffset + ', arg.index, ']))');
  13082. },
  13083. visitVariable: function (variable) {
  13084. this.parts.push('v', variable.index);
  13085. },
  13086. visitLiteral: function (literal) {
  13087. this.parts.push(literal.number);
  13088. },
  13089. visitBinaryOperation: function (operation) {
  13090. this.parts.push('(');
  13091. operation.arg1.visit(this);
  13092. this.parts.push(' ', operation.op, ' ');
  13093. operation.arg2.visit(this);
  13094. this.parts.push(')');
  13095. },
  13096. visitVariableDefinition: function (definition) {
  13097. this.parts.push('var ');
  13098. definition.variable.visit(this);
  13099. this.parts.push(' = ');
  13100. definition.arg.visit(this);
  13101. this.parts.push(';');
  13102. },
  13103. visitMin: function (max) {
  13104. this.parts.push('Math.min(');
  13105. max.arg.visit(this);
  13106. this.parts.push(', ', max.max, ')');
  13107. },
  13108. toString: function () {
  13109. return this.parts.join('');
  13110. }
  13111. };
  13112. function buildAddOperation(num1, num2) {
  13113. if (num2.type === 'literal' && num2.number === 0) {
  13114. return num1;
  13115. }
  13116. if (num1.type === 'literal' && num1.number === 0) {
  13117. return num2;
  13118. }
  13119. if (num2.type === 'literal' && num1.type === 'literal') {
  13120. return new AstLiteral(num1.number + num2.number);
  13121. }
  13122. return new AstBinaryOperation('+', num1, num2, num1.min + num2.min, num1.max + num2.max);
  13123. }
  13124. function buildMulOperation(num1, num2) {
  13125. if (num2.type === 'literal') {
  13126. if (num2.number === 0) {
  13127. return new AstLiteral(0);
  13128. } else if (num2.number === 1) {
  13129. return num1;
  13130. } else if (num1.type === 'literal') {
  13131. return new AstLiteral(num1.number * num2.number);
  13132. }
  13133. }
  13134. if (num1.type === 'literal') {
  13135. if (num1.number === 0) {
  13136. return new AstLiteral(0);
  13137. } else if (num1.number === 1) {
  13138. return num2;
  13139. }
  13140. }
  13141. var min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  13142. var max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  13143. return new AstBinaryOperation('*', num1, num2, min, max);
  13144. }
  13145. function buildSubOperation(num1, num2) {
  13146. if (num2.type === 'literal') {
  13147. if (num2.number === 0) {
  13148. return num1;
  13149. } else if (num1.type === 'literal') {
  13150. return new AstLiteral(num1.number - num2.number);
  13151. }
  13152. }
  13153. if (num2.type === 'binary' && num2.op === '-' && num1.type === 'literal' && num1.number === 1 && num2.arg1.type === 'literal' && num2.arg1.number === 1) {
  13154. return num2.arg2;
  13155. }
  13156. return new AstBinaryOperation('-', num1, num2, num1.min - num2.max, num1.max - num2.min);
  13157. }
  13158. function buildMinOperation(num1, max) {
  13159. if (num1.min >= max) {
  13160. return new AstLiteral(max);
  13161. } else if (num1.max <= max) {
  13162. return num1;
  13163. }
  13164. return new AstMin(num1, max);
  13165. }
  13166. function PostScriptCompiler() {
  13167. }
  13168. PostScriptCompiler.prototype = {
  13169. compile: function PostScriptCompiler_compile(code, domain, range) {
  13170. var stack = [];
  13171. var i, ii;
  13172. var instructions = [];
  13173. var inputSize = domain.length >> 1, outputSize = range.length >> 1;
  13174. var lastRegister = 0;
  13175. var n, j;
  13176. var num1, num2, ast1, ast2, tmpVar, item;
  13177. for (i = 0; i < inputSize; i++) {
  13178. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  13179. }
  13180. for (i = 0, ii = code.length; i < ii; i++) {
  13181. item = code[i];
  13182. if (typeof item === 'number') {
  13183. stack.push(new AstLiteral(item));
  13184. continue;
  13185. }
  13186. switch (item) {
  13187. case 'add':
  13188. if (stack.length < 2) {
  13189. return null;
  13190. }
  13191. num2 = stack.pop();
  13192. num1 = stack.pop();
  13193. stack.push(buildAddOperation(num1, num2));
  13194. break;
  13195. case 'cvr':
  13196. if (stack.length < 1) {
  13197. return null;
  13198. }
  13199. break;
  13200. case 'mul':
  13201. if (stack.length < 2) {
  13202. return null;
  13203. }
  13204. num2 = stack.pop();
  13205. num1 = stack.pop();
  13206. stack.push(buildMulOperation(num1, num2));
  13207. break;
  13208. case 'sub':
  13209. if (stack.length < 2) {
  13210. return null;
  13211. }
  13212. num2 = stack.pop();
  13213. num1 = stack.pop();
  13214. stack.push(buildSubOperation(num1, num2));
  13215. break;
  13216. case 'exch':
  13217. if (stack.length < 2) {
  13218. return null;
  13219. }
  13220. ast1 = stack.pop();
  13221. ast2 = stack.pop();
  13222. stack.push(ast1, ast2);
  13223. break;
  13224. case 'pop':
  13225. if (stack.length < 1) {
  13226. return null;
  13227. }
  13228. stack.pop();
  13229. break;
  13230. case 'index':
  13231. if (stack.length < 1) {
  13232. return null;
  13233. }
  13234. num1 = stack.pop();
  13235. if (num1.type !== 'literal') {
  13236. return null;
  13237. }
  13238. n = num1.number;
  13239. if (n < 0 || (n | 0) !== n || stack.length < n) {
  13240. return null;
  13241. }
  13242. ast1 = stack[stack.length - n - 1];
  13243. if (ast1.type === 'literal' || ast1.type === 'var') {
  13244. stack.push(ast1);
  13245. break;
  13246. }
  13247. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  13248. stack[stack.length - n - 1] = tmpVar;
  13249. stack.push(tmpVar);
  13250. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  13251. break;
  13252. case 'dup':
  13253. if (stack.length < 1) {
  13254. return null;
  13255. }
  13256. 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]) {
  13257. num1 = stack.pop();
  13258. stack.push(buildMinOperation(num1, code[i + 1]));
  13259. i += 6;
  13260. break;
  13261. }
  13262. ast1 = stack[stack.length - 1];
  13263. if (ast1.type === 'literal' || ast1.type === 'var') {
  13264. stack.push(ast1);
  13265. break;
  13266. }
  13267. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  13268. stack[stack.length - 1] = tmpVar;
  13269. stack.push(tmpVar);
  13270. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  13271. break;
  13272. case 'roll':
  13273. if (stack.length < 2) {
  13274. return null;
  13275. }
  13276. num2 = stack.pop();
  13277. num1 = stack.pop();
  13278. if (num2.type !== 'literal' || num1.type !== 'literal') {
  13279. return null;
  13280. }
  13281. j = num2.number;
  13282. n = num1.number;
  13283. if (n <= 0 || (n | 0) !== n || (j | 0) !== j || stack.length < n) {
  13284. return null;
  13285. }
  13286. j = (j % n + n) % n;
  13287. if (j === 0) {
  13288. break;
  13289. }
  13290. Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
  13291. break;
  13292. default:
  13293. return null;
  13294. }
  13295. }
  13296. if (stack.length !== outputSize) {
  13297. return null;
  13298. }
  13299. var result = [];
  13300. instructions.forEach(function (instruction) {
  13301. var statementBuilder = new ExpressionBuilderVisitor();
  13302. instruction.visit(statementBuilder);
  13303. result.push(statementBuilder.toString());
  13304. });
  13305. stack.forEach(function (expr, i) {
  13306. var statementBuilder = new ExpressionBuilderVisitor();
  13307. expr.visit(statementBuilder);
  13308. var min = range[i * 2], max = range[i * 2 + 1];
  13309. var out = [statementBuilder.toString()];
  13310. if (min > expr.min) {
  13311. out.unshift('Math.max(', min, ', ');
  13312. out.push(')');
  13313. }
  13314. if (max < expr.max) {
  13315. out.unshift('Math.min(', max, ', ');
  13316. out.push(')');
  13317. }
  13318. out.unshift('dest[destOffset + ', i, '] = ');
  13319. out.push(';');
  13320. result.push(out.join(''));
  13321. });
  13322. return result.join('\n');
  13323. }
  13324. };
  13325. return PostScriptCompiler;
  13326. }();
  13327. exports.isPDFFunction = isPDFFunction;
  13328. exports.PDFFunction = PDFFunction;
  13329. exports.PostScriptEvaluator = PostScriptEvaluator;
  13330. exports.PostScriptCompiler = PostScriptCompiler;
  13331. /***/ }),
  13332. /* 7 */
  13333. /***/ (function(module, exports, __w_pdfjs_require__) {
  13334. "use strict";
  13335. var sharedUtil = __w_pdfjs_require__(0);
  13336. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  13337. var getGlyphsUnicode = getLookupTableFactory(function (t) {
  13338. t['A'] = 0x0041;
  13339. t['AE'] = 0x00C6;
  13340. t['AEacute'] = 0x01FC;
  13341. t['AEmacron'] = 0x01E2;
  13342. t['AEsmall'] = 0xF7E6;
  13343. t['Aacute'] = 0x00C1;
  13344. t['Aacutesmall'] = 0xF7E1;
  13345. t['Abreve'] = 0x0102;
  13346. t['Abreveacute'] = 0x1EAE;
  13347. t['Abrevecyrillic'] = 0x04D0;
  13348. t['Abrevedotbelow'] = 0x1EB6;
  13349. t['Abrevegrave'] = 0x1EB0;
  13350. t['Abrevehookabove'] = 0x1EB2;
  13351. t['Abrevetilde'] = 0x1EB4;
  13352. t['Acaron'] = 0x01CD;
  13353. t['Acircle'] = 0x24B6;
  13354. t['Acircumflex'] = 0x00C2;
  13355. t['Acircumflexacute'] = 0x1EA4;
  13356. t['Acircumflexdotbelow'] = 0x1EAC;
  13357. t['Acircumflexgrave'] = 0x1EA6;
  13358. t['Acircumflexhookabove'] = 0x1EA8;
  13359. t['Acircumflexsmall'] = 0xF7E2;
  13360. t['Acircumflextilde'] = 0x1EAA;
  13361. t['Acute'] = 0xF6C9;
  13362. t['Acutesmall'] = 0xF7B4;
  13363. t['Acyrillic'] = 0x0410;
  13364. t['Adblgrave'] = 0x0200;
  13365. t['Adieresis'] = 0x00C4;
  13366. t['Adieresiscyrillic'] = 0x04D2;
  13367. t['Adieresismacron'] = 0x01DE;
  13368. t['Adieresissmall'] = 0xF7E4;
  13369. t['Adotbelow'] = 0x1EA0;
  13370. t['Adotmacron'] = 0x01E0;
  13371. t['Agrave'] = 0x00C0;
  13372. t['Agravesmall'] = 0xF7E0;
  13373. t['Ahookabove'] = 0x1EA2;
  13374. t['Aiecyrillic'] = 0x04D4;
  13375. t['Ainvertedbreve'] = 0x0202;
  13376. t['Alpha'] = 0x0391;
  13377. t['Alphatonos'] = 0x0386;
  13378. t['Amacron'] = 0x0100;
  13379. t['Amonospace'] = 0xFF21;
  13380. t['Aogonek'] = 0x0104;
  13381. t['Aring'] = 0x00C5;
  13382. t['Aringacute'] = 0x01FA;
  13383. t['Aringbelow'] = 0x1E00;
  13384. t['Aringsmall'] = 0xF7E5;
  13385. t['Asmall'] = 0xF761;
  13386. t['Atilde'] = 0x00C3;
  13387. t['Atildesmall'] = 0xF7E3;
  13388. t['Aybarmenian'] = 0x0531;
  13389. t['B'] = 0x0042;
  13390. t['Bcircle'] = 0x24B7;
  13391. t['Bdotaccent'] = 0x1E02;
  13392. t['Bdotbelow'] = 0x1E04;
  13393. t['Becyrillic'] = 0x0411;
  13394. t['Benarmenian'] = 0x0532;
  13395. t['Beta'] = 0x0392;
  13396. t['Bhook'] = 0x0181;
  13397. t['Blinebelow'] = 0x1E06;
  13398. t['Bmonospace'] = 0xFF22;
  13399. t['Brevesmall'] = 0xF6F4;
  13400. t['Bsmall'] = 0xF762;
  13401. t['Btopbar'] = 0x0182;
  13402. t['C'] = 0x0043;
  13403. t['Caarmenian'] = 0x053E;
  13404. t['Cacute'] = 0x0106;
  13405. t['Caron'] = 0xF6CA;
  13406. t['Caronsmall'] = 0xF6F5;
  13407. t['Ccaron'] = 0x010C;
  13408. t['Ccedilla'] = 0x00C7;
  13409. t['Ccedillaacute'] = 0x1E08;
  13410. t['Ccedillasmall'] = 0xF7E7;
  13411. t['Ccircle'] = 0x24B8;
  13412. t['Ccircumflex'] = 0x0108;
  13413. t['Cdot'] = 0x010A;
  13414. t['Cdotaccent'] = 0x010A;
  13415. t['Cedillasmall'] = 0xF7B8;
  13416. t['Chaarmenian'] = 0x0549;
  13417. t['Cheabkhasiancyrillic'] = 0x04BC;
  13418. t['Checyrillic'] = 0x0427;
  13419. t['Chedescenderabkhasiancyrillic'] = 0x04BE;
  13420. t['Chedescendercyrillic'] = 0x04B6;
  13421. t['Chedieresiscyrillic'] = 0x04F4;
  13422. t['Cheharmenian'] = 0x0543;
  13423. t['Chekhakassiancyrillic'] = 0x04CB;
  13424. t['Cheverticalstrokecyrillic'] = 0x04B8;
  13425. t['Chi'] = 0x03A7;
  13426. t['Chook'] = 0x0187;
  13427. t['Circumflexsmall'] = 0xF6F6;
  13428. t['Cmonospace'] = 0xFF23;
  13429. t['Coarmenian'] = 0x0551;
  13430. t['Csmall'] = 0xF763;
  13431. t['D'] = 0x0044;
  13432. t['DZ'] = 0x01F1;
  13433. t['DZcaron'] = 0x01C4;
  13434. t['Daarmenian'] = 0x0534;
  13435. t['Dafrican'] = 0x0189;
  13436. t['Dcaron'] = 0x010E;
  13437. t['Dcedilla'] = 0x1E10;
  13438. t['Dcircle'] = 0x24B9;
  13439. t['Dcircumflexbelow'] = 0x1E12;
  13440. t['Dcroat'] = 0x0110;
  13441. t['Ddotaccent'] = 0x1E0A;
  13442. t['Ddotbelow'] = 0x1E0C;
  13443. t['Decyrillic'] = 0x0414;
  13444. t['Deicoptic'] = 0x03EE;
  13445. t['Delta'] = 0x2206;
  13446. t['Deltagreek'] = 0x0394;
  13447. t['Dhook'] = 0x018A;
  13448. t['Dieresis'] = 0xF6CB;
  13449. t['DieresisAcute'] = 0xF6CC;
  13450. t['DieresisGrave'] = 0xF6CD;
  13451. t['Dieresissmall'] = 0xF7A8;
  13452. t['Digammagreek'] = 0x03DC;
  13453. t['Djecyrillic'] = 0x0402;
  13454. t['Dlinebelow'] = 0x1E0E;
  13455. t['Dmonospace'] = 0xFF24;
  13456. t['Dotaccentsmall'] = 0xF6F7;
  13457. t['Dslash'] = 0x0110;
  13458. t['Dsmall'] = 0xF764;
  13459. t['Dtopbar'] = 0x018B;
  13460. t['Dz'] = 0x01F2;
  13461. t['Dzcaron'] = 0x01C5;
  13462. t['Dzeabkhasiancyrillic'] = 0x04E0;
  13463. t['Dzecyrillic'] = 0x0405;
  13464. t['Dzhecyrillic'] = 0x040F;
  13465. t['E'] = 0x0045;
  13466. t['Eacute'] = 0x00C9;
  13467. t['Eacutesmall'] = 0xF7E9;
  13468. t['Ebreve'] = 0x0114;
  13469. t['Ecaron'] = 0x011A;
  13470. t['Ecedillabreve'] = 0x1E1C;
  13471. t['Echarmenian'] = 0x0535;
  13472. t['Ecircle'] = 0x24BA;
  13473. t['Ecircumflex'] = 0x00CA;
  13474. t['Ecircumflexacute'] = 0x1EBE;
  13475. t['Ecircumflexbelow'] = 0x1E18;
  13476. t['Ecircumflexdotbelow'] = 0x1EC6;
  13477. t['Ecircumflexgrave'] = 0x1EC0;
  13478. t['Ecircumflexhookabove'] = 0x1EC2;
  13479. t['Ecircumflexsmall'] = 0xF7EA;
  13480. t['Ecircumflextilde'] = 0x1EC4;
  13481. t['Ecyrillic'] = 0x0404;
  13482. t['Edblgrave'] = 0x0204;
  13483. t['Edieresis'] = 0x00CB;
  13484. t['Edieresissmall'] = 0xF7EB;
  13485. t['Edot'] = 0x0116;
  13486. t['Edotaccent'] = 0x0116;
  13487. t['Edotbelow'] = 0x1EB8;
  13488. t['Efcyrillic'] = 0x0424;
  13489. t['Egrave'] = 0x00C8;
  13490. t['Egravesmall'] = 0xF7E8;
  13491. t['Eharmenian'] = 0x0537;
  13492. t['Ehookabove'] = 0x1EBA;
  13493. t['Eightroman'] = 0x2167;
  13494. t['Einvertedbreve'] = 0x0206;
  13495. t['Eiotifiedcyrillic'] = 0x0464;
  13496. t['Elcyrillic'] = 0x041B;
  13497. t['Elevenroman'] = 0x216A;
  13498. t['Emacron'] = 0x0112;
  13499. t['Emacronacute'] = 0x1E16;
  13500. t['Emacrongrave'] = 0x1E14;
  13501. t['Emcyrillic'] = 0x041C;
  13502. t['Emonospace'] = 0xFF25;
  13503. t['Encyrillic'] = 0x041D;
  13504. t['Endescendercyrillic'] = 0x04A2;
  13505. t['Eng'] = 0x014A;
  13506. t['Enghecyrillic'] = 0x04A4;
  13507. t['Enhookcyrillic'] = 0x04C7;
  13508. t['Eogonek'] = 0x0118;
  13509. t['Eopen'] = 0x0190;
  13510. t['Epsilon'] = 0x0395;
  13511. t['Epsilontonos'] = 0x0388;
  13512. t['Ercyrillic'] = 0x0420;
  13513. t['Ereversed'] = 0x018E;
  13514. t['Ereversedcyrillic'] = 0x042D;
  13515. t['Escyrillic'] = 0x0421;
  13516. t['Esdescendercyrillic'] = 0x04AA;
  13517. t['Esh'] = 0x01A9;
  13518. t['Esmall'] = 0xF765;
  13519. t['Eta'] = 0x0397;
  13520. t['Etarmenian'] = 0x0538;
  13521. t['Etatonos'] = 0x0389;
  13522. t['Eth'] = 0x00D0;
  13523. t['Ethsmall'] = 0xF7F0;
  13524. t['Etilde'] = 0x1EBC;
  13525. t['Etildebelow'] = 0x1E1A;
  13526. t['Euro'] = 0x20AC;
  13527. t['Ezh'] = 0x01B7;
  13528. t['Ezhcaron'] = 0x01EE;
  13529. t['Ezhreversed'] = 0x01B8;
  13530. t['F'] = 0x0046;
  13531. t['Fcircle'] = 0x24BB;
  13532. t['Fdotaccent'] = 0x1E1E;
  13533. t['Feharmenian'] = 0x0556;
  13534. t['Feicoptic'] = 0x03E4;
  13535. t['Fhook'] = 0x0191;
  13536. t['Fitacyrillic'] = 0x0472;
  13537. t['Fiveroman'] = 0x2164;
  13538. t['Fmonospace'] = 0xFF26;
  13539. t['Fourroman'] = 0x2163;
  13540. t['Fsmall'] = 0xF766;
  13541. t['G'] = 0x0047;
  13542. t['GBsquare'] = 0x3387;
  13543. t['Gacute'] = 0x01F4;
  13544. t['Gamma'] = 0x0393;
  13545. t['Gammaafrican'] = 0x0194;
  13546. t['Gangiacoptic'] = 0x03EA;
  13547. t['Gbreve'] = 0x011E;
  13548. t['Gcaron'] = 0x01E6;
  13549. t['Gcedilla'] = 0x0122;
  13550. t['Gcircle'] = 0x24BC;
  13551. t['Gcircumflex'] = 0x011C;
  13552. t['Gcommaaccent'] = 0x0122;
  13553. t['Gdot'] = 0x0120;
  13554. t['Gdotaccent'] = 0x0120;
  13555. t['Gecyrillic'] = 0x0413;
  13556. t['Ghadarmenian'] = 0x0542;
  13557. t['Ghemiddlehookcyrillic'] = 0x0494;
  13558. t['Ghestrokecyrillic'] = 0x0492;
  13559. t['Gheupturncyrillic'] = 0x0490;
  13560. t['Ghook'] = 0x0193;
  13561. t['Gimarmenian'] = 0x0533;
  13562. t['Gjecyrillic'] = 0x0403;
  13563. t['Gmacron'] = 0x1E20;
  13564. t['Gmonospace'] = 0xFF27;
  13565. t['Grave'] = 0xF6CE;
  13566. t['Gravesmall'] = 0xF760;
  13567. t['Gsmall'] = 0xF767;
  13568. t['Gsmallhook'] = 0x029B;
  13569. t['Gstroke'] = 0x01E4;
  13570. t['H'] = 0x0048;
  13571. t['H18533'] = 0x25CF;
  13572. t['H18543'] = 0x25AA;
  13573. t['H18551'] = 0x25AB;
  13574. t['H22073'] = 0x25A1;
  13575. t['HPsquare'] = 0x33CB;
  13576. t['Haabkhasiancyrillic'] = 0x04A8;
  13577. t['Hadescendercyrillic'] = 0x04B2;
  13578. t['Hardsigncyrillic'] = 0x042A;
  13579. t['Hbar'] = 0x0126;
  13580. t['Hbrevebelow'] = 0x1E2A;
  13581. t['Hcedilla'] = 0x1E28;
  13582. t['Hcircle'] = 0x24BD;
  13583. t['Hcircumflex'] = 0x0124;
  13584. t['Hdieresis'] = 0x1E26;
  13585. t['Hdotaccent'] = 0x1E22;
  13586. t['Hdotbelow'] = 0x1E24;
  13587. t['Hmonospace'] = 0xFF28;
  13588. t['Hoarmenian'] = 0x0540;
  13589. t['Horicoptic'] = 0x03E8;
  13590. t['Hsmall'] = 0xF768;
  13591. t['Hungarumlaut'] = 0xF6CF;
  13592. t['Hungarumlautsmall'] = 0xF6F8;
  13593. t['Hzsquare'] = 0x3390;
  13594. t['I'] = 0x0049;
  13595. t['IAcyrillic'] = 0x042F;
  13596. t['IJ'] = 0x0132;
  13597. t['IUcyrillic'] = 0x042E;
  13598. t['Iacute'] = 0x00CD;
  13599. t['Iacutesmall'] = 0xF7ED;
  13600. t['Ibreve'] = 0x012C;
  13601. t['Icaron'] = 0x01CF;
  13602. t['Icircle'] = 0x24BE;
  13603. t['Icircumflex'] = 0x00CE;
  13604. t['Icircumflexsmall'] = 0xF7EE;
  13605. t['Icyrillic'] = 0x0406;
  13606. t['Idblgrave'] = 0x0208;
  13607. t['Idieresis'] = 0x00CF;
  13608. t['Idieresisacute'] = 0x1E2E;
  13609. t['Idieresiscyrillic'] = 0x04E4;
  13610. t['Idieresissmall'] = 0xF7EF;
  13611. t['Idot'] = 0x0130;
  13612. t['Idotaccent'] = 0x0130;
  13613. t['Idotbelow'] = 0x1ECA;
  13614. t['Iebrevecyrillic'] = 0x04D6;
  13615. t['Iecyrillic'] = 0x0415;
  13616. t['Ifraktur'] = 0x2111;
  13617. t['Igrave'] = 0x00CC;
  13618. t['Igravesmall'] = 0xF7EC;
  13619. t['Ihookabove'] = 0x1EC8;
  13620. t['Iicyrillic'] = 0x0418;
  13621. t['Iinvertedbreve'] = 0x020A;
  13622. t['Iishortcyrillic'] = 0x0419;
  13623. t['Imacron'] = 0x012A;
  13624. t['Imacroncyrillic'] = 0x04E2;
  13625. t['Imonospace'] = 0xFF29;
  13626. t['Iniarmenian'] = 0x053B;
  13627. t['Iocyrillic'] = 0x0401;
  13628. t['Iogonek'] = 0x012E;
  13629. t['Iota'] = 0x0399;
  13630. t['Iotaafrican'] = 0x0196;
  13631. t['Iotadieresis'] = 0x03AA;
  13632. t['Iotatonos'] = 0x038A;
  13633. t['Ismall'] = 0xF769;
  13634. t['Istroke'] = 0x0197;
  13635. t['Itilde'] = 0x0128;
  13636. t['Itildebelow'] = 0x1E2C;
  13637. t['Izhitsacyrillic'] = 0x0474;
  13638. t['Izhitsadblgravecyrillic'] = 0x0476;
  13639. t['J'] = 0x004A;
  13640. t['Jaarmenian'] = 0x0541;
  13641. t['Jcircle'] = 0x24BF;
  13642. t['Jcircumflex'] = 0x0134;
  13643. t['Jecyrillic'] = 0x0408;
  13644. t['Jheharmenian'] = 0x054B;
  13645. t['Jmonospace'] = 0xFF2A;
  13646. t['Jsmall'] = 0xF76A;
  13647. t['K'] = 0x004B;
  13648. t['KBsquare'] = 0x3385;
  13649. t['KKsquare'] = 0x33CD;
  13650. t['Kabashkircyrillic'] = 0x04A0;
  13651. t['Kacute'] = 0x1E30;
  13652. t['Kacyrillic'] = 0x041A;
  13653. t['Kadescendercyrillic'] = 0x049A;
  13654. t['Kahookcyrillic'] = 0x04C3;
  13655. t['Kappa'] = 0x039A;
  13656. t['Kastrokecyrillic'] = 0x049E;
  13657. t['Kaverticalstrokecyrillic'] = 0x049C;
  13658. t['Kcaron'] = 0x01E8;
  13659. t['Kcedilla'] = 0x0136;
  13660. t['Kcircle'] = 0x24C0;
  13661. t['Kcommaaccent'] = 0x0136;
  13662. t['Kdotbelow'] = 0x1E32;
  13663. t['Keharmenian'] = 0x0554;
  13664. t['Kenarmenian'] = 0x053F;
  13665. t['Khacyrillic'] = 0x0425;
  13666. t['Kheicoptic'] = 0x03E6;
  13667. t['Khook'] = 0x0198;
  13668. t['Kjecyrillic'] = 0x040C;
  13669. t['Klinebelow'] = 0x1E34;
  13670. t['Kmonospace'] = 0xFF2B;
  13671. t['Koppacyrillic'] = 0x0480;
  13672. t['Koppagreek'] = 0x03DE;
  13673. t['Ksicyrillic'] = 0x046E;
  13674. t['Ksmall'] = 0xF76B;
  13675. t['L'] = 0x004C;
  13676. t['LJ'] = 0x01C7;
  13677. t['LL'] = 0xF6BF;
  13678. t['Lacute'] = 0x0139;
  13679. t['Lambda'] = 0x039B;
  13680. t['Lcaron'] = 0x013D;
  13681. t['Lcedilla'] = 0x013B;
  13682. t['Lcircle'] = 0x24C1;
  13683. t['Lcircumflexbelow'] = 0x1E3C;
  13684. t['Lcommaaccent'] = 0x013B;
  13685. t['Ldot'] = 0x013F;
  13686. t['Ldotaccent'] = 0x013F;
  13687. t['Ldotbelow'] = 0x1E36;
  13688. t['Ldotbelowmacron'] = 0x1E38;
  13689. t['Liwnarmenian'] = 0x053C;
  13690. t['Lj'] = 0x01C8;
  13691. t['Ljecyrillic'] = 0x0409;
  13692. t['Llinebelow'] = 0x1E3A;
  13693. t['Lmonospace'] = 0xFF2C;
  13694. t['Lslash'] = 0x0141;
  13695. t['Lslashsmall'] = 0xF6F9;
  13696. t['Lsmall'] = 0xF76C;
  13697. t['M'] = 0x004D;
  13698. t['MBsquare'] = 0x3386;
  13699. t['Macron'] = 0xF6D0;
  13700. t['Macronsmall'] = 0xF7AF;
  13701. t['Macute'] = 0x1E3E;
  13702. t['Mcircle'] = 0x24C2;
  13703. t['Mdotaccent'] = 0x1E40;
  13704. t['Mdotbelow'] = 0x1E42;
  13705. t['Menarmenian'] = 0x0544;
  13706. t['Mmonospace'] = 0xFF2D;
  13707. t['Msmall'] = 0xF76D;
  13708. t['Mturned'] = 0x019C;
  13709. t['Mu'] = 0x039C;
  13710. t['N'] = 0x004E;
  13711. t['NJ'] = 0x01CA;
  13712. t['Nacute'] = 0x0143;
  13713. t['Ncaron'] = 0x0147;
  13714. t['Ncedilla'] = 0x0145;
  13715. t['Ncircle'] = 0x24C3;
  13716. t['Ncircumflexbelow'] = 0x1E4A;
  13717. t['Ncommaaccent'] = 0x0145;
  13718. t['Ndotaccent'] = 0x1E44;
  13719. t['Ndotbelow'] = 0x1E46;
  13720. t['Nhookleft'] = 0x019D;
  13721. t['Nineroman'] = 0x2168;
  13722. t['Nj'] = 0x01CB;
  13723. t['Njecyrillic'] = 0x040A;
  13724. t['Nlinebelow'] = 0x1E48;
  13725. t['Nmonospace'] = 0xFF2E;
  13726. t['Nowarmenian'] = 0x0546;
  13727. t['Nsmall'] = 0xF76E;
  13728. t['Ntilde'] = 0x00D1;
  13729. t['Ntildesmall'] = 0xF7F1;
  13730. t['Nu'] = 0x039D;
  13731. t['O'] = 0x004F;
  13732. t['OE'] = 0x0152;
  13733. t['OEsmall'] = 0xF6FA;
  13734. t['Oacute'] = 0x00D3;
  13735. t['Oacutesmall'] = 0xF7F3;
  13736. t['Obarredcyrillic'] = 0x04E8;
  13737. t['Obarreddieresiscyrillic'] = 0x04EA;
  13738. t['Obreve'] = 0x014E;
  13739. t['Ocaron'] = 0x01D1;
  13740. t['Ocenteredtilde'] = 0x019F;
  13741. t['Ocircle'] = 0x24C4;
  13742. t['Ocircumflex'] = 0x00D4;
  13743. t['Ocircumflexacute'] = 0x1ED0;
  13744. t['Ocircumflexdotbelow'] = 0x1ED8;
  13745. t['Ocircumflexgrave'] = 0x1ED2;
  13746. t['Ocircumflexhookabove'] = 0x1ED4;
  13747. t['Ocircumflexsmall'] = 0xF7F4;
  13748. t['Ocircumflextilde'] = 0x1ED6;
  13749. t['Ocyrillic'] = 0x041E;
  13750. t['Odblacute'] = 0x0150;
  13751. t['Odblgrave'] = 0x020C;
  13752. t['Odieresis'] = 0x00D6;
  13753. t['Odieresiscyrillic'] = 0x04E6;
  13754. t['Odieresissmall'] = 0xF7F6;
  13755. t['Odotbelow'] = 0x1ECC;
  13756. t['Ogoneksmall'] = 0xF6FB;
  13757. t['Ograve'] = 0x00D2;
  13758. t['Ogravesmall'] = 0xF7F2;
  13759. t['Oharmenian'] = 0x0555;
  13760. t['Ohm'] = 0x2126;
  13761. t['Ohookabove'] = 0x1ECE;
  13762. t['Ohorn'] = 0x01A0;
  13763. t['Ohornacute'] = 0x1EDA;
  13764. t['Ohorndotbelow'] = 0x1EE2;
  13765. t['Ohorngrave'] = 0x1EDC;
  13766. t['Ohornhookabove'] = 0x1EDE;
  13767. t['Ohorntilde'] = 0x1EE0;
  13768. t['Ohungarumlaut'] = 0x0150;
  13769. t['Oi'] = 0x01A2;
  13770. t['Oinvertedbreve'] = 0x020E;
  13771. t['Omacron'] = 0x014C;
  13772. t['Omacronacute'] = 0x1E52;
  13773. t['Omacrongrave'] = 0x1E50;
  13774. t['Omega'] = 0x2126;
  13775. t['Omegacyrillic'] = 0x0460;
  13776. t['Omegagreek'] = 0x03A9;
  13777. t['Omegaroundcyrillic'] = 0x047A;
  13778. t['Omegatitlocyrillic'] = 0x047C;
  13779. t['Omegatonos'] = 0x038F;
  13780. t['Omicron'] = 0x039F;
  13781. t['Omicrontonos'] = 0x038C;
  13782. t['Omonospace'] = 0xFF2F;
  13783. t['Oneroman'] = 0x2160;
  13784. t['Oogonek'] = 0x01EA;
  13785. t['Oogonekmacron'] = 0x01EC;
  13786. t['Oopen'] = 0x0186;
  13787. t['Oslash'] = 0x00D8;
  13788. t['Oslashacute'] = 0x01FE;
  13789. t['Oslashsmall'] = 0xF7F8;
  13790. t['Osmall'] = 0xF76F;
  13791. t['Ostrokeacute'] = 0x01FE;
  13792. t['Otcyrillic'] = 0x047E;
  13793. t['Otilde'] = 0x00D5;
  13794. t['Otildeacute'] = 0x1E4C;
  13795. t['Otildedieresis'] = 0x1E4E;
  13796. t['Otildesmall'] = 0xF7F5;
  13797. t['P'] = 0x0050;
  13798. t['Pacute'] = 0x1E54;
  13799. t['Pcircle'] = 0x24C5;
  13800. t['Pdotaccent'] = 0x1E56;
  13801. t['Pecyrillic'] = 0x041F;
  13802. t['Peharmenian'] = 0x054A;
  13803. t['Pemiddlehookcyrillic'] = 0x04A6;
  13804. t['Phi'] = 0x03A6;
  13805. t['Phook'] = 0x01A4;
  13806. t['Pi'] = 0x03A0;
  13807. t['Piwrarmenian'] = 0x0553;
  13808. t['Pmonospace'] = 0xFF30;
  13809. t['Psi'] = 0x03A8;
  13810. t['Psicyrillic'] = 0x0470;
  13811. t['Psmall'] = 0xF770;
  13812. t['Q'] = 0x0051;
  13813. t['Qcircle'] = 0x24C6;
  13814. t['Qmonospace'] = 0xFF31;
  13815. t['Qsmall'] = 0xF771;
  13816. t['R'] = 0x0052;
  13817. t['Raarmenian'] = 0x054C;
  13818. t['Racute'] = 0x0154;
  13819. t['Rcaron'] = 0x0158;
  13820. t['Rcedilla'] = 0x0156;
  13821. t['Rcircle'] = 0x24C7;
  13822. t['Rcommaaccent'] = 0x0156;
  13823. t['Rdblgrave'] = 0x0210;
  13824. t['Rdotaccent'] = 0x1E58;
  13825. t['Rdotbelow'] = 0x1E5A;
  13826. t['Rdotbelowmacron'] = 0x1E5C;
  13827. t['Reharmenian'] = 0x0550;
  13828. t['Rfraktur'] = 0x211C;
  13829. t['Rho'] = 0x03A1;
  13830. t['Ringsmall'] = 0xF6FC;
  13831. t['Rinvertedbreve'] = 0x0212;
  13832. t['Rlinebelow'] = 0x1E5E;
  13833. t['Rmonospace'] = 0xFF32;
  13834. t['Rsmall'] = 0xF772;
  13835. t['Rsmallinverted'] = 0x0281;
  13836. t['Rsmallinvertedsuperior'] = 0x02B6;
  13837. t['S'] = 0x0053;
  13838. t['SF010000'] = 0x250C;
  13839. t['SF020000'] = 0x2514;
  13840. t['SF030000'] = 0x2510;
  13841. t['SF040000'] = 0x2518;
  13842. t['SF050000'] = 0x253C;
  13843. t['SF060000'] = 0x252C;
  13844. t['SF070000'] = 0x2534;
  13845. t['SF080000'] = 0x251C;
  13846. t['SF090000'] = 0x2524;
  13847. t['SF100000'] = 0x2500;
  13848. t['SF110000'] = 0x2502;
  13849. t['SF190000'] = 0x2561;
  13850. t['SF200000'] = 0x2562;
  13851. t['SF210000'] = 0x2556;
  13852. t['SF220000'] = 0x2555;
  13853. t['SF230000'] = 0x2563;
  13854. t['SF240000'] = 0x2551;
  13855. t['SF250000'] = 0x2557;
  13856. t['SF260000'] = 0x255D;
  13857. t['SF270000'] = 0x255C;
  13858. t['SF280000'] = 0x255B;
  13859. t['SF360000'] = 0x255E;
  13860. t['SF370000'] = 0x255F;
  13861. t['SF380000'] = 0x255A;
  13862. t['SF390000'] = 0x2554;
  13863. t['SF400000'] = 0x2569;
  13864. t['SF410000'] = 0x2566;
  13865. t['SF420000'] = 0x2560;
  13866. t['SF430000'] = 0x2550;
  13867. t['SF440000'] = 0x256C;
  13868. t['SF450000'] = 0x2567;
  13869. t['SF460000'] = 0x2568;
  13870. t['SF470000'] = 0x2564;
  13871. t['SF480000'] = 0x2565;
  13872. t['SF490000'] = 0x2559;
  13873. t['SF500000'] = 0x2558;
  13874. t['SF510000'] = 0x2552;
  13875. t['SF520000'] = 0x2553;
  13876. t['SF530000'] = 0x256B;
  13877. t['SF540000'] = 0x256A;
  13878. t['Sacute'] = 0x015A;
  13879. t['Sacutedotaccent'] = 0x1E64;
  13880. t['Sampigreek'] = 0x03E0;
  13881. t['Scaron'] = 0x0160;
  13882. t['Scarondotaccent'] = 0x1E66;
  13883. t['Scaronsmall'] = 0xF6FD;
  13884. t['Scedilla'] = 0x015E;
  13885. t['Schwa'] = 0x018F;
  13886. t['Schwacyrillic'] = 0x04D8;
  13887. t['Schwadieresiscyrillic'] = 0x04DA;
  13888. t['Scircle'] = 0x24C8;
  13889. t['Scircumflex'] = 0x015C;
  13890. t['Scommaaccent'] = 0x0218;
  13891. t['Sdotaccent'] = 0x1E60;
  13892. t['Sdotbelow'] = 0x1E62;
  13893. t['Sdotbelowdotaccent'] = 0x1E68;
  13894. t['Seharmenian'] = 0x054D;
  13895. t['Sevenroman'] = 0x2166;
  13896. t['Shaarmenian'] = 0x0547;
  13897. t['Shacyrillic'] = 0x0428;
  13898. t['Shchacyrillic'] = 0x0429;
  13899. t['Sheicoptic'] = 0x03E2;
  13900. t['Shhacyrillic'] = 0x04BA;
  13901. t['Shimacoptic'] = 0x03EC;
  13902. t['Sigma'] = 0x03A3;
  13903. t['Sixroman'] = 0x2165;
  13904. t['Smonospace'] = 0xFF33;
  13905. t['Softsigncyrillic'] = 0x042C;
  13906. t['Ssmall'] = 0xF773;
  13907. t['Stigmagreek'] = 0x03DA;
  13908. t['T'] = 0x0054;
  13909. t['Tau'] = 0x03A4;
  13910. t['Tbar'] = 0x0166;
  13911. t['Tcaron'] = 0x0164;
  13912. t['Tcedilla'] = 0x0162;
  13913. t['Tcircle'] = 0x24C9;
  13914. t['Tcircumflexbelow'] = 0x1E70;
  13915. t['Tcommaaccent'] = 0x0162;
  13916. t['Tdotaccent'] = 0x1E6A;
  13917. t['Tdotbelow'] = 0x1E6C;
  13918. t['Tecyrillic'] = 0x0422;
  13919. t['Tedescendercyrillic'] = 0x04AC;
  13920. t['Tenroman'] = 0x2169;
  13921. t['Tetsecyrillic'] = 0x04B4;
  13922. t['Theta'] = 0x0398;
  13923. t['Thook'] = 0x01AC;
  13924. t['Thorn'] = 0x00DE;
  13925. t['Thornsmall'] = 0xF7FE;
  13926. t['Threeroman'] = 0x2162;
  13927. t['Tildesmall'] = 0xF6FE;
  13928. t['Tiwnarmenian'] = 0x054F;
  13929. t['Tlinebelow'] = 0x1E6E;
  13930. t['Tmonospace'] = 0xFF34;
  13931. t['Toarmenian'] = 0x0539;
  13932. t['Tonefive'] = 0x01BC;
  13933. t['Tonesix'] = 0x0184;
  13934. t['Tonetwo'] = 0x01A7;
  13935. t['Tretroflexhook'] = 0x01AE;
  13936. t['Tsecyrillic'] = 0x0426;
  13937. t['Tshecyrillic'] = 0x040B;
  13938. t['Tsmall'] = 0xF774;
  13939. t['Twelveroman'] = 0x216B;
  13940. t['Tworoman'] = 0x2161;
  13941. t['U'] = 0x0055;
  13942. t['Uacute'] = 0x00DA;
  13943. t['Uacutesmall'] = 0xF7FA;
  13944. t['Ubreve'] = 0x016C;
  13945. t['Ucaron'] = 0x01D3;
  13946. t['Ucircle'] = 0x24CA;
  13947. t['Ucircumflex'] = 0x00DB;
  13948. t['Ucircumflexbelow'] = 0x1E76;
  13949. t['Ucircumflexsmall'] = 0xF7FB;
  13950. t['Ucyrillic'] = 0x0423;
  13951. t['Udblacute'] = 0x0170;
  13952. t['Udblgrave'] = 0x0214;
  13953. t['Udieresis'] = 0x00DC;
  13954. t['Udieresisacute'] = 0x01D7;
  13955. t['Udieresisbelow'] = 0x1E72;
  13956. t['Udieresiscaron'] = 0x01D9;
  13957. t['Udieresiscyrillic'] = 0x04F0;
  13958. t['Udieresisgrave'] = 0x01DB;
  13959. t['Udieresismacron'] = 0x01D5;
  13960. t['Udieresissmall'] = 0xF7FC;
  13961. t['Udotbelow'] = 0x1EE4;
  13962. t['Ugrave'] = 0x00D9;
  13963. t['Ugravesmall'] = 0xF7F9;
  13964. t['Uhookabove'] = 0x1EE6;
  13965. t['Uhorn'] = 0x01AF;
  13966. t['Uhornacute'] = 0x1EE8;
  13967. t['Uhorndotbelow'] = 0x1EF0;
  13968. t['Uhorngrave'] = 0x1EEA;
  13969. t['Uhornhookabove'] = 0x1EEC;
  13970. t['Uhorntilde'] = 0x1EEE;
  13971. t['Uhungarumlaut'] = 0x0170;
  13972. t['Uhungarumlautcyrillic'] = 0x04F2;
  13973. t['Uinvertedbreve'] = 0x0216;
  13974. t['Ukcyrillic'] = 0x0478;
  13975. t['Umacron'] = 0x016A;
  13976. t['Umacroncyrillic'] = 0x04EE;
  13977. t['Umacrondieresis'] = 0x1E7A;
  13978. t['Umonospace'] = 0xFF35;
  13979. t['Uogonek'] = 0x0172;
  13980. t['Upsilon'] = 0x03A5;
  13981. t['Upsilon1'] = 0x03D2;
  13982. t['Upsilonacutehooksymbolgreek'] = 0x03D3;
  13983. t['Upsilonafrican'] = 0x01B1;
  13984. t['Upsilondieresis'] = 0x03AB;
  13985. t['Upsilondieresishooksymbolgreek'] = 0x03D4;
  13986. t['Upsilonhooksymbol'] = 0x03D2;
  13987. t['Upsilontonos'] = 0x038E;
  13988. t['Uring'] = 0x016E;
  13989. t['Ushortcyrillic'] = 0x040E;
  13990. t['Usmall'] = 0xF775;
  13991. t['Ustraightcyrillic'] = 0x04AE;
  13992. t['Ustraightstrokecyrillic'] = 0x04B0;
  13993. t['Utilde'] = 0x0168;
  13994. t['Utildeacute'] = 0x1E78;
  13995. t['Utildebelow'] = 0x1E74;
  13996. t['V'] = 0x0056;
  13997. t['Vcircle'] = 0x24CB;
  13998. t['Vdotbelow'] = 0x1E7E;
  13999. t['Vecyrillic'] = 0x0412;
  14000. t['Vewarmenian'] = 0x054E;
  14001. t['Vhook'] = 0x01B2;
  14002. t['Vmonospace'] = 0xFF36;
  14003. t['Voarmenian'] = 0x0548;
  14004. t['Vsmall'] = 0xF776;
  14005. t['Vtilde'] = 0x1E7C;
  14006. t['W'] = 0x0057;
  14007. t['Wacute'] = 0x1E82;
  14008. t['Wcircle'] = 0x24CC;
  14009. t['Wcircumflex'] = 0x0174;
  14010. t['Wdieresis'] = 0x1E84;
  14011. t['Wdotaccent'] = 0x1E86;
  14012. t['Wdotbelow'] = 0x1E88;
  14013. t['Wgrave'] = 0x1E80;
  14014. t['Wmonospace'] = 0xFF37;
  14015. t['Wsmall'] = 0xF777;
  14016. t['X'] = 0x0058;
  14017. t['Xcircle'] = 0x24CD;
  14018. t['Xdieresis'] = 0x1E8C;
  14019. t['Xdotaccent'] = 0x1E8A;
  14020. t['Xeharmenian'] = 0x053D;
  14021. t['Xi'] = 0x039E;
  14022. t['Xmonospace'] = 0xFF38;
  14023. t['Xsmall'] = 0xF778;
  14024. t['Y'] = 0x0059;
  14025. t['Yacute'] = 0x00DD;
  14026. t['Yacutesmall'] = 0xF7FD;
  14027. t['Yatcyrillic'] = 0x0462;
  14028. t['Ycircle'] = 0x24CE;
  14029. t['Ycircumflex'] = 0x0176;
  14030. t['Ydieresis'] = 0x0178;
  14031. t['Ydieresissmall'] = 0xF7FF;
  14032. t['Ydotaccent'] = 0x1E8E;
  14033. t['Ydotbelow'] = 0x1EF4;
  14034. t['Yericyrillic'] = 0x042B;
  14035. t['Yerudieresiscyrillic'] = 0x04F8;
  14036. t['Ygrave'] = 0x1EF2;
  14037. t['Yhook'] = 0x01B3;
  14038. t['Yhookabove'] = 0x1EF6;
  14039. t['Yiarmenian'] = 0x0545;
  14040. t['Yicyrillic'] = 0x0407;
  14041. t['Yiwnarmenian'] = 0x0552;
  14042. t['Ymonospace'] = 0xFF39;
  14043. t['Ysmall'] = 0xF779;
  14044. t['Ytilde'] = 0x1EF8;
  14045. t['Yusbigcyrillic'] = 0x046A;
  14046. t['Yusbigiotifiedcyrillic'] = 0x046C;
  14047. t['Yuslittlecyrillic'] = 0x0466;
  14048. t['Yuslittleiotifiedcyrillic'] = 0x0468;
  14049. t['Z'] = 0x005A;
  14050. t['Zaarmenian'] = 0x0536;
  14051. t['Zacute'] = 0x0179;
  14052. t['Zcaron'] = 0x017D;
  14053. t['Zcaronsmall'] = 0xF6FF;
  14054. t['Zcircle'] = 0x24CF;
  14055. t['Zcircumflex'] = 0x1E90;
  14056. t['Zdot'] = 0x017B;
  14057. t['Zdotaccent'] = 0x017B;
  14058. t['Zdotbelow'] = 0x1E92;
  14059. t['Zecyrillic'] = 0x0417;
  14060. t['Zedescendercyrillic'] = 0x0498;
  14061. t['Zedieresiscyrillic'] = 0x04DE;
  14062. t['Zeta'] = 0x0396;
  14063. t['Zhearmenian'] = 0x053A;
  14064. t['Zhebrevecyrillic'] = 0x04C1;
  14065. t['Zhecyrillic'] = 0x0416;
  14066. t['Zhedescendercyrillic'] = 0x0496;
  14067. t['Zhedieresiscyrillic'] = 0x04DC;
  14068. t['Zlinebelow'] = 0x1E94;
  14069. t['Zmonospace'] = 0xFF3A;
  14070. t['Zsmall'] = 0xF77A;
  14071. t['Zstroke'] = 0x01B5;
  14072. t['a'] = 0x0061;
  14073. t['aabengali'] = 0x0986;
  14074. t['aacute'] = 0x00E1;
  14075. t['aadeva'] = 0x0906;
  14076. t['aagujarati'] = 0x0A86;
  14077. t['aagurmukhi'] = 0x0A06;
  14078. t['aamatragurmukhi'] = 0x0A3E;
  14079. t['aarusquare'] = 0x3303;
  14080. t['aavowelsignbengali'] = 0x09BE;
  14081. t['aavowelsigndeva'] = 0x093E;
  14082. t['aavowelsigngujarati'] = 0x0ABE;
  14083. t['abbreviationmarkarmenian'] = 0x055F;
  14084. t['abbreviationsigndeva'] = 0x0970;
  14085. t['abengali'] = 0x0985;
  14086. t['abopomofo'] = 0x311A;
  14087. t['abreve'] = 0x0103;
  14088. t['abreveacute'] = 0x1EAF;
  14089. t['abrevecyrillic'] = 0x04D1;
  14090. t['abrevedotbelow'] = 0x1EB7;
  14091. t['abrevegrave'] = 0x1EB1;
  14092. t['abrevehookabove'] = 0x1EB3;
  14093. t['abrevetilde'] = 0x1EB5;
  14094. t['acaron'] = 0x01CE;
  14095. t['acircle'] = 0x24D0;
  14096. t['acircumflex'] = 0x00E2;
  14097. t['acircumflexacute'] = 0x1EA5;
  14098. t['acircumflexdotbelow'] = 0x1EAD;
  14099. t['acircumflexgrave'] = 0x1EA7;
  14100. t['acircumflexhookabove'] = 0x1EA9;
  14101. t['acircumflextilde'] = 0x1EAB;
  14102. t['acute'] = 0x00B4;
  14103. t['acutebelowcmb'] = 0x0317;
  14104. t['acutecmb'] = 0x0301;
  14105. t['acutecomb'] = 0x0301;
  14106. t['acutedeva'] = 0x0954;
  14107. t['acutelowmod'] = 0x02CF;
  14108. t['acutetonecmb'] = 0x0341;
  14109. t['acyrillic'] = 0x0430;
  14110. t['adblgrave'] = 0x0201;
  14111. t['addakgurmukhi'] = 0x0A71;
  14112. t['adeva'] = 0x0905;
  14113. t['adieresis'] = 0x00E4;
  14114. t['adieresiscyrillic'] = 0x04D3;
  14115. t['adieresismacron'] = 0x01DF;
  14116. t['adotbelow'] = 0x1EA1;
  14117. t['adotmacron'] = 0x01E1;
  14118. t['ae'] = 0x00E6;
  14119. t['aeacute'] = 0x01FD;
  14120. t['aekorean'] = 0x3150;
  14121. t['aemacron'] = 0x01E3;
  14122. t['afii00208'] = 0x2015;
  14123. t['afii08941'] = 0x20A4;
  14124. t['afii10017'] = 0x0410;
  14125. t['afii10018'] = 0x0411;
  14126. t['afii10019'] = 0x0412;
  14127. t['afii10020'] = 0x0413;
  14128. t['afii10021'] = 0x0414;
  14129. t['afii10022'] = 0x0415;
  14130. t['afii10023'] = 0x0401;
  14131. t['afii10024'] = 0x0416;
  14132. t['afii10025'] = 0x0417;
  14133. t['afii10026'] = 0x0418;
  14134. t['afii10027'] = 0x0419;
  14135. t['afii10028'] = 0x041A;
  14136. t['afii10029'] = 0x041B;
  14137. t['afii10030'] = 0x041C;
  14138. t['afii10031'] = 0x041D;
  14139. t['afii10032'] = 0x041E;
  14140. t['afii10033'] = 0x041F;
  14141. t['afii10034'] = 0x0420;
  14142. t['afii10035'] = 0x0421;
  14143. t['afii10036'] = 0x0422;
  14144. t['afii10037'] = 0x0423;
  14145. t['afii10038'] = 0x0424;
  14146. t['afii10039'] = 0x0425;
  14147. t['afii10040'] = 0x0426;
  14148. t['afii10041'] = 0x0427;
  14149. t['afii10042'] = 0x0428;
  14150. t['afii10043'] = 0x0429;
  14151. t['afii10044'] = 0x042A;
  14152. t['afii10045'] = 0x042B;
  14153. t['afii10046'] = 0x042C;
  14154. t['afii10047'] = 0x042D;
  14155. t['afii10048'] = 0x042E;
  14156. t['afii10049'] = 0x042F;
  14157. t['afii10050'] = 0x0490;
  14158. t['afii10051'] = 0x0402;
  14159. t['afii10052'] = 0x0403;
  14160. t['afii10053'] = 0x0404;
  14161. t['afii10054'] = 0x0405;
  14162. t['afii10055'] = 0x0406;
  14163. t['afii10056'] = 0x0407;
  14164. t['afii10057'] = 0x0408;
  14165. t['afii10058'] = 0x0409;
  14166. t['afii10059'] = 0x040A;
  14167. t['afii10060'] = 0x040B;
  14168. t['afii10061'] = 0x040C;
  14169. t['afii10062'] = 0x040E;
  14170. t['afii10063'] = 0xF6C4;
  14171. t['afii10064'] = 0xF6C5;
  14172. t['afii10065'] = 0x0430;
  14173. t['afii10066'] = 0x0431;
  14174. t['afii10067'] = 0x0432;
  14175. t['afii10068'] = 0x0433;
  14176. t['afii10069'] = 0x0434;
  14177. t['afii10070'] = 0x0435;
  14178. t['afii10071'] = 0x0451;
  14179. t['afii10072'] = 0x0436;
  14180. t['afii10073'] = 0x0437;
  14181. t['afii10074'] = 0x0438;
  14182. t['afii10075'] = 0x0439;
  14183. t['afii10076'] = 0x043A;
  14184. t['afii10077'] = 0x043B;
  14185. t['afii10078'] = 0x043C;
  14186. t['afii10079'] = 0x043D;
  14187. t['afii10080'] = 0x043E;
  14188. t['afii10081'] = 0x043F;
  14189. t['afii10082'] = 0x0440;
  14190. t['afii10083'] = 0x0441;
  14191. t['afii10084'] = 0x0442;
  14192. t['afii10085'] = 0x0443;
  14193. t['afii10086'] = 0x0444;
  14194. t['afii10087'] = 0x0445;
  14195. t['afii10088'] = 0x0446;
  14196. t['afii10089'] = 0x0447;
  14197. t['afii10090'] = 0x0448;
  14198. t['afii10091'] = 0x0449;
  14199. t['afii10092'] = 0x044A;
  14200. t['afii10093'] = 0x044B;
  14201. t['afii10094'] = 0x044C;
  14202. t['afii10095'] = 0x044D;
  14203. t['afii10096'] = 0x044E;
  14204. t['afii10097'] = 0x044F;
  14205. t['afii10098'] = 0x0491;
  14206. t['afii10099'] = 0x0452;
  14207. t['afii10100'] = 0x0453;
  14208. t['afii10101'] = 0x0454;
  14209. t['afii10102'] = 0x0455;
  14210. t['afii10103'] = 0x0456;
  14211. t['afii10104'] = 0x0457;
  14212. t['afii10105'] = 0x0458;
  14213. t['afii10106'] = 0x0459;
  14214. t['afii10107'] = 0x045A;
  14215. t['afii10108'] = 0x045B;
  14216. t['afii10109'] = 0x045C;
  14217. t['afii10110'] = 0x045E;
  14218. t['afii10145'] = 0x040F;
  14219. t['afii10146'] = 0x0462;
  14220. t['afii10147'] = 0x0472;
  14221. t['afii10148'] = 0x0474;
  14222. t['afii10192'] = 0xF6C6;
  14223. t['afii10193'] = 0x045F;
  14224. t['afii10194'] = 0x0463;
  14225. t['afii10195'] = 0x0473;
  14226. t['afii10196'] = 0x0475;
  14227. t['afii10831'] = 0xF6C7;
  14228. t['afii10832'] = 0xF6C8;
  14229. t['afii10846'] = 0x04D9;
  14230. t['afii299'] = 0x200E;
  14231. t['afii300'] = 0x200F;
  14232. t['afii301'] = 0x200D;
  14233. t['afii57381'] = 0x066A;
  14234. t['afii57388'] = 0x060C;
  14235. t['afii57392'] = 0x0660;
  14236. t['afii57393'] = 0x0661;
  14237. t['afii57394'] = 0x0662;
  14238. t['afii57395'] = 0x0663;
  14239. t['afii57396'] = 0x0664;
  14240. t['afii57397'] = 0x0665;
  14241. t['afii57398'] = 0x0666;
  14242. t['afii57399'] = 0x0667;
  14243. t['afii57400'] = 0x0668;
  14244. t['afii57401'] = 0x0669;
  14245. t['afii57403'] = 0x061B;
  14246. t['afii57407'] = 0x061F;
  14247. t['afii57409'] = 0x0621;
  14248. t['afii57410'] = 0x0622;
  14249. t['afii57411'] = 0x0623;
  14250. t['afii57412'] = 0x0624;
  14251. t['afii57413'] = 0x0625;
  14252. t['afii57414'] = 0x0626;
  14253. t['afii57415'] = 0x0627;
  14254. t['afii57416'] = 0x0628;
  14255. t['afii57417'] = 0x0629;
  14256. t['afii57418'] = 0x062A;
  14257. t['afii57419'] = 0x062B;
  14258. t['afii57420'] = 0x062C;
  14259. t['afii57421'] = 0x062D;
  14260. t['afii57422'] = 0x062E;
  14261. t['afii57423'] = 0x062F;
  14262. t['afii57424'] = 0x0630;
  14263. t['afii57425'] = 0x0631;
  14264. t['afii57426'] = 0x0632;
  14265. t['afii57427'] = 0x0633;
  14266. t['afii57428'] = 0x0634;
  14267. t['afii57429'] = 0x0635;
  14268. t['afii57430'] = 0x0636;
  14269. t['afii57431'] = 0x0637;
  14270. t['afii57432'] = 0x0638;
  14271. t['afii57433'] = 0x0639;
  14272. t['afii57434'] = 0x063A;
  14273. t['afii57440'] = 0x0640;
  14274. t['afii57441'] = 0x0641;
  14275. t['afii57442'] = 0x0642;
  14276. t['afii57443'] = 0x0643;
  14277. t['afii57444'] = 0x0644;
  14278. t['afii57445'] = 0x0645;
  14279. t['afii57446'] = 0x0646;
  14280. t['afii57448'] = 0x0648;
  14281. t['afii57449'] = 0x0649;
  14282. t['afii57450'] = 0x064A;
  14283. t['afii57451'] = 0x064B;
  14284. t['afii57452'] = 0x064C;
  14285. t['afii57453'] = 0x064D;
  14286. t['afii57454'] = 0x064E;
  14287. t['afii57455'] = 0x064F;
  14288. t['afii57456'] = 0x0650;
  14289. t['afii57457'] = 0x0651;
  14290. t['afii57458'] = 0x0652;
  14291. t['afii57470'] = 0x0647;
  14292. t['afii57505'] = 0x06A4;
  14293. t['afii57506'] = 0x067E;
  14294. t['afii57507'] = 0x0686;
  14295. t['afii57508'] = 0x0698;
  14296. t['afii57509'] = 0x06AF;
  14297. t['afii57511'] = 0x0679;
  14298. t['afii57512'] = 0x0688;
  14299. t['afii57513'] = 0x0691;
  14300. t['afii57514'] = 0x06BA;
  14301. t['afii57519'] = 0x06D2;
  14302. t['afii57534'] = 0x06D5;
  14303. t['afii57636'] = 0x20AA;
  14304. t['afii57645'] = 0x05BE;
  14305. t['afii57658'] = 0x05C3;
  14306. t['afii57664'] = 0x05D0;
  14307. t['afii57665'] = 0x05D1;
  14308. t['afii57666'] = 0x05D2;
  14309. t['afii57667'] = 0x05D3;
  14310. t['afii57668'] = 0x05D4;
  14311. t['afii57669'] = 0x05D5;
  14312. t['afii57670'] = 0x05D6;
  14313. t['afii57671'] = 0x05D7;
  14314. t['afii57672'] = 0x05D8;
  14315. t['afii57673'] = 0x05D9;
  14316. t['afii57674'] = 0x05DA;
  14317. t['afii57675'] = 0x05DB;
  14318. t['afii57676'] = 0x05DC;
  14319. t['afii57677'] = 0x05DD;
  14320. t['afii57678'] = 0x05DE;
  14321. t['afii57679'] = 0x05DF;
  14322. t['afii57680'] = 0x05E0;
  14323. t['afii57681'] = 0x05E1;
  14324. t['afii57682'] = 0x05E2;
  14325. t['afii57683'] = 0x05E3;
  14326. t['afii57684'] = 0x05E4;
  14327. t['afii57685'] = 0x05E5;
  14328. t['afii57686'] = 0x05E6;
  14329. t['afii57687'] = 0x05E7;
  14330. t['afii57688'] = 0x05E8;
  14331. t['afii57689'] = 0x05E9;
  14332. t['afii57690'] = 0x05EA;
  14333. t['afii57694'] = 0xFB2A;
  14334. t['afii57695'] = 0xFB2B;
  14335. t['afii57700'] = 0xFB4B;
  14336. t['afii57705'] = 0xFB1F;
  14337. t['afii57716'] = 0x05F0;
  14338. t['afii57717'] = 0x05F1;
  14339. t['afii57718'] = 0x05F2;
  14340. t['afii57723'] = 0xFB35;
  14341. t['afii57793'] = 0x05B4;
  14342. t['afii57794'] = 0x05B5;
  14343. t['afii57795'] = 0x05B6;
  14344. t['afii57796'] = 0x05BB;
  14345. t['afii57797'] = 0x05B8;
  14346. t['afii57798'] = 0x05B7;
  14347. t['afii57799'] = 0x05B0;
  14348. t['afii57800'] = 0x05B2;
  14349. t['afii57801'] = 0x05B1;
  14350. t['afii57802'] = 0x05B3;
  14351. t['afii57803'] = 0x05C2;
  14352. t['afii57804'] = 0x05C1;
  14353. t['afii57806'] = 0x05B9;
  14354. t['afii57807'] = 0x05BC;
  14355. t['afii57839'] = 0x05BD;
  14356. t['afii57841'] = 0x05BF;
  14357. t['afii57842'] = 0x05C0;
  14358. t['afii57929'] = 0x02BC;
  14359. t['afii61248'] = 0x2105;
  14360. t['afii61289'] = 0x2113;
  14361. t['afii61352'] = 0x2116;
  14362. t['afii61573'] = 0x202C;
  14363. t['afii61574'] = 0x202D;
  14364. t['afii61575'] = 0x202E;
  14365. t['afii61664'] = 0x200C;
  14366. t['afii63167'] = 0x066D;
  14367. t['afii64937'] = 0x02BD;
  14368. t['agrave'] = 0x00E0;
  14369. t['agujarati'] = 0x0A85;
  14370. t['agurmukhi'] = 0x0A05;
  14371. t['ahiragana'] = 0x3042;
  14372. t['ahookabove'] = 0x1EA3;
  14373. t['aibengali'] = 0x0990;
  14374. t['aibopomofo'] = 0x311E;
  14375. t['aideva'] = 0x0910;
  14376. t['aiecyrillic'] = 0x04D5;
  14377. t['aigujarati'] = 0x0A90;
  14378. t['aigurmukhi'] = 0x0A10;
  14379. t['aimatragurmukhi'] = 0x0A48;
  14380. t['ainarabic'] = 0x0639;
  14381. t['ainfinalarabic'] = 0xFECA;
  14382. t['aininitialarabic'] = 0xFECB;
  14383. t['ainmedialarabic'] = 0xFECC;
  14384. t['ainvertedbreve'] = 0x0203;
  14385. t['aivowelsignbengali'] = 0x09C8;
  14386. t['aivowelsigndeva'] = 0x0948;
  14387. t['aivowelsigngujarati'] = 0x0AC8;
  14388. t['akatakana'] = 0x30A2;
  14389. t['akatakanahalfwidth'] = 0xFF71;
  14390. t['akorean'] = 0x314F;
  14391. t['alef'] = 0x05D0;
  14392. t['alefarabic'] = 0x0627;
  14393. t['alefdageshhebrew'] = 0xFB30;
  14394. t['aleffinalarabic'] = 0xFE8E;
  14395. t['alefhamzaabovearabic'] = 0x0623;
  14396. t['alefhamzaabovefinalarabic'] = 0xFE84;
  14397. t['alefhamzabelowarabic'] = 0x0625;
  14398. t['alefhamzabelowfinalarabic'] = 0xFE88;
  14399. t['alefhebrew'] = 0x05D0;
  14400. t['aleflamedhebrew'] = 0xFB4F;
  14401. t['alefmaddaabovearabic'] = 0x0622;
  14402. t['alefmaddaabovefinalarabic'] = 0xFE82;
  14403. t['alefmaksuraarabic'] = 0x0649;
  14404. t['alefmaksurafinalarabic'] = 0xFEF0;
  14405. t['alefmaksurainitialarabic'] = 0xFEF3;
  14406. t['alefmaksuramedialarabic'] = 0xFEF4;
  14407. t['alefpatahhebrew'] = 0xFB2E;
  14408. t['alefqamatshebrew'] = 0xFB2F;
  14409. t['aleph'] = 0x2135;
  14410. t['allequal'] = 0x224C;
  14411. t['alpha'] = 0x03B1;
  14412. t['alphatonos'] = 0x03AC;
  14413. t['amacron'] = 0x0101;
  14414. t['amonospace'] = 0xFF41;
  14415. t['ampersand'] = 0x0026;
  14416. t['ampersandmonospace'] = 0xFF06;
  14417. t['ampersandsmall'] = 0xF726;
  14418. t['amsquare'] = 0x33C2;
  14419. t['anbopomofo'] = 0x3122;
  14420. t['angbopomofo'] = 0x3124;
  14421. t['angbracketleft'] = 0x3008;
  14422. t['angbracketright'] = 0x3009;
  14423. t['angkhankhuthai'] = 0x0E5A;
  14424. t['angle'] = 0x2220;
  14425. t['anglebracketleft'] = 0x3008;
  14426. t['anglebracketleftvertical'] = 0xFE3F;
  14427. t['anglebracketright'] = 0x3009;
  14428. t['anglebracketrightvertical'] = 0xFE40;
  14429. t['angleleft'] = 0x2329;
  14430. t['angleright'] = 0x232A;
  14431. t['angstrom'] = 0x212B;
  14432. t['anoteleia'] = 0x0387;
  14433. t['anudattadeva'] = 0x0952;
  14434. t['anusvarabengali'] = 0x0982;
  14435. t['anusvaradeva'] = 0x0902;
  14436. t['anusvaragujarati'] = 0x0A82;
  14437. t['aogonek'] = 0x0105;
  14438. t['apaatosquare'] = 0x3300;
  14439. t['aparen'] = 0x249C;
  14440. t['apostrophearmenian'] = 0x055A;
  14441. t['apostrophemod'] = 0x02BC;
  14442. t['apple'] = 0xF8FF;
  14443. t['approaches'] = 0x2250;
  14444. t['approxequal'] = 0x2248;
  14445. t['approxequalorimage'] = 0x2252;
  14446. t['approximatelyequal'] = 0x2245;
  14447. t['araeaekorean'] = 0x318E;
  14448. t['araeakorean'] = 0x318D;
  14449. t['arc'] = 0x2312;
  14450. t['arighthalfring'] = 0x1E9A;
  14451. t['aring'] = 0x00E5;
  14452. t['aringacute'] = 0x01FB;
  14453. t['aringbelow'] = 0x1E01;
  14454. t['arrowboth'] = 0x2194;
  14455. t['arrowdashdown'] = 0x21E3;
  14456. t['arrowdashleft'] = 0x21E0;
  14457. t['arrowdashright'] = 0x21E2;
  14458. t['arrowdashup'] = 0x21E1;
  14459. t['arrowdblboth'] = 0x21D4;
  14460. t['arrowdbldown'] = 0x21D3;
  14461. t['arrowdblleft'] = 0x21D0;
  14462. t['arrowdblright'] = 0x21D2;
  14463. t['arrowdblup'] = 0x21D1;
  14464. t['arrowdown'] = 0x2193;
  14465. t['arrowdownleft'] = 0x2199;
  14466. t['arrowdownright'] = 0x2198;
  14467. t['arrowdownwhite'] = 0x21E9;
  14468. t['arrowheaddownmod'] = 0x02C5;
  14469. t['arrowheadleftmod'] = 0x02C2;
  14470. t['arrowheadrightmod'] = 0x02C3;
  14471. t['arrowheadupmod'] = 0x02C4;
  14472. t['arrowhorizex'] = 0xF8E7;
  14473. t['arrowleft'] = 0x2190;
  14474. t['arrowleftdbl'] = 0x21D0;
  14475. t['arrowleftdblstroke'] = 0x21CD;
  14476. t['arrowleftoverright'] = 0x21C6;
  14477. t['arrowleftwhite'] = 0x21E6;
  14478. t['arrowright'] = 0x2192;
  14479. t['arrowrightdblstroke'] = 0x21CF;
  14480. t['arrowrightheavy'] = 0x279E;
  14481. t['arrowrightoverleft'] = 0x21C4;
  14482. t['arrowrightwhite'] = 0x21E8;
  14483. t['arrowtableft'] = 0x21E4;
  14484. t['arrowtabright'] = 0x21E5;
  14485. t['arrowup'] = 0x2191;
  14486. t['arrowupdn'] = 0x2195;
  14487. t['arrowupdnbse'] = 0x21A8;
  14488. t['arrowupdownbase'] = 0x21A8;
  14489. t['arrowupleft'] = 0x2196;
  14490. t['arrowupleftofdown'] = 0x21C5;
  14491. t['arrowupright'] = 0x2197;
  14492. t['arrowupwhite'] = 0x21E7;
  14493. t['arrowvertex'] = 0xF8E6;
  14494. t['asciicircum'] = 0x005E;
  14495. t['asciicircummonospace'] = 0xFF3E;
  14496. t['asciitilde'] = 0x007E;
  14497. t['asciitildemonospace'] = 0xFF5E;
  14498. t['ascript'] = 0x0251;
  14499. t['ascriptturned'] = 0x0252;
  14500. t['asmallhiragana'] = 0x3041;
  14501. t['asmallkatakana'] = 0x30A1;
  14502. t['asmallkatakanahalfwidth'] = 0xFF67;
  14503. t['asterisk'] = 0x002A;
  14504. t['asteriskaltonearabic'] = 0x066D;
  14505. t['asteriskarabic'] = 0x066D;
  14506. t['asteriskmath'] = 0x2217;
  14507. t['asteriskmonospace'] = 0xFF0A;
  14508. t['asterisksmall'] = 0xFE61;
  14509. t['asterism'] = 0x2042;
  14510. t['asuperior'] = 0xF6E9;
  14511. t['asymptoticallyequal'] = 0x2243;
  14512. t['at'] = 0x0040;
  14513. t['atilde'] = 0x00E3;
  14514. t['atmonospace'] = 0xFF20;
  14515. t['atsmall'] = 0xFE6B;
  14516. t['aturned'] = 0x0250;
  14517. t['aubengali'] = 0x0994;
  14518. t['aubopomofo'] = 0x3120;
  14519. t['audeva'] = 0x0914;
  14520. t['augujarati'] = 0x0A94;
  14521. t['augurmukhi'] = 0x0A14;
  14522. t['aulengthmarkbengali'] = 0x09D7;
  14523. t['aumatragurmukhi'] = 0x0A4C;
  14524. t['auvowelsignbengali'] = 0x09CC;
  14525. t['auvowelsigndeva'] = 0x094C;
  14526. t['auvowelsigngujarati'] = 0x0ACC;
  14527. t['avagrahadeva'] = 0x093D;
  14528. t['aybarmenian'] = 0x0561;
  14529. t['ayin'] = 0x05E2;
  14530. t['ayinaltonehebrew'] = 0xFB20;
  14531. t['ayinhebrew'] = 0x05E2;
  14532. t['b'] = 0x0062;
  14533. t['babengali'] = 0x09AC;
  14534. t['backslash'] = 0x005C;
  14535. t['backslashmonospace'] = 0xFF3C;
  14536. t['badeva'] = 0x092C;
  14537. t['bagujarati'] = 0x0AAC;
  14538. t['bagurmukhi'] = 0x0A2C;
  14539. t['bahiragana'] = 0x3070;
  14540. t['bahtthai'] = 0x0E3F;
  14541. t['bakatakana'] = 0x30D0;
  14542. t['bar'] = 0x007C;
  14543. t['barmonospace'] = 0xFF5C;
  14544. t['bbopomofo'] = 0x3105;
  14545. t['bcircle'] = 0x24D1;
  14546. t['bdotaccent'] = 0x1E03;
  14547. t['bdotbelow'] = 0x1E05;
  14548. t['beamedsixteenthnotes'] = 0x266C;
  14549. t['because'] = 0x2235;
  14550. t['becyrillic'] = 0x0431;
  14551. t['beharabic'] = 0x0628;
  14552. t['behfinalarabic'] = 0xFE90;
  14553. t['behinitialarabic'] = 0xFE91;
  14554. t['behiragana'] = 0x3079;
  14555. t['behmedialarabic'] = 0xFE92;
  14556. t['behmeeminitialarabic'] = 0xFC9F;
  14557. t['behmeemisolatedarabic'] = 0xFC08;
  14558. t['behnoonfinalarabic'] = 0xFC6D;
  14559. t['bekatakana'] = 0x30D9;
  14560. t['benarmenian'] = 0x0562;
  14561. t['bet'] = 0x05D1;
  14562. t['beta'] = 0x03B2;
  14563. t['betasymbolgreek'] = 0x03D0;
  14564. t['betdagesh'] = 0xFB31;
  14565. t['betdageshhebrew'] = 0xFB31;
  14566. t['bethebrew'] = 0x05D1;
  14567. t['betrafehebrew'] = 0xFB4C;
  14568. t['bhabengali'] = 0x09AD;
  14569. t['bhadeva'] = 0x092D;
  14570. t['bhagujarati'] = 0x0AAD;
  14571. t['bhagurmukhi'] = 0x0A2D;
  14572. t['bhook'] = 0x0253;
  14573. t['bihiragana'] = 0x3073;
  14574. t['bikatakana'] = 0x30D3;
  14575. t['bilabialclick'] = 0x0298;
  14576. t['bindigurmukhi'] = 0x0A02;
  14577. t['birusquare'] = 0x3331;
  14578. t['blackcircle'] = 0x25CF;
  14579. t['blackdiamond'] = 0x25C6;
  14580. t['blackdownpointingtriangle'] = 0x25BC;
  14581. t['blackleftpointingpointer'] = 0x25C4;
  14582. t['blackleftpointingtriangle'] = 0x25C0;
  14583. t['blacklenticularbracketleft'] = 0x3010;
  14584. t['blacklenticularbracketleftvertical'] = 0xFE3B;
  14585. t['blacklenticularbracketright'] = 0x3011;
  14586. t['blacklenticularbracketrightvertical'] = 0xFE3C;
  14587. t['blacklowerlefttriangle'] = 0x25E3;
  14588. t['blacklowerrighttriangle'] = 0x25E2;
  14589. t['blackrectangle'] = 0x25AC;
  14590. t['blackrightpointingpointer'] = 0x25BA;
  14591. t['blackrightpointingtriangle'] = 0x25B6;
  14592. t['blacksmallsquare'] = 0x25AA;
  14593. t['blacksmilingface'] = 0x263B;
  14594. t['blacksquare'] = 0x25A0;
  14595. t['blackstar'] = 0x2605;
  14596. t['blackupperlefttriangle'] = 0x25E4;
  14597. t['blackupperrighttriangle'] = 0x25E5;
  14598. t['blackuppointingsmalltriangle'] = 0x25B4;
  14599. t['blackuppointingtriangle'] = 0x25B2;
  14600. t['blank'] = 0x2423;
  14601. t['blinebelow'] = 0x1E07;
  14602. t['block'] = 0x2588;
  14603. t['bmonospace'] = 0xFF42;
  14604. t['bobaimaithai'] = 0x0E1A;
  14605. t['bohiragana'] = 0x307C;
  14606. t['bokatakana'] = 0x30DC;
  14607. t['bparen'] = 0x249D;
  14608. t['bqsquare'] = 0x33C3;
  14609. t['braceex'] = 0xF8F4;
  14610. t['braceleft'] = 0x007B;
  14611. t['braceleftbt'] = 0xF8F3;
  14612. t['braceleftmid'] = 0xF8F2;
  14613. t['braceleftmonospace'] = 0xFF5B;
  14614. t['braceleftsmall'] = 0xFE5B;
  14615. t['bracelefttp'] = 0xF8F1;
  14616. t['braceleftvertical'] = 0xFE37;
  14617. t['braceright'] = 0x007D;
  14618. t['bracerightbt'] = 0xF8FE;
  14619. t['bracerightmid'] = 0xF8FD;
  14620. t['bracerightmonospace'] = 0xFF5D;
  14621. t['bracerightsmall'] = 0xFE5C;
  14622. t['bracerighttp'] = 0xF8FC;
  14623. t['bracerightvertical'] = 0xFE38;
  14624. t['bracketleft'] = 0x005B;
  14625. t['bracketleftbt'] = 0xF8F0;
  14626. t['bracketleftex'] = 0xF8EF;
  14627. t['bracketleftmonospace'] = 0xFF3B;
  14628. t['bracketlefttp'] = 0xF8EE;
  14629. t['bracketright'] = 0x005D;
  14630. t['bracketrightbt'] = 0xF8FB;
  14631. t['bracketrightex'] = 0xF8FA;
  14632. t['bracketrightmonospace'] = 0xFF3D;
  14633. t['bracketrighttp'] = 0xF8F9;
  14634. t['breve'] = 0x02D8;
  14635. t['brevebelowcmb'] = 0x032E;
  14636. t['brevecmb'] = 0x0306;
  14637. t['breveinvertedbelowcmb'] = 0x032F;
  14638. t['breveinvertedcmb'] = 0x0311;
  14639. t['breveinverteddoublecmb'] = 0x0361;
  14640. t['bridgebelowcmb'] = 0x032A;
  14641. t['bridgeinvertedbelowcmb'] = 0x033A;
  14642. t['brokenbar'] = 0x00A6;
  14643. t['bstroke'] = 0x0180;
  14644. t['bsuperior'] = 0xF6EA;
  14645. t['btopbar'] = 0x0183;
  14646. t['buhiragana'] = 0x3076;
  14647. t['bukatakana'] = 0x30D6;
  14648. t['bullet'] = 0x2022;
  14649. t['bulletinverse'] = 0x25D8;
  14650. t['bulletoperator'] = 0x2219;
  14651. t['bullseye'] = 0x25CE;
  14652. t['c'] = 0x0063;
  14653. t['caarmenian'] = 0x056E;
  14654. t['cabengali'] = 0x099A;
  14655. t['cacute'] = 0x0107;
  14656. t['cadeva'] = 0x091A;
  14657. t['cagujarati'] = 0x0A9A;
  14658. t['cagurmukhi'] = 0x0A1A;
  14659. t['calsquare'] = 0x3388;
  14660. t['candrabindubengali'] = 0x0981;
  14661. t['candrabinducmb'] = 0x0310;
  14662. t['candrabindudeva'] = 0x0901;
  14663. t['candrabindugujarati'] = 0x0A81;
  14664. t['capslock'] = 0x21EA;
  14665. t['careof'] = 0x2105;
  14666. t['caron'] = 0x02C7;
  14667. t['caronbelowcmb'] = 0x032C;
  14668. t['caroncmb'] = 0x030C;
  14669. t['carriagereturn'] = 0x21B5;
  14670. t['cbopomofo'] = 0x3118;
  14671. t['ccaron'] = 0x010D;
  14672. t['ccedilla'] = 0x00E7;
  14673. t['ccedillaacute'] = 0x1E09;
  14674. t['ccircle'] = 0x24D2;
  14675. t['ccircumflex'] = 0x0109;
  14676. t['ccurl'] = 0x0255;
  14677. t['cdot'] = 0x010B;
  14678. t['cdotaccent'] = 0x010B;
  14679. t['cdsquare'] = 0x33C5;
  14680. t['cedilla'] = 0x00B8;
  14681. t['cedillacmb'] = 0x0327;
  14682. t['cent'] = 0x00A2;
  14683. t['centigrade'] = 0x2103;
  14684. t['centinferior'] = 0xF6DF;
  14685. t['centmonospace'] = 0xFFE0;
  14686. t['centoldstyle'] = 0xF7A2;
  14687. t['centsuperior'] = 0xF6E0;
  14688. t['chaarmenian'] = 0x0579;
  14689. t['chabengali'] = 0x099B;
  14690. t['chadeva'] = 0x091B;
  14691. t['chagujarati'] = 0x0A9B;
  14692. t['chagurmukhi'] = 0x0A1B;
  14693. t['chbopomofo'] = 0x3114;
  14694. t['cheabkhasiancyrillic'] = 0x04BD;
  14695. t['checkmark'] = 0x2713;
  14696. t['checyrillic'] = 0x0447;
  14697. t['chedescenderabkhasiancyrillic'] = 0x04BF;
  14698. t['chedescendercyrillic'] = 0x04B7;
  14699. t['chedieresiscyrillic'] = 0x04F5;
  14700. t['cheharmenian'] = 0x0573;
  14701. t['chekhakassiancyrillic'] = 0x04CC;
  14702. t['cheverticalstrokecyrillic'] = 0x04B9;
  14703. t['chi'] = 0x03C7;
  14704. t['chieuchacirclekorean'] = 0x3277;
  14705. t['chieuchaparenkorean'] = 0x3217;
  14706. t['chieuchcirclekorean'] = 0x3269;
  14707. t['chieuchkorean'] = 0x314A;
  14708. t['chieuchparenkorean'] = 0x3209;
  14709. t['chochangthai'] = 0x0E0A;
  14710. t['chochanthai'] = 0x0E08;
  14711. t['chochingthai'] = 0x0E09;
  14712. t['chochoethai'] = 0x0E0C;
  14713. t['chook'] = 0x0188;
  14714. t['cieucacirclekorean'] = 0x3276;
  14715. t['cieucaparenkorean'] = 0x3216;
  14716. t['cieuccirclekorean'] = 0x3268;
  14717. t['cieuckorean'] = 0x3148;
  14718. t['cieucparenkorean'] = 0x3208;
  14719. t['cieucuparenkorean'] = 0x321C;
  14720. t['circle'] = 0x25CB;
  14721. t['circlecopyrt'] = 0x00A9;
  14722. t['circlemultiply'] = 0x2297;
  14723. t['circleot'] = 0x2299;
  14724. t['circleplus'] = 0x2295;
  14725. t['circlepostalmark'] = 0x3036;
  14726. t['circlewithlefthalfblack'] = 0x25D0;
  14727. t['circlewithrighthalfblack'] = 0x25D1;
  14728. t['circumflex'] = 0x02C6;
  14729. t['circumflexbelowcmb'] = 0x032D;
  14730. t['circumflexcmb'] = 0x0302;
  14731. t['clear'] = 0x2327;
  14732. t['clickalveolar'] = 0x01C2;
  14733. t['clickdental'] = 0x01C0;
  14734. t['clicklateral'] = 0x01C1;
  14735. t['clickretroflex'] = 0x01C3;
  14736. t['club'] = 0x2663;
  14737. t['clubsuitblack'] = 0x2663;
  14738. t['clubsuitwhite'] = 0x2667;
  14739. t['cmcubedsquare'] = 0x33A4;
  14740. t['cmonospace'] = 0xFF43;
  14741. t['cmsquaredsquare'] = 0x33A0;
  14742. t['coarmenian'] = 0x0581;
  14743. t['colon'] = 0x003A;
  14744. t['colonmonetary'] = 0x20A1;
  14745. t['colonmonospace'] = 0xFF1A;
  14746. t['colonsign'] = 0x20A1;
  14747. t['colonsmall'] = 0xFE55;
  14748. t['colontriangularhalfmod'] = 0x02D1;
  14749. t['colontriangularmod'] = 0x02D0;
  14750. t['comma'] = 0x002C;
  14751. t['commaabovecmb'] = 0x0313;
  14752. t['commaaboverightcmb'] = 0x0315;
  14753. t['commaaccent'] = 0xF6C3;
  14754. t['commaarabic'] = 0x060C;
  14755. t['commaarmenian'] = 0x055D;
  14756. t['commainferior'] = 0xF6E1;
  14757. t['commamonospace'] = 0xFF0C;
  14758. t['commareversedabovecmb'] = 0x0314;
  14759. t['commareversedmod'] = 0x02BD;
  14760. t['commasmall'] = 0xFE50;
  14761. t['commasuperior'] = 0xF6E2;
  14762. t['commaturnedabovecmb'] = 0x0312;
  14763. t['commaturnedmod'] = 0x02BB;
  14764. t['compass'] = 0x263C;
  14765. t['congruent'] = 0x2245;
  14766. t['contourintegral'] = 0x222E;
  14767. t['control'] = 0x2303;
  14768. t['controlACK'] = 0x0006;
  14769. t['controlBEL'] = 0x0007;
  14770. t['controlBS'] = 0x0008;
  14771. t['controlCAN'] = 0x0018;
  14772. t['controlCR'] = 0x000D;
  14773. t['controlDC1'] = 0x0011;
  14774. t['controlDC2'] = 0x0012;
  14775. t['controlDC3'] = 0x0013;
  14776. t['controlDC4'] = 0x0014;
  14777. t['controlDEL'] = 0x007F;
  14778. t['controlDLE'] = 0x0010;
  14779. t['controlEM'] = 0x0019;
  14780. t['controlENQ'] = 0x0005;
  14781. t['controlEOT'] = 0x0004;
  14782. t['controlESC'] = 0x001B;
  14783. t['controlETB'] = 0x0017;
  14784. t['controlETX'] = 0x0003;
  14785. t['controlFF'] = 0x000C;
  14786. t['controlFS'] = 0x001C;
  14787. t['controlGS'] = 0x001D;
  14788. t['controlHT'] = 0x0009;
  14789. t['controlLF'] = 0x000A;
  14790. t['controlNAK'] = 0x0015;
  14791. t['controlNULL'] = 0x0000;
  14792. t['controlRS'] = 0x001E;
  14793. t['controlSI'] = 0x000F;
  14794. t['controlSO'] = 0x000E;
  14795. t['controlSOT'] = 0x0002;
  14796. t['controlSTX'] = 0x0001;
  14797. t['controlSUB'] = 0x001A;
  14798. t['controlSYN'] = 0x0016;
  14799. t['controlUS'] = 0x001F;
  14800. t['controlVT'] = 0x000B;
  14801. t['copyright'] = 0x00A9;
  14802. t['copyrightsans'] = 0xF8E9;
  14803. t['copyrightserif'] = 0xF6D9;
  14804. t['cornerbracketleft'] = 0x300C;
  14805. t['cornerbracketlefthalfwidth'] = 0xFF62;
  14806. t['cornerbracketleftvertical'] = 0xFE41;
  14807. t['cornerbracketright'] = 0x300D;
  14808. t['cornerbracketrighthalfwidth'] = 0xFF63;
  14809. t['cornerbracketrightvertical'] = 0xFE42;
  14810. t['corporationsquare'] = 0x337F;
  14811. t['cosquare'] = 0x33C7;
  14812. t['coverkgsquare'] = 0x33C6;
  14813. t['cparen'] = 0x249E;
  14814. t['cruzeiro'] = 0x20A2;
  14815. t['cstretched'] = 0x0297;
  14816. t['curlyand'] = 0x22CF;
  14817. t['curlyor'] = 0x22CE;
  14818. t['currency'] = 0x00A4;
  14819. t['cyrBreve'] = 0xF6D1;
  14820. t['cyrFlex'] = 0xF6D2;
  14821. t['cyrbreve'] = 0xF6D4;
  14822. t['cyrflex'] = 0xF6D5;
  14823. t['d'] = 0x0064;
  14824. t['daarmenian'] = 0x0564;
  14825. t['dabengali'] = 0x09A6;
  14826. t['dadarabic'] = 0x0636;
  14827. t['dadeva'] = 0x0926;
  14828. t['dadfinalarabic'] = 0xFEBE;
  14829. t['dadinitialarabic'] = 0xFEBF;
  14830. t['dadmedialarabic'] = 0xFEC0;
  14831. t['dagesh'] = 0x05BC;
  14832. t['dageshhebrew'] = 0x05BC;
  14833. t['dagger'] = 0x2020;
  14834. t['daggerdbl'] = 0x2021;
  14835. t['dagujarati'] = 0x0AA6;
  14836. t['dagurmukhi'] = 0x0A26;
  14837. t['dahiragana'] = 0x3060;
  14838. t['dakatakana'] = 0x30C0;
  14839. t['dalarabic'] = 0x062F;
  14840. t['dalet'] = 0x05D3;
  14841. t['daletdagesh'] = 0xFB33;
  14842. t['daletdageshhebrew'] = 0xFB33;
  14843. t['dalethebrew'] = 0x05D3;
  14844. t['dalfinalarabic'] = 0xFEAA;
  14845. t['dammaarabic'] = 0x064F;
  14846. t['dammalowarabic'] = 0x064F;
  14847. t['dammatanaltonearabic'] = 0x064C;
  14848. t['dammatanarabic'] = 0x064C;
  14849. t['danda'] = 0x0964;
  14850. t['dargahebrew'] = 0x05A7;
  14851. t['dargalefthebrew'] = 0x05A7;
  14852. t['dasiapneumatacyrilliccmb'] = 0x0485;
  14853. t['dblGrave'] = 0xF6D3;
  14854. t['dblanglebracketleft'] = 0x300A;
  14855. t['dblanglebracketleftvertical'] = 0xFE3D;
  14856. t['dblanglebracketright'] = 0x300B;
  14857. t['dblanglebracketrightvertical'] = 0xFE3E;
  14858. t['dblarchinvertedbelowcmb'] = 0x032B;
  14859. t['dblarrowleft'] = 0x21D4;
  14860. t['dblarrowright'] = 0x21D2;
  14861. t['dbldanda'] = 0x0965;
  14862. t['dblgrave'] = 0xF6D6;
  14863. t['dblgravecmb'] = 0x030F;
  14864. t['dblintegral'] = 0x222C;
  14865. t['dbllowline'] = 0x2017;
  14866. t['dbllowlinecmb'] = 0x0333;
  14867. t['dbloverlinecmb'] = 0x033F;
  14868. t['dblprimemod'] = 0x02BA;
  14869. t['dblverticalbar'] = 0x2016;
  14870. t['dblverticallineabovecmb'] = 0x030E;
  14871. t['dbopomofo'] = 0x3109;
  14872. t['dbsquare'] = 0x33C8;
  14873. t['dcaron'] = 0x010F;
  14874. t['dcedilla'] = 0x1E11;
  14875. t['dcircle'] = 0x24D3;
  14876. t['dcircumflexbelow'] = 0x1E13;
  14877. t['dcroat'] = 0x0111;
  14878. t['ddabengali'] = 0x09A1;
  14879. t['ddadeva'] = 0x0921;
  14880. t['ddagujarati'] = 0x0AA1;
  14881. t['ddagurmukhi'] = 0x0A21;
  14882. t['ddalarabic'] = 0x0688;
  14883. t['ddalfinalarabic'] = 0xFB89;
  14884. t['dddhadeva'] = 0x095C;
  14885. t['ddhabengali'] = 0x09A2;
  14886. t['ddhadeva'] = 0x0922;
  14887. t['ddhagujarati'] = 0x0AA2;
  14888. t['ddhagurmukhi'] = 0x0A22;
  14889. t['ddotaccent'] = 0x1E0B;
  14890. t['ddotbelow'] = 0x1E0D;
  14891. t['decimalseparatorarabic'] = 0x066B;
  14892. t['decimalseparatorpersian'] = 0x066B;
  14893. t['decyrillic'] = 0x0434;
  14894. t['degree'] = 0x00B0;
  14895. t['dehihebrew'] = 0x05AD;
  14896. t['dehiragana'] = 0x3067;
  14897. t['deicoptic'] = 0x03EF;
  14898. t['dekatakana'] = 0x30C7;
  14899. t['deleteleft'] = 0x232B;
  14900. t['deleteright'] = 0x2326;
  14901. t['delta'] = 0x03B4;
  14902. t['deltaturned'] = 0x018D;
  14903. t['denominatorminusonenumeratorbengali'] = 0x09F8;
  14904. t['dezh'] = 0x02A4;
  14905. t['dhabengali'] = 0x09A7;
  14906. t['dhadeva'] = 0x0927;
  14907. t['dhagujarati'] = 0x0AA7;
  14908. t['dhagurmukhi'] = 0x0A27;
  14909. t['dhook'] = 0x0257;
  14910. t['dialytikatonos'] = 0x0385;
  14911. t['dialytikatonoscmb'] = 0x0344;
  14912. t['diamond'] = 0x2666;
  14913. t['diamondsuitwhite'] = 0x2662;
  14914. t['dieresis'] = 0x00A8;
  14915. t['dieresisacute'] = 0xF6D7;
  14916. t['dieresisbelowcmb'] = 0x0324;
  14917. t['dieresiscmb'] = 0x0308;
  14918. t['dieresisgrave'] = 0xF6D8;
  14919. t['dieresistonos'] = 0x0385;
  14920. t['dihiragana'] = 0x3062;
  14921. t['dikatakana'] = 0x30C2;
  14922. t['dittomark'] = 0x3003;
  14923. t['divide'] = 0x00F7;
  14924. t['divides'] = 0x2223;
  14925. t['divisionslash'] = 0x2215;
  14926. t['djecyrillic'] = 0x0452;
  14927. t['dkshade'] = 0x2593;
  14928. t['dlinebelow'] = 0x1E0F;
  14929. t['dlsquare'] = 0x3397;
  14930. t['dmacron'] = 0x0111;
  14931. t['dmonospace'] = 0xFF44;
  14932. t['dnblock'] = 0x2584;
  14933. t['dochadathai'] = 0x0E0E;
  14934. t['dodekthai'] = 0x0E14;
  14935. t['dohiragana'] = 0x3069;
  14936. t['dokatakana'] = 0x30C9;
  14937. t['dollar'] = 0x0024;
  14938. t['dollarinferior'] = 0xF6E3;
  14939. t['dollarmonospace'] = 0xFF04;
  14940. t['dollaroldstyle'] = 0xF724;
  14941. t['dollarsmall'] = 0xFE69;
  14942. t['dollarsuperior'] = 0xF6E4;
  14943. t['dong'] = 0x20AB;
  14944. t['dorusquare'] = 0x3326;
  14945. t['dotaccent'] = 0x02D9;
  14946. t['dotaccentcmb'] = 0x0307;
  14947. t['dotbelowcmb'] = 0x0323;
  14948. t['dotbelowcomb'] = 0x0323;
  14949. t['dotkatakana'] = 0x30FB;
  14950. t['dotlessi'] = 0x0131;
  14951. t['dotlessj'] = 0xF6BE;
  14952. t['dotlessjstrokehook'] = 0x0284;
  14953. t['dotmath'] = 0x22C5;
  14954. t['dottedcircle'] = 0x25CC;
  14955. t['doubleyodpatah'] = 0xFB1F;
  14956. t['doubleyodpatahhebrew'] = 0xFB1F;
  14957. t['downtackbelowcmb'] = 0x031E;
  14958. t['downtackmod'] = 0x02D5;
  14959. t['dparen'] = 0x249F;
  14960. t['dsuperior'] = 0xF6EB;
  14961. t['dtail'] = 0x0256;
  14962. t['dtopbar'] = 0x018C;
  14963. t['duhiragana'] = 0x3065;
  14964. t['dukatakana'] = 0x30C5;
  14965. t['dz'] = 0x01F3;
  14966. t['dzaltone'] = 0x02A3;
  14967. t['dzcaron'] = 0x01C6;
  14968. t['dzcurl'] = 0x02A5;
  14969. t['dzeabkhasiancyrillic'] = 0x04E1;
  14970. t['dzecyrillic'] = 0x0455;
  14971. t['dzhecyrillic'] = 0x045F;
  14972. t['e'] = 0x0065;
  14973. t['eacute'] = 0x00E9;
  14974. t['earth'] = 0x2641;
  14975. t['ebengali'] = 0x098F;
  14976. t['ebopomofo'] = 0x311C;
  14977. t['ebreve'] = 0x0115;
  14978. t['ecandradeva'] = 0x090D;
  14979. t['ecandragujarati'] = 0x0A8D;
  14980. t['ecandravowelsigndeva'] = 0x0945;
  14981. t['ecandravowelsigngujarati'] = 0x0AC5;
  14982. t['ecaron'] = 0x011B;
  14983. t['ecedillabreve'] = 0x1E1D;
  14984. t['echarmenian'] = 0x0565;
  14985. t['echyiwnarmenian'] = 0x0587;
  14986. t['ecircle'] = 0x24D4;
  14987. t['ecircumflex'] = 0x00EA;
  14988. t['ecircumflexacute'] = 0x1EBF;
  14989. t['ecircumflexbelow'] = 0x1E19;
  14990. t['ecircumflexdotbelow'] = 0x1EC7;
  14991. t['ecircumflexgrave'] = 0x1EC1;
  14992. t['ecircumflexhookabove'] = 0x1EC3;
  14993. t['ecircumflextilde'] = 0x1EC5;
  14994. t['ecyrillic'] = 0x0454;
  14995. t['edblgrave'] = 0x0205;
  14996. t['edeva'] = 0x090F;
  14997. t['edieresis'] = 0x00EB;
  14998. t['edot'] = 0x0117;
  14999. t['edotaccent'] = 0x0117;
  15000. t['edotbelow'] = 0x1EB9;
  15001. t['eegurmukhi'] = 0x0A0F;
  15002. t['eematragurmukhi'] = 0x0A47;
  15003. t['efcyrillic'] = 0x0444;
  15004. t['egrave'] = 0x00E8;
  15005. t['egujarati'] = 0x0A8F;
  15006. t['eharmenian'] = 0x0567;
  15007. t['ehbopomofo'] = 0x311D;
  15008. t['ehiragana'] = 0x3048;
  15009. t['ehookabove'] = 0x1EBB;
  15010. t['eibopomofo'] = 0x311F;
  15011. t['eight'] = 0x0038;
  15012. t['eightarabic'] = 0x0668;
  15013. t['eightbengali'] = 0x09EE;
  15014. t['eightcircle'] = 0x2467;
  15015. t['eightcircleinversesansserif'] = 0x2791;
  15016. t['eightdeva'] = 0x096E;
  15017. t['eighteencircle'] = 0x2471;
  15018. t['eighteenparen'] = 0x2485;
  15019. t['eighteenperiod'] = 0x2499;
  15020. t['eightgujarati'] = 0x0AEE;
  15021. t['eightgurmukhi'] = 0x0A6E;
  15022. t['eighthackarabic'] = 0x0668;
  15023. t['eighthangzhou'] = 0x3028;
  15024. t['eighthnotebeamed'] = 0x266B;
  15025. t['eightideographicparen'] = 0x3227;
  15026. t['eightinferior'] = 0x2088;
  15027. t['eightmonospace'] = 0xFF18;
  15028. t['eightoldstyle'] = 0xF738;
  15029. t['eightparen'] = 0x247B;
  15030. t['eightperiod'] = 0x248F;
  15031. t['eightpersian'] = 0x06F8;
  15032. t['eightroman'] = 0x2177;
  15033. t['eightsuperior'] = 0x2078;
  15034. t['eightthai'] = 0x0E58;
  15035. t['einvertedbreve'] = 0x0207;
  15036. t['eiotifiedcyrillic'] = 0x0465;
  15037. t['ekatakana'] = 0x30A8;
  15038. t['ekatakanahalfwidth'] = 0xFF74;
  15039. t['ekonkargurmukhi'] = 0x0A74;
  15040. t['ekorean'] = 0x3154;
  15041. t['elcyrillic'] = 0x043B;
  15042. t['element'] = 0x2208;
  15043. t['elevencircle'] = 0x246A;
  15044. t['elevenparen'] = 0x247E;
  15045. t['elevenperiod'] = 0x2492;
  15046. t['elevenroman'] = 0x217A;
  15047. t['ellipsis'] = 0x2026;
  15048. t['ellipsisvertical'] = 0x22EE;
  15049. t['emacron'] = 0x0113;
  15050. t['emacronacute'] = 0x1E17;
  15051. t['emacrongrave'] = 0x1E15;
  15052. t['emcyrillic'] = 0x043C;
  15053. t['emdash'] = 0x2014;
  15054. t['emdashvertical'] = 0xFE31;
  15055. t['emonospace'] = 0xFF45;
  15056. t['emphasismarkarmenian'] = 0x055B;
  15057. t['emptyset'] = 0x2205;
  15058. t['enbopomofo'] = 0x3123;
  15059. t['encyrillic'] = 0x043D;
  15060. t['endash'] = 0x2013;
  15061. t['endashvertical'] = 0xFE32;
  15062. t['endescendercyrillic'] = 0x04A3;
  15063. t['eng'] = 0x014B;
  15064. t['engbopomofo'] = 0x3125;
  15065. t['enghecyrillic'] = 0x04A5;
  15066. t['enhookcyrillic'] = 0x04C8;
  15067. t['enspace'] = 0x2002;
  15068. t['eogonek'] = 0x0119;
  15069. t['eokorean'] = 0x3153;
  15070. t['eopen'] = 0x025B;
  15071. t['eopenclosed'] = 0x029A;
  15072. t['eopenreversed'] = 0x025C;
  15073. t['eopenreversedclosed'] = 0x025E;
  15074. t['eopenreversedhook'] = 0x025D;
  15075. t['eparen'] = 0x24A0;
  15076. t['epsilon'] = 0x03B5;
  15077. t['epsilontonos'] = 0x03AD;
  15078. t['equal'] = 0x003D;
  15079. t['equalmonospace'] = 0xFF1D;
  15080. t['equalsmall'] = 0xFE66;
  15081. t['equalsuperior'] = 0x207C;
  15082. t['equivalence'] = 0x2261;
  15083. t['erbopomofo'] = 0x3126;
  15084. t['ercyrillic'] = 0x0440;
  15085. t['ereversed'] = 0x0258;
  15086. t['ereversedcyrillic'] = 0x044D;
  15087. t['escyrillic'] = 0x0441;
  15088. t['esdescendercyrillic'] = 0x04AB;
  15089. t['esh'] = 0x0283;
  15090. t['eshcurl'] = 0x0286;
  15091. t['eshortdeva'] = 0x090E;
  15092. t['eshortvowelsigndeva'] = 0x0946;
  15093. t['eshreversedloop'] = 0x01AA;
  15094. t['eshsquatreversed'] = 0x0285;
  15095. t['esmallhiragana'] = 0x3047;
  15096. t['esmallkatakana'] = 0x30A7;
  15097. t['esmallkatakanahalfwidth'] = 0xFF6A;
  15098. t['estimated'] = 0x212E;
  15099. t['esuperior'] = 0xF6EC;
  15100. t['eta'] = 0x03B7;
  15101. t['etarmenian'] = 0x0568;
  15102. t['etatonos'] = 0x03AE;
  15103. t['eth'] = 0x00F0;
  15104. t['etilde'] = 0x1EBD;
  15105. t['etildebelow'] = 0x1E1B;
  15106. t['etnahtafoukhhebrew'] = 0x0591;
  15107. t['etnahtafoukhlefthebrew'] = 0x0591;
  15108. t['etnahtahebrew'] = 0x0591;
  15109. t['etnahtalefthebrew'] = 0x0591;
  15110. t['eturned'] = 0x01DD;
  15111. t['eukorean'] = 0x3161;
  15112. t['euro'] = 0x20AC;
  15113. t['evowelsignbengali'] = 0x09C7;
  15114. t['evowelsigndeva'] = 0x0947;
  15115. t['evowelsigngujarati'] = 0x0AC7;
  15116. t['exclam'] = 0x0021;
  15117. t['exclamarmenian'] = 0x055C;
  15118. t['exclamdbl'] = 0x203C;
  15119. t['exclamdown'] = 0x00A1;
  15120. t['exclamdownsmall'] = 0xF7A1;
  15121. t['exclammonospace'] = 0xFF01;
  15122. t['exclamsmall'] = 0xF721;
  15123. t['existential'] = 0x2203;
  15124. t['ezh'] = 0x0292;
  15125. t['ezhcaron'] = 0x01EF;
  15126. t['ezhcurl'] = 0x0293;
  15127. t['ezhreversed'] = 0x01B9;
  15128. t['ezhtail'] = 0x01BA;
  15129. t['f'] = 0x0066;
  15130. t['fadeva'] = 0x095E;
  15131. t['fagurmukhi'] = 0x0A5E;
  15132. t['fahrenheit'] = 0x2109;
  15133. t['fathaarabic'] = 0x064E;
  15134. t['fathalowarabic'] = 0x064E;
  15135. t['fathatanarabic'] = 0x064B;
  15136. t['fbopomofo'] = 0x3108;
  15137. t['fcircle'] = 0x24D5;
  15138. t['fdotaccent'] = 0x1E1F;
  15139. t['feharabic'] = 0x0641;
  15140. t['feharmenian'] = 0x0586;
  15141. t['fehfinalarabic'] = 0xFED2;
  15142. t['fehinitialarabic'] = 0xFED3;
  15143. t['fehmedialarabic'] = 0xFED4;
  15144. t['feicoptic'] = 0x03E5;
  15145. t['female'] = 0x2640;
  15146. t['ff'] = 0xFB00;
  15147. t['ffi'] = 0xFB03;
  15148. t['ffl'] = 0xFB04;
  15149. t['fi'] = 0xFB01;
  15150. t['fifteencircle'] = 0x246E;
  15151. t['fifteenparen'] = 0x2482;
  15152. t['fifteenperiod'] = 0x2496;
  15153. t['figuredash'] = 0x2012;
  15154. t['filledbox'] = 0x25A0;
  15155. t['filledrect'] = 0x25AC;
  15156. t['finalkaf'] = 0x05DA;
  15157. t['finalkafdagesh'] = 0xFB3A;
  15158. t['finalkafdageshhebrew'] = 0xFB3A;
  15159. t['finalkafhebrew'] = 0x05DA;
  15160. t['finalmem'] = 0x05DD;
  15161. t['finalmemhebrew'] = 0x05DD;
  15162. t['finalnun'] = 0x05DF;
  15163. t['finalnunhebrew'] = 0x05DF;
  15164. t['finalpe'] = 0x05E3;
  15165. t['finalpehebrew'] = 0x05E3;
  15166. t['finaltsadi'] = 0x05E5;
  15167. t['finaltsadihebrew'] = 0x05E5;
  15168. t['firsttonechinese'] = 0x02C9;
  15169. t['fisheye'] = 0x25C9;
  15170. t['fitacyrillic'] = 0x0473;
  15171. t['five'] = 0x0035;
  15172. t['fivearabic'] = 0x0665;
  15173. t['fivebengali'] = 0x09EB;
  15174. t['fivecircle'] = 0x2464;
  15175. t['fivecircleinversesansserif'] = 0x278E;
  15176. t['fivedeva'] = 0x096B;
  15177. t['fiveeighths'] = 0x215D;
  15178. t['fivegujarati'] = 0x0AEB;
  15179. t['fivegurmukhi'] = 0x0A6B;
  15180. t['fivehackarabic'] = 0x0665;
  15181. t['fivehangzhou'] = 0x3025;
  15182. t['fiveideographicparen'] = 0x3224;
  15183. t['fiveinferior'] = 0x2085;
  15184. t['fivemonospace'] = 0xFF15;
  15185. t['fiveoldstyle'] = 0xF735;
  15186. t['fiveparen'] = 0x2478;
  15187. t['fiveperiod'] = 0x248C;
  15188. t['fivepersian'] = 0x06F5;
  15189. t['fiveroman'] = 0x2174;
  15190. t['fivesuperior'] = 0x2075;
  15191. t['fivethai'] = 0x0E55;
  15192. t['fl'] = 0xFB02;
  15193. t['florin'] = 0x0192;
  15194. t['fmonospace'] = 0xFF46;
  15195. t['fmsquare'] = 0x3399;
  15196. t['fofanthai'] = 0x0E1F;
  15197. t['fofathai'] = 0x0E1D;
  15198. t['fongmanthai'] = 0x0E4F;
  15199. t['forall'] = 0x2200;
  15200. t['four'] = 0x0034;
  15201. t['fourarabic'] = 0x0664;
  15202. t['fourbengali'] = 0x09EA;
  15203. t['fourcircle'] = 0x2463;
  15204. t['fourcircleinversesansserif'] = 0x278D;
  15205. t['fourdeva'] = 0x096A;
  15206. t['fourgujarati'] = 0x0AEA;
  15207. t['fourgurmukhi'] = 0x0A6A;
  15208. t['fourhackarabic'] = 0x0664;
  15209. t['fourhangzhou'] = 0x3024;
  15210. t['fourideographicparen'] = 0x3223;
  15211. t['fourinferior'] = 0x2084;
  15212. t['fourmonospace'] = 0xFF14;
  15213. t['fournumeratorbengali'] = 0x09F7;
  15214. t['fouroldstyle'] = 0xF734;
  15215. t['fourparen'] = 0x2477;
  15216. t['fourperiod'] = 0x248B;
  15217. t['fourpersian'] = 0x06F4;
  15218. t['fourroman'] = 0x2173;
  15219. t['foursuperior'] = 0x2074;
  15220. t['fourteencircle'] = 0x246D;
  15221. t['fourteenparen'] = 0x2481;
  15222. t['fourteenperiod'] = 0x2495;
  15223. t['fourthai'] = 0x0E54;
  15224. t['fourthtonechinese'] = 0x02CB;
  15225. t['fparen'] = 0x24A1;
  15226. t['fraction'] = 0x2044;
  15227. t['franc'] = 0x20A3;
  15228. t['g'] = 0x0067;
  15229. t['gabengali'] = 0x0997;
  15230. t['gacute'] = 0x01F5;
  15231. t['gadeva'] = 0x0917;
  15232. t['gafarabic'] = 0x06AF;
  15233. t['gaffinalarabic'] = 0xFB93;
  15234. t['gafinitialarabic'] = 0xFB94;
  15235. t['gafmedialarabic'] = 0xFB95;
  15236. t['gagujarati'] = 0x0A97;
  15237. t['gagurmukhi'] = 0x0A17;
  15238. t['gahiragana'] = 0x304C;
  15239. t['gakatakana'] = 0x30AC;
  15240. t['gamma'] = 0x03B3;
  15241. t['gammalatinsmall'] = 0x0263;
  15242. t['gammasuperior'] = 0x02E0;
  15243. t['gangiacoptic'] = 0x03EB;
  15244. t['gbopomofo'] = 0x310D;
  15245. t['gbreve'] = 0x011F;
  15246. t['gcaron'] = 0x01E7;
  15247. t['gcedilla'] = 0x0123;
  15248. t['gcircle'] = 0x24D6;
  15249. t['gcircumflex'] = 0x011D;
  15250. t['gcommaaccent'] = 0x0123;
  15251. t['gdot'] = 0x0121;
  15252. t['gdotaccent'] = 0x0121;
  15253. t['gecyrillic'] = 0x0433;
  15254. t['gehiragana'] = 0x3052;
  15255. t['gekatakana'] = 0x30B2;
  15256. t['geometricallyequal'] = 0x2251;
  15257. t['gereshaccenthebrew'] = 0x059C;
  15258. t['gereshhebrew'] = 0x05F3;
  15259. t['gereshmuqdamhebrew'] = 0x059D;
  15260. t['germandbls'] = 0x00DF;
  15261. t['gershayimaccenthebrew'] = 0x059E;
  15262. t['gershayimhebrew'] = 0x05F4;
  15263. t['getamark'] = 0x3013;
  15264. t['ghabengali'] = 0x0998;
  15265. t['ghadarmenian'] = 0x0572;
  15266. t['ghadeva'] = 0x0918;
  15267. t['ghagujarati'] = 0x0A98;
  15268. t['ghagurmukhi'] = 0x0A18;
  15269. t['ghainarabic'] = 0x063A;
  15270. t['ghainfinalarabic'] = 0xFECE;
  15271. t['ghaininitialarabic'] = 0xFECF;
  15272. t['ghainmedialarabic'] = 0xFED0;
  15273. t['ghemiddlehookcyrillic'] = 0x0495;
  15274. t['ghestrokecyrillic'] = 0x0493;
  15275. t['gheupturncyrillic'] = 0x0491;
  15276. t['ghhadeva'] = 0x095A;
  15277. t['ghhagurmukhi'] = 0x0A5A;
  15278. t['ghook'] = 0x0260;
  15279. t['ghzsquare'] = 0x3393;
  15280. t['gihiragana'] = 0x304E;
  15281. t['gikatakana'] = 0x30AE;
  15282. t['gimarmenian'] = 0x0563;
  15283. t['gimel'] = 0x05D2;
  15284. t['gimeldagesh'] = 0xFB32;
  15285. t['gimeldageshhebrew'] = 0xFB32;
  15286. t['gimelhebrew'] = 0x05D2;
  15287. t['gjecyrillic'] = 0x0453;
  15288. t['glottalinvertedstroke'] = 0x01BE;
  15289. t['glottalstop'] = 0x0294;
  15290. t['glottalstopinverted'] = 0x0296;
  15291. t['glottalstopmod'] = 0x02C0;
  15292. t['glottalstopreversed'] = 0x0295;
  15293. t['glottalstopreversedmod'] = 0x02C1;
  15294. t['glottalstopreversedsuperior'] = 0x02E4;
  15295. t['glottalstopstroke'] = 0x02A1;
  15296. t['glottalstopstrokereversed'] = 0x02A2;
  15297. t['gmacron'] = 0x1E21;
  15298. t['gmonospace'] = 0xFF47;
  15299. t['gohiragana'] = 0x3054;
  15300. t['gokatakana'] = 0x30B4;
  15301. t['gparen'] = 0x24A2;
  15302. t['gpasquare'] = 0x33AC;
  15303. t['gradient'] = 0x2207;
  15304. t['grave'] = 0x0060;
  15305. t['gravebelowcmb'] = 0x0316;
  15306. t['gravecmb'] = 0x0300;
  15307. t['gravecomb'] = 0x0300;
  15308. t['gravedeva'] = 0x0953;
  15309. t['gravelowmod'] = 0x02CE;
  15310. t['gravemonospace'] = 0xFF40;
  15311. t['gravetonecmb'] = 0x0340;
  15312. t['greater'] = 0x003E;
  15313. t['greaterequal'] = 0x2265;
  15314. t['greaterequalorless'] = 0x22DB;
  15315. t['greatermonospace'] = 0xFF1E;
  15316. t['greaterorequivalent'] = 0x2273;
  15317. t['greaterorless'] = 0x2277;
  15318. t['greateroverequal'] = 0x2267;
  15319. t['greatersmall'] = 0xFE65;
  15320. t['gscript'] = 0x0261;
  15321. t['gstroke'] = 0x01E5;
  15322. t['guhiragana'] = 0x3050;
  15323. t['guillemotleft'] = 0x00AB;
  15324. t['guillemotright'] = 0x00BB;
  15325. t['guilsinglleft'] = 0x2039;
  15326. t['guilsinglright'] = 0x203A;
  15327. t['gukatakana'] = 0x30B0;
  15328. t['guramusquare'] = 0x3318;
  15329. t['gysquare'] = 0x33C9;
  15330. t['h'] = 0x0068;
  15331. t['haabkhasiancyrillic'] = 0x04A9;
  15332. t['haaltonearabic'] = 0x06C1;
  15333. t['habengali'] = 0x09B9;
  15334. t['hadescendercyrillic'] = 0x04B3;
  15335. t['hadeva'] = 0x0939;
  15336. t['hagujarati'] = 0x0AB9;
  15337. t['hagurmukhi'] = 0x0A39;
  15338. t['haharabic'] = 0x062D;
  15339. t['hahfinalarabic'] = 0xFEA2;
  15340. t['hahinitialarabic'] = 0xFEA3;
  15341. t['hahiragana'] = 0x306F;
  15342. t['hahmedialarabic'] = 0xFEA4;
  15343. t['haitusquare'] = 0x332A;
  15344. t['hakatakana'] = 0x30CF;
  15345. t['hakatakanahalfwidth'] = 0xFF8A;
  15346. t['halantgurmukhi'] = 0x0A4D;
  15347. t['hamzaarabic'] = 0x0621;
  15348. t['hamzalowarabic'] = 0x0621;
  15349. t['hangulfiller'] = 0x3164;
  15350. t['hardsigncyrillic'] = 0x044A;
  15351. t['harpoonleftbarbup'] = 0x21BC;
  15352. t['harpoonrightbarbup'] = 0x21C0;
  15353. t['hasquare'] = 0x33CA;
  15354. t['hatafpatah'] = 0x05B2;
  15355. t['hatafpatah16'] = 0x05B2;
  15356. t['hatafpatah23'] = 0x05B2;
  15357. t['hatafpatah2f'] = 0x05B2;
  15358. t['hatafpatahhebrew'] = 0x05B2;
  15359. t['hatafpatahnarrowhebrew'] = 0x05B2;
  15360. t['hatafpatahquarterhebrew'] = 0x05B2;
  15361. t['hatafpatahwidehebrew'] = 0x05B2;
  15362. t['hatafqamats'] = 0x05B3;
  15363. t['hatafqamats1b'] = 0x05B3;
  15364. t['hatafqamats28'] = 0x05B3;
  15365. t['hatafqamats34'] = 0x05B3;
  15366. t['hatafqamatshebrew'] = 0x05B3;
  15367. t['hatafqamatsnarrowhebrew'] = 0x05B3;
  15368. t['hatafqamatsquarterhebrew'] = 0x05B3;
  15369. t['hatafqamatswidehebrew'] = 0x05B3;
  15370. t['hatafsegol'] = 0x05B1;
  15371. t['hatafsegol17'] = 0x05B1;
  15372. t['hatafsegol24'] = 0x05B1;
  15373. t['hatafsegol30'] = 0x05B1;
  15374. t['hatafsegolhebrew'] = 0x05B1;
  15375. t['hatafsegolnarrowhebrew'] = 0x05B1;
  15376. t['hatafsegolquarterhebrew'] = 0x05B1;
  15377. t['hatafsegolwidehebrew'] = 0x05B1;
  15378. t['hbar'] = 0x0127;
  15379. t['hbopomofo'] = 0x310F;
  15380. t['hbrevebelow'] = 0x1E2B;
  15381. t['hcedilla'] = 0x1E29;
  15382. t['hcircle'] = 0x24D7;
  15383. t['hcircumflex'] = 0x0125;
  15384. t['hdieresis'] = 0x1E27;
  15385. t['hdotaccent'] = 0x1E23;
  15386. t['hdotbelow'] = 0x1E25;
  15387. t['he'] = 0x05D4;
  15388. t['heart'] = 0x2665;
  15389. t['heartsuitblack'] = 0x2665;
  15390. t['heartsuitwhite'] = 0x2661;
  15391. t['hedagesh'] = 0xFB34;
  15392. t['hedageshhebrew'] = 0xFB34;
  15393. t['hehaltonearabic'] = 0x06C1;
  15394. t['heharabic'] = 0x0647;
  15395. t['hehebrew'] = 0x05D4;
  15396. t['hehfinalaltonearabic'] = 0xFBA7;
  15397. t['hehfinalalttwoarabic'] = 0xFEEA;
  15398. t['hehfinalarabic'] = 0xFEEA;
  15399. t['hehhamzaabovefinalarabic'] = 0xFBA5;
  15400. t['hehhamzaaboveisolatedarabic'] = 0xFBA4;
  15401. t['hehinitialaltonearabic'] = 0xFBA8;
  15402. t['hehinitialarabic'] = 0xFEEB;
  15403. t['hehiragana'] = 0x3078;
  15404. t['hehmedialaltonearabic'] = 0xFBA9;
  15405. t['hehmedialarabic'] = 0xFEEC;
  15406. t['heiseierasquare'] = 0x337B;
  15407. t['hekatakana'] = 0x30D8;
  15408. t['hekatakanahalfwidth'] = 0xFF8D;
  15409. t['hekutaarusquare'] = 0x3336;
  15410. t['henghook'] = 0x0267;
  15411. t['herutusquare'] = 0x3339;
  15412. t['het'] = 0x05D7;
  15413. t['hethebrew'] = 0x05D7;
  15414. t['hhook'] = 0x0266;
  15415. t['hhooksuperior'] = 0x02B1;
  15416. t['hieuhacirclekorean'] = 0x327B;
  15417. t['hieuhaparenkorean'] = 0x321B;
  15418. t['hieuhcirclekorean'] = 0x326D;
  15419. t['hieuhkorean'] = 0x314E;
  15420. t['hieuhparenkorean'] = 0x320D;
  15421. t['hihiragana'] = 0x3072;
  15422. t['hikatakana'] = 0x30D2;
  15423. t['hikatakanahalfwidth'] = 0xFF8B;
  15424. t['hiriq'] = 0x05B4;
  15425. t['hiriq14'] = 0x05B4;
  15426. t['hiriq21'] = 0x05B4;
  15427. t['hiriq2d'] = 0x05B4;
  15428. t['hiriqhebrew'] = 0x05B4;
  15429. t['hiriqnarrowhebrew'] = 0x05B4;
  15430. t['hiriqquarterhebrew'] = 0x05B4;
  15431. t['hiriqwidehebrew'] = 0x05B4;
  15432. t['hlinebelow'] = 0x1E96;
  15433. t['hmonospace'] = 0xFF48;
  15434. t['hoarmenian'] = 0x0570;
  15435. t['hohipthai'] = 0x0E2B;
  15436. t['hohiragana'] = 0x307B;
  15437. t['hokatakana'] = 0x30DB;
  15438. t['hokatakanahalfwidth'] = 0xFF8E;
  15439. t['holam'] = 0x05B9;
  15440. t['holam19'] = 0x05B9;
  15441. t['holam26'] = 0x05B9;
  15442. t['holam32'] = 0x05B9;
  15443. t['holamhebrew'] = 0x05B9;
  15444. t['holamnarrowhebrew'] = 0x05B9;
  15445. t['holamquarterhebrew'] = 0x05B9;
  15446. t['holamwidehebrew'] = 0x05B9;
  15447. t['honokhukthai'] = 0x0E2E;
  15448. t['hookabovecomb'] = 0x0309;
  15449. t['hookcmb'] = 0x0309;
  15450. t['hookpalatalizedbelowcmb'] = 0x0321;
  15451. t['hookretroflexbelowcmb'] = 0x0322;
  15452. t['hoonsquare'] = 0x3342;
  15453. t['horicoptic'] = 0x03E9;
  15454. t['horizontalbar'] = 0x2015;
  15455. t['horncmb'] = 0x031B;
  15456. t['hotsprings'] = 0x2668;
  15457. t['house'] = 0x2302;
  15458. t['hparen'] = 0x24A3;
  15459. t['hsuperior'] = 0x02B0;
  15460. t['hturned'] = 0x0265;
  15461. t['huhiragana'] = 0x3075;
  15462. t['huiitosquare'] = 0x3333;
  15463. t['hukatakana'] = 0x30D5;
  15464. t['hukatakanahalfwidth'] = 0xFF8C;
  15465. t['hungarumlaut'] = 0x02DD;
  15466. t['hungarumlautcmb'] = 0x030B;
  15467. t['hv'] = 0x0195;
  15468. t['hyphen'] = 0x002D;
  15469. t['hypheninferior'] = 0xF6E5;
  15470. t['hyphenmonospace'] = 0xFF0D;
  15471. t['hyphensmall'] = 0xFE63;
  15472. t['hyphensuperior'] = 0xF6E6;
  15473. t['hyphentwo'] = 0x2010;
  15474. t['i'] = 0x0069;
  15475. t['iacute'] = 0x00ED;
  15476. t['iacyrillic'] = 0x044F;
  15477. t['ibengali'] = 0x0987;
  15478. t['ibopomofo'] = 0x3127;
  15479. t['ibreve'] = 0x012D;
  15480. t['icaron'] = 0x01D0;
  15481. t['icircle'] = 0x24D8;
  15482. t['icircumflex'] = 0x00EE;
  15483. t['icyrillic'] = 0x0456;
  15484. t['idblgrave'] = 0x0209;
  15485. t['ideographearthcircle'] = 0x328F;
  15486. t['ideographfirecircle'] = 0x328B;
  15487. t['ideographicallianceparen'] = 0x323F;
  15488. t['ideographiccallparen'] = 0x323A;
  15489. t['ideographiccentrecircle'] = 0x32A5;
  15490. t['ideographicclose'] = 0x3006;
  15491. t['ideographiccomma'] = 0x3001;
  15492. t['ideographiccommaleft'] = 0xFF64;
  15493. t['ideographiccongratulationparen'] = 0x3237;
  15494. t['ideographiccorrectcircle'] = 0x32A3;
  15495. t['ideographicearthparen'] = 0x322F;
  15496. t['ideographicenterpriseparen'] = 0x323D;
  15497. t['ideographicexcellentcircle'] = 0x329D;
  15498. t['ideographicfestivalparen'] = 0x3240;
  15499. t['ideographicfinancialcircle'] = 0x3296;
  15500. t['ideographicfinancialparen'] = 0x3236;
  15501. t['ideographicfireparen'] = 0x322B;
  15502. t['ideographichaveparen'] = 0x3232;
  15503. t['ideographichighcircle'] = 0x32A4;
  15504. t['ideographiciterationmark'] = 0x3005;
  15505. t['ideographiclaborcircle'] = 0x3298;
  15506. t['ideographiclaborparen'] = 0x3238;
  15507. t['ideographicleftcircle'] = 0x32A7;
  15508. t['ideographiclowcircle'] = 0x32A6;
  15509. t['ideographicmedicinecircle'] = 0x32A9;
  15510. t['ideographicmetalparen'] = 0x322E;
  15511. t['ideographicmoonparen'] = 0x322A;
  15512. t['ideographicnameparen'] = 0x3234;
  15513. t['ideographicperiod'] = 0x3002;
  15514. t['ideographicprintcircle'] = 0x329E;
  15515. t['ideographicreachparen'] = 0x3243;
  15516. t['ideographicrepresentparen'] = 0x3239;
  15517. t['ideographicresourceparen'] = 0x323E;
  15518. t['ideographicrightcircle'] = 0x32A8;
  15519. t['ideographicsecretcircle'] = 0x3299;
  15520. t['ideographicselfparen'] = 0x3242;
  15521. t['ideographicsocietyparen'] = 0x3233;
  15522. t['ideographicspace'] = 0x3000;
  15523. t['ideographicspecialparen'] = 0x3235;
  15524. t['ideographicstockparen'] = 0x3231;
  15525. t['ideographicstudyparen'] = 0x323B;
  15526. t['ideographicsunparen'] = 0x3230;
  15527. t['ideographicsuperviseparen'] = 0x323C;
  15528. t['ideographicwaterparen'] = 0x322C;
  15529. t['ideographicwoodparen'] = 0x322D;
  15530. t['ideographiczero'] = 0x3007;
  15531. t['ideographmetalcircle'] = 0x328E;
  15532. t['ideographmooncircle'] = 0x328A;
  15533. t['ideographnamecircle'] = 0x3294;
  15534. t['ideographsuncircle'] = 0x3290;
  15535. t['ideographwatercircle'] = 0x328C;
  15536. t['ideographwoodcircle'] = 0x328D;
  15537. t['ideva'] = 0x0907;
  15538. t['idieresis'] = 0x00EF;
  15539. t['idieresisacute'] = 0x1E2F;
  15540. t['idieresiscyrillic'] = 0x04E5;
  15541. t['idotbelow'] = 0x1ECB;
  15542. t['iebrevecyrillic'] = 0x04D7;
  15543. t['iecyrillic'] = 0x0435;
  15544. t['ieungacirclekorean'] = 0x3275;
  15545. t['ieungaparenkorean'] = 0x3215;
  15546. t['ieungcirclekorean'] = 0x3267;
  15547. t['ieungkorean'] = 0x3147;
  15548. t['ieungparenkorean'] = 0x3207;
  15549. t['igrave'] = 0x00EC;
  15550. t['igujarati'] = 0x0A87;
  15551. t['igurmukhi'] = 0x0A07;
  15552. t['ihiragana'] = 0x3044;
  15553. t['ihookabove'] = 0x1EC9;
  15554. t['iibengali'] = 0x0988;
  15555. t['iicyrillic'] = 0x0438;
  15556. t['iideva'] = 0x0908;
  15557. t['iigujarati'] = 0x0A88;
  15558. t['iigurmukhi'] = 0x0A08;
  15559. t['iimatragurmukhi'] = 0x0A40;
  15560. t['iinvertedbreve'] = 0x020B;
  15561. t['iishortcyrillic'] = 0x0439;
  15562. t['iivowelsignbengali'] = 0x09C0;
  15563. t['iivowelsigndeva'] = 0x0940;
  15564. t['iivowelsigngujarati'] = 0x0AC0;
  15565. t['ij'] = 0x0133;
  15566. t['ikatakana'] = 0x30A4;
  15567. t['ikatakanahalfwidth'] = 0xFF72;
  15568. t['ikorean'] = 0x3163;
  15569. t['ilde'] = 0x02DC;
  15570. t['iluyhebrew'] = 0x05AC;
  15571. t['imacron'] = 0x012B;
  15572. t['imacroncyrillic'] = 0x04E3;
  15573. t['imageorapproximatelyequal'] = 0x2253;
  15574. t['imatragurmukhi'] = 0x0A3F;
  15575. t['imonospace'] = 0xFF49;
  15576. t['increment'] = 0x2206;
  15577. t['infinity'] = 0x221E;
  15578. t['iniarmenian'] = 0x056B;
  15579. t['integral'] = 0x222B;
  15580. t['integralbottom'] = 0x2321;
  15581. t['integralbt'] = 0x2321;
  15582. t['integralex'] = 0xF8F5;
  15583. t['integraltop'] = 0x2320;
  15584. t['integraltp'] = 0x2320;
  15585. t['intersection'] = 0x2229;
  15586. t['intisquare'] = 0x3305;
  15587. t['invbullet'] = 0x25D8;
  15588. t['invcircle'] = 0x25D9;
  15589. t['invsmileface'] = 0x263B;
  15590. t['iocyrillic'] = 0x0451;
  15591. t['iogonek'] = 0x012F;
  15592. t['iota'] = 0x03B9;
  15593. t['iotadieresis'] = 0x03CA;
  15594. t['iotadieresistonos'] = 0x0390;
  15595. t['iotalatin'] = 0x0269;
  15596. t['iotatonos'] = 0x03AF;
  15597. t['iparen'] = 0x24A4;
  15598. t['irigurmukhi'] = 0x0A72;
  15599. t['ismallhiragana'] = 0x3043;
  15600. t['ismallkatakana'] = 0x30A3;
  15601. t['ismallkatakanahalfwidth'] = 0xFF68;
  15602. t['issharbengali'] = 0x09FA;
  15603. t['istroke'] = 0x0268;
  15604. t['isuperior'] = 0xF6ED;
  15605. t['iterationhiragana'] = 0x309D;
  15606. t['iterationkatakana'] = 0x30FD;
  15607. t['itilde'] = 0x0129;
  15608. t['itildebelow'] = 0x1E2D;
  15609. t['iubopomofo'] = 0x3129;
  15610. t['iucyrillic'] = 0x044E;
  15611. t['ivowelsignbengali'] = 0x09BF;
  15612. t['ivowelsigndeva'] = 0x093F;
  15613. t['ivowelsigngujarati'] = 0x0ABF;
  15614. t['izhitsacyrillic'] = 0x0475;
  15615. t['izhitsadblgravecyrillic'] = 0x0477;
  15616. t['j'] = 0x006A;
  15617. t['jaarmenian'] = 0x0571;
  15618. t['jabengali'] = 0x099C;
  15619. t['jadeva'] = 0x091C;
  15620. t['jagujarati'] = 0x0A9C;
  15621. t['jagurmukhi'] = 0x0A1C;
  15622. t['jbopomofo'] = 0x3110;
  15623. t['jcaron'] = 0x01F0;
  15624. t['jcircle'] = 0x24D9;
  15625. t['jcircumflex'] = 0x0135;
  15626. t['jcrossedtail'] = 0x029D;
  15627. t['jdotlessstroke'] = 0x025F;
  15628. t['jecyrillic'] = 0x0458;
  15629. t['jeemarabic'] = 0x062C;
  15630. t['jeemfinalarabic'] = 0xFE9E;
  15631. t['jeeminitialarabic'] = 0xFE9F;
  15632. t['jeemmedialarabic'] = 0xFEA0;
  15633. t['jeharabic'] = 0x0698;
  15634. t['jehfinalarabic'] = 0xFB8B;
  15635. t['jhabengali'] = 0x099D;
  15636. t['jhadeva'] = 0x091D;
  15637. t['jhagujarati'] = 0x0A9D;
  15638. t['jhagurmukhi'] = 0x0A1D;
  15639. t['jheharmenian'] = 0x057B;
  15640. t['jis'] = 0x3004;
  15641. t['jmonospace'] = 0xFF4A;
  15642. t['jparen'] = 0x24A5;
  15643. t['jsuperior'] = 0x02B2;
  15644. t['k'] = 0x006B;
  15645. t['kabashkircyrillic'] = 0x04A1;
  15646. t['kabengali'] = 0x0995;
  15647. t['kacute'] = 0x1E31;
  15648. t['kacyrillic'] = 0x043A;
  15649. t['kadescendercyrillic'] = 0x049B;
  15650. t['kadeva'] = 0x0915;
  15651. t['kaf'] = 0x05DB;
  15652. t['kafarabic'] = 0x0643;
  15653. t['kafdagesh'] = 0xFB3B;
  15654. t['kafdageshhebrew'] = 0xFB3B;
  15655. t['kaffinalarabic'] = 0xFEDA;
  15656. t['kafhebrew'] = 0x05DB;
  15657. t['kafinitialarabic'] = 0xFEDB;
  15658. t['kafmedialarabic'] = 0xFEDC;
  15659. t['kafrafehebrew'] = 0xFB4D;
  15660. t['kagujarati'] = 0x0A95;
  15661. t['kagurmukhi'] = 0x0A15;
  15662. t['kahiragana'] = 0x304B;
  15663. t['kahookcyrillic'] = 0x04C4;
  15664. t['kakatakana'] = 0x30AB;
  15665. t['kakatakanahalfwidth'] = 0xFF76;
  15666. t['kappa'] = 0x03BA;
  15667. t['kappasymbolgreek'] = 0x03F0;
  15668. t['kapyeounmieumkorean'] = 0x3171;
  15669. t['kapyeounphieuphkorean'] = 0x3184;
  15670. t['kapyeounpieupkorean'] = 0x3178;
  15671. t['kapyeounssangpieupkorean'] = 0x3179;
  15672. t['karoriisquare'] = 0x330D;
  15673. t['kashidaautoarabic'] = 0x0640;
  15674. t['kashidaautonosidebearingarabic'] = 0x0640;
  15675. t['kasmallkatakana'] = 0x30F5;
  15676. t['kasquare'] = 0x3384;
  15677. t['kasraarabic'] = 0x0650;
  15678. t['kasratanarabic'] = 0x064D;
  15679. t['kastrokecyrillic'] = 0x049F;
  15680. t['katahiraprolongmarkhalfwidth'] = 0xFF70;
  15681. t['kaverticalstrokecyrillic'] = 0x049D;
  15682. t['kbopomofo'] = 0x310E;
  15683. t['kcalsquare'] = 0x3389;
  15684. t['kcaron'] = 0x01E9;
  15685. t['kcedilla'] = 0x0137;
  15686. t['kcircle'] = 0x24DA;
  15687. t['kcommaaccent'] = 0x0137;
  15688. t['kdotbelow'] = 0x1E33;
  15689. t['keharmenian'] = 0x0584;
  15690. t['kehiragana'] = 0x3051;
  15691. t['kekatakana'] = 0x30B1;
  15692. t['kekatakanahalfwidth'] = 0xFF79;
  15693. t['kenarmenian'] = 0x056F;
  15694. t['kesmallkatakana'] = 0x30F6;
  15695. t['kgreenlandic'] = 0x0138;
  15696. t['khabengali'] = 0x0996;
  15697. t['khacyrillic'] = 0x0445;
  15698. t['khadeva'] = 0x0916;
  15699. t['khagujarati'] = 0x0A96;
  15700. t['khagurmukhi'] = 0x0A16;
  15701. t['khaharabic'] = 0x062E;
  15702. t['khahfinalarabic'] = 0xFEA6;
  15703. t['khahinitialarabic'] = 0xFEA7;
  15704. t['khahmedialarabic'] = 0xFEA8;
  15705. t['kheicoptic'] = 0x03E7;
  15706. t['khhadeva'] = 0x0959;
  15707. t['khhagurmukhi'] = 0x0A59;
  15708. t['khieukhacirclekorean'] = 0x3278;
  15709. t['khieukhaparenkorean'] = 0x3218;
  15710. t['khieukhcirclekorean'] = 0x326A;
  15711. t['khieukhkorean'] = 0x314B;
  15712. t['khieukhparenkorean'] = 0x320A;
  15713. t['khokhaithai'] = 0x0E02;
  15714. t['khokhonthai'] = 0x0E05;
  15715. t['khokhuatthai'] = 0x0E03;
  15716. t['khokhwaithai'] = 0x0E04;
  15717. t['khomutthai'] = 0x0E5B;
  15718. t['khook'] = 0x0199;
  15719. t['khorakhangthai'] = 0x0E06;
  15720. t['khzsquare'] = 0x3391;
  15721. t['kihiragana'] = 0x304D;
  15722. t['kikatakana'] = 0x30AD;
  15723. t['kikatakanahalfwidth'] = 0xFF77;
  15724. t['kiroguramusquare'] = 0x3315;
  15725. t['kiromeetorusquare'] = 0x3316;
  15726. t['kirosquare'] = 0x3314;
  15727. t['kiyeokacirclekorean'] = 0x326E;
  15728. t['kiyeokaparenkorean'] = 0x320E;
  15729. t['kiyeokcirclekorean'] = 0x3260;
  15730. t['kiyeokkorean'] = 0x3131;
  15731. t['kiyeokparenkorean'] = 0x3200;
  15732. t['kiyeoksioskorean'] = 0x3133;
  15733. t['kjecyrillic'] = 0x045C;
  15734. t['klinebelow'] = 0x1E35;
  15735. t['klsquare'] = 0x3398;
  15736. t['kmcubedsquare'] = 0x33A6;
  15737. t['kmonospace'] = 0xFF4B;
  15738. t['kmsquaredsquare'] = 0x33A2;
  15739. t['kohiragana'] = 0x3053;
  15740. t['kohmsquare'] = 0x33C0;
  15741. t['kokaithai'] = 0x0E01;
  15742. t['kokatakana'] = 0x30B3;
  15743. t['kokatakanahalfwidth'] = 0xFF7A;
  15744. t['kooposquare'] = 0x331E;
  15745. t['koppacyrillic'] = 0x0481;
  15746. t['koreanstandardsymbol'] = 0x327F;
  15747. t['koroniscmb'] = 0x0343;
  15748. t['kparen'] = 0x24A6;
  15749. t['kpasquare'] = 0x33AA;
  15750. t['ksicyrillic'] = 0x046F;
  15751. t['ktsquare'] = 0x33CF;
  15752. t['kturned'] = 0x029E;
  15753. t['kuhiragana'] = 0x304F;
  15754. t['kukatakana'] = 0x30AF;
  15755. t['kukatakanahalfwidth'] = 0xFF78;
  15756. t['kvsquare'] = 0x33B8;
  15757. t['kwsquare'] = 0x33BE;
  15758. t['l'] = 0x006C;
  15759. t['labengali'] = 0x09B2;
  15760. t['lacute'] = 0x013A;
  15761. t['ladeva'] = 0x0932;
  15762. t['lagujarati'] = 0x0AB2;
  15763. t['lagurmukhi'] = 0x0A32;
  15764. t['lakkhangyaothai'] = 0x0E45;
  15765. t['lamaleffinalarabic'] = 0xFEFC;
  15766. t['lamalefhamzaabovefinalarabic'] = 0xFEF8;
  15767. t['lamalefhamzaaboveisolatedarabic'] = 0xFEF7;
  15768. t['lamalefhamzabelowfinalarabic'] = 0xFEFA;
  15769. t['lamalefhamzabelowisolatedarabic'] = 0xFEF9;
  15770. t['lamalefisolatedarabic'] = 0xFEFB;
  15771. t['lamalefmaddaabovefinalarabic'] = 0xFEF6;
  15772. t['lamalefmaddaaboveisolatedarabic'] = 0xFEF5;
  15773. t['lamarabic'] = 0x0644;
  15774. t['lambda'] = 0x03BB;
  15775. t['lambdastroke'] = 0x019B;
  15776. t['lamed'] = 0x05DC;
  15777. t['lameddagesh'] = 0xFB3C;
  15778. t['lameddageshhebrew'] = 0xFB3C;
  15779. t['lamedhebrew'] = 0x05DC;
  15780. t['lamfinalarabic'] = 0xFEDE;
  15781. t['lamhahinitialarabic'] = 0xFCCA;
  15782. t['laminitialarabic'] = 0xFEDF;
  15783. t['lamjeeminitialarabic'] = 0xFCC9;
  15784. t['lamkhahinitialarabic'] = 0xFCCB;
  15785. t['lamlamhehisolatedarabic'] = 0xFDF2;
  15786. t['lammedialarabic'] = 0xFEE0;
  15787. t['lammeemhahinitialarabic'] = 0xFD88;
  15788. t['lammeeminitialarabic'] = 0xFCCC;
  15789. t['largecircle'] = 0x25EF;
  15790. t['lbar'] = 0x019A;
  15791. t['lbelt'] = 0x026C;
  15792. t['lbopomofo'] = 0x310C;
  15793. t['lcaron'] = 0x013E;
  15794. t['lcedilla'] = 0x013C;
  15795. t['lcircle'] = 0x24DB;
  15796. t['lcircumflexbelow'] = 0x1E3D;
  15797. t['lcommaaccent'] = 0x013C;
  15798. t['ldot'] = 0x0140;
  15799. t['ldotaccent'] = 0x0140;
  15800. t['ldotbelow'] = 0x1E37;
  15801. t['ldotbelowmacron'] = 0x1E39;
  15802. t['leftangleabovecmb'] = 0x031A;
  15803. t['lefttackbelowcmb'] = 0x0318;
  15804. t['less'] = 0x003C;
  15805. t['lessequal'] = 0x2264;
  15806. t['lessequalorgreater'] = 0x22DA;
  15807. t['lessmonospace'] = 0xFF1C;
  15808. t['lessorequivalent'] = 0x2272;
  15809. t['lessorgreater'] = 0x2276;
  15810. t['lessoverequal'] = 0x2266;
  15811. t['lesssmall'] = 0xFE64;
  15812. t['lezh'] = 0x026E;
  15813. t['lfblock'] = 0x258C;
  15814. t['lhookretroflex'] = 0x026D;
  15815. t['lira'] = 0x20A4;
  15816. t['liwnarmenian'] = 0x056C;
  15817. t['lj'] = 0x01C9;
  15818. t['ljecyrillic'] = 0x0459;
  15819. t['ll'] = 0xF6C0;
  15820. t['lladeva'] = 0x0933;
  15821. t['llagujarati'] = 0x0AB3;
  15822. t['llinebelow'] = 0x1E3B;
  15823. t['llladeva'] = 0x0934;
  15824. t['llvocalicbengali'] = 0x09E1;
  15825. t['llvocalicdeva'] = 0x0961;
  15826. t['llvocalicvowelsignbengali'] = 0x09E3;
  15827. t['llvocalicvowelsigndeva'] = 0x0963;
  15828. t['lmiddletilde'] = 0x026B;
  15829. t['lmonospace'] = 0xFF4C;
  15830. t['lmsquare'] = 0x33D0;
  15831. t['lochulathai'] = 0x0E2C;
  15832. t['logicaland'] = 0x2227;
  15833. t['logicalnot'] = 0x00AC;
  15834. t['logicalnotreversed'] = 0x2310;
  15835. t['logicalor'] = 0x2228;
  15836. t['lolingthai'] = 0x0E25;
  15837. t['longs'] = 0x017F;
  15838. t['lowlinecenterline'] = 0xFE4E;
  15839. t['lowlinecmb'] = 0x0332;
  15840. t['lowlinedashed'] = 0xFE4D;
  15841. t['lozenge'] = 0x25CA;
  15842. t['lparen'] = 0x24A7;
  15843. t['lslash'] = 0x0142;
  15844. t['lsquare'] = 0x2113;
  15845. t['lsuperior'] = 0xF6EE;
  15846. t['ltshade'] = 0x2591;
  15847. t['luthai'] = 0x0E26;
  15848. t['lvocalicbengali'] = 0x098C;
  15849. t['lvocalicdeva'] = 0x090C;
  15850. t['lvocalicvowelsignbengali'] = 0x09E2;
  15851. t['lvocalicvowelsigndeva'] = 0x0962;
  15852. t['lxsquare'] = 0x33D3;
  15853. t['m'] = 0x006D;
  15854. t['mabengali'] = 0x09AE;
  15855. t['macron'] = 0x00AF;
  15856. t['macronbelowcmb'] = 0x0331;
  15857. t['macroncmb'] = 0x0304;
  15858. t['macronlowmod'] = 0x02CD;
  15859. t['macronmonospace'] = 0xFFE3;
  15860. t['macute'] = 0x1E3F;
  15861. t['madeva'] = 0x092E;
  15862. t['magujarati'] = 0x0AAE;
  15863. t['magurmukhi'] = 0x0A2E;
  15864. t['mahapakhhebrew'] = 0x05A4;
  15865. t['mahapakhlefthebrew'] = 0x05A4;
  15866. t['mahiragana'] = 0x307E;
  15867. t['maichattawalowleftthai'] = 0xF895;
  15868. t['maichattawalowrightthai'] = 0xF894;
  15869. t['maichattawathai'] = 0x0E4B;
  15870. t['maichattawaupperleftthai'] = 0xF893;
  15871. t['maieklowleftthai'] = 0xF88C;
  15872. t['maieklowrightthai'] = 0xF88B;
  15873. t['maiekthai'] = 0x0E48;
  15874. t['maiekupperleftthai'] = 0xF88A;
  15875. t['maihanakatleftthai'] = 0xF884;
  15876. t['maihanakatthai'] = 0x0E31;
  15877. t['maitaikhuleftthai'] = 0xF889;
  15878. t['maitaikhuthai'] = 0x0E47;
  15879. t['maitholowleftthai'] = 0xF88F;
  15880. t['maitholowrightthai'] = 0xF88E;
  15881. t['maithothai'] = 0x0E49;
  15882. t['maithoupperleftthai'] = 0xF88D;
  15883. t['maitrilowleftthai'] = 0xF892;
  15884. t['maitrilowrightthai'] = 0xF891;
  15885. t['maitrithai'] = 0x0E4A;
  15886. t['maitriupperleftthai'] = 0xF890;
  15887. t['maiyamokthai'] = 0x0E46;
  15888. t['makatakana'] = 0x30DE;
  15889. t['makatakanahalfwidth'] = 0xFF8F;
  15890. t['male'] = 0x2642;
  15891. t['mansyonsquare'] = 0x3347;
  15892. t['maqafhebrew'] = 0x05BE;
  15893. t['mars'] = 0x2642;
  15894. t['masoracirclehebrew'] = 0x05AF;
  15895. t['masquare'] = 0x3383;
  15896. t['mbopomofo'] = 0x3107;
  15897. t['mbsquare'] = 0x33D4;
  15898. t['mcircle'] = 0x24DC;
  15899. t['mcubedsquare'] = 0x33A5;
  15900. t['mdotaccent'] = 0x1E41;
  15901. t['mdotbelow'] = 0x1E43;
  15902. t['meemarabic'] = 0x0645;
  15903. t['meemfinalarabic'] = 0xFEE2;
  15904. t['meeminitialarabic'] = 0xFEE3;
  15905. t['meemmedialarabic'] = 0xFEE4;
  15906. t['meemmeeminitialarabic'] = 0xFCD1;
  15907. t['meemmeemisolatedarabic'] = 0xFC48;
  15908. t['meetorusquare'] = 0x334D;
  15909. t['mehiragana'] = 0x3081;
  15910. t['meizierasquare'] = 0x337E;
  15911. t['mekatakana'] = 0x30E1;
  15912. t['mekatakanahalfwidth'] = 0xFF92;
  15913. t['mem'] = 0x05DE;
  15914. t['memdagesh'] = 0xFB3E;
  15915. t['memdageshhebrew'] = 0xFB3E;
  15916. t['memhebrew'] = 0x05DE;
  15917. t['menarmenian'] = 0x0574;
  15918. t['merkhahebrew'] = 0x05A5;
  15919. t['merkhakefulahebrew'] = 0x05A6;
  15920. t['merkhakefulalefthebrew'] = 0x05A6;
  15921. t['merkhalefthebrew'] = 0x05A5;
  15922. t['mhook'] = 0x0271;
  15923. t['mhzsquare'] = 0x3392;
  15924. t['middledotkatakanahalfwidth'] = 0xFF65;
  15925. t['middot'] = 0x00B7;
  15926. t['mieumacirclekorean'] = 0x3272;
  15927. t['mieumaparenkorean'] = 0x3212;
  15928. t['mieumcirclekorean'] = 0x3264;
  15929. t['mieumkorean'] = 0x3141;
  15930. t['mieumpansioskorean'] = 0x3170;
  15931. t['mieumparenkorean'] = 0x3204;
  15932. t['mieumpieupkorean'] = 0x316E;
  15933. t['mieumsioskorean'] = 0x316F;
  15934. t['mihiragana'] = 0x307F;
  15935. t['mikatakana'] = 0x30DF;
  15936. t['mikatakanahalfwidth'] = 0xFF90;
  15937. t['minus'] = 0x2212;
  15938. t['minusbelowcmb'] = 0x0320;
  15939. t['minuscircle'] = 0x2296;
  15940. t['minusmod'] = 0x02D7;
  15941. t['minusplus'] = 0x2213;
  15942. t['minute'] = 0x2032;
  15943. t['miribaarusquare'] = 0x334A;
  15944. t['mirisquare'] = 0x3349;
  15945. t['mlonglegturned'] = 0x0270;
  15946. t['mlsquare'] = 0x3396;
  15947. t['mmcubedsquare'] = 0x33A3;
  15948. t['mmonospace'] = 0xFF4D;
  15949. t['mmsquaredsquare'] = 0x339F;
  15950. t['mohiragana'] = 0x3082;
  15951. t['mohmsquare'] = 0x33C1;
  15952. t['mokatakana'] = 0x30E2;
  15953. t['mokatakanahalfwidth'] = 0xFF93;
  15954. t['molsquare'] = 0x33D6;
  15955. t['momathai'] = 0x0E21;
  15956. t['moverssquare'] = 0x33A7;
  15957. t['moverssquaredsquare'] = 0x33A8;
  15958. t['mparen'] = 0x24A8;
  15959. t['mpasquare'] = 0x33AB;
  15960. t['mssquare'] = 0x33B3;
  15961. t['msuperior'] = 0xF6EF;
  15962. t['mturned'] = 0x026F;
  15963. t['mu'] = 0x00B5;
  15964. t['mu1'] = 0x00B5;
  15965. t['muasquare'] = 0x3382;
  15966. t['muchgreater'] = 0x226B;
  15967. t['muchless'] = 0x226A;
  15968. t['mufsquare'] = 0x338C;
  15969. t['mugreek'] = 0x03BC;
  15970. t['mugsquare'] = 0x338D;
  15971. t['muhiragana'] = 0x3080;
  15972. t['mukatakana'] = 0x30E0;
  15973. t['mukatakanahalfwidth'] = 0xFF91;
  15974. t['mulsquare'] = 0x3395;
  15975. t['multiply'] = 0x00D7;
  15976. t['mumsquare'] = 0x339B;
  15977. t['munahhebrew'] = 0x05A3;
  15978. t['munahlefthebrew'] = 0x05A3;
  15979. t['musicalnote'] = 0x266A;
  15980. t['musicalnotedbl'] = 0x266B;
  15981. t['musicflatsign'] = 0x266D;
  15982. t['musicsharpsign'] = 0x266F;
  15983. t['mussquare'] = 0x33B2;
  15984. t['muvsquare'] = 0x33B6;
  15985. t['muwsquare'] = 0x33BC;
  15986. t['mvmegasquare'] = 0x33B9;
  15987. t['mvsquare'] = 0x33B7;
  15988. t['mwmegasquare'] = 0x33BF;
  15989. t['mwsquare'] = 0x33BD;
  15990. t['n'] = 0x006E;
  15991. t['nabengali'] = 0x09A8;
  15992. t['nabla'] = 0x2207;
  15993. t['nacute'] = 0x0144;
  15994. t['nadeva'] = 0x0928;
  15995. t['nagujarati'] = 0x0AA8;
  15996. t['nagurmukhi'] = 0x0A28;
  15997. t['nahiragana'] = 0x306A;
  15998. t['nakatakana'] = 0x30CA;
  15999. t['nakatakanahalfwidth'] = 0xFF85;
  16000. t['napostrophe'] = 0x0149;
  16001. t['nasquare'] = 0x3381;
  16002. t['nbopomofo'] = 0x310B;
  16003. t['nbspace'] = 0x00A0;
  16004. t['ncaron'] = 0x0148;
  16005. t['ncedilla'] = 0x0146;
  16006. t['ncircle'] = 0x24DD;
  16007. t['ncircumflexbelow'] = 0x1E4B;
  16008. t['ncommaaccent'] = 0x0146;
  16009. t['ndotaccent'] = 0x1E45;
  16010. t['ndotbelow'] = 0x1E47;
  16011. t['nehiragana'] = 0x306D;
  16012. t['nekatakana'] = 0x30CD;
  16013. t['nekatakanahalfwidth'] = 0xFF88;
  16014. t['newsheqelsign'] = 0x20AA;
  16015. t['nfsquare'] = 0x338B;
  16016. t['ngabengali'] = 0x0999;
  16017. t['ngadeva'] = 0x0919;
  16018. t['ngagujarati'] = 0x0A99;
  16019. t['ngagurmukhi'] = 0x0A19;
  16020. t['ngonguthai'] = 0x0E07;
  16021. t['nhiragana'] = 0x3093;
  16022. t['nhookleft'] = 0x0272;
  16023. t['nhookretroflex'] = 0x0273;
  16024. t['nieunacirclekorean'] = 0x326F;
  16025. t['nieunaparenkorean'] = 0x320F;
  16026. t['nieuncieuckorean'] = 0x3135;
  16027. t['nieuncirclekorean'] = 0x3261;
  16028. t['nieunhieuhkorean'] = 0x3136;
  16029. t['nieunkorean'] = 0x3134;
  16030. t['nieunpansioskorean'] = 0x3168;
  16031. t['nieunparenkorean'] = 0x3201;
  16032. t['nieunsioskorean'] = 0x3167;
  16033. t['nieuntikeutkorean'] = 0x3166;
  16034. t['nihiragana'] = 0x306B;
  16035. t['nikatakana'] = 0x30CB;
  16036. t['nikatakanahalfwidth'] = 0xFF86;
  16037. t['nikhahitleftthai'] = 0xF899;
  16038. t['nikhahitthai'] = 0x0E4D;
  16039. t['nine'] = 0x0039;
  16040. t['ninearabic'] = 0x0669;
  16041. t['ninebengali'] = 0x09EF;
  16042. t['ninecircle'] = 0x2468;
  16043. t['ninecircleinversesansserif'] = 0x2792;
  16044. t['ninedeva'] = 0x096F;
  16045. t['ninegujarati'] = 0x0AEF;
  16046. t['ninegurmukhi'] = 0x0A6F;
  16047. t['ninehackarabic'] = 0x0669;
  16048. t['ninehangzhou'] = 0x3029;
  16049. t['nineideographicparen'] = 0x3228;
  16050. t['nineinferior'] = 0x2089;
  16051. t['ninemonospace'] = 0xFF19;
  16052. t['nineoldstyle'] = 0xF739;
  16053. t['nineparen'] = 0x247C;
  16054. t['nineperiod'] = 0x2490;
  16055. t['ninepersian'] = 0x06F9;
  16056. t['nineroman'] = 0x2178;
  16057. t['ninesuperior'] = 0x2079;
  16058. t['nineteencircle'] = 0x2472;
  16059. t['nineteenparen'] = 0x2486;
  16060. t['nineteenperiod'] = 0x249A;
  16061. t['ninethai'] = 0x0E59;
  16062. t['nj'] = 0x01CC;
  16063. t['njecyrillic'] = 0x045A;
  16064. t['nkatakana'] = 0x30F3;
  16065. t['nkatakanahalfwidth'] = 0xFF9D;
  16066. t['nlegrightlong'] = 0x019E;
  16067. t['nlinebelow'] = 0x1E49;
  16068. t['nmonospace'] = 0xFF4E;
  16069. t['nmsquare'] = 0x339A;
  16070. t['nnabengali'] = 0x09A3;
  16071. t['nnadeva'] = 0x0923;
  16072. t['nnagujarati'] = 0x0AA3;
  16073. t['nnagurmukhi'] = 0x0A23;
  16074. t['nnnadeva'] = 0x0929;
  16075. t['nohiragana'] = 0x306E;
  16076. t['nokatakana'] = 0x30CE;
  16077. t['nokatakanahalfwidth'] = 0xFF89;
  16078. t['nonbreakingspace'] = 0x00A0;
  16079. t['nonenthai'] = 0x0E13;
  16080. t['nonuthai'] = 0x0E19;
  16081. t['noonarabic'] = 0x0646;
  16082. t['noonfinalarabic'] = 0xFEE6;
  16083. t['noonghunnaarabic'] = 0x06BA;
  16084. t['noonghunnafinalarabic'] = 0xFB9F;
  16085. t['nooninitialarabic'] = 0xFEE7;
  16086. t['noonjeeminitialarabic'] = 0xFCD2;
  16087. t['noonjeemisolatedarabic'] = 0xFC4B;
  16088. t['noonmedialarabic'] = 0xFEE8;
  16089. t['noonmeeminitialarabic'] = 0xFCD5;
  16090. t['noonmeemisolatedarabic'] = 0xFC4E;
  16091. t['noonnoonfinalarabic'] = 0xFC8D;
  16092. t['notcontains'] = 0x220C;
  16093. t['notelement'] = 0x2209;
  16094. t['notelementof'] = 0x2209;
  16095. t['notequal'] = 0x2260;
  16096. t['notgreater'] = 0x226F;
  16097. t['notgreaternorequal'] = 0x2271;
  16098. t['notgreaternorless'] = 0x2279;
  16099. t['notidentical'] = 0x2262;
  16100. t['notless'] = 0x226E;
  16101. t['notlessnorequal'] = 0x2270;
  16102. t['notparallel'] = 0x2226;
  16103. t['notprecedes'] = 0x2280;
  16104. t['notsubset'] = 0x2284;
  16105. t['notsucceeds'] = 0x2281;
  16106. t['notsuperset'] = 0x2285;
  16107. t['nowarmenian'] = 0x0576;
  16108. t['nparen'] = 0x24A9;
  16109. t['nssquare'] = 0x33B1;
  16110. t['nsuperior'] = 0x207F;
  16111. t['ntilde'] = 0x00F1;
  16112. t['nu'] = 0x03BD;
  16113. t['nuhiragana'] = 0x306C;
  16114. t['nukatakana'] = 0x30CC;
  16115. t['nukatakanahalfwidth'] = 0xFF87;
  16116. t['nuktabengali'] = 0x09BC;
  16117. t['nuktadeva'] = 0x093C;
  16118. t['nuktagujarati'] = 0x0ABC;
  16119. t['nuktagurmukhi'] = 0x0A3C;
  16120. t['numbersign'] = 0x0023;
  16121. t['numbersignmonospace'] = 0xFF03;
  16122. t['numbersignsmall'] = 0xFE5F;
  16123. t['numeralsigngreek'] = 0x0374;
  16124. t['numeralsignlowergreek'] = 0x0375;
  16125. t['numero'] = 0x2116;
  16126. t['nun'] = 0x05E0;
  16127. t['nundagesh'] = 0xFB40;
  16128. t['nundageshhebrew'] = 0xFB40;
  16129. t['nunhebrew'] = 0x05E0;
  16130. t['nvsquare'] = 0x33B5;
  16131. t['nwsquare'] = 0x33BB;
  16132. t['nyabengali'] = 0x099E;
  16133. t['nyadeva'] = 0x091E;
  16134. t['nyagujarati'] = 0x0A9E;
  16135. t['nyagurmukhi'] = 0x0A1E;
  16136. t['o'] = 0x006F;
  16137. t['oacute'] = 0x00F3;
  16138. t['oangthai'] = 0x0E2D;
  16139. t['obarred'] = 0x0275;
  16140. t['obarredcyrillic'] = 0x04E9;
  16141. t['obarreddieresiscyrillic'] = 0x04EB;
  16142. t['obengali'] = 0x0993;
  16143. t['obopomofo'] = 0x311B;
  16144. t['obreve'] = 0x014F;
  16145. t['ocandradeva'] = 0x0911;
  16146. t['ocandragujarati'] = 0x0A91;
  16147. t['ocandravowelsigndeva'] = 0x0949;
  16148. t['ocandravowelsigngujarati'] = 0x0AC9;
  16149. t['ocaron'] = 0x01D2;
  16150. t['ocircle'] = 0x24DE;
  16151. t['ocircumflex'] = 0x00F4;
  16152. t['ocircumflexacute'] = 0x1ED1;
  16153. t['ocircumflexdotbelow'] = 0x1ED9;
  16154. t['ocircumflexgrave'] = 0x1ED3;
  16155. t['ocircumflexhookabove'] = 0x1ED5;
  16156. t['ocircumflextilde'] = 0x1ED7;
  16157. t['ocyrillic'] = 0x043E;
  16158. t['odblacute'] = 0x0151;
  16159. t['odblgrave'] = 0x020D;
  16160. t['odeva'] = 0x0913;
  16161. t['odieresis'] = 0x00F6;
  16162. t['odieresiscyrillic'] = 0x04E7;
  16163. t['odotbelow'] = 0x1ECD;
  16164. t['oe'] = 0x0153;
  16165. t['oekorean'] = 0x315A;
  16166. t['ogonek'] = 0x02DB;
  16167. t['ogonekcmb'] = 0x0328;
  16168. t['ograve'] = 0x00F2;
  16169. t['ogujarati'] = 0x0A93;
  16170. t['oharmenian'] = 0x0585;
  16171. t['ohiragana'] = 0x304A;
  16172. t['ohookabove'] = 0x1ECF;
  16173. t['ohorn'] = 0x01A1;
  16174. t['ohornacute'] = 0x1EDB;
  16175. t['ohorndotbelow'] = 0x1EE3;
  16176. t['ohorngrave'] = 0x1EDD;
  16177. t['ohornhookabove'] = 0x1EDF;
  16178. t['ohorntilde'] = 0x1EE1;
  16179. t['ohungarumlaut'] = 0x0151;
  16180. t['oi'] = 0x01A3;
  16181. t['oinvertedbreve'] = 0x020F;
  16182. t['okatakana'] = 0x30AA;
  16183. t['okatakanahalfwidth'] = 0xFF75;
  16184. t['okorean'] = 0x3157;
  16185. t['olehebrew'] = 0x05AB;
  16186. t['omacron'] = 0x014D;
  16187. t['omacronacute'] = 0x1E53;
  16188. t['omacrongrave'] = 0x1E51;
  16189. t['omdeva'] = 0x0950;
  16190. t['omega'] = 0x03C9;
  16191. t['omega1'] = 0x03D6;
  16192. t['omegacyrillic'] = 0x0461;
  16193. t['omegalatinclosed'] = 0x0277;
  16194. t['omegaroundcyrillic'] = 0x047B;
  16195. t['omegatitlocyrillic'] = 0x047D;
  16196. t['omegatonos'] = 0x03CE;
  16197. t['omgujarati'] = 0x0AD0;
  16198. t['omicron'] = 0x03BF;
  16199. t['omicrontonos'] = 0x03CC;
  16200. t['omonospace'] = 0xFF4F;
  16201. t['one'] = 0x0031;
  16202. t['onearabic'] = 0x0661;
  16203. t['onebengali'] = 0x09E7;
  16204. t['onecircle'] = 0x2460;
  16205. t['onecircleinversesansserif'] = 0x278A;
  16206. t['onedeva'] = 0x0967;
  16207. t['onedotenleader'] = 0x2024;
  16208. t['oneeighth'] = 0x215B;
  16209. t['onefitted'] = 0xF6DC;
  16210. t['onegujarati'] = 0x0AE7;
  16211. t['onegurmukhi'] = 0x0A67;
  16212. t['onehackarabic'] = 0x0661;
  16213. t['onehalf'] = 0x00BD;
  16214. t['onehangzhou'] = 0x3021;
  16215. t['oneideographicparen'] = 0x3220;
  16216. t['oneinferior'] = 0x2081;
  16217. t['onemonospace'] = 0xFF11;
  16218. t['onenumeratorbengali'] = 0x09F4;
  16219. t['oneoldstyle'] = 0xF731;
  16220. t['oneparen'] = 0x2474;
  16221. t['oneperiod'] = 0x2488;
  16222. t['onepersian'] = 0x06F1;
  16223. t['onequarter'] = 0x00BC;
  16224. t['oneroman'] = 0x2170;
  16225. t['onesuperior'] = 0x00B9;
  16226. t['onethai'] = 0x0E51;
  16227. t['onethird'] = 0x2153;
  16228. t['oogonek'] = 0x01EB;
  16229. t['oogonekmacron'] = 0x01ED;
  16230. t['oogurmukhi'] = 0x0A13;
  16231. t['oomatragurmukhi'] = 0x0A4B;
  16232. t['oopen'] = 0x0254;
  16233. t['oparen'] = 0x24AA;
  16234. t['openbullet'] = 0x25E6;
  16235. t['option'] = 0x2325;
  16236. t['ordfeminine'] = 0x00AA;
  16237. t['ordmasculine'] = 0x00BA;
  16238. t['orthogonal'] = 0x221F;
  16239. t['oshortdeva'] = 0x0912;
  16240. t['oshortvowelsigndeva'] = 0x094A;
  16241. t['oslash'] = 0x00F8;
  16242. t['oslashacute'] = 0x01FF;
  16243. t['osmallhiragana'] = 0x3049;
  16244. t['osmallkatakana'] = 0x30A9;
  16245. t['osmallkatakanahalfwidth'] = 0xFF6B;
  16246. t['ostrokeacute'] = 0x01FF;
  16247. t['osuperior'] = 0xF6F0;
  16248. t['otcyrillic'] = 0x047F;
  16249. t['otilde'] = 0x00F5;
  16250. t['otildeacute'] = 0x1E4D;
  16251. t['otildedieresis'] = 0x1E4F;
  16252. t['oubopomofo'] = 0x3121;
  16253. t['overline'] = 0x203E;
  16254. t['overlinecenterline'] = 0xFE4A;
  16255. t['overlinecmb'] = 0x0305;
  16256. t['overlinedashed'] = 0xFE49;
  16257. t['overlinedblwavy'] = 0xFE4C;
  16258. t['overlinewavy'] = 0xFE4B;
  16259. t['overscore'] = 0x00AF;
  16260. t['ovowelsignbengali'] = 0x09CB;
  16261. t['ovowelsigndeva'] = 0x094B;
  16262. t['ovowelsigngujarati'] = 0x0ACB;
  16263. t['p'] = 0x0070;
  16264. t['paampssquare'] = 0x3380;
  16265. t['paasentosquare'] = 0x332B;
  16266. t['pabengali'] = 0x09AA;
  16267. t['pacute'] = 0x1E55;
  16268. t['padeva'] = 0x092A;
  16269. t['pagedown'] = 0x21DF;
  16270. t['pageup'] = 0x21DE;
  16271. t['pagujarati'] = 0x0AAA;
  16272. t['pagurmukhi'] = 0x0A2A;
  16273. t['pahiragana'] = 0x3071;
  16274. t['paiyannoithai'] = 0x0E2F;
  16275. t['pakatakana'] = 0x30D1;
  16276. t['palatalizationcyrilliccmb'] = 0x0484;
  16277. t['palochkacyrillic'] = 0x04C0;
  16278. t['pansioskorean'] = 0x317F;
  16279. t['paragraph'] = 0x00B6;
  16280. t['parallel'] = 0x2225;
  16281. t['parenleft'] = 0x0028;
  16282. t['parenleftaltonearabic'] = 0xFD3E;
  16283. t['parenleftbt'] = 0xF8ED;
  16284. t['parenleftex'] = 0xF8EC;
  16285. t['parenleftinferior'] = 0x208D;
  16286. t['parenleftmonospace'] = 0xFF08;
  16287. t['parenleftsmall'] = 0xFE59;
  16288. t['parenleftsuperior'] = 0x207D;
  16289. t['parenlefttp'] = 0xF8EB;
  16290. t['parenleftvertical'] = 0xFE35;
  16291. t['parenright'] = 0x0029;
  16292. t['parenrightaltonearabic'] = 0xFD3F;
  16293. t['parenrightbt'] = 0xF8F8;
  16294. t['parenrightex'] = 0xF8F7;
  16295. t['parenrightinferior'] = 0x208E;
  16296. t['parenrightmonospace'] = 0xFF09;
  16297. t['parenrightsmall'] = 0xFE5A;
  16298. t['parenrightsuperior'] = 0x207E;
  16299. t['parenrighttp'] = 0xF8F6;
  16300. t['parenrightvertical'] = 0xFE36;
  16301. t['partialdiff'] = 0x2202;
  16302. t['paseqhebrew'] = 0x05C0;
  16303. t['pashtahebrew'] = 0x0599;
  16304. t['pasquare'] = 0x33A9;
  16305. t['patah'] = 0x05B7;
  16306. t['patah11'] = 0x05B7;
  16307. t['patah1d'] = 0x05B7;
  16308. t['patah2a'] = 0x05B7;
  16309. t['patahhebrew'] = 0x05B7;
  16310. t['patahnarrowhebrew'] = 0x05B7;
  16311. t['patahquarterhebrew'] = 0x05B7;
  16312. t['patahwidehebrew'] = 0x05B7;
  16313. t['pazerhebrew'] = 0x05A1;
  16314. t['pbopomofo'] = 0x3106;
  16315. t['pcircle'] = 0x24DF;
  16316. t['pdotaccent'] = 0x1E57;
  16317. t['pe'] = 0x05E4;
  16318. t['pecyrillic'] = 0x043F;
  16319. t['pedagesh'] = 0xFB44;
  16320. t['pedageshhebrew'] = 0xFB44;
  16321. t['peezisquare'] = 0x333B;
  16322. t['pefinaldageshhebrew'] = 0xFB43;
  16323. t['peharabic'] = 0x067E;
  16324. t['peharmenian'] = 0x057A;
  16325. t['pehebrew'] = 0x05E4;
  16326. t['pehfinalarabic'] = 0xFB57;
  16327. t['pehinitialarabic'] = 0xFB58;
  16328. t['pehiragana'] = 0x307A;
  16329. t['pehmedialarabic'] = 0xFB59;
  16330. t['pekatakana'] = 0x30DA;
  16331. t['pemiddlehookcyrillic'] = 0x04A7;
  16332. t['perafehebrew'] = 0xFB4E;
  16333. t['percent'] = 0x0025;
  16334. t['percentarabic'] = 0x066A;
  16335. t['percentmonospace'] = 0xFF05;
  16336. t['percentsmall'] = 0xFE6A;
  16337. t['period'] = 0x002E;
  16338. t['periodarmenian'] = 0x0589;
  16339. t['periodcentered'] = 0x00B7;
  16340. t['periodhalfwidth'] = 0xFF61;
  16341. t['periodinferior'] = 0xF6E7;
  16342. t['periodmonospace'] = 0xFF0E;
  16343. t['periodsmall'] = 0xFE52;
  16344. t['periodsuperior'] = 0xF6E8;
  16345. t['perispomenigreekcmb'] = 0x0342;
  16346. t['perpendicular'] = 0x22A5;
  16347. t['perthousand'] = 0x2030;
  16348. t['peseta'] = 0x20A7;
  16349. t['pfsquare'] = 0x338A;
  16350. t['phabengali'] = 0x09AB;
  16351. t['phadeva'] = 0x092B;
  16352. t['phagujarati'] = 0x0AAB;
  16353. t['phagurmukhi'] = 0x0A2B;
  16354. t['phi'] = 0x03C6;
  16355. t['phi1'] = 0x03D5;
  16356. t['phieuphacirclekorean'] = 0x327A;
  16357. t['phieuphaparenkorean'] = 0x321A;
  16358. t['phieuphcirclekorean'] = 0x326C;
  16359. t['phieuphkorean'] = 0x314D;
  16360. t['phieuphparenkorean'] = 0x320C;
  16361. t['philatin'] = 0x0278;
  16362. t['phinthuthai'] = 0x0E3A;
  16363. t['phisymbolgreek'] = 0x03D5;
  16364. t['phook'] = 0x01A5;
  16365. t['phophanthai'] = 0x0E1E;
  16366. t['phophungthai'] = 0x0E1C;
  16367. t['phosamphaothai'] = 0x0E20;
  16368. t['pi'] = 0x03C0;
  16369. t['pieupacirclekorean'] = 0x3273;
  16370. t['pieupaparenkorean'] = 0x3213;
  16371. t['pieupcieuckorean'] = 0x3176;
  16372. t['pieupcirclekorean'] = 0x3265;
  16373. t['pieupkiyeokkorean'] = 0x3172;
  16374. t['pieupkorean'] = 0x3142;
  16375. t['pieupparenkorean'] = 0x3205;
  16376. t['pieupsioskiyeokkorean'] = 0x3174;
  16377. t['pieupsioskorean'] = 0x3144;
  16378. t['pieupsiostikeutkorean'] = 0x3175;
  16379. t['pieupthieuthkorean'] = 0x3177;
  16380. t['pieuptikeutkorean'] = 0x3173;
  16381. t['pihiragana'] = 0x3074;
  16382. t['pikatakana'] = 0x30D4;
  16383. t['pisymbolgreek'] = 0x03D6;
  16384. t['piwrarmenian'] = 0x0583;
  16385. t['plus'] = 0x002B;
  16386. t['plusbelowcmb'] = 0x031F;
  16387. t['pluscircle'] = 0x2295;
  16388. t['plusminus'] = 0x00B1;
  16389. t['plusmod'] = 0x02D6;
  16390. t['plusmonospace'] = 0xFF0B;
  16391. t['plussmall'] = 0xFE62;
  16392. t['plussuperior'] = 0x207A;
  16393. t['pmonospace'] = 0xFF50;
  16394. t['pmsquare'] = 0x33D8;
  16395. t['pohiragana'] = 0x307D;
  16396. t['pointingindexdownwhite'] = 0x261F;
  16397. t['pointingindexleftwhite'] = 0x261C;
  16398. t['pointingindexrightwhite'] = 0x261E;
  16399. t['pointingindexupwhite'] = 0x261D;
  16400. t['pokatakana'] = 0x30DD;
  16401. t['poplathai'] = 0x0E1B;
  16402. t['postalmark'] = 0x3012;
  16403. t['postalmarkface'] = 0x3020;
  16404. t['pparen'] = 0x24AB;
  16405. t['precedes'] = 0x227A;
  16406. t['prescription'] = 0x211E;
  16407. t['primemod'] = 0x02B9;
  16408. t['primereversed'] = 0x2035;
  16409. t['product'] = 0x220F;
  16410. t['projective'] = 0x2305;
  16411. t['prolongedkana'] = 0x30FC;
  16412. t['propellor'] = 0x2318;
  16413. t['propersubset'] = 0x2282;
  16414. t['propersuperset'] = 0x2283;
  16415. t['proportion'] = 0x2237;
  16416. t['proportional'] = 0x221D;
  16417. t['psi'] = 0x03C8;
  16418. t['psicyrillic'] = 0x0471;
  16419. t['psilipneumatacyrilliccmb'] = 0x0486;
  16420. t['pssquare'] = 0x33B0;
  16421. t['puhiragana'] = 0x3077;
  16422. t['pukatakana'] = 0x30D7;
  16423. t['pvsquare'] = 0x33B4;
  16424. t['pwsquare'] = 0x33BA;
  16425. t['q'] = 0x0071;
  16426. t['qadeva'] = 0x0958;
  16427. t['qadmahebrew'] = 0x05A8;
  16428. t['qafarabic'] = 0x0642;
  16429. t['qaffinalarabic'] = 0xFED6;
  16430. t['qafinitialarabic'] = 0xFED7;
  16431. t['qafmedialarabic'] = 0xFED8;
  16432. t['qamats'] = 0x05B8;
  16433. t['qamats10'] = 0x05B8;
  16434. t['qamats1a'] = 0x05B8;
  16435. t['qamats1c'] = 0x05B8;
  16436. t['qamats27'] = 0x05B8;
  16437. t['qamats29'] = 0x05B8;
  16438. t['qamats33'] = 0x05B8;
  16439. t['qamatsde'] = 0x05B8;
  16440. t['qamatshebrew'] = 0x05B8;
  16441. t['qamatsnarrowhebrew'] = 0x05B8;
  16442. t['qamatsqatanhebrew'] = 0x05B8;
  16443. t['qamatsqatannarrowhebrew'] = 0x05B8;
  16444. t['qamatsqatanquarterhebrew'] = 0x05B8;
  16445. t['qamatsqatanwidehebrew'] = 0x05B8;
  16446. t['qamatsquarterhebrew'] = 0x05B8;
  16447. t['qamatswidehebrew'] = 0x05B8;
  16448. t['qarneyparahebrew'] = 0x059F;
  16449. t['qbopomofo'] = 0x3111;
  16450. t['qcircle'] = 0x24E0;
  16451. t['qhook'] = 0x02A0;
  16452. t['qmonospace'] = 0xFF51;
  16453. t['qof'] = 0x05E7;
  16454. t['qofdagesh'] = 0xFB47;
  16455. t['qofdageshhebrew'] = 0xFB47;
  16456. t['qofhebrew'] = 0x05E7;
  16457. t['qparen'] = 0x24AC;
  16458. t['quarternote'] = 0x2669;
  16459. t['qubuts'] = 0x05BB;
  16460. t['qubuts18'] = 0x05BB;
  16461. t['qubuts25'] = 0x05BB;
  16462. t['qubuts31'] = 0x05BB;
  16463. t['qubutshebrew'] = 0x05BB;
  16464. t['qubutsnarrowhebrew'] = 0x05BB;
  16465. t['qubutsquarterhebrew'] = 0x05BB;
  16466. t['qubutswidehebrew'] = 0x05BB;
  16467. t['question'] = 0x003F;
  16468. t['questionarabic'] = 0x061F;
  16469. t['questionarmenian'] = 0x055E;
  16470. t['questiondown'] = 0x00BF;
  16471. t['questiondownsmall'] = 0xF7BF;
  16472. t['questiongreek'] = 0x037E;
  16473. t['questionmonospace'] = 0xFF1F;
  16474. t['questionsmall'] = 0xF73F;
  16475. t['quotedbl'] = 0x0022;
  16476. t['quotedblbase'] = 0x201E;
  16477. t['quotedblleft'] = 0x201C;
  16478. t['quotedblmonospace'] = 0xFF02;
  16479. t['quotedblprime'] = 0x301E;
  16480. t['quotedblprimereversed'] = 0x301D;
  16481. t['quotedblright'] = 0x201D;
  16482. t['quoteleft'] = 0x2018;
  16483. t['quoteleftreversed'] = 0x201B;
  16484. t['quotereversed'] = 0x201B;
  16485. t['quoteright'] = 0x2019;
  16486. t['quoterightn'] = 0x0149;
  16487. t['quotesinglbase'] = 0x201A;
  16488. t['quotesingle'] = 0x0027;
  16489. t['quotesinglemonospace'] = 0xFF07;
  16490. t['r'] = 0x0072;
  16491. t['raarmenian'] = 0x057C;
  16492. t['rabengali'] = 0x09B0;
  16493. t['racute'] = 0x0155;
  16494. t['radeva'] = 0x0930;
  16495. t['radical'] = 0x221A;
  16496. t['radicalex'] = 0xF8E5;
  16497. t['radoverssquare'] = 0x33AE;
  16498. t['radoverssquaredsquare'] = 0x33AF;
  16499. t['radsquare'] = 0x33AD;
  16500. t['rafe'] = 0x05BF;
  16501. t['rafehebrew'] = 0x05BF;
  16502. t['ragujarati'] = 0x0AB0;
  16503. t['ragurmukhi'] = 0x0A30;
  16504. t['rahiragana'] = 0x3089;
  16505. t['rakatakana'] = 0x30E9;
  16506. t['rakatakanahalfwidth'] = 0xFF97;
  16507. t['ralowerdiagonalbengali'] = 0x09F1;
  16508. t['ramiddlediagonalbengali'] = 0x09F0;
  16509. t['ramshorn'] = 0x0264;
  16510. t['ratio'] = 0x2236;
  16511. t['rbopomofo'] = 0x3116;
  16512. t['rcaron'] = 0x0159;
  16513. t['rcedilla'] = 0x0157;
  16514. t['rcircle'] = 0x24E1;
  16515. t['rcommaaccent'] = 0x0157;
  16516. t['rdblgrave'] = 0x0211;
  16517. t['rdotaccent'] = 0x1E59;
  16518. t['rdotbelow'] = 0x1E5B;
  16519. t['rdotbelowmacron'] = 0x1E5D;
  16520. t['referencemark'] = 0x203B;
  16521. t['reflexsubset'] = 0x2286;
  16522. t['reflexsuperset'] = 0x2287;
  16523. t['registered'] = 0x00AE;
  16524. t['registersans'] = 0xF8E8;
  16525. t['registerserif'] = 0xF6DA;
  16526. t['reharabic'] = 0x0631;
  16527. t['reharmenian'] = 0x0580;
  16528. t['rehfinalarabic'] = 0xFEAE;
  16529. t['rehiragana'] = 0x308C;
  16530. t['rekatakana'] = 0x30EC;
  16531. t['rekatakanahalfwidth'] = 0xFF9A;
  16532. t['resh'] = 0x05E8;
  16533. t['reshdageshhebrew'] = 0xFB48;
  16534. t['reshhebrew'] = 0x05E8;
  16535. t['reversedtilde'] = 0x223D;
  16536. t['reviahebrew'] = 0x0597;
  16537. t['reviamugrashhebrew'] = 0x0597;
  16538. t['revlogicalnot'] = 0x2310;
  16539. t['rfishhook'] = 0x027E;
  16540. t['rfishhookreversed'] = 0x027F;
  16541. t['rhabengali'] = 0x09DD;
  16542. t['rhadeva'] = 0x095D;
  16543. t['rho'] = 0x03C1;
  16544. t['rhook'] = 0x027D;
  16545. t['rhookturned'] = 0x027B;
  16546. t['rhookturnedsuperior'] = 0x02B5;
  16547. t['rhosymbolgreek'] = 0x03F1;
  16548. t['rhotichookmod'] = 0x02DE;
  16549. t['rieulacirclekorean'] = 0x3271;
  16550. t['rieulaparenkorean'] = 0x3211;
  16551. t['rieulcirclekorean'] = 0x3263;
  16552. t['rieulhieuhkorean'] = 0x3140;
  16553. t['rieulkiyeokkorean'] = 0x313A;
  16554. t['rieulkiyeoksioskorean'] = 0x3169;
  16555. t['rieulkorean'] = 0x3139;
  16556. t['rieulmieumkorean'] = 0x313B;
  16557. t['rieulpansioskorean'] = 0x316C;
  16558. t['rieulparenkorean'] = 0x3203;
  16559. t['rieulphieuphkorean'] = 0x313F;
  16560. t['rieulpieupkorean'] = 0x313C;
  16561. t['rieulpieupsioskorean'] = 0x316B;
  16562. t['rieulsioskorean'] = 0x313D;
  16563. t['rieulthieuthkorean'] = 0x313E;
  16564. t['rieultikeutkorean'] = 0x316A;
  16565. t['rieulyeorinhieuhkorean'] = 0x316D;
  16566. t['rightangle'] = 0x221F;
  16567. t['righttackbelowcmb'] = 0x0319;
  16568. t['righttriangle'] = 0x22BF;
  16569. t['rihiragana'] = 0x308A;
  16570. t['rikatakana'] = 0x30EA;
  16571. t['rikatakanahalfwidth'] = 0xFF98;
  16572. t['ring'] = 0x02DA;
  16573. t['ringbelowcmb'] = 0x0325;
  16574. t['ringcmb'] = 0x030A;
  16575. t['ringhalfleft'] = 0x02BF;
  16576. t['ringhalfleftarmenian'] = 0x0559;
  16577. t['ringhalfleftbelowcmb'] = 0x031C;
  16578. t['ringhalfleftcentered'] = 0x02D3;
  16579. t['ringhalfright'] = 0x02BE;
  16580. t['ringhalfrightbelowcmb'] = 0x0339;
  16581. t['ringhalfrightcentered'] = 0x02D2;
  16582. t['rinvertedbreve'] = 0x0213;
  16583. t['rittorusquare'] = 0x3351;
  16584. t['rlinebelow'] = 0x1E5F;
  16585. t['rlongleg'] = 0x027C;
  16586. t['rlonglegturned'] = 0x027A;
  16587. t['rmonospace'] = 0xFF52;
  16588. t['rohiragana'] = 0x308D;
  16589. t['rokatakana'] = 0x30ED;
  16590. t['rokatakanahalfwidth'] = 0xFF9B;
  16591. t['roruathai'] = 0x0E23;
  16592. t['rparen'] = 0x24AD;
  16593. t['rrabengali'] = 0x09DC;
  16594. t['rradeva'] = 0x0931;
  16595. t['rragurmukhi'] = 0x0A5C;
  16596. t['rreharabic'] = 0x0691;
  16597. t['rrehfinalarabic'] = 0xFB8D;
  16598. t['rrvocalicbengali'] = 0x09E0;
  16599. t['rrvocalicdeva'] = 0x0960;
  16600. t['rrvocalicgujarati'] = 0x0AE0;
  16601. t['rrvocalicvowelsignbengali'] = 0x09C4;
  16602. t['rrvocalicvowelsigndeva'] = 0x0944;
  16603. t['rrvocalicvowelsigngujarati'] = 0x0AC4;
  16604. t['rsuperior'] = 0xF6F1;
  16605. t['rtblock'] = 0x2590;
  16606. t['rturned'] = 0x0279;
  16607. t['rturnedsuperior'] = 0x02B4;
  16608. t['ruhiragana'] = 0x308B;
  16609. t['rukatakana'] = 0x30EB;
  16610. t['rukatakanahalfwidth'] = 0xFF99;
  16611. t['rupeemarkbengali'] = 0x09F2;
  16612. t['rupeesignbengali'] = 0x09F3;
  16613. t['rupiah'] = 0xF6DD;
  16614. t['ruthai'] = 0x0E24;
  16615. t['rvocalicbengali'] = 0x098B;
  16616. t['rvocalicdeva'] = 0x090B;
  16617. t['rvocalicgujarati'] = 0x0A8B;
  16618. t['rvocalicvowelsignbengali'] = 0x09C3;
  16619. t['rvocalicvowelsigndeva'] = 0x0943;
  16620. t['rvocalicvowelsigngujarati'] = 0x0AC3;
  16621. t['s'] = 0x0073;
  16622. t['sabengali'] = 0x09B8;
  16623. t['sacute'] = 0x015B;
  16624. t['sacutedotaccent'] = 0x1E65;
  16625. t['sadarabic'] = 0x0635;
  16626. t['sadeva'] = 0x0938;
  16627. t['sadfinalarabic'] = 0xFEBA;
  16628. t['sadinitialarabic'] = 0xFEBB;
  16629. t['sadmedialarabic'] = 0xFEBC;
  16630. t['sagujarati'] = 0x0AB8;
  16631. t['sagurmukhi'] = 0x0A38;
  16632. t['sahiragana'] = 0x3055;
  16633. t['sakatakana'] = 0x30B5;
  16634. t['sakatakanahalfwidth'] = 0xFF7B;
  16635. t['sallallahoualayhewasallamarabic'] = 0xFDFA;
  16636. t['samekh'] = 0x05E1;
  16637. t['samekhdagesh'] = 0xFB41;
  16638. t['samekhdageshhebrew'] = 0xFB41;
  16639. t['samekhhebrew'] = 0x05E1;
  16640. t['saraaathai'] = 0x0E32;
  16641. t['saraaethai'] = 0x0E41;
  16642. t['saraaimaimalaithai'] = 0x0E44;
  16643. t['saraaimaimuanthai'] = 0x0E43;
  16644. t['saraamthai'] = 0x0E33;
  16645. t['saraathai'] = 0x0E30;
  16646. t['saraethai'] = 0x0E40;
  16647. t['saraiileftthai'] = 0xF886;
  16648. t['saraiithai'] = 0x0E35;
  16649. t['saraileftthai'] = 0xF885;
  16650. t['saraithai'] = 0x0E34;
  16651. t['saraothai'] = 0x0E42;
  16652. t['saraueeleftthai'] = 0xF888;
  16653. t['saraueethai'] = 0x0E37;
  16654. t['saraueleftthai'] = 0xF887;
  16655. t['sarauethai'] = 0x0E36;
  16656. t['sarauthai'] = 0x0E38;
  16657. t['sarauuthai'] = 0x0E39;
  16658. t['sbopomofo'] = 0x3119;
  16659. t['scaron'] = 0x0161;
  16660. t['scarondotaccent'] = 0x1E67;
  16661. t['scedilla'] = 0x015F;
  16662. t['schwa'] = 0x0259;
  16663. t['schwacyrillic'] = 0x04D9;
  16664. t['schwadieresiscyrillic'] = 0x04DB;
  16665. t['schwahook'] = 0x025A;
  16666. t['scircle'] = 0x24E2;
  16667. t['scircumflex'] = 0x015D;
  16668. t['scommaaccent'] = 0x0219;
  16669. t['sdotaccent'] = 0x1E61;
  16670. t['sdotbelow'] = 0x1E63;
  16671. t['sdotbelowdotaccent'] = 0x1E69;
  16672. t['seagullbelowcmb'] = 0x033C;
  16673. t['second'] = 0x2033;
  16674. t['secondtonechinese'] = 0x02CA;
  16675. t['section'] = 0x00A7;
  16676. t['seenarabic'] = 0x0633;
  16677. t['seenfinalarabic'] = 0xFEB2;
  16678. t['seeninitialarabic'] = 0xFEB3;
  16679. t['seenmedialarabic'] = 0xFEB4;
  16680. t['segol'] = 0x05B6;
  16681. t['segol13'] = 0x05B6;
  16682. t['segol1f'] = 0x05B6;
  16683. t['segol2c'] = 0x05B6;
  16684. t['segolhebrew'] = 0x05B6;
  16685. t['segolnarrowhebrew'] = 0x05B6;
  16686. t['segolquarterhebrew'] = 0x05B6;
  16687. t['segoltahebrew'] = 0x0592;
  16688. t['segolwidehebrew'] = 0x05B6;
  16689. t['seharmenian'] = 0x057D;
  16690. t['sehiragana'] = 0x305B;
  16691. t['sekatakana'] = 0x30BB;
  16692. t['sekatakanahalfwidth'] = 0xFF7E;
  16693. t['semicolon'] = 0x003B;
  16694. t['semicolonarabic'] = 0x061B;
  16695. t['semicolonmonospace'] = 0xFF1B;
  16696. t['semicolonsmall'] = 0xFE54;
  16697. t['semivoicedmarkkana'] = 0x309C;
  16698. t['semivoicedmarkkanahalfwidth'] = 0xFF9F;
  16699. t['sentisquare'] = 0x3322;
  16700. t['sentosquare'] = 0x3323;
  16701. t['seven'] = 0x0037;
  16702. t['sevenarabic'] = 0x0667;
  16703. t['sevenbengali'] = 0x09ED;
  16704. t['sevencircle'] = 0x2466;
  16705. t['sevencircleinversesansserif'] = 0x2790;
  16706. t['sevendeva'] = 0x096D;
  16707. t['seveneighths'] = 0x215E;
  16708. t['sevengujarati'] = 0x0AED;
  16709. t['sevengurmukhi'] = 0x0A6D;
  16710. t['sevenhackarabic'] = 0x0667;
  16711. t['sevenhangzhou'] = 0x3027;
  16712. t['sevenideographicparen'] = 0x3226;
  16713. t['seveninferior'] = 0x2087;
  16714. t['sevenmonospace'] = 0xFF17;
  16715. t['sevenoldstyle'] = 0xF737;
  16716. t['sevenparen'] = 0x247A;
  16717. t['sevenperiod'] = 0x248E;
  16718. t['sevenpersian'] = 0x06F7;
  16719. t['sevenroman'] = 0x2176;
  16720. t['sevensuperior'] = 0x2077;
  16721. t['seventeencircle'] = 0x2470;
  16722. t['seventeenparen'] = 0x2484;
  16723. t['seventeenperiod'] = 0x2498;
  16724. t['seventhai'] = 0x0E57;
  16725. t['sfthyphen'] = 0x00AD;
  16726. t['shaarmenian'] = 0x0577;
  16727. t['shabengali'] = 0x09B6;
  16728. t['shacyrillic'] = 0x0448;
  16729. t['shaddaarabic'] = 0x0651;
  16730. t['shaddadammaarabic'] = 0xFC61;
  16731. t['shaddadammatanarabic'] = 0xFC5E;
  16732. t['shaddafathaarabic'] = 0xFC60;
  16733. t['shaddakasraarabic'] = 0xFC62;
  16734. t['shaddakasratanarabic'] = 0xFC5F;
  16735. t['shade'] = 0x2592;
  16736. t['shadedark'] = 0x2593;
  16737. t['shadelight'] = 0x2591;
  16738. t['shademedium'] = 0x2592;
  16739. t['shadeva'] = 0x0936;
  16740. t['shagujarati'] = 0x0AB6;
  16741. t['shagurmukhi'] = 0x0A36;
  16742. t['shalshelethebrew'] = 0x0593;
  16743. t['shbopomofo'] = 0x3115;
  16744. t['shchacyrillic'] = 0x0449;
  16745. t['sheenarabic'] = 0x0634;
  16746. t['sheenfinalarabic'] = 0xFEB6;
  16747. t['sheeninitialarabic'] = 0xFEB7;
  16748. t['sheenmedialarabic'] = 0xFEB8;
  16749. t['sheicoptic'] = 0x03E3;
  16750. t['sheqel'] = 0x20AA;
  16751. t['sheqelhebrew'] = 0x20AA;
  16752. t['sheva'] = 0x05B0;
  16753. t['sheva115'] = 0x05B0;
  16754. t['sheva15'] = 0x05B0;
  16755. t['sheva22'] = 0x05B0;
  16756. t['sheva2e'] = 0x05B0;
  16757. t['shevahebrew'] = 0x05B0;
  16758. t['shevanarrowhebrew'] = 0x05B0;
  16759. t['shevaquarterhebrew'] = 0x05B0;
  16760. t['shevawidehebrew'] = 0x05B0;
  16761. t['shhacyrillic'] = 0x04BB;
  16762. t['shimacoptic'] = 0x03ED;
  16763. t['shin'] = 0x05E9;
  16764. t['shindagesh'] = 0xFB49;
  16765. t['shindageshhebrew'] = 0xFB49;
  16766. t['shindageshshindot'] = 0xFB2C;
  16767. t['shindageshshindothebrew'] = 0xFB2C;
  16768. t['shindageshsindot'] = 0xFB2D;
  16769. t['shindageshsindothebrew'] = 0xFB2D;
  16770. t['shindothebrew'] = 0x05C1;
  16771. t['shinhebrew'] = 0x05E9;
  16772. t['shinshindot'] = 0xFB2A;
  16773. t['shinshindothebrew'] = 0xFB2A;
  16774. t['shinsindot'] = 0xFB2B;
  16775. t['shinsindothebrew'] = 0xFB2B;
  16776. t['shook'] = 0x0282;
  16777. t['sigma'] = 0x03C3;
  16778. t['sigma1'] = 0x03C2;
  16779. t['sigmafinal'] = 0x03C2;
  16780. t['sigmalunatesymbolgreek'] = 0x03F2;
  16781. t['sihiragana'] = 0x3057;
  16782. t['sikatakana'] = 0x30B7;
  16783. t['sikatakanahalfwidth'] = 0xFF7C;
  16784. t['siluqhebrew'] = 0x05BD;
  16785. t['siluqlefthebrew'] = 0x05BD;
  16786. t['similar'] = 0x223C;
  16787. t['sindothebrew'] = 0x05C2;
  16788. t['siosacirclekorean'] = 0x3274;
  16789. t['siosaparenkorean'] = 0x3214;
  16790. t['sioscieuckorean'] = 0x317E;
  16791. t['sioscirclekorean'] = 0x3266;
  16792. t['sioskiyeokkorean'] = 0x317A;
  16793. t['sioskorean'] = 0x3145;
  16794. t['siosnieunkorean'] = 0x317B;
  16795. t['siosparenkorean'] = 0x3206;
  16796. t['siospieupkorean'] = 0x317D;
  16797. t['siostikeutkorean'] = 0x317C;
  16798. t['six'] = 0x0036;
  16799. t['sixarabic'] = 0x0666;
  16800. t['sixbengali'] = 0x09EC;
  16801. t['sixcircle'] = 0x2465;
  16802. t['sixcircleinversesansserif'] = 0x278F;
  16803. t['sixdeva'] = 0x096C;
  16804. t['sixgujarati'] = 0x0AEC;
  16805. t['sixgurmukhi'] = 0x0A6C;
  16806. t['sixhackarabic'] = 0x0666;
  16807. t['sixhangzhou'] = 0x3026;
  16808. t['sixideographicparen'] = 0x3225;
  16809. t['sixinferior'] = 0x2086;
  16810. t['sixmonospace'] = 0xFF16;
  16811. t['sixoldstyle'] = 0xF736;
  16812. t['sixparen'] = 0x2479;
  16813. t['sixperiod'] = 0x248D;
  16814. t['sixpersian'] = 0x06F6;
  16815. t['sixroman'] = 0x2175;
  16816. t['sixsuperior'] = 0x2076;
  16817. t['sixteencircle'] = 0x246F;
  16818. t['sixteencurrencydenominatorbengali'] = 0x09F9;
  16819. t['sixteenparen'] = 0x2483;
  16820. t['sixteenperiod'] = 0x2497;
  16821. t['sixthai'] = 0x0E56;
  16822. t['slash'] = 0x002F;
  16823. t['slashmonospace'] = 0xFF0F;
  16824. t['slong'] = 0x017F;
  16825. t['slongdotaccent'] = 0x1E9B;
  16826. t['smileface'] = 0x263A;
  16827. t['smonospace'] = 0xFF53;
  16828. t['sofpasuqhebrew'] = 0x05C3;
  16829. t['softhyphen'] = 0x00AD;
  16830. t['softsigncyrillic'] = 0x044C;
  16831. t['sohiragana'] = 0x305D;
  16832. t['sokatakana'] = 0x30BD;
  16833. t['sokatakanahalfwidth'] = 0xFF7F;
  16834. t['soliduslongoverlaycmb'] = 0x0338;
  16835. t['solidusshortoverlaycmb'] = 0x0337;
  16836. t['sorusithai'] = 0x0E29;
  16837. t['sosalathai'] = 0x0E28;
  16838. t['sosothai'] = 0x0E0B;
  16839. t['sosuathai'] = 0x0E2A;
  16840. t['space'] = 0x0020;
  16841. t['spacehackarabic'] = 0x0020;
  16842. t['spade'] = 0x2660;
  16843. t['spadesuitblack'] = 0x2660;
  16844. t['spadesuitwhite'] = 0x2664;
  16845. t['sparen'] = 0x24AE;
  16846. t['squarebelowcmb'] = 0x033B;
  16847. t['squarecc'] = 0x33C4;
  16848. t['squarecm'] = 0x339D;
  16849. t['squarediagonalcrosshatchfill'] = 0x25A9;
  16850. t['squarehorizontalfill'] = 0x25A4;
  16851. t['squarekg'] = 0x338F;
  16852. t['squarekm'] = 0x339E;
  16853. t['squarekmcapital'] = 0x33CE;
  16854. t['squareln'] = 0x33D1;
  16855. t['squarelog'] = 0x33D2;
  16856. t['squaremg'] = 0x338E;
  16857. t['squaremil'] = 0x33D5;
  16858. t['squaremm'] = 0x339C;
  16859. t['squaremsquared'] = 0x33A1;
  16860. t['squareorthogonalcrosshatchfill'] = 0x25A6;
  16861. t['squareupperlefttolowerrightfill'] = 0x25A7;
  16862. t['squareupperrighttolowerleftfill'] = 0x25A8;
  16863. t['squareverticalfill'] = 0x25A5;
  16864. t['squarewhitewithsmallblack'] = 0x25A3;
  16865. t['srsquare'] = 0x33DB;
  16866. t['ssabengali'] = 0x09B7;
  16867. t['ssadeva'] = 0x0937;
  16868. t['ssagujarati'] = 0x0AB7;
  16869. t['ssangcieuckorean'] = 0x3149;
  16870. t['ssanghieuhkorean'] = 0x3185;
  16871. t['ssangieungkorean'] = 0x3180;
  16872. t['ssangkiyeokkorean'] = 0x3132;
  16873. t['ssangnieunkorean'] = 0x3165;
  16874. t['ssangpieupkorean'] = 0x3143;
  16875. t['ssangsioskorean'] = 0x3146;
  16876. t['ssangtikeutkorean'] = 0x3138;
  16877. t['ssuperior'] = 0xF6F2;
  16878. t['sterling'] = 0x00A3;
  16879. t['sterlingmonospace'] = 0xFFE1;
  16880. t['strokelongoverlaycmb'] = 0x0336;
  16881. t['strokeshortoverlaycmb'] = 0x0335;
  16882. t['subset'] = 0x2282;
  16883. t['subsetnotequal'] = 0x228A;
  16884. t['subsetorequal'] = 0x2286;
  16885. t['succeeds'] = 0x227B;
  16886. t['suchthat'] = 0x220B;
  16887. t['suhiragana'] = 0x3059;
  16888. t['sukatakana'] = 0x30B9;
  16889. t['sukatakanahalfwidth'] = 0xFF7D;
  16890. t['sukunarabic'] = 0x0652;
  16891. t['summation'] = 0x2211;
  16892. t['sun'] = 0x263C;
  16893. t['superset'] = 0x2283;
  16894. t['supersetnotequal'] = 0x228B;
  16895. t['supersetorequal'] = 0x2287;
  16896. t['svsquare'] = 0x33DC;
  16897. t['syouwaerasquare'] = 0x337C;
  16898. t['t'] = 0x0074;
  16899. t['tabengali'] = 0x09A4;
  16900. t['tackdown'] = 0x22A4;
  16901. t['tackleft'] = 0x22A3;
  16902. t['tadeva'] = 0x0924;
  16903. t['tagujarati'] = 0x0AA4;
  16904. t['tagurmukhi'] = 0x0A24;
  16905. t['taharabic'] = 0x0637;
  16906. t['tahfinalarabic'] = 0xFEC2;
  16907. t['tahinitialarabic'] = 0xFEC3;
  16908. t['tahiragana'] = 0x305F;
  16909. t['tahmedialarabic'] = 0xFEC4;
  16910. t['taisyouerasquare'] = 0x337D;
  16911. t['takatakana'] = 0x30BF;
  16912. t['takatakanahalfwidth'] = 0xFF80;
  16913. t['tatweelarabic'] = 0x0640;
  16914. t['tau'] = 0x03C4;
  16915. t['tav'] = 0x05EA;
  16916. t['tavdages'] = 0xFB4A;
  16917. t['tavdagesh'] = 0xFB4A;
  16918. t['tavdageshhebrew'] = 0xFB4A;
  16919. t['tavhebrew'] = 0x05EA;
  16920. t['tbar'] = 0x0167;
  16921. t['tbopomofo'] = 0x310A;
  16922. t['tcaron'] = 0x0165;
  16923. t['tccurl'] = 0x02A8;
  16924. t['tcedilla'] = 0x0163;
  16925. t['tcheharabic'] = 0x0686;
  16926. t['tchehfinalarabic'] = 0xFB7B;
  16927. t['tchehinitialarabic'] = 0xFB7C;
  16928. t['tchehmedialarabic'] = 0xFB7D;
  16929. t['tcircle'] = 0x24E3;
  16930. t['tcircumflexbelow'] = 0x1E71;
  16931. t['tcommaaccent'] = 0x0163;
  16932. t['tdieresis'] = 0x1E97;
  16933. t['tdotaccent'] = 0x1E6B;
  16934. t['tdotbelow'] = 0x1E6D;
  16935. t['tecyrillic'] = 0x0442;
  16936. t['tedescendercyrillic'] = 0x04AD;
  16937. t['teharabic'] = 0x062A;
  16938. t['tehfinalarabic'] = 0xFE96;
  16939. t['tehhahinitialarabic'] = 0xFCA2;
  16940. t['tehhahisolatedarabic'] = 0xFC0C;
  16941. t['tehinitialarabic'] = 0xFE97;
  16942. t['tehiragana'] = 0x3066;
  16943. t['tehjeeminitialarabic'] = 0xFCA1;
  16944. t['tehjeemisolatedarabic'] = 0xFC0B;
  16945. t['tehmarbutaarabic'] = 0x0629;
  16946. t['tehmarbutafinalarabic'] = 0xFE94;
  16947. t['tehmedialarabic'] = 0xFE98;
  16948. t['tehmeeminitialarabic'] = 0xFCA4;
  16949. t['tehmeemisolatedarabic'] = 0xFC0E;
  16950. t['tehnoonfinalarabic'] = 0xFC73;
  16951. t['tekatakana'] = 0x30C6;
  16952. t['tekatakanahalfwidth'] = 0xFF83;
  16953. t['telephone'] = 0x2121;
  16954. t['telephoneblack'] = 0x260E;
  16955. t['telishagedolahebrew'] = 0x05A0;
  16956. t['telishaqetanahebrew'] = 0x05A9;
  16957. t['tencircle'] = 0x2469;
  16958. t['tenideographicparen'] = 0x3229;
  16959. t['tenparen'] = 0x247D;
  16960. t['tenperiod'] = 0x2491;
  16961. t['tenroman'] = 0x2179;
  16962. t['tesh'] = 0x02A7;
  16963. t['tet'] = 0x05D8;
  16964. t['tetdagesh'] = 0xFB38;
  16965. t['tetdageshhebrew'] = 0xFB38;
  16966. t['tethebrew'] = 0x05D8;
  16967. t['tetsecyrillic'] = 0x04B5;
  16968. t['tevirhebrew'] = 0x059B;
  16969. t['tevirlefthebrew'] = 0x059B;
  16970. t['thabengali'] = 0x09A5;
  16971. t['thadeva'] = 0x0925;
  16972. t['thagujarati'] = 0x0AA5;
  16973. t['thagurmukhi'] = 0x0A25;
  16974. t['thalarabic'] = 0x0630;
  16975. t['thalfinalarabic'] = 0xFEAC;
  16976. t['thanthakhatlowleftthai'] = 0xF898;
  16977. t['thanthakhatlowrightthai'] = 0xF897;
  16978. t['thanthakhatthai'] = 0x0E4C;
  16979. t['thanthakhatupperleftthai'] = 0xF896;
  16980. t['theharabic'] = 0x062B;
  16981. t['thehfinalarabic'] = 0xFE9A;
  16982. t['thehinitialarabic'] = 0xFE9B;
  16983. t['thehmedialarabic'] = 0xFE9C;
  16984. t['thereexists'] = 0x2203;
  16985. t['therefore'] = 0x2234;
  16986. t['theta'] = 0x03B8;
  16987. t['theta1'] = 0x03D1;
  16988. t['thetasymbolgreek'] = 0x03D1;
  16989. t['thieuthacirclekorean'] = 0x3279;
  16990. t['thieuthaparenkorean'] = 0x3219;
  16991. t['thieuthcirclekorean'] = 0x326B;
  16992. t['thieuthkorean'] = 0x314C;
  16993. t['thieuthparenkorean'] = 0x320B;
  16994. t['thirteencircle'] = 0x246C;
  16995. t['thirteenparen'] = 0x2480;
  16996. t['thirteenperiod'] = 0x2494;
  16997. t['thonangmonthothai'] = 0x0E11;
  16998. t['thook'] = 0x01AD;
  16999. t['thophuthaothai'] = 0x0E12;
  17000. t['thorn'] = 0x00FE;
  17001. t['thothahanthai'] = 0x0E17;
  17002. t['thothanthai'] = 0x0E10;
  17003. t['thothongthai'] = 0x0E18;
  17004. t['thothungthai'] = 0x0E16;
  17005. t['thousandcyrillic'] = 0x0482;
  17006. t['thousandsseparatorarabic'] = 0x066C;
  17007. t['thousandsseparatorpersian'] = 0x066C;
  17008. t['three'] = 0x0033;
  17009. t['threearabic'] = 0x0663;
  17010. t['threebengali'] = 0x09E9;
  17011. t['threecircle'] = 0x2462;
  17012. t['threecircleinversesansserif'] = 0x278C;
  17013. t['threedeva'] = 0x0969;
  17014. t['threeeighths'] = 0x215C;
  17015. t['threegujarati'] = 0x0AE9;
  17016. t['threegurmukhi'] = 0x0A69;
  17017. t['threehackarabic'] = 0x0663;
  17018. t['threehangzhou'] = 0x3023;
  17019. t['threeideographicparen'] = 0x3222;
  17020. t['threeinferior'] = 0x2083;
  17021. t['threemonospace'] = 0xFF13;
  17022. t['threenumeratorbengali'] = 0x09F6;
  17023. t['threeoldstyle'] = 0xF733;
  17024. t['threeparen'] = 0x2476;
  17025. t['threeperiod'] = 0x248A;
  17026. t['threepersian'] = 0x06F3;
  17027. t['threequarters'] = 0x00BE;
  17028. t['threequartersemdash'] = 0xF6DE;
  17029. t['threeroman'] = 0x2172;
  17030. t['threesuperior'] = 0x00B3;
  17031. t['threethai'] = 0x0E53;
  17032. t['thzsquare'] = 0x3394;
  17033. t['tihiragana'] = 0x3061;
  17034. t['tikatakana'] = 0x30C1;
  17035. t['tikatakanahalfwidth'] = 0xFF81;
  17036. t['tikeutacirclekorean'] = 0x3270;
  17037. t['tikeutaparenkorean'] = 0x3210;
  17038. t['tikeutcirclekorean'] = 0x3262;
  17039. t['tikeutkorean'] = 0x3137;
  17040. t['tikeutparenkorean'] = 0x3202;
  17041. t['tilde'] = 0x02DC;
  17042. t['tildebelowcmb'] = 0x0330;
  17043. t['tildecmb'] = 0x0303;
  17044. t['tildecomb'] = 0x0303;
  17045. t['tildedoublecmb'] = 0x0360;
  17046. t['tildeoperator'] = 0x223C;
  17047. t['tildeoverlaycmb'] = 0x0334;
  17048. t['tildeverticalcmb'] = 0x033E;
  17049. t['timescircle'] = 0x2297;
  17050. t['tipehahebrew'] = 0x0596;
  17051. t['tipehalefthebrew'] = 0x0596;
  17052. t['tippigurmukhi'] = 0x0A70;
  17053. t['titlocyrilliccmb'] = 0x0483;
  17054. t['tiwnarmenian'] = 0x057F;
  17055. t['tlinebelow'] = 0x1E6F;
  17056. t['tmonospace'] = 0xFF54;
  17057. t['toarmenian'] = 0x0569;
  17058. t['tohiragana'] = 0x3068;
  17059. t['tokatakana'] = 0x30C8;
  17060. t['tokatakanahalfwidth'] = 0xFF84;
  17061. t['tonebarextrahighmod'] = 0x02E5;
  17062. t['tonebarextralowmod'] = 0x02E9;
  17063. t['tonebarhighmod'] = 0x02E6;
  17064. t['tonebarlowmod'] = 0x02E8;
  17065. t['tonebarmidmod'] = 0x02E7;
  17066. t['tonefive'] = 0x01BD;
  17067. t['tonesix'] = 0x0185;
  17068. t['tonetwo'] = 0x01A8;
  17069. t['tonos'] = 0x0384;
  17070. t['tonsquare'] = 0x3327;
  17071. t['topatakthai'] = 0x0E0F;
  17072. t['tortoiseshellbracketleft'] = 0x3014;
  17073. t['tortoiseshellbracketleftsmall'] = 0xFE5D;
  17074. t['tortoiseshellbracketleftvertical'] = 0xFE39;
  17075. t['tortoiseshellbracketright'] = 0x3015;
  17076. t['tortoiseshellbracketrightsmall'] = 0xFE5E;
  17077. t['tortoiseshellbracketrightvertical'] = 0xFE3A;
  17078. t['totaothai'] = 0x0E15;
  17079. t['tpalatalhook'] = 0x01AB;
  17080. t['tparen'] = 0x24AF;
  17081. t['trademark'] = 0x2122;
  17082. t['trademarksans'] = 0xF8EA;
  17083. t['trademarkserif'] = 0xF6DB;
  17084. t['tretroflexhook'] = 0x0288;
  17085. t['triagdn'] = 0x25BC;
  17086. t['triaglf'] = 0x25C4;
  17087. t['triagrt'] = 0x25BA;
  17088. t['triagup'] = 0x25B2;
  17089. t['ts'] = 0x02A6;
  17090. t['tsadi'] = 0x05E6;
  17091. t['tsadidagesh'] = 0xFB46;
  17092. t['tsadidageshhebrew'] = 0xFB46;
  17093. t['tsadihebrew'] = 0x05E6;
  17094. t['tsecyrillic'] = 0x0446;
  17095. t['tsere'] = 0x05B5;
  17096. t['tsere12'] = 0x05B5;
  17097. t['tsere1e'] = 0x05B5;
  17098. t['tsere2b'] = 0x05B5;
  17099. t['tserehebrew'] = 0x05B5;
  17100. t['tserenarrowhebrew'] = 0x05B5;
  17101. t['tserequarterhebrew'] = 0x05B5;
  17102. t['tserewidehebrew'] = 0x05B5;
  17103. t['tshecyrillic'] = 0x045B;
  17104. t['tsuperior'] = 0xF6F3;
  17105. t['ttabengali'] = 0x099F;
  17106. t['ttadeva'] = 0x091F;
  17107. t['ttagujarati'] = 0x0A9F;
  17108. t['ttagurmukhi'] = 0x0A1F;
  17109. t['tteharabic'] = 0x0679;
  17110. t['ttehfinalarabic'] = 0xFB67;
  17111. t['ttehinitialarabic'] = 0xFB68;
  17112. t['ttehmedialarabic'] = 0xFB69;
  17113. t['tthabengali'] = 0x09A0;
  17114. t['tthadeva'] = 0x0920;
  17115. t['tthagujarati'] = 0x0AA0;
  17116. t['tthagurmukhi'] = 0x0A20;
  17117. t['tturned'] = 0x0287;
  17118. t['tuhiragana'] = 0x3064;
  17119. t['tukatakana'] = 0x30C4;
  17120. t['tukatakanahalfwidth'] = 0xFF82;
  17121. t['tusmallhiragana'] = 0x3063;
  17122. t['tusmallkatakana'] = 0x30C3;
  17123. t['tusmallkatakanahalfwidth'] = 0xFF6F;
  17124. t['twelvecircle'] = 0x246B;
  17125. t['twelveparen'] = 0x247F;
  17126. t['twelveperiod'] = 0x2493;
  17127. t['twelveroman'] = 0x217B;
  17128. t['twentycircle'] = 0x2473;
  17129. t['twentyhangzhou'] = 0x5344;
  17130. t['twentyparen'] = 0x2487;
  17131. t['twentyperiod'] = 0x249B;
  17132. t['two'] = 0x0032;
  17133. t['twoarabic'] = 0x0662;
  17134. t['twobengali'] = 0x09E8;
  17135. t['twocircle'] = 0x2461;
  17136. t['twocircleinversesansserif'] = 0x278B;
  17137. t['twodeva'] = 0x0968;
  17138. t['twodotenleader'] = 0x2025;
  17139. t['twodotleader'] = 0x2025;
  17140. t['twodotleadervertical'] = 0xFE30;
  17141. t['twogujarati'] = 0x0AE8;
  17142. t['twogurmukhi'] = 0x0A68;
  17143. t['twohackarabic'] = 0x0662;
  17144. t['twohangzhou'] = 0x3022;
  17145. t['twoideographicparen'] = 0x3221;
  17146. t['twoinferior'] = 0x2082;
  17147. t['twomonospace'] = 0xFF12;
  17148. t['twonumeratorbengali'] = 0x09F5;
  17149. t['twooldstyle'] = 0xF732;
  17150. t['twoparen'] = 0x2475;
  17151. t['twoperiod'] = 0x2489;
  17152. t['twopersian'] = 0x06F2;
  17153. t['tworoman'] = 0x2171;
  17154. t['twostroke'] = 0x01BB;
  17155. t['twosuperior'] = 0x00B2;
  17156. t['twothai'] = 0x0E52;
  17157. t['twothirds'] = 0x2154;
  17158. t['u'] = 0x0075;
  17159. t['uacute'] = 0x00FA;
  17160. t['ubar'] = 0x0289;
  17161. t['ubengali'] = 0x0989;
  17162. t['ubopomofo'] = 0x3128;
  17163. t['ubreve'] = 0x016D;
  17164. t['ucaron'] = 0x01D4;
  17165. t['ucircle'] = 0x24E4;
  17166. t['ucircumflex'] = 0x00FB;
  17167. t['ucircumflexbelow'] = 0x1E77;
  17168. t['ucyrillic'] = 0x0443;
  17169. t['udattadeva'] = 0x0951;
  17170. t['udblacute'] = 0x0171;
  17171. t['udblgrave'] = 0x0215;
  17172. t['udeva'] = 0x0909;
  17173. t['udieresis'] = 0x00FC;
  17174. t['udieresisacute'] = 0x01D8;
  17175. t['udieresisbelow'] = 0x1E73;
  17176. t['udieresiscaron'] = 0x01DA;
  17177. t['udieresiscyrillic'] = 0x04F1;
  17178. t['udieresisgrave'] = 0x01DC;
  17179. t['udieresismacron'] = 0x01D6;
  17180. t['udotbelow'] = 0x1EE5;
  17181. t['ugrave'] = 0x00F9;
  17182. t['ugujarati'] = 0x0A89;
  17183. t['ugurmukhi'] = 0x0A09;
  17184. t['uhiragana'] = 0x3046;
  17185. t['uhookabove'] = 0x1EE7;
  17186. t['uhorn'] = 0x01B0;
  17187. t['uhornacute'] = 0x1EE9;
  17188. t['uhorndotbelow'] = 0x1EF1;
  17189. t['uhorngrave'] = 0x1EEB;
  17190. t['uhornhookabove'] = 0x1EED;
  17191. t['uhorntilde'] = 0x1EEF;
  17192. t['uhungarumlaut'] = 0x0171;
  17193. t['uhungarumlautcyrillic'] = 0x04F3;
  17194. t['uinvertedbreve'] = 0x0217;
  17195. t['ukatakana'] = 0x30A6;
  17196. t['ukatakanahalfwidth'] = 0xFF73;
  17197. t['ukcyrillic'] = 0x0479;
  17198. t['ukorean'] = 0x315C;
  17199. t['umacron'] = 0x016B;
  17200. t['umacroncyrillic'] = 0x04EF;
  17201. t['umacrondieresis'] = 0x1E7B;
  17202. t['umatragurmukhi'] = 0x0A41;
  17203. t['umonospace'] = 0xFF55;
  17204. t['underscore'] = 0x005F;
  17205. t['underscoredbl'] = 0x2017;
  17206. t['underscoremonospace'] = 0xFF3F;
  17207. t['underscorevertical'] = 0xFE33;
  17208. t['underscorewavy'] = 0xFE4F;
  17209. t['union'] = 0x222A;
  17210. t['universal'] = 0x2200;
  17211. t['uogonek'] = 0x0173;
  17212. t['uparen'] = 0x24B0;
  17213. t['upblock'] = 0x2580;
  17214. t['upperdothebrew'] = 0x05C4;
  17215. t['upsilon'] = 0x03C5;
  17216. t['upsilondieresis'] = 0x03CB;
  17217. t['upsilondieresistonos'] = 0x03B0;
  17218. t['upsilonlatin'] = 0x028A;
  17219. t['upsilontonos'] = 0x03CD;
  17220. t['uptackbelowcmb'] = 0x031D;
  17221. t['uptackmod'] = 0x02D4;
  17222. t['uragurmukhi'] = 0x0A73;
  17223. t['uring'] = 0x016F;
  17224. t['ushortcyrillic'] = 0x045E;
  17225. t['usmallhiragana'] = 0x3045;
  17226. t['usmallkatakana'] = 0x30A5;
  17227. t['usmallkatakanahalfwidth'] = 0xFF69;
  17228. t['ustraightcyrillic'] = 0x04AF;
  17229. t['ustraightstrokecyrillic'] = 0x04B1;
  17230. t['utilde'] = 0x0169;
  17231. t['utildeacute'] = 0x1E79;
  17232. t['utildebelow'] = 0x1E75;
  17233. t['uubengali'] = 0x098A;
  17234. t['uudeva'] = 0x090A;
  17235. t['uugujarati'] = 0x0A8A;
  17236. t['uugurmukhi'] = 0x0A0A;
  17237. t['uumatragurmukhi'] = 0x0A42;
  17238. t['uuvowelsignbengali'] = 0x09C2;
  17239. t['uuvowelsigndeva'] = 0x0942;
  17240. t['uuvowelsigngujarati'] = 0x0AC2;
  17241. t['uvowelsignbengali'] = 0x09C1;
  17242. t['uvowelsigndeva'] = 0x0941;
  17243. t['uvowelsigngujarati'] = 0x0AC1;
  17244. t['v'] = 0x0076;
  17245. t['vadeva'] = 0x0935;
  17246. t['vagujarati'] = 0x0AB5;
  17247. t['vagurmukhi'] = 0x0A35;
  17248. t['vakatakana'] = 0x30F7;
  17249. t['vav'] = 0x05D5;
  17250. t['vavdagesh'] = 0xFB35;
  17251. t['vavdagesh65'] = 0xFB35;
  17252. t['vavdageshhebrew'] = 0xFB35;
  17253. t['vavhebrew'] = 0x05D5;
  17254. t['vavholam'] = 0xFB4B;
  17255. t['vavholamhebrew'] = 0xFB4B;
  17256. t['vavvavhebrew'] = 0x05F0;
  17257. t['vavyodhebrew'] = 0x05F1;
  17258. t['vcircle'] = 0x24E5;
  17259. t['vdotbelow'] = 0x1E7F;
  17260. t['vecyrillic'] = 0x0432;
  17261. t['veharabic'] = 0x06A4;
  17262. t['vehfinalarabic'] = 0xFB6B;
  17263. t['vehinitialarabic'] = 0xFB6C;
  17264. t['vehmedialarabic'] = 0xFB6D;
  17265. t['vekatakana'] = 0x30F9;
  17266. t['venus'] = 0x2640;
  17267. t['verticalbar'] = 0x007C;
  17268. t['verticallineabovecmb'] = 0x030D;
  17269. t['verticallinebelowcmb'] = 0x0329;
  17270. t['verticallinelowmod'] = 0x02CC;
  17271. t['verticallinemod'] = 0x02C8;
  17272. t['vewarmenian'] = 0x057E;
  17273. t['vhook'] = 0x028B;
  17274. t['vikatakana'] = 0x30F8;
  17275. t['viramabengali'] = 0x09CD;
  17276. t['viramadeva'] = 0x094D;
  17277. t['viramagujarati'] = 0x0ACD;
  17278. t['visargabengali'] = 0x0983;
  17279. t['visargadeva'] = 0x0903;
  17280. t['visargagujarati'] = 0x0A83;
  17281. t['vmonospace'] = 0xFF56;
  17282. t['voarmenian'] = 0x0578;
  17283. t['voicediterationhiragana'] = 0x309E;
  17284. t['voicediterationkatakana'] = 0x30FE;
  17285. t['voicedmarkkana'] = 0x309B;
  17286. t['voicedmarkkanahalfwidth'] = 0xFF9E;
  17287. t['vokatakana'] = 0x30FA;
  17288. t['vparen'] = 0x24B1;
  17289. t['vtilde'] = 0x1E7D;
  17290. t['vturned'] = 0x028C;
  17291. t['vuhiragana'] = 0x3094;
  17292. t['vukatakana'] = 0x30F4;
  17293. t['w'] = 0x0077;
  17294. t['wacute'] = 0x1E83;
  17295. t['waekorean'] = 0x3159;
  17296. t['wahiragana'] = 0x308F;
  17297. t['wakatakana'] = 0x30EF;
  17298. t['wakatakanahalfwidth'] = 0xFF9C;
  17299. t['wakorean'] = 0x3158;
  17300. t['wasmallhiragana'] = 0x308E;
  17301. t['wasmallkatakana'] = 0x30EE;
  17302. t['wattosquare'] = 0x3357;
  17303. t['wavedash'] = 0x301C;
  17304. t['wavyunderscorevertical'] = 0xFE34;
  17305. t['wawarabic'] = 0x0648;
  17306. t['wawfinalarabic'] = 0xFEEE;
  17307. t['wawhamzaabovearabic'] = 0x0624;
  17308. t['wawhamzaabovefinalarabic'] = 0xFE86;
  17309. t['wbsquare'] = 0x33DD;
  17310. t['wcircle'] = 0x24E6;
  17311. t['wcircumflex'] = 0x0175;
  17312. t['wdieresis'] = 0x1E85;
  17313. t['wdotaccent'] = 0x1E87;
  17314. t['wdotbelow'] = 0x1E89;
  17315. t['wehiragana'] = 0x3091;
  17316. t['weierstrass'] = 0x2118;
  17317. t['wekatakana'] = 0x30F1;
  17318. t['wekorean'] = 0x315E;
  17319. t['weokorean'] = 0x315D;
  17320. t['wgrave'] = 0x1E81;
  17321. t['whitebullet'] = 0x25E6;
  17322. t['whitecircle'] = 0x25CB;
  17323. t['whitecircleinverse'] = 0x25D9;
  17324. t['whitecornerbracketleft'] = 0x300E;
  17325. t['whitecornerbracketleftvertical'] = 0xFE43;
  17326. t['whitecornerbracketright'] = 0x300F;
  17327. t['whitecornerbracketrightvertical'] = 0xFE44;
  17328. t['whitediamond'] = 0x25C7;
  17329. t['whitediamondcontainingblacksmalldiamond'] = 0x25C8;
  17330. t['whitedownpointingsmalltriangle'] = 0x25BF;
  17331. t['whitedownpointingtriangle'] = 0x25BD;
  17332. t['whiteleftpointingsmalltriangle'] = 0x25C3;
  17333. t['whiteleftpointingtriangle'] = 0x25C1;
  17334. t['whitelenticularbracketleft'] = 0x3016;
  17335. t['whitelenticularbracketright'] = 0x3017;
  17336. t['whiterightpointingsmalltriangle'] = 0x25B9;
  17337. t['whiterightpointingtriangle'] = 0x25B7;
  17338. t['whitesmallsquare'] = 0x25AB;
  17339. t['whitesmilingface'] = 0x263A;
  17340. t['whitesquare'] = 0x25A1;
  17341. t['whitestar'] = 0x2606;
  17342. t['whitetelephone'] = 0x260F;
  17343. t['whitetortoiseshellbracketleft'] = 0x3018;
  17344. t['whitetortoiseshellbracketright'] = 0x3019;
  17345. t['whiteuppointingsmalltriangle'] = 0x25B5;
  17346. t['whiteuppointingtriangle'] = 0x25B3;
  17347. t['wihiragana'] = 0x3090;
  17348. t['wikatakana'] = 0x30F0;
  17349. t['wikorean'] = 0x315F;
  17350. t['wmonospace'] = 0xFF57;
  17351. t['wohiragana'] = 0x3092;
  17352. t['wokatakana'] = 0x30F2;
  17353. t['wokatakanahalfwidth'] = 0xFF66;
  17354. t['won'] = 0x20A9;
  17355. t['wonmonospace'] = 0xFFE6;
  17356. t['wowaenthai'] = 0x0E27;
  17357. t['wparen'] = 0x24B2;
  17358. t['wring'] = 0x1E98;
  17359. t['wsuperior'] = 0x02B7;
  17360. t['wturned'] = 0x028D;
  17361. t['wynn'] = 0x01BF;
  17362. t['x'] = 0x0078;
  17363. t['xabovecmb'] = 0x033D;
  17364. t['xbopomofo'] = 0x3112;
  17365. t['xcircle'] = 0x24E7;
  17366. t['xdieresis'] = 0x1E8D;
  17367. t['xdotaccent'] = 0x1E8B;
  17368. t['xeharmenian'] = 0x056D;
  17369. t['xi'] = 0x03BE;
  17370. t['xmonospace'] = 0xFF58;
  17371. t['xparen'] = 0x24B3;
  17372. t['xsuperior'] = 0x02E3;
  17373. t['y'] = 0x0079;
  17374. t['yaadosquare'] = 0x334E;
  17375. t['yabengali'] = 0x09AF;
  17376. t['yacute'] = 0x00FD;
  17377. t['yadeva'] = 0x092F;
  17378. t['yaekorean'] = 0x3152;
  17379. t['yagujarati'] = 0x0AAF;
  17380. t['yagurmukhi'] = 0x0A2F;
  17381. t['yahiragana'] = 0x3084;
  17382. t['yakatakana'] = 0x30E4;
  17383. t['yakatakanahalfwidth'] = 0xFF94;
  17384. t['yakorean'] = 0x3151;
  17385. t['yamakkanthai'] = 0x0E4E;
  17386. t['yasmallhiragana'] = 0x3083;
  17387. t['yasmallkatakana'] = 0x30E3;
  17388. t['yasmallkatakanahalfwidth'] = 0xFF6C;
  17389. t['yatcyrillic'] = 0x0463;
  17390. t['ycircle'] = 0x24E8;
  17391. t['ycircumflex'] = 0x0177;
  17392. t['ydieresis'] = 0x00FF;
  17393. t['ydotaccent'] = 0x1E8F;
  17394. t['ydotbelow'] = 0x1EF5;
  17395. t['yeharabic'] = 0x064A;
  17396. t['yehbarreearabic'] = 0x06D2;
  17397. t['yehbarreefinalarabic'] = 0xFBAF;
  17398. t['yehfinalarabic'] = 0xFEF2;
  17399. t['yehhamzaabovearabic'] = 0x0626;
  17400. t['yehhamzaabovefinalarabic'] = 0xFE8A;
  17401. t['yehhamzaaboveinitialarabic'] = 0xFE8B;
  17402. t['yehhamzaabovemedialarabic'] = 0xFE8C;
  17403. t['yehinitialarabic'] = 0xFEF3;
  17404. t['yehmedialarabic'] = 0xFEF4;
  17405. t['yehmeeminitialarabic'] = 0xFCDD;
  17406. t['yehmeemisolatedarabic'] = 0xFC58;
  17407. t['yehnoonfinalarabic'] = 0xFC94;
  17408. t['yehthreedotsbelowarabic'] = 0x06D1;
  17409. t['yekorean'] = 0x3156;
  17410. t['yen'] = 0x00A5;
  17411. t['yenmonospace'] = 0xFFE5;
  17412. t['yeokorean'] = 0x3155;
  17413. t['yeorinhieuhkorean'] = 0x3186;
  17414. t['yerahbenyomohebrew'] = 0x05AA;
  17415. t['yerahbenyomolefthebrew'] = 0x05AA;
  17416. t['yericyrillic'] = 0x044B;
  17417. t['yerudieresiscyrillic'] = 0x04F9;
  17418. t['yesieungkorean'] = 0x3181;
  17419. t['yesieungpansioskorean'] = 0x3183;
  17420. t['yesieungsioskorean'] = 0x3182;
  17421. t['yetivhebrew'] = 0x059A;
  17422. t['ygrave'] = 0x1EF3;
  17423. t['yhook'] = 0x01B4;
  17424. t['yhookabove'] = 0x1EF7;
  17425. t['yiarmenian'] = 0x0575;
  17426. t['yicyrillic'] = 0x0457;
  17427. t['yikorean'] = 0x3162;
  17428. t['yinyang'] = 0x262F;
  17429. t['yiwnarmenian'] = 0x0582;
  17430. t['ymonospace'] = 0xFF59;
  17431. t['yod'] = 0x05D9;
  17432. t['yoddagesh'] = 0xFB39;
  17433. t['yoddageshhebrew'] = 0xFB39;
  17434. t['yodhebrew'] = 0x05D9;
  17435. t['yodyodhebrew'] = 0x05F2;
  17436. t['yodyodpatahhebrew'] = 0xFB1F;
  17437. t['yohiragana'] = 0x3088;
  17438. t['yoikorean'] = 0x3189;
  17439. t['yokatakana'] = 0x30E8;
  17440. t['yokatakanahalfwidth'] = 0xFF96;
  17441. t['yokorean'] = 0x315B;
  17442. t['yosmallhiragana'] = 0x3087;
  17443. t['yosmallkatakana'] = 0x30E7;
  17444. t['yosmallkatakanahalfwidth'] = 0xFF6E;
  17445. t['yotgreek'] = 0x03F3;
  17446. t['yoyaekorean'] = 0x3188;
  17447. t['yoyakorean'] = 0x3187;
  17448. t['yoyakthai'] = 0x0E22;
  17449. t['yoyingthai'] = 0x0E0D;
  17450. t['yparen'] = 0x24B4;
  17451. t['ypogegrammeni'] = 0x037A;
  17452. t['ypogegrammenigreekcmb'] = 0x0345;
  17453. t['yr'] = 0x01A6;
  17454. t['yring'] = 0x1E99;
  17455. t['ysuperior'] = 0x02B8;
  17456. t['ytilde'] = 0x1EF9;
  17457. t['yturned'] = 0x028E;
  17458. t['yuhiragana'] = 0x3086;
  17459. t['yuikorean'] = 0x318C;
  17460. t['yukatakana'] = 0x30E6;
  17461. t['yukatakanahalfwidth'] = 0xFF95;
  17462. t['yukorean'] = 0x3160;
  17463. t['yusbigcyrillic'] = 0x046B;
  17464. t['yusbigiotifiedcyrillic'] = 0x046D;
  17465. t['yuslittlecyrillic'] = 0x0467;
  17466. t['yuslittleiotifiedcyrillic'] = 0x0469;
  17467. t['yusmallhiragana'] = 0x3085;
  17468. t['yusmallkatakana'] = 0x30E5;
  17469. t['yusmallkatakanahalfwidth'] = 0xFF6D;
  17470. t['yuyekorean'] = 0x318B;
  17471. t['yuyeokorean'] = 0x318A;
  17472. t['yyabengali'] = 0x09DF;
  17473. t['yyadeva'] = 0x095F;
  17474. t['z'] = 0x007A;
  17475. t['zaarmenian'] = 0x0566;
  17476. t['zacute'] = 0x017A;
  17477. t['zadeva'] = 0x095B;
  17478. t['zagurmukhi'] = 0x0A5B;
  17479. t['zaharabic'] = 0x0638;
  17480. t['zahfinalarabic'] = 0xFEC6;
  17481. t['zahinitialarabic'] = 0xFEC7;
  17482. t['zahiragana'] = 0x3056;
  17483. t['zahmedialarabic'] = 0xFEC8;
  17484. t['zainarabic'] = 0x0632;
  17485. t['zainfinalarabic'] = 0xFEB0;
  17486. t['zakatakana'] = 0x30B6;
  17487. t['zaqefgadolhebrew'] = 0x0595;
  17488. t['zaqefqatanhebrew'] = 0x0594;
  17489. t['zarqahebrew'] = 0x0598;
  17490. t['zayin'] = 0x05D6;
  17491. t['zayindagesh'] = 0xFB36;
  17492. t['zayindageshhebrew'] = 0xFB36;
  17493. t['zayinhebrew'] = 0x05D6;
  17494. t['zbopomofo'] = 0x3117;
  17495. t['zcaron'] = 0x017E;
  17496. t['zcircle'] = 0x24E9;
  17497. t['zcircumflex'] = 0x1E91;
  17498. t['zcurl'] = 0x0291;
  17499. t['zdot'] = 0x017C;
  17500. t['zdotaccent'] = 0x017C;
  17501. t['zdotbelow'] = 0x1E93;
  17502. t['zecyrillic'] = 0x0437;
  17503. t['zedescendercyrillic'] = 0x0499;
  17504. t['zedieresiscyrillic'] = 0x04DF;
  17505. t['zehiragana'] = 0x305C;
  17506. t['zekatakana'] = 0x30BC;
  17507. t['zero'] = 0x0030;
  17508. t['zeroarabic'] = 0x0660;
  17509. t['zerobengali'] = 0x09E6;
  17510. t['zerodeva'] = 0x0966;
  17511. t['zerogujarati'] = 0x0AE6;
  17512. t['zerogurmukhi'] = 0x0A66;
  17513. t['zerohackarabic'] = 0x0660;
  17514. t['zeroinferior'] = 0x2080;
  17515. t['zeromonospace'] = 0xFF10;
  17516. t['zerooldstyle'] = 0xF730;
  17517. t['zeropersian'] = 0x06F0;
  17518. t['zerosuperior'] = 0x2070;
  17519. t['zerothai'] = 0x0E50;
  17520. t['zerowidthjoiner'] = 0xFEFF;
  17521. t['zerowidthnonjoiner'] = 0x200C;
  17522. t['zerowidthspace'] = 0x200B;
  17523. t['zeta'] = 0x03B6;
  17524. t['zhbopomofo'] = 0x3113;
  17525. t['zhearmenian'] = 0x056A;
  17526. t['zhebrevecyrillic'] = 0x04C2;
  17527. t['zhecyrillic'] = 0x0436;
  17528. t['zhedescendercyrillic'] = 0x0497;
  17529. t['zhedieresiscyrillic'] = 0x04DD;
  17530. t['zihiragana'] = 0x3058;
  17531. t['zikatakana'] = 0x30B8;
  17532. t['zinorhebrew'] = 0x05AE;
  17533. t['zlinebelow'] = 0x1E95;
  17534. t['zmonospace'] = 0xFF5A;
  17535. t['zohiragana'] = 0x305E;
  17536. t['zokatakana'] = 0x30BE;
  17537. t['zparen'] = 0x24B5;
  17538. t['zretroflexhook'] = 0x0290;
  17539. t['zstroke'] = 0x01B6;
  17540. t['zuhiragana'] = 0x305A;
  17541. t['zukatakana'] = 0x30BA;
  17542. t['.notdef'] = 0x0000;
  17543. t['angbracketleftbig'] = 0x2329;
  17544. t['angbracketleftBig'] = 0x2329;
  17545. t['angbracketleftbigg'] = 0x2329;
  17546. t['angbracketleftBigg'] = 0x2329;
  17547. t['angbracketrightBig'] = 0x232A;
  17548. t['angbracketrightbig'] = 0x232A;
  17549. t['angbracketrightBigg'] = 0x232A;
  17550. t['angbracketrightbigg'] = 0x232A;
  17551. t['arrowhookleft'] = 0x21AA;
  17552. t['arrowhookright'] = 0x21A9;
  17553. t['arrowlefttophalf'] = 0x21BC;
  17554. t['arrowleftbothalf'] = 0x21BD;
  17555. t['arrownortheast'] = 0x2197;
  17556. t['arrownorthwest'] = 0x2196;
  17557. t['arrowrighttophalf'] = 0x21C0;
  17558. t['arrowrightbothalf'] = 0x21C1;
  17559. t['arrowsoutheast'] = 0x2198;
  17560. t['arrowsouthwest'] = 0x2199;
  17561. t['backslashbig'] = 0x2216;
  17562. t['backslashBig'] = 0x2216;
  17563. t['backslashBigg'] = 0x2216;
  17564. t['backslashbigg'] = 0x2216;
  17565. t['bardbl'] = 0x2016;
  17566. t['bracehtipdownleft'] = 0xFE37;
  17567. t['bracehtipdownright'] = 0xFE37;
  17568. t['bracehtipupleft'] = 0xFE38;
  17569. t['bracehtipupright'] = 0xFE38;
  17570. t['braceleftBig'] = 0x007B;
  17571. t['braceleftbig'] = 0x007B;
  17572. t['braceleftbigg'] = 0x007B;
  17573. t['braceleftBigg'] = 0x007B;
  17574. t['bracerightBig'] = 0x007D;
  17575. t['bracerightbig'] = 0x007D;
  17576. t['bracerightbigg'] = 0x007D;
  17577. t['bracerightBigg'] = 0x007D;
  17578. t['bracketleftbig'] = 0x005B;
  17579. t['bracketleftBig'] = 0x005B;
  17580. t['bracketleftbigg'] = 0x005B;
  17581. t['bracketleftBigg'] = 0x005B;
  17582. t['bracketrightBig'] = 0x005D;
  17583. t['bracketrightbig'] = 0x005D;
  17584. t['bracketrightbigg'] = 0x005D;
  17585. t['bracketrightBigg'] = 0x005D;
  17586. t['ceilingleftbig'] = 0x2308;
  17587. t['ceilingleftBig'] = 0x2308;
  17588. t['ceilingleftBigg'] = 0x2308;
  17589. t['ceilingleftbigg'] = 0x2308;
  17590. t['ceilingrightbig'] = 0x2309;
  17591. t['ceilingrightBig'] = 0x2309;
  17592. t['ceilingrightbigg'] = 0x2309;
  17593. t['ceilingrightBigg'] = 0x2309;
  17594. t['circledotdisplay'] = 0x2299;
  17595. t['circledottext'] = 0x2299;
  17596. t['circlemultiplydisplay'] = 0x2297;
  17597. t['circlemultiplytext'] = 0x2297;
  17598. t['circleplusdisplay'] = 0x2295;
  17599. t['circleplustext'] = 0x2295;
  17600. t['contintegraldisplay'] = 0x222E;
  17601. t['contintegraltext'] = 0x222E;
  17602. t['coproductdisplay'] = 0x2210;
  17603. t['coproducttext'] = 0x2210;
  17604. t['floorleftBig'] = 0x230A;
  17605. t['floorleftbig'] = 0x230A;
  17606. t['floorleftbigg'] = 0x230A;
  17607. t['floorleftBigg'] = 0x230A;
  17608. t['floorrightbig'] = 0x230B;
  17609. t['floorrightBig'] = 0x230B;
  17610. t['floorrightBigg'] = 0x230B;
  17611. t['floorrightbigg'] = 0x230B;
  17612. t['hatwide'] = 0x0302;
  17613. t['hatwider'] = 0x0302;
  17614. t['hatwidest'] = 0x0302;
  17615. t['intercal'] = 0x1D40;
  17616. t['integraldisplay'] = 0x222B;
  17617. t['integraltext'] = 0x222B;
  17618. t['intersectiondisplay'] = 0x22C2;
  17619. t['intersectiontext'] = 0x22C2;
  17620. t['logicalanddisplay'] = 0x2227;
  17621. t['logicalandtext'] = 0x2227;
  17622. t['logicalordisplay'] = 0x2228;
  17623. t['logicalortext'] = 0x2228;
  17624. t['parenleftBig'] = 0x0028;
  17625. t['parenleftbig'] = 0x0028;
  17626. t['parenleftBigg'] = 0x0028;
  17627. t['parenleftbigg'] = 0x0028;
  17628. t['parenrightBig'] = 0x0029;
  17629. t['parenrightbig'] = 0x0029;
  17630. t['parenrightBigg'] = 0x0029;
  17631. t['parenrightbigg'] = 0x0029;
  17632. t['prime'] = 0x2032;
  17633. t['productdisplay'] = 0x220F;
  17634. t['producttext'] = 0x220F;
  17635. t['radicalbig'] = 0x221A;
  17636. t['radicalBig'] = 0x221A;
  17637. t['radicalBigg'] = 0x221A;
  17638. t['radicalbigg'] = 0x221A;
  17639. t['radicalbt'] = 0x221A;
  17640. t['radicaltp'] = 0x221A;
  17641. t['radicalvertex'] = 0x221A;
  17642. t['slashbig'] = 0x002F;
  17643. t['slashBig'] = 0x002F;
  17644. t['slashBigg'] = 0x002F;
  17645. t['slashbigg'] = 0x002F;
  17646. t['summationdisplay'] = 0x2211;
  17647. t['summationtext'] = 0x2211;
  17648. t['tildewide'] = 0x02DC;
  17649. t['tildewider'] = 0x02DC;
  17650. t['tildewidest'] = 0x02DC;
  17651. t['uniondisplay'] = 0x22C3;
  17652. t['unionmultidisplay'] = 0x228E;
  17653. t['unionmultitext'] = 0x228E;
  17654. t['unionsqdisplay'] = 0x2294;
  17655. t['unionsqtext'] = 0x2294;
  17656. t['uniontext'] = 0x22C3;
  17657. t['vextenddouble'] = 0x2225;
  17658. t['vextendsingle'] = 0x2223;
  17659. });
  17660. var getDingbatsGlyphsUnicode = getLookupTableFactory(function (t) {
  17661. t['space'] = 0x0020;
  17662. t['a1'] = 0x2701;
  17663. t['a2'] = 0x2702;
  17664. t['a202'] = 0x2703;
  17665. t['a3'] = 0x2704;
  17666. t['a4'] = 0x260E;
  17667. t['a5'] = 0x2706;
  17668. t['a119'] = 0x2707;
  17669. t['a118'] = 0x2708;
  17670. t['a117'] = 0x2709;
  17671. t['a11'] = 0x261B;
  17672. t['a12'] = 0x261E;
  17673. t['a13'] = 0x270C;
  17674. t['a14'] = 0x270D;
  17675. t['a15'] = 0x270E;
  17676. t['a16'] = 0x270F;
  17677. t['a105'] = 0x2710;
  17678. t['a17'] = 0x2711;
  17679. t['a18'] = 0x2712;
  17680. t['a19'] = 0x2713;
  17681. t['a20'] = 0x2714;
  17682. t['a21'] = 0x2715;
  17683. t['a22'] = 0x2716;
  17684. t['a23'] = 0x2717;
  17685. t['a24'] = 0x2718;
  17686. t['a25'] = 0x2719;
  17687. t['a26'] = 0x271A;
  17688. t['a27'] = 0x271B;
  17689. t['a28'] = 0x271C;
  17690. t['a6'] = 0x271D;
  17691. t['a7'] = 0x271E;
  17692. t['a8'] = 0x271F;
  17693. t['a9'] = 0x2720;
  17694. t['a10'] = 0x2721;
  17695. t['a29'] = 0x2722;
  17696. t['a30'] = 0x2723;
  17697. t['a31'] = 0x2724;
  17698. t['a32'] = 0x2725;
  17699. t['a33'] = 0x2726;
  17700. t['a34'] = 0x2727;
  17701. t['a35'] = 0x2605;
  17702. t['a36'] = 0x2729;
  17703. t['a37'] = 0x272A;
  17704. t['a38'] = 0x272B;
  17705. t['a39'] = 0x272C;
  17706. t['a40'] = 0x272D;
  17707. t['a41'] = 0x272E;
  17708. t['a42'] = 0x272F;
  17709. t['a43'] = 0x2730;
  17710. t['a44'] = 0x2731;
  17711. t['a45'] = 0x2732;
  17712. t['a46'] = 0x2733;
  17713. t['a47'] = 0x2734;
  17714. t['a48'] = 0x2735;
  17715. t['a49'] = 0x2736;
  17716. t['a50'] = 0x2737;
  17717. t['a51'] = 0x2738;
  17718. t['a52'] = 0x2739;
  17719. t['a53'] = 0x273A;
  17720. t['a54'] = 0x273B;
  17721. t['a55'] = 0x273C;
  17722. t['a56'] = 0x273D;
  17723. t['a57'] = 0x273E;
  17724. t['a58'] = 0x273F;
  17725. t['a59'] = 0x2740;
  17726. t['a60'] = 0x2741;
  17727. t['a61'] = 0x2742;
  17728. t['a62'] = 0x2743;
  17729. t['a63'] = 0x2744;
  17730. t['a64'] = 0x2745;
  17731. t['a65'] = 0x2746;
  17732. t['a66'] = 0x2747;
  17733. t['a67'] = 0x2748;
  17734. t['a68'] = 0x2749;
  17735. t['a69'] = 0x274A;
  17736. t['a70'] = 0x274B;
  17737. t['a71'] = 0x25CF;
  17738. t['a72'] = 0x274D;
  17739. t['a73'] = 0x25A0;
  17740. t['a74'] = 0x274F;
  17741. t['a203'] = 0x2750;
  17742. t['a75'] = 0x2751;
  17743. t['a204'] = 0x2752;
  17744. t['a76'] = 0x25B2;
  17745. t['a77'] = 0x25BC;
  17746. t['a78'] = 0x25C6;
  17747. t['a79'] = 0x2756;
  17748. t['a81'] = 0x25D7;
  17749. t['a82'] = 0x2758;
  17750. t['a83'] = 0x2759;
  17751. t['a84'] = 0x275A;
  17752. t['a97'] = 0x275B;
  17753. t['a98'] = 0x275C;
  17754. t['a99'] = 0x275D;
  17755. t['a100'] = 0x275E;
  17756. t['a101'] = 0x2761;
  17757. t['a102'] = 0x2762;
  17758. t['a103'] = 0x2763;
  17759. t['a104'] = 0x2764;
  17760. t['a106'] = 0x2765;
  17761. t['a107'] = 0x2766;
  17762. t['a108'] = 0x2767;
  17763. t['a112'] = 0x2663;
  17764. t['a111'] = 0x2666;
  17765. t['a110'] = 0x2665;
  17766. t['a109'] = 0x2660;
  17767. t['a120'] = 0x2460;
  17768. t['a121'] = 0x2461;
  17769. t['a122'] = 0x2462;
  17770. t['a123'] = 0x2463;
  17771. t['a124'] = 0x2464;
  17772. t['a125'] = 0x2465;
  17773. t['a126'] = 0x2466;
  17774. t['a127'] = 0x2467;
  17775. t['a128'] = 0x2468;
  17776. t['a129'] = 0x2469;
  17777. t['a130'] = 0x2776;
  17778. t['a131'] = 0x2777;
  17779. t['a132'] = 0x2778;
  17780. t['a133'] = 0x2779;
  17781. t['a134'] = 0x277A;
  17782. t['a135'] = 0x277B;
  17783. t['a136'] = 0x277C;
  17784. t['a137'] = 0x277D;
  17785. t['a138'] = 0x277E;
  17786. t['a139'] = 0x277F;
  17787. t['a140'] = 0x2780;
  17788. t['a141'] = 0x2781;
  17789. t['a142'] = 0x2782;
  17790. t['a143'] = 0x2783;
  17791. t['a144'] = 0x2784;
  17792. t['a145'] = 0x2785;
  17793. t['a146'] = 0x2786;
  17794. t['a147'] = 0x2787;
  17795. t['a148'] = 0x2788;
  17796. t['a149'] = 0x2789;
  17797. t['a150'] = 0x278A;
  17798. t['a151'] = 0x278B;
  17799. t['a152'] = 0x278C;
  17800. t['a153'] = 0x278D;
  17801. t['a154'] = 0x278E;
  17802. t['a155'] = 0x278F;
  17803. t['a156'] = 0x2790;
  17804. t['a157'] = 0x2791;
  17805. t['a158'] = 0x2792;
  17806. t['a159'] = 0x2793;
  17807. t['a160'] = 0x2794;
  17808. t['a161'] = 0x2192;
  17809. t['a163'] = 0x2194;
  17810. t['a164'] = 0x2195;
  17811. t['a196'] = 0x2798;
  17812. t['a165'] = 0x2799;
  17813. t['a192'] = 0x279A;
  17814. t['a166'] = 0x279B;
  17815. t['a167'] = 0x279C;
  17816. t['a168'] = 0x279D;
  17817. t['a169'] = 0x279E;
  17818. t['a170'] = 0x279F;
  17819. t['a171'] = 0x27A0;
  17820. t['a172'] = 0x27A1;
  17821. t['a173'] = 0x27A2;
  17822. t['a162'] = 0x27A3;
  17823. t['a174'] = 0x27A4;
  17824. t['a175'] = 0x27A5;
  17825. t['a176'] = 0x27A6;
  17826. t['a177'] = 0x27A7;
  17827. t['a178'] = 0x27A8;
  17828. t['a179'] = 0x27A9;
  17829. t['a193'] = 0x27AA;
  17830. t['a180'] = 0x27AB;
  17831. t['a199'] = 0x27AC;
  17832. t['a181'] = 0x27AD;
  17833. t['a200'] = 0x27AE;
  17834. t['a182'] = 0x27AF;
  17835. t['a201'] = 0x27B1;
  17836. t['a183'] = 0x27B2;
  17837. t['a184'] = 0x27B3;
  17838. t['a197'] = 0x27B4;
  17839. t['a185'] = 0x27B5;
  17840. t['a194'] = 0x27B6;
  17841. t['a198'] = 0x27B7;
  17842. t['a186'] = 0x27B8;
  17843. t['a195'] = 0x27B9;
  17844. t['a187'] = 0x27BA;
  17845. t['a188'] = 0x27BB;
  17846. t['a189'] = 0x27BC;
  17847. t['a190'] = 0x27BD;
  17848. t['a191'] = 0x27BE;
  17849. t['a89'] = 0x2768;
  17850. t['a90'] = 0x2769;
  17851. t['a93'] = 0x276A;
  17852. t['a94'] = 0x276B;
  17853. t['a91'] = 0x276C;
  17854. t['a92'] = 0x276D;
  17855. t['a205'] = 0x276E;
  17856. t['a85'] = 0x276F;
  17857. t['a206'] = 0x2770;
  17858. t['a86'] = 0x2771;
  17859. t['a87'] = 0x2772;
  17860. t['a88'] = 0x2773;
  17861. t['a95'] = 0x2774;
  17862. t['a96'] = 0x2775;
  17863. t['.notdef'] = 0x0000;
  17864. });
  17865. exports.getGlyphsUnicode = getGlyphsUnicode;
  17866. exports.getDingbatsGlyphsUnicode = getDingbatsGlyphsUnicode;
  17867. /***/ }),
  17868. /* 8 */
  17869. /***/ (function(module, exports, __w_pdfjs_require__) {
  17870. "use strict";
  17871. var sharedUtil = __w_pdfjs_require__(0);
  17872. var corePrimitives = __w_pdfjs_require__(1);
  17873. var corePdfManager = __w_pdfjs_require__(33);
  17874. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  17875. var InvalidPDFException = sharedUtil.InvalidPDFException;
  17876. var MessageHandler = sharedUtil.MessageHandler;
  17877. var MissingPDFException = sharedUtil.MissingPDFException;
  17878. var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
  17879. var PasswordException = sharedUtil.PasswordException;
  17880. var UnknownErrorException = sharedUtil.UnknownErrorException;
  17881. var XRefParseException = sharedUtil.XRefParseException;
  17882. var arrayByteLength = sharedUtil.arrayByteLength;
  17883. var arraysToBytes = sharedUtil.arraysToBytes;
  17884. var assert = sharedUtil.assert;
  17885. var createPromiseCapability = sharedUtil.createPromiseCapability;
  17886. var info = sharedUtil.info;
  17887. var warn = sharedUtil.warn;
  17888. var setVerbosityLevel = sharedUtil.setVerbosityLevel;
  17889. var isNodeJS = sharedUtil.isNodeJS;
  17890. var Ref = corePrimitives.Ref;
  17891. var LocalPdfManager = corePdfManager.LocalPdfManager;
  17892. var NetworkPdfManager = corePdfManager.NetworkPdfManager;
  17893. var WorkerTask = function WorkerTaskClosure() {
  17894. function WorkerTask(name) {
  17895. this.name = name;
  17896. this.terminated = false;
  17897. this._capability = createPromiseCapability();
  17898. }
  17899. WorkerTask.prototype = {
  17900. get finished() {
  17901. return this._capability.promise;
  17902. },
  17903. finish: function () {
  17904. this._capability.resolve();
  17905. },
  17906. terminate: function () {
  17907. this.terminated = true;
  17908. },
  17909. ensureNotTerminated: function () {
  17910. if (this.terminated) {
  17911. throw new Error('Worker task was terminated');
  17912. }
  17913. }
  17914. };
  17915. return WorkerTask;
  17916. }();
  17917. var PDFWorkerStream = function PDFWorkerStreamClosure() {
  17918. function PDFWorkerStream(params, msgHandler) {
  17919. this._queuedChunks = [];
  17920. var initialData = params.initialData;
  17921. if (initialData && initialData.length > 0) {
  17922. this._queuedChunks.push(initialData);
  17923. }
  17924. this._msgHandler = msgHandler;
  17925. this._isRangeSupported = !params.disableRange;
  17926. this._isStreamingSupported = !params.disableStream;
  17927. this._contentLength = params.length;
  17928. this._fullRequestReader = null;
  17929. this._rangeReaders = [];
  17930. msgHandler.on('OnDataRange', this._onReceiveData.bind(this));
  17931. msgHandler.on('OnDataProgress', this._onProgress.bind(this));
  17932. }
  17933. PDFWorkerStream.prototype = {
  17934. _onReceiveData: function PDFWorkerStream_onReceiveData(args) {
  17935. if (args.begin === undefined) {
  17936. if (this._fullRequestReader) {
  17937. this._fullRequestReader._enqueue(args.chunk);
  17938. } else {
  17939. this._queuedChunks.push(args.chunk);
  17940. }
  17941. } else {
  17942. var found = this._rangeReaders.some(function (rangeReader) {
  17943. if (rangeReader._begin !== args.begin) {
  17944. return false;
  17945. }
  17946. rangeReader._enqueue(args.chunk);
  17947. return true;
  17948. });
  17949. assert(found);
  17950. }
  17951. },
  17952. _onProgress: function PDFWorkerStream_onProgress(evt) {
  17953. if (this._rangeReaders.length > 0) {
  17954. var firstReader = this._rangeReaders[0];
  17955. if (firstReader.onProgress) {
  17956. firstReader.onProgress({ loaded: evt.loaded });
  17957. }
  17958. }
  17959. },
  17960. _removeRangeReader: function PDFWorkerStream_removeRangeReader(reader) {
  17961. var i = this._rangeReaders.indexOf(reader);
  17962. if (i >= 0) {
  17963. this._rangeReaders.splice(i, 1);
  17964. }
  17965. },
  17966. getFullReader: function PDFWorkerStream_getFullReader() {
  17967. assert(!this._fullRequestReader);
  17968. var queuedChunks = this._queuedChunks;
  17969. this._queuedChunks = null;
  17970. return new PDFWorkerStreamReader(this, queuedChunks);
  17971. },
  17972. getRangeReader: function PDFWorkerStream_getRangeReader(begin, end) {
  17973. var reader = new PDFWorkerStreamRangeReader(this, begin, end);
  17974. this._msgHandler.send('RequestDataRange', {
  17975. begin: begin,
  17976. end: end
  17977. });
  17978. this._rangeReaders.push(reader);
  17979. return reader;
  17980. },
  17981. cancelAllRequests: function PDFWorkerStream_cancelAllRequests(reason) {
  17982. if (this._fullRequestReader) {
  17983. this._fullRequestReader.cancel(reason);
  17984. }
  17985. var readers = this._rangeReaders.slice(0);
  17986. readers.forEach(function (rangeReader) {
  17987. rangeReader.cancel(reason);
  17988. });
  17989. }
  17990. };
  17991. function PDFWorkerStreamReader(stream, queuedChunks) {
  17992. this._stream = stream;
  17993. this._done = false;
  17994. this._queuedChunks = queuedChunks || [];
  17995. this._requests = [];
  17996. this._headersReady = Promise.resolve();
  17997. stream._fullRequestReader = this;
  17998. this.onProgress = null;
  17999. }
  18000. PDFWorkerStreamReader.prototype = {
  18001. _enqueue: function PDFWorkerStreamReader_enqueue(chunk) {
  18002. if (this._done) {
  18003. return;
  18004. }
  18005. if (this._requests.length > 0) {
  18006. var requestCapability = this._requests.shift();
  18007. requestCapability.resolve({
  18008. value: chunk,
  18009. done: false
  18010. });
  18011. return;
  18012. }
  18013. this._queuedChunks.push(chunk);
  18014. },
  18015. get headersReady() {
  18016. return this._headersReady;
  18017. },
  18018. get isRangeSupported() {
  18019. return this._stream._isRangeSupported;
  18020. },
  18021. get isStreamingSupported() {
  18022. return this._stream._isStreamingSupported;
  18023. },
  18024. get contentLength() {
  18025. return this._stream._contentLength;
  18026. },
  18027. read: function PDFWorkerStreamReader_read() {
  18028. if (this._queuedChunks.length > 0) {
  18029. var chunk = this._queuedChunks.shift();
  18030. return Promise.resolve({
  18031. value: chunk,
  18032. done: false
  18033. });
  18034. }
  18035. if (this._done) {
  18036. return Promise.resolve({
  18037. value: undefined,
  18038. done: true
  18039. });
  18040. }
  18041. var requestCapability = createPromiseCapability();
  18042. this._requests.push(requestCapability);
  18043. return requestCapability.promise;
  18044. },
  18045. cancel: function PDFWorkerStreamReader_cancel(reason) {
  18046. this._done = true;
  18047. this._requests.forEach(function (requestCapability) {
  18048. requestCapability.resolve({
  18049. value: undefined,
  18050. done: true
  18051. });
  18052. });
  18053. this._requests = [];
  18054. }
  18055. };
  18056. function PDFWorkerStreamRangeReader(stream, begin, end) {
  18057. this._stream = stream;
  18058. this._begin = begin;
  18059. this._end = end;
  18060. this._queuedChunk = null;
  18061. this._requests = [];
  18062. this._done = false;
  18063. this.onProgress = null;
  18064. }
  18065. PDFWorkerStreamRangeReader.prototype = {
  18066. _enqueue: function PDFWorkerStreamRangeReader_enqueue(chunk) {
  18067. if (this._done) {
  18068. return;
  18069. }
  18070. if (this._requests.length === 0) {
  18071. this._queuedChunk = chunk;
  18072. } else {
  18073. var requestsCapability = this._requests.shift();
  18074. requestsCapability.resolve({
  18075. value: chunk,
  18076. done: false
  18077. });
  18078. this._requests.forEach(function (requestCapability) {
  18079. requestCapability.resolve({
  18080. value: undefined,
  18081. done: true
  18082. });
  18083. });
  18084. this._requests = [];
  18085. }
  18086. this._done = true;
  18087. this._stream._removeRangeReader(this);
  18088. },
  18089. get isStreamingSupported() {
  18090. return false;
  18091. },
  18092. read: function PDFWorkerStreamRangeReader_read() {
  18093. if (this._queuedChunk) {
  18094. return Promise.resolve({
  18095. value: this._queuedChunk,
  18096. done: false
  18097. });
  18098. }
  18099. if (this._done) {
  18100. return Promise.resolve({
  18101. value: undefined,
  18102. done: true
  18103. });
  18104. }
  18105. var requestCapability = createPromiseCapability();
  18106. this._requests.push(requestCapability);
  18107. return requestCapability.promise;
  18108. },
  18109. cancel: function PDFWorkerStreamRangeReader_cancel(reason) {
  18110. this._done = true;
  18111. this._requests.forEach(function (requestCapability) {
  18112. requestCapability.resolve({
  18113. value: undefined,
  18114. done: true
  18115. });
  18116. });
  18117. this._requests = [];
  18118. this._stream._removeRangeReader(this);
  18119. }
  18120. };
  18121. return PDFWorkerStream;
  18122. }();
  18123. var PDFNetworkStream;
  18124. function setPDFNetworkStreamClass(cls) {
  18125. PDFNetworkStream = cls;
  18126. }
  18127. var WorkerMessageHandler = {
  18128. setup: function wphSetup(handler, port) {
  18129. var testMessageProcessed = false;
  18130. handler.on('test', function wphSetupTest(data) {
  18131. if (testMessageProcessed) {
  18132. return;
  18133. }
  18134. testMessageProcessed = true;
  18135. if (!(data instanceof Uint8Array)) {
  18136. handler.send('test', 'main', false);
  18137. return;
  18138. }
  18139. var supportTransfers = data[0] === 255;
  18140. handler.postMessageTransfers = supportTransfers;
  18141. var xhr = new XMLHttpRequest();
  18142. var responseExists = 'response' in xhr;
  18143. try {
  18144. xhr.responseType;
  18145. } catch (e) {
  18146. responseExists = false;
  18147. }
  18148. if (!responseExists) {
  18149. handler.send('test', false);
  18150. return;
  18151. }
  18152. handler.send('test', {
  18153. supportTypedArray: true,
  18154. supportTransfers: supportTransfers
  18155. });
  18156. });
  18157. handler.on('configure', function wphConfigure(data) {
  18158. setVerbosityLevel(data.verbosity);
  18159. });
  18160. handler.on('GetDocRequest', function wphSetupDoc(data) {
  18161. return WorkerMessageHandler.createDocumentHandler(data, port);
  18162. });
  18163. },
  18164. createDocumentHandler: function wphCreateDocumentHandler(docParams, port) {
  18165. var pdfManager;
  18166. var terminated = false;
  18167. var cancelXHRs = null;
  18168. var WorkerTasks = [];
  18169. var docId = docParams.docId;
  18170. var docBaseUrl = docParams.docBaseUrl;
  18171. var workerHandlerName = docParams.docId + '_worker';
  18172. var handler = new MessageHandler(workerHandlerName, docId, port);
  18173. handler.postMessageTransfers = docParams.postMessageTransfers;
  18174. function ensureNotTerminated() {
  18175. if (terminated) {
  18176. throw new Error('Worker was terminated');
  18177. }
  18178. }
  18179. function startWorkerTask(task) {
  18180. WorkerTasks.push(task);
  18181. }
  18182. function finishWorkerTask(task) {
  18183. task.finish();
  18184. var i = WorkerTasks.indexOf(task);
  18185. WorkerTasks.splice(i, 1);
  18186. }
  18187. function loadDocument(recoveryMode) {
  18188. var loadDocumentCapability = createPromiseCapability();
  18189. var parseSuccess = function parseSuccess() {
  18190. var numPagesPromise = pdfManager.ensureDoc('numPages');
  18191. var fingerprintPromise = pdfManager.ensureDoc('fingerprint');
  18192. var encryptedPromise = pdfManager.ensureXRef('encrypt');
  18193. Promise.all([
  18194. numPagesPromise,
  18195. fingerprintPromise,
  18196. encryptedPromise
  18197. ]).then(function onDocReady(results) {
  18198. var doc = {
  18199. numPages: results[0],
  18200. fingerprint: results[1],
  18201. encrypted: !!results[2]
  18202. };
  18203. loadDocumentCapability.resolve(doc);
  18204. }, parseFailure);
  18205. };
  18206. var parseFailure = function parseFailure(e) {
  18207. loadDocumentCapability.reject(e);
  18208. };
  18209. pdfManager.ensureDoc('checkHeader', []).then(function () {
  18210. pdfManager.ensureDoc('parseStartXRef', []).then(function () {
  18211. pdfManager.ensureDoc('parse', [recoveryMode]).then(parseSuccess, parseFailure);
  18212. }, parseFailure);
  18213. }, parseFailure);
  18214. return loadDocumentCapability.promise;
  18215. }
  18216. function getPdfManager(data, evaluatorOptions) {
  18217. var pdfManagerCapability = createPromiseCapability();
  18218. var pdfManager;
  18219. var source = data.source;
  18220. if (source.data) {
  18221. try {
  18222. pdfManager = new LocalPdfManager(docId, source.data, source.password, evaluatorOptions, docBaseUrl);
  18223. pdfManagerCapability.resolve(pdfManager);
  18224. } catch (ex) {
  18225. pdfManagerCapability.reject(ex);
  18226. }
  18227. return pdfManagerCapability.promise;
  18228. }
  18229. var pdfStream;
  18230. try {
  18231. if (source.chunkedViewerLoading) {
  18232. pdfStream = new PDFWorkerStream(source, handler);
  18233. } else {
  18234. assert(PDFNetworkStream, 'pdfjs/core/network module is not loaded');
  18235. pdfStream = new PDFNetworkStream(data);
  18236. }
  18237. } catch (ex) {
  18238. pdfManagerCapability.reject(ex);
  18239. return pdfManagerCapability.promise;
  18240. }
  18241. var fullRequest = pdfStream.getFullReader();
  18242. fullRequest.headersReady.then(function () {
  18243. if (!fullRequest.isStreamingSupported || !fullRequest.isRangeSupported) {
  18244. fullRequest.onProgress = function (evt) {
  18245. handler.send('DocProgress', {
  18246. loaded: evt.loaded,
  18247. total: evt.total
  18248. });
  18249. };
  18250. }
  18251. if (!fullRequest.isRangeSupported) {
  18252. return;
  18253. }
  18254. var disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
  18255. pdfManager = new NetworkPdfManager(docId, pdfStream, {
  18256. msgHandler: handler,
  18257. url: source.url,
  18258. password: source.password,
  18259. length: fullRequest.contentLength,
  18260. disableAutoFetch: disableAutoFetch,
  18261. rangeChunkSize: source.rangeChunkSize
  18262. }, evaluatorOptions, docBaseUrl);
  18263. pdfManagerCapability.resolve(pdfManager);
  18264. cancelXHRs = null;
  18265. }).catch(function (reason) {
  18266. pdfManagerCapability.reject(reason);
  18267. cancelXHRs = null;
  18268. });
  18269. var cachedChunks = [], loaded = 0;
  18270. var flushChunks = function () {
  18271. var pdfFile = arraysToBytes(cachedChunks);
  18272. if (source.length && pdfFile.length !== source.length) {
  18273. warn('reported HTTP length is different from actual');
  18274. }
  18275. try {
  18276. pdfManager = new LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, docBaseUrl);
  18277. pdfManagerCapability.resolve(pdfManager);
  18278. } catch (ex) {
  18279. pdfManagerCapability.reject(ex);
  18280. }
  18281. cachedChunks = [];
  18282. };
  18283. var readPromise = new Promise(function (resolve, reject) {
  18284. var readChunk = function (chunk) {
  18285. try {
  18286. ensureNotTerminated();
  18287. if (chunk.done) {
  18288. if (!pdfManager) {
  18289. flushChunks();
  18290. }
  18291. cancelXHRs = null;
  18292. return;
  18293. }
  18294. var data = chunk.value;
  18295. loaded += arrayByteLength(data);
  18296. if (!fullRequest.isStreamingSupported) {
  18297. handler.send('DocProgress', {
  18298. loaded: loaded,
  18299. total: Math.max(loaded, fullRequest.contentLength || 0)
  18300. });
  18301. }
  18302. if (pdfManager) {
  18303. pdfManager.sendProgressiveData(data);
  18304. } else {
  18305. cachedChunks.push(data);
  18306. }
  18307. fullRequest.read().then(readChunk, reject);
  18308. } catch (e) {
  18309. reject(e);
  18310. }
  18311. };
  18312. fullRequest.read().then(readChunk, reject);
  18313. });
  18314. readPromise.catch(function (e) {
  18315. pdfManagerCapability.reject(e);
  18316. cancelXHRs = null;
  18317. });
  18318. cancelXHRs = function () {
  18319. pdfStream.cancelAllRequests('abort');
  18320. };
  18321. return pdfManagerCapability.promise;
  18322. }
  18323. function setupDoc(data) {
  18324. function onSuccess(doc) {
  18325. ensureNotTerminated();
  18326. handler.send('GetDoc', { pdfInfo: doc });
  18327. }
  18328. function onFailure(e) {
  18329. if (e instanceof PasswordException) {
  18330. var task = new WorkerTask('PasswordException: response ' + e.code);
  18331. startWorkerTask(task);
  18332. handler.sendWithPromise('PasswordRequest', e).then(function (data) {
  18333. finishWorkerTask(task);
  18334. pdfManager.updatePassword(data.password);
  18335. pdfManagerReady();
  18336. }).catch(function (ex) {
  18337. finishWorkerTask(task);
  18338. handler.send('PasswordException', ex);
  18339. }.bind(null, e));
  18340. } else if (e instanceof InvalidPDFException) {
  18341. handler.send('InvalidPDF', e);
  18342. } else if (e instanceof MissingPDFException) {
  18343. handler.send('MissingPDF', e);
  18344. } else if (e instanceof UnexpectedResponseException) {
  18345. handler.send('UnexpectedResponse', e);
  18346. } else {
  18347. handler.send('UnknownError', new UnknownErrorException(e.message, e.toString()));
  18348. }
  18349. }
  18350. function pdfManagerReady() {
  18351. ensureNotTerminated();
  18352. loadDocument(false).then(onSuccess, function loadFailure(ex) {
  18353. ensureNotTerminated();
  18354. if (!(ex instanceof XRefParseException)) {
  18355. onFailure(ex);
  18356. return;
  18357. }
  18358. pdfManager.requestLoadedStream();
  18359. pdfManager.onLoadedStream().then(function () {
  18360. ensureNotTerminated();
  18361. loadDocument(true).then(onSuccess, onFailure);
  18362. });
  18363. }, onFailure);
  18364. }
  18365. ensureNotTerminated();
  18366. var evaluatorOptions = {
  18367. forceDataSchema: data.disableCreateObjectURL,
  18368. maxImageSize: data.maxImageSize === undefined ? -1 : data.maxImageSize,
  18369. disableFontFace: data.disableFontFace,
  18370. disableNativeImageDecoder: data.disableNativeImageDecoder
  18371. };
  18372. getPdfManager(data, evaluatorOptions).then(function (newPdfManager) {
  18373. if (terminated) {
  18374. newPdfManager.terminate();
  18375. throw new Error('Worker was terminated');
  18376. }
  18377. pdfManager = newPdfManager;
  18378. handler.send('PDFManagerReady', null);
  18379. pdfManager.onLoadedStream().then(function (stream) {
  18380. handler.send('DataLoaded', { length: stream.bytes.byteLength });
  18381. });
  18382. }).then(pdfManagerReady, onFailure);
  18383. }
  18384. handler.on('GetPage', function wphSetupGetPage(data) {
  18385. return pdfManager.getPage(data.pageIndex).then(function (page) {
  18386. var rotatePromise = pdfManager.ensure(page, 'rotate');
  18387. var refPromise = pdfManager.ensure(page, 'ref');
  18388. var userUnitPromise = pdfManager.ensure(page, 'userUnit');
  18389. var viewPromise = pdfManager.ensure(page, 'view');
  18390. return Promise.all([
  18391. rotatePromise,
  18392. refPromise,
  18393. userUnitPromise,
  18394. viewPromise
  18395. ]).then(function (results) {
  18396. return {
  18397. rotate: results[0],
  18398. ref: results[1],
  18399. userUnit: results[2],
  18400. view: results[3]
  18401. };
  18402. });
  18403. });
  18404. });
  18405. handler.on('GetPageIndex', function wphSetupGetPageIndex(data) {
  18406. var ref = new Ref(data.ref.num, data.ref.gen);
  18407. var catalog = pdfManager.pdfDocument.catalog;
  18408. return catalog.getPageIndex(ref);
  18409. });
  18410. handler.on('GetDestinations', function wphSetupGetDestinations(data) {
  18411. return pdfManager.ensureCatalog('destinations');
  18412. });
  18413. handler.on('GetDestination', function wphSetupGetDestination(data) {
  18414. return pdfManager.ensureCatalog('getDestination', [data.id]);
  18415. });
  18416. handler.on('GetPageLabels', function wphSetupGetPageLabels(data) {
  18417. return pdfManager.ensureCatalog('pageLabels');
  18418. });
  18419. handler.on('GetAttachments', function wphSetupGetAttachments(data) {
  18420. return pdfManager.ensureCatalog('attachments');
  18421. });
  18422. handler.on('GetJavaScript', function wphSetupGetJavaScript(data) {
  18423. return pdfManager.ensureCatalog('javaScript');
  18424. });
  18425. handler.on('GetOutline', function wphSetupGetOutline(data) {
  18426. return pdfManager.ensureCatalog('documentOutline');
  18427. });
  18428. handler.on('GetMetadata', function wphSetupGetMetadata(data) {
  18429. return Promise.all([
  18430. pdfManager.ensureDoc('documentInfo'),
  18431. pdfManager.ensureCatalog('metadata')
  18432. ]);
  18433. });
  18434. handler.on('GetData', function wphSetupGetData(data) {
  18435. pdfManager.requestLoadedStream();
  18436. return pdfManager.onLoadedStream().then(function (stream) {
  18437. return stream.bytes;
  18438. });
  18439. });
  18440. handler.on('GetStats', function wphSetupGetStats(data) {
  18441. return pdfManager.pdfDocument.xref.stats;
  18442. });
  18443. handler.on('GetAnnotations', function wphSetupGetAnnotations(data) {
  18444. return pdfManager.getPage(data.pageIndex).then(function (page) {
  18445. return pdfManager.ensure(page, 'getAnnotationsData', [data.intent]);
  18446. });
  18447. });
  18448. handler.on('RenderPageRequest', function wphSetupRenderPage(data) {
  18449. var pageIndex = data.pageIndex;
  18450. pdfManager.getPage(pageIndex).then(function (page) {
  18451. var task = new WorkerTask('RenderPageRequest: page ' + pageIndex);
  18452. startWorkerTask(task);
  18453. var pageNum = pageIndex + 1;
  18454. var start = Date.now();
  18455. page.getOperatorList(handler, task, data.intent, data.renderInteractiveForms).then(function (operatorList) {
  18456. finishWorkerTask(task);
  18457. info('page=' + pageNum + ' - getOperatorList: time=' + (Date.now() - start) + 'ms, len=' + operatorList.totalLength);
  18458. }, function (e) {
  18459. finishWorkerTask(task);
  18460. if (task.terminated) {
  18461. return;
  18462. }
  18463. handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.unknown });
  18464. var minimumStackMessage = 'worker.js: while trying to getPage() and getOperatorList()';
  18465. var wrappedException;
  18466. if (typeof e === 'string') {
  18467. wrappedException = {
  18468. message: e,
  18469. stack: minimumStackMessage
  18470. };
  18471. } else if (typeof e === 'object') {
  18472. wrappedException = {
  18473. message: e.message || e.toString(),
  18474. stack: e.stack || minimumStackMessage
  18475. };
  18476. } else {
  18477. wrappedException = {
  18478. message: 'Unknown exception type: ' + typeof e,
  18479. stack: minimumStackMessage
  18480. };
  18481. }
  18482. handler.send('PageError', {
  18483. pageNum: pageNum,
  18484. error: wrappedException,
  18485. intent: data.intent
  18486. });
  18487. });
  18488. });
  18489. }, this);
  18490. handler.on('GetTextContent', function wphExtractText(data) {
  18491. var pageIndex = data.pageIndex;
  18492. var normalizeWhitespace = data.normalizeWhitespace;
  18493. var combineTextItems = data.combineTextItems;
  18494. return pdfManager.getPage(pageIndex).then(function (page) {
  18495. var task = new WorkerTask('GetTextContent: page ' + pageIndex);
  18496. startWorkerTask(task);
  18497. var pageNum = pageIndex + 1;
  18498. var start = Date.now();
  18499. return page.extractTextContent(task, normalizeWhitespace, combineTextItems).then(function (textContent) {
  18500. finishWorkerTask(task);
  18501. info('text indexing: page=' + pageNum + ' - time=' + (Date.now() - start) + 'ms');
  18502. return textContent;
  18503. }, function (reason) {
  18504. finishWorkerTask(task);
  18505. if (task.terminated) {
  18506. return;
  18507. }
  18508. throw reason;
  18509. });
  18510. });
  18511. });
  18512. handler.on('Cleanup', function wphCleanup(data) {
  18513. return pdfManager.cleanup();
  18514. });
  18515. handler.on('Terminate', function wphTerminate(data) {
  18516. terminated = true;
  18517. if (pdfManager) {
  18518. pdfManager.terminate();
  18519. pdfManager = null;
  18520. }
  18521. if (cancelXHRs) {
  18522. cancelXHRs();
  18523. }
  18524. var waitOn = [];
  18525. WorkerTasks.forEach(function (task) {
  18526. waitOn.push(task.finished);
  18527. task.terminate();
  18528. });
  18529. return Promise.all(waitOn).then(function () {
  18530. handler.destroy();
  18531. handler = null;
  18532. });
  18533. });
  18534. handler.on('Ready', function wphReady(data) {
  18535. setupDoc(docParams);
  18536. docParams = null;
  18537. });
  18538. return workerHandlerName;
  18539. }
  18540. };
  18541. function initializeWorker() {
  18542. var handler = new MessageHandler('worker', 'main', self);
  18543. WorkerMessageHandler.setup(handler, self);
  18544. handler.send('ready', null);
  18545. }
  18546. if (typeof window === 'undefined' && !isNodeJS()) {
  18547. initializeWorker();
  18548. }
  18549. exports.setPDFNetworkStreamClass = setPDFNetworkStreamClass;
  18550. exports.WorkerTask = WorkerTask;
  18551. exports.WorkerMessageHandler = WorkerMessageHandler;
  18552. /***/ }),
  18553. /* 9 */
  18554. /***/ (function(module, exports) {
  18555. var g;
  18556. g = function () {
  18557. return this;
  18558. }();
  18559. try {
  18560. g = g || Function("return this")() || (1, eval)("this");
  18561. } catch (e) {
  18562. if (typeof window === "object")
  18563. g = window;
  18564. }
  18565. module.exports = g;
  18566. /***/ }),
  18567. /* 10 */
  18568. /***/ (function(module, exports, __w_pdfjs_require__) {
  18569. "use strict";
  18570. var ArithmeticDecoder = function ArithmeticDecoderClosure() {
  18571. var QeTable = [
  18572. {
  18573. qe: 0x5601,
  18574. nmps: 1,
  18575. nlps: 1,
  18576. switchFlag: 1
  18577. },
  18578. {
  18579. qe: 0x3401,
  18580. nmps: 2,
  18581. nlps: 6,
  18582. switchFlag: 0
  18583. },
  18584. {
  18585. qe: 0x1801,
  18586. nmps: 3,
  18587. nlps: 9,
  18588. switchFlag: 0
  18589. },
  18590. {
  18591. qe: 0x0AC1,
  18592. nmps: 4,
  18593. nlps: 12,
  18594. switchFlag: 0
  18595. },
  18596. {
  18597. qe: 0x0521,
  18598. nmps: 5,
  18599. nlps: 29,
  18600. switchFlag: 0
  18601. },
  18602. {
  18603. qe: 0x0221,
  18604. nmps: 38,
  18605. nlps: 33,
  18606. switchFlag: 0
  18607. },
  18608. {
  18609. qe: 0x5601,
  18610. nmps: 7,
  18611. nlps: 6,
  18612. switchFlag: 1
  18613. },
  18614. {
  18615. qe: 0x5401,
  18616. nmps: 8,
  18617. nlps: 14,
  18618. switchFlag: 0
  18619. },
  18620. {
  18621. qe: 0x4801,
  18622. nmps: 9,
  18623. nlps: 14,
  18624. switchFlag: 0
  18625. },
  18626. {
  18627. qe: 0x3801,
  18628. nmps: 10,
  18629. nlps: 14,
  18630. switchFlag: 0
  18631. },
  18632. {
  18633. qe: 0x3001,
  18634. nmps: 11,
  18635. nlps: 17,
  18636. switchFlag: 0
  18637. },
  18638. {
  18639. qe: 0x2401,
  18640. nmps: 12,
  18641. nlps: 18,
  18642. switchFlag: 0
  18643. },
  18644. {
  18645. qe: 0x1C01,
  18646. nmps: 13,
  18647. nlps: 20,
  18648. switchFlag: 0
  18649. },
  18650. {
  18651. qe: 0x1601,
  18652. nmps: 29,
  18653. nlps: 21,
  18654. switchFlag: 0
  18655. },
  18656. {
  18657. qe: 0x5601,
  18658. nmps: 15,
  18659. nlps: 14,
  18660. switchFlag: 1
  18661. },
  18662. {
  18663. qe: 0x5401,
  18664. nmps: 16,
  18665. nlps: 14,
  18666. switchFlag: 0
  18667. },
  18668. {
  18669. qe: 0x5101,
  18670. nmps: 17,
  18671. nlps: 15,
  18672. switchFlag: 0
  18673. },
  18674. {
  18675. qe: 0x4801,
  18676. nmps: 18,
  18677. nlps: 16,
  18678. switchFlag: 0
  18679. },
  18680. {
  18681. qe: 0x3801,
  18682. nmps: 19,
  18683. nlps: 17,
  18684. switchFlag: 0
  18685. },
  18686. {
  18687. qe: 0x3401,
  18688. nmps: 20,
  18689. nlps: 18,
  18690. switchFlag: 0
  18691. },
  18692. {
  18693. qe: 0x3001,
  18694. nmps: 21,
  18695. nlps: 19,
  18696. switchFlag: 0
  18697. },
  18698. {
  18699. qe: 0x2801,
  18700. nmps: 22,
  18701. nlps: 19,
  18702. switchFlag: 0
  18703. },
  18704. {
  18705. qe: 0x2401,
  18706. nmps: 23,
  18707. nlps: 20,
  18708. switchFlag: 0
  18709. },
  18710. {
  18711. qe: 0x2201,
  18712. nmps: 24,
  18713. nlps: 21,
  18714. switchFlag: 0
  18715. },
  18716. {
  18717. qe: 0x1C01,
  18718. nmps: 25,
  18719. nlps: 22,
  18720. switchFlag: 0
  18721. },
  18722. {
  18723. qe: 0x1801,
  18724. nmps: 26,
  18725. nlps: 23,
  18726. switchFlag: 0
  18727. },
  18728. {
  18729. qe: 0x1601,
  18730. nmps: 27,
  18731. nlps: 24,
  18732. switchFlag: 0
  18733. },
  18734. {
  18735. qe: 0x1401,
  18736. nmps: 28,
  18737. nlps: 25,
  18738. switchFlag: 0
  18739. },
  18740. {
  18741. qe: 0x1201,
  18742. nmps: 29,
  18743. nlps: 26,
  18744. switchFlag: 0
  18745. },
  18746. {
  18747. qe: 0x1101,
  18748. nmps: 30,
  18749. nlps: 27,
  18750. switchFlag: 0
  18751. },
  18752. {
  18753. qe: 0x0AC1,
  18754. nmps: 31,
  18755. nlps: 28,
  18756. switchFlag: 0
  18757. },
  18758. {
  18759. qe: 0x09C1,
  18760. nmps: 32,
  18761. nlps: 29,
  18762. switchFlag: 0
  18763. },
  18764. {
  18765. qe: 0x08A1,
  18766. nmps: 33,
  18767. nlps: 30,
  18768. switchFlag: 0
  18769. },
  18770. {
  18771. qe: 0x0521,
  18772. nmps: 34,
  18773. nlps: 31,
  18774. switchFlag: 0
  18775. },
  18776. {
  18777. qe: 0x0441,
  18778. nmps: 35,
  18779. nlps: 32,
  18780. switchFlag: 0
  18781. },
  18782. {
  18783. qe: 0x02A1,
  18784. nmps: 36,
  18785. nlps: 33,
  18786. switchFlag: 0
  18787. },
  18788. {
  18789. qe: 0x0221,
  18790. nmps: 37,
  18791. nlps: 34,
  18792. switchFlag: 0
  18793. },
  18794. {
  18795. qe: 0x0141,
  18796. nmps: 38,
  18797. nlps: 35,
  18798. switchFlag: 0
  18799. },
  18800. {
  18801. qe: 0x0111,
  18802. nmps: 39,
  18803. nlps: 36,
  18804. switchFlag: 0
  18805. },
  18806. {
  18807. qe: 0x0085,
  18808. nmps: 40,
  18809. nlps: 37,
  18810. switchFlag: 0
  18811. },
  18812. {
  18813. qe: 0x0049,
  18814. nmps: 41,
  18815. nlps: 38,
  18816. switchFlag: 0
  18817. },
  18818. {
  18819. qe: 0x0025,
  18820. nmps: 42,
  18821. nlps: 39,
  18822. switchFlag: 0
  18823. },
  18824. {
  18825. qe: 0x0015,
  18826. nmps: 43,
  18827. nlps: 40,
  18828. switchFlag: 0
  18829. },
  18830. {
  18831. qe: 0x0009,
  18832. nmps: 44,
  18833. nlps: 41,
  18834. switchFlag: 0
  18835. },
  18836. {
  18837. qe: 0x0005,
  18838. nmps: 45,
  18839. nlps: 42,
  18840. switchFlag: 0
  18841. },
  18842. {
  18843. qe: 0x0001,
  18844. nmps: 45,
  18845. nlps: 43,
  18846. switchFlag: 0
  18847. },
  18848. {
  18849. qe: 0x5601,
  18850. nmps: 46,
  18851. nlps: 46,
  18852. switchFlag: 0
  18853. }
  18854. ];
  18855. function ArithmeticDecoder(data, start, end) {
  18856. this.data = data;
  18857. this.bp = start;
  18858. this.dataEnd = end;
  18859. this.chigh = data[start];
  18860. this.clow = 0;
  18861. this.byteIn();
  18862. this.chigh = this.chigh << 7 & 0xFFFF | this.clow >> 9 & 0x7F;
  18863. this.clow = this.clow << 7 & 0xFFFF;
  18864. this.ct -= 7;
  18865. this.a = 0x8000;
  18866. }
  18867. ArithmeticDecoder.prototype = {
  18868. byteIn: function ArithmeticDecoder_byteIn() {
  18869. var data = this.data;
  18870. var bp = this.bp;
  18871. if (data[bp] === 0xFF) {
  18872. var b1 = data[bp + 1];
  18873. if (b1 > 0x8F) {
  18874. this.clow += 0xFF00;
  18875. this.ct = 8;
  18876. } else {
  18877. bp++;
  18878. this.clow += data[bp] << 9;
  18879. this.ct = 7;
  18880. this.bp = bp;
  18881. }
  18882. } else {
  18883. bp++;
  18884. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xFF00;
  18885. this.ct = 8;
  18886. this.bp = bp;
  18887. }
  18888. if (this.clow > 0xFFFF) {
  18889. this.chigh += this.clow >> 16;
  18890. this.clow &= 0xFFFF;
  18891. }
  18892. },
  18893. readBit: function ArithmeticDecoder_readBit(contexts, pos) {
  18894. var cx_index = contexts[pos] >> 1, cx_mps = contexts[pos] & 1;
  18895. var qeTableIcx = QeTable[cx_index];
  18896. var qeIcx = qeTableIcx.qe;
  18897. var d;
  18898. var a = this.a - qeIcx;
  18899. if (this.chigh < qeIcx) {
  18900. if (a < qeIcx) {
  18901. a = qeIcx;
  18902. d = cx_mps;
  18903. cx_index = qeTableIcx.nmps;
  18904. } else {
  18905. a = qeIcx;
  18906. d = 1 ^ cx_mps;
  18907. if (qeTableIcx.switchFlag === 1) {
  18908. cx_mps = d;
  18909. }
  18910. cx_index = qeTableIcx.nlps;
  18911. }
  18912. } else {
  18913. this.chigh -= qeIcx;
  18914. if ((a & 0x8000) !== 0) {
  18915. this.a = a;
  18916. return cx_mps;
  18917. }
  18918. if (a < qeIcx) {
  18919. d = 1 ^ cx_mps;
  18920. if (qeTableIcx.switchFlag === 1) {
  18921. cx_mps = d;
  18922. }
  18923. cx_index = qeTableIcx.nlps;
  18924. } else {
  18925. d = cx_mps;
  18926. cx_index = qeTableIcx.nmps;
  18927. }
  18928. }
  18929. do {
  18930. if (this.ct === 0) {
  18931. this.byteIn();
  18932. }
  18933. a <<= 1;
  18934. this.chigh = this.chigh << 1 & 0xFFFF | this.clow >> 15 & 1;
  18935. this.clow = this.clow << 1 & 0xFFFF;
  18936. this.ct--;
  18937. } while ((a & 0x8000) === 0);
  18938. this.a = a;
  18939. contexts[pos] = cx_index << 1 | cx_mps;
  18940. return d;
  18941. }
  18942. };
  18943. return ArithmeticDecoder;
  18944. }();
  18945. exports.ArithmeticDecoder = ArithmeticDecoder;
  18946. /***/ }),
  18947. /* 11 */
  18948. /***/ (function(module, exports, __w_pdfjs_require__) {
  18949. "use strict";
  18950. var sharedUtil = __w_pdfjs_require__(0);
  18951. var coreCharsets = __w_pdfjs_require__(22);
  18952. var coreEncodings = __w_pdfjs_require__(4);
  18953. var error = sharedUtil.error;
  18954. var info = sharedUtil.info;
  18955. var bytesToString = sharedUtil.bytesToString;
  18956. var warn = sharedUtil.warn;
  18957. var isArray = sharedUtil.isArray;
  18958. var Util = sharedUtil.Util;
  18959. var stringToBytes = sharedUtil.stringToBytes;
  18960. var assert = sharedUtil.assert;
  18961. var ISOAdobeCharset = coreCharsets.ISOAdobeCharset;
  18962. var ExpertCharset = coreCharsets.ExpertCharset;
  18963. var ExpertSubsetCharset = coreCharsets.ExpertSubsetCharset;
  18964. var StandardEncoding = coreEncodings.StandardEncoding;
  18965. var ExpertEncoding = coreEncodings.ExpertEncoding;
  18966. var MAX_SUBR_NESTING = 10;
  18967. var CFFStandardStrings = [
  18968. '.notdef',
  18969. 'space',
  18970. 'exclam',
  18971. 'quotedbl',
  18972. 'numbersign',
  18973. 'dollar',
  18974. 'percent',
  18975. 'ampersand',
  18976. 'quoteright',
  18977. 'parenleft',
  18978. 'parenright',
  18979. 'asterisk',
  18980. 'plus',
  18981. 'comma',
  18982. 'hyphen',
  18983. 'period',
  18984. 'slash',
  18985. 'zero',
  18986. 'one',
  18987. 'two',
  18988. 'three',
  18989. 'four',
  18990. 'five',
  18991. 'six',
  18992. 'seven',
  18993. 'eight',
  18994. 'nine',
  18995. 'colon',
  18996. 'semicolon',
  18997. 'less',
  18998. 'equal',
  18999. 'greater',
  19000. 'question',
  19001. 'at',
  19002. 'A',
  19003. 'B',
  19004. 'C',
  19005. 'D',
  19006. 'E',
  19007. 'F',
  19008. 'G',
  19009. 'H',
  19010. 'I',
  19011. 'J',
  19012. 'K',
  19013. 'L',
  19014. 'M',
  19015. 'N',
  19016. 'O',
  19017. 'P',
  19018. 'Q',
  19019. 'R',
  19020. 'S',
  19021. 'T',
  19022. 'U',
  19023. 'V',
  19024. 'W',
  19025. 'X',
  19026. 'Y',
  19027. 'Z',
  19028. 'bracketleft',
  19029. 'backslash',
  19030. 'bracketright',
  19031. 'asciicircum',
  19032. 'underscore',
  19033. 'quoteleft',
  19034. 'a',
  19035. 'b',
  19036. 'c',
  19037. 'd',
  19038. 'e',
  19039. 'f',
  19040. 'g',
  19041. 'h',
  19042. 'i',
  19043. 'j',
  19044. 'k',
  19045. 'l',
  19046. 'm',
  19047. 'n',
  19048. 'o',
  19049. 'p',
  19050. 'q',
  19051. 'r',
  19052. 's',
  19053. 't',
  19054. 'u',
  19055. 'v',
  19056. 'w',
  19057. 'x',
  19058. 'y',
  19059. 'z',
  19060. 'braceleft',
  19061. 'bar',
  19062. 'braceright',
  19063. 'asciitilde',
  19064. 'exclamdown',
  19065. 'cent',
  19066. 'sterling',
  19067. 'fraction',
  19068. 'yen',
  19069. 'florin',
  19070. 'section',
  19071. 'currency',
  19072. 'quotesingle',
  19073. 'quotedblleft',
  19074. 'guillemotleft',
  19075. 'guilsinglleft',
  19076. 'guilsinglright',
  19077. 'fi',
  19078. 'fl',
  19079. 'endash',
  19080. 'dagger',
  19081. 'daggerdbl',
  19082. 'periodcentered',
  19083. 'paragraph',
  19084. 'bullet',
  19085. 'quotesinglbase',
  19086. 'quotedblbase',
  19087. 'quotedblright',
  19088. 'guillemotright',
  19089. 'ellipsis',
  19090. 'perthousand',
  19091. 'questiondown',
  19092. 'grave',
  19093. 'acute',
  19094. 'circumflex',
  19095. 'tilde',
  19096. 'macron',
  19097. 'breve',
  19098. 'dotaccent',
  19099. 'dieresis',
  19100. 'ring',
  19101. 'cedilla',
  19102. 'hungarumlaut',
  19103. 'ogonek',
  19104. 'caron',
  19105. 'emdash',
  19106. 'AE',
  19107. 'ordfeminine',
  19108. 'Lslash',
  19109. 'Oslash',
  19110. 'OE',
  19111. 'ordmasculine',
  19112. 'ae',
  19113. 'dotlessi',
  19114. 'lslash',
  19115. 'oslash',
  19116. 'oe',
  19117. 'germandbls',
  19118. 'onesuperior',
  19119. 'logicalnot',
  19120. 'mu',
  19121. 'trademark',
  19122. 'Eth',
  19123. 'onehalf',
  19124. 'plusminus',
  19125. 'Thorn',
  19126. 'onequarter',
  19127. 'divide',
  19128. 'brokenbar',
  19129. 'degree',
  19130. 'thorn',
  19131. 'threequarters',
  19132. 'twosuperior',
  19133. 'registered',
  19134. 'minus',
  19135. 'eth',
  19136. 'multiply',
  19137. 'threesuperior',
  19138. 'copyright',
  19139. 'Aacute',
  19140. 'Acircumflex',
  19141. 'Adieresis',
  19142. 'Agrave',
  19143. 'Aring',
  19144. 'Atilde',
  19145. 'Ccedilla',
  19146. 'Eacute',
  19147. 'Ecircumflex',
  19148. 'Edieresis',
  19149. 'Egrave',
  19150. 'Iacute',
  19151. 'Icircumflex',
  19152. 'Idieresis',
  19153. 'Igrave',
  19154. 'Ntilde',
  19155. 'Oacute',
  19156. 'Ocircumflex',
  19157. 'Odieresis',
  19158. 'Ograve',
  19159. 'Otilde',
  19160. 'Scaron',
  19161. 'Uacute',
  19162. 'Ucircumflex',
  19163. 'Udieresis',
  19164. 'Ugrave',
  19165. 'Yacute',
  19166. 'Ydieresis',
  19167. 'Zcaron',
  19168. 'aacute',
  19169. 'acircumflex',
  19170. 'adieresis',
  19171. 'agrave',
  19172. 'aring',
  19173. 'atilde',
  19174. 'ccedilla',
  19175. 'eacute',
  19176. 'ecircumflex',
  19177. 'edieresis',
  19178. 'egrave',
  19179. 'iacute',
  19180. 'icircumflex',
  19181. 'idieresis',
  19182. 'igrave',
  19183. 'ntilde',
  19184. 'oacute',
  19185. 'ocircumflex',
  19186. 'odieresis',
  19187. 'ograve',
  19188. 'otilde',
  19189. 'scaron',
  19190. 'uacute',
  19191. 'ucircumflex',
  19192. 'udieresis',
  19193. 'ugrave',
  19194. 'yacute',
  19195. 'ydieresis',
  19196. 'zcaron',
  19197. 'exclamsmall',
  19198. 'Hungarumlautsmall',
  19199. 'dollaroldstyle',
  19200. 'dollarsuperior',
  19201. 'ampersandsmall',
  19202. 'Acutesmall',
  19203. 'parenleftsuperior',
  19204. 'parenrightsuperior',
  19205. 'twodotenleader',
  19206. 'onedotenleader',
  19207. 'zerooldstyle',
  19208. 'oneoldstyle',
  19209. 'twooldstyle',
  19210. 'threeoldstyle',
  19211. 'fouroldstyle',
  19212. 'fiveoldstyle',
  19213. 'sixoldstyle',
  19214. 'sevenoldstyle',
  19215. 'eightoldstyle',
  19216. 'nineoldstyle',
  19217. 'commasuperior',
  19218. 'threequartersemdash',
  19219. 'periodsuperior',
  19220. 'questionsmall',
  19221. 'asuperior',
  19222. 'bsuperior',
  19223. 'centsuperior',
  19224. 'dsuperior',
  19225. 'esuperior',
  19226. 'isuperior',
  19227. 'lsuperior',
  19228. 'msuperior',
  19229. 'nsuperior',
  19230. 'osuperior',
  19231. 'rsuperior',
  19232. 'ssuperior',
  19233. 'tsuperior',
  19234. 'ff',
  19235. 'ffi',
  19236. 'ffl',
  19237. 'parenleftinferior',
  19238. 'parenrightinferior',
  19239. 'Circumflexsmall',
  19240. 'hyphensuperior',
  19241. 'Gravesmall',
  19242. 'Asmall',
  19243. 'Bsmall',
  19244. 'Csmall',
  19245. 'Dsmall',
  19246. 'Esmall',
  19247. 'Fsmall',
  19248. 'Gsmall',
  19249. 'Hsmall',
  19250. 'Ismall',
  19251. 'Jsmall',
  19252. 'Ksmall',
  19253. 'Lsmall',
  19254. 'Msmall',
  19255. 'Nsmall',
  19256. 'Osmall',
  19257. 'Psmall',
  19258. 'Qsmall',
  19259. 'Rsmall',
  19260. 'Ssmall',
  19261. 'Tsmall',
  19262. 'Usmall',
  19263. 'Vsmall',
  19264. 'Wsmall',
  19265. 'Xsmall',
  19266. 'Ysmall',
  19267. 'Zsmall',
  19268. 'colonmonetary',
  19269. 'onefitted',
  19270. 'rupiah',
  19271. 'Tildesmall',
  19272. 'exclamdownsmall',
  19273. 'centoldstyle',
  19274. 'Lslashsmall',
  19275. 'Scaronsmall',
  19276. 'Zcaronsmall',
  19277. 'Dieresissmall',
  19278. 'Brevesmall',
  19279. 'Caronsmall',
  19280. 'Dotaccentsmall',
  19281. 'Macronsmall',
  19282. 'figuredash',
  19283. 'hypheninferior',
  19284. 'Ogoneksmall',
  19285. 'Ringsmall',
  19286. 'Cedillasmall',
  19287. 'questiondownsmall',
  19288. 'oneeighth',
  19289. 'threeeighths',
  19290. 'fiveeighths',
  19291. 'seveneighths',
  19292. 'onethird',
  19293. 'twothirds',
  19294. 'zerosuperior',
  19295. 'foursuperior',
  19296. 'fivesuperior',
  19297. 'sixsuperior',
  19298. 'sevensuperior',
  19299. 'eightsuperior',
  19300. 'ninesuperior',
  19301. 'zeroinferior',
  19302. 'oneinferior',
  19303. 'twoinferior',
  19304. 'threeinferior',
  19305. 'fourinferior',
  19306. 'fiveinferior',
  19307. 'sixinferior',
  19308. 'seveninferior',
  19309. 'eightinferior',
  19310. 'nineinferior',
  19311. 'centinferior',
  19312. 'dollarinferior',
  19313. 'periodinferior',
  19314. 'commainferior',
  19315. 'Agravesmall',
  19316. 'Aacutesmall',
  19317. 'Acircumflexsmall',
  19318. 'Atildesmall',
  19319. 'Adieresissmall',
  19320. 'Aringsmall',
  19321. 'AEsmall',
  19322. 'Ccedillasmall',
  19323. 'Egravesmall',
  19324. 'Eacutesmall',
  19325. 'Ecircumflexsmall',
  19326. 'Edieresissmall',
  19327. 'Igravesmall',
  19328. 'Iacutesmall',
  19329. 'Icircumflexsmall',
  19330. 'Idieresissmall',
  19331. 'Ethsmall',
  19332. 'Ntildesmall',
  19333. 'Ogravesmall',
  19334. 'Oacutesmall',
  19335. 'Ocircumflexsmall',
  19336. 'Otildesmall',
  19337. 'Odieresissmall',
  19338. 'OEsmall',
  19339. 'Oslashsmall',
  19340. 'Ugravesmall',
  19341. 'Uacutesmall',
  19342. 'Ucircumflexsmall',
  19343. 'Udieresissmall',
  19344. 'Yacutesmall',
  19345. 'Thornsmall',
  19346. 'Ydieresissmall',
  19347. '001.000',
  19348. '001.001',
  19349. '001.002',
  19350. '001.003',
  19351. 'Black',
  19352. 'Bold',
  19353. 'Book',
  19354. 'Light',
  19355. 'Medium',
  19356. 'Regular',
  19357. 'Roman',
  19358. 'Semibold'
  19359. ];
  19360. var CFFParser = function CFFParserClosure() {
  19361. var CharstringValidationData = [
  19362. null,
  19363. {
  19364. id: 'hstem',
  19365. min: 2,
  19366. stackClearing: true,
  19367. stem: true
  19368. },
  19369. null,
  19370. {
  19371. id: 'vstem',
  19372. min: 2,
  19373. stackClearing: true,
  19374. stem: true
  19375. },
  19376. {
  19377. id: 'vmoveto',
  19378. min: 1,
  19379. stackClearing: true
  19380. },
  19381. {
  19382. id: 'rlineto',
  19383. min: 2,
  19384. resetStack: true
  19385. },
  19386. {
  19387. id: 'hlineto',
  19388. min: 1,
  19389. resetStack: true
  19390. },
  19391. {
  19392. id: 'vlineto',
  19393. min: 1,
  19394. resetStack: true
  19395. },
  19396. {
  19397. id: 'rrcurveto',
  19398. min: 6,
  19399. resetStack: true
  19400. },
  19401. null,
  19402. {
  19403. id: 'callsubr',
  19404. min: 1,
  19405. undefStack: true
  19406. },
  19407. {
  19408. id: 'return',
  19409. min: 0,
  19410. undefStack: true
  19411. },
  19412. null,
  19413. null,
  19414. {
  19415. id: 'endchar',
  19416. min: 0,
  19417. stackClearing: true
  19418. },
  19419. null,
  19420. null,
  19421. null,
  19422. {
  19423. id: 'hstemhm',
  19424. min: 2,
  19425. stackClearing: true,
  19426. stem: true
  19427. },
  19428. {
  19429. id: 'hintmask',
  19430. min: 0,
  19431. stackClearing: true
  19432. },
  19433. {
  19434. id: 'cntrmask',
  19435. min: 0,
  19436. stackClearing: true
  19437. },
  19438. {
  19439. id: 'rmoveto',
  19440. min: 2,
  19441. stackClearing: true
  19442. },
  19443. {
  19444. id: 'hmoveto',
  19445. min: 1,
  19446. stackClearing: true
  19447. },
  19448. {
  19449. id: 'vstemhm',
  19450. min: 2,
  19451. stackClearing: true,
  19452. stem: true
  19453. },
  19454. {
  19455. id: 'rcurveline',
  19456. min: 8,
  19457. resetStack: true
  19458. },
  19459. {
  19460. id: 'rlinecurve',
  19461. min: 8,
  19462. resetStack: true
  19463. },
  19464. {
  19465. id: 'vvcurveto',
  19466. min: 4,
  19467. resetStack: true
  19468. },
  19469. {
  19470. id: 'hhcurveto',
  19471. min: 4,
  19472. resetStack: true
  19473. },
  19474. null,
  19475. {
  19476. id: 'callgsubr',
  19477. min: 1,
  19478. undefStack: true
  19479. },
  19480. {
  19481. id: 'vhcurveto',
  19482. min: 4,
  19483. resetStack: true
  19484. },
  19485. {
  19486. id: 'hvcurveto',
  19487. min: 4,
  19488. resetStack: true
  19489. }
  19490. ];
  19491. var CharstringValidationData12 = [
  19492. null,
  19493. null,
  19494. null,
  19495. {
  19496. id: 'and',
  19497. min: 2,
  19498. stackDelta: -1
  19499. },
  19500. {
  19501. id: 'or',
  19502. min: 2,
  19503. stackDelta: -1
  19504. },
  19505. {
  19506. id: 'not',
  19507. min: 1,
  19508. stackDelta: 0
  19509. },
  19510. null,
  19511. null,
  19512. null,
  19513. {
  19514. id: 'abs',
  19515. min: 1,
  19516. stackDelta: 0
  19517. },
  19518. {
  19519. id: 'add',
  19520. min: 2,
  19521. stackDelta: -1,
  19522. stackFn: function stack_div(stack, index) {
  19523. stack[index - 2] = stack[index - 2] + stack[index - 1];
  19524. }
  19525. },
  19526. {
  19527. id: 'sub',
  19528. min: 2,
  19529. stackDelta: -1,
  19530. stackFn: function stack_div(stack, index) {
  19531. stack[index - 2] = stack[index - 2] - stack[index - 1];
  19532. }
  19533. },
  19534. {
  19535. id: 'div',
  19536. min: 2,
  19537. stackDelta: -1,
  19538. stackFn: function stack_div(stack, index) {
  19539. stack[index - 2] = stack[index - 2] / stack[index - 1];
  19540. }
  19541. },
  19542. null,
  19543. {
  19544. id: 'neg',
  19545. min: 1,
  19546. stackDelta: 0,
  19547. stackFn: function stack_div(stack, index) {
  19548. stack[index - 1] = -stack[index - 1];
  19549. }
  19550. },
  19551. {
  19552. id: 'eq',
  19553. min: 2,
  19554. stackDelta: -1
  19555. },
  19556. null,
  19557. null,
  19558. {
  19559. id: 'drop',
  19560. min: 1,
  19561. stackDelta: -1
  19562. },
  19563. null,
  19564. {
  19565. id: 'put',
  19566. min: 2,
  19567. stackDelta: -2
  19568. },
  19569. {
  19570. id: 'get',
  19571. min: 1,
  19572. stackDelta: 0
  19573. },
  19574. {
  19575. id: 'ifelse',
  19576. min: 4,
  19577. stackDelta: -3
  19578. },
  19579. {
  19580. id: 'random',
  19581. min: 0,
  19582. stackDelta: 1
  19583. },
  19584. {
  19585. id: 'mul',
  19586. min: 2,
  19587. stackDelta: -1,
  19588. stackFn: function stack_div(stack, index) {
  19589. stack[index - 2] = stack[index - 2] * stack[index - 1];
  19590. }
  19591. },
  19592. null,
  19593. {
  19594. id: 'sqrt',
  19595. min: 1,
  19596. stackDelta: 0
  19597. },
  19598. {
  19599. id: 'dup',
  19600. min: 1,
  19601. stackDelta: 1
  19602. },
  19603. {
  19604. id: 'exch',
  19605. min: 2,
  19606. stackDelta: 0
  19607. },
  19608. {
  19609. id: 'index',
  19610. min: 2,
  19611. stackDelta: 0
  19612. },
  19613. {
  19614. id: 'roll',
  19615. min: 3,
  19616. stackDelta: -2
  19617. },
  19618. null,
  19619. null,
  19620. null,
  19621. {
  19622. id: 'hflex',
  19623. min: 7,
  19624. resetStack: true
  19625. },
  19626. {
  19627. id: 'flex',
  19628. min: 13,
  19629. resetStack: true
  19630. },
  19631. {
  19632. id: 'hflex1',
  19633. min: 9,
  19634. resetStack: true
  19635. },
  19636. {
  19637. id: 'flex1',
  19638. min: 11,
  19639. resetStack: true
  19640. }
  19641. ];
  19642. function CFFParser(file, properties, seacAnalysisEnabled) {
  19643. this.bytes = file.getBytes();
  19644. this.properties = properties;
  19645. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  19646. }
  19647. CFFParser.prototype = {
  19648. parse: function CFFParser_parse() {
  19649. var properties = this.properties;
  19650. var cff = new CFF();
  19651. this.cff = cff;
  19652. var header = this.parseHeader();
  19653. var nameIndex = this.parseIndex(header.endPos);
  19654. var topDictIndex = this.parseIndex(nameIndex.endPos);
  19655. var stringIndex = this.parseIndex(topDictIndex.endPos);
  19656. var globalSubrIndex = this.parseIndex(stringIndex.endPos);
  19657. var topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  19658. var topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  19659. cff.header = header.obj;
  19660. cff.names = this.parseNameIndex(nameIndex.obj);
  19661. cff.strings = this.parseStringIndex(stringIndex.obj);
  19662. cff.topDict = topDict;
  19663. cff.globalSubrIndex = globalSubrIndex.obj;
  19664. this.parsePrivateDict(cff.topDict);
  19665. cff.isCIDFont = topDict.hasName('ROS');
  19666. var charStringOffset = topDict.getByName('CharStrings');
  19667. var charStringIndex = this.parseIndex(charStringOffset).obj;
  19668. var fontMatrix = topDict.getByName('FontMatrix');
  19669. if (fontMatrix) {
  19670. properties.fontMatrix = fontMatrix;
  19671. }
  19672. var fontBBox = topDict.getByName('FontBBox');
  19673. if (fontBBox) {
  19674. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  19675. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  19676. properties.ascentScaled = true;
  19677. }
  19678. var charset, encoding;
  19679. if (cff.isCIDFont) {
  19680. var fdArrayIndex = this.parseIndex(topDict.getByName('FDArray')).obj;
  19681. for (var i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  19682. var dictRaw = fdArrayIndex.get(i);
  19683. var fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  19684. this.parsePrivateDict(fontDict);
  19685. cff.fdArray.push(fontDict);
  19686. }
  19687. encoding = null;
  19688. charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, true);
  19689. cff.fdSelect = this.parseFDSelect(topDict.getByName('FDSelect'), charStringIndex.count);
  19690. } else {
  19691. charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, false);
  19692. encoding = this.parseEncoding(topDict.getByName('Encoding'), properties, cff.strings, charset.charset);
  19693. }
  19694. cff.charset = charset;
  19695. cff.encoding = encoding;
  19696. var charStringsAndSeacs = this.parseCharStrings(charStringIndex, topDict.privateDict.subrsIndex, globalSubrIndex.obj, cff.fdSelect, cff.fdArray);
  19697. cff.charStrings = charStringsAndSeacs.charStrings;
  19698. cff.seacs = charStringsAndSeacs.seacs;
  19699. cff.widths = charStringsAndSeacs.widths;
  19700. return cff;
  19701. },
  19702. parseHeader: function CFFParser_parseHeader() {
  19703. var bytes = this.bytes;
  19704. var bytesLength = bytes.length;
  19705. var offset = 0;
  19706. while (offset < bytesLength && bytes[offset] !== 1) {
  19707. ++offset;
  19708. }
  19709. if (offset >= bytesLength) {
  19710. error('Invalid CFF header');
  19711. } else if (offset !== 0) {
  19712. info('cff data is shifted');
  19713. bytes = bytes.subarray(offset);
  19714. this.bytes = bytes;
  19715. }
  19716. var major = bytes[0];
  19717. var minor = bytes[1];
  19718. var hdrSize = bytes[2];
  19719. var offSize = bytes[3];
  19720. var header = new CFFHeader(major, minor, hdrSize, offSize);
  19721. return {
  19722. obj: header,
  19723. endPos: hdrSize
  19724. };
  19725. },
  19726. parseDict: function CFFParser_parseDict(dict) {
  19727. var pos = 0;
  19728. function parseOperand() {
  19729. var value = dict[pos++];
  19730. if (value === 30) {
  19731. return parseFloatOperand();
  19732. } else if (value === 28) {
  19733. value = dict[pos++];
  19734. value = (value << 24 | dict[pos++] << 16) >> 16;
  19735. return value;
  19736. } else if (value === 29) {
  19737. value = dict[pos++];
  19738. value = value << 8 | dict[pos++];
  19739. value = value << 8 | dict[pos++];
  19740. value = value << 8 | dict[pos++];
  19741. return value;
  19742. } else if (value >= 32 && value <= 246) {
  19743. return value - 139;
  19744. } else if (value >= 247 && value <= 250) {
  19745. return (value - 247) * 256 + dict[pos++] + 108;
  19746. } else if (value >= 251 && value <= 254) {
  19747. return -((value - 251) * 256) - dict[pos++] - 108;
  19748. }
  19749. warn('CFFParser_parseDict: "' + value + '" is a reserved command.');
  19750. return NaN;
  19751. }
  19752. function parseFloatOperand() {
  19753. var str = '';
  19754. var eof = 15;
  19755. var lookup = [
  19756. '0',
  19757. '1',
  19758. '2',
  19759. '3',
  19760. '4',
  19761. '5',
  19762. '6',
  19763. '7',
  19764. '8',
  19765. '9',
  19766. '.',
  19767. 'E',
  19768. 'E-',
  19769. null,
  19770. '-'
  19771. ];
  19772. var length = dict.length;
  19773. while (pos < length) {
  19774. var b = dict[pos++];
  19775. var b1 = b >> 4;
  19776. var b2 = b & 15;
  19777. if (b1 === eof) {
  19778. break;
  19779. }
  19780. str += lookup[b1];
  19781. if (b2 === eof) {
  19782. break;
  19783. }
  19784. str += lookup[b2];
  19785. }
  19786. return parseFloat(str);
  19787. }
  19788. var operands = [];
  19789. var entries = [];
  19790. pos = 0;
  19791. var end = dict.length;
  19792. while (pos < end) {
  19793. var b = dict[pos];
  19794. if (b <= 21) {
  19795. if (b === 12) {
  19796. b = b << 8 | dict[++pos];
  19797. }
  19798. entries.push([
  19799. b,
  19800. operands
  19801. ]);
  19802. operands = [];
  19803. ++pos;
  19804. } else {
  19805. operands.push(parseOperand());
  19806. }
  19807. }
  19808. return entries;
  19809. },
  19810. parseIndex: function CFFParser_parseIndex(pos) {
  19811. var cffIndex = new CFFIndex();
  19812. var bytes = this.bytes;
  19813. var count = bytes[pos++] << 8 | bytes[pos++];
  19814. var offsets = [];
  19815. var end = pos;
  19816. var i, ii;
  19817. if (count !== 0) {
  19818. var offsetSize = bytes[pos++];
  19819. var startPos = pos + (count + 1) * offsetSize - 1;
  19820. for (i = 0, ii = count + 1; i < ii; ++i) {
  19821. var offset = 0;
  19822. for (var j = 0; j < offsetSize; ++j) {
  19823. offset <<= 8;
  19824. offset += bytes[pos++];
  19825. }
  19826. offsets.push(startPos + offset);
  19827. }
  19828. end = offsets[count];
  19829. }
  19830. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  19831. var offsetStart = offsets[i];
  19832. var offsetEnd = offsets[i + 1];
  19833. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  19834. }
  19835. return {
  19836. obj: cffIndex,
  19837. endPos: end
  19838. };
  19839. },
  19840. parseNameIndex: function CFFParser_parseNameIndex(index) {
  19841. var names = [];
  19842. for (var i = 0, ii = index.count; i < ii; ++i) {
  19843. var name = index.get(i);
  19844. var length = Math.min(name.length, 127);
  19845. var data = [];
  19846. for (var j = 0; j < length; ++j) {
  19847. var c = name[j];
  19848. if (j === 0 && c === 0) {
  19849. data[j] = c;
  19850. continue;
  19851. }
  19852. 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) {
  19853. data[j] = 95;
  19854. continue;
  19855. }
  19856. data[j] = c;
  19857. }
  19858. names.push(bytesToString(data));
  19859. }
  19860. return names;
  19861. },
  19862. parseStringIndex: function CFFParser_parseStringIndex(index) {
  19863. var strings = new CFFStrings();
  19864. for (var i = 0, ii = index.count; i < ii; ++i) {
  19865. var data = index.get(i);
  19866. strings.add(bytesToString(data));
  19867. }
  19868. return strings;
  19869. },
  19870. createDict: function CFFParser_createDict(Type, dict, strings) {
  19871. var cffDict = new Type(strings);
  19872. for (var i = 0, ii = dict.length; i < ii; ++i) {
  19873. var pair = dict[i];
  19874. var key = pair[0];
  19875. var value = pair[1];
  19876. cffDict.setByKey(key, value);
  19877. }
  19878. return cffDict;
  19879. },
  19880. parseCharString: function CFFParser_parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  19881. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  19882. return false;
  19883. }
  19884. var stackSize = state.stackSize;
  19885. var stack = state.stack;
  19886. var length = data.length;
  19887. for (var j = 0; j < length;) {
  19888. var value = data[j++];
  19889. var validationCommand = null;
  19890. if (value === 12) {
  19891. var q = data[j++];
  19892. if (q === 0) {
  19893. data[j - 2] = 139;
  19894. data[j - 1] = 22;
  19895. stackSize = 0;
  19896. } else {
  19897. validationCommand = CharstringValidationData12[q];
  19898. }
  19899. } else if (value === 28) {
  19900. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  19901. j += 2;
  19902. stackSize++;
  19903. } else if (value === 14) {
  19904. if (stackSize >= 4) {
  19905. stackSize -= 4;
  19906. if (this.seacAnalysisEnabled) {
  19907. state.seac = stack.slice(stackSize, stackSize + 4);
  19908. return false;
  19909. }
  19910. }
  19911. validationCommand = CharstringValidationData[value];
  19912. } else if (value >= 32 && value <= 246) {
  19913. stack[stackSize] = value - 139;
  19914. stackSize++;
  19915. } else if (value >= 247 && value <= 254) {
  19916. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  19917. j++;
  19918. stackSize++;
  19919. } else if (value === 255) {
  19920. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  19921. j += 4;
  19922. stackSize++;
  19923. } else if (value === 19 || value === 20) {
  19924. state.hints += stackSize >> 1;
  19925. j += state.hints + 7 >> 3;
  19926. stackSize %= 2;
  19927. validationCommand = CharstringValidationData[value];
  19928. } else if (value === 10 || value === 29) {
  19929. var subrsIndex;
  19930. if (value === 10) {
  19931. subrsIndex = localSubrIndex;
  19932. } else {
  19933. subrsIndex = globalSubrIndex;
  19934. }
  19935. if (!subrsIndex) {
  19936. validationCommand = CharstringValidationData[value];
  19937. warn('Missing subrsIndex for ' + validationCommand.id);
  19938. return false;
  19939. }
  19940. var bias = 32768;
  19941. if (subrsIndex.count < 1240) {
  19942. bias = 107;
  19943. } else if (subrsIndex.count < 33900) {
  19944. bias = 1131;
  19945. }
  19946. var subrNumber = stack[--stackSize] + bias;
  19947. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  19948. validationCommand = CharstringValidationData[value];
  19949. warn('Out of bounds subrIndex for ' + validationCommand.id);
  19950. return false;
  19951. }
  19952. state.stackSize = stackSize;
  19953. state.callDepth++;
  19954. var valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  19955. if (!valid) {
  19956. return false;
  19957. }
  19958. state.callDepth--;
  19959. stackSize = state.stackSize;
  19960. continue;
  19961. } else if (value === 11) {
  19962. state.stackSize = stackSize;
  19963. return true;
  19964. } else {
  19965. validationCommand = CharstringValidationData[value];
  19966. }
  19967. if (validationCommand) {
  19968. if (validationCommand.stem) {
  19969. state.hints += stackSize >> 1;
  19970. }
  19971. if ('min' in validationCommand) {
  19972. if (!state.undefStack && stackSize < validationCommand.min) {
  19973. warn('Not enough parameters for ' + validationCommand.id + '; actual: ' + stackSize + ', expected: ' + validationCommand.min);
  19974. return false;
  19975. }
  19976. }
  19977. if (state.firstStackClearing && validationCommand.stackClearing) {
  19978. state.firstStackClearing = false;
  19979. stackSize -= validationCommand.min;
  19980. if (stackSize >= 2 && validationCommand.stem) {
  19981. stackSize %= 2;
  19982. } else if (stackSize > 1) {
  19983. warn('Found too many parameters for stack-clearing command');
  19984. }
  19985. if (stackSize > 0 && stack[stackSize - 1] >= 0) {
  19986. state.width = stack[stackSize - 1];
  19987. }
  19988. }
  19989. if ('stackDelta' in validationCommand) {
  19990. if ('stackFn' in validationCommand) {
  19991. validationCommand.stackFn(stack, stackSize);
  19992. }
  19993. stackSize += validationCommand.stackDelta;
  19994. } else if (validationCommand.stackClearing) {
  19995. stackSize = 0;
  19996. } else if (validationCommand.resetStack) {
  19997. stackSize = 0;
  19998. state.undefStack = false;
  19999. } else if (validationCommand.undefStack) {
  20000. stackSize = 0;
  20001. state.undefStack = true;
  20002. state.firstStackClearing = false;
  20003. }
  20004. }
  20005. }
  20006. state.stackSize = stackSize;
  20007. return true;
  20008. },
  20009. parseCharStrings: function CFFParser_parseCharStrings(charStrings, localSubrIndex, globalSubrIndex, fdSelect, fdArray) {
  20010. var seacs = [];
  20011. var widths = [];
  20012. var count = charStrings.count;
  20013. for (var i = 0; i < count; i++) {
  20014. var charstring = charStrings.get(i);
  20015. var state = {
  20016. callDepth: 0,
  20017. stackSize: 0,
  20018. stack: [],
  20019. undefStack: true,
  20020. hints: 0,
  20021. firstStackClearing: true,
  20022. seac: null,
  20023. width: null
  20024. };
  20025. var valid = true;
  20026. var localSubrToUse = null;
  20027. if (fdSelect && fdArray.length) {
  20028. var fdIndex = fdSelect.getFDIndex(i);
  20029. if (fdIndex === -1) {
  20030. warn('Glyph index is not in fd select.');
  20031. valid = false;
  20032. }
  20033. if (fdIndex >= fdArray.length) {
  20034. warn('Invalid fd index for glyph index.');
  20035. valid = false;
  20036. }
  20037. if (valid) {
  20038. localSubrToUse = fdArray[fdIndex].privateDict.subrsIndex;
  20039. }
  20040. } else if (localSubrIndex) {
  20041. localSubrToUse = localSubrIndex;
  20042. }
  20043. if (valid) {
  20044. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  20045. }
  20046. if (state.width !== null) {
  20047. widths[i] = state.width;
  20048. }
  20049. if (state.seac !== null) {
  20050. seacs[i] = state.seac;
  20051. }
  20052. if (!valid) {
  20053. charStrings.set(i, new Uint8Array([14]));
  20054. }
  20055. }
  20056. return {
  20057. charStrings: charStrings,
  20058. seacs: seacs,
  20059. widths: widths
  20060. };
  20061. },
  20062. emptyPrivateDictionary: function CFFParser_emptyPrivateDictionary(parentDict) {
  20063. var privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  20064. parentDict.setByKey(18, [
  20065. 0,
  20066. 0
  20067. ]);
  20068. parentDict.privateDict = privateDict;
  20069. },
  20070. parsePrivateDict: function CFFParser_parsePrivateDict(parentDict) {
  20071. if (!parentDict.hasName('Private')) {
  20072. this.emptyPrivateDictionary(parentDict);
  20073. return;
  20074. }
  20075. var privateOffset = parentDict.getByName('Private');
  20076. if (!isArray(privateOffset) || privateOffset.length !== 2) {
  20077. parentDict.removeByName('Private');
  20078. return;
  20079. }
  20080. var size = privateOffset[0];
  20081. var offset = privateOffset[1];
  20082. if (size === 0 || offset >= this.bytes.length) {
  20083. this.emptyPrivateDictionary(parentDict);
  20084. return;
  20085. }
  20086. var privateDictEnd = offset + size;
  20087. var dictData = this.bytes.subarray(offset, privateDictEnd);
  20088. var dict = this.parseDict(dictData);
  20089. var privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  20090. parentDict.privateDict = privateDict;
  20091. if (!privateDict.getByName('Subrs')) {
  20092. return;
  20093. }
  20094. var subrsOffset = privateDict.getByName('Subrs');
  20095. var relativeOffset = offset + subrsOffset;
  20096. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  20097. this.emptyPrivateDictionary(parentDict);
  20098. return;
  20099. }
  20100. var subrsIndex = this.parseIndex(relativeOffset);
  20101. privateDict.subrsIndex = subrsIndex.obj;
  20102. },
  20103. parseCharsets: function CFFParser_parseCharsets(pos, length, strings, cid) {
  20104. if (pos === 0) {
  20105. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, ISOAdobeCharset);
  20106. } else if (pos === 1) {
  20107. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, ExpertCharset);
  20108. } else if (pos === 2) {
  20109. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, ExpertSubsetCharset);
  20110. }
  20111. var bytes = this.bytes;
  20112. var start = pos;
  20113. var format = bytes[pos++];
  20114. var charset = ['.notdef'];
  20115. var id, count, i;
  20116. length -= 1;
  20117. switch (format) {
  20118. case 0:
  20119. for (i = 0; i < length; i++) {
  20120. id = bytes[pos++] << 8 | bytes[pos++];
  20121. charset.push(cid ? id : strings.get(id));
  20122. }
  20123. break;
  20124. case 1:
  20125. while (charset.length <= length) {
  20126. id = bytes[pos++] << 8 | bytes[pos++];
  20127. count = bytes[pos++];
  20128. for (i = 0; i <= count; i++) {
  20129. charset.push(cid ? id++ : strings.get(id++));
  20130. }
  20131. }
  20132. break;
  20133. case 2:
  20134. while (charset.length <= length) {
  20135. id = bytes[pos++] << 8 | bytes[pos++];
  20136. count = bytes[pos++] << 8 | bytes[pos++];
  20137. for (i = 0; i <= count; i++) {
  20138. charset.push(cid ? id++ : strings.get(id++));
  20139. }
  20140. }
  20141. break;
  20142. default:
  20143. error('Unknown charset format');
  20144. }
  20145. var end = pos;
  20146. var raw = bytes.subarray(start, end);
  20147. return new CFFCharset(false, format, charset, raw);
  20148. },
  20149. parseEncoding: function CFFParser_parseEncoding(pos, properties, strings, charset) {
  20150. var encoding = Object.create(null);
  20151. var bytes = this.bytes;
  20152. var predefined = false;
  20153. var format, i, ii;
  20154. var raw = null;
  20155. function readSupplement() {
  20156. var supplementsCount = bytes[pos++];
  20157. for (i = 0; i < supplementsCount; i++) {
  20158. var code = bytes[pos++];
  20159. var sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  20160. encoding[code] = charset.indexOf(strings.get(sid));
  20161. }
  20162. }
  20163. if (pos === 0 || pos === 1) {
  20164. predefined = true;
  20165. format = pos;
  20166. var baseEncoding = pos ? ExpertEncoding : StandardEncoding;
  20167. for (i = 0, ii = charset.length; i < ii; i++) {
  20168. var index = baseEncoding.indexOf(charset[i]);
  20169. if (index !== -1) {
  20170. encoding[index] = i;
  20171. }
  20172. }
  20173. } else {
  20174. var dataStart = pos;
  20175. format = bytes[pos++];
  20176. switch (format & 0x7f) {
  20177. case 0:
  20178. var glyphsCount = bytes[pos++];
  20179. for (i = 1; i <= glyphsCount; i++) {
  20180. encoding[bytes[pos++]] = i;
  20181. }
  20182. break;
  20183. case 1:
  20184. var rangesCount = bytes[pos++];
  20185. var gid = 1;
  20186. for (i = 0; i < rangesCount; i++) {
  20187. var start = bytes[pos++];
  20188. var left = bytes[pos++];
  20189. for (var j = start; j <= start + left; j++) {
  20190. encoding[j] = gid++;
  20191. }
  20192. }
  20193. break;
  20194. default:
  20195. error('Unknown encoding format: ' + format + ' in CFF');
  20196. break;
  20197. }
  20198. var dataEnd = pos;
  20199. if (format & 0x80) {
  20200. bytes[dataStart] &= 0x7f;
  20201. readSupplement();
  20202. }
  20203. raw = bytes.subarray(dataStart, dataEnd);
  20204. }
  20205. format = format & 0x7f;
  20206. return new CFFEncoding(predefined, format, encoding, raw);
  20207. },
  20208. parseFDSelect: function CFFParser_parseFDSelect(pos, length) {
  20209. var start = pos;
  20210. var bytes = this.bytes;
  20211. var format = bytes[pos++];
  20212. var fdSelect = [], rawBytes;
  20213. var i, invalidFirstGID = false;
  20214. switch (format) {
  20215. case 0:
  20216. for (i = 0; i < length; ++i) {
  20217. var id = bytes[pos++];
  20218. fdSelect.push(id);
  20219. }
  20220. rawBytes = bytes.subarray(start, pos);
  20221. break;
  20222. case 3:
  20223. var rangesCount = bytes[pos++] << 8 | bytes[pos++];
  20224. for (i = 0; i < rangesCount; ++i) {
  20225. var first = bytes[pos++] << 8 | bytes[pos++];
  20226. if (i === 0 && first !== 0) {
  20227. warn('parseFDSelect: The first range must have a first GID of 0' + ' -- trying to recover.');
  20228. invalidFirstGID = true;
  20229. first = 0;
  20230. }
  20231. var fdIndex = bytes[pos++];
  20232. var next = bytes[pos] << 8 | bytes[pos + 1];
  20233. for (var j = first; j < next; ++j) {
  20234. fdSelect.push(fdIndex);
  20235. }
  20236. }
  20237. pos += 2;
  20238. rawBytes = bytes.subarray(start, pos);
  20239. if (invalidFirstGID) {
  20240. rawBytes[3] = rawBytes[4] = 0;
  20241. }
  20242. break;
  20243. default:
  20244. error('parseFDSelect: Unknown format "' + format + '".');
  20245. break;
  20246. }
  20247. assert(fdSelect.length === length, 'parseFDSelect: Invalid font data.');
  20248. return new CFFFDSelect(fdSelect, rawBytes);
  20249. }
  20250. };
  20251. return CFFParser;
  20252. }();
  20253. var CFF = function CFFClosure() {
  20254. function CFF() {
  20255. this.header = null;
  20256. this.names = [];
  20257. this.topDict = null;
  20258. this.strings = new CFFStrings();
  20259. this.globalSubrIndex = null;
  20260. this.encoding = null;
  20261. this.charset = null;
  20262. this.charStrings = null;
  20263. this.fdArray = [];
  20264. this.fdSelect = null;
  20265. this.isCIDFont = false;
  20266. }
  20267. return CFF;
  20268. }();
  20269. var CFFHeader = function CFFHeaderClosure() {
  20270. function CFFHeader(major, minor, hdrSize, offSize) {
  20271. this.major = major;
  20272. this.minor = minor;
  20273. this.hdrSize = hdrSize;
  20274. this.offSize = offSize;
  20275. }
  20276. return CFFHeader;
  20277. }();
  20278. var CFFStrings = function CFFStringsClosure() {
  20279. function CFFStrings() {
  20280. this.strings = [];
  20281. }
  20282. CFFStrings.prototype = {
  20283. get: function CFFStrings_get(index) {
  20284. if (index >= 0 && index <= 390) {
  20285. return CFFStandardStrings[index];
  20286. }
  20287. if (index - 391 <= this.strings.length) {
  20288. return this.strings[index - 391];
  20289. }
  20290. return CFFStandardStrings[0];
  20291. },
  20292. add: function CFFStrings_add(value) {
  20293. this.strings.push(value);
  20294. },
  20295. get count() {
  20296. return this.strings.length;
  20297. }
  20298. };
  20299. return CFFStrings;
  20300. }();
  20301. var CFFIndex = function CFFIndexClosure() {
  20302. function CFFIndex() {
  20303. this.objects = [];
  20304. this.length = 0;
  20305. }
  20306. CFFIndex.prototype = {
  20307. add: function CFFIndex_add(data) {
  20308. this.length += data.length;
  20309. this.objects.push(data);
  20310. },
  20311. set: function CFFIndex_set(index, data) {
  20312. this.length += data.length - this.objects[index].length;
  20313. this.objects[index] = data;
  20314. },
  20315. get: function CFFIndex_get(index) {
  20316. return this.objects[index];
  20317. },
  20318. get count() {
  20319. return this.objects.length;
  20320. }
  20321. };
  20322. return CFFIndex;
  20323. }();
  20324. var CFFDict = function CFFDictClosure() {
  20325. function CFFDict(tables, strings) {
  20326. this.keyToNameMap = tables.keyToNameMap;
  20327. this.nameToKeyMap = tables.nameToKeyMap;
  20328. this.defaults = tables.defaults;
  20329. this.types = tables.types;
  20330. this.opcodes = tables.opcodes;
  20331. this.order = tables.order;
  20332. this.strings = strings;
  20333. this.values = Object.create(null);
  20334. }
  20335. CFFDict.prototype = {
  20336. setByKey: function CFFDict_setByKey(key, value) {
  20337. if (!(key in this.keyToNameMap)) {
  20338. return false;
  20339. }
  20340. var valueLength = value.length;
  20341. if (valueLength === 0) {
  20342. return true;
  20343. }
  20344. for (var i = 0; i < valueLength; i++) {
  20345. if (isNaN(value[i])) {
  20346. warn('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
  20347. return true;
  20348. }
  20349. }
  20350. var type = this.types[key];
  20351. if (type === 'num' || type === 'sid' || type === 'offset') {
  20352. value = value[0];
  20353. }
  20354. this.values[key] = value;
  20355. return true;
  20356. },
  20357. setByName: function CFFDict_setByName(name, value) {
  20358. if (!(name in this.nameToKeyMap)) {
  20359. error('Invalid dictionary name "' + name + '"');
  20360. }
  20361. this.values[this.nameToKeyMap[name]] = value;
  20362. },
  20363. hasName: function CFFDict_hasName(name) {
  20364. return this.nameToKeyMap[name] in this.values;
  20365. },
  20366. getByName: function CFFDict_getByName(name) {
  20367. if (!(name in this.nameToKeyMap)) {
  20368. error('Invalid dictionary name "' + name + '"');
  20369. }
  20370. var key = this.nameToKeyMap[name];
  20371. if (!(key in this.values)) {
  20372. return this.defaults[key];
  20373. }
  20374. return this.values[key];
  20375. },
  20376. removeByName: function CFFDict_removeByName(name) {
  20377. delete this.values[this.nameToKeyMap[name]];
  20378. }
  20379. };
  20380. CFFDict.createTables = function CFFDict_createTables(layout) {
  20381. var tables = {
  20382. keyToNameMap: {},
  20383. nameToKeyMap: {},
  20384. defaults: {},
  20385. types: {},
  20386. opcodes: {},
  20387. order: []
  20388. };
  20389. for (var i = 0, ii = layout.length; i < ii; ++i) {
  20390. var entry = layout[i];
  20391. var key = isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  20392. tables.keyToNameMap[key] = entry[1];
  20393. tables.nameToKeyMap[entry[1]] = key;
  20394. tables.types[key] = entry[2];
  20395. tables.defaults[key] = entry[3];
  20396. tables.opcodes[key] = isArray(entry[0]) ? entry[0] : [entry[0]];
  20397. tables.order.push(key);
  20398. }
  20399. return tables;
  20400. };
  20401. return CFFDict;
  20402. }();
  20403. var CFFTopDict = function CFFTopDictClosure() {
  20404. var layout = [
  20405. [
  20406. [
  20407. 12,
  20408. 30
  20409. ],
  20410. 'ROS',
  20411. [
  20412. 'sid',
  20413. 'sid',
  20414. 'num'
  20415. ],
  20416. null
  20417. ],
  20418. [
  20419. [
  20420. 12,
  20421. 20
  20422. ],
  20423. 'SyntheticBase',
  20424. 'num',
  20425. null
  20426. ],
  20427. [
  20428. 0,
  20429. 'version',
  20430. 'sid',
  20431. null
  20432. ],
  20433. [
  20434. 1,
  20435. 'Notice',
  20436. 'sid',
  20437. null
  20438. ],
  20439. [
  20440. [
  20441. 12,
  20442. 0
  20443. ],
  20444. 'Copyright',
  20445. 'sid',
  20446. null
  20447. ],
  20448. [
  20449. 2,
  20450. 'FullName',
  20451. 'sid',
  20452. null
  20453. ],
  20454. [
  20455. 3,
  20456. 'FamilyName',
  20457. 'sid',
  20458. null
  20459. ],
  20460. [
  20461. 4,
  20462. 'Weight',
  20463. 'sid',
  20464. null
  20465. ],
  20466. [
  20467. [
  20468. 12,
  20469. 1
  20470. ],
  20471. 'isFixedPitch',
  20472. 'num',
  20473. 0
  20474. ],
  20475. [
  20476. [
  20477. 12,
  20478. 2
  20479. ],
  20480. 'ItalicAngle',
  20481. 'num',
  20482. 0
  20483. ],
  20484. [
  20485. [
  20486. 12,
  20487. 3
  20488. ],
  20489. 'UnderlinePosition',
  20490. 'num',
  20491. -100
  20492. ],
  20493. [
  20494. [
  20495. 12,
  20496. 4
  20497. ],
  20498. 'UnderlineThickness',
  20499. 'num',
  20500. 50
  20501. ],
  20502. [
  20503. [
  20504. 12,
  20505. 5
  20506. ],
  20507. 'PaintType',
  20508. 'num',
  20509. 0
  20510. ],
  20511. [
  20512. [
  20513. 12,
  20514. 6
  20515. ],
  20516. 'CharstringType',
  20517. 'num',
  20518. 2
  20519. ],
  20520. [
  20521. [
  20522. 12,
  20523. 7
  20524. ],
  20525. 'FontMatrix',
  20526. [
  20527. 'num',
  20528. 'num',
  20529. 'num',
  20530. 'num',
  20531. 'num',
  20532. 'num'
  20533. ],
  20534. [
  20535. 0.001,
  20536. 0,
  20537. 0,
  20538. 0.001,
  20539. 0,
  20540. 0
  20541. ]
  20542. ],
  20543. [
  20544. 13,
  20545. 'UniqueID',
  20546. 'num',
  20547. null
  20548. ],
  20549. [
  20550. 5,
  20551. 'FontBBox',
  20552. [
  20553. 'num',
  20554. 'num',
  20555. 'num',
  20556. 'num'
  20557. ],
  20558. [
  20559. 0,
  20560. 0,
  20561. 0,
  20562. 0
  20563. ]
  20564. ],
  20565. [
  20566. [
  20567. 12,
  20568. 8
  20569. ],
  20570. 'StrokeWidth',
  20571. 'num',
  20572. 0
  20573. ],
  20574. [
  20575. 14,
  20576. 'XUID',
  20577. 'array',
  20578. null
  20579. ],
  20580. [
  20581. 15,
  20582. 'charset',
  20583. 'offset',
  20584. 0
  20585. ],
  20586. [
  20587. 16,
  20588. 'Encoding',
  20589. 'offset',
  20590. 0
  20591. ],
  20592. [
  20593. 17,
  20594. 'CharStrings',
  20595. 'offset',
  20596. 0
  20597. ],
  20598. [
  20599. 18,
  20600. 'Private',
  20601. [
  20602. 'offset',
  20603. 'offset'
  20604. ],
  20605. null
  20606. ],
  20607. [
  20608. [
  20609. 12,
  20610. 21
  20611. ],
  20612. 'PostScript',
  20613. 'sid',
  20614. null
  20615. ],
  20616. [
  20617. [
  20618. 12,
  20619. 22
  20620. ],
  20621. 'BaseFontName',
  20622. 'sid',
  20623. null
  20624. ],
  20625. [
  20626. [
  20627. 12,
  20628. 23
  20629. ],
  20630. 'BaseFontBlend',
  20631. 'delta',
  20632. null
  20633. ],
  20634. [
  20635. [
  20636. 12,
  20637. 31
  20638. ],
  20639. 'CIDFontVersion',
  20640. 'num',
  20641. 0
  20642. ],
  20643. [
  20644. [
  20645. 12,
  20646. 32
  20647. ],
  20648. 'CIDFontRevision',
  20649. 'num',
  20650. 0
  20651. ],
  20652. [
  20653. [
  20654. 12,
  20655. 33
  20656. ],
  20657. 'CIDFontType',
  20658. 'num',
  20659. 0
  20660. ],
  20661. [
  20662. [
  20663. 12,
  20664. 34
  20665. ],
  20666. 'CIDCount',
  20667. 'num',
  20668. 8720
  20669. ],
  20670. [
  20671. [
  20672. 12,
  20673. 35
  20674. ],
  20675. 'UIDBase',
  20676. 'num',
  20677. null
  20678. ],
  20679. [
  20680. [
  20681. 12,
  20682. 37
  20683. ],
  20684. 'FDSelect',
  20685. 'offset',
  20686. null
  20687. ],
  20688. [
  20689. [
  20690. 12,
  20691. 36
  20692. ],
  20693. 'FDArray',
  20694. 'offset',
  20695. null
  20696. ],
  20697. [
  20698. [
  20699. 12,
  20700. 38
  20701. ],
  20702. 'FontName',
  20703. 'sid',
  20704. null
  20705. ]
  20706. ];
  20707. var tables = null;
  20708. function CFFTopDict(strings) {
  20709. if (tables === null) {
  20710. tables = CFFDict.createTables(layout);
  20711. }
  20712. CFFDict.call(this, tables, strings);
  20713. this.privateDict = null;
  20714. }
  20715. CFFTopDict.prototype = Object.create(CFFDict.prototype);
  20716. return CFFTopDict;
  20717. }();
  20718. var CFFPrivateDict = function CFFPrivateDictClosure() {
  20719. var layout = [
  20720. [
  20721. 6,
  20722. 'BlueValues',
  20723. 'delta',
  20724. null
  20725. ],
  20726. [
  20727. 7,
  20728. 'OtherBlues',
  20729. 'delta',
  20730. null
  20731. ],
  20732. [
  20733. 8,
  20734. 'FamilyBlues',
  20735. 'delta',
  20736. null
  20737. ],
  20738. [
  20739. 9,
  20740. 'FamilyOtherBlues',
  20741. 'delta',
  20742. null
  20743. ],
  20744. [
  20745. [
  20746. 12,
  20747. 9
  20748. ],
  20749. 'BlueScale',
  20750. 'num',
  20751. 0.039625
  20752. ],
  20753. [
  20754. [
  20755. 12,
  20756. 10
  20757. ],
  20758. 'BlueShift',
  20759. 'num',
  20760. 7
  20761. ],
  20762. [
  20763. [
  20764. 12,
  20765. 11
  20766. ],
  20767. 'BlueFuzz',
  20768. 'num',
  20769. 1
  20770. ],
  20771. [
  20772. 10,
  20773. 'StdHW',
  20774. 'num',
  20775. null
  20776. ],
  20777. [
  20778. 11,
  20779. 'StdVW',
  20780. 'num',
  20781. null
  20782. ],
  20783. [
  20784. [
  20785. 12,
  20786. 12
  20787. ],
  20788. 'StemSnapH',
  20789. 'delta',
  20790. null
  20791. ],
  20792. [
  20793. [
  20794. 12,
  20795. 13
  20796. ],
  20797. 'StemSnapV',
  20798. 'delta',
  20799. null
  20800. ],
  20801. [
  20802. [
  20803. 12,
  20804. 14
  20805. ],
  20806. 'ForceBold',
  20807. 'num',
  20808. 0
  20809. ],
  20810. [
  20811. [
  20812. 12,
  20813. 17
  20814. ],
  20815. 'LanguageGroup',
  20816. 'num',
  20817. 0
  20818. ],
  20819. [
  20820. [
  20821. 12,
  20822. 18
  20823. ],
  20824. 'ExpansionFactor',
  20825. 'num',
  20826. 0.06
  20827. ],
  20828. [
  20829. [
  20830. 12,
  20831. 19
  20832. ],
  20833. 'initialRandomSeed',
  20834. 'num',
  20835. 0
  20836. ],
  20837. [
  20838. 20,
  20839. 'defaultWidthX',
  20840. 'num',
  20841. 0
  20842. ],
  20843. [
  20844. 21,
  20845. 'nominalWidthX',
  20846. 'num',
  20847. 0
  20848. ],
  20849. [
  20850. 19,
  20851. 'Subrs',
  20852. 'offset',
  20853. null
  20854. ]
  20855. ];
  20856. var tables = null;
  20857. function CFFPrivateDict(strings) {
  20858. if (tables === null) {
  20859. tables = CFFDict.createTables(layout);
  20860. }
  20861. CFFDict.call(this, tables, strings);
  20862. this.subrsIndex = null;
  20863. }
  20864. CFFPrivateDict.prototype = Object.create(CFFDict.prototype);
  20865. return CFFPrivateDict;
  20866. }();
  20867. var CFFCharsetPredefinedTypes = {
  20868. ISO_ADOBE: 0,
  20869. EXPERT: 1,
  20870. EXPERT_SUBSET: 2
  20871. };
  20872. var CFFCharset = function CFFCharsetClosure() {
  20873. function CFFCharset(predefined, format, charset, raw) {
  20874. this.predefined = predefined;
  20875. this.format = format;
  20876. this.charset = charset;
  20877. this.raw = raw;
  20878. }
  20879. return CFFCharset;
  20880. }();
  20881. var CFFEncoding = function CFFEncodingClosure() {
  20882. function CFFEncoding(predefined, format, encoding, raw) {
  20883. this.predefined = predefined;
  20884. this.format = format;
  20885. this.encoding = encoding;
  20886. this.raw = raw;
  20887. }
  20888. return CFFEncoding;
  20889. }();
  20890. var CFFFDSelect = function CFFFDSelectClosure() {
  20891. function CFFFDSelect(fdSelect, raw) {
  20892. this.fdSelect = fdSelect;
  20893. this.raw = raw;
  20894. }
  20895. CFFFDSelect.prototype = {
  20896. getFDIndex: function CFFFDSelect_get(glyphIndex) {
  20897. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  20898. return -1;
  20899. }
  20900. return this.fdSelect[glyphIndex];
  20901. }
  20902. };
  20903. return CFFFDSelect;
  20904. }();
  20905. var CFFOffsetTracker = function CFFOffsetTrackerClosure() {
  20906. function CFFOffsetTracker() {
  20907. this.offsets = Object.create(null);
  20908. }
  20909. CFFOffsetTracker.prototype = {
  20910. isTracking: function CFFOffsetTracker_isTracking(key) {
  20911. return key in this.offsets;
  20912. },
  20913. track: function CFFOffsetTracker_track(key, location) {
  20914. if (key in this.offsets) {
  20915. error('Already tracking location of ' + key);
  20916. }
  20917. this.offsets[key] = location;
  20918. },
  20919. offset: function CFFOffsetTracker_offset(value) {
  20920. for (var key in this.offsets) {
  20921. this.offsets[key] += value;
  20922. }
  20923. },
  20924. setEntryLocation: function CFFOffsetTracker_setEntryLocation(key, values, output) {
  20925. if (!(key in this.offsets)) {
  20926. error('Not tracking location of ' + key);
  20927. }
  20928. var data = output.data;
  20929. var dataOffset = this.offsets[key];
  20930. var size = 5;
  20931. for (var i = 0, ii = values.length; i < ii; ++i) {
  20932. var offset0 = i * size + dataOffset;
  20933. var offset1 = offset0 + 1;
  20934. var offset2 = offset0 + 2;
  20935. var offset3 = offset0 + 3;
  20936. var offset4 = offset0 + 4;
  20937. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  20938. error('writing to an offset that is not empty');
  20939. }
  20940. var value = values[i];
  20941. data[offset0] = 0x1d;
  20942. data[offset1] = value >> 24 & 0xFF;
  20943. data[offset2] = value >> 16 & 0xFF;
  20944. data[offset3] = value >> 8 & 0xFF;
  20945. data[offset4] = value & 0xFF;
  20946. }
  20947. }
  20948. };
  20949. return CFFOffsetTracker;
  20950. }();
  20951. var CFFCompiler = function CFFCompilerClosure() {
  20952. function CFFCompiler(cff) {
  20953. this.cff = cff;
  20954. }
  20955. CFFCompiler.prototype = {
  20956. compile: function CFFCompiler_compile() {
  20957. var cff = this.cff;
  20958. var output = {
  20959. data: [],
  20960. length: 0,
  20961. add: function CFFCompiler_add(data) {
  20962. this.data = this.data.concat(data);
  20963. this.length = this.data.length;
  20964. }
  20965. };
  20966. var header = this.compileHeader(cff.header);
  20967. output.add(header);
  20968. var nameIndex = this.compileNameIndex(cff.names);
  20969. output.add(nameIndex);
  20970. if (cff.isCIDFont) {
  20971. if (cff.topDict.hasName('FontMatrix')) {
  20972. var base = cff.topDict.getByName('FontMatrix');
  20973. cff.topDict.removeByName('FontMatrix');
  20974. for (var i = 0, ii = cff.fdArray.length; i < ii; i++) {
  20975. var subDict = cff.fdArray[i];
  20976. var matrix = base.slice(0);
  20977. if (subDict.hasName('FontMatrix')) {
  20978. matrix = Util.transform(matrix, subDict.getByName('FontMatrix'));
  20979. }
  20980. subDict.setByName('FontMatrix', matrix);
  20981. }
  20982. }
  20983. }
  20984. var compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  20985. output.add(compiled.output);
  20986. var topDictTracker = compiled.trackers[0];
  20987. var stringIndex = this.compileStringIndex(cff.strings.strings);
  20988. output.add(stringIndex);
  20989. var globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  20990. output.add(globalSubrIndex);
  20991. if (cff.encoding && cff.topDict.hasName('Encoding')) {
  20992. if (cff.encoding.predefined) {
  20993. topDictTracker.setEntryLocation('Encoding', [cff.encoding.format], output);
  20994. } else {
  20995. var encoding = this.compileEncoding(cff.encoding);
  20996. topDictTracker.setEntryLocation('Encoding', [output.length], output);
  20997. output.add(encoding);
  20998. }
  20999. }
  21000. if (cff.charset && cff.topDict.hasName('charset')) {
  21001. if (cff.charset.predefined) {
  21002. topDictTracker.setEntryLocation('charset', [cff.charset.format], output);
  21003. } else {
  21004. var charset = this.compileCharset(cff.charset);
  21005. topDictTracker.setEntryLocation('charset', [output.length], output);
  21006. output.add(charset);
  21007. }
  21008. }
  21009. var charStrings = this.compileCharStrings(cff.charStrings);
  21010. topDictTracker.setEntryLocation('CharStrings', [output.length], output);
  21011. output.add(charStrings);
  21012. if (cff.isCIDFont) {
  21013. topDictTracker.setEntryLocation('FDSelect', [output.length], output);
  21014. var fdSelect = this.compileFDSelect(cff.fdSelect.raw);
  21015. output.add(fdSelect);
  21016. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  21017. topDictTracker.setEntryLocation('FDArray', [output.length], output);
  21018. output.add(compiled.output);
  21019. var fontDictTrackers = compiled.trackers;
  21020. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  21021. }
  21022. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  21023. output.add([0]);
  21024. return output.data;
  21025. },
  21026. encodeNumber: function CFFCompiler_encodeNumber(value) {
  21027. if (parseFloat(value) === parseInt(value, 10) && !isNaN(value)) {
  21028. return this.encodeInteger(value);
  21029. }
  21030. return this.encodeFloat(value);
  21031. },
  21032. encodeFloat: function CFFCompiler_encodeFloat(num) {
  21033. var value = num.toString();
  21034. var m = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value);
  21035. if (m) {
  21036. var epsilon = parseFloat('1e' + ((m[2] ? +m[2] : 0) + m[1].length));
  21037. value = (Math.round(num * epsilon) / epsilon).toString();
  21038. }
  21039. var nibbles = '';
  21040. var i, ii;
  21041. for (i = 0, ii = value.length; i < ii; ++i) {
  21042. var a = value[i];
  21043. if (a === 'e') {
  21044. nibbles += value[++i] === '-' ? 'c' : 'b';
  21045. } else if (a === '.') {
  21046. nibbles += 'a';
  21047. } else if (a === '-') {
  21048. nibbles += 'e';
  21049. } else {
  21050. nibbles += a;
  21051. }
  21052. }
  21053. nibbles += nibbles.length & 1 ? 'f' : 'ff';
  21054. var out = [30];
  21055. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  21056. out.push(parseInt(nibbles.substr(i, 2), 16));
  21057. }
  21058. return out;
  21059. },
  21060. encodeInteger: function CFFCompiler_encodeInteger(value) {
  21061. var code;
  21062. if (value >= -107 && value <= 107) {
  21063. code = [value + 139];
  21064. } else if (value >= 108 && value <= 1131) {
  21065. value = value - 108;
  21066. code = [
  21067. (value >> 8) + 247,
  21068. value & 0xFF
  21069. ];
  21070. } else if (value >= -1131 && value <= -108) {
  21071. value = -value - 108;
  21072. code = [
  21073. (value >> 8) + 251,
  21074. value & 0xFF
  21075. ];
  21076. } else if (value >= -32768 && value <= 32767) {
  21077. code = [
  21078. 0x1c,
  21079. value >> 8 & 0xFF,
  21080. value & 0xFF
  21081. ];
  21082. } else {
  21083. code = [
  21084. 0x1d,
  21085. value >> 24 & 0xFF,
  21086. value >> 16 & 0xFF,
  21087. value >> 8 & 0xFF,
  21088. value & 0xFF
  21089. ];
  21090. }
  21091. return code;
  21092. },
  21093. compileHeader: function CFFCompiler_compileHeader(header) {
  21094. return [
  21095. header.major,
  21096. header.minor,
  21097. header.hdrSize,
  21098. header.offSize
  21099. ];
  21100. },
  21101. compileNameIndex: function CFFCompiler_compileNameIndex(names) {
  21102. var nameIndex = new CFFIndex();
  21103. for (var i = 0, ii = names.length; i < ii; ++i) {
  21104. nameIndex.add(stringToBytes(names[i]));
  21105. }
  21106. return this.compileIndex(nameIndex);
  21107. },
  21108. compileTopDicts: function CFFCompiler_compileTopDicts(dicts, length, removeCidKeys) {
  21109. var fontDictTrackers = [];
  21110. var fdArrayIndex = new CFFIndex();
  21111. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  21112. var fontDict = dicts[i];
  21113. if (removeCidKeys) {
  21114. fontDict.removeByName('CIDFontVersion');
  21115. fontDict.removeByName('CIDFontRevision');
  21116. fontDict.removeByName('CIDFontType');
  21117. fontDict.removeByName('CIDCount');
  21118. fontDict.removeByName('UIDBase');
  21119. }
  21120. var fontDictTracker = new CFFOffsetTracker();
  21121. var fontDictData = this.compileDict(fontDict, fontDictTracker);
  21122. fontDictTrackers.push(fontDictTracker);
  21123. fdArrayIndex.add(fontDictData);
  21124. fontDictTracker.offset(length);
  21125. }
  21126. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  21127. return {
  21128. trackers: fontDictTrackers,
  21129. output: fdArrayIndex
  21130. };
  21131. },
  21132. compilePrivateDicts: function CFFCompiler_compilePrivateDicts(dicts, trackers, output) {
  21133. for (var i = 0, ii = dicts.length; i < ii; ++i) {
  21134. var fontDict = dicts[i];
  21135. assert(fontDict.privateDict && fontDict.hasName('Private'), 'There must be an private dictionary.');
  21136. var privateDict = fontDict.privateDict;
  21137. var privateDictTracker = new CFFOffsetTracker();
  21138. var privateDictData = this.compileDict(privateDict, privateDictTracker);
  21139. var outputLength = output.length;
  21140. privateDictTracker.offset(outputLength);
  21141. if (!privateDictData.length) {
  21142. outputLength = 0;
  21143. }
  21144. trackers[i].setEntryLocation('Private', [
  21145. privateDictData.length,
  21146. outputLength
  21147. ], output);
  21148. output.add(privateDictData);
  21149. if (privateDict.subrsIndex && privateDict.hasName('Subrs')) {
  21150. var subrs = this.compileIndex(privateDict.subrsIndex);
  21151. privateDictTracker.setEntryLocation('Subrs', [privateDictData.length], output);
  21152. output.add(subrs);
  21153. }
  21154. }
  21155. },
  21156. compileDict: function CFFCompiler_compileDict(dict, offsetTracker) {
  21157. var out = [];
  21158. var order = dict.order;
  21159. for (var i = 0; i < order.length; ++i) {
  21160. var key = order[i];
  21161. if (!(key in dict.values)) {
  21162. continue;
  21163. }
  21164. var values = dict.values[key];
  21165. var types = dict.types[key];
  21166. if (!isArray(types)) {
  21167. types = [types];
  21168. }
  21169. if (!isArray(values)) {
  21170. values = [values];
  21171. }
  21172. if (values.length === 0) {
  21173. continue;
  21174. }
  21175. for (var j = 0, jj = types.length; j < jj; ++j) {
  21176. var type = types[j];
  21177. var value = values[j];
  21178. switch (type) {
  21179. case 'num':
  21180. case 'sid':
  21181. out = out.concat(this.encodeNumber(value));
  21182. break;
  21183. case 'offset':
  21184. var name = dict.keyToNameMap[key];
  21185. if (!offsetTracker.isTracking(name)) {
  21186. offsetTracker.track(name, out.length);
  21187. }
  21188. out = out.concat([
  21189. 0x1d,
  21190. 0,
  21191. 0,
  21192. 0,
  21193. 0
  21194. ]);
  21195. break;
  21196. case 'array':
  21197. case 'delta':
  21198. out = out.concat(this.encodeNumber(value));
  21199. for (var k = 1, kk = values.length; k < kk; ++k) {
  21200. out = out.concat(this.encodeNumber(values[k]));
  21201. }
  21202. break;
  21203. default:
  21204. error('Unknown data type of ' + type);
  21205. break;
  21206. }
  21207. }
  21208. out = out.concat(dict.opcodes[key]);
  21209. }
  21210. return out;
  21211. },
  21212. compileStringIndex: function CFFCompiler_compileStringIndex(strings) {
  21213. var stringIndex = new CFFIndex();
  21214. for (var i = 0, ii = strings.length; i < ii; ++i) {
  21215. stringIndex.add(stringToBytes(strings[i]));
  21216. }
  21217. return this.compileIndex(stringIndex);
  21218. },
  21219. compileGlobalSubrIndex: function CFFCompiler_compileGlobalSubrIndex() {
  21220. var globalSubrIndex = this.cff.globalSubrIndex;
  21221. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  21222. },
  21223. compileCharStrings: function CFFCompiler_compileCharStrings(charStrings) {
  21224. return this.compileIndex(charStrings);
  21225. },
  21226. compileCharset: function CFFCompiler_compileCharset(charset) {
  21227. return this.compileTypedArray(charset.raw);
  21228. },
  21229. compileEncoding: function CFFCompiler_compileEncoding(encoding) {
  21230. return this.compileTypedArray(encoding.raw);
  21231. },
  21232. compileFDSelect: function CFFCompiler_compileFDSelect(fdSelect) {
  21233. return this.compileTypedArray(fdSelect);
  21234. },
  21235. compileTypedArray: function CFFCompiler_compileTypedArray(data) {
  21236. var out = [];
  21237. for (var i = 0, ii = data.length; i < ii; ++i) {
  21238. out[i] = data[i];
  21239. }
  21240. return out;
  21241. },
  21242. compileIndex: function CFFCompiler_compileIndex(index, trackers) {
  21243. trackers = trackers || [];
  21244. var objects = index.objects;
  21245. var count = objects.length;
  21246. if (count === 0) {
  21247. return [
  21248. 0,
  21249. 0,
  21250. 0
  21251. ];
  21252. }
  21253. var data = [
  21254. count >> 8 & 0xFF,
  21255. count & 0xff
  21256. ];
  21257. var lastOffset = 1, i;
  21258. for (i = 0; i < count; ++i) {
  21259. lastOffset += objects[i].length;
  21260. }
  21261. var offsetSize;
  21262. if (lastOffset < 0x100) {
  21263. offsetSize = 1;
  21264. } else if (lastOffset < 0x10000) {
  21265. offsetSize = 2;
  21266. } else if (lastOffset < 0x1000000) {
  21267. offsetSize = 3;
  21268. } else {
  21269. offsetSize = 4;
  21270. }
  21271. data.push(offsetSize);
  21272. var relativeOffset = 1;
  21273. for (i = 0; i < count + 1; i++) {
  21274. if (offsetSize === 1) {
  21275. data.push(relativeOffset & 0xFF);
  21276. } else if (offsetSize === 2) {
  21277. data.push(relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  21278. } else if (offsetSize === 3) {
  21279. data.push(relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  21280. } else {
  21281. data.push(relativeOffset >>> 24 & 0xFF, relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
  21282. }
  21283. if (objects[i]) {
  21284. relativeOffset += objects[i].length;
  21285. }
  21286. }
  21287. for (i = 0; i < count; i++) {
  21288. if (trackers[i]) {
  21289. trackers[i].offset(data.length);
  21290. }
  21291. for (var j = 0, jj = objects[i].length; j < jj; j++) {
  21292. data.push(objects[i][j]);
  21293. }
  21294. }
  21295. return data;
  21296. }
  21297. };
  21298. return CFFCompiler;
  21299. }();
  21300. exports.CFFStandardStrings = CFFStandardStrings;
  21301. exports.CFFParser = CFFParser;
  21302. exports.CFF = CFF;
  21303. exports.CFFHeader = CFFHeader;
  21304. exports.CFFStrings = CFFStrings;
  21305. exports.CFFIndex = CFFIndex;
  21306. exports.CFFCharset = CFFCharset;
  21307. exports.CFFTopDict = CFFTopDict;
  21308. exports.CFFPrivateDict = CFFPrivateDict;
  21309. exports.CFFCompiler = CFFCompiler;
  21310. /***/ }),
  21311. /* 12 */
  21312. /***/ (function(module, exports, __w_pdfjs_require__) {
  21313. "use strict";
  21314. var sharedUtil = __w_pdfjs_require__(0);
  21315. var MissingDataException = sharedUtil.MissingDataException;
  21316. var arrayByteLength = sharedUtil.arrayByteLength;
  21317. var arraysToBytes = sharedUtil.arraysToBytes;
  21318. var assert = sharedUtil.assert;
  21319. var createPromiseCapability = sharedUtil.createPromiseCapability;
  21320. var isInt = sharedUtil.isInt;
  21321. var isEmptyObj = sharedUtil.isEmptyObj;
  21322. var ChunkedStream = function ChunkedStreamClosure() {
  21323. function ChunkedStream(length, chunkSize, manager) {
  21324. this.bytes = new Uint8Array(length);
  21325. this.start = 0;
  21326. this.pos = 0;
  21327. this.end = length;
  21328. this.chunkSize = chunkSize;
  21329. this.loadedChunks = [];
  21330. this.numChunksLoaded = 0;
  21331. this.numChunks = Math.ceil(length / chunkSize);
  21332. this.manager = manager;
  21333. this.progressiveDataLength = 0;
  21334. this.lastSuccessfulEnsureByteChunk = -1;
  21335. }
  21336. ChunkedStream.prototype = {
  21337. getMissingChunks: function ChunkedStream_getMissingChunks() {
  21338. var chunks = [];
  21339. for (var chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  21340. if (!this.loadedChunks[chunk]) {
  21341. chunks.push(chunk);
  21342. }
  21343. }
  21344. return chunks;
  21345. },
  21346. getBaseStreams: function ChunkedStream_getBaseStreams() {
  21347. return [this];
  21348. },
  21349. allChunksLoaded: function ChunkedStream_allChunksLoaded() {
  21350. return this.numChunksLoaded === this.numChunks;
  21351. },
  21352. onReceiveData: function ChunkedStream_onReceiveData(begin, chunk) {
  21353. var end = begin + chunk.byteLength;
  21354. assert(begin % this.chunkSize === 0, 'Bad begin offset: ' + begin);
  21355. var length = this.bytes.length;
  21356. assert(end % this.chunkSize === 0 || end === length, 'Bad end offset: ' + end);
  21357. this.bytes.set(new Uint8Array(chunk), begin);
  21358. var chunkSize = this.chunkSize;
  21359. var beginChunk = Math.floor(begin / chunkSize);
  21360. var endChunk = Math.floor((end - 1) / chunkSize) + 1;
  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. onReceiveProgressiveData: function ChunkedStream_onReceiveProgressiveData(data) {
  21370. var position = this.progressiveDataLength;
  21371. var beginChunk = Math.floor(position / this.chunkSize);
  21372. this.bytes.set(new Uint8Array(data), position);
  21373. position += data.byteLength;
  21374. this.progressiveDataLength = position;
  21375. var endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  21376. var curChunk;
  21377. for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  21378. if (!this.loadedChunks[curChunk]) {
  21379. this.loadedChunks[curChunk] = true;
  21380. ++this.numChunksLoaded;
  21381. }
  21382. }
  21383. },
  21384. ensureByte: function ChunkedStream_ensureByte(pos) {
  21385. var chunk = Math.floor(pos / this.chunkSize);
  21386. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  21387. return;
  21388. }
  21389. if (!this.loadedChunks[chunk]) {
  21390. throw new MissingDataException(pos, pos + 1);
  21391. }
  21392. this.lastSuccessfulEnsureByteChunk = chunk;
  21393. },
  21394. ensureRange: function ChunkedStream_ensureRange(begin, end) {
  21395. if (begin >= end) {
  21396. return;
  21397. }
  21398. if (end <= this.progressiveDataLength) {
  21399. return;
  21400. }
  21401. var chunkSize = this.chunkSize;
  21402. var beginChunk = Math.floor(begin / chunkSize);
  21403. var endChunk = Math.floor((end - 1) / chunkSize) + 1;
  21404. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  21405. if (!this.loadedChunks[chunk]) {
  21406. throw new MissingDataException(begin, end);
  21407. }
  21408. }
  21409. },
  21410. nextEmptyChunk: function ChunkedStream_nextEmptyChunk(beginChunk) {
  21411. var chunk, numChunks = this.numChunks;
  21412. for (var i = 0; i < numChunks; ++i) {
  21413. chunk = (beginChunk + i) % numChunks;
  21414. if (!this.loadedChunks[chunk]) {
  21415. return chunk;
  21416. }
  21417. }
  21418. return null;
  21419. },
  21420. hasChunk: function ChunkedStream_hasChunk(chunk) {
  21421. return !!this.loadedChunks[chunk];
  21422. },
  21423. get length() {
  21424. return this.end - this.start;
  21425. },
  21426. get isEmpty() {
  21427. return this.length === 0;
  21428. },
  21429. getByte: function ChunkedStream_getByte() {
  21430. var pos = this.pos;
  21431. if (pos >= this.end) {
  21432. return -1;
  21433. }
  21434. this.ensureByte(pos);
  21435. return this.bytes[this.pos++];
  21436. },
  21437. getUint16: function ChunkedStream_getUint16() {
  21438. var b0 = this.getByte();
  21439. var b1 = this.getByte();
  21440. if (b0 === -1 || b1 === -1) {
  21441. return -1;
  21442. }
  21443. return (b0 << 8) + b1;
  21444. },
  21445. getInt32: function ChunkedStream_getInt32() {
  21446. var b0 = this.getByte();
  21447. var b1 = this.getByte();
  21448. var b2 = this.getByte();
  21449. var b3 = this.getByte();
  21450. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  21451. },
  21452. getBytes: function ChunkedStream_getBytes(length) {
  21453. var bytes = this.bytes;
  21454. var pos = this.pos;
  21455. var strEnd = this.end;
  21456. if (!length) {
  21457. this.ensureRange(pos, strEnd);
  21458. return bytes.subarray(pos, strEnd);
  21459. }
  21460. var end = pos + length;
  21461. if (end > strEnd) {
  21462. end = strEnd;
  21463. }
  21464. this.ensureRange(pos, end);
  21465. this.pos = end;
  21466. return bytes.subarray(pos, end);
  21467. },
  21468. peekByte: function ChunkedStream_peekByte() {
  21469. var peekedByte = this.getByte();
  21470. this.pos--;
  21471. return peekedByte;
  21472. },
  21473. peekBytes: function ChunkedStream_peekBytes(length) {
  21474. var bytes = this.getBytes(length);
  21475. this.pos -= bytes.length;
  21476. return bytes;
  21477. },
  21478. getByteRange: function ChunkedStream_getBytes(begin, end) {
  21479. this.ensureRange(begin, end);
  21480. return this.bytes.subarray(begin, end);
  21481. },
  21482. skip: function ChunkedStream_skip(n) {
  21483. if (!n) {
  21484. n = 1;
  21485. }
  21486. this.pos += n;
  21487. },
  21488. reset: function ChunkedStream_reset() {
  21489. this.pos = this.start;
  21490. },
  21491. moveStart: function ChunkedStream_moveStart() {
  21492. this.start = this.pos;
  21493. },
  21494. makeSubStream: function ChunkedStream_makeSubStream(start, length, dict) {
  21495. this.ensureRange(start, start + length);
  21496. function ChunkedStreamSubstream() {
  21497. }
  21498. ChunkedStreamSubstream.prototype = Object.create(this);
  21499. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  21500. var chunkSize = this.chunkSize;
  21501. var beginChunk = Math.floor(this.start / chunkSize);
  21502. var endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  21503. var missingChunks = [];
  21504. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  21505. if (!this.loadedChunks[chunk]) {
  21506. missingChunks.push(chunk);
  21507. }
  21508. }
  21509. return missingChunks;
  21510. };
  21511. var subStream = new ChunkedStreamSubstream();
  21512. subStream.pos = subStream.start = start;
  21513. subStream.end = start + length || this.end;
  21514. subStream.dict = dict;
  21515. return subStream;
  21516. }
  21517. };
  21518. return ChunkedStream;
  21519. }();
  21520. var ChunkedStreamManager = function ChunkedStreamManagerClosure() {
  21521. function ChunkedStreamManager(pdfNetworkStream, args) {
  21522. var chunkSize = args.rangeChunkSize;
  21523. var length = args.length;
  21524. this.stream = new ChunkedStream(length, chunkSize, this);
  21525. this.length = length;
  21526. this.chunkSize = chunkSize;
  21527. this.pdfNetworkStream = pdfNetworkStream;
  21528. this.url = args.url;
  21529. this.disableAutoFetch = args.disableAutoFetch;
  21530. this.msgHandler = args.msgHandler;
  21531. this.currRequestId = 0;
  21532. this.chunksNeededByRequest = Object.create(null);
  21533. this.requestsByChunk = Object.create(null);
  21534. this.promisesByRequest = Object.create(null);
  21535. this.progressiveDataLength = 0;
  21536. this.aborted = false;
  21537. this._loadedStreamCapability = createPromiseCapability();
  21538. }
  21539. ChunkedStreamManager.prototype = {
  21540. onLoadedStream: function ChunkedStreamManager_getLoadedStream() {
  21541. return this._loadedStreamCapability.promise;
  21542. },
  21543. sendRequest: function ChunkedStreamManager_sendRequest(begin, end) {
  21544. var rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  21545. if (!rangeReader.isStreamingSupported) {
  21546. rangeReader.onProgress = this.onProgress.bind(this);
  21547. }
  21548. var chunks = [], loaded = 0;
  21549. var manager = this;
  21550. var promise = new Promise(function (resolve, reject) {
  21551. var readChunk = function (chunk) {
  21552. try {
  21553. if (!chunk.done) {
  21554. var data = chunk.value;
  21555. chunks.push(data);
  21556. loaded += arrayByteLength(data);
  21557. if (rangeReader.isStreamingSupported) {
  21558. manager.onProgress({ loaded: loaded });
  21559. }
  21560. rangeReader.read().then(readChunk, reject);
  21561. return;
  21562. }
  21563. var chunkData = arraysToBytes(chunks);
  21564. chunks = null;
  21565. resolve(chunkData);
  21566. } catch (e) {
  21567. reject(e);
  21568. }
  21569. };
  21570. rangeReader.read().then(readChunk, reject);
  21571. });
  21572. promise.then(function (data) {
  21573. if (this.aborted) {
  21574. return;
  21575. }
  21576. this.onReceiveData({
  21577. chunk: data,
  21578. begin: begin
  21579. });
  21580. }.bind(this));
  21581. },
  21582. requestAllChunks: function ChunkedStreamManager_requestAllChunks() {
  21583. var missingChunks = this.stream.getMissingChunks();
  21584. this._requestChunks(missingChunks);
  21585. return this._loadedStreamCapability.promise;
  21586. },
  21587. _requestChunks: function ChunkedStreamManager_requestChunks(chunks) {
  21588. var requestId = this.currRequestId++;
  21589. var i, ii;
  21590. var chunksNeeded = Object.create(null);
  21591. this.chunksNeededByRequest[requestId] = chunksNeeded;
  21592. for (i = 0, ii = chunks.length; i < ii; i++) {
  21593. if (!this.stream.hasChunk(chunks[i])) {
  21594. chunksNeeded[chunks[i]] = true;
  21595. }
  21596. }
  21597. if (isEmptyObj(chunksNeeded)) {
  21598. return Promise.resolve();
  21599. }
  21600. var capability = createPromiseCapability();
  21601. this.promisesByRequest[requestId] = capability;
  21602. var chunksToRequest = [];
  21603. for (var chunk in chunksNeeded) {
  21604. chunk = chunk | 0;
  21605. if (!(chunk in this.requestsByChunk)) {
  21606. this.requestsByChunk[chunk] = [];
  21607. chunksToRequest.push(chunk);
  21608. }
  21609. this.requestsByChunk[chunk].push(requestId);
  21610. }
  21611. if (!chunksToRequest.length) {
  21612. return capability.promise;
  21613. }
  21614. var groupedChunksToRequest = this.groupChunks(chunksToRequest);
  21615. for (i = 0; i < groupedChunksToRequest.length; ++i) {
  21616. var groupedChunk = groupedChunksToRequest[i];
  21617. var begin = groupedChunk.beginChunk * this.chunkSize;
  21618. var end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  21619. this.sendRequest(begin, end);
  21620. }
  21621. return capability.promise;
  21622. },
  21623. getStream: function ChunkedStreamManager_getStream() {
  21624. return this.stream;
  21625. },
  21626. requestRange: function ChunkedStreamManager_requestRange(begin, end) {
  21627. end = Math.min(end, this.length);
  21628. var beginChunk = this.getBeginChunk(begin);
  21629. var endChunk = this.getEndChunk(end);
  21630. var chunks = [];
  21631. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  21632. chunks.push(chunk);
  21633. }
  21634. return this._requestChunks(chunks);
  21635. },
  21636. requestRanges: function ChunkedStreamManager_requestRanges(ranges) {
  21637. ranges = ranges || [];
  21638. var chunksToRequest = [];
  21639. for (var i = 0; i < ranges.length; i++) {
  21640. var beginChunk = this.getBeginChunk(ranges[i].begin);
  21641. var endChunk = this.getEndChunk(ranges[i].end);
  21642. for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
  21643. if (chunksToRequest.indexOf(chunk) < 0) {
  21644. chunksToRequest.push(chunk);
  21645. }
  21646. }
  21647. }
  21648. chunksToRequest.sort(function (a, b) {
  21649. return a - b;
  21650. });
  21651. return this._requestChunks(chunksToRequest);
  21652. },
  21653. groupChunks: function ChunkedStreamManager_groupChunks(chunks) {
  21654. var groupedChunks = [];
  21655. var beginChunk = -1;
  21656. var prevChunk = -1;
  21657. for (var i = 0; i < chunks.length; ++i) {
  21658. var chunk = chunks[i];
  21659. if (beginChunk < 0) {
  21660. beginChunk = chunk;
  21661. }
  21662. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  21663. groupedChunks.push({
  21664. beginChunk: beginChunk,
  21665. endChunk: prevChunk + 1
  21666. });
  21667. beginChunk = chunk;
  21668. }
  21669. if (i + 1 === chunks.length) {
  21670. groupedChunks.push({
  21671. beginChunk: beginChunk,
  21672. endChunk: chunk + 1
  21673. });
  21674. }
  21675. prevChunk = chunk;
  21676. }
  21677. return groupedChunks;
  21678. },
  21679. onProgress: function ChunkedStreamManager_onProgress(args) {
  21680. var bytesLoaded = this.stream.numChunksLoaded * this.chunkSize + args.loaded;
  21681. this.msgHandler.send('DocProgress', {
  21682. loaded: bytesLoaded,
  21683. total: this.length
  21684. });
  21685. },
  21686. onReceiveData: function ChunkedStreamManager_onReceiveData(args) {
  21687. var chunk = args.chunk;
  21688. var isProgressive = args.begin === undefined;
  21689. var begin = isProgressive ? this.progressiveDataLength : args.begin;
  21690. var end = begin + chunk.byteLength;
  21691. var beginChunk = Math.floor(begin / this.chunkSize);
  21692. var endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  21693. if (isProgressive) {
  21694. this.stream.onReceiveProgressiveData(chunk);
  21695. this.progressiveDataLength = end;
  21696. } else {
  21697. this.stream.onReceiveData(begin, chunk);
  21698. }
  21699. if (this.stream.allChunksLoaded()) {
  21700. this._loadedStreamCapability.resolve(this.stream);
  21701. }
  21702. var loadedRequests = [];
  21703. var i, requestId;
  21704. for (chunk = beginChunk; chunk < endChunk; ++chunk) {
  21705. var requestIds = this.requestsByChunk[chunk] || [];
  21706. delete this.requestsByChunk[chunk];
  21707. for (i = 0; i < requestIds.length; ++i) {
  21708. requestId = requestIds[i];
  21709. var chunksNeeded = this.chunksNeededByRequest[requestId];
  21710. if (chunk in chunksNeeded) {
  21711. delete chunksNeeded[chunk];
  21712. }
  21713. if (!isEmptyObj(chunksNeeded)) {
  21714. continue;
  21715. }
  21716. loadedRequests.push(requestId);
  21717. }
  21718. }
  21719. if (!this.disableAutoFetch && isEmptyObj(this.requestsByChunk)) {
  21720. var nextEmptyChunk;
  21721. if (this.stream.numChunksLoaded === 1) {
  21722. var lastChunk = this.stream.numChunks - 1;
  21723. if (!this.stream.hasChunk(lastChunk)) {
  21724. nextEmptyChunk = lastChunk;
  21725. }
  21726. } else {
  21727. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  21728. }
  21729. if (isInt(nextEmptyChunk)) {
  21730. this._requestChunks([nextEmptyChunk]);
  21731. }
  21732. }
  21733. for (i = 0; i < loadedRequests.length; ++i) {
  21734. requestId = loadedRequests[i];
  21735. var capability = this.promisesByRequest[requestId];
  21736. delete this.promisesByRequest[requestId];
  21737. capability.resolve();
  21738. }
  21739. this.msgHandler.send('DocProgress', {
  21740. loaded: this.stream.numChunksLoaded * this.chunkSize,
  21741. total: this.length
  21742. });
  21743. },
  21744. onError: function ChunkedStreamManager_onError(err) {
  21745. this._loadedStreamCapability.reject(err);
  21746. },
  21747. getBeginChunk: function ChunkedStreamManager_getBeginChunk(begin) {
  21748. var chunk = Math.floor(begin / this.chunkSize);
  21749. return chunk;
  21750. },
  21751. getEndChunk: function ChunkedStreamManager_getEndChunk(end) {
  21752. var chunk = Math.floor((end - 1) / this.chunkSize) + 1;
  21753. return chunk;
  21754. },
  21755. abort: function ChunkedStreamManager_abort() {
  21756. this.aborted = true;
  21757. if (this.pdfNetworkStream) {
  21758. this.pdfNetworkStream.cancelAllRequests('abort');
  21759. }
  21760. for (var requestId in this.promisesByRequest) {
  21761. var capability = this.promisesByRequest[requestId];
  21762. capability.reject(new Error('Request was aborted'));
  21763. }
  21764. }
  21765. };
  21766. return ChunkedStreamManager;
  21767. }();
  21768. exports.ChunkedStream = ChunkedStream;
  21769. exports.ChunkedStreamManager = ChunkedStreamManager;
  21770. /***/ }),
  21771. /* 13 */
  21772. /***/ (function(module, exports, __w_pdfjs_require__) {
  21773. "use strict";
  21774. var sharedUtil = __w_pdfjs_require__(0);
  21775. var corePrimitives = __w_pdfjs_require__(1);
  21776. var coreStream = __w_pdfjs_require__(2);
  21777. var PasswordException = sharedUtil.PasswordException;
  21778. var PasswordResponses = sharedUtil.PasswordResponses;
  21779. var bytesToString = sharedUtil.bytesToString;
  21780. var warn = sharedUtil.warn;
  21781. var error = sharedUtil.error;
  21782. var assert = sharedUtil.assert;
  21783. var isInt = sharedUtil.isInt;
  21784. var stringToBytes = sharedUtil.stringToBytes;
  21785. var utf8StringToString = sharedUtil.utf8StringToString;
  21786. var Name = corePrimitives.Name;
  21787. var isName = corePrimitives.isName;
  21788. var isDict = corePrimitives.isDict;
  21789. var DecryptStream = coreStream.DecryptStream;
  21790. var ARCFourCipher = function ARCFourCipherClosure() {
  21791. function ARCFourCipher(key) {
  21792. this.a = 0;
  21793. this.b = 0;
  21794. var s = new Uint8Array(256);
  21795. var i, j = 0, tmp, keyLength = key.length;
  21796. for (i = 0; i < 256; ++i) {
  21797. s[i] = i;
  21798. }
  21799. for (i = 0; i < 256; ++i) {
  21800. tmp = s[i];
  21801. j = j + tmp + key[i % keyLength] & 0xFF;
  21802. s[i] = s[j];
  21803. s[j] = tmp;
  21804. }
  21805. this.s = s;
  21806. }
  21807. ARCFourCipher.prototype = {
  21808. encryptBlock: function ARCFourCipher_encryptBlock(data) {
  21809. var i, n = data.length, tmp, tmp2;
  21810. var a = this.a, b = this.b, s = this.s;
  21811. var output = new Uint8Array(n);
  21812. for (i = 0; i < n; ++i) {
  21813. a = a + 1 & 0xFF;
  21814. tmp = s[a];
  21815. b = b + tmp & 0xFF;
  21816. tmp2 = s[b];
  21817. s[a] = tmp2;
  21818. s[b] = tmp;
  21819. output[i] = data[i] ^ s[tmp + tmp2 & 0xFF];
  21820. }
  21821. this.a = a;
  21822. this.b = b;
  21823. return output;
  21824. }
  21825. };
  21826. ARCFourCipher.prototype.decryptBlock = ARCFourCipher.prototype.encryptBlock;
  21827. return ARCFourCipher;
  21828. }();
  21829. var calculateMD5 = function calculateMD5Closure() {
  21830. var r = new Uint8Array([
  21831. 7,
  21832. 12,
  21833. 17,
  21834. 22,
  21835. 7,
  21836. 12,
  21837. 17,
  21838. 22,
  21839. 7,
  21840. 12,
  21841. 17,
  21842. 22,
  21843. 7,
  21844. 12,
  21845. 17,
  21846. 22,
  21847. 5,
  21848. 9,
  21849. 14,
  21850. 20,
  21851. 5,
  21852. 9,
  21853. 14,
  21854. 20,
  21855. 5,
  21856. 9,
  21857. 14,
  21858. 20,
  21859. 5,
  21860. 9,
  21861. 14,
  21862. 20,
  21863. 4,
  21864. 11,
  21865. 16,
  21866. 23,
  21867. 4,
  21868. 11,
  21869. 16,
  21870. 23,
  21871. 4,
  21872. 11,
  21873. 16,
  21874. 23,
  21875. 4,
  21876. 11,
  21877. 16,
  21878. 23,
  21879. 6,
  21880. 10,
  21881. 15,
  21882. 21,
  21883. 6,
  21884. 10,
  21885. 15,
  21886. 21,
  21887. 6,
  21888. 10,
  21889. 15,
  21890. 21,
  21891. 6,
  21892. 10,
  21893. 15,
  21894. 21
  21895. ]);
  21896. var k = new Int32Array([
  21897. -680876936,
  21898. -389564586,
  21899. 606105819,
  21900. -1044525330,
  21901. -176418897,
  21902. 1200080426,
  21903. -1473231341,
  21904. -45705983,
  21905. 1770035416,
  21906. -1958414417,
  21907. -42063,
  21908. -1990404162,
  21909. 1804603682,
  21910. -40341101,
  21911. -1502002290,
  21912. 1236535329,
  21913. -165796510,
  21914. -1069501632,
  21915. 643717713,
  21916. -373897302,
  21917. -701558691,
  21918. 38016083,
  21919. -660478335,
  21920. -405537848,
  21921. 568446438,
  21922. -1019803690,
  21923. -187363961,
  21924. 1163531501,
  21925. -1444681467,
  21926. -51403784,
  21927. 1735328473,
  21928. -1926607734,
  21929. -378558,
  21930. -2022574463,
  21931. 1839030562,
  21932. -35309556,
  21933. -1530992060,
  21934. 1272893353,
  21935. -155497632,
  21936. -1094730640,
  21937. 681279174,
  21938. -358537222,
  21939. -722521979,
  21940. 76029189,
  21941. -640364487,
  21942. -421815835,
  21943. 530742520,
  21944. -995338651,
  21945. -198630844,
  21946. 1126891415,
  21947. -1416354905,
  21948. -57434055,
  21949. 1700485571,
  21950. -1894986606,
  21951. -1051523,
  21952. -2054922799,
  21953. 1873313359,
  21954. -30611744,
  21955. -1560198380,
  21956. 1309151649,
  21957. -145523070,
  21958. -1120210379,
  21959. 718787259,
  21960. -343485551
  21961. ]);
  21962. function hash(data, offset, length) {
  21963. var h0 = 1732584193, h1 = -271733879, h2 = -1732584194, h3 = 271733878;
  21964. var paddedLength = length + 72 & ~63;
  21965. var padded = new Uint8Array(paddedLength);
  21966. var i, j, n;
  21967. for (i = 0; i < length; ++i) {
  21968. padded[i] = data[offset++];
  21969. }
  21970. padded[i++] = 0x80;
  21971. n = paddedLength - 8;
  21972. while (i < n) {
  21973. padded[i++] = 0;
  21974. }
  21975. padded[i++] = length << 3 & 0xFF;
  21976. padded[i++] = length >> 5 & 0xFF;
  21977. padded[i++] = length >> 13 & 0xFF;
  21978. padded[i++] = length >> 21 & 0xFF;
  21979. padded[i++] = length >>> 29 & 0xFF;
  21980. padded[i++] = 0;
  21981. padded[i++] = 0;
  21982. padded[i++] = 0;
  21983. var w = new Int32Array(16);
  21984. for (i = 0; i < paddedLength;) {
  21985. for (j = 0; j < 16; ++j, i += 4) {
  21986. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  21987. }
  21988. var a = h0, b = h1, c = h2, d = h3, f, g;
  21989. for (j = 0; j < 64; ++j) {
  21990. if (j < 16) {
  21991. f = b & c | ~b & d;
  21992. g = j;
  21993. } else if (j < 32) {
  21994. f = d & b | ~d & c;
  21995. g = 5 * j + 1 & 15;
  21996. } else if (j < 48) {
  21997. f = b ^ c ^ d;
  21998. g = 3 * j + 5 & 15;
  21999. } else {
  22000. f = c ^ (b | ~d);
  22001. g = 7 * j & 15;
  22002. }
  22003. var tmp = d, rotateArg = a + f + k[j] + w[g] | 0, rotate = r[j];
  22004. d = c;
  22005. c = b;
  22006. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  22007. a = tmp;
  22008. }
  22009. h0 = h0 + a | 0;
  22010. h1 = h1 + b | 0;
  22011. h2 = h2 + c | 0;
  22012. h3 = h3 + d | 0;
  22013. }
  22014. return new Uint8Array([
  22015. h0 & 0xFF,
  22016. h0 >> 8 & 0xFF,
  22017. h0 >> 16 & 0xFF,
  22018. h0 >>> 24 & 0xFF,
  22019. h1 & 0xFF,
  22020. h1 >> 8 & 0xFF,
  22021. h1 >> 16 & 0xFF,
  22022. h1 >>> 24 & 0xFF,
  22023. h2 & 0xFF,
  22024. h2 >> 8 & 0xFF,
  22025. h2 >> 16 & 0xFF,
  22026. h2 >>> 24 & 0xFF,
  22027. h3 & 0xFF,
  22028. h3 >> 8 & 0xFF,
  22029. h3 >> 16 & 0xFF,
  22030. h3 >>> 24 & 0xFF
  22031. ]);
  22032. }
  22033. return hash;
  22034. }();
  22035. var Word64 = function Word64Closure() {
  22036. function Word64(highInteger, lowInteger) {
  22037. this.high = highInteger | 0;
  22038. this.low = lowInteger | 0;
  22039. }
  22040. Word64.prototype = {
  22041. and: function Word64_and(word) {
  22042. this.high &= word.high;
  22043. this.low &= word.low;
  22044. },
  22045. xor: function Word64_xor(word) {
  22046. this.high ^= word.high;
  22047. this.low ^= word.low;
  22048. },
  22049. or: function Word64_or(word) {
  22050. this.high |= word.high;
  22051. this.low |= word.low;
  22052. },
  22053. shiftRight: function Word64_shiftRight(places) {
  22054. if (places >= 32) {
  22055. this.low = this.high >>> places - 32 | 0;
  22056. this.high = 0;
  22057. } else {
  22058. this.low = this.low >>> places | this.high << 32 - places;
  22059. this.high = this.high >>> places | 0;
  22060. }
  22061. },
  22062. shiftLeft: function Word64_shiftLeft(places) {
  22063. if (places >= 32) {
  22064. this.high = this.low << places - 32;
  22065. this.low = 0;
  22066. } else {
  22067. this.high = this.high << places | this.low >>> 32 - places;
  22068. this.low = this.low << places;
  22069. }
  22070. },
  22071. rotateRight: function Word64_rotateRight(places) {
  22072. var low, high;
  22073. if (places & 32) {
  22074. high = this.low;
  22075. low = this.high;
  22076. } else {
  22077. low = this.low;
  22078. high = this.high;
  22079. }
  22080. places &= 31;
  22081. this.low = low >>> places | high << 32 - places;
  22082. this.high = high >>> places | low << 32 - places;
  22083. },
  22084. not: function Word64_not() {
  22085. this.high = ~this.high;
  22086. this.low = ~this.low;
  22087. },
  22088. add: function Word64_add(word) {
  22089. var lowAdd = (this.low >>> 0) + (word.low >>> 0);
  22090. var highAdd = (this.high >>> 0) + (word.high >>> 0);
  22091. if (lowAdd > 0xFFFFFFFF) {
  22092. highAdd += 1;
  22093. }
  22094. this.low = lowAdd | 0;
  22095. this.high = highAdd | 0;
  22096. },
  22097. copyTo: function Word64_copyTo(bytes, offset) {
  22098. bytes[offset] = this.high >>> 24 & 0xFF;
  22099. bytes[offset + 1] = this.high >> 16 & 0xFF;
  22100. bytes[offset + 2] = this.high >> 8 & 0xFF;
  22101. bytes[offset + 3] = this.high & 0xFF;
  22102. bytes[offset + 4] = this.low >>> 24 & 0xFF;
  22103. bytes[offset + 5] = this.low >> 16 & 0xFF;
  22104. bytes[offset + 6] = this.low >> 8 & 0xFF;
  22105. bytes[offset + 7] = this.low & 0xFF;
  22106. },
  22107. assign: function Word64_assign(word) {
  22108. this.high = word.high;
  22109. this.low = word.low;
  22110. }
  22111. };
  22112. return Word64;
  22113. }();
  22114. var calculateSHA256 = function calculateSHA256Closure() {
  22115. function rotr(x, n) {
  22116. return x >>> n | x << 32 - n;
  22117. }
  22118. function ch(x, y, z) {
  22119. return x & y ^ ~x & z;
  22120. }
  22121. function maj(x, y, z) {
  22122. return x & y ^ x & z ^ y & z;
  22123. }
  22124. function sigma(x) {
  22125. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  22126. }
  22127. function sigmaPrime(x) {
  22128. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  22129. }
  22130. function littleSigma(x) {
  22131. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  22132. }
  22133. function littleSigmaPrime(x) {
  22134. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  22135. }
  22136. var k = [
  22137. 0x428a2f98,
  22138. 0x71374491,
  22139. 0xb5c0fbcf,
  22140. 0xe9b5dba5,
  22141. 0x3956c25b,
  22142. 0x59f111f1,
  22143. 0x923f82a4,
  22144. 0xab1c5ed5,
  22145. 0xd807aa98,
  22146. 0x12835b01,
  22147. 0x243185be,
  22148. 0x550c7dc3,
  22149. 0x72be5d74,
  22150. 0x80deb1fe,
  22151. 0x9bdc06a7,
  22152. 0xc19bf174,
  22153. 0xe49b69c1,
  22154. 0xefbe4786,
  22155. 0x0fc19dc6,
  22156. 0x240ca1cc,
  22157. 0x2de92c6f,
  22158. 0x4a7484aa,
  22159. 0x5cb0a9dc,
  22160. 0x76f988da,
  22161. 0x983e5152,
  22162. 0xa831c66d,
  22163. 0xb00327c8,
  22164. 0xbf597fc7,
  22165. 0xc6e00bf3,
  22166. 0xd5a79147,
  22167. 0x06ca6351,
  22168. 0x14292967,
  22169. 0x27b70a85,
  22170. 0x2e1b2138,
  22171. 0x4d2c6dfc,
  22172. 0x53380d13,
  22173. 0x650a7354,
  22174. 0x766a0abb,
  22175. 0x81c2c92e,
  22176. 0x92722c85,
  22177. 0xa2bfe8a1,
  22178. 0xa81a664b,
  22179. 0xc24b8b70,
  22180. 0xc76c51a3,
  22181. 0xd192e819,
  22182. 0xd6990624,
  22183. 0xf40e3585,
  22184. 0x106aa070,
  22185. 0x19a4c116,
  22186. 0x1e376c08,
  22187. 0x2748774c,
  22188. 0x34b0bcb5,
  22189. 0x391c0cb3,
  22190. 0x4ed8aa4a,
  22191. 0x5b9cca4f,
  22192. 0x682e6ff3,
  22193. 0x748f82ee,
  22194. 0x78a5636f,
  22195. 0x84c87814,
  22196. 0x8cc70208,
  22197. 0x90befffa,
  22198. 0xa4506ceb,
  22199. 0xbef9a3f7,
  22200. 0xc67178f2
  22201. ];
  22202. function hash(data, offset, length) {
  22203. var h0 = 0x6a09e667, h1 = 0xbb67ae85, h2 = 0x3c6ef372, h3 = 0xa54ff53a, h4 = 0x510e527f, h5 = 0x9b05688c, h6 = 0x1f83d9ab, h7 = 0x5be0cd19;
  22204. var paddedLength = Math.ceil((length + 9) / 64) * 64;
  22205. var padded = new Uint8Array(paddedLength);
  22206. var i, j, n;
  22207. for (i = 0; i < length; ++i) {
  22208. padded[i] = data[offset++];
  22209. }
  22210. padded[i++] = 0x80;
  22211. n = paddedLength - 8;
  22212. while (i < n) {
  22213. padded[i++] = 0;
  22214. }
  22215. padded[i++] = 0;
  22216. padded[i++] = 0;
  22217. padded[i++] = 0;
  22218. padded[i++] = length >>> 29 & 0xFF;
  22219. padded[i++] = length >> 21 & 0xFF;
  22220. padded[i++] = length >> 13 & 0xFF;
  22221. padded[i++] = length >> 5 & 0xFF;
  22222. padded[i++] = length << 3 & 0xFF;
  22223. var w = new Uint32Array(64);
  22224. for (i = 0; i < paddedLength;) {
  22225. for (j = 0; j < 16; ++j) {
  22226. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  22227. i += 4;
  22228. }
  22229. for (j = 16; j < 64; ++j) {
  22230. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  22231. }
  22232. var a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7, t1, t2;
  22233. for (j = 0; j < 64; ++j) {
  22234. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  22235. t2 = sigma(a) + maj(a, b, c);
  22236. h = g;
  22237. g = f;
  22238. f = e;
  22239. e = d + t1 | 0;
  22240. d = c;
  22241. c = b;
  22242. b = a;
  22243. a = t1 + t2 | 0;
  22244. }
  22245. h0 = h0 + a | 0;
  22246. h1 = h1 + b | 0;
  22247. h2 = h2 + c | 0;
  22248. h3 = h3 + d | 0;
  22249. h4 = h4 + e | 0;
  22250. h5 = h5 + f | 0;
  22251. h6 = h6 + g | 0;
  22252. h7 = h7 + h | 0;
  22253. }
  22254. return new Uint8Array([
  22255. h0 >> 24 & 0xFF,
  22256. h0 >> 16 & 0xFF,
  22257. h0 >> 8 & 0xFF,
  22258. h0 & 0xFF,
  22259. h1 >> 24 & 0xFF,
  22260. h1 >> 16 & 0xFF,
  22261. h1 >> 8 & 0xFF,
  22262. h1 & 0xFF,
  22263. h2 >> 24 & 0xFF,
  22264. h2 >> 16 & 0xFF,
  22265. h2 >> 8 & 0xFF,
  22266. h2 & 0xFF,
  22267. h3 >> 24 & 0xFF,
  22268. h3 >> 16 & 0xFF,
  22269. h3 >> 8 & 0xFF,
  22270. h3 & 0xFF,
  22271. h4 >> 24 & 0xFF,
  22272. h4 >> 16 & 0xFF,
  22273. h4 >> 8 & 0xFF,
  22274. h4 & 0xFF,
  22275. h5 >> 24 & 0xFF,
  22276. h5 >> 16 & 0xFF,
  22277. h5 >> 8 & 0xFF,
  22278. h5 & 0xFF,
  22279. h6 >> 24 & 0xFF,
  22280. h6 >> 16 & 0xFF,
  22281. h6 >> 8 & 0xFF,
  22282. h6 & 0xFF,
  22283. h7 >> 24 & 0xFF,
  22284. h7 >> 16 & 0xFF,
  22285. h7 >> 8 & 0xFF,
  22286. h7 & 0xFF
  22287. ]);
  22288. }
  22289. return hash;
  22290. }();
  22291. var calculateSHA512 = function calculateSHA512Closure() {
  22292. function ch(result, x, y, z, tmp) {
  22293. result.assign(x);
  22294. result.and(y);
  22295. tmp.assign(x);
  22296. tmp.not();
  22297. tmp.and(z);
  22298. result.xor(tmp);
  22299. }
  22300. function maj(result, x, y, z, tmp) {
  22301. result.assign(x);
  22302. result.and(y);
  22303. tmp.assign(x);
  22304. tmp.and(z);
  22305. result.xor(tmp);
  22306. tmp.assign(y);
  22307. tmp.and(z);
  22308. result.xor(tmp);
  22309. }
  22310. function sigma(result, x, tmp) {
  22311. result.assign(x);
  22312. result.rotateRight(28);
  22313. tmp.assign(x);
  22314. tmp.rotateRight(34);
  22315. result.xor(tmp);
  22316. tmp.assign(x);
  22317. tmp.rotateRight(39);
  22318. result.xor(tmp);
  22319. }
  22320. function sigmaPrime(result, x, tmp) {
  22321. result.assign(x);
  22322. result.rotateRight(14);
  22323. tmp.assign(x);
  22324. tmp.rotateRight(18);
  22325. result.xor(tmp);
  22326. tmp.assign(x);
  22327. tmp.rotateRight(41);
  22328. result.xor(tmp);
  22329. }
  22330. function littleSigma(result, x, tmp) {
  22331. result.assign(x);
  22332. result.rotateRight(1);
  22333. tmp.assign(x);
  22334. tmp.rotateRight(8);
  22335. result.xor(tmp);
  22336. tmp.assign(x);
  22337. tmp.shiftRight(7);
  22338. result.xor(tmp);
  22339. }
  22340. function littleSigmaPrime(result, x, tmp) {
  22341. result.assign(x);
  22342. result.rotateRight(19);
  22343. tmp.assign(x);
  22344. tmp.rotateRight(61);
  22345. result.xor(tmp);
  22346. tmp.assign(x);
  22347. tmp.shiftRight(6);
  22348. result.xor(tmp);
  22349. }
  22350. var k = [
  22351. new Word64(0x428a2f98, 0xd728ae22),
  22352. new Word64(0x71374491, 0x23ef65cd),
  22353. new Word64(0xb5c0fbcf, 0xec4d3b2f),
  22354. new Word64(0xe9b5dba5, 0x8189dbbc),
  22355. new Word64(0x3956c25b, 0xf348b538),
  22356. new Word64(0x59f111f1, 0xb605d019),
  22357. new Word64(0x923f82a4, 0xaf194f9b),
  22358. new Word64(0xab1c5ed5, 0xda6d8118),
  22359. new Word64(0xd807aa98, 0xa3030242),
  22360. new Word64(0x12835b01, 0x45706fbe),
  22361. new Word64(0x243185be, 0x4ee4b28c),
  22362. new Word64(0x550c7dc3, 0xd5ffb4e2),
  22363. new Word64(0x72be5d74, 0xf27b896f),
  22364. new Word64(0x80deb1fe, 0x3b1696b1),
  22365. new Word64(0x9bdc06a7, 0x25c71235),
  22366. new Word64(0xc19bf174, 0xcf692694),
  22367. new Word64(0xe49b69c1, 0x9ef14ad2),
  22368. new Word64(0xefbe4786, 0x384f25e3),
  22369. new Word64(0x0fc19dc6, 0x8b8cd5b5),
  22370. new Word64(0x240ca1cc, 0x77ac9c65),
  22371. new Word64(0x2de92c6f, 0x592b0275),
  22372. new Word64(0x4a7484aa, 0x6ea6e483),
  22373. new Word64(0x5cb0a9dc, 0xbd41fbd4),
  22374. new Word64(0x76f988da, 0x831153b5),
  22375. new Word64(0x983e5152, 0xee66dfab),
  22376. new Word64(0xa831c66d, 0x2db43210),
  22377. new Word64(0xb00327c8, 0x98fb213f),
  22378. new Word64(0xbf597fc7, 0xbeef0ee4),
  22379. new Word64(0xc6e00bf3, 0x3da88fc2),
  22380. new Word64(0xd5a79147, 0x930aa725),
  22381. new Word64(0x06ca6351, 0xe003826f),
  22382. new Word64(0x14292967, 0x0a0e6e70),
  22383. new Word64(0x27b70a85, 0x46d22ffc),
  22384. new Word64(0x2e1b2138, 0x5c26c926),
  22385. new Word64(0x4d2c6dfc, 0x5ac42aed),
  22386. new Word64(0x53380d13, 0x9d95b3df),
  22387. new Word64(0x650a7354, 0x8baf63de),
  22388. new Word64(0x766a0abb, 0x3c77b2a8),
  22389. new Word64(0x81c2c92e, 0x47edaee6),
  22390. new Word64(0x92722c85, 0x1482353b),
  22391. new Word64(0xa2bfe8a1, 0x4cf10364),
  22392. new Word64(0xa81a664b, 0xbc423001),
  22393. new Word64(0xc24b8b70, 0xd0f89791),
  22394. new Word64(0xc76c51a3, 0x0654be30),
  22395. new Word64(0xd192e819, 0xd6ef5218),
  22396. new Word64(0xd6990624, 0x5565a910),
  22397. new Word64(0xf40e3585, 0x5771202a),
  22398. new Word64(0x106aa070, 0x32bbd1b8),
  22399. new Word64(0x19a4c116, 0xb8d2d0c8),
  22400. new Word64(0x1e376c08, 0x5141ab53),
  22401. new Word64(0x2748774c, 0xdf8eeb99),
  22402. new Word64(0x34b0bcb5, 0xe19b48a8),
  22403. new Word64(0x391c0cb3, 0xc5c95a63),
  22404. new Word64(0x4ed8aa4a, 0xe3418acb),
  22405. new Word64(0x5b9cca4f, 0x7763e373),
  22406. new Word64(0x682e6ff3, 0xd6b2b8a3),
  22407. new Word64(0x748f82ee, 0x5defb2fc),
  22408. new Word64(0x78a5636f, 0x43172f60),
  22409. new Word64(0x84c87814, 0xa1f0ab72),
  22410. new Word64(0x8cc70208, 0x1a6439ec),
  22411. new Word64(0x90befffa, 0x23631e28),
  22412. new Word64(0xa4506ceb, 0xde82bde9),
  22413. new Word64(0xbef9a3f7, 0xb2c67915),
  22414. new Word64(0xc67178f2, 0xe372532b),
  22415. new Word64(0xca273ece, 0xea26619c),
  22416. new Word64(0xd186b8c7, 0x21c0c207),
  22417. new Word64(0xeada7dd6, 0xcde0eb1e),
  22418. new Word64(0xf57d4f7f, 0xee6ed178),
  22419. new Word64(0x06f067aa, 0x72176fba),
  22420. new Word64(0x0a637dc5, 0xa2c898a6),
  22421. new Word64(0x113f9804, 0xbef90dae),
  22422. new Word64(0x1b710b35, 0x131c471b),
  22423. new Word64(0x28db77f5, 0x23047d84),
  22424. new Word64(0x32caab7b, 0x40c72493),
  22425. new Word64(0x3c9ebe0a, 0x15c9bebc),
  22426. new Word64(0x431d67c4, 0x9c100d4c),
  22427. new Word64(0x4cc5d4be, 0xcb3e42b6),
  22428. new Word64(0x597f299c, 0xfc657e2a),
  22429. new Word64(0x5fcb6fab, 0x3ad6faec),
  22430. new Word64(0x6c44198c, 0x4a475817)
  22431. ];
  22432. function hash(data, offset, length, mode384) {
  22433. mode384 = !!mode384;
  22434. var h0, h1, h2, h3, h4, h5, h6, h7;
  22435. if (!mode384) {
  22436. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  22437. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  22438. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  22439. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  22440. h4 = new Word64(0x510e527f, 0xade682d1);
  22441. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  22442. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  22443. h7 = new Word64(0x5be0cd19, 0x137e2179);
  22444. } else {
  22445. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  22446. h1 = new Word64(0x629a292a, 0x367cd507);
  22447. h2 = new Word64(0x9159015a, 0x3070dd17);
  22448. h3 = new Word64(0x152fecd8, 0xf70e5939);
  22449. h4 = new Word64(0x67332667, 0xffc00b31);
  22450. h5 = new Word64(0x8eb44a87, 0x68581511);
  22451. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  22452. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  22453. }
  22454. var paddedLength = Math.ceil((length + 17) / 128) * 128;
  22455. var padded = new Uint8Array(paddedLength);
  22456. var i, j, n;
  22457. for (i = 0; i < length; ++i) {
  22458. padded[i] = data[offset++];
  22459. }
  22460. padded[i++] = 0x80;
  22461. n = paddedLength - 16;
  22462. while (i < n) {
  22463. padded[i++] = 0;
  22464. }
  22465. padded[i++] = 0;
  22466. padded[i++] = 0;
  22467. padded[i++] = 0;
  22468. padded[i++] = 0;
  22469. padded[i++] = 0;
  22470. padded[i++] = 0;
  22471. padded[i++] = 0;
  22472. padded[i++] = 0;
  22473. padded[i++] = 0;
  22474. padded[i++] = 0;
  22475. padded[i++] = 0;
  22476. padded[i++] = length >>> 29 & 0xFF;
  22477. padded[i++] = length >> 21 & 0xFF;
  22478. padded[i++] = length >> 13 & 0xFF;
  22479. padded[i++] = length >> 5 & 0xFF;
  22480. padded[i++] = length << 3 & 0xFF;
  22481. var w = new Array(80);
  22482. for (i = 0; i < 80; i++) {
  22483. w[i] = new Word64(0, 0);
  22484. }
  22485. var a = new Word64(0, 0), b = new Word64(0, 0), c = new Word64(0, 0);
  22486. var d = new Word64(0, 0), e = new Word64(0, 0), f = new Word64(0, 0);
  22487. var g = new Word64(0, 0), h = new Word64(0, 0);
  22488. var t1 = new Word64(0, 0), t2 = new Word64(0, 0);
  22489. var tmp1 = new Word64(0, 0), tmp2 = new Word64(0, 0), tmp3;
  22490. for (i = 0; i < paddedLength;) {
  22491. for (j = 0; j < 16; ++j) {
  22492. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  22493. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  22494. i += 8;
  22495. }
  22496. for (j = 16; j < 80; ++j) {
  22497. tmp3 = w[j];
  22498. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  22499. tmp3.add(w[j - 7]);
  22500. littleSigma(tmp1, w[j - 15], tmp2);
  22501. tmp3.add(tmp1);
  22502. tmp3.add(w[j - 16]);
  22503. }
  22504. a.assign(h0);
  22505. b.assign(h1);
  22506. c.assign(h2);
  22507. d.assign(h3);
  22508. e.assign(h4);
  22509. f.assign(h5);
  22510. g.assign(h6);
  22511. h.assign(h7);
  22512. for (j = 0; j < 80; ++j) {
  22513. t1.assign(h);
  22514. sigmaPrime(tmp1, e, tmp2);
  22515. t1.add(tmp1);
  22516. ch(tmp1, e, f, g, tmp2);
  22517. t1.add(tmp1);
  22518. t1.add(k[j]);
  22519. t1.add(w[j]);
  22520. sigma(t2, a, tmp2);
  22521. maj(tmp1, a, b, c, tmp2);
  22522. t2.add(tmp1);
  22523. tmp3 = h;
  22524. h = g;
  22525. g = f;
  22526. f = e;
  22527. d.add(t1);
  22528. e = d;
  22529. d = c;
  22530. c = b;
  22531. b = a;
  22532. tmp3.assign(t1);
  22533. tmp3.add(t2);
  22534. a = tmp3;
  22535. }
  22536. h0.add(a);
  22537. h1.add(b);
  22538. h2.add(c);
  22539. h3.add(d);
  22540. h4.add(e);
  22541. h5.add(f);
  22542. h6.add(g);
  22543. h7.add(h);
  22544. }
  22545. var result;
  22546. if (!mode384) {
  22547. result = new Uint8Array(64);
  22548. h0.copyTo(result, 0);
  22549. h1.copyTo(result, 8);
  22550. h2.copyTo(result, 16);
  22551. h3.copyTo(result, 24);
  22552. h4.copyTo(result, 32);
  22553. h5.copyTo(result, 40);
  22554. h6.copyTo(result, 48);
  22555. h7.copyTo(result, 56);
  22556. } else {
  22557. result = new Uint8Array(48);
  22558. h0.copyTo(result, 0);
  22559. h1.copyTo(result, 8);
  22560. h2.copyTo(result, 16);
  22561. h3.copyTo(result, 24);
  22562. h4.copyTo(result, 32);
  22563. h5.copyTo(result, 40);
  22564. }
  22565. return result;
  22566. }
  22567. return hash;
  22568. }();
  22569. var calculateSHA384 = function calculateSHA384Closure() {
  22570. function hash(data, offset, length) {
  22571. return calculateSHA512(data, offset, length, true);
  22572. }
  22573. return hash;
  22574. }();
  22575. var NullCipher = function NullCipherClosure() {
  22576. function NullCipher() {
  22577. }
  22578. NullCipher.prototype = {
  22579. decryptBlock: function NullCipher_decryptBlock(data) {
  22580. return data;
  22581. }
  22582. };
  22583. return NullCipher;
  22584. }();
  22585. var AES128Cipher = function AES128CipherClosure() {
  22586. var rcon = new Uint8Array([
  22587. 0x8d,
  22588. 0x01,
  22589. 0x02,
  22590. 0x04,
  22591. 0x08,
  22592. 0x10,
  22593. 0x20,
  22594. 0x40,
  22595. 0x80,
  22596. 0x1b,
  22597. 0x36,
  22598. 0x6c,
  22599. 0xd8,
  22600. 0xab,
  22601. 0x4d,
  22602. 0x9a,
  22603. 0x2f,
  22604. 0x5e,
  22605. 0xbc,
  22606. 0x63,
  22607. 0xc6,
  22608. 0x97,
  22609. 0x35,
  22610. 0x6a,
  22611. 0xd4,
  22612. 0xb3,
  22613. 0x7d,
  22614. 0xfa,
  22615. 0xef,
  22616. 0xc5,
  22617. 0x91,
  22618. 0x39,
  22619. 0x72,
  22620. 0xe4,
  22621. 0xd3,
  22622. 0xbd,
  22623. 0x61,
  22624. 0xc2,
  22625. 0x9f,
  22626. 0x25,
  22627. 0x4a,
  22628. 0x94,
  22629. 0x33,
  22630. 0x66,
  22631. 0xcc,
  22632. 0x83,
  22633. 0x1d,
  22634. 0x3a,
  22635. 0x74,
  22636. 0xe8,
  22637. 0xcb,
  22638. 0x8d,
  22639. 0x01,
  22640. 0x02,
  22641. 0x04,
  22642. 0x08,
  22643. 0x10,
  22644. 0x20,
  22645. 0x40,
  22646. 0x80,
  22647. 0x1b,
  22648. 0x36,
  22649. 0x6c,
  22650. 0xd8,
  22651. 0xab,
  22652. 0x4d,
  22653. 0x9a,
  22654. 0x2f,
  22655. 0x5e,
  22656. 0xbc,
  22657. 0x63,
  22658. 0xc6,
  22659. 0x97,
  22660. 0x35,
  22661. 0x6a,
  22662. 0xd4,
  22663. 0xb3,
  22664. 0x7d,
  22665. 0xfa,
  22666. 0xef,
  22667. 0xc5,
  22668. 0x91,
  22669. 0x39,
  22670. 0x72,
  22671. 0xe4,
  22672. 0xd3,
  22673. 0xbd,
  22674. 0x61,
  22675. 0xc2,
  22676. 0x9f,
  22677. 0x25,
  22678. 0x4a,
  22679. 0x94,
  22680. 0x33,
  22681. 0x66,
  22682. 0xcc,
  22683. 0x83,
  22684. 0x1d,
  22685. 0x3a,
  22686. 0x74,
  22687. 0xe8,
  22688. 0xcb,
  22689. 0x8d,
  22690. 0x01,
  22691. 0x02,
  22692. 0x04,
  22693. 0x08,
  22694. 0x10,
  22695. 0x20,
  22696. 0x40,
  22697. 0x80,
  22698. 0x1b,
  22699. 0x36,
  22700. 0x6c,
  22701. 0xd8,
  22702. 0xab,
  22703. 0x4d,
  22704. 0x9a,
  22705. 0x2f,
  22706. 0x5e,
  22707. 0xbc,
  22708. 0x63,
  22709. 0xc6,
  22710. 0x97,
  22711. 0x35,
  22712. 0x6a,
  22713. 0xd4,
  22714. 0xb3,
  22715. 0x7d,
  22716. 0xfa,
  22717. 0xef,
  22718. 0xc5,
  22719. 0x91,
  22720. 0x39,
  22721. 0x72,
  22722. 0xe4,
  22723. 0xd3,
  22724. 0xbd,
  22725. 0x61,
  22726. 0xc2,
  22727. 0x9f,
  22728. 0x25,
  22729. 0x4a,
  22730. 0x94,
  22731. 0x33,
  22732. 0x66,
  22733. 0xcc,
  22734. 0x83,
  22735. 0x1d,
  22736. 0x3a,
  22737. 0x74,
  22738. 0xe8,
  22739. 0xcb,
  22740. 0x8d,
  22741. 0x01,
  22742. 0x02,
  22743. 0x04,
  22744. 0x08,
  22745. 0x10,
  22746. 0x20,
  22747. 0x40,
  22748. 0x80,
  22749. 0x1b,
  22750. 0x36,
  22751. 0x6c,
  22752. 0xd8,
  22753. 0xab,
  22754. 0x4d,
  22755. 0x9a,
  22756. 0x2f,
  22757. 0x5e,
  22758. 0xbc,
  22759. 0x63,
  22760. 0xc6,
  22761. 0x97,
  22762. 0x35,
  22763. 0x6a,
  22764. 0xd4,
  22765. 0xb3,
  22766. 0x7d,
  22767. 0xfa,
  22768. 0xef,
  22769. 0xc5,
  22770. 0x91,
  22771. 0x39,
  22772. 0x72,
  22773. 0xe4,
  22774. 0xd3,
  22775. 0xbd,
  22776. 0x61,
  22777. 0xc2,
  22778. 0x9f,
  22779. 0x25,
  22780. 0x4a,
  22781. 0x94,
  22782. 0x33,
  22783. 0x66,
  22784. 0xcc,
  22785. 0x83,
  22786. 0x1d,
  22787. 0x3a,
  22788. 0x74,
  22789. 0xe8,
  22790. 0xcb,
  22791. 0x8d,
  22792. 0x01,
  22793. 0x02,
  22794. 0x04,
  22795. 0x08,
  22796. 0x10,
  22797. 0x20,
  22798. 0x40,
  22799. 0x80,
  22800. 0x1b,
  22801. 0x36,
  22802. 0x6c,
  22803. 0xd8,
  22804. 0xab,
  22805. 0x4d,
  22806. 0x9a,
  22807. 0x2f,
  22808. 0x5e,
  22809. 0xbc,
  22810. 0x63,
  22811. 0xc6,
  22812. 0x97,
  22813. 0x35,
  22814. 0x6a,
  22815. 0xd4,
  22816. 0xb3,
  22817. 0x7d,
  22818. 0xfa,
  22819. 0xef,
  22820. 0xc5,
  22821. 0x91,
  22822. 0x39,
  22823. 0x72,
  22824. 0xe4,
  22825. 0xd3,
  22826. 0xbd,
  22827. 0x61,
  22828. 0xc2,
  22829. 0x9f,
  22830. 0x25,
  22831. 0x4a,
  22832. 0x94,
  22833. 0x33,
  22834. 0x66,
  22835. 0xcc,
  22836. 0x83,
  22837. 0x1d,
  22838. 0x3a,
  22839. 0x74,
  22840. 0xe8,
  22841. 0xcb,
  22842. 0x8d
  22843. ]);
  22844. var s = new Uint8Array([
  22845. 0x63,
  22846. 0x7c,
  22847. 0x77,
  22848. 0x7b,
  22849. 0xf2,
  22850. 0x6b,
  22851. 0x6f,
  22852. 0xc5,
  22853. 0x30,
  22854. 0x01,
  22855. 0x67,
  22856. 0x2b,
  22857. 0xfe,
  22858. 0xd7,
  22859. 0xab,
  22860. 0x76,
  22861. 0xca,
  22862. 0x82,
  22863. 0xc9,
  22864. 0x7d,
  22865. 0xfa,
  22866. 0x59,
  22867. 0x47,
  22868. 0xf0,
  22869. 0xad,
  22870. 0xd4,
  22871. 0xa2,
  22872. 0xaf,
  22873. 0x9c,
  22874. 0xa4,
  22875. 0x72,
  22876. 0xc0,
  22877. 0xb7,
  22878. 0xfd,
  22879. 0x93,
  22880. 0x26,
  22881. 0x36,
  22882. 0x3f,
  22883. 0xf7,
  22884. 0xcc,
  22885. 0x34,
  22886. 0xa5,
  22887. 0xe5,
  22888. 0xf1,
  22889. 0x71,
  22890. 0xd8,
  22891. 0x31,
  22892. 0x15,
  22893. 0x04,
  22894. 0xc7,
  22895. 0x23,
  22896. 0xc3,
  22897. 0x18,
  22898. 0x96,
  22899. 0x05,
  22900. 0x9a,
  22901. 0x07,
  22902. 0x12,
  22903. 0x80,
  22904. 0xe2,
  22905. 0xeb,
  22906. 0x27,
  22907. 0xb2,
  22908. 0x75,
  22909. 0x09,
  22910. 0x83,
  22911. 0x2c,
  22912. 0x1a,
  22913. 0x1b,
  22914. 0x6e,
  22915. 0x5a,
  22916. 0xa0,
  22917. 0x52,
  22918. 0x3b,
  22919. 0xd6,
  22920. 0xb3,
  22921. 0x29,
  22922. 0xe3,
  22923. 0x2f,
  22924. 0x84,
  22925. 0x53,
  22926. 0xd1,
  22927. 0x00,
  22928. 0xed,
  22929. 0x20,
  22930. 0xfc,
  22931. 0xb1,
  22932. 0x5b,
  22933. 0x6a,
  22934. 0xcb,
  22935. 0xbe,
  22936. 0x39,
  22937. 0x4a,
  22938. 0x4c,
  22939. 0x58,
  22940. 0xcf,
  22941. 0xd0,
  22942. 0xef,
  22943. 0xaa,
  22944. 0xfb,
  22945. 0x43,
  22946. 0x4d,
  22947. 0x33,
  22948. 0x85,
  22949. 0x45,
  22950. 0xf9,
  22951. 0x02,
  22952. 0x7f,
  22953. 0x50,
  22954. 0x3c,
  22955. 0x9f,
  22956. 0xa8,
  22957. 0x51,
  22958. 0xa3,
  22959. 0x40,
  22960. 0x8f,
  22961. 0x92,
  22962. 0x9d,
  22963. 0x38,
  22964. 0xf5,
  22965. 0xbc,
  22966. 0xb6,
  22967. 0xda,
  22968. 0x21,
  22969. 0x10,
  22970. 0xff,
  22971. 0xf3,
  22972. 0xd2,
  22973. 0xcd,
  22974. 0x0c,
  22975. 0x13,
  22976. 0xec,
  22977. 0x5f,
  22978. 0x97,
  22979. 0x44,
  22980. 0x17,
  22981. 0xc4,
  22982. 0xa7,
  22983. 0x7e,
  22984. 0x3d,
  22985. 0x64,
  22986. 0x5d,
  22987. 0x19,
  22988. 0x73,
  22989. 0x60,
  22990. 0x81,
  22991. 0x4f,
  22992. 0xdc,
  22993. 0x22,
  22994. 0x2a,
  22995. 0x90,
  22996. 0x88,
  22997. 0x46,
  22998. 0xee,
  22999. 0xb8,
  23000. 0x14,
  23001. 0xde,
  23002. 0x5e,
  23003. 0x0b,
  23004. 0xdb,
  23005. 0xe0,
  23006. 0x32,
  23007. 0x3a,
  23008. 0x0a,
  23009. 0x49,
  23010. 0x06,
  23011. 0x24,
  23012. 0x5c,
  23013. 0xc2,
  23014. 0xd3,
  23015. 0xac,
  23016. 0x62,
  23017. 0x91,
  23018. 0x95,
  23019. 0xe4,
  23020. 0x79,
  23021. 0xe7,
  23022. 0xc8,
  23023. 0x37,
  23024. 0x6d,
  23025. 0x8d,
  23026. 0xd5,
  23027. 0x4e,
  23028. 0xa9,
  23029. 0x6c,
  23030. 0x56,
  23031. 0xf4,
  23032. 0xea,
  23033. 0x65,
  23034. 0x7a,
  23035. 0xae,
  23036. 0x08,
  23037. 0xba,
  23038. 0x78,
  23039. 0x25,
  23040. 0x2e,
  23041. 0x1c,
  23042. 0xa6,
  23043. 0xb4,
  23044. 0xc6,
  23045. 0xe8,
  23046. 0xdd,
  23047. 0x74,
  23048. 0x1f,
  23049. 0x4b,
  23050. 0xbd,
  23051. 0x8b,
  23052. 0x8a,
  23053. 0x70,
  23054. 0x3e,
  23055. 0xb5,
  23056. 0x66,
  23057. 0x48,
  23058. 0x03,
  23059. 0xf6,
  23060. 0x0e,
  23061. 0x61,
  23062. 0x35,
  23063. 0x57,
  23064. 0xb9,
  23065. 0x86,
  23066. 0xc1,
  23067. 0x1d,
  23068. 0x9e,
  23069. 0xe1,
  23070. 0xf8,
  23071. 0x98,
  23072. 0x11,
  23073. 0x69,
  23074. 0xd9,
  23075. 0x8e,
  23076. 0x94,
  23077. 0x9b,
  23078. 0x1e,
  23079. 0x87,
  23080. 0xe9,
  23081. 0xce,
  23082. 0x55,
  23083. 0x28,
  23084. 0xdf,
  23085. 0x8c,
  23086. 0xa1,
  23087. 0x89,
  23088. 0x0d,
  23089. 0xbf,
  23090. 0xe6,
  23091. 0x42,
  23092. 0x68,
  23093. 0x41,
  23094. 0x99,
  23095. 0x2d,
  23096. 0x0f,
  23097. 0xb0,
  23098. 0x54,
  23099. 0xbb,
  23100. 0x16
  23101. ]);
  23102. var inv_s = new Uint8Array([
  23103. 0x52,
  23104. 0x09,
  23105. 0x6a,
  23106. 0xd5,
  23107. 0x30,
  23108. 0x36,
  23109. 0xa5,
  23110. 0x38,
  23111. 0xbf,
  23112. 0x40,
  23113. 0xa3,
  23114. 0x9e,
  23115. 0x81,
  23116. 0xf3,
  23117. 0xd7,
  23118. 0xfb,
  23119. 0x7c,
  23120. 0xe3,
  23121. 0x39,
  23122. 0x82,
  23123. 0x9b,
  23124. 0x2f,
  23125. 0xff,
  23126. 0x87,
  23127. 0x34,
  23128. 0x8e,
  23129. 0x43,
  23130. 0x44,
  23131. 0xc4,
  23132. 0xde,
  23133. 0xe9,
  23134. 0xcb,
  23135. 0x54,
  23136. 0x7b,
  23137. 0x94,
  23138. 0x32,
  23139. 0xa6,
  23140. 0xc2,
  23141. 0x23,
  23142. 0x3d,
  23143. 0xee,
  23144. 0x4c,
  23145. 0x95,
  23146. 0x0b,
  23147. 0x42,
  23148. 0xfa,
  23149. 0xc3,
  23150. 0x4e,
  23151. 0x08,
  23152. 0x2e,
  23153. 0xa1,
  23154. 0x66,
  23155. 0x28,
  23156. 0xd9,
  23157. 0x24,
  23158. 0xb2,
  23159. 0x76,
  23160. 0x5b,
  23161. 0xa2,
  23162. 0x49,
  23163. 0x6d,
  23164. 0x8b,
  23165. 0xd1,
  23166. 0x25,
  23167. 0x72,
  23168. 0xf8,
  23169. 0xf6,
  23170. 0x64,
  23171. 0x86,
  23172. 0x68,
  23173. 0x98,
  23174. 0x16,
  23175. 0xd4,
  23176. 0xa4,
  23177. 0x5c,
  23178. 0xcc,
  23179. 0x5d,
  23180. 0x65,
  23181. 0xb6,
  23182. 0x92,
  23183. 0x6c,
  23184. 0x70,
  23185. 0x48,
  23186. 0x50,
  23187. 0xfd,
  23188. 0xed,
  23189. 0xb9,
  23190. 0xda,
  23191. 0x5e,
  23192. 0x15,
  23193. 0x46,
  23194. 0x57,
  23195. 0xa7,
  23196. 0x8d,
  23197. 0x9d,
  23198. 0x84,
  23199. 0x90,
  23200. 0xd8,
  23201. 0xab,
  23202. 0x00,
  23203. 0x8c,
  23204. 0xbc,
  23205. 0xd3,
  23206. 0x0a,
  23207. 0xf7,
  23208. 0xe4,
  23209. 0x58,
  23210. 0x05,
  23211. 0xb8,
  23212. 0xb3,
  23213. 0x45,
  23214. 0x06,
  23215. 0xd0,
  23216. 0x2c,
  23217. 0x1e,
  23218. 0x8f,
  23219. 0xca,
  23220. 0x3f,
  23221. 0x0f,
  23222. 0x02,
  23223. 0xc1,
  23224. 0xaf,
  23225. 0xbd,
  23226. 0x03,
  23227. 0x01,
  23228. 0x13,
  23229. 0x8a,
  23230. 0x6b,
  23231. 0x3a,
  23232. 0x91,
  23233. 0x11,
  23234. 0x41,
  23235. 0x4f,
  23236. 0x67,
  23237. 0xdc,
  23238. 0xea,
  23239. 0x97,
  23240. 0xf2,
  23241. 0xcf,
  23242. 0xce,
  23243. 0xf0,
  23244. 0xb4,
  23245. 0xe6,
  23246. 0x73,
  23247. 0x96,
  23248. 0xac,
  23249. 0x74,
  23250. 0x22,
  23251. 0xe7,
  23252. 0xad,
  23253. 0x35,
  23254. 0x85,
  23255. 0xe2,
  23256. 0xf9,
  23257. 0x37,
  23258. 0xe8,
  23259. 0x1c,
  23260. 0x75,
  23261. 0xdf,
  23262. 0x6e,
  23263. 0x47,
  23264. 0xf1,
  23265. 0x1a,
  23266. 0x71,
  23267. 0x1d,
  23268. 0x29,
  23269. 0xc5,
  23270. 0x89,
  23271. 0x6f,
  23272. 0xb7,
  23273. 0x62,
  23274. 0x0e,
  23275. 0xaa,
  23276. 0x18,
  23277. 0xbe,
  23278. 0x1b,
  23279. 0xfc,
  23280. 0x56,
  23281. 0x3e,
  23282. 0x4b,
  23283. 0xc6,
  23284. 0xd2,
  23285. 0x79,
  23286. 0x20,
  23287. 0x9a,
  23288. 0xdb,
  23289. 0xc0,
  23290. 0xfe,
  23291. 0x78,
  23292. 0xcd,
  23293. 0x5a,
  23294. 0xf4,
  23295. 0x1f,
  23296. 0xdd,
  23297. 0xa8,
  23298. 0x33,
  23299. 0x88,
  23300. 0x07,
  23301. 0xc7,
  23302. 0x31,
  23303. 0xb1,
  23304. 0x12,
  23305. 0x10,
  23306. 0x59,
  23307. 0x27,
  23308. 0x80,
  23309. 0xec,
  23310. 0x5f,
  23311. 0x60,
  23312. 0x51,
  23313. 0x7f,
  23314. 0xa9,
  23315. 0x19,
  23316. 0xb5,
  23317. 0x4a,
  23318. 0x0d,
  23319. 0x2d,
  23320. 0xe5,
  23321. 0x7a,
  23322. 0x9f,
  23323. 0x93,
  23324. 0xc9,
  23325. 0x9c,
  23326. 0xef,
  23327. 0xa0,
  23328. 0xe0,
  23329. 0x3b,
  23330. 0x4d,
  23331. 0xae,
  23332. 0x2a,
  23333. 0xf5,
  23334. 0xb0,
  23335. 0xc8,
  23336. 0xeb,
  23337. 0xbb,
  23338. 0x3c,
  23339. 0x83,
  23340. 0x53,
  23341. 0x99,
  23342. 0x61,
  23343. 0x17,
  23344. 0x2b,
  23345. 0x04,
  23346. 0x7e,
  23347. 0xba,
  23348. 0x77,
  23349. 0xd6,
  23350. 0x26,
  23351. 0xe1,
  23352. 0x69,
  23353. 0x14,
  23354. 0x63,
  23355. 0x55,
  23356. 0x21,
  23357. 0x0c,
  23358. 0x7d
  23359. ]);
  23360. var mixCol = new Uint8Array(256);
  23361. for (var i = 0; i < 256; i++) {
  23362. if (i < 128) {
  23363. mixCol[i] = i << 1;
  23364. } else {
  23365. mixCol[i] = i << 1 ^ 0x1b;
  23366. }
  23367. }
  23368. var mix = new Uint32Array([
  23369. 0x00000000,
  23370. 0x0e090d0b,
  23371. 0x1c121a16,
  23372. 0x121b171d,
  23373. 0x3824342c,
  23374. 0x362d3927,
  23375. 0x24362e3a,
  23376. 0x2a3f2331,
  23377. 0x70486858,
  23378. 0x7e416553,
  23379. 0x6c5a724e,
  23380. 0x62537f45,
  23381. 0x486c5c74,
  23382. 0x4665517f,
  23383. 0x547e4662,
  23384. 0x5a774b69,
  23385. 0xe090d0b0,
  23386. 0xee99ddbb,
  23387. 0xfc82caa6,
  23388. 0xf28bc7ad,
  23389. 0xd8b4e49c,
  23390. 0xd6bde997,
  23391. 0xc4a6fe8a,
  23392. 0xcaaff381,
  23393. 0x90d8b8e8,
  23394. 0x9ed1b5e3,
  23395. 0x8ccaa2fe,
  23396. 0x82c3aff5,
  23397. 0xa8fc8cc4,
  23398. 0xa6f581cf,
  23399. 0xb4ee96d2,
  23400. 0xbae79bd9,
  23401. 0xdb3bbb7b,
  23402. 0xd532b670,
  23403. 0xc729a16d,
  23404. 0xc920ac66,
  23405. 0xe31f8f57,
  23406. 0xed16825c,
  23407. 0xff0d9541,
  23408. 0xf104984a,
  23409. 0xab73d323,
  23410. 0xa57ade28,
  23411. 0xb761c935,
  23412. 0xb968c43e,
  23413. 0x9357e70f,
  23414. 0x9d5eea04,
  23415. 0x8f45fd19,
  23416. 0x814cf012,
  23417. 0x3bab6bcb,
  23418. 0x35a266c0,
  23419. 0x27b971dd,
  23420. 0x29b07cd6,
  23421. 0x038f5fe7,
  23422. 0x0d8652ec,
  23423. 0x1f9d45f1,
  23424. 0x119448fa,
  23425. 0x4be30393,
  23426. 0x45ea0e98,
  23427. 0x57f11985,
  23428. 0x59f8148e,
  23429. 0x73c737bf,
  23430. 0x7dce3ab4,
  23431. 0x6fd52da9,
  23432. 0x61dc20a2,
  23433. 0xad766df6,
  23434. 0xa37f60fd,
  23435. 0xb16477e0,
  23436. 0xbf6d7aeb,
  23437. 0x955259da,
  23438. 0x9b5b54d1,
  23439. 0x894043cc,
  23440. 0x87494ec7,
  23441. 0xdd3e05ae,
  23442. 0xd33708a5,
  23443. 0xc12c1fb8,
  23444. 0xcf2512b3,
  23445. 0xe51a3182,
  23446. 0xeb133c89,
  23447. 0xf9082b94,
  23448. 0xf701269f,
  23449. 0x4de6bd46,
  23450. 0x43efb04d,
  23451. 0x51f4a750,
  23452. 0x5ffdaa5b,
  23453. 0x75c2896a,
  23454. 0x7bcb8461,
  23455. 0x69d0937c,
  23456. 0x67d99e77,
  23457. 0x3daed51e,
  23458. 0x33a7d815,
  23459. 0x21bccf08,
  23460. 0x2fb5c203,
  23461. 0x058ae132,
  23462. 0x0b83ec39,
  23463. 0x1998fb24,
  23464. 0x1791f62f,
  23465. 0x764dd68d,
  23466. 0x7844db86,
  23467. 0x6a5fcc9b,
  23468. 0x6456c190,
  23469. 0x4e69e2a1,
  23470. 0x4060efaa,
  23471. 0x527bf8b7,
  23472. 0x5c72f5bc,
  23473. 0x0605bed5,
  23474. 0x080cb3de,
  23475. 0x1a17a4c3,
  23476. 0x141ea9c8,
  23477. 0x3e218af9,
  23478. 0x302887f2,
  23479. 0x223390ef,
  23480. 0x2c3a9de4,
  23481. 0x96dd063d,
  23482. 0x98d40b36,
  23483. 0x8acf1c2b,
  23484. 0x84c61120,
  23485. 0xaef93211,
  23486. 0xa0f03f1a,
  23487. 0xb2eb2807,
  23488. 0xbce2250c,
  23489. 0xe6956e65,
  23490. 0xe89c636e,
  23491. 0xfa877473,
  23492. 0xf48e7978,
  23493. 0xdeb15a49,
  23494. 0xd0b85742,
  23495. 0xc2a3405f,
  23496. 0xccaa4d54,
  23497. 0x41ecdaf7,
  23498. 0x4fe5d7fc,
  23499. 0x5dfec0e1,
  23500. 0x53f7cdea,
  23501. 0x79c8eedb,
  23502. 0x77c1e3d0,
  23503. 0x65daf4cd,
  23504. 0x6bd3f9c6,
  23505. 0x31a4b2af,
  23506. 0x3fadbfa4,
  23507. 0x2db6a8b9,
  23508. 0x23bfa5b2,
  23509. 0x09808683,
  23510. 0x07898b88,
  23511. 0x15929c95,
  23512. 0x1b9b919e,
  23513. 0xa17c0a47,
  23514. 0xaf75074c,
  23515. 0xbd6e1051,
  23516. 0xb3671d5a,
  23517. 0x99583e6b,
  23518. 0x97513360,
  23519. 0x854a247d,
  23520. 0x8b432976,
  23521. 0xd134621f,
  23522. 0xdf3d6f14,
  23523. 0xcd267809,
  23524. 0xc32f7502,
  23525. 0xe9105633,
  23526. 0xe7195b38,
  23527. 0xf5024c25,
  23528. 0xfb0b412e,
  23529. 0x9ad7618c,
  23530. 0x94de6c87,
  23531. 0x86c57b9a,
  23532. 0x88cc7691,
  23533. 0xa2f355a0,
  23534. 0xacfa58ab,
  23535. 0xbee14fb6,
  23536. 0xb0e842bd,
  23537. 0xea9f09d4,
  23538. 0xe49604df,
  23539. 0xf68d13c2,
  23540. 0xf8841ec9,
  23541. 0xd2bb3df8,
  23542. 0xdcb230f3,
  23543. 0xcea927ee,
  23544. 0xc0a02ae5,
  23545. 0x7a47b13c,
  23546. 0x744ebc37,
  23547. 0x6655ab2a,
  23548. 0x685ca621,
  23549. 0x42638510,
  23550. 0x4c6a881b,
  23551. 0x5e719f06,
  23552. 0x5078920d,
  23553. 0x0a0fd964,
  23554. 0x0406d46f,
  23555. 0x161dc372,
  23556. 0x1814ce79,
  23557. 0x322bed48,
  23558. 0x3c22e043,
  23559. 0x2e39f75e,
  23560. 0x2030fa55,
  23561. 0xec9ab701,
  23562. 0xe293ba0a,
  23563. 0xf088ad17,
  23564. 0xfe81a01c,
  23565. 0xd4be832d,
  23566. 0xdab78e26,
  23567. 0xc8ac993b,
  23568. 0xc6a59430,
  23569. 0x9cd2df59,
  23570. 0x92dbd252,
  23571. 0x80c0c54f,
  23572. 0x8ec9c844,
  23573. 0xa4f6eb75,
  23574. 0xaaffe67e,
  23575. 0xb8e4f163,
  23576. 0xb6edfc68,
  23577. 0x0c0a67b1,
  23578. 0x02036aba,
  23579. 0x10187da7,
  23580. 0x1e1170ac,
  23581. 0x342e539d,
  23582. 0x3a275e96,
  23583. 0x283c498b,
  23584. 0x26354480,
  23585. 0x7c420fe9,
  23586. 0x724b02e2,
  23587. 0x605015ff,
  23588. 0x6e5918f4,
  23589. 0x44663bc5,
  23590. 0x4a6f36ce,
  23591. 0x587421d3,
  23592. 0x567d2cd8,
  23593. 0x37a10c7a,
  23594. 0x39a80171,
  23595. 0x2bb3166c,
  23596. 0x25ba1b67,
  23597. 0x0f853856,
  23598. 0x018c355d,
  23599. 0x13972240,
  23600. 0x1d9e2f4b,
  23601. 0x47e96422,
  23602. 0x49e06929,
  23603. 0x5bfb7e34,
  23604. 0x55f2733f,
  23605. 0x7fcd500e,
  23606. 0x71c45d05,
  23607. 0x63df4a18,
  23608. 0x6dd64713,
  23609. 0xd731dcca,
  23610. 0xd938d1c1,
  23611. 0xcb23c6dc,
  23612. 0xc52acbd7,
  23613. 0xef15e8e6,
  23614. 0xe11ce5ed,
  23615. 0xf307f2f0,
  23616. 0xfd0efffb,
  23617. 0xa779b492,
  23618. 0xa970b999,
  23619. 0xbb6bae84,
  23620. 0xb562a38f,
  23621. 0x9f5d80be,
  23622. 0x91548db5,
  23623. 0x834f9aa8,
  23624. 0x8d4697a3
  23625. ]);
  23626. function expandKey128(cipherKey) {
  23627. var b = 176, result = new Uint8Array(b);
  23628. result.set(cipherKey);
  23629. for (var j = 16, i = 1; j < b; ++i) {
  23630. var t1 = result[j - 3], t2 = result[j - 2], t3 = result[j - 1], t4 = result[j - 4];
  23631. t1 = s[t1];
  23632. t2 = s[t2];
  23633. t3 = s[t3];
  23634. t4 = s[t4];
  23635. t1 = t1 ^ rcon[i];
  23636. for (var n = 0; n < 4; ++n) {
  23637. result[j] = t1 ^= result[j - 16];
  23638. j++;
  23639. result[j] = t2 ^= result[j - 16];
  23640. j++;
  23641. result[j] = t3 ^= result[j - 16];
  23642. j++;
  23643. result[j] = t4 ^= result[j - 16];
  23644. j++;
  23645. }
  23646. }
  23647. return result;
  23648. }
  23649. function decrypt128(input, key) {
  23650. var state = new Uint8Array(16);
  23651. state.set(input);
  23652. var i, j, k;
  23653. var t, u, v;
  23654. for (j = 0, k = 160; j < 16; ++j, ++k) {
  23655. state[j] ^= key[k];
  23656. }
  23657. for (i = 9; i >= 1; --i) {
  23658. t = state[13];
  23659. state[13] = state[9];
  23660. state[9] = state[5];
  23661. state[5] = state[1];
  23662. state[1] = t;
  23663. t = state[14];
  23664. u = state[10];
  23665. state[14] = state[6];
  23666. state[10] = state[2];
  23667. state[6] = t;
  23668. state[2] = u;
  23669. t = state[15];
  23670. u = state[11];
  23671. v = state[7];
  23672. state[15] = state[3];
  23673. state[11] = t;
  23674. state[7] = u;
  23675. state[3] = v;
  23676. for (j = 0; j < 16; ++j) {
  23677. state[j] = inv_s[state[j]];
  23678. }
  23679. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  23680. state[j] ^= key[k];
  23681. }
  23682. for (j = 0; j < 16; j += 4) {
  23683. var s0 = mix[state[j]], s1 = mix[state[j + 1]], s2 = mix[state[j + 2]], s3 = mix[state[j + 3]];
  23684. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  23685. state[j] = t >>> 24 & 0xFF;
  23686. state[j + 1] = t >> 16 & 0xFF;
  23687. state[j + 2] = t >> 8 & 0xFF;
  23688. state[j + 3] = t & 0xFF;
  23689. }
  23690. }
  23691. t = state[13];
  23692. state[13] = state[9];
  23693. state[9] = state[5];
  23694. state[5] = state[1];
  23695. state[1] = t;
  23696. t = state[14];
  23697. u = state[10];
  23698. state[14] = state[6];
  23699. state[10] = state[2];
  23700. state[6] = t;
  23701. state[2] = u;
  23702. t = state[15];
  23703. u = state[11];
  23704. v = state[7];
  23705. state[15] = state[3];
  23706. state[11] = t;
  23707. state[7] = u;
  23708. state[3] = v;
  23709. for (j = 0; j < 16; ++j) {
  23710. state[j] = inv_s[state[j]];
  23711. state[j] ^= key[j];
  23712. }
  23713. return state;
  23714. }
  23715. function encrypt128(input, key) {
  23716. var t, u, v, k;
  23717. var state = new Uint8Array(16);
  23718. state.set(input);
  23719. for (j = 0; j < 16; ++j) {
  23720. state[j] ^= key[j];
  23721. }
  23722. for (i = 1; i < 10; i++) {
  23723. for (j = 0; j < 16; ++j) {
  23724. state[j] = s[state[j]];
  23725. }
  23726. v = state[1];
  23727. state[1] = state[5];
  23728. state[5] = state[9];
  23729. state[9] = state[13];
  23730. state[13] = v;
  23731. v = state[2];
  23732. u = state[6];
  23733. state[2] = state[10];
  23734. state[6] = state[14];
  23735. state[10] = v;
  23736. state[14] = u;
  23737. v = state[3];
  23738. u = state[7];
  23739. t = state[11];
  23740. state[3] = state[15];
  23741. state[7] = v;
  23742. state[11] = u;
  23743. state[15] = t;
  23744. for (var j = 0; j < 16; j += 4) {
  23745. var s0 = state[j + 0], s1 = state[j + 1];
  23746. var s2 = state[j + 2], s3 = state[j + 3];
  23747. t = s0 ^ s1 ^ s2 ^ s3;
  23748. state[j + 0] ^= t ^ mixCol[s0 ^ s1];
  23749. state[j + 1] ^= t ^ mixCol[s1 ^ s2];
  23750. state[j + 2] ^= t ^ mixCol[s2 ^ s3];
  23751. state[j + 3] ^= t ^ mixCol[s3 ^ s0];
  23752. }
  23753. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  23754. state[j] ^= key[k];
  23755. }
  23756. }
  23757. for (j = 0; j < 16; ++j) {
  23758. state[j] = s[state[j]];
  23759. }
  23760. v = state[1];
  23761. state[1] = state[5];
  23762. state[5] = state[9];
  23763. state[9] = state[13];
  23764. state[13] = v;
  23765. v = state[2];
  23766. u = state[6];
  23767. state[2] = state[10];
  23768. state[6] = state[14];
  23769. state[10] = v;
  23770. state[14] = u;
  23771. v = state[3];
  23772. u = state[7];
  23773. t = state[11];
  23774. state[3] = state[15];
  23775. state[7] = v;
  23776. state[11] = u;
  23777. state[15] = t;
  23778. for (j = 0, k = 160; j < 16; ++j, ++k) {
  23779. state[j] ^= key[k];
  23780. }
  23781. return state;
  23782. }
  23783. function AES128Cipher(key) {
  23784. this.key = expandKey128(key);
  23785. this.buffer = new Uint8Array(16);
  23786. this.bufferPosition = 0;
  23787. }
  23788. function decryptBlock2(data, finalize) {
  23789. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [], iv = this.iv;
  23790. for (i = 0; i < sourceLength; ++i) {
  23791. buffer[bufferLength] = data[i];
  23792. ++bufferLength;
  23793. if (bufferLength < 16) {
  23794. continue;
  23795. }
  23796. var plain = decrypt128(buffer, this.key);
  23797. for (j = 0; j < 16; ++j) {
  23798. plain[j] ^= iv[j];
  23799. }
  23800. iv = buffer;
  23801. result.push(plain);
  23802. buffer = new Uint8Array(16);
  23803. bufferLength = 0;
  23804. }
  23805. this.buffer = buffer;
  23806. this.bufferLength = bufferLength;
  23807. this.iv = iv;
  23808. if (result.length === 0) {
  23809. return new Uint8Array([]);
  23810. }
  23811. var outputLength = 16 * result.length;
  23812. if (finalize) {
  23813. var lastBlock = result[result.length - 1];
  23814. var psLen = lastBlock[15];
  23815. if (psLen <= 16) {
  23816. for (i = 15, ii = 16 - psLen; i >= ii; --i) {
  23817. if (lastBlock[i] !== psLen) {
  23818. psLen = 0;
  23819. break;
  23820. }
  23821. }
  23822. outputLength -= psLen;
  23823. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  23824. }
  23825. }
  23826. var output = new Uint8Array(outputLength);
  23827. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  23828. output.set(result[i], j);
  23829. }
  23830. return output;
  23831. }
  23832. AES128Cipher.prototype = {
  23833. decryptBlock: function AES128Cipher_decryptBlock(data, finalize) {
  23834. var i, sourceLength = data.length;
  23835. var buffer = this.buffer, bufferLength = this.bufferPosition;
  23836. for (i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  23837. buffer[bufferLength] = data[i];
  23838. }
  23839. if (bufferLength < 16) {
  23840. this.bufferLength = bufferLength;
  23841. return new Uint8Array([]);
  23842. }
  23843. this.iv = buffer;
  23844. this.buffer = new Uint8Array(16);
  23845. this.bufferLength = 0;
  23846. this.decryptBlock = decryptBlock2;
  23847. return this.decryptBlock(data.subarray(16), finalize);
  23848. },
  23849. encrypt: function AES128Cipher_encrypt(data, iv) {
  23850. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [];
  23851. if (!iv) {
  23852. iv = new Uint8Array(16);
  23853. }
  23854. for (i = 0; i < sourceLength; ++i) {
  23855. buffer[bufferLength] = data[i];
  23856. ++bufferLength;
  23857. if (bufferLength < 16) {
  23858. continue;
  23859. }
  23860. for (j = 0; j < 16; ++j) {
  23861. buffer[j] ^= iv[j];
  23862. }
  23863. var cipher = encrypt128(buffer, this.key);
  23864. iv = cipher;
  23865. result.push(cipher);
  23866. buffer = new Uint8Array(16);
  23867. bufferLength = 0;
  23868. }
  23869. this.buffer = buffer;
  23870. this.bufferLength = bufferLength;
  23871. this.iv = iv;
  23872. if (result.length === 0) {
  23873. return new Uint8Array([]);
  23874. }
  23875. var outputLength = 16 * result.length;
  23876. var output = new Uint8Array(outputLength);
  23877. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  23878. output.set(result[i], j);
  23879. }
  23880. return output;
  23881. }
  23882. };
  23883. return AES128Cipher;
  23884. }();
  23885. var AES256Cipher = function AES256CipherClosure() {
  23886. var s = new Uint8Array([
  23887. 0x63,
  23888. 0x7c,
  23889. 0x77,
  23890. 0x7b,
  23891. 0xf2,
  23892. 0x6b,
  23893. 0x6f,
  23894. 0xc5,
  23895. 0x30,
  23896. 0x01,
  23897. 0x67,
  23898. 0x2b,
  23899. 0xfe,
  23900. 0xd7,
  23901. 0xab,
  23902. 0x76,
  23903. 0xca,
  23904. 0x82,
  23905. 0xc9,
  23906. 0x7d,
  23907. 0xfa,
  23908. 0x59,
  23909. 0x47,
  23910. 0xf0,
  23911. 0xad,
  23912. 0xd4,
  23913. 0xa2,
  23914. 0xaf,
  23915. 0x9c,
  23916. 0xa4,
  23917. 0x72,
  23918. 0xc0,
  23919. 0xb7,
  23920. 0xfd,
  23921. 0x93,
  23922. 0x26,
  23923. 0x36,
  23924. 0x3f,
  23925. 0xf7,
  23926. 0xcc,
  23927. 0x34,
  23928. 0xa5,
  23929. 0xe5,
  23930. 0xf1,
  23931. 0x71,
  23932. 0xd8,
  23933. 0x31,
  23934. 0x15,
  23935. 0x04,
  23936. 0xc7,
  23937. 0x23,
  23938. 0xc3,
  23939. 0x18,
  23940. 0x96,
  23941. 0x05,
  23942. 0x9a,
  23943. 0x07,
  23944. 0x12,
  23945. 0x80,
  23946. 0xe2,
  23947. 0xeb,
  23948. 0x27,
  23949. 0xb2,
  23950. 0x75,
  23951. 0x09,
  23952. 0x83,
  23953. 0x2c,
  23954. 0x1a,
  23955. 0x1b,
  23956. 0x6e,
  23957. 0x5a,
  23958. 0xa0,
  23959. 0x52,
  23960. 0x3b,
  23961. 0xd6,
  23962. 0xb3,
  23963. 0x29,
  23964. 0xe3,
  23965. 0x2f,
  23966. 0x84,
  23967. 0x53,
  23968. 0xd1,
  23969. 0x00,
  23970. 0xed,
  23971. 0x20,
  23972. 0xfc,
  23973. 0xb1,
  23974. 0x5b,
  23975. 0x6a,
  23976. 0xcb,
  23977. 0xbe,
  23978. 0x39,
  23979. 0x4a,
  23980. 0x4c,
  23981. 0x58,
  23982. 0xcf,
  23983. 0xd0,
  23984. 0xef,
  23985. 0xaa,
  23986. 0xfb,
  23987. 0x43,
  23988. 0x4d,
  23989. 0x33,
  23990. 0x85,
  23991. 0x45,
  23992. 0xf9,
  23993. 0x02,
  23994. 0x7f,
  23995. 0x50,
  23996. 0x3c,
  23997. 0x9f,
  23998. 0xa8,
  23999. 0x51,
  24000. 0xa3,
  24001. 0x40,
  24002. 0x8f,
  24003. 0x92,
  24004. 0x9d,
  24005. 0x38,
  24006. 0xf5,
  24007. 0xbc,
  24008. 0xb6,
  24009. 0xda,
  24010. 0x21,
  24011. 0x10,
  24012. 0xff,
  24013. 0xf3,
  24014. 0xd2,
  24015. 0xcd,
  24016. 0x0c,
  24017. 0x13,
  24018. 0xec,
  24019. 0x5f,
  24020. 0x97,
  24021. 0x44,
  24022. 0x17,
  24023. 0xc4,
  24024. 0xa7,
  24025. 0x7e,
  24026. 0x3d,
  24027. 0x64,
  24028. 0x5d,
  24029. 0x19,
  24030. 0x73,
  24031. 0x60,
  24032. 0x81,
  24033. 0x4f,
  24034. 0xdc,
  24035. 0x22,
  24036. 0x2a,
  24037. 0x90,
  24038. 0x88,
  24039. 0x46,
  24040. 0xee,
  24041. 0xb8,
  24042. 0x14,
  24043. 0xde,
  24044. 0x5e,
  24045. 0x0b,
  24046. 0xdb,
  24047. 0xe0,
  24048. 0x32,
  24049. 0x3a,
  24050. 0x0a,
  24051. 0x49,
  24052. 0x06,
  24053. 0x24,
  24054. 0x5c,
  24055. 0xc2,
  24056. 0xd3,
  24057. 0xac,
  24058. 0x62,
  24059. 0x91,
  24060. 0x95,
  24061. 0xe4,
  24062. 0x79,
  24063. 0xe7,
  24064. 0xc8,
  24065. 0x37,
  24066. 0x6d,
  24067. 0x8d,
  24068. 0xd5,
  24069. 0x4e,
  24070. 0xa9,
  24071. 0x6c,
  24072. 0x56,
  24073. 0xf4,
  24074. 0xea,
  24075. 0x65,
  24076. 0x7a,
  24077. 0xae,
  24078. 0x08,
  24079. 0xba,
  24080. 0x78,
  24081. 0x25,
  24082. 0x2e,
  24083. 0x1c,
  24084. 0xa6,
  24085. 0xb4,
  24086. 0xc6,
  24087. 0xe8,
  24088. 0xdd,
  24089. 0x74,
  24090. 0x1f,
  24091. 0x4b,
  24092. 0xbd,
  24093. 0x8b,
  24094. 0x8a,
  24095. 0x70,
  24096. 0x3e,
  24097. 0xb5,
  24098. 0x66,
  24099. 0x48,
  24100. 0x03,
  24101. 0xf6,
  24102. 0x0e,
  24103. 0x61,
  24104. 0x35,
  24105. 0x57,
  24106. 0xb9,
  24107. 0x86,
  24108. 0xc1,
  24109. 0x1d,
  24110. 0x9e,
  24111. 0xe1,
  24112. 0xf8,
  24113. 0x98,
  24114. 0x11,
  24115. 0x69,
  24116. 0xd9,
  24117. 0x8e,
  24118. 0x94,
  24119. 0x9b,
  24120. 0x1e,
  24121. 0x87,
  24122. 0xe9,
  24123. 0xce,
  24124. 0x55,
  24125. 0x28,
  24126. 0xdf,
  24127. 0x8c,
  24128. 0xa1,
  24129. 0x89,
  24130. 0x0d,
  24131. 0xbf,
  24132. 0xe6,
  24133. 0x42,
  24134. 0x68,
  24135. 0x41,
  24136. 0x99,
  24137. 0x2d,
  24138. 0x0f,
  24139. 0xb0,
  24140. 0x54,
  24141. 0xbb,
  24142. 0x16
  24143. ]);
  24144. var inv_s = new Uint8Array([
  24145. 0x52,
  24146. 0x09,
  24147. 0x6a,
  24148. 0xd5,
  24149. 0x30,
  24150. 0x36,
  24151. 0xa5,
  24152. 0x38,
  24153. 0xbf,
  24154. 0x40,
  24155. 0xa3,
  24156. 0x9e,
  24157. 0x81,
  24158. 0xf3,
  24159. 0xd7,
  24160. 0xfb,
  24161. 0x7c,
  24162. 0xe3,
  24163. 0x39,
  24164. 0x82,
  24165. 0x9b,
  24166. 0x2f,
  24167. 0xff,
  24168. 0x87,
  24169. 0x34,
  24170. 0x8e,
  24171. 0x43,
  24172. 0x44,
  24173. 0xc4,
  24174. 0xde,
  24175. 0xe9,
  24176. 0xcb,
  24177. 0x54,
  24178. 0x7b,
  24179. 0x94,
  24180. 0x32,
  24181. 0xa6,
  24182. 0xc2,
  24183. 0x23,
  24184. 0x3d,
  24185. 0xee,
  24186. 0x4c,
  24187. 0x95,
  24188. 0x0b,
  24189. 0x42,
  24190. 0xfa,
  24191. 0xc3,
  24192. 0x4e,
  24193. 0x08,
  24194. 0x2e,
  24195. 0xa1,
  24196. 0x66,
  24197. 0x28,
  24198. 0xd9,
  24199. 0x24,
  24200. 0xb2,
  24201. 0x76,
  24202. 0x5b,
  24203. 0xa2,
  24204. 0x49,
  24205. 0x6d,
  24206. 0x8b,
  24207. 0xd1,
  24208. 0x25,
  24209. 0x72,
  24210. 0xf8,
  24211. 0xf6,
  24212. 0x64,
  24213. 0x86,
  24214. 0x68,
  24215. 0x98,
  24216. 0x16,
  24217. 0xd4,
  24218. 0xa4,
  24219. 0x5c,
  24220. 0xcc,
  24221. 0x5d,
  24222. 0x65,
  24223. 0xb6,
  24224. 0x92,
  24225. 0x6c,
  24226. 0x70,
  24227. 0x48,
  24228. 0x50,
  24229. 0xfd,
  24230. 0xed,
  24231. 0xb9,
  24232. 0xda,
  24233. 0x5e,
  24234. 0x15,
  24235. 0x46,
  24236. 0x57,
  24237. 0xa7,
  24238. 0x8d,
  24239. 0x9d,
  24240. 0x84,
  24241. 0x90,
  24242. 0xd8,
  24243. 0xab,
  24244. 0x00,
  24245. 0x8c,
  24246. 0xbc,
  24247. 0xd3,
  24248. 0x0a,
  24249. 0xf7,
  24250. 0xe4,
  24251. 0x58,
  24252. 0x05,
  24253. 0xb8,
  24254. 0xb3,
  24255. 0x45,
  24256. 0x06,
  24257. 0xd0,
  24258. 0x2c,
  24259. 0x1e,
  24260. 0x8f,
  24261. 0xca,
  24262. 0x3f,
  24263. 0x0f,
  24264. 0x02,
  24265. 0xc1,
  24266. 0xaf,
  24267. 0xbd,
  24268. 0x03,
  24269. 0x01,
  24270. 0x13,
  24271. 0x8a,
  24272. 0x6b,
  24273. 0x3a,
  24274. 0x91,
  24275. 0x11,
  24276. 0x41,
  24277. 0x4f,
  24278. 0x67,
  24279. 0xdc,
  24280. 0xea,
  24281. 0x97,
  24282. 0xf2,
  24283. 0xcf,
  24284. 0xce,
  24285. 0xf0,
  24286. 0xb4,
  24287. 0xe6,
  24288. 0x73,
  24289. 0x96,
  24290. 0xac,
  24291. 0x74,
  24292. 0x22,
  24293. 0xe7,
  24294. 0xad,
  24295. 0x35,
  24296. 0x85,
  24297. 0xe2,
  24298. 0xf9,
  24299. 0x37,
  24300. 0xe8,
  24301. 0x1c,
  24302. 0x75,
  24303. 0xdf,
  24304. 0x6e,
  24305. 0x47,
  24306. 0xf1,
  24307. 0x1a,
  24308. 0x71,
  24309. 0x1d,
  24310. 0x29,
  24311. 0xc5,
  24312. 0x89,
  24313. 0x6f,
  24314. 0xb7,
  24315. 0x62,
  24316. 0x0e,
  24317. 0xaa,
  24318. 0x18,
  24319. 0xbe,
  24320. 0x1b,
  24321. 0xfc,
  24322. 0x56,
  24323. 0x3e,
  24324. 0x4b,
  24325. 0xc6,
  24326. 0xd2,
  24327. 0x79,
  24328. 0x20,
  24329. 0x9a,
  24330. 0xdb,
  24331. 0xc0,
  24332. 0xfe,
  24333. 0x78,
  24334. 0xcd,
  24335. 0x5a,
  24336. 0xf4,
  24337. 0x1f,
  24338. 0xdd,
  24339. 0xa8,
  24340. 0x33,
  24341. 0x88,
  24342. 0x07,
  24343. 0xc7,
  24344. 0x31,
  24345. 0xb1,
  24346. 0x12,
  24347. 0x10,
  24348. 0x59,
  24349. 0x27,
  24350. 0x80,
  24351. 0xec,
  24352. 0x5f,
  24353. 0x60,
  24354. 0x51,
  24355. 0x7f,
  24356. 0xa9,
  24357. 0x19,
  24358. 0xb5,
  24359. 0x4a,
  24360. 0x0d,
  24361. 0x2d,
  24362. 0xe5,
  24363. 0x7a,
  24364. 0x9f,
  24365. 0x93,
  24366. 0xc9,
  24367. 0x9c,
  24368. 0xef,
  24369. 0xa0,
  24370. 0xe0,
  24371. 0x3b,
  24372. 0x4d,
  24373. 0xae,
  24374. 0x2a,
  24375. 0xf5,
  24376. 0xb0,
  24377. 0xc8,
  24378. 0xeb,
  24379. 0xbb,
  24380. 0x3c,
  24381. 0x83,
  24382. 0x53,
  24383. 0x99,
  24384. 0x61,
  24385. 0x17,
  24386. 0x2b,
  24387. 0x04,
  24388. 0x7e,
  24389. 0xba,
  24390. 0x77,
  24391. 0xd6,
  24392. 0x26,
  24393. 0xe1,
  24394. 0x69,
  24395. 0x14,
  24396. 0x63,
  24397. 0x55,
  24398. 0x21,
  24399. 0x0c,
  24400. 0x7d
  24401. ]);
  24402. var mixCol = new Uint8Array(256);
  24403. for (var i = 0; i < 256; i++) {
  24404. if (i < 128) {
  24405. mixCol[i] = i << 1;
  24406. } else {
  24407. mixCol[i] = i << 1 ^ 0x1b;
  24408. }
  24409. }
  24410. var mix = new Uint32Array([
  24411. 0x00000000,
  24412. 0x0e090d0b,
  24413. 0x1c121a16,
  24414. 0x121b171d,
  24415. 0x3824342c,
  24416. 0x362d3927,
  24417. 0x24362e3a,
  24418. 0x2a3f2331,
  24419. 0x70486858,
  24420. 0x7e416553,
  24421. 0x6c5a724e,
  24422. 0x62537f45,
  24423. 0x486c5c74,
  24424. 0x4665517f,
  24425. 0x547e4662,
  24426. 0x5a774b69,
  24427. 0xe090d0b0,
  24428. 0xee99ddbb,
  24429. 0xfc82caa6,
  24430. 0xf28bc7ad,
  24431. 0xd8b4e49c,
  24432. 0xd6bde997,
  24433. 0xc4a6fe8a,
  24434. 0xcaaff381,
  24435. 0x90d8b8e8,
  24436. 0x9ed1b5e3,
  24437. 0x8ccaa2fe,
  24438. 0x82c3aff5,
  24439. 0xa8fc8cc4,
  24440. 0xa6f581cf,
  24441. 0xb4ee96d2,
  24442. 0xbae79bd9,
  24443. 0xdb3bbb7b,
  24444. 0xd532b670,
  24445. 0xc729a16d,
  24446. 0xc920ac66,
  24447. 0xe31f8f57,
  24448. 0xed16825c,
  24449. 0xff0d9541,
  24450. 0xf104984a,
  24451. 0xab73d323,
  24452. 0xa57ade28,
  24453. 0xb761c935,
  24454. 0xb968c43e,
  24455. 0x9357e70f,
  24456. 0x9d5eea04,
  24457. 0x8f45fd19,
  24458. 0x814cf012,
  24459. 0x3bab6bcb,
  24460. 0x35a266c0,
  24461. 0x27b971dd,
  24462. 0x29b07cd6,
  24463. 0x038f5fe7,
  24464. 0x0d8652ec,
  24465. 0x1f9d45f1,
  24466. 0x119448fa,
  24467. 0x4be30393,
  24468. 0x45ea0e98,
  24469. 0x57f11985,
  24470. 0x59f8148e,
  24471. 0x73c737bf,
  24472. 0x7dce3ab4,
  24473. 0x6fd52da9,
  24474. 0x61dc20a2,
  24475. 0xad766df6,
  24476. 0xa37f60fd,
  24477. 0xb16477e0,
  24478. 0xbf6d7aeb,
  24479. 0x955259da,
  24480. 0x9b5b54d1,
  24481. 0x894043cc,
  24482. 0x87494ec7,
  24483. 0xdd3e05ae,
  24484. 0xd33708a5,
  24485. 0xc12c1fb8,
  24486. 0xcf2512b3,
  24487. 0xe51a3182,
  24488. 0xeb133c89,
  24489. 0xf9082b94,
  24490. 0xf701269f,
  24491. 0x4de6bd46,
  24492. 0x43efb04d,
  24493. 0x51f4a750,
  24494. 0x5ffdaa5b,
  24495. 0x75c2896a,
  24496. 0x7bcb8461,
  24497. 0x69d0937c,
  24498. 0x67d99e77,
  24499. 0x3daed51e,
  24500. 0x33a7d815,
  24501. 0x21bccf08,
  24502. 0x2fb5c203,
  24503. 0x058ae132,
  24504. 0x0b83ec39,
  24505. 0x1998fb24,
  24506. 0x1791f62f,
  24507. 0x764dd68d,
  24508. 0x7844db86,
  24509. 0x6a5fcc9b,
  24510. 0x6456c190,
  24511. 0x4e69e2a1,
  24512. 0x4060efaa,
  24513. 0x527bf8b7,
  24514. 0x5c72f5bc,
  24515. 0x0605bed5,
  24516. 0x080cb3de,
  24517. 0x1a17a4c3,
  24518. 0x141ea9c8,
  24519. 0x3e218af9,
  24520. 0x302887f2,
  24521. 0x223390ef,
  24522. 0x2c3a9de4,
  24523. 0x96dd063d,
  24524. 0x98d40b36,
  24525. 0x8acf1c2b,
  24526. 0x84c61120,
  24527. 0xaef93211,
  24528. 0xa0f03f1a,
  24529. 0xb2eb2807,
  24530. 0xbce2250c,
  24531. 0xe6956e65,
  24532. 0xe89c636e,
  24533. 0xfa877473,
  24534. 0xf48e7978,
  24535. 0xdeb15a49,
  24536. 0xd0b85742,
  24537. 0xc2a3405f,
  24538. 0xccaa4d54,
  24539. 0x41ecdaf7,
  24540. 0x4fe5d7fc,
  24541. 0x5dfec0e1,
  24542. 0x53f7cdea,
  24543. 0x79c8eedb,
  24544. 0x77c1e3d0,
  24545. 0x65daf4cd,
  24546. 0x6bd3f9c6,
  24547. 0x31a4b2af,
  24548. 0x3fadbfa4,
  24549. 0x2db6a8b9,
  24550. 0x23bfa5b2,
  24551. 0x09808683,
  24552. 0x07898b88,
  24553. 0x15929c95,
  24554. 0x1b9b919e,
  24555. 0xa17c0a47,
  24556. 0xaf75074c,
  24557. 0xbd6e1051,
  24558. 0xb3671d5a,
  24559. 0x99583e6b,
  24560. 0x97513360,
  24561. 0x854a247d,
  24562. 0x8b432976,
  24563. 0xd134621f,
  24564. 0xdf3d6f14,
  24565. 0xcd267809,
  24566. 0xc32f7502,
  24567. 0xe9105633,
  24568. 0xe7195b38,
  24569. 0xf5024c25,
  24570. 0xfb0b412e,
  24571. 0x9ad7618c,
  24572. 0x94de6c87,
  24573. 0x86c57b9a,
  24574. 0x88cc7691,
  24575. 0xa2f355a0,
  24576. 0xacfa58ab,
  24577. 0xbee14fb6,
  24578. 0xb0e842bd,
  24579. 0xea9f09d4,
  24580. 0xe49604df,
  24581. 0xf68d13c2,
  24582. 0xf8841ec9,
  24583. 0xd2bb3df8,
  24584. 0xdcb230f3,
  24585. 0xcea927ee,
  24586. 0xc0a02ae5,
  24587. 0x7a47b13c,
  24588. 0x744ebc37,
  24589. 0x6655ab2a,
  24590. 0x685ca621,
  24591. 0x42638510,
  24592. 0x4c6a881b,
  24593. 0x5e719f06,
  24594. 0x5078920d,
  24595. 0x0a0fd964,
  24596. 0x0406d46f,
  24597. 0x161dc372,
  24598. 0x1814ce79,
  24599. 0x322bed48,
  24600. 0x3c22e043,
  24601. 0x2e39f75e,
  24602. 0x2030fa55,
  24603. 0xec9ab701,
  24604. 0xe293ba0a,
  24605. 0xf088ad17,
  24606. 0xfe81a01c,
  24607. 0xd4be832d,
  24608. 0xdab78e26,
  24609. 0xc8ac993b,
  24610. 0xc6a59430,
  24611. 0x9cd2df59,
  24612. 0x92dbd252,
  24613. 0x80c0c54f,
  24614. 0x8ec9c844,
  24615. 0xa4f6eb75,
  24616. 0xaaffe67e,
  24617. 0xb8e4f163,
  24618. 0xb6edfc68,
  24619. 0x0c0a67b1,
  24620. 0x02036aba,
  24621. 0x10187da7,
  24622. 0x1e1170ac,
  24623. 0x342e539d,
  24624. 0x3a275e96,
  24625. 0x283c498b,
  24626. 0x26354480,
  24627. 0x7c420fe9,
  24628. 0x724b02e2,
  24629. 0x605015ff,
  24630. 0x6e5918f4,
  24631. 0x44663bc5,
  24632. 0x4a6f36ce,
  24633. 0x587421d3,
  24634. 0x567d2cd8,
  24635. 0x37a10c7a,
  24636. 0x39a80171,
  24637. 0x2bb3166c,
  24638. 0x25ba1b67,
  24639. 0x0f853856,
  24640. 0x018c355d,
  24641. 0x13972240,
  24642. 0x1d9e2f4b,
  24643. 0x47e96422,
  24644. 0x49e06929,
  24645. 0x5bfb7e34,
  24646. 0x55f2733f,
  24647. 0x7fcd500e,
  24648. 0x71c45d05,
  24649. 0x63df4a18,
  24650. 0x6dd64713,
  24651. 0xd731dcca,
  24652. 0xd938d1c1,
  24653. 0xcb23c6dc,
  24654. 0xc52acbd7,
  24655. 0xef15e8e6,
  24656. 0xe11ce5ed,
  24657. 0xf307f2f0,
  24658. 0xfd0efffb,
  24659. 0xa779b492,
  24660. 0xa970b999,
  24661. 0xbb6bae84,
  24662. 0xb562a38f,
  24663. 0x9f5d80be,
  24664. 0x91548db5,
  24665. 0x834f9aa8,
  24666. 0x8d4697a3
  24667. ]);
  24668. function expandKey256(cipherKey) {
  24669. var b = 240, result = new Uint8Array(b);
  24670. var r = 1;
  24671. result.set(cipherKey);
  24672. for (var j = 32, i = 1; j < b; ++i) {
  24673. if (j % 32 === 16) {
  24674. t1 = s[t1];
  24675. t2 = s[t2];
  24676. t3 = s[t3];
  24677. t4 = s[t4];
  24678. } else if (j % 32 === 0) {
  24679. var t1 = result[j - 3], t2 = result[j - 2], t3 = result[j - 1], t4 = result[j - 4];
  24680. t1 = s[t1];
  24681. t2 = s[t2];
  24682. t3 = s[t3];
  24683. t4 = s[t4];
  24684. t1 = t1 ^ r;
  24685. if ((r <<= 1) >= 256) {
  24686. r = (r ^ 0x1b) & 0xFF;
  24687. }
  24688. }
  24689. for (var n = 0; n < 4; ++n) {
  24690. result[j] = t1 ^= result[j - 32];
  24691. j++;
  24692. result[j] = t2 ^= result[j - 32];
  24693. j++;
  24694. result[j] = t3 ^= result[j - 32];
  24695. j++;
  24696. result[j] = t4 ^= result[j - 32];
  24697. j++;
  24698. }
  24699. }
  24700. return result;
  24701. }
  24702. function decrypt256(input, key) {
  24703. var state = new Uint8Array(16);
  24704. state.set(input);
  24705. var i, j, k;
  24706. var t, u, v;
  24707. for (j = 0, k = 224; j < 16; ++j, ++k) {
  24708. state[j] ^= key[k];
  24709. }
  24710. for (i = 13; i >= 1; --i) {
  24711. t = state[13];
  24712. state[13] = state[9];
  24713. state[9] = state[5];
  24714. state[5] = state[1];
  24715. state[1] = t;
  24716. t = state[14];
  24717. u = state[10];
  24718. state[14] = state[6];
  24719. state[10] = state[2];
  24720. state[6] = t;
  24721. state[2] = u;
  24722. t = state[15];
  24723. u = state[11];
  24724. v = state[7];
  24725. state[15] = state[3];
  24726. state[11] = t;
  24727. state[7] = u;
  24728. state[3] = v;
  24729. for (j = 0; j < 16; ++j) {
  24730. state[j] = inv_s[state[j]];
  24731. }
  24732. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  24733. state[j] ^= key[k];
  24734. }
  24735. for (j = 0; j < 16; j += 4) {
  24736. var s0 = mix[state[j]], s1 = mix[state[j + 1]], s2 = mix[state[j + 2]], s3 = mix[state[j + 3]];
  24737. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  24738. state[j] = t >>> 24 & 0xFF;
  24739. state[j + 1] = t >> 16 & 0xFF;
  24740. state[j + 2] = t >> 8 & 0xFF;
  24741. state[j + 3] = t & 0xFF;
  24742. }
  24743. }
  24744. t = state[13];
  24745. state[13] = state[9];
  24746. state[9] = state[5];
  24747. state[5] = state[1];
  24748. state[1] = t;
  24749. t = state[14];
  24750. u = state[10];
  24751. state[14] = state[6];
  24752. state[10] = state[2];
  24753. state[6] = t;
  24754. state[2] = u;
  24755. t = state[15];
  24756. u = state[11];
  24757. v = state[7];
  24758. state[15] = state[3];
  24759. state[11] = t;
  24760. state[7] = u;
  24761. state[3] = v;
  24762. for (j = 0; j < 16; ++j) {
  24763. state[j] = inv_s[state[j]];
  24764. state[j] ^= key[j];
  24765. }
  24766. return state;
  24767. }
  24768. function encrypt256(input, key) {
  24769. var t, u, v, k;
  24770. var state = new Uint8Array(16);
  24771. state.set(input);
  24772. for (j = 0; j < 16; ++j) {
  24773. state[j] ^= key[j];
  24774. }
  24775. for (i = 1; i < 14; i++) {
  24776. for (j = 0; j < 16; ++j) {
  24777. state[j] = s[state[j]];
  24778. }
  24779. v = state[1];
  24780. state[1] = state[5];
  24781. state[5] = state[9];
  24782. state[9] = state[13];
  24783. state[13] = v;
  24784. v = state[2];
  24785. u = state[6];
  24786. state[2] = state[10];
  24787. state[6] = state[14];
  24788. state[10] = v;
  24789. state[14] = u;
  24790. v = state[3];
  24791. u = state[7];
  24792. t = state[11];
  24793. state[3] = state[15];
  24794. state[7] = v;
  24795. state[11] = u;
  24796. state[15] = t;
  24797. for (var j = 0; j < 16; j += 4) {
  24798. var s0 = state[j + 0], s1 = state[j + 1];
  24799. var s2 = state[j + 2], s3 = state[j + 3];
  24800. t = s0 ^ s1 ^ s2 ^ s3;
  24801. state[j + 0] ^= t ^ mixCol[s0 ^ s1];
  24802. state[j + 1] ^= t ^ mixCol[s1 ^ s2];
  24803. state[j + 2] ^= t ^ mixCol[s2 ^ s3];
  24804. state[j + 3] ^= t ^ mixCol[s3 ^ s0];
  24805. }
  24806. for (j = 0, k = i * 16; j < 16; ++j, ++k) {
  24807. state[j] ^= key[k];
  24808. }
  24809. }
  24810. for (j = 0; j < 16; ++j) {
  24811. state[j] = s[state[j]];
  24812. }
  24813. v = state[1];
  24814. state[1] = state[5];
  24815. state[5] = state[9];
  24816. state[9] = state[13];
  24817. state[13] = v;
  24818. v = state[2];
  24819. u = state[6];
  24820. state[2] = state[10];
  24821. state[6] = state[14];
  24822. state[10] = v;
  24823. state[14] = u;
  24824. v = state[3];
  24825. u = state[7];
  24826. t = state[11];
  24827. state[3] = state[15];
  24828. state[7] = v;
  24829. state[11] = u;
  24830. state[15] = t;
  24831. for (j = 0, k = 224; j < 16; ++j, ++k) {
  24832. state[j] ^= key[k];
  24833. }
  24834. return state;
  24835. }
  24836. function AES256Cipher(key) {
  24837. this.key = expandKey256(key);
  24838. this.buffer = new Uint8Array(16);
  24839. this.bufferPosition = 0;
  24840. }
  24841. function decryptBlock2(data, finalize) {
  24842. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [], iv = this.iv;
  24843. for (i = 0; i < sourceLength; ++i) {
  24844. buffer[bufferLength] = data[i];
  24845. ++bufferLength;
  24846. if (bufferLength < 16) {
  24847. continue;
  24848. }
  24849. var plain = decrypt256(buffer, this.key);
  24850. for (j = 0; j < 16; ++j) {
  24851. plain[j] ^= iv[j];
  24852. }
  24853. iv = buffer;
  24854. result.push(plain);
  24855. buffer = new Uint8Array(16);
  24856. bufferLength = 0;
  24857. }
  24858. this.buffer = buffer;
  24859. this.bufferLength = bufferLength;
  24860. this.iv = iv;
  24861. if (result.length === 0) {
  24862. return new Uint8Array([]);
  24863. }
  24864. var outputLength = 16 * result.length;
  24865. if (finalize) {
  24866. var lastBlock = result[result.length - 1];
  24867. var psLen = lastBlock[15];
  24868. if (psLen <= 16) {
  24869. for (i = 15, ii = 16 - psLen; i >= ii; --i) {
  24870. if (lastBlock[i] !== psLen) {
  24871. psLen = 0;
  24872. break;
  24873. }
  24874. }
  24875. outputLength -= psLen;
  24876. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  24877. }
  24878. }
  24879. var output = new Uint8Array(outputLength);
  24880. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  24881. output.set(result[i], j);
  24882. }
  24883. return output;
  24884. }
  24885. AES256Cipher.prototype = {
  24886. decryptBlock: function AES256Cipher_decryptBlock(data, finalize, iv) {
  24887. var i, sourceLength = data.length;
  24888. var buffer = this.buffer, bufferLength = this.bufferPosition;
  24889. if (iv) {
  24890. this.iv = iv;
  24891. } else {
  24892. for (i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  24893. buffer[bufferLength] = data[i];
  24894. }
  24895. if (bufferLength < 16) {
  24896. this.bufferLength = bufferLength;
  24897. return new Uint8Array([]);
  24898. }
  24899. this.iv = buffer;
  24900. data = data.subarray(16);
  24901. }
  24902. this.buffer = new Uint8Array(16);
  24903. this.bufferLength = 0;
  24904. this.decryptBlock = decryptBlock2;
  24905. return this.decryptBlock(data, finalize);
  24906. },
  24907. encrypt: function AES256Cipher_encrypt(data, iv) {
  24908. var i, j, ii, sourceLength = data.length, buffer = this.buffer, bufferLength = this.bufferPosition, result = [];
  24909. if (!iv) {
  24910. iv = new Uint8Array(16);
  24911. }
  24912. for (i = 0; i < sourceLength; ++i) {
  24913. buffer[bufferLength] = data[i];
  24914. ++bufferLength;
  24915. if (bufferLength < 16) {
  24916. continue;
  24917. }
  24918. for (j = 0; j < 16; ++j) {
  24919. buffer[j] ^= iv[j];
  24920. }
  24921. var cipher = encrypt256(buffer, this.key);
  24922. this.iv = cipher;
  24923. result.push(cipher);
  24924. buffer = new Uint8Array(16);
  24925. bufferLength = 0;
  24926. }
  24927. this.buffer = buffer;
  24928. this.bufferLength = bufferLength;
  24929. this.iv = iv;
  24930. if (result.length === 0) {
  24931. return new Uint8Array([]);
  24932. }
  24933. var outputLength = 16 * result.length;
  24934. var output = new Uint8Array(outputLength);
  24935. for (i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  24936. output.set(result[i], j);
  24937. }
  24938. return output;
  24939. }
  24940. };
  24941. return AES256Cipher;
  24942. }();
  24943. var PDF17 = function PDF17Closure() {
  24944. function compareByteArrays(array1, array2) {
  24945. if (array1.length !== array2.length) {
  24946. return false;
  24947. }
  24948. for (var i = 0; i < array1.length; i++) {
  24949. if (array1[i] !== array2[i]) {
  24950. return false;
  24951. }
  24952. }
  24953. return true;
  24954. }
  24955. function PDF17() {
  24956. }
  24957. PDF17.prototype = {
  24958. checkOwnerPassword: function PDF17_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  24959. var hashData = new Uint8Array(password.length + 56);
  24960. hashData.set(password, 0);
  24961. hashData.set(ownerValidationSalt, password.length);
  24962. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  24963. var result = calculateSHA256(hashData, 0, hashData.length);
  24964. return compareByteArrays(result, ownerPassword);
  24965. },
  24966. checkUserPassword: function PDF17_checkUserPassword(password, userValidationSalt, userPassword) {
  24967. var hashData = new Uint8Array(password.length + 8);
  24968. hashData.set(password, 0);
  24969. hashData.set(userValidationSalt, password.length);
  24970. var result = calculateSHA256(hashData, 0, hashData.length);
  24971. return compareByteArrays(result, userPassword);
  24972. },
  24973. getOwnerKey: function PDF17_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  24974. var hashData = new Uint8Array(password.length + 56);
  24975. hashData.set(password, 0);
  24976. hashData.set(ownerKeySalt, password.length);
  24977. hashData.set(userBytes, password.length + ownerKeySalt.length);
  24978. var key = calculateSHA256(hashData, 0, hashData.length);
  24979. var cipher = new AES256Cipher(key);
  24980. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  24981. },
  24982. getUserKey: function PDF17_getUserKey(password, userKeySalt, userEncryption) {
  24983. var hashData = new Uint8Array(password.length + 8);
  24984. hashData.set(password, 0);
  24985. hashData.set(userKeySalt, password.length);
  24986. var key = calculateSHA256(hashData, 0, hashData.length);
  24987. var cipher = new AES256Cipher(key);
  24988. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  24989. }
  24990. };
  24991. return PDF17;
  24992. }();
  24993. var PDF20 = function PDF20Closure() {
  24994. function concatArrays(array1, array2) {
  24995. var t = new Uint8Array(array1.length + array2.length);
  24996. t.set(array1, 0);
  24997. t.set(array2, array1.length);
  24998. return t;
  24999. }
  25000. function calculatePDF20Hash(password, input, userBytes) {
  25001. var k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  25002. var e = [0];
  25003. var i = 0;
  25004. while (i < 64 || e[e.length - 1] > i - 32) {
  25005. var arrayLength = password.length + k.length + userBytes.length;
  25006. var k1 = new Uint8Array(arrayLength * 64);
  25007. var array = concatArrays(password, k);
  25008. array = concatArrays(array, userBytes);
  25009. for (var j = 0, pos = 0; j < 64; j++, pos += arrayLength) {
  25010. k1.set(array, pos);
  25011. }
  25012. var cipher = new AES128Cipher(k.subarray(0, 16));
  25013. e = cipher.encrypt(k1, k.subarray(16, 32));
  25014. var remainder = 0;
  25015. for (var z = 0; z < 16; z++) {
  25016. remainder *= 256 % 3;
  25017. remainder %= 3;
  25018. remainder += (e[z] >>> 0) % 3;
  25019. remainder %= 3;
  25020. }
  25021. if (remainder === 0) {
  25022. k = calculateSHA256(e, 0, e.length);
  25023. } else if (remainder === 1) {
  25024. k = calculateSHA384(e, 0, e.length);
  25025. } else if (remainder === 2) {
  25026. k = calculateSHA512(e, 0, e.length);
  25027. }
  25028. i++;
  25029. }
  25030. return k.subarray(0, 32);
  25031. }
  25032. function PDF20() {
  25033. }
  25034. function compareByteArrays(array1, array2) {
  25035. if (array1.length !== array2.length) {
  25036. return false;
  25037. }
  25038. for (var i = 0; i < array1.length; i++) {
  25039. if (array1[i] !== array2[i]) {
  25040. return false;
  25041. }
  25042. }
  25043. return true;
  25044. }
  25045. PDF20.prototype = {
  25046. hash: function PDF20_hash(password, concatBytes, userBytes) {
  25047. return calculatePDF20Hash(password, concatBytes, userBytes);
  25048. },
  25049. checkOwnerPassword: function PDF20_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  25050. var hashData = new Uint8Array(password.length + 56);
  25051. hashData.set(password, 0);
  25052. hashData.set(ownerValidationSalt, password.length);
  25053. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  25054. var result = calculatePDF20Hash(password, hashData, userBytes);
  25055. return compareByteArrays(result, ownerPassword);
  25056. },
  25057. checkUserPassword: function PDF20_checkUserPassword(password, userValidationSalt, userPassword) {
  25058. var hashData = new Uint8Array(password.length + 8);
  25059. hashData.set(password, 0);
  25060. hashData.set(userValidationSalt, password.length);
  25061. var result = calculatePDF20Hash(password, hashData, []);
  25062. return compareByteArrays(result, userPassword);
  25063. },
  25064. getOwnerKey: function PDF20_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  25065. var hashData = new Uint8Array(password.length + 56);
  25066. hashData.set(password, 0);
  25067. hashData.set(ownerKeySalt, password.length);
  25068. hashData.set(userBytes, password.length + ownerKeySalt.length);
  25069. var key = calculatePDF20Hash(password, hashData, userBytes);
  25070. var cipher = new AES256Cipher(key);
  25071. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  25072. },
  25073. getUserKey: function PDF20_getUserKey(password, userKeySalt, userEncryption) {
  25074. var hashData = new Uint8Array(password.length + 8);
  25075. hashData.set(password, 0);
  25076. hashData.set(userKeySalt, password.length);
  25077. var key = calculatePDF20Hash(password, hashData, []);
  25078. var cipher = new AES256Cipher(key);
  25079. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  25080. }
  25081. };
  25082. return PDF20;
  25083. }();
  25084. var CipherTransform = function CipherTransformClosure() {
  25085. function CipherTransform(stringCipherConstructor, streamCipherConstructor) {
  25086. this.StringCipherConstructor = stringCipherConstructor;
  25087. this.StreamCipherConstructor = streamCipherConstructor;
  25088. }
  25089. CipherTransform.prototype = {
  25090. createStream: function CipherTransform_createStream(stream, length) {
  25091. var cipher = new this.StreamCipherConstructor();
  25092. return new DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  25093. return cipher.decryptBlock(data, finalize);
  25094. });
  25095. },
  25096. decryptString: function CipherTransform_decryptString(s) {
  25097. var cipher = new this.StringCipherConstructor();
  25098. var data = stringToBytes(s);
  25099. data = cipher.decryptBlock(data, true);
  25100. return bytesToString(data);
  25101. }
  25102. };
  25103. return CipherTransform;
  25104. }();
  25105. var CipherTransformFactory = function CipherTransformFactoryClosure() {
  25106. var defaultPasswordBytes = new Uint8Array([
  25107. 0x28,
  25108. 0xBF,
  25109. 0x4E,
  25110. 0x5E,
  25111. 0x4E,
  25112. 0x75,
  25113. 0x8A,
  25114. 0x41,
  25115. 0x64,
  25116. 0x00,
  25117. 0x4E,
  25118. 0x56,
  25119. 0xFF,
  25120. 0xFA,
  25121. 0x01,
  25122. 0x08,
  25123. 0x2E,
  25124. 0x2E,
  25125. 0x00,
  25126. 0xB6,
  25127. 0xD0,
  25128. 0x68,
  25129. 0x3E,
  25130. 0x80,
  25131. 0x2F,
  25132. 0x0C,
  25133. 0xA9,
  25134. 0xFE,
  25135. 0x64,
  25136. 0x53,
  25137. 0x69,
  25138. 0x7A
  25139. ]);
  25140. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  25141. if (password) {
  25142. var passwordLength = Math.min(127, password.length);
  25143. password = password.subarray(0, passwordLength);
  25144. } else {
  25145. password = [];
  25146. }
  25147. var pdfAlgorithm;
  25148. if (revision === 6) {
  25149. pdfAlgorithm = new PDF20();
  25150. } else {
  25151. pdfAlgorithm = new PDF17();
  25152. }
  25153. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  25154. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  25155. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  25156. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  25157. }
  25158. return null;
  25159. }
  25160. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  25161. var hashDataSize = 40 + ownerPassword.length + fileId.length;
  25162. var hashData = new Uint8Array(hashDataSize), i = 0, j, n;
  25163. if (password) {
  25164. n = Math.min(32, password.length);
  25165. for (; i < n; ++i) {
  25166. hashData[i] = password[i];
  25167. }
  25168. }
  25169. j = 0;
  25170. while (i < 32) {
  25171. hashData[i++] = defaultPasswordBytes[j++];
  25172. }
  25173. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  25174. hashData[i++] = ownerPassword[j];
  25175. }
  25176. hashData[i++] = flags & 0xFF;
  25177. hashData[i++] = flags >> 8 & 0xFF;
  25178. hashData[i++] = flags >> 16 & 0xFF;
  25179. hashData[i++] = flags >>> 24 & 0xFF;
  25180. for (j = 0, n = fileId.length; j < n; ++j) {
  25181. hashData[i++] = fileId[j];
  25182. }
  25183. if (revision >= 4 && !encryptMetadata) {
  25184. hashData[i++] = 0xFF;
  25185. hashData[i++] = 0xFF;
  25186. hashData[i++] = 0xFF;
  25187. hashData[i++] = 0xFF;
  25188. }
  25189. var hash = calculateMD5(hashData, 0, i);
  25190. var keyLengthInBytes = keyLength >> 3;
  25191. if (revision >= 3) {
  25192. for (j = 0; j < 50; ++j) {
  25193. hash = calculateMD5(hash, 0, keyLengthInBytes);
  25194. }
  25195. }
  25196. var encryptionKey = hash.subarray(0, keyLengthInBytes);
  25197. var cipher, checkData;
  25198. if (revision >= 3) {
  25199. for (i = 0; i < 32; ++i) {
  25200. hashData[i] = defaultPasswordBytes[i];
  25201. }
  25202. for (j = 0, n = fileId.length; j < n; ++j) {
  25203. hashData[i++] = fileId[j];
  25204. }
  25205. cipher = new ARCFourCipher(encryptionKey);
  25206. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  25207. n = encryptionKey.length;
  25208. var derivedKey = new Uint8Array(n), k;
  25209. for (j = 1; j <= 19; ++j) {
  25210. for (k = 0; k < n; ++k) {
  25211. derivedKey[k] = encryptionKey[k] ^ j;
  25212. }
  25213. cipher = new ARCFourCipher(derivedKey);
  25214. checkData = cipher.encryptBlock(checkData);
  25215. }
  25216. for (j = 0, n = checkData.length; j < n; ++j) {
  25217. if (userPassword[j] !== checkData[j]) {
  25218. return null;
  25219. }
  25220. }
  25221. } else {
  25222. cipher = new ARCFourCipher(encryptionKey);
  25223. checkData = cipher.encryptBlock(defaultPasswordBytes);
  25224. for (j = 0, n = checkData.length; j < n; ++j) {
  25225. if (userPassword[j] !== checkData[j]) {
  25226. return null;
  25227. }
  25228. }
  25229. }
  25230. return encryptionKey;
  25231. }
  25232. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  25233. var hashData = new Uint8Array(32), i = 0, j, n;
  25234. n = Math.min(32, password.length);
  25235. for (; i < n; ++i) {
  25236. hashData[i] = password[i];
  25237. }
  25238. j = 0;
  25239. while (i < 32) {
  25240. hashData[i++] = defaultPasswordBytes[j++];
  25241. }
  25242. var hash = calculateMD5(hashData, 0, i);
  25243. var keyLengthInBytes = keyLength >> 3;
  25244. if (revision >= 3) {
  25245. for (j = 0; j < 50; ++j) {
  25246. hash = calculateMD5(hash, 0, hash.length);
  25247. }
  25248. }
  25249. var cipher, userPassword;
  25250. if (revision >= 3) {
  25251. userPassword = ownerPassword;
  25252. var derivedKey = new Uint8Array(keyLengthInBytes), k;
  25253. for (j = 19; j >= 0; j--) {
  25254. for (k = 0; k < keyLengthInBytes; ++k) {
  25255. derivedKey[k] = hash[k] ^ j;
  25256. }
  25257. cipher = new ARCFourCipher(derivedKey);
  25258. userPassword = cipher.encryptBlock(userPassword);
  25259. }
  25260. } else {
  25261. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  25262. userPassword = cipher.encryptBlock(ownerPassword);
  25263. }
  25264. return userPassword;
  25265. }
  25266. var identityName = Name.get('Identity');
  25267. function CipherTransformFactory(dict, fileId, password) {
  25268. var filter = dict.get('Filter');
  25269. if (!isName(filter, 'Standard')) {
  25270. error('unknown encryption method');
  25271. }
  25272. this.dict = dict;
  25273. var algorithm = dict.get('V');
  25274. if (!isInt(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  25275. error('unsupported encryption algorithm');
  25276. }
  25277. this.algorithm = algorithm;
  25278. var keyLength = dict.get('Length');
  25279. if (!keyLength) {
  25280. if (algorithm <= 3) {
  25281. keyLength = 40;
  25282. } else {
  25283. var cfDict = dict.get('CF');
  25284. var streamCryptoName = dict.get('StmF');
  25285. if (isDict(cfDict) && isName(streamCryptoName)) {
  25286. cfDict.suppressEncryption = true;
  25287. var handlerDict = cfDict.get(streamCryptoName.name);
  25288. keyLength = handlerDict && handlerDict.get('Length') || 128;
  25289. if (keyLength < 40) {
  25290. keyLength <<= 3;
  25291. }
  25292. }
  25293. }
  25294. }
  25295. if (!isInt(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  25296. error('invalid key length');
  25297. }
  25298. var ownerPassword = stringToBytes(dict.get('O')).subarray(0, 32);
  25299. var userPassword = stringToBytes(dict.get('U')).subarray(0, 32);
  25300. var flags = dict.get('P');
  25301. var revision = dict.get('R');
  25302. var encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get('EncryptMetadata') !== false;
  25303. this.encryptMetadata = encryptMetadata;
  25304. var fileIdBytes = stringToBytes(fileId);
  25305. var passwordBytes;
  25306. if (password) {
  25307. if (revision === 6) {
  25308. try {
  25309. password = utf8StringToString(password);
  25310. } catch (ex) {
  25311. warn('CipherTransformFactory: ' + 'Unable to convert UTF8 encoded password.');
  25312. }
  25313. }
  25314. passwordBytes = stringToBytes(password);
  25315. }
  25316. var encryptionKey;
  25317. if (algorithm !== 5) {
  25318. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  25319. } else {
  25320. var ownerValidationSalt = stringToBytes(dict.get('O')).subarray(32, 40);
  25321. var ownerKeySalt = stringToBytes(dict.get('O')).subarray(40, 48);
  25322. var uBytes = stringToBytes(dict.get('U')).subarray(0, 48);
  25323. var userValidationSalt = stringToBytes(dict.get('U')).subarray(32, 40);
  25324. var userKeySalt = stringToBytes(dict.get('U')).subarray(40, 48);
  25325. var ownerEncryption = stringToBytes(dict.get('OE'));
  25326. var userEncryption = stringToBytes(dict.get('UE'));
  25327. var perms = stringToBytes(dict.get('Perms'));
  25328. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  25329. }
  25330. if (!encryptionKey && !password) {
  25331. throw new PasswordException('No password given', PasswordResponses.NEED_PASSWORD);
  25332. } else if (!encryptionKey && password) {
  25333. var decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  25334. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  25335. }
  25336. if (!encryptionKey) {
  25337. throw new PasswordException('Incorrect Password', PasswordResponses.INCORRECT_PASSWORD);
  25338. }
  25339. this.encryptionKey = encryptionKey;
  25340. if (algorithm >= 4) {
  25341. var cf = dict.get('CF');
  25342. if (isDict(cf)) {
  25343. cf.suppressEncryption = true;
  25344. }
  25345. this.cf = cf;
  25346. this.stmf = dict.get('StmF') || identityName;
  25347. this.strf = dict.get('StrF') || identityName;
  25348. this.eff = dict.get('EFF') || this.stmf;
  25349. }
  25350. }
  25351. function buildObjectKey(num, gen, encryptionKey, isAes) {
  25352. var key = new Uint8Array(encryptionKey.length + 9), i, n;
  25353. for (i = 0, n = encryptionKey.length; i < n; ++i) {
  25354. key[i] = encryptionKey[i];
  25355. }
  25356. key[i++] = num & 0xFF;
  25357. key[i++] = num >> 8 & 0xFF;
  25358. key[i++] = num >> 16 & 0xFF;
  25359. key[i++] = gen & 0xFF;
  25360. key[i++] = gen >> 8 & 0xFF;
  25361. if (isAes) {
  25362. key[i++] = 0x73;
  25363. key[i++] = 0x41;
  25364. key[i++] = 0x6C;
  25365. key[i++] = 0x54;
  25366. }
  25367. var hash = calculateMD5(key, 0, i);
  25368. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  25369. }
  25370. function buildCipherConstructor(cf, name, num, gen, key) {
  25371. assert(isName(name), 'Invalid crypt filter name.');
  25372. var cryptFilter = cf.get(name.name);
  25373. var cfm;
  25374. if (cryptFilter !== null && cryptFilter !== undefined) {
  25375. cfm = cryptFilter.get('CFM');
  25376. }
  25377. if (!cfm || cfm.name === 'None') {
  25378. return function cipherTransformFactoryBuildCipherConstructorNone() {
  25379. return new NullCipher();
  25380. };
  25381. }
  25382. if (cfm.name === 'V2') {
  25383. return function cipherTransformFactoryBuildCipherConstructorV2() {
  25384. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  25385. };
  25386. }
  25387. if (cfm.name === 'AESV2') {
  25388. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  25389. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  25390. };
  25391. }
  25392. if (cfm.name === 'AESV3') {
  25393. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  25394. return new AES256Cipher(key);
  25395. };
  25396. }
  25397. error('Unknown crypto method');
  25398. }
  25399. CipherTransformFactory.prototype = {
  25400. createCipherTransform: function CipherTransformFactory_createCipherTransform(num, gen) {
  25401. if (this.algorithm === 4 || this.algorithm === 5) {
  25402. return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey));
  25403. }
  25404. var key = buildObjectKey(num, gen, this.encryptionKey, false);
  25405. var cipherConstructor = function buildCipherCipherConstructor() {
  25406. return new ARCFourCipher(key);
  25407. };
  25408. return new CipherTransform(cipherConstructor, cipherConstructor);
  25409. }
  25410. };
  25411. return CipherTransformFactory;
  25412. }();
  25413. exports.AES128Cipher = AES128Cipher;
  25414. exports.AES256Cipher = AES256Cipher;
  25415. exports.ARCFourCipher = ARCFourCipher;
  25416. exports.CipherTransformFactory = CipherTransformFactory;
  25417. exports.PDF17 = PDF17;
  25418. exports.PDF20 = PDF20;
  25419. exports.calculateMD5 = calculateMD5;
  25420. exports.calculateSHA256 = calculateSHA256;
  25421. exports.calculateSHA384 = calculateSHA384;
  25422. exports.calculateSHA512 = calculateSHA512;
  25423. /***/ }),
  25424. /* 14 */
  25425. /***/ (function(module, exports, __w_pdfjs_require__) {
  25426. "use strict";
  25427. var sharedUtil = __w_pdfjs_require__(0);
  25428. var corePrimitives = __w_pdfjs_require__(1);
  25429. var coreStream = __w_pdfjs_require__(2);
  25430. var coreParser = __w_pdfjs_require__(5);
  25431. var coreImage = __w_pdfjs_require__(27);
  25432. var coreColorSpace = __w_pdfjs_require__(3);
  25433. var coreMurmurHash3 = __w_pdfjs_require__(31);
  25434. var coreFonts = __w_pdfjs_require__(26);
  25435. var coreFunction = __w_pdfjs_require__(6);
  25436. var corePattern = __w_pdfjs_require__(32);
  25437. var coreCMap = __w_pdfjs_require__(23);
  25438. var coreMetrics = __w_pdfjs_require__(30);
  25439. var coreBidi = __w_pdfjs_require__(21);
  25440. var coreEncodings = __w_pdfjs_require__(4);
  25441. var coreStandardFonts = __w_pdfjs_require__(17);
  25442. var coreUnicode = __w_pdfjs_require__(18);
  25443. var coreGlyphList = __w_pdfjs_require__(7);
  25444. var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
  25445. var IDENTITY_MATRIX = sharedUtil.IDENTITY_MATRIX;
  25446. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  25447. var ImageKind = sharedUtil.ImageKind;
  25448. var OPS = sharedUtil.OPS;
  25449. var TextRenderingMode = sharedUtil.TextRenderingMode;
  25450. var CMapCompressionType = sharedUtil.CMapCompressionType;
  25451. var Util = sharedUtil.Util;
  25452. var assert = sharedUtil.assert;
  25453. var createPromiseCapability = sharedUtil.createPromiseCapability;
  25454. var error = sharedUtil.error;
  25455. var info = sharedUtil.info;
  25456. var isArray = sharedUtil.isArray;
  25457. var isNum = sharedUtil.isNum;
  25458. var isString = sharedUtil.isString;
  25459. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  25460. var warn = sharedUtil.warn;
  25461. var Dict = corePrimitives.Dict;
  25462. var Name = corePrimitives.Name;
  25463. var isEOF = corePrimitives.isEOF;
  25464. var isCmd = corePrimitives.isCmd;
  25465. var isDict = corePrimitives.isDict;
  25466. var isName = corePrimitives.isName;
  25467. var isRef = corePrimitives.isRef;
  25468. var isStream = corePrimitives.isStream;
  25469. var DecodeStream = coreStream.DecodeStream;
  25470. var JpegStream = coreStream.JpegStream;
  25471. var Stream = coreStream.Stream;
  25472. var Lexer = coreParser.Lexer;
  25473. var Parser = coreParser.Parser;
  25474. var PDFImage = coreImage.PDFImage;
  25475. var ColorSpace = coreColorSpace.ColorSpace;
  25476. var MurmurHash3_64 = coreMurmurHash3.MurmurHash3_64;
  25477. var ErrorFont = coreFonts.ErrorFont;
  25478. var FontFlags = coreFonts.FontFlags;
  25479. var Font = coreFonts.Font;
  25480. var IdentityToUnicodeMap = coreFonts.IdentityToUnicodeMap;
  25481. var ToUnicodeMap = coreFonts.ToUnicodeMap;
  25482. var getFontType = coreFonts.getFontType;
  25483. var isPDFFunction = coreFunction.isPDFFunction;
  25484. var PDFFunction = coreFunction.PDFFunction;
  25485. var Pattern = corePattern.Pattern;
  25486. var getTilingPatternIR = corePattern.getTilingPatternIR;
  25487. var CMapFactory = coreCMap.CMapFactory;
  25488. var IdentityCMap = coreCMap.IdentityCMap;
  25489. var getMetrics = coreMetrics.getMetrics;
  25490. var bidi = coreBidi.bidi;
  25491. var WinAnsiEncoding = coreEncodings.WinAnsiEncoding;
  25492. var StandardEncoding = coreEncodings.StandardEncoding;
  25493. var MacRomanEncoding = coreEncodings.MacRomanEncoding;
  25494. var SymbolSetEncoding = coreEncodings.SymbolSetEncoding;
  25495. var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding;
  25496. var getEncoding = coreEncodings.getEncoding;
  25497. var getStdFontMap = coreStandardFonts.getStdFontMap;
  25498. var getSerifFonts = coreStandardFonts.getSerifFonts;
  25499. var getSymbolsFonts = coreStandardFonts.getSymbolsFonts;
  25500. var getNormalizedUnicodes = coreUnicode.getNormalizedUnicodes;
  25501. var reverseIfRtl = coreUnicode.reverseIfRtl;
  25502. var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph;
  25503. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  25504. var PartialEvaluator = function PartialEvaluatorClosure() {
  25505. var DefaultPartialEvaluatorOptions = {
  25506. forceDataSchema: false,
  25507. maxImageSize: -1,
  25508. disableFontFace: false,
  25509. disableNativeImageDecoder: false
  25510. };
  25511. function NativeImageDecoder(xref, resources, handler, forceDataSchema) {
  25512. this.xref = xref;
  25513. this.resources = resources;
  25514. this.handler = handler;
  25515. this.forceDataSchema = forceDataSchema;
  25516. }
  25517. NativeImageDecoder.prototype = {
  25518. canDecode: function (image) {
  25519. return image instanceof JpegStream && NativeImageDecoder.isDecodable(image, this.xref, this.resources);
  25520. },
  25521. decode: function (image) {
  25522. var dict = image.dict;
  25523. var colorSpace = dict.get('ColorSpace', 'CS');
  25524. colorSpace = ColorSpace.parse(colorSpace, this.xref, this.resources);
  25525. var numComps = colorSpace.numComps;
  25526. var decodePromise = this.handler.sendWithPromise('JpegDecode', [
  25527. image.getIR(this.forceDataSchema),
  25528. numComps
  25529. ]);
  25530. return decodePromise.then(function (message) {
  25531. var data = message.data;
  25532. return new Stream(data, 0, data.length, image.dict);
  25533. });
  25534. }
  25535. };
  25536. NativeImageDecoder.isSupported = function NativeImageDecoder_isSupported(image, xref, res) {
  25537. var dict = image.dict;
  25538. if (dict.has('DecodeParms') || dict.has('DP')) {
  25539. return false;
  25540. }
  25541. var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res);
  25542. return (cs.name === 'DeviceGray' || cs.name === 'DeviceRGB') && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
  25543. };
  25544. NativeImageDecoder.isDecodable = function NativeImageDecoder_isDecodable(image, xref, res) {
  25545. var dict = image.dict;
  25546. if (dict.has('DecodeParms') || dict.has('DP')) {
  25547. return false;
  25548. }
  25549. var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res);
  25550. return (cs.numComps === 1 || cs.numComps === 3) && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
  25551. };
  25552. function PartialEvaluator(pdfManager, xref, handler, pageIndex, idFactory, fontCache, builtInCMapCache, options) {
  25553. this.pdfManager = pdfManager;
  25554. this.xref = xref;
  25555. this.handler = handler;
  25556. this.pageIndex = pageIndex;
  25557. this.idFactory = idFactory;
  25558. this.fontCache = fontCache;
  25559. this.builtInCMapCache = builtInCMapCache;
  25560. this.options = options || DefaultPartialEvaluatorOptions;
  25561. this.fetchBuiltInCMap = function (name) {
  25562. var cachedCMap = builtInCMapCache[name];
  25563. if (cachedCMap) {
  25564. return Promise.resolve(cachedCMap);
  25565. }
  25566. return handler.sendWithPromise('FetchBuiltInCMap', { name: name }).then(function (data) {
  25567. if (data.compressionType !== CMapCompressionType.NONE) {
  25568. builtInCMapCache[name] = data;
  25569. }
  25570. return data;
  25571. });
  25572. };
  25573. }
  25574. var TIME_SLOT_DURATION_MS = 20;
  25575. var CHECK_TIME_EVERY = 100;
  25576. function TimeSlotManager() {
  25577. this.reset();
  25578. }
  25579. TimeSlotManager.prototype = {
  25580. check: function TimeSlotManager_check() {
  25581. if (++this.checked < CHECK_TIME_EVERY) {
  25582. return false;
  25583. }
  25584. this.checked = 0;
  25585. return this.endTime <= Date.now();
  25586. },
  25587. reset: function TimeSlotManager_reset() {
  25588. this.endTime = Date.now() + TIME_SLOT_DURATION_MS;
  25589. this.checked = 0;
  25590. }
  25591. };
  25592. var deferred = Promise.resolve();
  25593. var TILING_PATTERN = 1, SHADING_PATTERN = 2;
  25594. PartialEvaluator.prototype = {
  25595. hasBlendModes: function PartialEvaluator_hasBlendModes(resources) {
  25596. if (!isDict(resources)) {
  25597. return false;
  25598. }
  25599. var processed = Object.create(null);
  25600. if (resources.objId) {
  25601. processed[resources.objId] = true;
  25602. }
  25603. var nodes = [resources], xref = this.xref;
  25604. while (nodes.length) {
  25605. var key, i, ii;
  25606. var node = nodes.shift();
  25607. var graphicStates = node.get('ExtGState');
  25608. if (isDict(graphicStates)) {
  25609. var graphicStatesKeys = graphicStates.getKeys();
  25610. for (i = 0, ii = graphicStatesKeys.length; i < ii; i++) {
  25611. key = graphicStatesKeys[i];
  25612. var graphicState = graphicStates.get(key);
  25613. var bm = graphicState.get('BM');
  25614. if (isName(bm) && bm.name !== 'Normal') {
  25615. return true;
  25616. }
  25617. }
  25618. }
  25619. var xObjects = node.get('XObject');
  25620. if (!isDict(xObjects)) {
  25621. continue;
  25622. }
  25623. var xObjectsKeys = xObjects.getKeys();
  25624. for (i = 0, ii = xObjectsKeys.length; i < ii; i++) {
  25625. key = xObjectsKeys[i];
  25626. var xObject = xObjects.getRaw(key);
  25627. if (isRef(xObject)) {
  25628. if (processed[xObject.toString()]) {
  25629. continue;
  25630. }
  25631. xObject = xref.fetch(xObject);
  25632. }
  25633. if (!isStream(xObject)) {
  25634. continue;
  25635. }
  25636. if (xObject.dict.objId) {
  25637. if (processed[xObject.dict.objId]) {
  25638. continue;
  25639. }
  25640. processed[xObject.dict.objId] = true;
  25641. }
  25642. var xResources = xObject.dict.get('Resources');
  25643. if (isDict(xResources) && (!xResources.objId || !processed[xResources.objId])) {
  25644. nodes.push(xResources);
  25645. if (xResources.objId) {
  25646. processed[xResources.objId] = true;
  25647. }
  25648. }
  25649. }
  25650. }
  25651. return false;
  25652. },
  25653. buildFormXObject: function PartialEvaluator_buildFormXObject(resources, xobj, smask, operatorList, task, initialState) {
  25654. var matrix = xobj.dict.getArray('Matrix');
  25655. var bbox = xobj.dict.getArray('BBox');
  25656. var group = xobj.dict.get('Group');
  25657. if (group) {
  25658. var groupOptions = {
  25659. matrix: matrix,
  25660. bbox: bbox,
  25661. smask: smask,
  25662. isolated: false,
  25663. knockout: false
  25664. };
  25665. var groupSubtype = group.get('S');
  25666. var colorSpace;
  25667. if (isName(groupSubtype, 'Transparency')) {
  25668. groupOptions.isolated = group.get('I') || false;
  25669. groupOptions.knockout = group.get('K') || false;
  25670. colorSpace = group.has('CS') ? ColorSpace.parse(group.get('CS'), this.xref, resources) : null;
  25671. }
  25672. if (smask && smask.backdrop) {
  25673. colorSpace = colorSpace || ColorSpace.singletons.rgb;
  25674. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  25675. }
  25676. operatorList.addOp(OPS.beginGroup, [groupOptions]);
  25677. }
  25678. operatorList.addOp(OPS.paintFormXObjectBegin, [
  25679. matrix,
  25680. bbox
  25681. ]);
  25682. return this.getOperatorList(xobj, task, xobj.dict.get('Resources') || resources, operatorList, initialState).then(function () {
  25683. operatorList.addOp(OPS.paintFormXObjectEnd, []);
  25684. if (group) {
  25685. operatorList.addOp(OPS.endGroup, [groupOptions]);
  25686. }
  25687. });
  25688. },
  25689. buildPaintImageXObject: function PartialEvaluator_buildPaintImageXObject(resources, image, inline, operatorList, cacheKey, imageCache) {
  25690. var self = this;
  25691. var dict = image.dict;
  25692. var w = dict.get('Width', 'W');
  25693. var h = dict.get('Height', 'H');
  25694. if (!(w && isNum(w)) || !(h && isNum(h))) {
  25695. warn('Image dimensions are missing, or not numbers.');
  25696. return;
  25697. }
  25698. var maxImageSize = this.options.maxImageSize;
  25699. if (maxImageSize !== -1 && w * h > maxImageSize) {
  25700. warn('Image exceeded maximum allowed size and was removed.');
  25701. return;
  25702. }
  25703. var imageMask = dict.get('ImageMask', 'IM') || false;
  25704. var imgData, args;
  25705. if (imageMask) {
  25706. var width = dict.get('Width', 'W');
  25707. var height = dict.get('Height', 'H');
  25708. var bitStrideLength = width + 7 >> 3;
  25709. var imgArray = image.getBytes(bitStrideLength * height);
  25710. var decode = dict.getArray('Decode', 'D');
  25711. var inverseDecode = !!decode && decode[0] > 0;
  25712. imgData = PDFImage.createMask(imgArray, width, height, image instanceof DecodeStream, inverseDecode);
  25713. imgData.cached = true;
  25714. args = [imgData];
  25715. operatorList.addOp(OPS.paintImageMaskXObject, args);
  25716. if (cacheKey) {
  25717. imageCache[cacheKey] = {
  25718. fn: OPS.paintImageMaskXObject,
  25719. args: args
  25720. };
  25721. }
  25722. return;
  25723. }
  25724. var softMask = dict.get('SMask', 'SM') || false;
  25725. var mask = dict.get('Mask') || false;
  25726. var SMALL_IMAGE_DIMENSIONS = 200;
  25727. if (inline && !softMask && !mask && !(image instanceof JpegStream) && w + h < SMALL_IMAGE_DIMENSIONS) {
  25728. var imageObj = new PDFImage(this.xref, resources, image, inline, null, null);
  25729. imgData = imageObj.createImageData(true);
  25730. operatorList.addOp(OPS.paintInlineImageXObject, [imgData]);
  25731. return;
  25732. }
  25733. var useNativeImageDecoder = !this.options.disableNativeImageDecoder;
  25734. var objId = 'img_' + this.idFactory.createObjId();
  25735. operatorList.addDependency(objId);
  25736. args = [
  25737. objId,
  25738. w,
  25739. h
  25740. ];
  25741. if (useNativeImageDecoder && !softMask && !mask && image instanceof JpegStream && NativeImageDecoder.isSupported(image, this.xref, resources)) {
  25742. operatorList.addOp(OPS.paintJpegXObject, args);
  25743. this.handler.send('obj', [
  25744. objId,
  25745. this.pageIndex,
  25746. 'JpegStream',
  25747. image.getIR(this.options.forceDataSchema)
  25748. ]);
  25749. return;
  25750. }
  25751. var nativeImageDecoder = null;
  25752. if (useNativeImageDecoder && (image instanceof JpegStream || mask instanceof JpegStream || softMask instanceof JpegStream)) {
  25753. nativeImageDecoder = new NativeImageDecoder(self.xref, resources, self.handler, self.options.forceDataSchema);
  25754. }
  25755. PDFImage.buildImage(self.handler, self.xref, resources, image, inline, nativeImageDecoder).then(function (imageObj) {
  25756. var imgData = imageObj.createImageData(false);
  25757. self.handler.send('obj', [
  25758. objId,
  25759. self.pageIndex,
  25760. 'Image',
  25761. imgData
  25762. ], [imgData.data.buffer]);
  25763. }).then(undefined, function (reason) {
  25764. warn('Unable to decode image: ' + reason);
  25765. self.handler.send('obj', [
  25766. objId,
  25767. self.pageIndex,
  25768. 'Image',
  25769. null
  25770. ]);
  25771. });
  25772. operatorList.addOp(OPS.paintImageXObject, args);
  25773. if (cacheKey) {
  25774. imageCache[cacheKey] = {
  25775. fn: OPS.paintImageXObject,
  25776. args: args
  25777. };
  25778. }
  25779. },
  25780. handleSMask: function PartialEvaluator_handleSmask(smask, resources, operatorList, task, stateManager) {
  25781. var smaskContent = smask.get('G');
  25782. var smaskOptions = {
  25783. subtype: smask.get('S').name,
  25784. backdrop: smask.get('BC')
  25785. };
  25786. var transferObj = smask.get('TR');
  25787. if (isPDFFunction(transferObj)) {
  25788. var transferFn = PDFFunction.parse(this.xref, transferObj);
  25789. var transferMap = new Uint8Array(256);
  25790. var tmp = new Float32Array(1);
  25791. for (var i = 0; i < 256; i++) {
  25792. tmp[0] = i / 255;
  25793. transferFn(tmp, 0, tmp, 0);
  25794. transferMap[i] = tmp[0] * 255 | 0;
  25795. }
  25796. smaskOptions.transferMap = transferMap;
  25797. }
  25798. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone());
  25799. },
  25800. handleTilingType: function PartialEvaluator_handleTilingType(fn, args, resources, pattern, patternDict, operatorList, task) {
  25801. var tilingOpList = new OperatorList();
  25802. var resourcesArray = [
  25803. patternDict.get('Resources'),
  25804. resources
  25805. ];
  25806. var patternResources = Dict.merge(this.xref, resourcesArray);
  25807. return this.getOperatorList(pattern, task, patternResources, tilingOpList).then(function () {
  25808. operatorList.addDependencies(tilingOpList.dependencies);
  25809. operatorList.addOp(fn, getTilingPatternIR({
  25810. fnArray: tilingOpList.fnArray,
  25811. argsArray: tilingOpList.argsArray
  25812. }, patternDict, args));
  25813. });
  25814. },
  25815. handleSetFont: function PartialEvaluator_handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) {
  25816. var fontName;
  25817. if (fontArgs) {
  25818. fontArgs = fontArgs.slice();
  25819. fontName = fontArgs[0].name;
  25820. }
  25821. var self = this;
  25822. return this.loadFont(fontName, fontRef, this.xref, resources).then(function (translated) {
  25823. if (!translated.font.isType3Font) {
  25824. return translated;
  25825. }
  25826. return translated.loadType3Data(self, resources, operatorList, task).then(function () {
  25827. return translated;
  25828. }, function (reason) {
  25829. self.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font });
  25830. return new TranslatedFont('g_font_error', new ErrorFont('Type3 font load error: ' + reason), translated.font);
  25831. });
  25832. }).then(function (translated) {
  25833. state.font = translated.font;
  25834. translated.send(self.handler);
  25835. return translated.loadedName;
  25836. });
  25837. },
  25838. handleText: function PartialEvaluator_handleText(chars, state) {
  25839. var font = state.font;
  25840. var glyphs = font.charsToGlyphs(chars);
  25841. var isAddToPathSet = !!(state.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
  25842. if (font.data && (isAddToPathSet || this.options.disableFontFace)) {
  25843. var buildPath = function (fontChar) {
  25844. if (!font.renderer.hasBuiltPath(fontChar)) {
  25845. var path = font.renderer.getPathJs(fontChar);
  25846. this.handler.send('commonobj', [
  25847. font.loadedName + '_path_' + fontChar,
  25848. 'FontPath',
  25849. path
  25850. ]);
  25851. }
  25852. }.bind(this);
  25853. for (var i = 0, ii = glyphs.length; i < ii; i++) {
  25854. var glyph = glyphs[i];
  25855. buildPath(glyph.fontChar);
  25856. var accent = glyph.accent;
  25857. if (accent && accent.fontChar) {
  25858. buildPath(accent.fontChar);
  25859. }
  25860. }
  25861. }
  25862. return glyphs;
  25863. },
  25864. setGState: function PartialEvaluator_setGState(resources, gState, operatorList, task, xref, stateManager) {
  25865. var gStateObj = [];
  25866. var gStateKeys = gState.getKeys();
  25867. var self = this;
  25868. var promise = Promise.resolve();
  25869. for (var i = 0, ii = gStateKeys.length; i < ii; i++) {
  25870. var key = gStateKeys[i];
  25871. var value = gState.get(key);
  25872. switch (key) {
  25873. case 'Type':
  25874. break;
  25875. case 'LW':
  25876. case 'LC':
  25877. case 'LJ':
  25878. case 'ML':
  25879. case 'D':
  25880. case 'RI':
  25881. case 'FL':
  25882. case 'CA':
  25883. case 'ca':
  25884. gStateObj.push([
  25885. key,
  25886. value
  25887. ]);
  25888. break;
  25889. case 'Font':
  25890. promise = promise.then(function () {
  25891. return self.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  25892. operatorList.addDependency(loadedName);
  25893. gStateObj.push([
  25894. key,
  25895. [
  25896. loadedName,
  25897. value[1]
  25898. ]
  25899. ]);
  25900. });
  25901. });
  25902. break;
  25903. case 'BM':
  25904. gStateObj.push([
  25905. key,
  25906. value
  25907. ]);
  25908. break;
  25909. case 'SMask':
  25910. if (isName(value, 'None')) {
  25911. gStateObj.push([
  25912. key,
  25913. false
  25914. ]);
  25915. break;
  25916. }
  25917. if (isDict(value)) {
  25918. promise = promise.then(function (dict) {
  25919. return self.handleSMask(dict, resources, operatorList, task, stateManager);
  25920. }.bind(this, value));
  25921. gStateObj.push([
  25922. key,
  25923. true
  25924. ]);
  25925. } else {
  25926. warn('Unsupported SMask type');
  25927. }
  25928. break;
  25929. case 'OP':
  25930. case 'op':
  25931. case 'OPM':
  25932. case 'BG':
  25933. case 'BG2':
  25934. case 'UCR':
  25935. case 'UCR2':
  25936. case 'TR':
  25937. case 'TR2':
  25938. case 'HT':
  25939. case 'SM':
  25940. case 'SA':
  25941. case 'AIS':
  25942. case 'TK':
  25943. info('graphic state operator ' + key);
  25944. break;
  25945. default:
  25946. info('Unknown graphic state operator ' + key);
  25947. break;
  25948. }
  25949. }
  25950. return promise.then(function () {
  25951. if (gStateObj.length > 0) {
  25952. operatorList.addOp(OPS.setGState, [gStateObj]);
  25953. }
  25954. });
  25955. },
  25956. loadFont: function PartialEvaluator_loadFont(fontName, font, xref, resources) {
  25957. function errorFont() {
  25958. return Promise.resolve(new TranslatedFont('g_font_error', new ErrorFont('Font ' + fontName + ' is not available'), font));
  25959. }
  25960. var fontRef;
  25961. if (font) {
  25962. assert(isRef(font));
  25963. fontRef = font;
  25964. } else {
  25965. var fontRes = resources.get('Font');
  25966. if (fontRes) {
  25967. fontRef = fontRes.getRaw(fontName);
  25968. } else {
  25969. warn('fontRes not available');
  25970. return errorFont();
  25971. }
  25972. }
  25973. if (!fontRef) {
  25974. warn('fontRef not available');
  25975. return errorFont();
  25976. }
  25977. if (this.fontCache.has(fontRef)) {
  25978. return this.fontCache.get(fontRef);
  25979. }
  25980. font = xref.fetchIfRef(fontRef);
  25981. if (!isDict(font)) {
  25982. return errorFont();
  25983. }
  25984. if (font.translated) {
  25985. return font.translated;
  25986. }
  25987. var fontCapability = createPromiseCapability();
  25988. var preEvaluatedFont = this.preEvaluateFont(font, xref);
  25989. var descriptor = preEvaluatedFont.descriptor;
  25990. var fontRefIsRef = isRef(fontRef), fontID;
  25991. if (fontRefIsRef) {
  25992. fontID = fontRef.toString();
  25993. }
  25994. if (isDict(descriptor)) {
  25995. if (!descriptor.fontAliases) {
  25996. descriptor.fontAliases = Object.create(null);
  25997. }
  25998. var fontAliases = descriptor.fontAliases;
  25999. var hash = preEvaluatedFont.hash;
  26000. if (fontAliases[hash]) {
  26001. var aliasFontRef = fontAliases[hash].aliasRef;
  26002. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  26003. this.fontCache.putAlias(fontRef, aliasFontRef);
  26004. return this.fontCache.get(fontRef);
  26005. }
  26006. } else {
  26007. fontAliases[hash] = { fontID: Font.getFontID() };
  26008. }
  26009. if (fontRefIsRef) {
  26010. fontAliases[hash].aliasRef = fontRef;
  26011. }
  26012. fontID = fontAliases[hash].fontID;
  26013. }
  26014. if (fontRefIsRef) {
  26015. this.fontCache.put(fontRef, fontCapability.promise);
  26016. } else {
  26017. if (!fontID) {
  26018. fontID = this.idFactory.createObjId();
  26019. }
  26020. this.fontCache.put('id_' + fontID, fontCapability.promise);
  26021. }
  26022. assert(fontID, 'The "fontID" must be defined.');
  26023. font.loadedName = 'g_' + this.pdfManager.docId + '_f' + fontID;
  26024. font.translated = fontCapability.promise;
  26025. var translatedPromise;
  26026. try {
  26027. translatedPromise = this.translateFont(preEvaluatedFont, xref);
  26028. } catch (e) {
  26029. translatedPromise = Promise.reject(e);
  26030. }
  26031. var self = this;
  26032. translatedPromise.then(function (translatedFont) {
  26033. if (translatedFont.fontType !== undefined) {
  26034. var xrefFontStats = xref.stats.fontTypes;
  26035. xrefFontStats[translatedFont.fontType] = true;
  26036. }
  26037. fontCapability.resolve(new TranslatedFont(font.loadedName, translatedFont, font));
  26038. }, function (reason) {
  26039. self.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font });
  26040. try {
  26041. var descriptor = preEvaluatedFont.descriptor;
  26042. var fontFile3 = descriptor && descriptor.get('FontFile3');
  26043. var subtype = fontFile3 && fontFile3.get('Subtype');
  26044. var fontType = getFontType(preEvaluatedFont.type, subtype && subtype.name);
  26045. var xrefFontStats = xref.stats.fontTypes;
  26046. xrefFontStats[fontType] = true;
  26047. } catch (ex) {
  26048. }
  26049. fontCapability.resolve(new TranslatedFont(font.loadedName, new ErrorFont(reason instanceof Error ? reason.message : reason), font));
  26050. });
  26051. return fontCapability.promise;
  26052. },
  26053. buildPath: function PartialEvaluator_buildPath(operatorList, fn, args) {
  26054. var lastIndex = operatorList.length - 1;
  26055. if (!args) {
  26056. args = [];
  26057. }
  26058. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== OPS.constructPath) {
  26059. operatorList.addOp(OPS.constructPath, [
  26060. [fn],
  26061. args
  26062. ]);
  26063. } else {
  26064. var opArgs = operatorList.argsArray[lastIndex];
  26065. opArgs[0].push(fn);
  26066. Array.prototype.push.apply(opArgs[1], args);
  26067. }
  26068. },
  26069. handleColorN: function PartialEvaluator_handleColorN(operatorList, fn, args, cs, patterns, resources, task, xref) {
  26070. var patternName = args[args.length - 1];
  26071. var pattern;
  26072. if (isName(patternName) && (pattern = patterns.get(patternName.name))) {
  26073. var dict = isStream(pattern) ? pattern.dict : pattern;
  26074. var typeNum = dict.get('PatternType');
  26075. if (typeNum === TILING_PATTERN) {
  26076. var color = cs.base ? cs.base.getRgb(args, 0) : null;
  26077. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task);
  26078. } else if (typeNum === SHADING_PATTERN) {
  26079. var shading = dict.get('Shading');
  26080. var matrix = dict.getArray('Matrix');
  26081. pattern = Pattern.parseShading(shading, matrix, xref, resources, this.handler);
  26082. operatorList.addOp(fn, pattern.getIR());
  26083. return Promise.resolve();
  26084. }
  26085. return Promise.reject('Unknown PatternType: ' + typeNum);
  26086. }
  26087. operatorList.addOp(fn, args);
  26088. return Promise.resolve();
  26089. },
  26090. getOperatorList: function PartialEvaluator_getOperatorList(stream, task, resources, operatorList, initialState) {
  26091. var self = this;
  26092. var xref = this.xref;
  26093. var imageCache = Object.create(null);
  26094. assert(operatorList);
  26095. resources = resources || Dict.empty;
  26096. var xobjs = resources.get('XObject') || Dict.empty;
  26097. var patterns = resources.get('Pattern') || Dict.empty;
  26098. var stateManager = new StateManager(initialState || new EvalState());
  26099. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  26100. var timeSlotManager = new TimeSlotManager();
  26101. return new Promise(function promiseBody(resolve, reject) {
  26102. var next = function (promise) {
  26103. promise.then(function () {
  26104. try {
  26105. promiseBody(resolve, reject);
  26106. } catch (ex) {
  26107. reject(ex);
  26108. }
  26109. }, reject);
  26110. };
  26111. task.ensureNotTerminated();
  26112. timeSlotManager.reset();
  26113. var stop, operation = {}, i, ii, cs;
  26114. while (!(stop = timeSlotManager.check())) {
  26115. operation.args = null;
  26116. if (!preprocessor.read(operation)) {
  26117. break;
  26118. }
  26119. var args = operation.args;
  26120. var fn = operation.fn;
  26121. switch (fn | 0) {
  26122. case OPS.paintXObject:
  26123. if (args[0].code) {
  26124. break;
  26125. }
  26126. var name = args[0].name;
  26127. if (!name) {
  26128. warn('XObject must be referred to by name.');
  26129. continue;
  26130. }
  26131. if (imageCache[name] !== undefined) {
  26132. operatorList.addOp(imageCache[name].fn, imageCache[name].args);
  26133. args = null;
  26134. continue;
  26135. }
  26136. var xobj = xobjs.get(name);
  26137. if (xobj) {
  26138. assert(isStream(xobj), 'XObject should be a stream');
  26139. var type = xobj.dict.get('Subtype');
  26140. assert(isName(type), 'XObject should have a Name subtype');
  26141. if (type.name === 'Form') {
  26142. stateManager.save();
  26143. next(self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () {
  26144. stateManager.restore();
  26145. }));
  26146. return;
  26147. } else if (type.name === 'Image') {
  26148. self.buildPaintImageXObject(resources, xobj, false, operatorList, name, imageCache);
  26149. args = null;
  26150. continue;
  26151. } else if (type.name === 'PS') {
  26152. info('Ignored XObject subtype PS');
  26153. continue;
  26154. } else {
  26155. error('Unhandled XObject subtype ' + type.name);
  26156. }
  26157. }
  26158. break;
  26159. case OPS.setFont:
  26160. var fontSize = args[1];
  26161. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state).then(function (loadedName) {
  26162. operatorList.addDependency(loadedName);
  26163. operatorList.addOp(OPS.setFont, [
  26164. loadedName,
  26165. fontSize
  26166. ]);
  26167. }));
  26168. return;
  26169. case OPS.endInlineImage:
  26170. var cacheKey = args[0].cacheKey;
  26171. if (cacheKey) {
  26172. var cacheEntry = imageCache[cacheKey];
  26173. if (cacheEntry !== undefined) {
  26174. operatorList.addOp(cacheEntry.fn, cacheEntry.args);
  26175. args = null;
  26176. continue;
  26177. }
  26178. }
  26179. self.buildPaintImageXObject(resources, args[0], true, operatorList, cacheKey, imageCache);
  26180. args = null;
  26181. continue;
  26182. case OPS.showText:
  26183. args[0] = self.handleText(args[0], stateManager.state);
  26184. break;
  26185. case OPS.showSpacedText:
  26186. var arr = args[0];
  26187. var combinedGlyphs = [];
  26188. var arrLength = arr.length;
  26189. var state = stateManager.state;
  26190. for (i = 0; i < arrLength; ++i) {
  26191. var arrItem = arr[i];
  26192. if (isString(arrItem)) {
  26193. Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
  26194. } else if (isNum(arrItem)) {
  26195. combinedGlyphs.push(arrItem);
  26196. }
  26197. }
  26198. args[0] = combinedGlyphs;
  26199. fn = OPS.showText;
  26200. break;
  26201. case OPS.nextLineShowText:
  26202. operatorList.addOp(OPS.nextLine);
  26203. args[0] = self.handleText(args[0], stateManager.state);
  26204. fn = OPS.showText;
  26205. break;
  26206. case OPS.nextLineSetSpacingShowText:
  26207. operatorList.addOp(OPS.nextLine);
  26208. operatorList.addOp(OPS.setWordSpacing, [args.shift()]);
  26209. operatorList.addOp(OPS.setCharSpacing, [args.shift()]);
  26210. args[0] = self.handleText(args[0], stateManager.state);
  26211. fn = OPS.showText;
  26212. break;
  26213. case OPS.setTextRenderingMode:
  26214. stateManager.state.textRenderingMode = args[0];
  26215. break;
  26216. case OPS.setFillColorSpace:
  26217. stateManager.state.fillColorSpace = ColorSpace.parse(args[0], xref, resources);
  26218. continue;
  26219. case OPS.setStrokeColorSpace:
  26220. stateManager.state.strokeColorSpace = ColorSpace.parse(args[0], xref, resources);
  26221. continue;
  26222. case OPS.setFillColor:
  26223. cs = stateManager.state.fillColorSpace;
  26224. args = cs.getRgb(args, 0);
  26225. fn = OPS.setFillRGBColor;
  26226. break;
  26227. case OPS.setStrokeColor:
  26228. cs = stateManager.state.strokeColorSpace;
  26229. args = cs.getRgb(args, 0);
  26230. fn = OPS.setStrokeRGBColor;
  26231. break;
  26232. case OPS.setFillGray:
  26233. stateManager.state.fillColorSpace = ColorSpace.singletons.gray;
  26234. args = ColorSpace.singletons.gray.getRgb(args, 0);
  26235. fn = OPS.setFillRGBColor;
  26236. break;
  26237. case OPS.setStrokeGray:
  26238. stateManager.state.strokeColorSpace = ColorSpace.singletons.gray;
  26239. args = ColorSpace.singletons.gray.getRgb(args, 0);
  26240. fn = OPS.setStrokeRGBColor;
  26241. break;
  26242. case OPS.setFillCMYKColor:
  26243. stateManager.state.fillColorSpace = ColorSpace.singletons.cmyk;
  26244. args = ColorSpace.singletons.cmyk.getRgb(args, 0);
  26245. fn = OPS.setFillRGBColor;
  26246. break;
  26247. case OPS.setStrokeCMYKColor:
  26248. stateManager.state.strokeColorSpace = ColorSpace.singletons.cmyk;
  26249. args = ColorSpace.singletons.cmyk.getRgb(args, 0);
  26250. fn = OPS.setStrokeRGBColor;
  26251. break;
  26252. case OPS.setFillRGBColor:
  26253. stateManager.state.fillColorSpace = ColorSpace.singletons.rgb;
  26254. args = ColorSpace.singletons.rgb.getRgb(args, 0);
  26255. break;
  26256. case OPS.setStrokeRGBColor:
  26257. stateManager.state.strokeColorSpace = ColorSpace.singletons.rgb;
  26258. args = ColorSpace.singletons.rgb.getRgb(args, 0);
  26259. break;
  26260. case OPS.setFillColorN:
  26261. cs = stateManager.state.fillColorSpace;
  26262. if (cs.name === 'Pattern') {
  26263. next(self.handleColorN(operatorList, OPS.setFillColorN, args, cs, patterns, resources, task, xref));
  26264. return;
  26265. }
  26266. args = cs.getRgb(args, 0);
  26267. fn = OPS.setFillRGBColor;
  26268. break;
  26269. case OPS.setStrokeColorN:
  26270. cs = stateManager.state.strokeColorSpace;
  26271. if (cs.name === 'Pattern') {
  26272. next(self.handleColorN(operatorList, OPS.setStrokeColorN, args, cs, patterns, resources, task, xref));
  26273. return;
  26274. }
  26275. args = cs.getRgb(args, 0);
  26276. fn = OPS.setStrokeRGBColor;
  26277. break;
  26278. case OPS.shadingFill:
  26279. var shadingRes = resources.get('Shading');
  26280. if (!shadingRes) {
  26281. error('No shading resource found');
  26282. }
  26283. var shading = shadingRes.get(args[0].name);
  26284. if (!shading) {
  26285. error('No shading object found');
  26286. }
  26287. var shadingFill = Pattern.parseShading(shading, null, xref, resources, self.handler);
  26288. var patternIR = shadingFill.getIR();
  26289. args = [patternIR];
  26290. fn = OPS.shadingFill;
  26291. break;
  26292. case OPS.setGState:
  26293. var dictName = args[0];
  26294. var extGState = resources.get('ExtGState');
  26295. if (!isDict(extGState) || !extGState.has(dictName.name)) {
  26296. break;
  26297. }
  26298. var gState = extGState.get(dictName.name);
  26299. next(self.setGState(resources, gState, operatorList, task, xref, stateManager));
  26300. return;
  26301. case OPS.moveTo:
  26302. case OPS.lineTo:
  26303. case OPS.curveTo:
  26304. case OPS.curveTo2:
  26305. case OPS.curveTo3:
  26306. case OPS.closePath:
  26307. self.buildPath(operatorList, fn, args);
  26308. continue;
  26309. case OPS.rectangle:
  26310. self.buildPath(operatorList, fn, args);
  26311. continue;
  26312. case OPS.markPoint:
  26313. case OPS.markPointProps:
  26314. case OPS.beginMarkedContent:
  26315. case OPS.beginMarkedContentProps:
  26316. case OPS.endMarkedContent:
  26317. case OPS.beginCompat:
  26318. case OPS.endCompat:
  26319. continue;
  26320. default:
  26321. if (args !== null) {
  26322. for (i = 0, ii = args.length; i < ii; i++) {
  26323. if (args[i] instanceof Dict) {
  26324. break;
  26325. }
  26326. }
  26327. if (i < ii) {
  26328. warn('getOperatorList - ignoring operator: ' + fn);
  26329. continue;
  26330. }
  26331. }
  26332. }
  26333. operatorList.addOp(fn, args);
  26334. }
  26335. if (stop) {
  26336. next(deferred);
  26337. return;
  26338. }
  26339. for (i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  26340. operatorList.addOp(OPS.restore, []);
  26341. }
  26342. resolve();
  26343. });
  26344. },
  26345. getTextContent: function PartialEvaluator_getTextContent(stream, task, resources, stateManager, normalizeWhitespace, combineTextItems) {
  26346. stateManager = stateManager || new StateManager(new TextState());
  26347. var WhitespaceRegexp = /\s/g;
  26348. var textContent = {
  26349. items: [],
  26350. styles: Object.create(null)
  26351. };
  26352. var textContentItem = {
  26353. initialized: false,
  26354. str: [],
  26355. width: 0,
  26356. height: 0,
  26357. vertical: false,
  26358. lastAdvanceWidth: 0,
  26359. lastAdvanceHeight: 0,
  26360. textAdvanceScale: 0,
  26361. spaceWidth: 0,
  26362. fakeSpaceMin: Infinity,
  26363. fakeMultiSpaceMin: Infinity,
  26364. fakeMultiSpaceMax: -0,
  26365. textRunBreakAllowed: false,
  26366. transform: null,
  26367. fontName: null
  26368. };
  26369. var SPACE_FACTOR = 0.3;
  26370. var MULTI_SPACE_FACTOR = 1.5;
  26371. var MULTI_SPACE_FACTOR_MAX = 4;
  26372. var self = this;
  26373. var xref = this.xref;
  26374. resources = xref.fetchIfRef(resources) || Dict.empty;
  26375. var xobjs = null;
  26376. var xobjsCache = Object.create(null);
  26377. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  26378. var textState;
  26379. function ensureTextContentItem() {
  26380. if (textContentItem.initialized) {
  26381. return textContentItem;
  26382. }
  26383. var font = textState.font;
  26384. if (!(font.loadedName in textContent.styles)) {
  26385. textContent.styles[font.loadedName] = {
  26386. fontFamily: font.fallbackName,
  26387. ascent: font.ascent,
  26388. descent: font.descent,
  26389. vertical: font.vertical
  26390. };
  26391. }
  26392. textContentItem.fontName = font.loadedName;
  26393. var tsm = [
  26394. textState.fontSize * textState.textHScale,
  26395. 0,
  26396. 0,
  26397. textState.fontSize,
  26398. 0,
  26399. textState.textRise
  26400. ];
  26401. if (font.isType3Font && textState.fontMatrix !== FONT_IDENTITY_MATRIX && textState.fontSize === 1) {
  26402. var glyphHeight = font.bbox[3] - font.bbox[1];
  26403. if (glyphHeight > 0) {
  26404. glyphHeight = glyphHeight * textState.fontMatrix[3];
  26405. tsm[3] *= glyphHeight;
  26406. }
  26407. }
  26408. var trm = Util.transform(textState.ctm, Util.transform(textState.textMatrix, tsm));
  26409. textContentItem.transform = trm;
  26410. if (!font.vertical) {
  26411. textContentItem.width = 0;
  26412. textContentItem.height = Math.sqrt(trm[2] * trm[2] + trm[3] * trm[3]);
  26413. textContentItem.vertical = false;
  26414. } else {
  26415. textContentItem.width = Math.sqrt(trm[0] * trm[0] + trm[1] * trm[1]);
  26416. textContentItem.height = 0;
  26417. textContentItem.vertical = true;
  26418. }
  26419. var a = textState.textLineMatrix[0];
  26420. var b = textState.textLineMatrix[1];
  26421. var scaleLineX = Math.sqrt(a * a + b * b);
  26422. a = textState.ctm[0];
  26423. b = textState.ctm[1];
  26424. var scaleCtmX = Math.sqrt(a * a + b * b);
  26425. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  26426. textContentItem.lastAdvanceWidth = 0;
  26427. textContentItem.lastAdvanceHeight = 0;
  26428. var spaceWidth = font.spaceWidth / 1000 * textState.fontSize;
  26429. if (spaceWidth) {
  26430. textContentItem.spaceWidth = spaceWidth;
  26431. textContentItem.fakeSpaceMin = spaceWidth * SPACE_FACTOR;
  26432. textContentItem.fakeMultiSpaceMin = spaceWidth * MULTI_SPACE_FACTOR;
  26433. textContentItem.fakeMultiSpaceMax = spaceWidth * MULTI_SPACE_FACTOR_MAX;
  26434. textContentItem.textRunBreakAllowed = !font.isMonospace;
  26435. } else {
  26436. textContentItem.spaceWidth = 0;
  26437. textContentItem.fakeSpaceMin = Infinity;
  26438. textContentItem.fakeMultiSpaceMin = Infinity;
  26439. textContentItem.fakeMultiSpaceMax = 0;
  26440. textContentItem.textRunBreakAllowed = false;
  26441. }
  26442. textContentItem.initialized = true;
  26443. return textContentItem;
  26444. }
  26445. function replaceWhitespace(str) {
  26446. var i = 0, ii = str.length, code;
  26447. while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7F) {
  26448. i++;
  26449. }
  26450. return i < ii ? str.replace(WhitespaceRegexp, ' ') : str;
  26451. }
  26452. function runBidiTransform(textChunk) {
  26453. var str = textChunk.str.join('');
  26454. var bidiResult = bidi(str, -1, textChunk.vertical);
  26455. return {
  26456. str: normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str,
  26457. dir: bidiResult.dir,
  26458. width: textChunk.width,
  26459. height: textChunk.height,
  26460. transform: textChunk.transform,
  26461. fontName: textChunk.fontName
  26462. };
  26463. }
  26464. function handleSetFont(fontName, fontRef) {
  26465. return self.loadFont(fontName, fontRef, xref, resources).then(function (translated) {
  26466. textState.font = translated.font;
  26467. textState.fontMatrix = translated.font.fontMatrix || FONT_IDENTITY_MATRIX;
  26468. });
  26469. }
  26470. function buildTextContentItem(chars) {
  26471. var font = textState.font;
  26472. var textChunk = ensureTextContentItem();
  26473. var width = 0;
  26474. var height = 0;
  26475. var glyphs = font.charsToGlyphs(chars);
  26476. for (var i = 0; i < glyphs.length; i++) {
  26477. var glyph = glyphs[i];
  26478. var glyphWidth = null;
  26479. if (font.vertical && glyph.vmetric) {
  26480. glyphWidth = glyph.vmetric[0];
  26481. } else {
  26482. glyphWidth = glyph.width;
  26483. }
  26484. var glyphUnicode = glyph.unicode;
  26485. var NormalizedUnicodes = getNormalizedUnicodes();
  26486. if (NormalizedUnicodes[glyphUnicode] !== undefined) {
  26487. glyphUnicode = NormalizedUnicodes[glyphUnicode];
  26488. }
  26489. glyphUnicode = reverseIfRtl(glyphUnicode);
  26490. var charSpacing = textState.charSpacing;
  26491. if (glyph.isSpace) {
  26492. var wordSpacing = textState.wordSpacing;
  26493. charSpacing += wordSpacing;
  26494. if (wordSpacing > 0) {
  26495. addFakeSpaces(wordSpacing, textChunk.str);
  26496. }
  26497. }
  26498. var tx = 0;
  26499. var ty = 0;
  26500. if (!font.vertical) {
  26501. var w0 = glyphWidth * textState.fontMatrix[0];
  26502. tx = (w0 * textState.fontSize + charSpacing) * textState.textHScale;
  26503. width += tx;
  26504. } else {
  26505. var w1 = glyphWidth * textState.fontMatrix[0];
  26506. ty = w1 * textState.fontSize + charSpacing;
  26507. height += ty;
  26508. }
  26509. textState.translateTextMatrix(tx, ty);
  26510. textChunk.str.push(glyphUnicode);
  26511. }
  26512. if (!font.vertical) {
  26513. textChunk.lastAdvanceWidth = width;
  26514. textChunk.width += width;
  26515. } else {
  26516. textChunk.lastAdvanceHeight = height;
  26517. textChunk.height += Math.abs(height);
  26518. }
  26519. return textChunk;
  26520. }
  26521. function addFakeSpaces(width, strBuf) {
  26522. if (width < textContentItem.fakeSpaceMin) {
  26523. return;
  26524. }
  26525. if (width < textContentItem.fakeMultiSpaceMin) {
  26526. strBuf.push(' ');
  26527. return;
  26528. }
  26529. var fakeSpaces = Math.round(width / textContentItem.spaceWidth);
  26530. while (fakeSpaces-- > 0) {
  26531. strBuf.push(' ');
  26532. }
  26533. }
  26534. function flushTextContentItem() {
  26535. if (!textContentItem.initialized) {
  26536. return;
  26537. }
  26538. textContentItem.width *= textContentItem.textAdvanceScale;
  26539. textContentItem.height *= textContentItem.textAdvanceScale;
  26540. textContent.items.push(runBidiTransform(textContentItem));
  26541. textContentItem.initialized = false;
  26542. textContentItem.str.length = 0;
  26543. }
  26544. var timeSlotManager = new TimeSlotManager();
  26545. return new Promise(function promiseBody(resolve, reject) {
  26546. var next = function (promise) {
  26547. promise.then(function () {
  26548. try {
  26549. promiseBody(resolve, reject);
  26550. } catch (ex) {
  26551. reject(ex);
  26552. }
  26553. }, reject);
  26554. };
  26555. task.ensureNotTerminated();
  26556. timeSlotManager.reset();
  26557. var stop, operation = {}, args = [];
  26558. while (!(stop = timeSlotManager.check())) {
  26559. args.length = 0;
  26560. operation.args = args;
  26561. if (!preprocessor.read(operation)) {
  26562. break;
  26563. }
  26564. textState = stateManager.state;
  26565. var fn = operation.fn;
  26566. args = operation.args;
  26567. var advance, diff;
  26568. switch (fn | 0) {
  26569. case OPS.setFont:
  26570. var fontNameArg = args[0].name, fontSizeArg = args[1];
  26571. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  26572. break;
  26573. }
  26574. flushTextContentItem();
  26575. textState.fontName = fontNameArg;
  26576. textState.fontSize = fontSizeArg;
  26577. next(handleSetFont(fontNameArg, null));
  26578. return;
  26579. case OPS.setTextRise:
  26580. flushTextContentItem();
  26581. textState.textRise = args[0];
  26582. break;
  26583. case OPS.setHScale:
  26584. flushTextContentItem();
  26585. textState.textHScale = args[0] / 100;
  26586. break;
  26587. case OPS.setLeading:
  26588. flushTextContentItem();
  26589. textState.leading = args[0];
  26590. break;
  26591. case OPS.moveText:
  26592. var isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0;
  26593. advance = args[0] - args[1];
  26594. if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) {
  26595. textState.translateTextLineMatrix(args[0], args[1]);
  26596. textContentItem.width += args[0] - textContentItem.lastAdvanceWidth;
  26597. textContentItem.height += args[1] - textContentItem.lastAdvanceHeight;
  26598. diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight);
  26599. addFakeSpaces(diff, textContentItem.str);
  26600. break;
  26601. }
  26602. flushTextContentItem();
  26603. textState.translateTextLineMatrix(args[0], args[1]);
  26604. textState.textMatrix = textState.textLineMatrix.slice();
  26605. break;
  26606. case OPS.setLeadingMoveText:
  26607. flushTextContentItem();
  26608. textState.leading = -args[1];
  26609. textState.translateTextLineMatrix(args[0], args[1]);
  26610. textState.textMatrix = textState.textLineMatrix.slice();
  26611. break;
  26612. case OPS.nextLine:
  26613. flushTextContentItem();
  26614. textState.carriageReturn();
  26615. break;
  26616. case OPS.setTextMatrix:
  26617. advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]);
  26618. if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) {
  26619. textState.translateTextLineMatrix(advance.width, advance.height);
  26620. textContentItem.width += advance.width - textContentItem.lastAdvanceWidth;
  26621. textContentItem.height += advance.height - textContentItem.lastAdvanceHeight;
  26622. diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight);
  26623. addFakeSpaces(diff, textContentItem.str);
  26624. break;
  26625. }
  26626. flushTextContentItem();
  26627. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  26628. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  26629. break;
  26630. case OPS.setCharSpacing:
  26631. textState.charSpacing = args[0];
  26632. break;
  26633. case OPS.setWordSpacing:
  26634. textState.wordSpacing = args[0];
  26635. break;
  26636. case OPS.beginText:
  26637. flushTextContentItem();
  26638. textState.textMatrix = IDENTITY_MATRIX.slice();
  26639. textState.textLineMatrix = IDENTITY_MATRIX.slice();
  26640. break;
  26641. case OPS.showSpacedText:
  26642. var items = args[0];
  26643. var offset;
  26644. for (var j = 0, jj = items.length; j < jj; j++) {
  26645. if (typeof items[j] === 'string') {
  26646. buildTextContentItem(items[j]);
  26647. } else if (isNum(items[j])) {
  26648. ensureTextContentItem();
  26649. advance = items[j] * textState.fontSize / 1000;
  26650. var breakTextRun = false;
  26651. if (textState.font.vertical) {
  26652. offset = advance;
  26653. textState.translateTextMatrix(0, offset);
  26654. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  26655. if (!breakTextRun) {
  26656. textContentItem.height += offset;
  26657. }
  26658. } else {
  26659. advance = -advance;
  26660. offset = advance * textState.textHScale;
  26661. textState.translateTextMatrix(offset, 0);
  26662. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  26663. if (!breakTextRun) {
  26664. textContentItem.width += offset;
  26665. }
  26666. }
  26667. if (breakTextRun) {
  26668. flushTextContentItem();
  26669. } else if (advance > 0) {
  26670. addFakeSpaces(advance, textContentItem.str);
  26671. }
  26672. }
  26673. }
  26674. break;
  26675. case OPS.showText:
  26676. buildTextContentItem(args[0]);
  26677. break;
  26678. case OPS.nextLineShowText:
  26679. flushTextContentItem();
  26680. textState.carriageReturn();
  26681. buildTextContentItem(args[0]);
  26682. break;
  26683. case OPS.nextLineSetSpacingShowText:
  26684. flushTextContentItem();
  26685. textState.wordSpacing = args[0];
  26686. textState.charSpacing = args[1];
  26687. textState.carriageReturn();
  26688. buildTextContentItem(args[2]);
  26689. break;
  26690. case OPS.paintXObject:
  26691. flushTextContentItem();
  26692. if (args[0].code) {
  26693. break;
  26694. }
  26695. if (!xobjs) {
  26696. xobjs = resources.get('XObject') || Dict.empty;
  26697. }
  26698. var name = args[0].name;
  26699. if (xobjsCache.key === name) {
  26700. if (xobjsCache.texts) {
  26701. Util.appendToArray(textContent.items, xobjsCache.texts.items);
  26702. Util.extendObj(textContent.styles, xobjsCache.texts.styles);
  26703. }
  26704. break;
  26705. }
  26706. var xobj = xobjs.get(name);
  26707. if (!xobj) {
  26708. break;
  26709. }
  26710. assert(isStream(xobj), 'XObject should be a stream');
  26711. var type = xobj.dict.get('Subtype');
  26712. assert(isName(type), 'XObject should have a Name subtype');
  26713. if (type.name !== 'Form') {
  26714. xobjsCache.key = name;
  26715. xobjsCache.texts = null;
  26716. break;
  26717. }
  26718. stateManager.save();
  26719. var matrix = xobj.dict.getArray('Matrix');
  26720. if (isArray(matrix) && matrix.length === 6) {
  26721. stateManager.transform(matrix);
  26722. }
  26723. next(self.getTextContent(xobj, task, xobj.dict.get('Resources') || resources, stateManager, normalizeWhitespace, combineTextItems).then(function (formTextContent) {
  26724. Util.appendToArray(textContent.items, formTextContent.items);
  26725. Util.extendObj(textContent.styles, formTextContent.styles);
  26726. stateManager.restore();
  26727. xobjsCache.key = name;
  26728. xobjsCache.texts = formTextContent;
  26729. }));
  26730. return;
  26731. case OPS.setGState:
  26732. flushTextContentItem();
  26733. var dictName = args[0];
  26734. var extGState = resources.get('ExtGState');
  26735. if (!isDict(extGState) || !isName(dictName)) {
  26736. break;
  26737. }
  26738. var gState = extGState.get(dictName.name);
  26739. if (!isDict(gState)) {
  26740. break;
  26741. }
  26742. var gStateFont = gState.get('Font');
  26743. if (gStateFont) {
  26744. textState.fontName = null;
  26745. textState.fontSize = gStateFont[1];
  26746. next(handleSetFont(null, gStateFont[0]));
  26747. return;
  26748. }
  26749. break;
  26750. }
  26751. }
  26752. if (stop) {
  26753. next(deferred);
  26754. return;
  26755. }
  26756. flushTextContentItem();
  26757. resolve(textContent);
  26758. });
  26759. },
  26760. extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, xref, properties) {
  26761. var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
  26762. var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined);
  26763. if (properties.composite) {
  26764. var cidSystemInfo = dict.get('CIDSystemInfo');
  26765. if (isDict(cidSystemInfo)) {
  26766. properties.cidSystemInfo = {
  26767. registry: cidSystemInfo.get('Registry'),
  26768. ordering: cidSystemInfo.get('Ordering'),
  26769. supplement: cidSystemInfo.get('Supplement')
  26770. };
  26771. }
  26772. var cidToGidMap = dict.get('CIDToGIDMap');
  26773. if (isStream(cidToGidMap)) {
  26774. properties.cidToGidMap = this.readCidToGidMap(cidToGidMap);
  26775. }
  26776. }
  26777. var differences = [];
  26778. var baseEncodingName = null;
  26779. var encoding;
  26780. if (dict.has('Encoding')) {
  26781. encoding = dict.get('Encoding');
  26782. if (isDict(encoding)) {
  26783. baseEncodingName = encoding.get('BaseEncoding');
  26784. baseEncodingName = isName(baseEncodingName) ? baseEncodingName.name : null;
  26785. if (encoding.has('Differences')) {
  26786. var diffEncoding = encoding.get('Differences');
  26787. var index = 0;
  26788. for (var j = 0, jj = diffEncoding.length; j < jj; j++) {
  26789. var data = xref.fetchIfRef(diffEncoding[j]);
  26790. if (isNum(data)) {
  26791. index = data;
  26792. } else if (isName(data)) {
  26793. differences[index++] = data.name;
  26794. } else {
  26795. error('Invalid entry in \'Differences\' array: ' + data);
  26796. }
  26797. }
  26798. }
  26799. } else if (isName(encoding)) {
  26800. baseEncodingName = encoding.name;
  26801. } else {
  26802. error('Encoding is not a Name nor a Dict');
  26803. }
  26804. if (baseEncodingName !== 'MacRomanEncoding' && baseEncodingName !== 'MacExpertEncoding' && baseEncodingName !== 'WinAnsiEncoding') {
  26805. baseEncodingName = null;
  26806. }
  26807. }
  26808. if (baseEncodingName) {
  26809. properties.defaultEncoding = getEncoding(baseEncodingName).slice();
  26810. } else {
  26811. var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  26812. var isNonsymbolicFont = !!(properties.flags & FontFlags.Nonsymbolic);
  26813. encoding = StandardEncoding;
  26814. if (properties.type === 'TrueType' && !isNonsymbolicFont) {
  26815. encoding = WinAnsiEncoding;
  26816. }
  26817. if (isSymbolicFont) {
  26818. encoding = MacRomanEncoding;
  26819. if (!properties.file) {
  26820. if (/Symbol/i.test(properties.name)) {
  26821. encoding = SymbolSetEncoding;
  26822. } else if (/Dingbats/i.test(properties.name)) {
  26823. encoding = ZapfDingbatsEncoding;
  26824. }
  26825. }
  26826. }
  26827. properties.defaultEncoding = encoding;
  26828. }
  26829. properties.differences = differences;
  26830. properties.baseEncodingName = baseEncodingName;
  26831. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  26832. properties.dict = dict;
  26833. return toUnicodePromise.then(function (toUnicode) {
  26834. properties.toUnicode = toUnicode;
  26835. return this.buildToUnicode(properties);
  26836. }.bind(this)).then(function (toUnicode) {
  26837. properties.toUnicode = toUnicode;
  26838. return properties;
  26839. });
  26840. },
  26841. buildToUnicode: function PartialEvaluator_buildToUnicode(properties) {
  26842. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  26843. if (properties.hasIncludedToUnicodeMap) {
  26844. return Promise.resolve(properties.toUnicode);
  26845. }
  26846. var toUnicode, charcode, glyphName;
  26847. if (!properties.composite) {
  26848. toUnicode = [];
  26849. var encoding = properties.defaultEncoding.slice();
  26850. var baseEncodingName = properties.baseEncodingName;
  26851. var differences = properties.differences;
  26852. for (charcode in differences) {
  26853. glyphName = differences[charcode];
  26854. if (glyphName === '.notdef') {
  26855. continue;
  26856. }
  26857. encoding[charcode] = glyphName;
  26858. }
  26859. var glyphsUnicodeMap = getGlyphsUnicode();
  26860. for (charcode in encoding) {
  26861. glyphName = encoding[charcode];
  26862. if (glyphName === '') {
  26863. continue;
  26864. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  26865. var code = 0;
  26866. switch (glyphName[0]) {
  26867. case 'G':
  26868. if (glyphName.length === 3) {
  26869. code = parseInt(glyphName.substr(1), 16);
  26870. }
  26871. break;
  26872. case 'g':
  26873. if (glyphName.length === 5) {
  26874. code = parseInt(glyphName.substr(1), 16);
  26875. }
  26876. break;
  26877. case 'C':
  26878. case 'c':
  26879. if (glyphName.length >= 3) {
  26880. code = +glyphName.substr(1);
  26881. }
  26882. break;
  26883. default:
  26884. var unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  26885. if (unicode !== -1) {
  26886. code = unicode;
  26887. }
  26888. }
  26889. if (code) {
  26890. if (baseEncodingName && code === +charcode) {
  26891. var baseEncoding = getEncoding(baseEncodingName);
  26892. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  26893. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  26894. continue;
  26895. }
  26896. }
  26897. toUnicode[charcode] = String.fromCharCode(code);
  26898. }
  26899. continue;
  26900. }
  26901. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  26902. }
  26903. return Promise.resolve(new ToUnicodeMap(toUnicode));
  26904. }
  26905. 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'))) {
  26906. var registry = properties.cidSystemInfo.registry;
  26907. var ordering = properties.cidSystemInfo.ordering;
  26908. var ucs2CMapName = Name.get(registry + '-' + ordering + '-UCS2');
  26909. return CMapFactory.create({
  26910. encoding: ucs2CMapName,
  26911. fetchBuiltInCMap: this.fetchBuiltInCMap,
  26912. useCMap: null
  26913. }).then(function (ucs2CMap) {
  26914. var cMap = properties.cMap;
  26915. toUnicode = [];
  26916. cMap.forEach(function (charcode, cid) {
  26917. assert(cid <= 0xffff, 'Max size of CID is 65,535');
  26918. var ucs2 = ucs2CMap.lookup(cid);
  26919. if (ucs2) {
  26920. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  26921. }
  26922. });
  26923. return new ToUnicodeMap(toUnicode);
  26924. });
  26925. }
  26926. return Promise.resolve(new IdentityToUnicodeMap(properties.firstChar, properties.lastChar));
  26927. },
  26928. readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) {
  26929. var cmapObj = toUnicode;
  26930. if (isName(cmapObj)) {
  26931. return CMapFactory.create({
  26932. encoding: cmapObj,
  26933. fetchBuiltInCMap: this.fetchBuiltInCMap,
  26934. useCMap: null
  26935. }).then(function (cmap) {
  26936. if (cmap instanceof IdentityCMap) {
  26937. return new IdentityToUnicodeMap(0, 0xFFFF);
  26938. }
  26939. return new ToUnicodeMap(cmap.getMap());
  26940. });
  26941. } else if (isStream(cmapObj)) {
  26942. return CMapFactory.create({
  26943. encoding: cmapObj,
  26944. fetchBuiltInCMap: this.fetchBuiltInCMap,
  26945. useCMap: null
  26946. }).then(function (cmap) {
  26947. if (cmap instanceof IdentityCMap) {
  26948. return new IdentityToUnicodeMap(0, 0xFFFF);
  26949. }
  26950. var map = new Array(cmap.length);
  26951. cmap.forEach(function (charCode, token) {
  26952. var str = [];
  26953. for (var k = 0; k < token.length; k += 2) {
  26954. var w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  26955. if ((w1 & 0xF800) !== 0xD800) {
  26956. str.push(w1);
  26957. continue;
  26958. }
  26959. k += 2;
  26960. var w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  26961. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  26962. }
  26963. map[charCode] = String.fromCharCode.apply(String, str);
  26964. });
  26965. return new ToUnicodeMap(map);
  26966. });
  26967. }
  26968. return Promise.resolve(null);
  26969. },
  26970. readCidToGidMap: function PartialEvaluator_readCidToGidMap(cidToGidStream) {
  26971. var glyphsData = cidToGidStream.getBytes();
  26972. var result = [];
  26973. for (var j = 0, jj = glyphsData.length; j < jj; j++) {
  26974. var glyphID = glyphsData[j++] << 8 | glyphsData[j];
  26975. if (glyphID === 0) {
  26976. continue;
  26977. }
  26978. var code = j >> 1;
  26979. result[code] = glyphID;
  26980. }
  26981. return result;
  26982. },
  26983. extractWidths: function PartialEvaluator_extractWidths(dict, xref, descriptor, properties) {
  26984. var glyphsWidths = [];
  26985. var defaultWidth = 0;
  26986. var glyphsVMetrics = [];
  26987. var defaultVMetrics;
  26988. var i, ii, j, jj, start, code, widths;
  26989. if (properties.composite) {
  26990. defaultWidth = dict.get('DW') || 1000;
  26991. widths = dict.get('W');
  26992. if (widths) {
  26993. for (i = 0, ii = widths.length; i < ii; i++) {
  26994. start = xref.fetchIfRef(widths[i++]);
  26995. code = xref.fetchIfRef(widths[i]);
  26996. if (isArray(code)) {
  26997. for (j = 0, jj = code.length; j < jj; j++) {
  26998. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  26999. }
  27000. } else {
  27001. var width = xref.fetchIfRef(widths[++i]);
  27002. for (j = start; j <= code; j++) {
  27003. glyphsWidths[j] = width;
  27004. }
  27005. }
  27006. }
  27007. }
  27008. if (properties.vertical) {
  27009. var vmetrics = dict.getArray('DW2') || [
  27010. 880,
  27011. -1000
  27012. ];
  27013. defaultVMetrics = [
  27014. vmetrics[1],
  27015. defaultWidth * 0.5,
  27016. vmetrics[0]
  27017. ];
  27018. vmetrics = dict.get('W2');
  27019. if (vmetrics) {
  27020. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  27021. start = xref.fetchIfRef(vmetrics[i++]);
  27022. code = xref.fetchIfRef(vmetrics[i]);
  27023. if (isArray(code)) {
  27024. for (j = 0, jj = code.length; j < jj; j++) {
  27025. glyphsVMetrics[start++] = [
  27026. xref.fetchIfRef(code[j++]),
  27027. xref.fetchIfRef(code[j++]),
  27028. xref.fetchIfRef(code[j])
  27029. ];
  27030. }
  27031. } else {
  27032. var vmetric = [
  27033. xref.fetchIfRef(vmetrics[++i]),
  27034. xref.fetchIfRef(vmetrics[++i]),
  27035. xref.fetchIfRef(vmetrics[++i])
  27036. ];
  27037. for (j = start; j <= code; j++) {
  27038. glyphsVMetrics[j] = vmetric;
  27039. }
  27040. }
  27041. }
  27042. }
  27043. }
  27044. } else {
  27045. var firstChar = properties.firstChar;
  27046. widths = dict.get('Widths');
  27047. if (widths) {
  27048. j = firstChar;
  27049. for (i = 0, ii = widths.length; i < ii; i++) {
  27050. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  27051. }
  27052. defaultWidth = parseFloat(descriptor.get('MissingWidth')) || 0;
  27053. } else {
  27054. var baseFontName = dict.get('BaseFont');
  27055. if (isName(baseFontName)) {
  27056. var metrics = this.getBaseFontMetrics(baseFontName.name);
  27057. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  27058. defaultWidth = metrics.defaultWidth;
  27059. }
  27060. }
  27061. }
  27062. var isMonospace = true;
  27063. var firstWidth = defaultWidth;
  27064. for (var glyph in glyphsWidths) {
  27065. var glyphWidth = glyphsWidths[glyph];
  27066. if (!glyphWidth) {
  27067. continue;
  27068. }
  27069. if (!firstWidth) {
  27070. firstWidth = glyphWidth;
  27071. continue;
  27072. }
  27073. if (firstWidth !== glyphWidth) {
  27074. isMonospace = false;
  27075. break;
  27076. }
  27077. }
  27078. if (isMonospace) {
  27079. properties.flags |= FontFlags.FixedPitch;
  27080. }
  27081. properties.defaultWidth = defaultWidth;
  27082. properties.widths = glyphsWidths;
  27083. properties.defaultVMetrics = defaultVMetrics;
  27084. properties.vmetrics = glyphsVMetrics;
  27085. },
  27086. isSerifFont: function PartialEvaluator_isSerifFont(baseFontName) {
  27087. var fontNameWoStyle = baseFontName.split('-')[0];
  27088. return fontNameWoStyle in getSerifFonts() || fontNameWoStyle.search(/serif/gi) !== -1;
  27089. },
  27090. getBaseFontMetrics: function PartialEvaluator_getBaseFontMetrics(name) {
  27091. var defaultWidth = 0;
  27092. var widths = [];
  27093. var monospace = false;
  27094. var stdFontMap = getStdFontMap();
  27095. var lookupName = stdFontMap[name] || name;
  27096. var Metrics = getMetrics();
  27097. if (!(lookupName in Metrics)) {
  27098. if (this.isSerifFont(name)) {
  27099. lookupName = 'Times-Roman';
  27100. } else {
  27101. lookupName = 'Helvetica';
  27102. }
  27103. }
  27104. var glyphWidths = Metrics[lookupName];
  27105. if (isNum(glyphWidths)) {
  27106. defaultWidth = glyphWidths;
  27107. monospace = true;
  27108. } else {
  27109. widths = glyphWidths();
  27110. }
  27111. return {
  27112. defaultWidth: defaultWidth,
  27113. monospace: monospace,
  27114. widths: widths
  27115. };
  27116. },
  27117. buildCharCodeToWidth: function PartialEvaluator_bulildCharCodeToWidth(widthsByGlyphName, properties) {
  27118. var widths = Object.create(null);
  27119. var differences = properties.differences;
  27120. var encoding = properties.defaultEncoding;
  27121. for (var charCode = 0; charCode < 256; charCode++) {
  27122. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  27123. widths[charCode] = widthsByGlyphName[differences[charCode]];
  27124. continue;
  27125. }
  27126. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  27127. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  27128. continue;
  27129. }
  27130. }
  27131. return widths;
  27132. },
  27133. preEvaluateFont: function PartialEvaluator_preEvaluateFont(dict, xref) {
  27134. var baseDict = dict;
  27135. var type = dict.get('Subtype');
  27136. assert(isName(type), 'invalid font Subtype');
  27137. var composite = false;
  27138. var uint8array;
  27139. if (type.name === 'Type0') {
  27140. var df = dict.get('DescendantFonts');
  27141. if (!df) {
  27142. error('Descendant fonts are not specified');
  27143. }
  27144. dict = isArray(df) ? xref.fetchIfRef(df[0]) : df;
  27145. type = dict.get('Subtype');
  27146. assert(isName(type), 'invalid font Subtype');
  27147. composite = true;
  27148. }
  27149. var descriptor = dict.get('FontDescriptor');
  27150. if (descriptor) {
  27151. var hash = new MurmurHash3_64();
  27152. var encoding = baseDict.getRaw('Encoding');
  27153. if (isName(encoding)) {
  27154. hash.update(encoding.name);
  27155. } else if (isRef(encoding)) {
  27156. hash.update(encoding.toString());
  27157. } else if (isDict(encoding)) {
  27158. var keys = encoding.getKeys();
  27159. for (var i = 0, ii = keys.length; i < ii; i++) {
  27160. var entry = encoding.getRaw(keys[i]);
  27161. if (isName(entry)) {
  27162. hash.update(entry.name);
  27163. } else if (isRef(entry)) {
  27164. hash.update(entry.toString());
  27165. } else if (isArray(entry)) {
  27166. var diffLength = entry.length, diffBuf = new Array(diffLength);
  27167. for (var j = 0; j < diffLength; j++) {
  27168. var diffEntry = entry[j];
  27169. if (isName(diffEntry)) {
  27170. diffBuf[j] = diffEntry.name;
  27171. } else if (isNum(diffEntry) || isRef(diffEntry)) {
  27172. diffBuf[j] = diffEntry.toString();
  27173. }
  27174. }
  27175. hash.update(diffBuf.join());
  27176. }
  27177. }
  27178. }
  27179. var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
  27180. if (isStream(toUnicode)) {
  27181. var stream = toUnicode.str || toUnicode;
  27182. uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  27183. hash.update(uint8array);
  27184. } else if (isName(toUnicode)) {
  27185. hash.update(toUnicode.name);
  27186. }
  27187. var widths = dict.get('Widths') || baseDict.get('Widths');
  27188. if (widths) {
  27189. uint8array = new Uint8Array(new Uint32Array(widths).buffer);
  27190. hash.update(uint8array);
  27191. }
  27192. }
  27193. return {
  27194. descriptor: descriptor,
  27195. dict: dict,
  27196. baseDict: baseDict,
  27197. composite: composite,
  27198. type: type.name,
  27199. hash: hash ? hash.hexdigest() : ''
  27200. };
  27201. },
  27202. translateFont: function PartialEvaluator_translateFont(preEvaluatedFont, xref) {
  27203. var baseDict = preEvaluatedFont.baseDict;
  27204. var dict = preEvaluatedFont.dict;
  27205. var composite = preEvaluatedFont.composite;
  27206. var descriptor = preEvaluatedFont.descriptor;
  27207. var type = preEvaluatedFont.type;
  27208. var maxCharIndex = composite ? 0xFFFF : 0xFF;
  27209. var properties;
  27210. if (!descriptor) {
  27211. if (type === 'Type3') {
  27212. descriptor = new Dict(null);
  27213. descriptor.set('FontName', Name.get(type));
  27214. descriptor.set('FontBBox', dict.getArray('FontBBox'));
  27215. } else {
  27216. var baseFontName = dict.get('BaseFont');
  27217. if (!isName(baseFontName)) {
  27218. error('Base font is not specified');
  27219. }
  27220. baseFontName = baseFontName.name.replace(/[,_]/g, '-');
  27221. var metrics = this.getBaseFontMetrics(baseFontName);
  27222. var fontNameWoStyle = baseFontName.split('-')[0];
  27223. var flags = (this.isSerifFont(fontNameWoStyle) ? FontFlags.Serif : 0) | (metrics.monospace ? FontFlags.FixedPitch : 0) | (getSymbolsFonts()[fontNameWoStyle] ? FontFlags.Symbolic : FontFlags.Nonsymbolic);
  27224. properties = {
  27225. type: type,
  27226. name: baseFontName,
  27227. widths: metrics.widths,
  27228. defaultWidth: metrics.defaultWidth,
  27229. flags: flags,
  27230. firstChar: 0,
  27231. lastChar: maxCharIndex
  27232. };
  27233. return this.extractDataStructures(dict, dict, xref, properties).then(function (properties) {
  27234. properties.widths = this.buildCharCodeToWidth(metrics.widths, properties);
  27235. return new Font(baseFontName, null, properties);
  27236. }.bind(this));
  27237. }
  27238. }
  27239. var firstChar = dict.get('FirstChar') || 0;
  27240. var lastChar = dict.get('LastChar') || maxCharIndex;
  27241. var fontName = descriptor.get('FontName');
  27242. var baseFont = dict.get('BaseFont');
  27243. if (isString(fontName)) {
  27244. fontName = Name.get(fontName);
  27245. }
  27246. if (isString(baseFont)) {
  27247. baseFont = Name.get(baseFont);
  27248. }
  27249. if (type !== 'Type3') {
  27250. var fontNameStr = fontName && fontName.name;
  27251. var baseFontStr = baseFont && baseFont.name;
  27252. if (fontNameStr !== baseFontStr) {
  27253. info('The FontDescriptor\'s FontName is "' + fontNameStr + '" but should be the same as the Font\'s BaseFont "' + baseFontStr + '"');
  27254. if (fontNameStr && baseFontStr && baseFontStr.indexOf(fontNameStr) === 0) {
  27255. fontName = baseFont;
  27256. }
  27257. }
  27258. }
  27259. fontName = fontName || baseFont;
  27260. assert(isName(fontName), 'invalid font name');
  27261. var fontFile = descriptor.get('FontFile', 'FontFile2', 'FontFile3');
  27262. if (fontFile) {
  27263. if (fontFile.dict) {
  27264. var subtype = fontFile.dict.get('Subtype');
  27265. if (subtype) {
  27266. subtype = subtype.name;
  27267. }
  27268. var length1 = fontFile.dict.get('Length1');
  27269. var length2 = fontFile.dict.get('Length2');
  27270. var length3 = fontFile.dict.get('Length3');
  27271. }
  27272. }
  27273. properties = {
  27274. type: type,
  27275. name: fontName.name,
  27276. subtype: subtype,
  27277. file: fontFile,
  27278. length1: length1,
  27279. length2: length2,
  27280. length3: length3,
  27281. loadedName: baseDict.loadedName,
  27282. composite: composite,
  27283. wideChars: composite,
  27284. fixedPitch: false,
  27285. fontMatrix: dict.getArray('FontMatrix') || FONT_IDENTITY_MATRIX,
  27286. firstChar: firstChar || 0,
  27287. lastChar: lastChar || maxCharIndex,
  27288. bbox: descriptor.getArray('FontBBox'),
  27289. ascent: descriptor.get('Ascent'),
  27290. descent: descriptor.get('Descent'),
  27291. xHeight: descriptor.get('XHeight'),
  27292. capHeight: descriptor.get('CapHeight'),
  27293. flags: descriptor.get('Flags'),
  27294. italicAngle: descriptor.get('ItalicAngle'),
  27295. coded: false
  27296. };
  27297. var cMapPromise;
  27298. if (composite) {
  27299. var cidEncoding = baseDict.get('Encoding');
  27300. if (isName(cidEncoding)) {
  27301. properties.cidEncoding = cidEncoding.name;
  27302. }
  27303. cMapPromise = CMapFactory.create({
  27304. encoding: cidEncoding,
  27305. fetchBuiltInCMap: this.fetchBuiltInCMap,
  27306. useCMap: null
  27307. }).then(function (cMap) {
  27308. properties.cMap = cMap;
  27309. properties.vertical = properties.cMap.vertical;
  27310. });
  27311. } else {
  27312. cMapPromise = Promise.resolve(undefined);
  27313. }
  27314. return cMapPromise.then(function () {
  27315. return this.extractDataStructures(dict, baseDict, xref, properties);
  27316. }.bind(this)).then(function (properties) {
  27317. this.extractWidths(dict, xref, descriptor, properties);
  27318. if (type === 'Type3') {
  27319. properties.isType3Font = true;
  27320. }
  27321. return new Font(fontName.name, fontFile, properties);
  27322. }.bind(this));
  27323. }
  27324. };
  27325. return PartialEvaluator;
  27326. }();
  27327. var TranslatedFont = function TranslatedFontClosure() {
  27328. function TranslatedFont(loadedName, font, dict) {
  27329. this.loadedName = loadedName;
  27330. this.font = font;
  27331. this.dict = dict;
  27332. this.type3Loaded = null;
  27333. this.sent = false;
  27334. }
  27335. TranslatedFont.prototype = {
  27336. send: function (handler) {
  27337. if (this.sent) {
  27338. return;
  27339. }
  27340. var fontData = this.font.exportData();
  27341. handler.send('commonobj', [
  27342. this.loadedName,
  27343. 'Font',
  27344. fontData
  27345. ]);
  27346. this.sent = true;
  27347. },
  27348. loadType3Data: function (evaluator, resources, parentOperatorList, task) {
  27349. assert(this.font.isType3Font);
  27350. if (this.type3Loaded) {
  27351. return this.type3Loaded;
  27352. }
  27353. var translatedFont = this.font;
  27354. var loadCharProcsPromise = Promise.resolve();
  27355. var charProcs = this.dict.get('CharProcs');
  27356. var fontResources = this.dict.get('Resources') || resources;
  27357. var charProcKeys = charProcs.getKeys();
  27358. var charProcOperatorList = Object.create(null);
  27359. for (var i = 0, n = charProcKeys.length; i < n; ++i) {
  27360. loadCharProcsPromise = loadCharProcsPromise.then(function (key) {
  27361. var glyphStream = charProcs.get(key);
  27362. var operatorList = new OperatorList();
  27363. return evaluator.getOperatorList(glyphStream, task, fontResources, operatorList).then(function () {
  27364. charProcOperatorList[key] = operatorList.getIR();
  27365. parentOperatorList.addDependencies(operatorList.dependencies);
  27366. }, function (reason) {
  27367. warn('Type3 font resource \"' + key + '\" is not available');
  27368. var operatorList = new OperatorList();
  27369. charProcOperatorList[key] = operatorList.getIR();
  27370. });
  27371. }.bind(this, charProcKeys[i]));
  27372. }
  27373. this.type3Loaded = loadCharProcsPromise.then(function () {
  27374. translatedFont.charProcOperatorList = charProcOperatorList;
  27375. });
  27376. return this.type3Loaded;
  27377. }
  27378. };
  27379. return TranslatedFont;
  27380. }();
  27381. var OperatorList = function OperatorListClosure() {
  27382. var CHUNK_SIZE = 1000;
  27383. var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5;
  27384. function getTransfers(queue) {
  27385. var transfers = [];
  27386. var fnArray = queue.fnArray, argsArray = queue.argsArray;
  27387. for (var i = 0, ii = queue.length; i < ii; i++) {
  27388. switch (fnArray[i]) {
  27389. case OPS.paintInlineImageXObject:
  27390. case OPS.paintInlineImageXObjectGroup:
  27391. case OPS.paintImageMaskXObject:
  27392. var arg = argsArray[i][0];
  27393. if (!arg.cached) {
  27394. transfers.push(arg.data.buffer);
  27395. }
  27396. break;
  27397. }
  27398. }
  27399. return transfers;
  27400. }
  27401. function OperatorList(intent, messageHandler, pageIndex) {
  27402. this.messageHandler = messageHandler;
  27403. this.fnArray = [];
  27404. this.argsArray = [];
  27405. this.dependencies = Object.create(null);
  27406. this._totalLength = 0;
  27407. this.pageIndex = pageIndex;
  27408. this.intent = intent;
  27409. }
  27410. OperatorList.prototype = {
  27411. get length() {
  27412. return this.argsArray.length;
  27413. },
  27414. get totalLength() {
  27415. return this._totalLength + this.length;
  27416. },
  27417. addOp: function (fn, args) {
  27418. this.fnArray.push(fn);
  27419. this.argsArray.push(args);
  27420. if (this.messageHandler) {
  27421. if (this.fnArray.length >= CHUNK_SIZE) {
  27422. this.flush();
  27423. } else if (this.fnArray.length >= CHUNK_SIZE_ABOUT && (fn === OPS.restore || fn === OPS.endText)) {
  27424. this.flush();
  27425. }
  27426. }
  27427. },
  27428. addDependency: function (dependency) {
  27429. if (dependency in this.dependencies) {
  27430. return;
  27431. }
  27432. this.dependencies[dependency] = true;
  27433. this.addOp(OPS.dependency, [dependency]);
  27434. },
  27435. addDependencies: function (dependencies) {
  27436. for (var key in dependencies) {
  27437. this.addDependency(key);
  27438. }
  27439. },
  27440. addOpList: function (opList) {
  27441. Util.extendObj(this.dependencies, opList.dependencies);
  27442. for (var i = 0, ii = opList.length; i < ii; i++) {
  27443. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  27444. }
  27445. },
  27446. getIR: function () {
  27447. return {
  27448. fnArray: this.fnArray,
  27449. argsArray: this.argsArray,
  27450. length: this.length
  27451. };
  27452. },
  27453. flush: function (lastChunk) {
  27454. if (this.intent !== 'oplist') {
  27455. new QueueOptimizer().optimize(this);
  27456. }
  27457. var transfers = getTransfers(this);
  27458. var length = this.length;
  27459. this._totalLength += length;
  27460. this.messageHandler.send('RenderPageChunk', {
  27461. operatorList: {
  27462. fnArray: this.fnArray,
  27463. argsArray: this.argsArray,
  27464. lastChunk: lastChunk,
  27465. length: length
  27466. },
  27467. pageIndex: this.pageIndex,
  27468. intent: this.intent
  27469. }, transfers);
  27470. this.dependencies = Object.create(null);
  27471. this.fnArray.length = 0;
  27472. this.argsArray.length = 0;
  27473. }
  27474. };
  27475. return OperatorList;
  27476. }();
  27477. var StateManager = function StateManagerClosure() {
  27478. function StateManager(initialState) {
  27479. this.state = initialState;
  27480. this.stateStack = [];
  27481. }
  27482. StateManager.prototype = {
  27483. save: function () {
  27484. var old = this.state;
  27485. this.stateStack.push(this.state);
  27486. this.state = old.clone();
  27487. },
  27488. restore: function () {
  27489. var prev = this.stateStack.pop();
  27490. if (prev) {
  27491. this.state = prev;
  27492. }
  27493. },
  27494. transform: function (args) {
  27495. this.state.ctm = Util.transform(this.state.ctm, args);
  27496. }
  27497. };
  27498. return StateManager;
  27499. }();
  27500. var TextState = function TextStateClosure() {
  27501. function TextState() {
  27502. this.ctm = new Float32Array(IDENTITY_MATRIX);
  27503. this.fontName = null;
  27504. this.fontSize = 0;
  27505. this.font = null;
  27506. this.fontMatrix = FONT_IDENTITY_MATRIX;
  27507. this.textMatrix = IDENTITY_MATRIX.slice();
  27508. this.textLineMatrix = IDENTITY_MATRIX.slice();
  27509. this.charSpacing = 0;
  27510. this.wordSpacing = 0;
  27511. this.leading = 0;
  27512. this.textHScale = 1;
  27513. this.textRise = 0;
  27514. }
  27515. TextState.prototype = {
  27516. setTextMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
  27517. var m = this.textMatrix;
  27518. m[0] = a;
  27519. m[1] = b;
  27520. m[2] = c;
  27521. m[3] = d;
  27522. m[4] = e;
  27523. m[5] = f;
  27524. },
  27525. setTextLineMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
  27526. var m = this.textLineMatrix;
  27527. m[0] = a;
  27528. m[1] = b;
  27529. m[2] = c;
  27530. m[3] = d;
  27531. m[4] = e;
  27532. m[5] = f;
  27533. },
  27534. translateTextMatrix: function TextState_translateTextMatrix(x, y) {
  27535. var m = this.textMatrix;
  27536. m[4] = m[0] * x + m[2] * y + m[4];
  27537. m[5] = m[1] * x + m[3] * y + m[5];
  27538. },
  27539. translateTextLineMatrix: function TextState_translateTextMatrix(x, y) {
  27540. var m = this.textLineMatrix;
  27541. m[4] = m[0] * x + m[2] * y + m[4];
  27542. m[5] = m[1] * x + m[3] * y + m[5];
  27543. },
  27544. calcTextLineMatrixAdvance: function TextState_calcTextLineMatrixAdvance(a, b, c, d, e, f) {
  27545. var font = this.font;
  27546. if (!font) {
  27547. return null;
  27548. }
  27549. var m = this.textLineMatrix;
  27550. if (!(a === m[0] && b === m[1] && c === m[2] && d === m[3])) {
  27551. return null;
  27552. }
  27553. var txDiff = e - m[4], tyDiff = f - m[5];
  27554. if (font.vertical && txDiff !== 0 || !font.vertical && tyDiff !== 0) {
  27555. return null;
  27556. }
  27557. var tx, ty, denominator = a * d - b * c;
  27558. if (font.vertical) {
  27559. tx = -tyDiff * c / denominator;
  27560. ty = tyDiff * a / denominator;
  27561. } else {
  27562. tx = txDiff * d / denominator;
  27563. ty = -txDiff * b / denominator;
  27564. }
  27565. return {
  27566. width: tx,
  27567. height: ty,
  27568. value: font.vertical ? ty : tx
  27569. };
  27570. },
  27571. calcRenderMatrix: function TextState_calcRendeMatrix(ctm) {
  27572. var tsm = [
  27573. this.fontSize * this.textHScale,
  27574. 0,
  27575. 0,
  27576. this.fontSize,
  27577. 0,
  27578. this.textRise
  27579. ];
  27580. return Util.transform(ctm, Util.transform(this.textMatrix, tsm));
  27581. },
  27582. carriageReturn: function TextState_carriageReturn() {
  27583. this.translateTextLineMatrix(0, -this.leading);
  27584. this.textMatrix = this.textLineMatrix.slice();
  27585. },
  27586. clone: function TextState_clone() {
  27587. var clone = Object.create(this);
  27588. clone.textMatrix = this.textMatrix.slice();
  27589. clone.textLineMatrix = this.textLineMatrix.slice();
  27590. clone.fontMatrix = this.fontMatrix.slice();
  27591. return clone;
  27592. }
  27593. };
  27594. return TextState;
  27595. }();
  27596. var EvalState = function EvalStateClosure() {
  27597. function EvalState() {
  27598. this.ctm = new Float32Array(IDENTITY_MATRIX);
  27599. this.font = null;
  27600. this.textRenderingMode = TextRenderingMode.FILL;
  27601. this.fillColorSpace = ColorSpace.singletons.gray;
  27602. this.strokeColorSpace = ColorSpace.singletons.gray;
  27603. }
  27604. EvalState.prototype = {
  27605. clone: function CanvasExtraState_clone() {
  27606. return Object.create(this);
  27607. }
  27608. };
  27609. return EvalState;
  27610. }();
  27611. var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() {
  27612. var getOPMap = getLookupTableFactory(function (t) {
  27613. t['w'] = {
  27614. id: OPS.setLineWidth,
  27615. numArgs: 1,
  27616. variableArgs: false
  27617. };
  27618. t['J'] = {
  27619. id: OPS.setLineCap,
  27620. numArgs: 1,
  27621. variableArgs: false
  27622. };
  27623. t['j'] = {
  27624. id: OPS.setLineJoin,
  27625. numArgs: 1,
  27626. variableArgs: false
  27627. };
  27628. t['M'] = {
  27629. id: OPS.setMiterLimit,
  27630. numArgs: 1,
  27631. variableArgs: false
  27632. };
  27633. t['d'] = {
  27634. id: OPS.setDash,
  27635. numArgs: 2,
  27636. variableArgs: false
  27637. };
  27638. t['ri'] = {
  27639. id: OPS.setRenderingIntent,
  27640. numArgs: 1,
  27641. variableArgs: false
  27642. };
  27643. t['i'] = {
  27644. id: OPS.setFlatness,
  27645. numArgs: 1,
  27646. variableArgs: false
  27647. };
  27648. t['gs'] = {
  27649. id: OPS.setGState,
  27650. numArgs: 1,
  27651. variableArgs: false
  27652. };
  27653. t['q'] = {
  27654. id: OPS.save,
  27655. numArgs: 0,
  27656. variableArgs: false
  27657. };
  27658. t['Q'] = {
  27659. id: OPS.restore,
  27660. numArgs: 0,
  27661. variableArgs: false
  27662. };
  27663. t['cm'] = {
  27664. id: OPS.transform,
  27665. numArgs: 6,
  27666. variableArgs: false
  27667. };
  27668. t['m'] = {
  27669. id: OPS.moveTo,
  27670. numArgs: 2,
  27671. variableArgs: false
  27672. };
  27673. t['l'] = {
  27674. id: OPS.lineTo,
  27675. numArgs: 2,
  27676. variableArgs: false
  27677. };
  27678. t['c'] = {
  27679. id: OPS.curveTo,
  27680. numArgs: 6,
  27681. variableArgs: false
  27682. };
  27683. t['v'] = {
  27684. id: OPS.curveTo2,
  27685. numArgs: 4,
  27686. variableArgs: false
  27687. };
  27688. t['y'] = {
  27689. id: OPS.curveTo3,
  27690. numArgs: 4,
  27691. variableArgs: false
  27692. };
  27693. t['h'] = {
  27694. id: OPS.closePath,
  27695. numArgs: 0,
  27696. variableArgs: false
  27697. };
  27698. t['re'] = {
  27699. id: OPS.rectangle,
  27700. numArgs: 4,
  27701. variableArgs: false
  27702. };
  27703. t['S'] = {
  27704. id: OPS.stroke,
  27705. numArgs: 0,
  27706. variableArgs: false
  27707. };
  27708. t['s'] = {
  27709. id: OPS.closeStroke,
  27710. numArgs: 0,
  27711. variableArgs: false
  27712. };
  27713. t['f'] = {
  27714. id: OPS.fill,
  27715. numArgs: 0,
  27716. variableArgs: false
  27717. };
  27718. t['F'] = {
  27719. id: OPS.fill,
  27720. numArgs: 0,
  27721. variableArgs: false
  27722. };
  27723. t['f*'] = {
  27724. id: OPS.eoFill,
  27725. numArgs: 0,
  27726. variableArgs: false
  27727. };
  27728. t['B'] = {
  27729. id: OPS.fillStroke,
  27730. numArgs: 0,
  27731. variableArgs: false
  27732. };
  27733. t['B*'] = {
  27734. id: OPS.eoFillStroke,
  27735. numArgs: 0,
  27736. variableArgs: false
  27737. };
  27738. t['b'] = {
  27739. id: OPS.closeFillStroke,
  27740. numArgs: 0,
  27741. variableArgs: false
  27742. };
  27743. t['b*'] = {
  27744. id: OPS.closeEOFillStroke,
  27745. numArgs: 0,
  27746. variableArgs: false
  27747. };
  27748. t['n'] = {
  27749. id: OPS.endPath,
  27750. numArgs: 0,
  27751. variableArgs: false
  27752. };
  27753. t['W'] = {
  27754. id: OPS.clip,
  27755. numArgs: 0,
  27756. variableArgs: false
  27757. };
  27758. t['W*'] = {
  27759. id: OPS.eoClip,
  27760. numArgs: 0,
  27761. variableArgs: false
  27762. };
  27763. t['BT'] = {
  27764. id: OPS.beginText,
  27765. numArgs: 0,
  27766. variableArgs: false
  27767. };
  27768. t['ET'] = {
  27769. id: OPS.endText,
  27770. numArgs: 0,
  27771. variableArgs: false
  27772. };
  27773. t['Tc'] = {
  27774. id: OPS.setCharSpacing,
  27775. numArgs: 1,
  27776. variableArgs: false
  27777. };
  27778. t['Tw'] = {
  27779. id: OPS.setWordSpacing,
  27780. numArgs: 1,
  27781. variableArgs: false
  27782. };
  27783. t['Tz'] = {
  27784. id: OPS.setHScale,
  27785. numArgs: 1,
  27786. variableArgs: false
  27787. };
  27788. t['TL'] = {
  27789. id: OPS.setLeading,
  27790. numArgs: 1,
  27791. variableArgs: false
  27792. };
  27793. t['Tf'] = {
  27794. id: OPS.setFont,
  27795. numArgs: 2,
  27796. variableArgs: false
  27797. };
  27798. t['Tr'] = {
  27799. id: OPS.setTextRenderingMode,
  27800. numArgs: 1,
  27801. variableArgs: false
  27802. };
  27803. t['Ts'] = {
  27804. id: OPS.setTextRise,
  27805. numArgs: 1,
  27806. variableArgs: false
  27807. };
  27808. t['Td'] = {
  27809. id: OPS.moveText,
  27810. numArgs: 2,
  27811. variableArgs: false
  27812. };
  27813. t['TD'] = {
  27814. id: OPS.setLeadingMoveText,
  27815. numArgs: 2,
  27816. variableArgs: false
  27817. };
  27818. t['Tm'] = {
  27819. id: OPS.setTextMatrix,
  27820. numArgs: 6,
  27821. variableArgs: false
  27822. };
  27823. t['T*'] = {
  27824. id: OPS.nextLine,
  27825. numArgs: 0,
  27826. variableArgs: false
  27827. };
  27828. t['Tj'] = {
  27829. id: OPS.showText,
  27830. numArgs: 1,
  27831. variableArgs: false
  27832. };
  27833. t['TJ'] = {
  27834. id: OPS.showSpacedText,
  27835. numArgs: 1,
  27836. variableArgs: false
  27837. };
  27838. t['\''] = {
  27839. id: OPS.nextLineShowText,
  27840. numArgs: 1,
  27841. variableArgs: false
  27842. };
  27843. t['"'] = {
  27844. id: OPS.nextLineSetSpacingShowText,
  27845. numArgs: 3,
  27846. variableArgs: false
  27847. };
  27848. t['d0'] = {
  27849. id: OPS.setCharWidth,
  27850. numArgs: 2,
  27851. variableArgs: false
  27852. };
  27853. t['d1'] = {
  27854. id: OPS.setCharWidthAndBounds,
  27855. numArgs: 6,
  27856. variableArgs: false
  27857. };
  27858. t['CS'] = {
  27859. id: OPS.setStrokeColorSpace,
  27860. numArgs: 1,
  27861. variableArgs: false
  27862. };
  27863. t['cs'] = {
  27864. id: OPS.setFillColorSpace,
  27865. numArgs: 1,
  27866. variableArgs: false
  27867. };
  27868. t['SC'] = {
  27869. id: OPS.setStrokeColor,
  27870. numArgs: 4,
  27871. variableArgs: true
  27872. };
  27873. t['SCN'] = {
  27874. id: OPS.setStrokeColorN,
  27875. numArgs: 33,
  27876. variableArgs: true
  27877. };
  27878. t['sc'] = {
  27879. id: OPS.setFillColor,
  27880. numArgs: 4,
  27881. variableArgs: true
  27882. };
  27883. t['scn'] = {
  27884. id: OPS.setFillColorN,
  27885. numArgs: 33,
  27886. variableArgs: true
  27887. };
  27888. t['G'] = {
  27889. id: OPS.setStrokeGray,
  27890. numArgs: 1,
  27891. variableArgs: false
  27892. };
  27893. t['g'] = {
  27894. id: OPS.setFillGray,
  27895. numArgs: 1,
  27896. variableArgs: false
  27897. };
  27898. t['RG'] = {
  27899. id: OPS.setStrokeRGBColor,
  27900. numArgs: 3,
  27901. variableArgs: false
  27902. };
  27903. t['rg'] = {
  27904. id: OPS.setFillRGBColor,
  27905. numArgs: 3,
  27906. variableArgs: false
  27907. };
  27908. t['K'] = {
  27909. id: OPS.setStrokeCMYKColor,
  27910. numArgs: 4,
  27911. variableArgs: false
  27912. };
  27913. t['k'] = {
  27914. id: OPS.setFillCMYKColor,
  27915. numArgs: 4,
  27916. variableArgs: false
  27917. };
  27918. t['sh'] = {
  27919. id: OPS.shadingFill,
  27920. numArgs: 1,
  27921. variableArgs: false
  27922. };
  27923. t['BI'] = {
  27924. id: OPS.beginInlineImage,
  27925. numArgs: 0,
  27926. variableArgs: false
  27927. };
  27928. t['ID'] = {
  27929. id: OPS.beginImageData,
  27930. numArgs: 0,
  27931. variableArgs: false
  27932. };
  27933. t['EI'] = {
  27934. id: OPS.endInlineImage,
  27935. numArgs: 1,
  27936. variableArgs: false
  27937. };
  27938. t['Do'] = {
  27939. id: OPS.paintXObject,
  27940. numArgs: 1,
  27941. variableArgs: false
  27942. };
  27943. t['MP'] = {
  27944. id: OPS.markPoint,
  27945. numArgs: 1,
  27946. variableArgs: false
  27947. };
  27948. t['DP'] = {
  27949. id: OPS.markPointProps,
  27950. numArgs: 2,
  27951. variableArgs: false
  27952. };
  27953. t['BMC'] = {
  27954. id: OPS.beginMarkedContent,
  27955. numArgs: 1,
  27956. variableArgs: false
  27957. };
  27958. t['BDC'] = {
  27959. id: OPS.beginMarkedContentProps,
  27960. numArgs: 2,
  27961. variableArgs: false
  27962. };
  27963. t['EMC'] = {
  27964. id: OPS.endMarkedContent,
  27965. numArgs: 0,
  27966. variableArgs: false
  27967. };
  27968. t['BX'] = {
  27969. id: OPS.beginCompat,
  27970. numArgs: 0,
  27971. variableArgs: false
  27972. };
  27973. t['EX'] = {
  27974. id: OPS.endCompat,
  27975. numArgs: 0,
  27976. variableArgs: false
  27977. };
  27978. t['BM'] = null;
  27979. t['BD'] = null;
  27980. t['true'] = null;
  27981. t['fa'] = null;
  27982. t['fal'] = null;
  27983. t['fals'] = null;
  27984. t['false'] = null;
  27985. t['nu'] = null;
  27986. t['nul'] = null;
  27987. t['null'] = null;
  27988. });
  27989. function EvaluatorPreprocessor(stream, xref, stateManager) {
  27990. this.opMap = getOPMap();
  27991. this.parser = new Parser(new Lexer(stream, this.opMap), false, xref);
  27992. this.stateManager = stateManager;
  27993. this.nonProcessedArgs = [];
  27994. }
  27995. EvaluatorPreprocessor.prototype = {
  27996. get savedStatesDepth() {
  27997. return this.stateManager.stateStack.length;
  27998. },
  27999. read: function EvaluatorPreprocessor_read(operation) {
  28000. var args = operation.args;
  28001. while (true) {
  28002. var obj = this.parser.getObj();
  28003. if (isCmd(obj)) {
  28004. var cmd = obj.cmd;
  28005. var opSpec = this.opMap[cmd];
  28006. if (!opSpec) {
  28007. warn('Unknown command "' + cmd + '"');
  28008. continue;
  28009. }
  28010. var fn = opSpec.id;
  28011. var numArgs = opSpec.numArgs;
  28012. var argsLength = args !== null ? args.length : 0;
  28013. if (!opSpec.variableArgs) {
  28014. if (argsLength !== numArgs) {
  28015. var nonProcessedArgs = this.nonProcessedArgs;
  28016. while (argsLength > numArgs) {
  28017. nonProcessedArgs.push(args.shift());
  28018. argsLength--;
  28019. }
  28020. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  28021. if (args === null) {
  28022. args = [];
  28023. }
  28024. args.unshift(nonProcessedArgs.pop());
  28025. argsLength++;
  28026. }
  28027. }
  28028. if (argsLength < numArgs) {
  28029. warn('Skipping command ' + fn + ': expected ' + numArgs + ' args, but received ' + argsLength + ' args.');
  28030. if (args !== null) {
  28031. args.length = 0;
  28032. }
  28033. continue;
  28034. }
  28035. } else if (argsLength > numArgs) {
  28036. info('Command ' + fn + ': expected [0,' + numArgs + '] args, but received ' + argsLength + ' args.');
  28037. }
  28038. this.preprocessCommand(fn, args);
  28039. operation.fn = fn;
  28040. operation.args = args;
  28041. return true;
  28042. }
  28043. if (isEOF(obj)) {
  28044. return false;
  28045. }
  28046. if (obj !== null) {
  28047. if (args === null) {
  28048. args = [];
  28049. }
  28050. args.push(obj);
  28051. assert(args.length <= 33, 'Too many arguments');
  28052. }
  28053. }
  28054. },
  28055. preprocessCommand: function EvaluatorPreprocessor_preprocessCommand(fn, args) {
  28056. switch (fn | 0) {
  28057. case OPS.save:
  28058. this.stateManager.save();
  28059. break;
  28060. case OPS.restore:
  28061. this.stateManager.restore();
  28062. break;
  28063. case OPS.transform:
  28064. this.stateManager.transform(args);
  28065. break;
  28066. }
  28067. }
  28068. };
  28069. return EvaluatorPreprocessor;
  28070. }();
  28071. var QueueOptimizer = function QueueOptimizerClosure() {
  28072. function addState(parentState, pattern, fn) {
  28073. var state = parentState;
  28074. for (var i = 0, ii = pattern.length - 1; i < ii; i++) {
  28075. var item = pattern[i];
  28076. state = state[item] || (state[item] = []);
  28077. }
  28078. state[pattern[pattern.length - 1]] = fn;
  28079. }
  28080. function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) {
  28081. var iFirstPIMXO = iFirstSave + 2;
  28082. for (var i = 0; i < count; i++) {
  28083. var arg = argsArray[iFirstPIMXO + 4 * i];
  28084. var imageMask = arg.length === 1 && arg[0];
  28085. if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) {
  28086. fnArray[iFirstPIMXO + 4 * i] = OPS.paintSolidColorImageMask;
  28087. continue;
  28088. }
  28089. break;
  28090. }
  28091. return count - i;
  28092. }
  28093. var InitialState = [];
  28094. addState(InitialState, [
  28095. OPS.save,
  28096. OPS.transform,
  28097. OPS.paintInlineImageXObject,
  28098. OPS.restore
  28099. ], function foundInlineImageGroup(context) {
  28100. var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  28101. var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  28102. var MAX_WIDTH = 1000;
  28103. var IMAGE_PADDING = 1;
  28104. var fnArray = context.fnArray, argsArray = context.argsArray;
  28105. var curr = context.iCurr;
  28106. var iFirstSave = curr - 3;
  28107. var iFirstTransform = curr - 2;
  28108. var iFirstPIIXO = curr - 1;
  28109. var i = iFirstSave + 4;
  28110. var ii = fnArray.length;
  28111. while (i + 3 < ii) {
  28112. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintInlineImageXObject || fnArray[i + 3] !== OPS.restore) {
  28113. break;
  28114. }
  28115. i += 4;
  28116. }
  28117. var count = Math.min((i - iFirstSave) / 4, MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  28118. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  28119. return i;
  28120. }
  28121. var maxX = 0;
  28122. var map = [], maxLineHeight = 0;
  28123. var currentX = IMAGE_PADDING, currentY = IMAGE_PADDING;
  28124. var q;
  28125. for (q = 0; q < count; q++) {
  28126. var transform = argsArray[iFirstTransform + (q << 2)];
  28127. var img = argsArray[iFirstPIIXO + (q << 2)][0];
  28128. if (currentX + img.width > MAX_WIDTH) {
  28129. maxX = Math.max(maxX, currentX);
  28130. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  28131. currentX = 0;
  28132. maxLineHeight = 0;
  28133. }
  28134. map.push({
  28135. transform: transform,
  28136. x: currentX,
  28137. y: currentY,
  28138. w: img.width,
  28139. h: img.height
  28140. });
  28141. currentX += img.width + 2 * IMAGE_PADDING;
  28142. maxLineHeight = Math.max(maxLineHeight, img.height);
  28143. }
  28144. var imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  28145. var imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  28146. var imgData = new Uint8Array(imgWidth * imgHeight * 4);
  28147. var imgRowSize = imgWidth << 2;
  28148. for (q = 0; q < count; q++) {
  28149. var data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  28150. var rowSize = map[q].w << 2;
  28151. var dataOffset = 0;
  28152. var offset = map[q].x + map[q].y * imgWidth << 2;
  28153. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  28154. for (var k = 0, kk = map[q].h; k < kk; k++) {
  28155. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  28156. dataOffset += rowSize;
  28157. offset += imgRowSize;
  28158. }
  28159. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  28160. while (offset >= 0) {
  28161. data[offset - 4] = data[offset];
  28162. data[offset - 3] = data[offset + 1];
  28163. data[offset - 2] = data[offset + 2];
  28164. data[offset - 1] = data[offset + 3];
  28165. data[offset + rowSize] = data[offset + rowSize - 4];
  28166. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  28167. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  28168. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  28169. offset -= imgRowSize;
  28170. }
  28171. }
  28172. fnArray.splice(iFirstSave, count * 4, OPS.paintInlineImageXObjectGroup);
  28173. argsArray.splice(iFirstSave, count * 4, [
  28174. {
  28175. width: imgWidth,
  28176. height: imgHeight,
  28177. kind: ImageKind.RGBA_32BPP,
  28178. data: imgData
  28179. },
  28180. map
  28181. ]);
  28182. return iFirstSave + 1;
  28183. });
  28184. addState(InitialState, [
  28185. OPS.save,
  28186. OPS.transform,
  28187. OPS.paintImageMaskXObject,
  28188. OPS.restore
  28189. ], function foundImageMaskGroup(context) {
  28190. var MIN_IMAGES_IN_MASKS_BLOCK = 10;
  28191. var MAX_IMAGES_IN_MASKS_BLOCK = 100;
  28192. var MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  28193. var fnArray = context.fnArray, argsArray = context.argsArray;
  28194. var curr = context.iCurr;
  28195. var iFirstSave = curr - 3;
  28196. var iFirstTransform = curr - 2;
  28197. var iFirstPIMXO = curr - 1;
  28198. var i = iFirstSave + 4;
  28199. var ii = fnArray.length;
  28200. while (i + 3 < ii) {
  28201. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintImageMaskXObject || fnArray[i + 3] !== OPS.restore) {
  28202. break;
  28203. }
  28204. i += 4;
  28205. }
  28206. var count = (i - iFirstSave) / 4;
  28207. count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray);
  28208. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  28209. return i;
  28210. }
  28211. var q;
  28212. var isSameImage = false;
  28213. var iTransform, transformArgs;
  28214. var firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  28215. if (argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0) {
  28216. isSameImage = true;
  28217. var firstTransformArg0 = argsArray[iFirstTransform][0];
  28218. var firstTransformArg3 = argsArray[iFirstTransform][3];
  28219. iTransform = iFirstTransform + 4;
  28220. var iPIMXO = iFirstPIMXO + 4;
  28221. for (q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  28222. transformArgs = argsArray[iTransform];
  28223. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== 0 || transformArgs[2] !== 0 || transformArgs[3] !== firstTransformArg3) {
  28224. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  28225. isSameImage = false;
  28226. } else {
  28227. count = q;
  28228. }
  28229. break;
  28230. }
  28231. }
  28232. }
  28233. if (isSameImage) {
  28234. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  28235. var positions = new Float32Array(count * 2);
  28236. iTransform = iFirstTransform;
  28237. for (q = 0; q < count; q++, iTransform += 4) {
  28238. transformArgs = argsArray[iTransform];
  28239. positions[q << 1] = transformArgs[4];
  28240. positions[(q << 1) + 1] = transformArgs[5];
  28241. }
  28242. fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectRepeat);
  28243. argsArray.splice(iFirstSave, count * 4, [
  28244. firstPIMXOArg0,
  28245. firstTransformArg0,
  28246. firstTransformArg3,
  28247. positions
  28248. ]);
  28249. } else {
  28250. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  28251. var images = [];
  28252. for (q = 0; q < count; q++) {
  28253. transformArgs = argsArray[iFirstTransform + (q << 2)];
  28254. var maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  28255. images.push({
  28256. data: maskParams.data,
  28257. width: maskParams.width,
  28258. height: maskParams.height,
  28259. transform: transformArgs
  28260. });
  28261. }
  28262. fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectGroup);
  28263. argsArray.splice(iFirstSave, count * 4, [images]);
  28264. }
  28265. return iFirstSave + 1;
  28266. });
  28267. addState(InitialState, [
  28268. OPS.save,
  28269. OPS.transform,
  28270. OPS.paintImageXObject,
  28271. OPS.restore
  28272. ], function (context) {
  28273. var MIN_IMAGES_IN_BLOCK = 3;
  28274. var MAX_IMAGES_IN_BLOCK = 1000;
  28275. var fnArray = context.fnArray, argsArray = context.argsArray;
  28276. var curr = context.iCurr;
  28277. var iFirstSave = curr - 3;
  28278. var iFirstTransform = curr - 2;
  28279. var iFirstPIXO = curr - 1;
  28280. var iFirstRestore = curr;
  28281. if (argsArray[iFirstTransform][1] !== 0 || argsArray[iFirstTransform][2] !== 0) {
  28282. return iFirstRestore + 1;
  28283. }
  28284. var firstPIXOArg0 = argsArray[iFirstPIXO][0];
  28285. var firstTransformArg0 = argsArray[iFirstTransform][0];
  28286. var firstTransformArg3 = argsArray[iFirstTransform][3];
  28287. var i = iFirstSave + 4;
  28288. var ii = fnArray.length;
  28289. while (i + 3 < ii) {
  28290. if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintImageXObject || fnArray[i + 3] !== OPS.restore) {
  28291. break;
  28292. }
  28293. if (argsArray[i + 1][0] !== firstTransformArg0 || argsArray[i + 1][1] !== 0 || argsArray[i + 1][2] !== 0 || argsArray[i + 1][3] !== firstTransformArg3) {
  28294. break;
  28295. }
  28296. if (argsArray[i + 2][0] !== firstPIXOArg0) {
  28297. break;
  28298. }
  28299. i += 4;
  28300. }
  28301. var count = Math.min((i - iFirstSave) / 4, MAX_IMAGES_IN_BLOCK);
  28302. if (count < MIN_IMAGES_IN_BLOCK) {
  28303. return i;
  28304. }
  28305. var positions = new Float32Array(count * 2);
  28306. var iTransform = iFirstTransform;
  28307. for (var q = 0; q < count; q++, iTransform += 4) {
  28308. var transformArgs = argsArray[iTransform];
  28309. positions[q << 1] = transformArgs[4];
  28310. positions[(q << 1) + 1] = transformArgs[5];
  28311. }
  28312. var args = [
  28313. firstPIXOArg0,
  28314. firstTransformArg0,
  28315. firstTransformArg3,
  28316. positions
  28317. ];
  28318. fnArray.splice(iFirstSave, count * 4, OPS.paintImageXObjectRepeat);
  28319. argsArray.splice(iFirstSave, count * 4, args);
  28320. return iFirstSave + 1;
  28321. });
  28322. addState(InitialState, [
  28323. OPS.beginText,
  28324. OPS.setFont,
  28325. OPS.setTextMatrix,
  28326. OPS.showText,
  28327. OPS.endText
  28328. ], function (context) {
  28329. var MIN_CHARS_IN_BLOCK = 3;
  28330. var MAX_CHARS_IN_BLOCK = 1000;
  28331. var fnArray = context.fnArray, argsArray = context.argsArray;
  28332. var curr = context.iCurr;
  28333. var iFirstBeginText = curr - 4;
  28334. var iFirstSetFont = curr - 3;
  28335. var iFirstSetTextMatrix = curr - 2;
  28336. var iFirstShowText = curr - 1;
  28337. var iFirstEndText = curr;
  28338. var firstSetFontArg0 = argsArray[iFirstSetFont][0];
  28339. var firstSetFontArg1 = argsArray[iFirstSetFont][1];
  28340. var i = iFirstBeginText + 5;
  28341. var ii = fnArray.length;
  28342. while (i + 4 < ii) {
  28343. 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) {
  28344. break;
  28345. }
  28346. if (argsArray[i + 1][0] !== firstSetFontArg0 || argsArray[i + 1][1] !== firstSetFontArg1) {
  28347. break;
  28348. }
  28349. i += 5;
  28350. }
  28351. var count = Math.min((i - iFirstBeginText) / 5, MAX_CHARS_IN_BLOCK);
  28352. if (count < MIN_CHARS_IN_BLOCK) {
  28353. return i;
  28354. }
  28355. var iFirst = iFirstBeginText;
  28356. 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) {
  28357. count++;
  28358. iFirst -= 5;
  28359. }
  28360. var iEndText = iFirst + 4;
  28361. for (var q = 1; q < count; q++) {
  28362. fnArray.splice(iEndText, 3);
  28363. argsArray.splice(iEndText, 3);
  28364. iEndText += 2;
  28365. }
  28366. return iEndText + 1;
  28367. });
  28368. function QueueOptimizer() {
  28369. }
  28370. QueueOptimizer.prototype = {
  28371. optimize: function QueueOptimizer_optimize(queue) {
  28372. var fnArray = queue.fnArray, argsArray = queue.argsArray;
  28373. var context = {
  28374. iCurr: 0,
  28375. fnArray: fnArray,
  28376. argsArray: argsArray
  28377. };
  28378. var state;
  28379. var i = 0, ii = fnArray.length;
  28380. while (i < ii) {
  28381. state = (state || InitialState)[fnArray[i]];
  28382. if (typeof state === 'function') {
  28383. context.iCurr = i;
  28384. i = state(context);
  28385. state = undefined;
  28386. ii = context.fnArray.length;
  28387. } else {
  28388. i++;
  28389. }
  28390. }
  28391. }
  28392. };
  28393. return QueueOptimizer;
  28394. }();
  28395. exports.OperatorList = OperatorList;
  28396. exports.PartialEvaluator = PartialEvaluator;
  28397. /***/ }),
  28398. /* 15 */
  28399. /***/ (function(module, exports, __w_pdfjs_require__) {
  28400. "use strict";
  28401. var sharedUtil = __w_pdfjs_require__(0);
  28402. var coreArithmeticDecoder = __w_pdfjs_require__(10);
  28403. var info = sharedUtil.info;
  28404. var warn = sharedUtil.warn;
  28405. var error = sharedUtil.error;
  28406. var log2 = sharedUtil.log2;
  28407. var readUint16 = sharedUtil.readUint16;
  28408. var readUint32 = sharedUtil.readUint32;
  28409. var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder;
  28410. var JpxImage = function JpxImageClosure() {
  28411. var SubbandsGainLog2 = {
  28412. 'LL': 0,
  28413. 'LH': 1,
  28414. 'HL': 1,
  28415. 'HH': 2
  28416. };
  28417. function JpxImage() {
  28418. this.failOnCorruptedImage = false;
  28419. }
  28420. JpxImage.prototype = {
  28421. parse: function JpxImage_parse(data) {
  28422. var head = readUint16(data, 0);
  28423. if (head === 0xFF4F) {
  28424. this.parseCodestream(data, 0, data.length);
  28425. return;
  28426. }
  28427. var position = 0, length = data.length;
  28428. while (position < length) {
  28429. var headerSize = 8;
  28430. var lbox = readUint32(data, position);
  28431. var tbox = readUint32(data, position + 4);
  28432. position += headerSize;
  28433. if (lbox === 1) {
  28434. lbox = readUint32(data, position) * 4294967296 + readUint32(data, position + 4);
  28435. position += 8;
  28436. headerSize += 8;
  28437. }
  28438. if (lbox === 0) {
  28439. lbox = length - position + headerSize;
  28440. }
  28441. if (lbox < headerSize) {
  28442. error('JPX Error: Invalid box field size');
  28443. }
  28444. var dataLength = lbox - headerSize;
  28445. var jumpDataLength = true;
  28446. switch (tbox) {
  28447. case 0x6A703268:
  28448. jumpDataLength = false;
  28449. break;
  28450. case 0x636F6C72:
  28451. var method = data[position];
  28452. if (method === 1) {
  28453. var colorspace = readUint32(data, position + 3);
  28454. switch (colorspace) {
  28455. case 16:
  28456. case 17:
  28457. case 18:
  28458. break;
  28459. default:
  28460. warn('Unknown colorspace ' + colorspace);
  28461. break;
  28462. }
  28463. } else if (method === 2) {
  28464. info('ICC profile not supported');
  28465. }
  28466. break;
  28467. case 0x6A703263:
  28468. this.parseCodestream(data, position, position + dataLength);
  28469. break;
  28470. case 0x6A502020:
  28471. if (readUint32(data, position) !== 0x0d0a870a) {
  28472. warn('Invalid JP2 signature');
  28473. }
  28474. break;
  28475. case 0x6A501A1A:
  28476. case 0x66747970:
  28477. case 0x72726571:
  28478. case 0x72657320:
  28479. case 0x69686472:
  28480. break;
  28481. default:
  28482. var headerType = String.fromCharCode(tbox >> 24 & 0xFF, tbox >> 16 & 0xFF, tbox >> 8 & 0xFF, tbox & 0xFF);
  28483. warn('Unsupported header type ' + tbox + ' (' + headerType + ')');
  28484. break;
  28485. }
  28486. if (jumpDataLength) {
  28487. position += dataLength;
  28488. }
  28489. }
  28490. },
  28491. parseImageProperties: function JpxImage_parseImageProperties(stream) {
  28492. var newByte = stream.getByte();
  28493. while (newByte >= 0) {
  28494. var oldByte = newByte;
  28495. newByte = stream.getByte();
  28496. var code = oldByte << 8 | newByte;
  28497. if (code === 0xFF51) {
  28498. stream.skip(4);
  28499. var Xsiz = stream.getInt32() >>> 0;
  28500. var Ysiz = stream.getInt32() >>> 0;
  28501. var XOsiz = stream.getInt32() >>> 0;
  28502. var YOsiz = stream.getInt32() >>> 0;
  28503. stream.skip(16);
  28504. var Csiz = stream.getUint16();
  28505. this.width = Xsiz - XOsiz;
  28506. this.height = Ysiz - YOsiz;
  28507. this.componentsCount = Csiz;
  28508. this.bitsPerComponent = 8;
  28509. return;
  28510. }
  28511. }
  28512. error('JPX Error: No size marker found in JPX stream');
  28513. },
  28514. parseCodestream: function JpxImage_parseCodestream(data, start, end) {
  28515. var context = {};
  28516. var doNotRecover = false;
  28517. try {
  28518. var position = start;
  28519. while (position + 1 < end) {
  28520. var code = readUint16(data, position);
  28521. position += 2;
  28522. var length = 0, j, sqcd, spqcds, spqcdSize, scalarExpounded, tile;
  28523. switch (code) {
  28524. case 0xFF4F:
  28525. context.mainHeader = true;
  28526. break;
  28527. case 0xFFD9:
  28528. break;
  28529. case 0xFF51:
  28530. length = readUint16(data, position);
  28531. var siz = {};
  28532. siz.Xsiz = readUint32(data, position + 4);
  28533. siz.Ysiz = readUint32(data, position + 8);
  28534. siz.XOsiz = readUint32(data, position + 12);
  28535. siz.YOsiz = readUint32(data, position + 16);
  28536. siz.XTsiz = readUint32(data, position + 20);
  28537. siz.YTsiz = readUint32(data, position + 24);
  28538. siz.XTOsiz = readUint32(data, position + 28);
  28539. siz.YTOsiz = readUint32(data, position + 32);
  28540. var componentsCount = readUint16(data, position + 36);
  28541. siz.Csiz = componentsCount;
  28542. var components = [];
  28543. j = position + 38;
  28544. for (var i = 0; i < componentsCount; i++) {
  28545. var component = {
  28546. precision: (data[j] & 0x7F) + 1,
  28547. isSigned: !!(data[j] & 0x80),
  28548. XRsiz: data[j + 1],
  28549. YRsiz: data[j + 1]
  28550. };
  28551. calculateComponentDimensions(component, siz);
  28552. components.push(component);
  28553. }
  28554. context.SIZ = siz;
  28555. context.components = components;
  28556. calculateTileGrids(context, components);
  28557. context.QCC = [];
  28558. context.COC = [];
  28559. break;
  28560. case 0xFF5C:
  28561. length = readUint16(data, position);
  28562. var qcd = {};
  28563. j = position + 2;
  28564. sqcd = data[j++];
  28565. switch (sqcd & 0x1F) {
  28566. case 0:
  28567. spqcdSize = 8;
  28568. scalarExpounded = true;
  28569. break;
  28570. case 1:
  28571. spqcdSize = 16;
  28572. scalarExpounded = false;
  28573. break;
  28574. case 2:
  28575. spqcdSize = 16;
  28576. scalarExpounded = true;
  28577. break;
  28578. default:
  28579. throw new Error('Invalid SQcd value ' + sqcd);
  28580. }
  28581. qcd.noQuantization = spqcdSize === 8;
  28582. qcd.scalarExpounded = scalarExpounded;
  28583. qcd.guardBits = sqcd >> 5;
  28584. spqcds = [];
  28585. while (j < length + position) {
  28586. var spqcd = {};
  28587. if (spqcdSize === 8) {
  28588. spqcd.epsilon = data[j++] >> 3;
  28589. spqcd.mu = 0;
  28590. } else {
  28591. spqcd.epsilon = data[j] >> 3;
  28592. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  28593. j += 2;
  28594. }
  28595. spqcds.push(spqcd);
  28596. }
  28597. qcd.SPqcds = spqcds;
  28598. if (context.mainHeader) {
  28599. context.QCD = qcd;
  28600. } else {
  28601. context.currentTile.QCD = qcd;
  28602. context.currentTile.QCC = [];
  28603. }
  28604. break;
  28605. case 0xFF5D:
  28606. length = readUint16(data, position);
  28607. var qcc = {};
  28608. j = position + 2;
  28609. var cqcc;
  28610. if (context.SIZ.Csiz < 257) {
  28611. cqcc = data[j++];
  28612. } else {
  28613. cqcc = readUint16(data, j);
  28614. j += 2;
  28615. }
  28616. sqcd = data[j++];
  28617. switch (sqcd & 0x1F) {
  28618. case 0:
  28619. spqcdSize = 8;
  28620. scalarExpounded = true;
  28621. break;
  28622. case 1:
  28623. spqcdSize = 16;
  28624. scalarExpounded = false;
  28625. break;
  28626. case 2:
  28627. spqcdSize = 16;
  28628. scalarExpounded = true;
  28629. break;
  28630. default:
  28631. throw new Error('Invalid SQcd value ' + sqcd);
  28632. }
  28633. qcc.noQuantization = spqcdSize === 8;
  28634. qcc.scalarExpounded = scalarExpounded;
  28635. qcc.guardBits = sqcd >> 5;
  28636. spqcds = [];
  28637. while (j < length + position) {
  28638. spqcd = {};
  28639. if (spqcdSize === 8) {
  28640. spqcd.epsilon = data[j++] >> 3;
  28641. spqcd.mu = 0;
  28642. } else {
  28643. spqcd.epsilon = data[j] >> 3;
  28644. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  28645. j += 2;
  28646. }
  28647. spqcds.push(spqcd);
  28648. }
  28649. qcc.SPqcds = spqcds;
  28650. if (context.mainHeader) {
  28651. context.QCC[cqcc] = qcc;
  28652. } else {
  28653. context.currentTile.QCC[cqcc] = qcc;
  28654. }
  28655. break;
  28656. case 0xFF52:
  28657. length = readUint16(data, position);
  28658. var cod = {};
  28659. j = position + 2;
  28660. var scod = data[j++];
  28661. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  28662. cod.sopMarkerUsed = !!(scod & 2);
  28663. cod.ephMarkerUsed = !!(scod & 4);
  28664. cod.progressionOrder = data[j++];
  28665. cod.layersCount = readUint16(data, j);
  28666. j += 2;
  28667. cod.multipleComponentTransform = data[j++];
  28668. cod.decompositionLevelsCount = data[j++];
  28669. cod.xcb = (data[j++] & 0xF) + 2;
  28670. cod.ycb = (data[j++] & 0xF) + 2;
  28671. var blockStyle = data[j++];
  28672. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  28673. cod.resetContextProbabilities = !!(blockStyle & 2);
  28674. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  28675. cod.verticalyStripe = !!(blockStyle & 8);
  28676. cod.predictableTermination = !!(blockStyle & 16);
  28677. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  28678. cod.reversibleTransformation = data[j++];
  28679. if (cod.entropyCoderWithCustomPrecincts) {
  28680. var precinctsSizes = [];
  28681. while (j < length + position) {
  28682. var precinctsSize = data[j++];
  28683. precinctsSizes.push({
  28684. PPx: precinctsSize & 0xF,
  28685. PPy: precinctsSize >> 4
  28686. });
  28687. }
  28688. cod.precinctsSizes = precinctsSizes;
  28689. }
  28690. var unsupported = [];
  28691. if (cod.selectiveArithmeticCodingBypass) {
  28692. unsupported.push('selectiveArithmeticCodingBypass');
  28693. }
  28694. if (cod.resetContextProbabilities) {
  28695. unsupported.push('resetContextProbabilities');
  28696. }
  28697. if (cod.terminationOnEachCodingPass) {
  28698. unsupported.push('terminationOnEachCodingPass');
  28699. }
  28700. if (cod.verticalyStripe) {
  28701. unsupported.push('verticalyStripe');
  28702. }
  28703. if (cod.predictableTermination) {
  28704. unsupported.push('predictableTermination');
  28705. }
  28706. if (unsupported.length > 0) {
  28707. doNotRecover = true;
  28708. throw new Error('Unsupported COD options (' + unsupported.join(', ') + ')');
  28709. }
  28710. if (context.mainHeader) {
  28711. context.COD = cod;
  28712. } else {
  28713. context.currentTile.COD = cod;
  28714. context.currentTile.COC = [];
  28715. }
  28716. break;
  28717. case 0xFF90:
  28718. length = readUint16(data, position);
  28719. tile = {};
  28720. tile.index = readUint16(data, position + 2);
  28721. tile.length = readUint32(data, position + 4);
  28722. tile.dataEnd = tile.length + position - 2;
  28723. tile.partIndex = data[position + 8];
  28724. tile.partsCount = data[position + 9];
  28725. context.mainHeader = false;
  28726. if (tile.partIndex === 0) {
  28727. tile.COD = context.COD;
  28728. tile.COC = context.COC.slice(0);
  28729. tile.QCD = context.QCD;
  28730. tile.QCC = context.QCC.slice(0);
  28731. }
  28732. context.currentTile = tile;
  28733. break;
  28734. case 0xFF93:
  28735. tile = context.currentTile;
  28736. if (tile.partIndex === 0) {
  28737. initializeTile(context, tile.index);
  28738. buildPackets(context);
  28739. }
  28740. length = tile.dataEnd - position;
  28741. parseTilePackets(context, data, position, length);
  28742. break;
  28743. case 0xFF55:
  28744. case 0xFF57:
  28745. case 0xFF58:
  28746. case 0xFF64:
  28747. length = readUint16(data, position);
  28748. break;
  28749. case 0xFF53:
  28750. throw new Error('Codestream code 0xFF53 (COC) is ' + 'not implemented');
  28751. default:
  28752. throw new Error('Unknown codestream code: ' + code.toString(16));
  28753. }
  28754. position += length;
  28755. }
  28756. } catch (e) {
  28757. if (doNotRecover || this.failOnCorruptedImage) {
  28758. error('JPX Error: ' + e.message);
  28759. } else {
  28760. warn('JPX: Trying to recover from: ' + e.message);
  28761. }
  28762. }
  28763. this.tiles = transformComponents(context);
  28764. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  28765. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  28766. this.componentsCount = context.SIZ.Csiz;
  28767. }
  28768. };
  28769. function calculateComponentDimensions(component, siz) {
  28770. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  28771. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  28772. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  28773. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  28774. component.width = component.x1 - component.x0;
  28775. component.height = component.y1 - component.y0;
  28776. }
  28777. function calculateTileGrids(context, components) {
  28778. var siz = context.SIZ;
  28779. var tile, tiles = [];
  28780. var numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  28781. var numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  28782. for (var q = 0; q < numYtiles; q++) {
  28783. for (var p = 0; p < numXtiles; p++) {
  28784. tile = {};
  28785. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  28786. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  28787. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  28788. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  28789. tile.width = tile.tx1 - tile.tx0;
  28790. tile.height = tile.ty1 - tile.ty0;
  28791. tile.components = [];
  28792. tiles.push(tile);
  28793. }
  28794. }
  28795. context.tiles = tiles;
  28796. var componentsCount = siz.Csiz;
  28797. for (var i = 0, ii = componentsCount; i < ii; i++) {
  28798. var component = components[i];
  28799. for (var j = 0, jj = tiles.length; j < jj; j++) {
  28800. var tileComponent = {};
  28801. tile = tiles[j];
  28802. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  28803. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  28804. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  28805. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  28806. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  28807. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  28808. tile.components[i] = tileComponent;
  28809. }
  28810. }
  28811. }
  28812. function getBlocksDimensions(context, component, r) {
  28813. var codOrCoc = component.codingStyleParameters;
  28814. var result = {};
  28815. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  28816. result.PPx = 15;
  28817. result.PPy = 15;
  28818. } else {
  28819. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  28820. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  28821. }
  28822. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  28823. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  28824. return result;
  28825. }
  28826. function buildPrecincts(context, resolution, dimensions) {
  28827. var precinctWidth = 1 << dimensions.PPx;
  28828. var precinctHeight = 1 << dimensions.PPy;
  28829. var isZeroRes = resolution.resLevel === 0;
  28830. var precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  28831. var precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  28832. var numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  28833. var numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  28834. var numprecincts = numprecinctswide * numprecinctshigh;
  28835. resolution.precinctParameters = {
  28836. precinctWidth: precinctWidth,
  28837. precinctHeight: precinctHeight,
  28838. numprecinctswide: numprecinctswide,
  28839. numprecinctshigh: numprecinctshigh,
  28840. numprecincts: numprecincts,
  28841. precinctWidthInSubband: precinctWidthInSubband,
  28842. precinctHeightInSubband: precinctHeightInSubband
  28843. };
  28844. }
  28845. function buildCodeblocks(context, subband, dimensions) {
  28846. var xcb_ = dimensions.xcb_;
  28847. var ycb_ = dimensions.ycb_;
  28848. var codeblockWidth = 1 << xcb_;
  28849. var codeblockHeight = 1 << ycb_;
  28850. var cbx0 = subband.tbx0 >> xcb_;
  28851. var cby0 = subband.tby0 >> ycb_;
  28852. var cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  28853. var cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  28854. var precinctParameters = subband.resolution.precinctParameters;
  28855. var codeblocks = [];
  28856. var precincts = [];
  28857. var i, j, codeblock, precinctNumber;
  28858. for (j = cby0; j < cby1; j++) {
  28859. for (i = cbx0; i < cbx1; i++) {
  28860. codeblock = {
  28861. cbx: i,
  28862. cby: j,
  28863. tbx0: codeblockWidth * i,
  28864. tby0: codeblockHeight * j,
  28865. tbx1: codeblockWidth * (i + 1),
  28866. tby1: codeblockHeight * (j + 1)
  28867. };
  28868. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  28869. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  28870. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  28871. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  28872. var pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  28873. var pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  28874. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  28875. codeblock.precinctNumber = precinctNumber;
  28876. codeblock.subbandType = subband.type;
  28877. codeblock.Lblock = 3;
  28878. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  28879. continue;
  28880. }
  28881. codeblocks.push(codeblock);
  28882. var precinct = precincts[precinctNumber];
  28883. if (precinct !== undefined) {
  28884. if (i < precinct.cbxMin) {
  28885. precinct.cbxMin = i;
  28886. } else if (i > precinct.cbxMax) {
  28887. precinct.cbxMax = i;
  28888. }
  28889. if (j < precinct.cbyMin) {
  28890. precinct.cbxMin = j;
  28891. } else if (j > precinct.cbyMax) {
  28892. precinct.cbyMax = j;
  28893. }
  28894. } else {
  28895. precincts[precinctNumber] = precinct = {
  28896. cbxMin: i,
  28897. cbyMin: j,
  28898. cbxMax: i,
  28899. cbyMax: j
  28900. };
  28901. }
  28902. codeblock.precinct = precinct;
  28903. }
  28904. }
  28905. subband.codeblockParameters = {
  28906. codeblockWidth: xcb_,
  28907. codeblockHeight: ycb_,
  28908. numcodeblockwide: cbx1 - cbx0 + 1,
  28909. numcodeblockhigh: cby1 - cby0 + 1
  28910. };
  28911. subband.codeblocks = codeblocks;
  28912. subband.precincts = precincts;
  28913. }
  28914. function createPacket(resolution, precinctNumber, layerNumber) {
  28915. var precinctCodeblocks = [];
  28916. var subbands = resolution.subbands;
  28917. for (var i = 0, ii = subbands.length; i < ii; i++) {
  28918. var subband = subbands[i];
  28919. var codeblocks = subband.codeblocks;
  28920. for (var j = 0, jj = codeblocks.length; j < jj; j++) {
  28921. var codeblock = codeblocks[j];
  28922. if (codeblock.precinctNumber !== precinctNumber) {
  28923. continue;
  28924. }
  28925. precinctCodeblocks.push(codeblock);
  28926. }
  28927. }
  28928. return {
  28929. layerNumber: layerNumber,
  28930. codeblocks: precinctCodeblocks
  28931. };
  28932. }
  28933. function LayerResolutionComponentPositionIterator(context) {
  28934. var siz = context.SIZ;
  28935. var tileIndex = context.currentTile.index;
  28936. var tile = context.tiles[tileIndex];
  28937. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  28938. var componentsCount = siz.Csiz;
  28939. var maxDecompositionLevelsCount = 0;
  28940. for (var q = 0; q < componentsCount; q++) {
  28941. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  28942. }
  28943. var l = 0, r = 0, i = 0, k = 0;
  28944. this.nextPacket = function JpxImage_nextPacket() {
  28945. for (; l < layersCount; l++) {
  28946. for (; r <= maxDecompositionLevelsCount; r++) {
  28947. for (; i < componentsCount; i++) {
  28948. var component = tile.components[i];
  28949. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  28950. continue;
  28951. }
  28952. var resolution = component.resolutions[r];
  28953. var numprecincts = resolution.precinctParameters.numprecincts;
  28954. for (; k < numprecincts;) {
  28955. var packet = createPacket(resolution, k, l);
  28956. k++;
  28957. return packet;
  28958. }
  28959. k = 0;
  28960. }
  28961. i = 0;
  28962. }
  28963. r = 0;
  28964. }
  28965. error('JPX Error: Out of packets');
  28966. };
  28967. }
  28968. function ResolutionLayerComponentPositionIterator(context) {
  28969. var siz = context.SIZ;
  28970. var tileIndex = context.currentTile.index;
  28971. var tile = context.tiles[tileIndex];
  28972. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  28973. var componentsCount = siz.Csiz;
  28974. var maxDecompositionLevelsCount = 0;
  28975. for (var q = 0; q < componentsCount; q++) {
  28976. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  28977. }
  28978. var r = 0, l = 0, i = 0, k = 0;
  28979. this.nextPacket = function JpxImage_nextPacket() {
  28980. for (; r <= maxDecompositionLevelsCount; r++) {
  28981. for (; l < layersCount; l++) {
  28982. for (; i < componentsCount; i++) {
  28983. var component = tile.components[i];
  28984. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  28985. continue;
  28986. }
  28987. var resolution = component.resolutions[r];
  28988. var numprecincts = resolution.precinctParameters.numprecincts;
  28989. for (; k < numprecincts;) {
  28990. var packet = createPacket(resolution, k, l);
  28991. k++;
  28992. return packet;
  28993. }
  28994. k = 0;
  28995. }
  28996. i = 0;
  28997. }
  28998. l = 0;
  28999. }
  29000. error('JPX Error: Out of packets');
  29001. };
  29002. }
  29003. function ResolutionPositionComponentLayerIterator(context) {
  29004. var siz = context.SIZ;
  29005. var tileIndex = context.currentTile.index;
  29006. var tile = context.tiles[tileIndex];
  29007. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29008. var componentsCount = siz.Csiz;
  29009. var l, r, c, p;
  29010. var maxDecompositionLevelsCount = 0;
  29011. for (c = 0; c < componentsCount; c++) {
  29012. var component = tile.components[c];
  29013. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  29014. }
  29015. var maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  29016. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  29017. var maxNumPrecincts = 0;
  29018. for (c = 0; c < componentsCount; ++c) {
  29019. var resolutions = tile.components[c].resolutions;
  29020. if (r < resolutions.length) {
  29021. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  29022. }
  29023. }
  29024. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  29025. }
  29026. l = 0;
  29027. r = 0;
  29028. c = 0;
  29029. p = 0;
  29030. this.nextPacket = function JpxImage_nextPacket() {
  29031. for (; r <= maxDecompositionLevelsCount; r++) {
  29032. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  29033. for (; c < componentsCount; c++) {
  29034. var component = tile.components[c];
  29035. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  29036. continue;
  29037. }
  29038. var resolution = component.resolutions[r];
  29039. var numprecincts = resolution.precinctParameters.numprecincts;
  29040. if (p >= numprecincts) {
  29041. continue;
  29042. }
  29043. for (; l < layersCount;) {
  29044. var packet = createPacket(resolution, p, l);
  29045. l++;
  29046. return packet;
  29047. }
  29048. l = 0;
  29049. }
  29050. c = 0;
  29051. }
  29052. p = 0;
  29053. }
  29054. error('JPX Error: Out of packets');
  29055. };
  29056. }
  29057. function PositionComponentResolutionLayerIterator(context) {
  29058. var siz = context.SIZ;
  29059. var tileIndex = context.currentTile.index;
  29060. var tile = context.tiles[tileIndex];
  29061. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29062. var componentsCount = siz.Csiz;
  29063. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  29064. var precinctsIterationSizes = precinctsSizes;
  29065. var l = 0, r = 0, c = 0, px = 0, py = 0;
  29066. this.nextPacket = function JpxImage_nextPacket() {
  29067. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  29068. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  29069. for (; c < componentsCount; c++) {
  29070. var component = tile.components[c];
  29071. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29072. for (; r <= decompositionLevelsCount; r++) {
  29073. var resolution = component.resolutions[r];
  29074. var sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  29075. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  29076. if (k === null) {
  29077. continue;
  29078. }
  29079. for (; l < layersCount;) {
  29080. var packet = createPacket(resolution, k, l);
  29081. l++;
  29082. return packet;
  29083. }
  29084. l = 0;
  29085. }
  29086. r = 0;
  29087. }
  29088. c = 0;
  29089. }
  29090. px = 0;
  29091. }
  29092. error('JPX Error: Out of packets');
  29093. };
  29094. }
  29095. function ComponentPositionResolutionLayerIterator(context) {
  29096. var siz = context.SIZ;
  29097. var tileIndex = context.currentTile.index;
  29098. var tile = context.tiles[tileIndex];
  29099. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  29100. var componentsCount = siz.Csiz;
  29101. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  29102. var l = 0, r = 0, c = 0, px = 0, py = 0;
  29103. this.nextPacket = function JpxImage_nextPacket() {
  29104. for (; c < componentsCount; ++c) {
  29105. var component = tile.components[c];
  29106. var precinctsIterationSizes = precinctsSizes.components[c];
  29107. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29108. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  29109. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  29110. for (; r <= decompositionLevelsCount; r++) {
  29111. var resolution = component.resolutions[r];
  29112. var sizeInImageScale = precinctsIterationSizes.resolutions[r];
  29113. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  29114. if (k === null) {
  29115. continue;
  29116. }
  29117. for (; l < layersCount;) {
  29118. var packet = createPacket(resolution, k, l);
  29119. l++;
  29120. return packet;
  29121. }
  29122. l = 0;
  29123. }
  29124. r = 0;
  29125. }
  29126. px = 0;
  29127. }
  29128. py = 0;
  29129. }
  29130. error('JPX Error: Out of packets');
  29131. };
  29132. }
  29133. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  29134. var posX = pxIndex * precinctIterationSizes.minWidth;
  29135. var posY = pyIndex * precinctIterationSizes.minHeight;
  29136. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  29137. return null;
  29138. }
  29139. var startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  29140. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  29141. }
  29142. function getPrecinctSizesInImageScale(tile) {
  29143. var componentsCount = tile.components.length;
  29144. var minWidth = Number.MAX_VALUE;
  29145. var minHeight = Number.MAX_VALUE;
  29146. var maxNumWide = 0;
  29147. var maxNumHigh = 0;
  29148. var sizePerComponent = new Array(componentsCount);
  29149. for (var c = 0; c < componentsCount; c++) {
  29150. var component = tile.components[c];
  29151. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29152. var sizePerResolution = new Array(decompositionLevelsCount + 1);
  29153. var minWidthCurrentComponent = Number.MAX_VALUE;
  29154. var minHeightCurrentComponent = Number.MAX_VALUE;
  29155. var maxNumWideCurrentComponent = 0;
  29156. var maxNumHighCurrentComponent = 0;
  29157. var scale = 1;
  29158. for (var r = decompositionLevelsCount; r >= 0; --r) {
  29159. var resolution = component.resolutions[r];
  29160. var widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  29161. var heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  29162. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  29163. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  29164. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  29165. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  29166. sizePerResolution[r] = {
  29167. width: widthCurrentResolution,
  29168. height: heightCurrentResolution
  29169. };
  29170. scale <<= 1;
  29171. }
  29172. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  29173. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  29174. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  29175. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  29176. sizePerComponent[c] = {
  29177. resolutions: sizePerResolution,
  29178. minWidth: minWidthCurrentComponent,
  29179. minHeight: minHeightCurrentComponent,
  29180. maxNumWide: maxNumWideCurrentComponent,
  29181. maxNumHigh: maxNumHighCurrentComponent
  29182. };
  29183. }
  29184. return {
  29185. components: sizePerComponent,
  29186. minWidth: minWidth,
  29187. minHeight: minHeight,
  29188. maxNumWide: maxNumWide,
  29189. maxNumHigh: maxNumHigh
  29190. };
  29191. }
  29192. function buildPackets(context) {
  29193. var siz = context.SIZ;
  29194. var tileIndex = context.currentTile.index;
  29195. var tile = context.tiles[tileIndex];
  29196. var componentsCount = siz.Csiz;
  29197. for (var c = 0; c < componentsCount; c++) {
  29198. var component = tile.components[c];
  29199. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  29200. var resolutions = [];
  29201. var subbands = [];
  29202. for (var r = 0; r <= decompositionLevelsCount; r++) {
  29203. var blocksDimensions = getBlocksDimensions(context, component, r);
  29204. var resolution = {};
  29205. var scale = 1 << decompositionLevelsCount - r;
  29206. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  29207. resolution.try0 = Math.ceil(component.tcy0 / scale);
  29208. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  29209. resolution.try1 = Math.ceil(component.tcy1 / scale);
  29210. resolution.resLevel = r;
  29211. buildPrecincts(context, resolution, blocksDimensions);
  29212. resolutions.push(resolution);
  29213. var subband;
  29214. if (r === 0) {
  29215. subband = {};
  29216. subband.type = 'LL';
  29217. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  29218. subband.tby0 = Math.ceil(component.tcy0 / scale);
  29219. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  29220. subband.tby1 = Math.ceil(component.tcy1 / scale);
  29221. subband.resolution = resolution;
  29222. buildCodeblocks(context, subband, blocksDimensions);
  29223. subbands.push(subband);
  29224. resolution.subbands = [subband];
  29225. } else {
  29226. var bscale = 1 << decompositionLevelsCount - r + 1;
  29227. var resolutionSubbands = [];
  29228. subband = {};
  29229. subband.type = 'HL';
  29230. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  29231. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  29232. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  29233. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  29234. subband.resolution = resolution;
  29235. buildCodeblocks(context, subband, blocksDimensions);
  29236. subbands.push(subband);
  29237. resolutionSubbands.push(subband);
  29238. subband = {};
  29239. subband.type = 'LH';
  29240. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  29241. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  29242. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  29243. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  29244. subband.resolution = resolution;
  29245. buildCodeblocks(context, subband, blocksDimensions);
  29246. subbands.push(subband);
  29247. resolutionSubbands.push(subband);
  29248. subband = {};
  29249. subband.type = 'HH';
  29250. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  29251. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  29252. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  29253. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  29254. subband.resolution = resolution;
  29255. buildCodeblocks(context, subband, blocksDimensions);
  29256. subbands.push(subband);
  29257. resolutionSubbands.push(subband);
  29258. resolution.subbands = resolutionSubbands;
  29259. }
  29260. }
  29261. component.resolutions = resolutions;
  29262. component.subbands = subbands;
  29263. }
  29264. var progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  29265. switch (progressionOrder) {
  29266. case 0:
  29267. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  29268. break;
  29269. case 1:
  29270. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  29271. break;
  29272. case 2:
  29273. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  29274. break;
  29275. case 3:
  29276. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  29277. break;
  29278. case 4:
  29279. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  29280. break;
  29281. default:
  29282. error('JPX Error: Unsupported progression order ' + progressionOrder);
  29283. }
  29284. }
  29285. function parseTilePackets(context, data, offset, dataLength) {
  29286. var position = 0;
  29287. var buffer, bufferSize = 0, skipNextBit = false;
  29288. function readBits(count) {
  29289. while (bufferSize < count) {
  29290. var b = data[offset + position];
  29291. position++;
  29292. if (skipNextBit) {
  29293. buffer = buffer << 7 | b;
  29294. bufferSize += 7;
  29295. skipNextBit = false;
  29296. } else {
  29297. buffer = buffer << 8 | b;
  29298. bufferSize += 8;
  29299. }
  29300. if (b === 0xFF) {
  29301. skipNextBit = true;
  29302. }
  29303. }
  29304. bufferSize -= count;
  29305. return buffer >>> bufferSize & (1 << count) - 1;
  29306. }
  29307. function skipMarkerIfEqual(value) {
  29308. if (data[offset + position - 1] === 0xFF && data[offset + position] === value) {
  29309. skipBytes(1);
  29310. return true;
  29311. } else if (data[offset + position] === 0xFF && data[offset + position + 1] === value) {
  29312. skipBytes(2);
  29313. return true;
  29314. }
  29315. return false;
  29316. }
  29317. function skipBytes(count) {
  29318. position += count;
  29319. }
  29320. function alignToByte() {
  29321. bufferSize = 0;
  29322. if (skipNextBit) {
  29323. position++;
  29324. skipNextBit = false;
  29325. }
  29326. }
  29327. function readCodingpasses() {
  29328. if (readBits(1) === 0) {
  29329. return 1;
  29330. }
  29331. if (readBits(1) === 0) {
  29332. return 2;
  29333. }
  29334. var value = readBits(2);
  29335. if (value < 3) {
  29336. return value + 3;
  29337. }
  29338. value = readBits(5);
  29339. if (value < 31) {
  29340. return value + 6;
  29341. }
  29342. value = readBits(7);
  29343. return value + 37;
  29344. }
  29345. var tileIndex = context.currentTile.index;
  29346. var tile = context.tiles[tileIndex];
  29347. var sopMarkerUsed = context.COD.sopMarkerUsed;
  29348. var ephMarkerUsed = context.COD.ephMarkerUsed;
  29349. var packetsIterator = tile.packetsIterator;
  29350. while (position < dataLength) {
  29351. alignToByte();
  29352. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  29353. skipBytes(4);
  29354. }
  29355. var packet = packetsIterator.nextPacket();
  29356. if (!readBits(1)) {
  29357. continue;
  29358. }
  29359. var layerNumber = packet.layerNumber;
  29360. var queue = [], codeblock;
  29361. for (var i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  29362. codeblock = packet.codeblocks[i];
  29363. var precinct = codeblock.precinct;
  29364. var codeblockColumn = codeblock.cbx - precinct.cbxMin;
  29365. var codeblockRow = codeblock.cby - precinct.cbyMin;
  29366. var codeblockIncluded = false;
  29367. var firstTimeInclusion = false;
  29368. var valueReady;
  29369. if (codeblock['included'] !== undefined) {
  29370. codeblockIncluded = !!readBits(1);
  29371. } else {
  29372. precinct = codeblock.precinct;
  29373. var inclusionTree, zeroBitPlanesTree;
  29374. if (precinct['inclusionTree'] !== undefined) {
  29375. inclusionTree = precinct.inclusionTree;
  29376. } else {
  29377. var width = precinct.cbxMax - precinct.cbxMin + 1;
  29378. var height = precinct.cbyMax - precinct.cbyMin + 1;
  29379. inclusionTree = new InclusionTree(width, height, layerNumber);
  29380. zeroBitPlanesTree = new TagTree(width, height);
  29381. precinct.inclusionTree = inclusionTree;
  29382. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  29383. }
  29384. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  29385. while (true) {
  29386. if (readBits(1)) {
  29387. valueReady = !inclusionTree.nextLevel();
  29388. if (valueReady) {
  29389. codeblock.included = true;
  29390. codeblockIncluded = firstTimeInclusion = true;
  29391. break;
  29392. }
  29393. } else {
  29394. inclusionTree.incrementValue(layerNumber);
  29395. break;
  29396. }
  29397. }
  29398. }
  29399. }
  29400. if (!codeblockIncluded) {
  29401. continue;
  29402. }
  29403. if (firstTimeInclusion) {
  29404. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  29405. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  29406. while (true) {
  29407. if (readBits(1)) {
  29408. valueReady = !zeroBitPlanesTree.nextLevel();
  29409. if (valueReady) {
  29410. break;
  29411. }
  29412. } else {
  29413. zeroBitPlanesTree.incrementValue();
  29414. }
  29415. }
  29416. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  29417. }
  29418. var codingpasses = readCodingpasses();
  29419. while (readBits(1)) {
  29420. codeblock.Lblock++;
  29421. }
  29422. var codingpassesLog2 = log2(codingpasses);
  29423. var bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  29424. var codedDataLength = readBits(bits);
  29425. queue.push({
  29426. codeblock: codeblock,
  29427. codingpasses: codingpasses,
  29428. dataLength: codedDataLength
  29429. });
  29430. }
  29431. alignToByte();
  29432. if (ephMarkerUsed) {
  29433. skipMarkerIfEqual(0x92);
  29434. }
  29435. while (queue.length > 0) {
  29436. var packetItem = queue.shift();
  29437. codeblock = packetItem.codeblock;
  29438. if (codeblock['data'] === undefined) {
  29439. codeblock.data = [];
  29440. }
  29441. codeblock.data.push({
  29442. data: data,
  29443. start: offset + position,
  29444. end: offset + position + packetItem.dataLength,
  29445. codingpasses: packetItem.codingpasses
  29446. });
  29447. position += packetItem.dataLength;
  29448. }
  29449. }
  29450. return position;
  29451. }
  29452. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) {
  29453. var x0 = subband.tbx0;
  29454. var y0 = subband.tby0;
  29455. var width = subband.tbx1 - subband.tbx0;
  29456. var codeblocks = subband.codeblocks;
  29457. var right = subband.type.charAt(0) === 'H' ? 1 : 0;
  29458. var bottom = subband.type.charAt(1) === 'H' ? levelWidth : 0;
  29459. for (var i = 0, ii = codeblocks.length; i < ii; ++i) {
  29460. var codeblock = codeblocks[i];
  29461. var blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  29462. var blockHeight = codeblock.tby1_ - codeblock.tby0_;
  29463. if (blockWidth === 0 || blockHeight === 0) {
  29464. continue;
  29465. }
  29466. if (codeblock['data'] === undefined) {
  29467. continue;
  29468. }
  29469. var bitModel, currentCodingpassType;
  29470. bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  29471. currentCodingpassType = 2;
  29472. var data = codeblock.data, totalLength = 0, codingpasses = 0;
  29473. var j, jj, dataItem;
  29474. for (j = 0, jj = data.length; j < jj; j++) {
  29475. dataItem = data[j];
  29476. totalLength += dataItem.end - dataItem.start;
  29477. codingpasses += dataItem.codingpasses;
  29478. }
  29479. var encodedData = new Uint8Array(totalLength);
  29480. var position = 0;
  29481. for (j = 0, jj = data.length; j < jj; j++) {
  29482. dataItem = data[j];
  29483. var chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  29484. encodedData.set(chunk, position);
  29485. position += chunk.length;
  29486. }
  29487. var decoder = new ArithmeticDecoder(encodedData, 0, totalLength);
  29488. bitModel.setDecoder(decoder);
  29489. for (j = 0; j < codingpasses; j++) {
  29490. switch (currentCodingpassType) {
  29491. case 0:
  29492. bitModel.runSignificancePropagationPass();
  29493. break;
  29494. case 1:
  29495. bitModel.runMagnitudeRefinementPass();
  29496. break;
  29497. case 2:
  29498. bitModel.runCleanupPass();
  29499. if (segmentationSymbolUsed) {
  29500. bitModel.checkSegmentationSymbol();
  29501. }
  29502. break;
  29503. }
  29504. currentCodingpassType = (currentCodingpassType + 1) % 3;
  29505. }
  29506. var offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  29507. var sign = bitModel.coefficentsSign;
  29508. var magnitude = bitModel.coefficentsMagnitude;
  29509. var bitsDecoded = bitModel.bitsDecoded;
  29510. var magnitudeCorrection = reversible ? 0 : 0.5;
  29511. var k, n, nb;
  29512. position = 0;
  29513. var interleave = subband.type !== 'LL';
  29514. for (j = 0; j < blockHeight; j++) {
  29515. var row = offset / width | 0;
  29516. var levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  29517. for (k = 0; k < blockWidth; k++) {
  29518. n = magnitude[position];
  29519. if (n !== 0) {
  29520. n = (n + magnitudeCorrection) * delta;
  29521. if (sign[position] !== 0) {
  29522. n = -n;
  29523. }
  29524. nb = bitsDecoded[position];
  29525. var pos = interleave ? levelOffset + (offset << 1) : offset;
  29526. if (reversible && nb >= mb) {
  29527. coefficients[pos] = n;
  29528. } else {
  29529. coefficients[pos] = n * (1 << mb - nb);
  29530. }
  29531. }
  29532. offset++;
  29533. position++;
  29534. }
  29535. offset += width - blockWidth;
  29536. }
  29537. }
  29538. }
  29539. function transformTile(context, tile, c) {
  29540. var component = tile.components[c];
  29541. var codingStyleParameters = component.codingStyleParameters;
  29542. var quantizationParameters = component.quantizationParameters;
  29543. var decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  29544. var spqcds = quantizationParameters.SPqcds;
  29545. var scalarExpounded = quantizationParameters.scalarExpounded;
  29546. var guardBits = quantizationParameters.guardBits;
  29547. var segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  29548. var precision = context.components[c].precision;
  29549. var reversible = codingStyleParameters.reversibleTransformation;
  29550. var transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  29551. var subbandCoefficients = [];
  29552. var b = 0;
  29553. for (var i = 0; i <= decompositionLevelsCount; i++) {
  29554. var resolution = component.resolutions[i];
  29555. var width = resolution.trx1 - resolution.trx0;
  29556. var height = resolution.try1 - resolution.try0;
  29557. var coefficients = new Float32Array(width * height);
  29558. for (var j = 0, jj = resolution.subbands.length; j < jj; j++) {
  29559. var mu, epsilon;
  29560. if (!scalarExpounded) {
  29561. mu = spqcds[0].mu;
  29562. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  29563. } else {
  29564. mu = spqcds[b].mu;
  29565. epsilon = spqcds[b].epsilon;
  29566. b++;
  29567. }
  29568. var subband = resolution.subbands[j];
  29569. var gainLog2 = SubbandsGainLog2[subband.type];
  29570. var delta = reversible ? 1 : Math.pow(2, precision + gainLog2 - epsilon) * (1 + mu / 2048);
  29571. var mb = guardBits + epsilon - 1;
  29572. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed);
  29573. }
  29574. subbandCoefficients.push({
  29575. width: width,
  29576. height: height,
  29577. items: coefficients
  29578. });
  29579. }
  29580. var result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  29581. return {
  29582. left: component.tcx0,
  29583. top: component.tcy0,
  29584. width: result.width,
  29585. height: result.height,
  29586. items: result.items
  29587. };
  29588. }
  29589. function transformComponents(context) {
  29590. var siz = context.SIZ;
  29591. var components = context.components;
  29592. var componentsCount = siz.Csiz;
  29593. var resultImages = [];
  29594. for (var i = 0, ii = context.tiles.length; i < ii; i++) {
  29595. var tile = context.tiles[i];
  29596. var transformedTiles = [];
  29597. var c;
  29598. for (c = 0; c < componentsCount; c++) {
  29599. transformedTiles[c] = transformTile(context, tile, c);
  29600. }
  29601. var tile0 = transformedTiles[0];
  29602. var out = new Uint8Array(tile0.items.length * componentsCount);
  29603. var result = {
  29604. left: tile0.left,
  29605. top: tile0.top,
  29606. width: tile0.width,
  29607. height: tile0.height,
  29608. items: out
  29609. };
  29610. var shift, offset, max, min, maxK;
  29611. var pos = 0, j, jj, y0, y1, y2, r, g, b, k, val;
  29612. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  29613. var fourComponents = componentsCount === 4;
  29614. var y0items = transformedTiles[0].items;
  29615. var y1items = transformedTiles[1].items;
  29616. var y2items = transformedTiles[2].items;
  29617. var y3items = fourComponents ? transformedTiles[3].items : null;
  29618. shift = components[0].precision - 8;
  29619. offset = (128 << shift) + 0.5;
  29620. max = 255 * (1 << shift);
  29621. maxK = max * 0.5;
  29622. min = -maxK;
  29623. var component0 = tile.components[0];
  29624. var alpha01 = componentsCount - 3;
  29625. jj = y0items.length;
  29626. if (!component0.codingStyleParameters.reversibleTransformation) {
  29627. for (j = 0; j < jj; j++, pos += alpha01) {
  29628. y0 = y0items[j] + offset;
  29629. y1 = y1items[j];
  29630. y2 = y2items[j];
  29631. r = y0 + 1.402 * y2;
  29632. g = y0 - 0.34413 * y1 - 0.71414 * y2;
  29633. b = y0 + 1.772 * y1;
  29634. out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift;
  29635. out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift;
  29636. out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift;
  29637. }
  29638. } else {
  29639. for (j = 0; j < jj; j++, pos += alpha01) {
  29640. y0 = y0items[j] + offset;
  29641. y1 = y1items[j];
  29642. y2 = y2items[j];
  29643. g = y0 - (y2 + y1 >> 2);
  29644. r = g + y2;
  29645. b = g + y1;
  29646. out[pos++] = r <= 0 ? 0 : r >= max ? 255 : r >> shift;
  29647. out[pos++] = g <= 0 ? 0 : g >= max ? 255 : g >> shift;
  29648. out[pos++] = b <= 0 ? 0 : b >= max ? 255 : b >> shift;
  29649. }
  29650. }
  29651. if (fourComponents) {
  29652. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  29653. k = y3items[j];
  29654. out[pos] = k <= min ? 0 : k >= maxK ? 255 : k + offset >> shift;
  29655. }
  29656. }
  29657. } else {
  29658. for (c = 0; c < componentsCount; c++) {
  29659. var items = transformedTiles[c].items;
  29660. shift = components[c].precision - 8;
  29661. offset = (128 << shift) + 0.5;
  29662. max = 127.5 * (1 << shift);
  29663. min = -max;
  29664. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  29665. val = items[j];
  29666. out[pos] = val <= min ? 0 : val >= max ? 255 : val + offset >> shift;
  29667. pos += componentsCount;
  29668. }
  29669. }
  29670. }
  29671. resultImages.push(result);
  29672. }
  29673. return resultImages;
  29674. }
  29675. function initializeTile(context, tileIndex) {
  29676. var siz = context.SIZ;
  29677. var componentsCount = siz.Csiz;
  29678. var tile = context.tiles[tileIndex];
  29679. for (var c = 0; c < componentsCount; c++) {
  29680. var component = tile.components[c];
  29681. var qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  29682. component.quantizationParameters = qcdOrQcc;
  29683. var codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  29684. component.codingStyleParameters = codOrCoc;
  29685. }
  29686. tile.codingStyleDefaultParameters = context.currentTile.COD;
  29687. }
  29688. var TagTree = function TagTreeClosure() {
  29689. function TagTree(width, height) {
  29690. var levelsLength = log2(Math.max(width, height)) + 1;
  29691. this.levels = [];
  29692. for (var i = 0; i < levelsLength; i++) {
  29693. var level = {
  29694. width: width,
  29695. height: height,
  29696. items: []
  29697. };
  29698. this.levels.push(level);
  29699. width = Math.ceil(width / 2);
  29700. height = Math.ceil(height / 2);
  29701. }
  29702. }
  29703. TagTree.prototype = {
  29704. reset: function TagTree_reset(i, j) {
  29705. var currentLevel = 0, value = 0, level;
  29706. while (currentLevel < this.levels.length) {
  29707. level = this.levels[currentLevel];
  29708. var index = i + j * level.width;
  29709. if (level.items[index] !== undefined) {
  29710. value = level.items[index];
  29711. break;
  29712. }
  29713. level.index = index;
  29714. i >>= 1;
  29715. j >>= 1;
  29716. currentLevel++;
  29717. }
  29718. currentLevel--;
  29719. level = this.levels[currentLevel];
  29720. level.items[level.index] = value;
  29721. this.currentLevel = currentLevel;
  29722. delete this.value;
  29723. },
  29724. incrementValue: function TagTree_incrementValue() {
  29725. var level = this.levels[this.currentLevel];
  29726. level.items[level.index]++;
  29727. },
  29728. nextLevel: function TagTree_nextLevel() {
  29729. var currentLevel = this.currentLevel;
  29730. var level = this.levels[currentLevel];
  29731. var value = level.items[level.index];
  29732. currentLevel--;
  29733. if (currentLevel < 0) {
  29734. this.value = value;
  29735. return false;
  29736. }
  29737. this.currentLevel = currentLevel;
  29738. level = this.levels[currentLevel];
  29739. level.items[level.index] = value;
  29740. return true;
  29741. }
  29742. };
  29743. return TagTree;
  29744. }();
  29745. var InclusionTree = function InclusionTreeClosure() {
  29746. function InclusionTree(width, height, defaultValue) {
  29747. var levelsLength = log2(Math.max(width, height)) + 1;
  29748. this.levels = [];
  29749. for (var i = 0; i < levelsLength; i++) {
  29750. var items = new Uint8Array(width * height);
  29751. for (var j = 0, jj = items.length; j < jj; j++) {
  29752. items[j] = defaultValue;
  29753. }
  29754. var level = {
  29755. width: width,
  29756. height: height,
  29757. items: items
  29758. };
  29759. this.levels.push(level);
  29760. width = Math.ceil(width / 2);
  29761. height = Math.ceil(height / 2);
  29762. }
  29763. }
  29764. InclusionTree.prototype = {
  29765. reset: function InclusionTree_reset(i, j, stopValue) {
  29766. var currentLevel = 0;
  29767. while (currentLevel < this.levels.length) {
  29768. var level = this.levels[currentLevel];
  29769. var index = i + j * level.width;
  29770. level.index = index;
  29771. var value = level.items[index];
  29772. if (value === 0xFF) {
  29773. break;
  29774. }
  29775. if (value > stopValue) {
  29776. this.currentLevel = currentLevel;
  29777. this.propagateValues();
  29778. return false;
  29779. }
  29780. i >>= 1;
  29781. j >>= 1;
  29782. currentLevel++;
  29783. }
  29784. this.currentLevel = currentLevel - 1;
  29785. return true;
  29786. },
  29787. incrementValue: function InclusionTree_incrementValue(stopValue) {
  29788. var level = this.levels[this.currentLevel];
  29789. level.items[level.index] = stopValue + 1;
  29790. this.propagateValues();
  29791. },
  29792. propagateValues: function InclusionTree_propagateValues() {
  29793. var levelIndex = this.currentLevel;
  29794. var level = this.levels[levelIndex];
  29795. var currentValue = level.items[level.index];
  29796. while (--levelIndex >= 0) {
  29797. level = this.levels[levelIndex];
  29798. level.items[level.index] = currentValue;
  29799. }
  29800. },
  29801. nextLevel: function InclusionTree_nextLevel() {
  29802. var currentLevel = this.currentLevel;
  29803. var level = this.levels[currentLevel];
  29804. var value = level.items[level.index];
  29805. level.items[level.index] = 0xFF;
  29806. currentLevel--;
  29807. if (currentLevel < 0) {
  29808. return false;
  29809. }
  29810. this.currentLevel = currentLevel;
  29811. level = this.levels[currentLevel];
  29812. level.items[level.index] = value;
  29813. return true;
  29814. }
  29815. };
  29816. return InclusionTree;
  29817. }();
  29818. var BitModel = function BitModelClosure() {
  29819. var UNIFORM_CONTEXT = 17;
  29820. var RUNLENGTH_CONTEXT = 18;
  29821. var LLAndLHContextsLabel = new Uint8Array([
  29822. 0,
  29823. 5,
  29824. 8,
  29825. 0,
  29826. 3,
  29827. 7,
  29828. 8,
  29829. 0,
  29830. 4,
  29831. 7,
  29832. 8,
  29833. 0,
  29834. 0,
  29835. 0,
  29836. 0,
  29837. 0,
  29838. 1,
  29839. 6,
  29840. 8,
  29841. 0,
  29842. 3,
  29843. 7,
  29844. 8,
  29845. 0,
  29846. 4,
  29847. 7,
  29848. 8,
  29849. 0,
  29850. 0,
  29851. 0,
  29852. 0,
  29853. 0,
  29854. 2,
  29855. 6,
  29856. 8,
  29857. 0,
  29858. 3,
  29859. 7,
  29860. 8,
  29861. 0,
  29862. 4,
  29863. 7,
  29864. 8,
  29865. 0,
  29866. 0,
  29867. 0,
  29868. 0,
  29869. 0,
  29870. 2,
  29871. 6,
  29872. 8,
  29873. 0,
  29874. 3,
  29875. 7,
  29876. 8,
  29877. 0,
  29878. 4,
  29879. 7,
  29880. 8,
  29881. 0,
  29882. 0,
  29883. 0,
  29884. 0,
  29885. 0,
  29886. 2,
  29887. 6,
  29888. 8,
  29889. 0,
  29890. 3,
  29891. 7,
  29892. 8,
  29893. 0,
  29894. 4,
  29895. 7,
  29896. 8
  29897. ]);
  29898. var HLContextLabel = new Uint8Array([
  29899. 0,
  29900. 3,
  29901. 4,
  29902. 0,
  29903. 5,
  29904. 7,
  29905. 7,
  29906. 0,
  29907. 8,
  29908. 8,
  29909. 8,
  29910. 0,
  29911. 0,
  29912. 0,
  29913. 0,
  29914. 0,
  29915. 1,
  29916. 3,
  29917. 4,
  29918. 0,
  29919. 6,
  29920. 7,
  29921. 7,
  29922. 0,
  29923. 8,
  29924. 8,
  29925. 8,
  29926. 0,
  29927. 0,
  29928. 0,
  29929. 0,
  29930. 0,
  29931. 2,
  29932. 3,
  29933. 4,
  29934. 0,
  29935. 6,
  29936. 7,
  29937. 7,
  29938. 0,
  29939. 8,
  29940. 8,
  29941. 8,
  29942. 0,
  29943. 0,
  29944. 0,
  29945. 0,
  29946. 0,
  29947. 2,
  29948. 3,
  29949. 4,
  29950. 0,
  29951. 6,
  29952. 7,
  29953. 7,
  29954. 0,
  29955. 8,
  29956. 8,
  29957. 8,
  29958. 0,
  29959. 0,
  29960. 0,
  29961. 0,
  29962. 0,
  29963. 2,
  29964. 3,
  29965. 4,
  29966. 0,
  29967. 6,
  29968. 7,
  29969. 7,
  29970. 0,
  29971. 8,
  29972. 8,
  29973. 8
  29974. ]);
  29975. var HHContextLabel = new Uint8Array([
  29976. 0,
  29977. 1,
  29978. 2,
  29979. 0,
  29980. 1,
  29981. 2,
  29982. 2,
  29983. 0,
  29984. 2,
  29985. 2,
  29986. 2,
  29987. 0,
  29988. 0,
  29989. 0,
  29990. 0,
  29991. 0,
  29992. 3,
  29993. 4,
  29994. 5,
  29995. 0,
  29996. 4,
  29997. 5,
  29998. 5,
  29999. 0,
  30000. 5,
  30001. 5,
  30002. 5,
  30003. 0,
  30004. 0,
  30005. 0,
  30006. 0,
  30007. 0,
  30008. 6,
  30009. 7,
  30010. 7,
  30011. 0,
  30012. 7,
  30013. 7,
  30014. 7,
  30015. 0,
  30016. 7,
  30017. 7,
  30018. 7,
  30019. 0,
  30020. 0,
  30021. 0,
  30022. 0,
  30023. 0,
  30024. 8,
  30025. 8,
  30026. 8,
  30027. 0,
  30028. 8,
  30029. 8,
  30030. 8,
  30031. 0,
  30032. 8,
  30033. 8,
  30034. 8,
  30035. 0,
  30036. 0,
  30037. 0,
  30038. 0,
  30039. 0,
  30040. 8,
  30041. 8,
  30042. 8,
  30043. 0,
  30044. 8,
  30045. 8,
  30046. 8,
  30047. 0,
  30048. 8,
  30049. 8,
  30050. 8
  30051. ]);
  30052. function BitModel(width, height, subband, zeroBitPlanes, mb) {
  30053. this.width = width;
  30054. this.height = height;
  30055. this.contextLabelTable = subband === 'HH' ? HHContextLabel : subband === 'HL' ? HLContextLabel : LLAndLHContextsLabel;
  30056. var coefficientCount = width * height;
  30057. this.neighborsSignificance = new Uint8Array(coefficientCount);
  30058. this.coefficentsSign = new Uint8Array(coefficientCount);
  30059. this.coefficentsMagnitude = mb > 14 ? new Uint32Array(coefficientCount) : mb > 6 ? new Uint16Array(coefficientCount) : new Uint8Array(coefficientCount);
  30060. this.processingFlags = new Uint8Array(coefficientCount);
  30061. var bitsDecoded = new Uint8Array(coefficientCount);
  30062. if (zeroBitPlanes !== 0) {
  30063. for (var i = 0; i < coefficientCount; i++) {
  30064. bitsDecoded[i] = zeroBitPlanes;
  30065. }
  30066. }
  30067. this.bitsDecoded = bitsDecoded;
  30068. this.reset();
  30069. }
  30070. BitModel.prototype = {
  30071. setDecoder: function BitModel_setDecoder(decoder) {
  30072. this.decoder = decoder;
  30073. },
  30074. reset: function BitModel_reset() {
  30075. this.contexts = new Int8Array(19);
  30076. this.contexts[0] = 4 << 1 | 0;
  30077. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  30078. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  30079. },
  30080. setNeighborsSignificance: function BitModel_setNeighborsSignificance(row, column, index) {
  30081. var neighborsSignificance = this.neighborsSignificance;
  30082. var width = this.width, height = this.height;
  30083. var left = column > 0;
  30084. var right = column + 1 < width;
  30085. var i;
  30086. if (row > 0) {
  30087. i = index - width;
  30088. if (left) {
  30089. neighborsSignificance[i - 1] += 0x10;
  30090. }
  30091. if (right) {
  30092. neighborsSignificance[i + 1] += 0x10;
  30093. }
  30094. neighborsSignificance[i] += 0x04;
  30095. }
  30096. if (row + 1 < height) {
  30097. i = index + width;
  30098. if (left) {
  30099. neighborsSignificance[i - 1] += 0x10;
  30100. }
  30101. if (right) {
  30102. neighborsSignificance[i + 1] += 0x10;
  30103. }
  30104. neighborsSignificance[i] += 0x04;
  30105. }
  30106. if (left) {
  30107. neighborsSignificance[index - 1] += 0x01;
  30108. }
  30109. if (right) {
  30110. neighborsSignificance[index + 1] += 0x01;
  30111. }
  30112. neighborsSignificance[index] |= 0x80;
  30113. },
  30114. runSignificancePropagationPass: function BitModel_runSignificancePropagationPass() {
  30115. var decoder = this.decoder;
  30116. var width = this.width, height = this.height;
  30117. var coefficentsMagnitude = this.coefficentsMagnitude;
  30118. var coefficentsSign = this.coefficentsSign;
  30119. var neighborsSignificance = this.neighborsSignificance;
  30120. var processingFlags = this.processingFlags;
  30121. var contexts = this.contexts;
  30122. var labels = this.contextLabelTable;
  30123. var bitsDecoded = this.bitsDecoded;
  30124. var processedInverseMask = ~1;
  30125. var processedMask = 1;
  30126. var firstMagnitudeBitMask = 2;
  30127. for (var i0 = 0; i0 < height; i0 += 4) {
  30128. for (var j = 0; j < width; j++) {
  30129. var index = i0 * width + j;
  30130. for (var i1 = 0; i1 < 4; i1++, index += width) {
  30131. var i = i0 + i1;
  30132. if (i >= height) {
  30133. break;
  30134. }
  30135. processingFlags[index] &= processedInverseMask;
  30136. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  30137. continue;
  30138. }
  30139. var contextLabel = labels[neighborsSignificance[index]];
  30140. var decision = decoder.readBit(contexts, contextLabel);
  30141. if (decision) {
  30142. var sign = this.decodeSignBit(i, j, index);
  30143. coefficentsSign[index] = sign;
  30144. coefficentsMagnitude[index] = 1;
  30145. this.setNeighborsSignificance(i, j, index);
  30146. processingFlags[index] |= firstMagnitudeBitMask;
  30147. }
  30148. bitsDecoded[index]++;
  30149. processingFlags[index] |= processedMask;
  30150. }
  30151. }
  30152. }
  30153. },
  30154. decodeSignBit: function BitModel_decodeSignBit(row, column, index) {
  30155. var width = this.width, height = this.height;
  30156. var coefficentsMagnitude = this.coefficentsMagnitude;
  30157. var coefficentsSign = this.coefficentsSign;
  30158. var contribution, sign0, sign1, significance1;
  30159. var contextLabel, decoded;
  30160. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  30161. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  30162. sign1 = coefficentsSign[index + 1];
  30163. if (significance1) {
  30164. sign0 = coefficentsSign[index - 1];
  30165. contribution = 1 - sign1 - sign0;
  30166. } else {
  30167. contribution = 1 - sign1 - sign1;
  30168. }
  30169. } else if (significance1) {
  30170. sign0 = coefficentsSign[index - 1];
  30171. contribution = 1 - sign0 - sign0;
  30172. } else {
  30173. contribution = 0;
  30174. }
  30175. var horizontalContribution = 3 * contribution;
  30176. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  30177. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  30178. sign1 = coefficentsSign[index + width];
  30179. if (significance1) {
  30180. sign0 = coefficentsSign[index - width];
  30181. contribution = 1 - sign1 - sign0 + horizontalContribution;
  30182. } else {
  30183. contribution = 1 - sign1 - sign1 + horizontalContribution;
  30184. }
  30185. } else if (significance1) {
  30186. sign0 = coefficentsSign[index - width];
  30187. contribution = 1 - sign0 - sign0 + horizontalContribution;
  30188. } else {
  30189. contribution = horizontalContribution;
  30190. }
  30191. if (contribution >= 0) {
  30192. contextLabel = 9 + contribution;
  30193. decoded = this.decoder.readBit(this.contexts, contextLabel);
  30194. } else {
  30195. contextLabel = 9 - contribution;
  30196. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  30197. }
  30198. return decoded;
  30199. },
  30200. runMagnitudeRefinementPass: function BitModel_runMagnitudeRefinementPass() {
  30201. var decoder = this.decoder;
  30202. var width = this.width, height = this.height;
  30203. var coefficentsMagnitude = this.coefficentsMagnitude;
  30204. var neighborsSignificance = this.neighborsSignificance;
  30205. var contexts = this.contexts;
  30206. var bitsDecoded = this.bitsDecoded;
  30207. var processingFlags = this.processingFlags;
  30208. var processedMask = 1;
  30209. var firstMagnitudeBitMask = 2;
  30210. var length = width * height;
  30211. var width4 = width * 4;
  30212. for (var index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  30213. indexNext = Math.min(length, index0 + width4);
  30214. for (var j = 0; j < width; j++) {
  30215. for (var index = index0 + j; index < indexNext; index += width) {
  30216. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  30217. continue;
  30218. }
  30219. var contextLabel = 16;
  30220. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  30221. processingFlags[index] ^= firstMagnitudeBitMask;
  30222. var significance = neighborsSignificance[index] & 127;
  30223. contextLabel = significance === 0 ? 15 : 14;
  30224. }
  30225. var bit = decoder.readBit(contexts, contextLabel);
  30226. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  30227. bitsDecoded[index]++;
  30228. processingFlags[index] |= processedMask;
  30229. }
  30230. }
  30231. }
  30232. },
  30233. runCleanupPass: function BitModel_runCleanupPass() {
  30234. var decoder = this.decoder;
  30235. var width = this.width, height = this.height;
  30236. var neighborsSignificance = this.neighborsSignificance;
  30237. var coefficentsMagnitude = this.coefficentsMagnitude;
  30238. var coefficentsSign = this.coefficentsSign;
  30239. var contexts = this.contexts;
  30240. var labels = this.contextLabelTable;
  30241. var bitsDecoded = this.bitsDecoded;
  30242. var processingFlags = this.processingFlags;
  30243. var processedMask = 1;
  30244. var firstMagnitudeBitMask = 2;
  30245. var oneRowDown = width;
  30246. var twoRowsDown = width * 2;
  30247. var threeRowsDown = width * 3;
  30248. var iNext;
  30249. for (var i0 = 0; i0 < height; i0 = iNext) {
  30250. iNext = Math.min(i0 + 4, height);
  30251. var indexBase = i0 * width;
  30252. var checkAllEmpty = i0 + 3 < height;
  30253. for (var j = 0; j < width; j++) {
  30254. var index0 = indexBase + j;
  30255. 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;
  30256. var i1 = 0, index = index0;
  30257. var i = i0, sign;
  30258. if (allEmpty) {
  30259. var hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  30260. if (!hasSignificantCoefficent) {
  30261. bitsDecoded[index0]++;
  30262. bitsDecoded[index0 + oneRowDown]++;
  30263. bitsDecoded[index0 + twoRowsDown]++;
  30264. bitsDecoded[index0 + threeRowsDown]++;
  30265. continue;
  30266. }
  30267. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  30268. if (i1 !== 0) {
  30269. i = i0 + i1;
  30270. index += i1 * width;
  30271. }
  30272. sign = this.decodeSignBit(i, j, index);
  30273. coefficentsSign[index] = sign;
  30274. coefficentsMagnitude[index] = 1;
  30275. this.setNeighborsSignificance(i, j, index);
  30276. processingFlags[index] |= firstMagnitudeBitMask;
  30277. index = index0;
  30278. for (var i2 = i0; i2 <= i; i2++, index += width) {
  30279. bitsDecoded[index]++;
  30280. }
  30281. i1++;
  30282. }
  30283. for (i = i0 + i1; i < iNext; i++, index += width) {
  30284. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  30285. continue;
  30286. }
  30287. var contextLabel = labels[neighborsSignificance[index]];
  30288. var decision = decoder.readBit(contexts, contextLabel);
  30289. if (decision === 1) {
  30290. sign = this.decodeSignBit(i, j, index);
  30291. coefficentsSign[index] = sign;
  30292. coefficentsMagnitude[index] = 1;
  30293. this.setNeighborsSignificance(i, j, index);
  30294. processingFlags[index] |= firstMagnitudeBitMask;
  30295. }
  30296. bitsDecoded[index]++;
  30297. }
  30298. }
  30299. }
  30300. },
  30301. checkSegmentationSymbol: function BitModel_checkSegmentationSymbol() {
  30302. var decoder = this.decoder;
  30303. var contexts = this.contexts;
  30304. 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);
  30305. if (symbol !== 0xA) {
  30306. error('JPX Error: Invalid segmentation symbol');
  30307. }
  30308. }
  30309. };
  30310. return BitModel;
  30311. }();
  30312. var Transform = function TransformClosure() {
  30313. function Transform() {
  30314. }
  30315. Transform.prototype.calculate = function transformCalculate(subbands, u0, v0) {
  30316. var ll = subbands[0];
  30317. for (var i = 1, ii = subbands.length; i < ii; i++) {
  30318. ll = this.iterate(ll, subbands[i], u0, v0);
  30319. }
  30320. return ll;
  30321. };
  30322. Transform.prototype.extend = function extend(buffer, offset, size) {
  30323. var i1 = offset - 1, j1 = offset + 1;
  30324. var i2 = offset + size - 2, j2 = offset + size;
  30325. buffer[i1--] = buffer[j1++];
  30326. buffer[j2++] = buffer[i2--];
  30327. buffer[i1--] = buffer[j1++];
  30328. buffer[j2++] = buffer[i2--];
  30329. buffer[i1--] = buffer[j1++];
  30330. buffer[j2++] = buffer[i2--];
  30331. buffer[i1] = buffer[j1];
  30332. buffer[j2] = buffer[i2];
  30333. };
  30334. Transform.prototype.iterate = function Transform_iterate(ll, hl_lh_hh, u0, v0) {
  30335. var llWidth = ll.width, llHeight = ll.height, llItems = ll.items;
  30336. var width = hl_lh_hh.width;
  30337. var height = hl_lh_hh.height;
  30338. var items = hl_lh_hh.items;
  30339. var i, j, k, l, u, v;
  30340. for (k = 0, i = 0; i < llHeight; i++) {
  30341. l = i * 2 * width;
  30342. for (j = 0; j < llWidth; j++, k++, l += 2) {
  30343. items[l] = llItems[k];
  30344. }
  30345. }
  30346. llItems = ll.items = null;
  30347. var bufferPadding = 4;
  30348. var rowBuffer = new Float32Array(width + 2 * bufferPadding);
  30349. if (width === 1) {
  30350. if ((u0 & 1) !== 0) {
  30351. for (v = 0, k = 0; v < height; v++, k += width) {
  30352. items[k] *= 0.5;
  30353. }
  30354. }
  30355. } else {
  30356. for (v = 0, k = 0; v < height; v++, k += width) {
  30357. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  30358. this.extend(rowBuffer, bufferPadding, width);
  30359. this.filter(rowBuffer, bufferPadding, width);
  30360. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  30361. }
  30362. }
  30363. var numBuffers = 16;
  30364. var colBuffers = [];
  30365. for (i = 0; i < numBuffers; i++) {
  30366. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  30367. }
  30368. var b, currentBuffer = 0;
  30369. ll = bufferPadding + height;
  30370. if (height === 1) {
  30371. if ((v0 & 1) !== 0) {
  30372. for (u = 0; u < width; u++) {
  30373. items[u] *= 0.5;
  30374. }
  30375. }
  30376. } else {
  30377. for (u = 0; u < width; u++) {
  30378. if (currentBuffer === 0) {
  30379. numBuffers = Math.min(width - u, numBuffers);
  30380. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  30381. for (b = 0; b < numBuffers; b++) {
  30382. colBuffers[b][l] = items[k + b];
  30383. }
  30384. }
  30385. currentBuffer = numBuffers;
  30386. }
  30387. currentBuffer--;
  30388. var buffer = colBuffers[currentBuffer];
  30389. this.extend(buffer, bufferPadding, height);
  30390. this.filter(buffer, bufferPadding, height);
  30391. if (currentBuffer === 0) {
  30392. k = u - numBuffers + 1;
  30393. for (l = bufferPadding; l < ll; k += width, l++) {
  30394. for (b = 0; b < numBuffers; b++) {
  30395. items[k + b] = colBuffers[b][l];
  30396. }
  30397. }
  30398. }
  30399. }
  30400. }
  30401. return {
  30402. width: width,
  30403. height: height,
  30404. items: items
  30405. };
  30406. };
  30407. return Transform;
  30408. }();
  30409. var IrreversibleTransform = function IrreversibleTransformClosure() {
  30410. function IrreversibleTransform() {
  30411. Transform.call(this);
  30412. }
  30413. IrreversibleTransform.prototype = Object.create(Transform.prototype);
  30414. IrreversibleTransform.prototype.filter = function irreversibleTransformFilter(x, offset, length) {
  30415. var len = length >> 1;
  30416. offset = offset | 0;
  30417. var j, n, current, next;
  30418. var alpha = -1.586134342059924;
  30419. var beta = -0.052980118572961;
  30420. var gamma = 0.882911075530934;
  30421. var delta = 0.443506852043971;
  30422. var K = 1.230174104914001;
  30423. var K_ = 1 / K;
  30424. j = offset - 3;
  30425. for (n = len + 4; n--; j += 2) {
  30426. x[j] *= K_;
  30427. }
  30428. j = offset - 2;
  30429. current = delta * x[j - 1];
  30430. for (n = len + 3; n--; j += 2) {
  30431. next = delta * x[j + 1];
  30432. x[j] = K * x[j] - current - next;
  30433. if (n--) {
  30434. j += 2;
  30435. current = delta * x[j + 1];
  30436. x[j] = K * x[j] - current - next;
  30437. } else {
  30438. break;
  30439. }
  30440. }
  30441. j = offset - 1;
  30442. current = gamma * x[j - 1];
  30443. for (n = len + 2; n--; j += 2) {
  30444. next = gamma * x[j + 1];
  30445. x[j] -= current + next;
  30446. if (n--) {
  30447. j += 2;
  30448. current = gamma * x[j + 1];
  30449. x[j] -= current + next;
  30450. } else {
  30451. break;
  30452. }
  30453. }
  30454. j = offset;
  30455. current = beta * x[j - 1];
  30456. for (n = len + 1; n--; j += 2) {
  30457. next = beta * x[j + 1];
  30458. x[j] -= current + next;
  30459. if (n--) {
  30460. j += 2;
  30461. current = beta * x[j + 1];
  30462. x[j] -= current + next;
  30463. } else {
  30464. break;
  30465. }
  30466. }
  30467. if (len !== 0) {
  30468. j = offset + 1;
  30469. current = alpha * x[j - 1];
  30470. for (n = len; n--; j += 2) {
  30471. next = alpha * x[j + 1];
  30472. x[j] -= current + next;
  30473. if (n--) {
  30474. j += 2;
  30475. current = alpha * x[j + 1];
  30476. x[j] -= current + next;
  30477. } else {
  30478. break;
  30479. }
  30480. }
  30481. }
  30482. };
  30483. return IrreversibleTransform;
  30484. }();
  30485. var ReversibleTransform = function ReversibleTransformClosure() {
  30486. function ReversibleTransform() {
  30487. Transform.call(this);
  30488. }
  30489. ReversibleTransform.prototype = Object.create(Transform.prototype);
  30490. ReversibleTransform.prototype.filter = function reversibleTransformFilter(x, offset, length) {
  30491. var len = length >> 1;
  30492. offset = offset | 0;
  30493. var j, n;
  30494. for (j = offset, n = len + 1; n--; j += 2) {
  30495. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  30496. }
  30497. for (j = offset + 1, n = len; n--; j += 2) {
  30498. x[j] += x[j - 1] + x[j + 1] >> 1;
  30499. }
  30500. };
  30501. return ReversibleTransform;
  30502. }();
  30503. return JpxImage;
  30504. }();
  30505. exports.JpxImage = JpxImage;
  30506. /***/ }),
  30507. /* 16 */
  30508. /***/ (function(module, exports, __w_pdfjs_require__) {
  30509. "use strict";
  30510. var sharedUtil = __w_pdfjs_require__(0);
  30511. var corePrimitives = __w_pdfjs_require__(1);
  30512. var coreCrypto = __w_pdfjs_require__(13);
  30513. var coreParser = __w_pdfjs_require__(5);
  30514. var coreChunkedStream = __w_pdfjs_require__(12);
  30515. var coreColorSpace = __w_pdfjs_require__(3);
  30516. var InvalidPDFException = sharedUtil.InvalidPDFException;
  30517. var MissingDataException = sharedUtil.MissingDataException;
  30518. var XRefParseException = sharedUtil.XRefParseException;
  30519. var assert = sharedUtil.assert;
  30520. var bytesToString = sharedUtil.bytesToString;
  30521. var createPromiseCapability = sharedUtil.createPromiseCapability;
  30522. var error = sharedUtil.error;
  30523. var info = sharedUtil.info;
  30524. var isArray = sharedUtil.isArray;
  30525. var isBool = sharedUtil.isBool;
  30526. var isInt = sharedUtil.isInt;
  30527. var isString = sharedUtil.isString;
  30528. var shadow = sharedUtil.shadow;
  30529. var stringToPDFString = sharedUtil.stringToPDFString;
  30530. var stringToUTF8String = sharedUtil.stringToUTF8String;
  30531. var warn = sharedUtil.warn;
  30532. var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
  30533. var Util = sharedUtil.Util;
  30534. var Ref = corePrimitives.Ref;
  30535. var RefSet = corePrimitives.RefSet;
  30536. var RefSetCache = corePrimitives.RefSetCache;
  30537. var isName = corePrimitives.isName;
  30538. var isCmd = corePrimitives.isCmd;
  30539. var isDict = corePrimitives.isDict;
  30540. var isRef = corePrimitives.isRef;
  30541. var isRefsEqual = corePrimitives.isRefsEqual;
  30542. var isStream = corePrimitives.isStream;
  30543. var CipherTransformFactory = coreCrypto.CipherTransformFactory;
  30544. var Lexer = coreParser.Lexer;
  30545. var Parser = coreParser.Parser;
  30546. var ChunkedStream = coreChunkedStream.ChunkedStream;
  30547. var ColorSpace = coreColorSpace.ColorSpace;
  30548. var Catalog = function CatalogClosure() {
  30549. function Catalog(pdfManager, xref, pageFactory) {
  30550. this.pdfManager = pdfManager;
  30551. this.xref = xref;
  30552. this.catDict = xref.getCatalogObj();
  30553. this.fontCache = new RefSetCache();
  30554. this.builtInCMapCache = Object.create(null);
  30555. assert(isDict(this.catDict), 'catalog object is not a dictionary');
  30556. this.pageFactory = pageFactory;
  30557. this.pagePromises = [];
  30558. }
  30559. Catalog.prototype = {
  30560. get metadata() {
  30561. var streamRef = this.catDict.getRaw('Metadata');
  30562. if (!isRef(streamRef)) {
  30563. return shadow(this, 'metadata', null);
  30564. }
  30565. var encryptMetadata = !this.xref.encrypt ? false : this.xref.encrypt.encryptMetadata;
  30566. var stream = this.xref.fetch(streamRef, !encryptMetadata);
  30567. var metadata;
  30568. if (stream && isDict(stream.dict)) {
  30569. var type = stream.dict.get('Type');
  30570. var subtype = stream.dict.get('Subtype');
  30571. if (isName(type, 'Metadata') && isName(subtype, 'XML')) {
  30572. try {
  30573. metadata = stringToUTF8String(bytesToString(stream.getBytes()));
  30574. } catch (e) {
  30575. if (e instanceof MissingDataException) {
  30576. throw e;
  30577. }
  30578. info('Skipping invalid metadata.');
  30579. }
  30580. }
  30581. }
  30582. return shadow(this, 'metadata', metadata);
  30583. },
  30584. get toplevelPagesDict() {
  30585. var pagesObj = this.catDict.get('Pages');
  30586. assert(isDict(pagesObj), 'invalid top-level pages dictionary');
  30587. return shadow(this, 'toplevelPagesDict', pagesObj);
  30588. },
  30589. get documentOutline() {
  30590. var obj = null;
  30591. try {
  30592. obj = this.readDocumentOutline();
  30593. } catch (ex) {
  30594. if (ex instanceof MissingDataException) {
  30595. throw ex;
  30596. }
  30597. warn('Unable to read document outline');
  30598. }
  30599. return shadow(this, 'documentOutline', obj);
  30600. },
  30601. readDocumentOutline: function Catalog_readDocumentOutline() {
  30602. var obj = this.catDict.get('Outlines');
  30603. if (!isDict(obj)) {
  30604. return null;
  30605. }
  30606. obj = obj.getRaw('First');
  30607. if (!isRef(obj)) {
  30608. return null;
  30609. }
  30610. var root = { items: [] };
  30611. var queue = [{
  30612. obj: obj,
  30613. parent: root
  30614. }];
  30615. var processed = new RefSet();
  30616. processed.put(obj);
  30617. var xref = this.xref, blackColor = new Uint8Array(3);
  30618. while (queue.length > 0) {
  30619. var i = queue.shift();
  30620. var outlineDict = xref.fetchIfRef(i.obj);
  30621. if (outlineDict === null) {
  30622. continue;
  30623. }
  30624. assert(outlineDict.has('Title'), 'Invalid outline item');
  30625. var data = {
  30626. url: null,
  30627. dest: null
  30628. };
  30629. Catalog.parseDestDictionary({
  30630. destDict: outlineDict,
  30631. resultObj: data,
  30632. docBaseUrl: this.pdfManager.docBaseUrl
  30633. });
  30634. var title = outlineDict.get('Title');
  30635. var flags = outlineDict.get('F') || 0;
  30636. var color = outlineDict.getArray('C'), rgbColor = blackColor;
  30637. if (isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  30638. rgbColor = ColorSpace.singletons.rgb.getRgb(color, 0);
  30639. }
  30640. var outlineItem = {
  30641. dest: data.dest,
  30642. url: data.url,
  30643. unsafeUrl: data.unsafeUrl,
  30644. newWindow: data.newWindow,
  30645. title: stringToPDFString(title),
  30646. color: rgbColor,
  30647. count: outlineDict.get('Count'),
  30648. bold: !!(flags & 2),
  30649. italic: !!(flags & 1),
  30650. items: []
  30651. };
  30652. i.parent.items.push(outlineItem);
  30653. obj = outlineDict.getRaw('First');
  30654. if (isRef(obj) && !processed.has(obj)) {
  30655. queue.push({
  30656. obj: obj,
  30657. parent: outlineItem
  30658. });
  30659. processed.put(obj);
  30660. }
  30661. obj = outlineDict.getRaw('Next');
  30662. if (isRef(obj) && !processed.has(obj)) {
  30663. queue.push({
  30664. obj: obj,
  30665. parent: i.parent
  30666. });
  30667. processed.put(obj);
  30668. }
  30669. }
  30670. return root.items.length > 0 ? root.items : null;
  30671. },
  30672. get numPages() {
  30673. var obj = this.toplevelPagesDict.get('Count');
  30674. assert(isInt(obj), 'page count in top level pages object is not an integer');
  30675. return shadow(this, 'num', obj);
  30676. },
  30677. get destinations() {
  30678. function fetchDestination(dest) {
  30679. return isDict(dest) ? dest.get('D') : dest;
  30680. }
  30681. var xref = this.xref;
  30682. var dests = {}, nameTreeRef, nameDictionaryRef;
  30683. var obj = this.catDict.get('Names');
  30684. if (obj && obj.has('Dests')) {
  30685. nameTreeRef = obj.getRaw('Dests');
  30686. } else if (this.catDict.has('Dests')) {
  30687. nameDictionaryRef = this.catDict.get('Dests');
  30688. }
  30689. if (nameDictionaryRef) {
  30690. obj = nameDictionaryRef;
  30691. obj.forEach(function catalogForEach(key, value) {
  30692. if (!value) {
  30693. return;
  30694. }
  30695. dests[key] = fetchDestination(value);
  30696. });
  30697. }
  30698. if (nameTreeRef) {
  30699. var nameTree = new NameTree(nameTreeRef, xref);
  30700. var names = nameTree.getAll();
  30701. for (var name in names) {
  30702. dests[name] = fetchDestination(names[name]);
  30703. }
  30704. }
  30705. return shadow(this, 'destinations', dests);
  30706. },
  30707. getDestination: function Catalog_getDestination(destinationId) {
  30708. function fetchDestination(dest) {
  30709. return isDict(dest) ? dest.get('D') : dest;
  30710. }
  30711. var xref = this.xref;
  30712. var dest = null, nameTreeRef, nameDictionaryRef;
  30713. var obj = this.catDict.get('Names');
  30714. if (obj && obj.has('Dests')) {
  30715. nameTreeRef = obj.getRaw('Dests');
  30716. } else if (this.catDict.has('Dests')) {
  30717. nameDictionaryRef = this.catDict.get('Dests');
  30718. }
  30719. if (nameDictionaryRef) {
  30720. var value = nameDictionaryRef.get(destinationId);
  30721. if (value) {
  30722. dest = fetchDestination(value);
  30723. }
  30724. }
  30725. if (nameTreeRef) {
  30726. var nameTree = new NameTree(nameTreeRef, xref);
  30727. dest = fetchDestination(nameTree.get(destinationId));
  30728. }
  30729. return dest;
  30730. },
  30731. get pageLabels() {
  30732. var obj = null;
  30733. try {
  30734. obj = this.readPageLabels();
  30735. } catch (ex) {
  30736. if (ex instanceof MissingDataException) {
  30737. throw ex;
  30738. }
  30739. warn('Unable to read page labels.');
  30740. }
  30741. return shadow(this, 'pageLabels', obj);
  30742. },
  30743. readPageLabels: function Catalog_readPageLabels() {
  30744. var obj = this.catDict.getRaw('PageLabels');
  30745. if (!obj) {
  30746. return null;
  30747. }
  30748. var pageLabels = new Array(this.numPages);
  30749. var style = null;
  30750. var prefix = '';
  30751. var numberTree = new NumberTree(obj, this.xref);
  30752. var nums = numberTree.getAll();
  30753. var currentLabel = '', currentIndex = 1;
  30754. for (var i = 0, ii = this.numPages; i < ii; i++) {
  30755. if (i in nums) {
  30756. var labelDict = nums[i];
  30757. assert(isDict(labelDict), 'The PageLabel is not a dictionary.');
  30758. var type = labelDict.get('Type');
  30759. assert(!type || isName(type, 'PageLabel'), 'Invalid type in PageLabel dictionary.');
  30760. var s = labelDict.get('S');
  30761. assert(!s || isName(s), 'Invalid style in PageLabel dictionary.');
  30762. style = s ? s.name : null;
  30763. var p = labelDict.get('P');
  30764. assert(!p || isString(p), 'Invalid prefix in PageLabel dictionary.');
  30765. prefix = p ? stringToPDFString(p) : '';
  30766. var st = labelDict.get('St');
  30767. assert(!st || isInt(st) && st >= 1, 'Invalid start in PageLabel dictionary.');
  30768. currentIndex = st || 1;
  30769. }
  30770. switch (style) {
  30771. case 'D':
  30772. currentLabel = currentIndex;
  30773. break;
  30774. case 'R':
  30775. case 'r':
  30776. currentLabel = Util.toRoman(currentIndex, style === 'r');
  30777. break;
  30778. case 'A':
  30779. case 'a':
  30780. var LIMIT = 26;
  30781. var A_UPPER_CASE = 0x41, A_LOWER_CASE = 0x61;
  30782. var baseCharCode = style === 'a' ? A_LOWER_CASE : A_UPPER_CASE;
  30783. var letterIndex = currentIndex - 1;
  30784. var character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  30785. var charBuf = [];
  30786. for (var j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) {
  30787. charBuf.push(character);
  30788. }
  30789. currentLabel = charBuf.join('');
  30790. break;
  30791. default:
  30792. assert(!style, 'Invalid style "' + style + '" in PageLabel dictionary.');
  30793. }
  30794. pageLabels[i] = prefix + currentLabel;
  30795. currentLabel = '';
  30796. currentIndex++;
  30797. }
  30798. return pageLabels;
  30799. },
  30800. get attachments() {
  30801. var xref = this.xref;
  30802. var attachments = null, nameTreeRef;
  30803. var obj = this.catDict.get('Names');
  30804. if (obj) {
  30805. nameTreeRef = obj.getRaw('EmbeddedFiles');
  30806. }
  30807. if (nameTreeRef) {
  30808. var nameTree = new NameTree(nameTreeRef, xref);
  30809. var names = nameTree.getAll();
  30810. for (var name in names) {
  30811. var fs = new FileSpec(names[name], xref);
  30812. if (!attachments) {
  30813. attachments = Object.create(null);
  30814. }
  30815. attachments[stringToPDFString(name)] = fs.serializable;
  30816. }
  30817. }
  30818. return shadow(this, 'attachments', attachments);
  30819. },
  30820. get javaScript() {
  30821. var xref = this.xref;
  30822. var obj = this.catDict.get('Names');
  30823. var javaScript = [];
  30824. function appendIfJavaScriptDict(jsDict) {
  30825. var type = jsDict.get('S');
  30826. if (!isName(type, 'JavaScript')) {
  30827. return;
  30828. }
  30829. var js = jsDict.get('JS');
  30830. if (isStream(js)) {
  30831. js = bytesToString(js.getBytes());
  30832. } else if (!isString(js)) {
  30833. return;
  30834. }
  30835. javaScript.push(stringToPDFString(js));
  30836. }
  30837. if (obj && obj.has('JavaScript')) {
  30838. var nameTree = new NameTree(obj.getRaw('JavaScript'), xref);
  30839. var names = nameTree.getAll();
  30840. for (var name in names) {
  30841. var jsDict = names[name];
  30842. if (isDict(jsDict)) {
  30843. appendIfJavaScriptDict(jsDict);
  30844. }
  30845. }
  30846. }
  30847. var openactionDict = this.catDict.get('OpenAction');
  30848. if (isDict(openactionDict, 'Action')) {
  30849. var actionType = openactionDict.get('S');
  30850. if (isName(actionType, 'Named')) {
  30851. var action = openactionDict.get('N');
  30852. if (isName(action, 'Print')) {
  30853. javaScript.push('print({});');
  30854. }
  30855. } else {
  30856. appendIfJavaScriptDict(openactionDict);
  30857. }
  30858. }
  30859. return shadow(this, 'javaScript', javaScript);
  30860. },
  30861. cleanup: function Catalog_cleanup() {
  30862. var promises = [];
  30863. this.fontCache.forEach(function (promise) {
  30864. promises.push(promise);
  30865. });
  30866. return Promise.all(promises).then(function (translatedFonts) {
  30867. for (var i = 0, ii = translatedFonts.length; i < ii; i++) {
  30868. var font = translatedFonts[i].dict;
  30869. delete font.translated;
  30870. }
  30871. this.fontCache.clear();
  30872. this.builtInCMapCache = Object.create(null);
  30873. }.bind(this));
  30874. },
  30875. getPage: function Catalog_getPage(pageIndex) {
  30876. if (!(pageIndex in this.pagePromises)) {
  30877. this.pagePromises[pageIndex] = this.getPageDict(pageIndex).then(function (a) {
  30878. var dict = a[0];
  30879. var ref = a[1];
  30880. return this.pageFactory.createPage(pageIndex, dict, ref, this.fontCache, this.builtInCMapCache);
  30881. }.bind(this));
  30882. }
  30883. return this.pagePromises[pageIndex];
  30884. },
  30885. getPageDict: function Catalog_getPageDict(pageIndex) {
  30886. var capability = createPromiseCapability();
  30887. var nodesToVisit = [this.catDict.getRaw('Pages')];
  30888. var currentPageIndex = 0;
  30889. var xref = this.xref;
  30890. function next() {
  30891. while (nodesToVisit.length) {
  30892. var currentNode = nodesToVisit.pop();
  30893. if (isRef(currentNode)) {
  30894. xref.fetchAsync(currentNode).then(function (obj) {
  30895. if (isDict(obj, 'Page') || isDict(obj) && !obj.has('Kids')) {
  30896. if (pageIndex === currentPageIndex) {
  30897. capability.resolve([
  30898. obj,
  30899. currentNode
  30900. ]);
  30901. } else {
  30902. currentPageIndex++;
  30903. next();
  30904. }
  30905. return;
  30906. }
  30907. nodesToVisit.push(obj);
  30908. next();
  30909. }, capability.reject);
  30910. return;
  30911. }
  30912. assert(isDict(currentNode), 'page dictionary kid reference points to wrong type of object');
  30913. var count = currentNode.get('Count');
  30914. if (currentPageIndex + count <= pageIndex) {
  30915. currentPageIndex += count;
  30916. continue;
  30917. }
  30918. var kids = currentNode.get('Kids');
  30919. assert(isArray(kids), 'page dictionary kids object is not an array');
  30920. for (var last = kids.length - 1; last >= 0; last--) {
  30921. nodesToVisit.push(kids[last]);
  30922. }
  30923. }
  30924. capability.reject('Page index ' + pageIndex + ' not found.');
  30925. }
  30926. next();
  30927. return capability.promise;
  30928. },
  30929. getPageIndex: function Catalog_getPageIndex(pageRef) {
  30930. var xref = this.xref;
  30931. function pagesBeforeRef(kidRef) {
  30932. var total = 0;
  30933. var parentRef;
  30934. return xref.fetchAsync(kidRef).then(function (node) {
  30935. if (isRefsEqual(kidRef, pageRef) && !isDict(node, 'Page') && !(isDict(node) && !node.has('Type') && node.has('Contents'))) {
  30936. throw new Error('The reference does not point to a /Page Dict.');
  30937. }
  30938. if (!node) {
  30939. return null;
  30940. }
  30941. assert(isDict(node), 'node must be a Dict.');
  30942. parentRef = node.getRaw('Parent');
  30943. return node.getAsync('Parent');
  30944. }).then(function (parent) {
  30945. if (!parent) {
  30946. return null;
  30947. }
  30948. assert(isDict(parent), 'parent must be a Dict.');
  30949. return parent.getAsync('Kids');
  30950. }).then(function (kids) {
  30951. if (!kids) {
  30952. return null;
  30953. }
  30954. var kidPromises = [];
  30955. var found = false;
  30956. for (var i = 0; i < kids.length; i++) {
  30957. var kid = kids[i];
  30958. assert(isRef(kid), 'kid must be a Ref.');
  30959. if (kid.num === kidRef.num) {
  30960. found = true;
  30961. break;
  30962. }
  30963. kidPromises.push(xref.fetchAsync(kid).then(function (kid) {
  30964. if (kid.has('Count')) {
  30965. var count = kid.get('Count');
  30966. total += count;
  30967. } else {
  30968. total++;
  30969. }
  30970. }));
  30971. }
  30972. if (!found) {
  30973. error('kid ref not found in parents kids');
  30974. }
  30975. return Promise.all(kidPromises).then(function () {
  30976. return [
  30977. total,
  30978. parentRef
  30979. ];
  30980. });
  30981. });
  30982. }
  30983. var total = 0;
  30984. function next(ref) {
  30985. return pagesBeforeRef(ref).then(function (args) {
  30986. if (!args) {
  30987. return total;
  30988. }
  30989. var count = args[0];
  30990. var parentRef = args[1];
  30991. total += count;
  30992. return next(parentRef);
  30993. });
  30994. }
  30995. return next(pageRef);
  30996. }
  30997. };
  30998. Catalog.parseDestDictionary = function Catalog_parseDestDictionary(params) {
  30999. function addDefaultProtocolToUrl(url) {
  31000. if (url.indexOf('www.') === 0) {
  31001. return 'http://' + url;
  31002. }
  31003. return url;
  31004. }
  31005. function tryConvertUrlEncoding(url) {
  31006. try {
  31007. return stringToUTF8String(url);
  31008. } catch (e) {
  31009. return url;
  31010. }
  31011. }
  31012. var destDict = params.destDict;
  31013. if (!isDict(destDict)) {
  31014. warn('Catalog_parseDestDictionary: "destDict" must be a dictionary.');
  31015. return;
  31016. }
  31017. var resultObj = params.resultObj;
  31018. if (typeof resultObj !== 'object') {
  31019. warn('Catalog_parseDestDictionary: "resultObj" must be an object.');
  31020. return;
  31021. }
  31022. var docBaseUrl = params.docBaseUrl || null;
  31023. var action = destDict.get('A'), url, dest;
  31024. if (isDict(action)) {
  31025. var linkType = action.get('S').name;
  31026. switch (linkType) {
  31027. case 'URI':
  31028. url = action.get('URI');
  31029. if (isName(url)) {
  31030. url = '/' + url.name;
  31031. } else if (isString(url)) {
  31032. url = addDefaultProtocolToUrl(url);
  31033. }
  31034. break;
  31035. case 'GoTo':
  31036. dest = action.get('D');
  31037. break;
  31038. case 'Launch':
  31039. case 'GoToR':
  31040. var urlDict = action.get('F');
  31041. if (isDict(urlDict)) {
  31042. url = urlDict.get('F') || null;
  31043. } else if (isString(urlDict)) {
  31044. url = urlDict;
  31045. }
  31046. var remoteDest = action.get('D');
  31047. if (remoteDest) {
  31048. if (isName(remoteDest)) {
  31049. remoteDest = remoteDest.name;
  31050. }
  31051. if (isString(url)) {
  31052. var baseUrl = url.split('#')[0];
  31053. if (isString(remoteDest)) {
  31054. url = baseUrl + '#' + (/^\d+$/.test(remoteDest) ? 'nameddest=' : '') + remoteDest;
  31055. } else if (isArray(remoteDest)) {
  31056. url = baseUrl + '#' + JSON.stringify(remoteDest);
  31057. }
  31058. }
  31059. }
  31060. var newWindow = action.get('NewWindow');
  31061. if (isBool(newWindow)) {
  31062. resultObj.newWindow = newWindow;
  31063. }
  31064. break;
  31065. case 'Named':
  31066. var namedAction = action.get('N');
  31067. if (isName(namedAction)) {
  31068. resultObj.action = namedAction.name;
  31069. }
  31070. break;
  31071. case 'JavaScript':
  31072. var jsAction = action.get('JS'), js;
  31073. if (isStream(jsAction)) {
  31074. js = bytesToString(jsAction.getBytes());
  31075. } else if (isString(jsAction)) {
  31076. js = jsAction;
  31077. }
  31078. if (js) {
  31079. var URL_OPEN_METHODS = [
  31080. 'app.launchURL',
  31081. 'window.open'
  31082. ];
  31083. var regex = new RegExp('^\\s*(' + URL_OPEN_METHODS.join('|').split('.').join('\\.') + ')\\((?:\'|\")([^\'\"]*)(?:\'|\")(?:,\\s*(\\w+)\\)|\\))', 'i');
  31084. var jsUrl = regex.exec(stringToPDFString(js));
  31085. if (jsUrl && jsUrl[2]) {
  31086. url = jsUrl[2];
  31087. if (jsUrl[3] === 'true' && jsUrl[1] === 'app.launchURL') {
  31088. resultObj.newWindow = true;
  31089. }
  31090. break;
  31091. }
  31092. }
  31093. default:
  31094. warn('Catalog_parseDestDictionary: Unrecognized link type "' + linkType + '".');
  31095. break;
  31096. }
  31097. } else if (destDict.has('Dest')) {
  31098. dest = destDict.get('Dest');
  31099. }
  31100. if (isString(url)) {
  31101. url = tryConvertUrlEncoding(url);
  31102. var absoluteUrl = createValidAbsoluteUrl(url, docBaseUrl);
  31103. if (absoluteUrl) {
  31104. resultObj.url = absoluteUrl.href;
  31105. }
  31106. resultObj.unsafeUrl = url;
  31107. }
  31108. if (dest) {
  31109. if (isName(dest)) {
  31110. dest = dest.name;
  31111. }
  31112. if (isString(dest) || isArray(dest)) {
  31113. resultObj.dest = dest;
  31114. }
  31115. }
  31116. };
  31117. return Catalog;
  31118. }();
  31119. var XRef = function XRefClosure() {
  31120. function XRef(stream, pdfManager) {
  31121. this.stream = stream;
  31122. this.pdfManager = pdfManager;
  31123. this.entries = [];
  31124. this.xrefstms = Object.create(null);
  31125. this.cache = [];
  31126. this.stats = {
  31127. streamTypes: [],
  31128. fontTypes: []
  31129. };
  31130. }
  31131. XRef.prototype = {
  31132. setStartXRef: function XRef_setStartXRef(startXRef) {
  31133. this.startXRefQueue = [startXRef];
  31134. },
  31135. parse: function XRef_parse(recoveryMode) {
  31136. var trailerDict;
  31137. if (!recoveryMode) {
  31138. trailerDict = this.readXRef();
  31139. } else {
  31140. warn('Indexing all PDF objects');
  31141. trailerDict = this.indexObjects();
  31142. }
  31143. trailerDict.assignXref(this);
  31144. this.trailer = trailerDict;
  31145. var encrypt = trailerDict.get('Encrypt');
  31146. if (isDict(encrypt)) {
  31147. var ids = trailerDict.get('ID');
  31148. var fileId = ids && ids.length ? ids[0] : '';
  31149. encrypt.suppressEncryption = true;
  31150. this.encrypt = new CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  31151. }
  31152. if (!(this.root = trailerDict.get('Root'))) {
  31153. error('Invalid root reference');
  31154. }
  31155. },
  31156. processXRefTable: function XRef_processXRefTable(parser) {
  31157. if (!('tableState' in this)) {
  31158. this.tableState = {
  31159. entryNum: 0,
  31160. streamPos: parser.lexer.stream.pos,
  31161. parserBuf1: parser.buf1,
  31162. parserBuf2: parser.buf2
  31163. };
  31164. }
  31165. var obj = this.readXRefTable(parser);
  31166. if (!isCmd(obj, 'trailer')) {
  31167. error('Invalid XRef table: could not find trailer dictionary');
  31168. }
  31169. var dict = parser.getObj();
  31170. if (!isDict(dict) && dict.dict) {
  31171. dict = dict.dict;
  31172. }
  31173. if (!isDict(dict)) {
  31174. error('Invalid XRef table: could not parse trailer dictionary');
  31175. }
  31176. delete this.tableState;
  31177. return dict;
  31178. },
  31179. readXRefTable: function XRef_readXRefTable(parser) {
  31180. var stream = parser.lexer.stream;
  31181. var tableState = this.tableState;
  31182. stream.pos = tableState.streamPos;
  31183. parser.buf1 = tableState.parserBuf1;
  31184. parser.buf2 = tableState.parserBuf2;
  31185. var obj;
  31186. while (true) {
  31187. if (!('firstEntryNum' in tableState) || !('entryCount' in tableState)) {
  31188. if (isCmd(obj = parser.getObj(), 'trailer')) {
  31189. break;
  31190. }
  31191. tableState.firstEntryNum = obj;
  31192. tableState.entryCount = parser.getObj();
  31193. }
  31194. var first = tableState.firstEntryNum;
  31195. var count = tableState.entryCount;
  31196. if (!isInt(first) || !isInt(count)) {
  31197. error('Invalid XRef table: wrong types in subsection header');
  31198. }
  31199. for (var i = tableState.entryNum; i < count; i++) {
  31200. tableState.streamPos = stream.pos;
  31201. tableState.entryNum = i;
  31202. tableState.parserBuf1 = parser.buf1;
  31203. tableState.parserBuf2 = parser.buf2;
  31204. var entry = {};
  31205. entry.offset = parser.getObj();
  31206. entry.gen = parser.getObj();
  31207. var type = parser.getObj();
  31208. if (isCmd(type, 'f')) {
  31209. entry.free = true;
  31210. } else if (isCmd(type, 'n')) {
  31211. entry.uncompressed = true;
  31212. }
  31213. if (!isInt(entry.offset) || !isInt(entry.gen) || !(entry.free || entry.uncompressed)) {
  31214. error('Invalid entry in XRef subsection: ' + first + ', ' + count);
  31215. }
  31216. if (i === 0 && entry.free && first === 1) {
  31217. first = 0;
  31218. }
  31219. if (!this.entries[i + first]) {
  31220. this.entries[i + first] = entry;
  31221. }
  31222. }
  31223. tableState.entryNum = 0;
  31224. tableState.streamPos = stream.pos;
  31225. tableState.parserBuf1 = parser.buf1;
  31226. tableState.parserBuf2 = parser.buf2;
  31227. delete tableState.firstEntryNum;
  31228. delete tableState.entryCount;
  31229. }
  31230. if (this.entries[0] && !this.entries[0].free) {
  31231. error('Invalid XRef table: unexpected first object');
  31232. }
  31233. return obj;
  31234. },
  31235. processXRefStream: function XRef_processXRefStream(stream) {
  31236. if (!('streamState' in this)) {
  31237. var streamParameters = stream.dict;
  31238. var byteWidths = streamParameters.get('W');
  31239. var range = streamParameters.get('Index');
  31240. if (!range) {
  31241. range = [
  31242. 0,
  31243. streamParameters.get('Size')
  31244. ];
  31245. }
  31246. this.streamState = {
  31247. entryRanges: range,
  31248. byteWidths: byteWidths,
  31249. entryNum: 0,
  31250. streamPos: stream.pos
  31251. };
  31252. }
  31253. this.readXRefStream(stream);
  31254. delete this.streamState;
  31255. return stream.dict;
  31256. },
  31257. readXRefStream: function XRef_readXRefStream(stream) {
  31258. var i, j;
  31259. var streamState = this.streamState;
  31260. stream.pos = streamState.streamPos;
  31261. var byteWidths = streamState.byteWidths;
  31262. var typeFieldWidth = byteWidths[0];
  31263. var offsetFieldWidth = byteWidths[1];
  31264. var generationFieldWidth = byteWidths[2];
  31265. var entryRanges = streamState.entryRanges;
  31266. while (entryRanges.length > 0) {
  31267. var first = entryRanges[0];
  31268. var n = entryRanges[1];
  31269. if (!isInt(first) || !isInt(n)) {
  31270. error('Invalid XRef range fields: ' + first + ', ' + n);
  31271. }
  31272. if (!isInt(typeFieldWidth) || !isInt(offsetFieldWidth) || !isInt(generationFieldWidth)) {
  31273. error('Invalid XRef entry fields length: ' + first + ', ' + n);
  31274. }
  31275. for (i = streamState.entryNum; i < n; ++i) {
  31276. streamState.entryNum = i;
  31277. streamState.streamPos = stream.pos;
  31278. var type = 0, offset = 0, generation = 0;
  31279. for (j = 0; j < typeFieldWidth; ++j) {
  31280. type = type << 8 | stream.getByte();
  31281. }
  31282. if (typeFieldWidth === 0) {
  31283. type = 1;
  31284. }
  31285. for (j = 0; j < offsetFieldWidth; ++j) {
  31286. offset = offset << 8 | stream.getByte();
  31287. }
  31288. for (j = 0; j < generationFieldWidth; ++j) {
  31289. generation = generation << 8 | stream.getByte();
  31290. }
  31291. var entry = {};
  31292. entry.offset = offset;
  31293. entry.gen = generation;
  31294. switch (type) {
  31295. case 0:
  31296. entry.free = true;
  31297. break;
  31298. case 1:
  31299. entry.uncompressed = true;
  31300. break;
  31301. case 2:
  31302. break;
  31303. default:
  31304. error('Invalid XRef entry type: ' + type);
  31305. }
  31306. if (!this.entries[first + i]) {
  31307. this.entries[first + i] = entry;
  31308. }
  31309. }
  31310. streamState.entryNum = 0;
  31311. streamState.streamPos = stream.pos;
  31312. entryRanges.splice(0, 2);
  31313. }
  31314. },
  31315. indexObjects: function XRef_indexObjects() {
  31316. var TAB = 0x9, LF = 0xA, CR = 0xD, SPACE = 0x20;
  31317. var PERCENT = 0x25, LT = 0x3C;
  31318. function readToken(data, offset) {
  31319. var token = '', ch = data[offset];
  31320. while (ch !== LF && ch !== CR && ch !== LT) {
  31321. if (++offset >= data.length) {
  31322. break;
  31323. }
  31324. token += String.fromCharCode(ch);
  31325. ch = data[offset];
  31326. }
  31327. return token;
  31328. }
  31329. function skipUntil(data, offset, what) {
  31330. var length = what.length, dataLength = data.length;
  31331. var skipped = 0;
  31332. while (offset < dataLength) {
  31333. var i = 0;
  31334. while (i < length && data[offset + i] === what[i]) {
  31335. ++i;
  31336. }
  31337. if (i >= length) {
  31338. break;
  31339. }
  31340. offset++;
  31341. skipped++;
  31342. }
  31343. return skipped;
  31344. }
  31345. var objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  31346. var trailerBytes = new Uint8Array([
  31347. 116,
  31348. 114,
  31349. 97,
  31350. 105,
  31351. 108,
  31352. 101,
  31353. 114
  31354. ]);
  31355. var startxrefBytes = new Uint8Array([
  31356. 115,
  31357. 116,
  31358. 97,
  31359. 114,
  31360. 116,
  31361. 120,
  31362. 114,
  31363. 101,
  31364. 102
  31365. ]);
  31366. var endobjBytes = new Uint8Array([
  31367. 101,
  31368. 110,
  31369. 100,
  31370. 111,
  31371. 98,
  31372. 106
  31373. ]);
  31374. var xrefBytes = new Uint8Array([
  31375. 47,
  31376. 88,
  31377. 82,
  31378. 101,
  31379. 102
  31380. ]);
  31381. this.entries.length = 0;
  31382. var stream = this.stream;
  31383. stream.pos = 0;
  31384. var buffer = stream.getBytes();
  31385. var position = stream.start, length = buffer.length;
  31386. var trailers = [], xrefStms = [];
  31387. while (position < length) {
  31388. var ch = buffer[position];
  31389. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  31390. ++position;
  31391. continue;
  31392. }
  31393. if (ch === PERCENT) {
  31394. do {
  31395. ++position;
  31396. if (position >= length) {
  31397. break;
  31398. }
  31399. ch = buffer[position];
  31400. } while (ch !== LF && ch !== CR);
  31401. continue;
  31402. }
  31403. var token = readToken(buffer, position);
  31404. var m;
  31405. if (token.indexOf('xref') === 0 && (token.length === 4 || /\s/.test(token[4]))) {
  31406. position += skipUntil(buffer, position, trailerBytes);
  31407. trailers.push(position);
  31408. position += skipUntil(buffer, position, startxrefBytes);
  31409. } else if (m = objRegExp.exec(token)) {
  31410. if (typeof this.entries[m[1]] === 'undefined') {
  31411. this.entries[m[1]] = {
  31412. offset: position - stream.start,
  31413. gen: m[2] | 0,
  31414. uncompressed: true
  31415. };
  31416. }
  31417. var contentLength = skipUntil(buffer, position, endobjBytes) + 7;
  31418. var content = buffer.subarray(position, position + contentLength);
  31419. var xrefTagOffset = skipUntil(content, 0, xrefBytes);
  31420. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  31421. xrefStms.push(position - stream.start);
  31422. this.xrefstms[position - stream.start] = 1;
  31423. }
  31424. position += contentLength;
  31425. } else if (token.indexOf('trailer') === 0 && (token.length === 7 || /\s/.test(token[7]))) {
  31426. trailers.push(position);
  31427. position += skipUntil(buffer, position, startxrefBytes);
  31428. } else {
  31429. position += token.length + 1;
  31430. }
  31431. }
  31432. var i, ii;
  31433. for (i = 0, ii = xrefStms.length; i < ii; ++i) {
  31434. this.startXRefQueue.push(xrefStms[i]);
  31435. this.readXRef(true);
  31436. }
  31437. var dict;
  31438. for (i = 0, ii = trailers.length; i < ii; ++i) {
  31439. stream.pos = trailers[i];
  31440. var parser = new Parser(new Lexer(stream), true, this, true);
  31441. var obj = parser.getObj();
  31442. if (!isCmd(obj, 'trailer')) {
  31443. continue;
  31444. }
  31445. dict = parser.getObj();
  31446. if (!isDict(dict)) {
  31447. continue;
  31448. }
  31449. if (dict.has('ID')) {
  31450. return dict;
  31451. }
  31452. }
  31453. if (dict) {
  31454. return dict;
  31455. }
  31456. throw new InvalidPDFException('Invalid PDF structure');
  31457. },
  31458. readXRef: function XRef_readXRef(recoveryMode) {
  31459. var stream = this.stream;
  31460. try {
  31461. while (this.startXRefQueue.length) {
  31462. var startXRef = this.startXRefQueue[0];
  31463. stream.pos = startXRef + stream.start;
  31464. var parser = new Parser(new Lexer(stream), true, this);
  31465. var obj = parser.getObj();
  31466. var dict;
  31467. if (isCmd(obj, 'xref')) {
  31468. dict = this.processXRefTable(parser);
  31469. if (!this.topDict) {
  31470. this.topDict = dict;
  31471. }
  31472. obj = dict.get('XRefStm');
  31473. if (isInt(obj)) {
  31474. var pos = obj;
  31475. if (!(pos in this.xrefstms)) {
  31476. this.xrefstms[pos] = 1;
  31477. this.startXRefQueue.push(pos);
  31478. }
  31479. }
  31480. } else if (isInt(obj)) {
  31481. if (!isInt(parser.getObj()) || !isCmd(parser.getObj(), 'obj') || !isStream(obj = parser.getObj())) {
  31482. error('Invalid XRef stream');
  31483. }
  31484. dict = this.processXRefStream(obj);
  31485. if (!this.topDict) {
  31486. this.topDict = dict;
  31487. }
  31488. if (!dict) {
  31489. error('Failed to read XRef stream');
  31490. }
  31491. } else {
  31492. error('Invalid XRef stream header');
  31493. }
  31494. obj = dict.get('Prev');
  31495. if (isInt(obj)) {
  31496. this.startXRefQueue.push(obj);
  31497. } else if (isRef(obj)) {
  31498. this.startXRefQueue.push(obj.num);
  31499. }
  31500. this.startXRefQueue.shift();
  31501. }
  31502. return this.topDict;
  31503. } catch (e) {
  31504. if (e instanceof MissingDataException) {
  31505. throw e;
  31506. }
  31507. info('(while reading XRef): ' + e);
  31508. }
  31509. if (recoveryMode) {
  31510. return;
  31511. }
  31512. throw new XRefParseException();
  31513. },
  31514. getEntry: function XRef_getEntry(i) {
  31515. var xrefEntry = this.entries[i];
  31516. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  31517. return xrefEntry;
  31518. }
  31519. return null;
  31520. },
  31521. fetchIfRef: function XRef_fetchIfRef(obj, suppressEncryption) {
  31522. if (!isRef(obj)) {
  31523. return obj;
  31524. }
  31525. return this.fetch(obj, suppressEncryption);
  31526. },
  31527. fetch: function XRef_fetch(ref, suppressEncryption) {
  31528. assert(isRef(ref), 'ref object is not a reference');
  31529. var num = ref.num;
  31530. if (num in this.cache) {
  31531. var cacheEntry = this.cache[num];
  31532. if (isDict(cacheEntry) && !cacheEntry.objId) {
  31533. cacheEntry.objId = ref.toString();
  31534. }
  31535. return cacheEntry;
  31536. }
  31537. var xrefEntry = this.getEntry(num);
  31538. if (xrefEntry === null) {
  31539. return this.cache[num] = null;
  31540. }
  31541. if (xrefEntry.uncompressed) {
  31542. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  31543. } else {
  31544. xrefEntry = this.fetchCompressed(xrefEntry, suppressEncryption);
  31545. }
  31546. if (isDict(xrefEntry)) {
  31547. xrefEntry.objId = ref.toString();
  31548. } else if (isStream(xrefEntry)) {
  31549. xrefEntry.dict.objId = ref.toString();
  31550. }
  31551. return xrefEntry;
  31552. },
  31553. fetchUncompressed: function XRef_fetchUncompressed(ref, xrefEntry, suppressEncryption) {
  31554. var gen = ref.gen;
  31555. var num = ref.num;
  31556. if (xrefEntry.gen !== gen) {
  31557. error('inconsistent generation in XRef');
  31558. }
  31559. var stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  31560. var parser = new Parser(new Lexer(stream), true, this);
  31561. var obj1 = parser.getObj();
  31562. var obj2 = parser.getObj();
  31563. var obj3 = parser.getObj();
  31564. if (!isInt(obj1) || parseInt(obj1, 10) !== num || !isInt(obj2) || parseInt(obj2, 10) !== gen || !isCmd(obj3)) {
  31565. error('bad XRef entry');
  31566. }
  31567. if (!isCmd(obj3, 'obj')) {
  31568. if (obj3.cmd.indexOf('obj') === 0) {
  31569. num = parseInt(obj3.cmd.substring(3), 10);
  31570. if (!isNaN(num)) {
  31571. return num;
  31572. }
  31573. }
  31574. error('bad XRef entry');
  31575. }
  31576. if (this.encrypt && !suppressEncryption) {
  31577. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  31578. } else {
  31579. xrefEntry = parser.getObj();
  31580. }
  31581. if (!isStream(xrefEntry)) {
  31582. this.cache[num] = xrefEntry;
  31583. }
  31584. return xrefEntry;
  31585. },
  31586. fetchCompressed: function XRef_fetchCompressed(xrefEntry, suppressEncryption) {
  31587. var tableOffset = xrefEntry.offset;
  31588. var stream = this.fetch(new Ref(tableOffset, 0));
  31589. if (!isStream(stream)) {
  31590. error('bad ObjStm stream');
  31591. }
  31592. var first = stream.dict.get('First');
  31593. var n = stream.dict.get('N');
  31594. if (!isInt(first) || !isInt(n)) {
  31595. error('invalid first and n parameters for ObjStm stream');
  31596. }
  31597. var parser = new Parser(new Lexer(stream), false, this);
  31598. parser.allowStreams = true;
  31599. var i, entries = [], num, nums = [];
  31600. for (i = 0; i < n; ++i) {
  31601. num = parser.getObj();
  31602. if (!isInt(num)) {
  31603. error('invalid object number in the ObjStm stream: ' + num);
  31604. }
  31605. nums.push(num);
  31606. var offset = parser.getObj();
  31607. if (!isInt(offset)) {
  31608. error('invalid object offset in the ObjStm stream: ' + offset);
  31609. }
  31610. }
  31611. for (i = 0; i < n; ++i) {
  31612. entries.push(parser.getObj());
  31613. if (isCmd(parser.buf1, 'endobj')) {
  31614. parser.shift();
  31615. }
  31616. num = nums[i];
  31617. var entry = this.entries[num];
  31618. if (entry && entry.offset === tableOffset && entry.gen === i) {
  31619. this.cache[num] = entries[i];
  31620. }
  31621. }
  31622. xrefEntry = entries[xrefEntry.gen];
  31623. if (xrefEntry === undefined) {
  31624. error('bad XRef entry for compressed object');
  31625. }
  31626. return xrefEntry;
  31627. },
  31628. fetchIfRefAsync: function XRef_fetchIfRefAsync(obj, suppressEncryption) {
  31629. if (!isRef(obj)) {
  31630. return Promise.resolve(obj);
  31631. }
  31632. return this.fetchAsync(obj, suppressEncryption);
  31633. },
  31634. fetchAsync: function XRef_fetchAsync(ref, suppressEncryption) {
  31635. var streamManager = this.stream.manager;
  31636. var xref = this;
  31637. return new Promise(function tryFetch(resolve, reject) {
  31638. try {
  31639. resolve(xref.fetch(ref, suppressEncryption));
  31640. } catch (e) {
  31641. if (e instanceof MissingDataException) {
  31642. streamManager.requestRange(e.begin, e.end).then(function () {
  31643. tryFetch(resolve, reject);
  31644. }, reject);
  31645. return;
  31646. }
  31647. reject(e);
  31648. }
  31649. });
  31650. },
  31651. getCatalogObj: function XRef_getCatalogObj() {
  31652. return this.root;
  31653. }
  31654. };
  31655. return XRef;
  31656. }();
  31657. var NameOrNumberTree = function NameOrNumberTreeClosure() {
  31658. function NameOrNumberTree(root, xref) {
  31659. throw new Error('Cannot initialize NameOrNumberTree.');
  31660. }
  31661. NameOrNumberTree.prototype = {
  31662. getAll: function NameOrNumberTree_getAll() {
  31663. var dict = Object.create(null);
  31664. if (!this.root) {
  31665. return dict;
  31666. }
  31667. var xref = this.xref;
  31668. var processed = new RefSet();
  31669. processed.put(this.root);
  31670. var queue = [this.root];
  31671. while (queue.length > 0) {
  31672. var i, n;
  31673. var obj = xref.fetchIfRef(queue.shift());
  31674. if (!isDict(obj)) {
  31675. continue;
  31676. }
  31677. if (obj.has('Kids')) {
  31678. var kids = obj.get('Kids');
  31679. for (i = 0, n = kids.length; i < n; i++) {
  31680. var kid = kids[i];
  31681. assert(!processed.has(kid), 'Duplicate entry in "' + this._type + '" tree.');
  31682. queue.push(kid);
  31683. processed.put(kid);
  31684. }
  31685. continue;
  31686. }
  31687. var entries = obj.get(this._type);
  31688. if (isArray(entries)) {
  31689. for (i = 0, n = entries.length; i < n; i += 2) {
  31690. dict[xref.fetchIfRef(entries[i])] = xref.fetchIfRef(entries[i + 1]);
  31691. }
  31692. }
  31693. }
  31694. return dict;
  31695. },
  31696. get: function NameOrNumberTree_get(key) {
  31697. if (!this.root) {
  31698. return null;
  31699. }
  31700. var xref = this.xref;
  31701. var kidsOrEntries = xref.fetchIfRef(this.root);
  31702. var loopCount = 0;
  31703. var MAX_LEVELS = 10;
  31704. var l, r, m;
  31705. while (kidsOrEntries.has('Kids')) {
  31706. if (++loopCount > MAX_LEVELS) {
  31707. warn('Search depth limit reached for "' + this._type + '" tree.');
  31708. return null;
  31709. }
  31710. var kids = kidsOrEntries.get('Kids');
  31711. if (!isArray(kids)) {
  31712. return null;
  31713. }
  31714. l = 0;
  31715. r = kids.length - 1;
  31716. while (l <= r) {
  31717. m = l + r >> 1;
  31718. var kid = xref.fetchIfRef(kids[m]);
  31719. var limits = kid.get('Limits');
  31720. if (key < xref.fetchIfRef(limits[0])) {
  31721. r = m - 1;
  31722. } else if (key > xref.fetchIfRef(limits[1])) {
  31723. l = m + 1;
  31724. } else {
  31725. kidsOrEntries = xref.fetchIfRef(kids[m]);
  31726. break;
  31727. }
  31728. }
  31729. if (l > r) {
  31730. return null;
  31731. }
  31732. }
  31733. var entries = kidsOrEntries.get(this._type);
  31734. if (isArray(entries)) {
  31735. l = 0;
  31736. r = entries.length - 2;
  31737. while (l <= r) {
  31738. m = l + r & ~1;
  31739. var currentKey = xref.fetchIfRef(entries[m]);
  31740. if (key < currentKey) {
  31741. r = m - 2;
  31742. } else if (key > currentKey) {
  31743. l = m + 2;
  31744. } else {
  31745. return xref.fetchIfRef(entries[m + 1]);
  31746. }
  31747. }
  31748. }
  31749. return null;
  31750. }
  31751. };
  31752. return NameOrNumberTree;
  31753. }();
  31754. var NameTree = function NameTreeClosure() {
  31755. function NameTree(root, xref) {
  31756. this.root = root;
  31757. this.xref = xref;
  31758. this._type = 'Names';
  31759. }
  31760. Util.inherit(NameTree, NameOrNumberTree, {});
  31761. return NameTree;
  31762. }();
  31763. var NumberTree = function NumberTreeClosure() {
  31764. function NumberTree(root, xref) {
  31765. this.root = root;
  31766. this.xref = xref;
  31767. this._type = 'Nums';
  31768. }
  31769. Util.inherit(NumberTree, NameOrNumberTree, {});
  31770. return NumberTree;
  31771. }();
  31772. var FileSpec = function FileSpecClosure() {
  31773. function FileSpec(root, xref) {
  31774. if (!root || !isDict(root)) {
  31775. return;
  31776. }
  31777. this.xref = xref;
  31778. this.root = root;
  31779. if (root.has('FS')) {
  31780. this.fs = root.get('FS');
  31781. }
  31782. this.description = root.has('Desc') ? stringToPDFString(root.get('Desc')) : '';
  31783. if (root.has('RF')) {
  31784. warn('Related file specifications are not supported');
  31785. }
  31786. this.contentAvailable = true;
  31787. if (!root.has('EF')) {
  31788. this.contentAvailable = false;
  31789. warn('Non-embedded file specifications are not supported');
  31790. }
  31791. }
  31792. function pickPlatformItem(dict) {
  31793. if (dict.has('UF')) {
  31794. return dict.get('UF');
  31795. } else if (dict.has('F')) {
  31796. return dict.get('F');
  31797. } else if (dict.has('Unix')) {
  31798. return dict.get('Unix');
  31799. } else if (dict.has('Mac')) {
  31800. return dict.get('Mac');
  31801. } else if (dict.has('DOS')) {
  31802. return dict.get('DOS');
  31803. }
  31804. return null;
  31805. }
  31806. FileSpec.prototype = {
  31807. get filename() {
  31808. if (!this._filename && this.root) {
  31809. var filename = pickPlatformItem(this.root) || 'unnamed';
  31810. this._filename = stringToPDFString(filename).replace(/\\\\/g, '\\').replace(/\\\//g, '/').replace(/\\/g, '/');
  31811. }
  31812. return this._filename;
  31813. },
  31814. get content() {
  31815. if (!this.contentAvailable) {
  31816. return null;
  31817. }
  31818. if (!this.contentRef && this.root) {
  31819. this.contentRef = pickPlatformItem(this.root.get('EF'));
  31820. }
  31821. var content = null;
  31822. if (this.contentRef) {
  31823. var xref = this.xref;
  31824. var fileObj = xref.fetchIfRef(this.contentRef);
  31825. if (fileObj && isStream(fileObj)) {
  31826. content = fileObj.getBytes();
  31827. } else {
  31828. warn('Embedded file specification points to non-existing/invalid ' + 'content');
  31829. }
  31830. } else {
  31831. warn('Embedded file specification does not have a content');
  31832. }
  31833. return content;
  31834. },
  31835. get serializable() {
  31836. return {
  31837. filename: this.filename,
  31838. content: this.content
  31839. };
  31840. }
  31841. };
  31842. return FileSpec;
  31843. }();
  31844. var ObjectLoader = function () {
  31845. function mayHaveChildren(value) {
  31846. return isRef(value) || isDict(value) || isArray(value) || isStream(value);
  31847. }
  31848. function addChildren(node, nodesToVisit) {
  31849. var value;
  31850. if (isDict(node) || isStream(node)) {
  31851. var map;
  31852. if (isDict(node)) {
  31853. map = node.map;
  31854. } else {
  31855. map = node.dict.map;
  31856. }
  31857. for (var key in map) {
  31858. value = map[key];
  31859. if (mayHaveChildren(value)) {
  31860. nodesToVisit.push(value);
  31861. }
  31862. }
  31863. } else if (isArray(node)) {
  31864. for (var i = 0, ii = node.length; i < ii; i++) {
  31865. value = node[i];
  31866. if (mayHaveChildren(value)) {
  31867. nodesToVisit.push(value);
  31868. }
  31869. }
  31870. }
  31871. }
  31872. function ObjectLoader(obj, keys, xref) {
  31873. this.obj = obj;
  31874. this.keys = keys;
  31875. this.xref = xref;
  31876. this.refSet = null;
  31877. this.capability = null;
  31878. }
  31879. ObjectLoader.prototype = {
  31880. load: function ObjectLoader_load() {
  31881. var keys = this.keys;
  31882. this.capability = createPromiseCapability();
  31883. if (!(this.xref.stream instanceof ChunkedStream) || this.xref.stream.getMissingChunks().length === 0) {
  31884. this.capability.resolve();
  31885. return this.capability.promise;
  31886. }
  31887. this.refSet = new RefSet();
  31888. var nodesToVisit = [];
  31889. for (var i = 0; i < keys.length; i++) {
  31890. nodesToVisit.push(this.obj[keys[i]]);
  31891. }
  31892. this._walk(nodesToVisit);
  31893. return this.capability.promise;
  31894. },
  31895. _walk: function ObjectLoader_walk(nodesToVisit) {
  31896. var nodesToRevisit = [];
  31897. var pendingRequests = [];
  31898. while (nodesToVisit.length) {
  31899. var currentNode = nodesToVisit.pop();
  31900. if (isRef(currentNode)) {
  31901. if (this.refSet.has(currentNode)) {
  31902. continue;
  31903. }
  31904. try {
  31905. var ref = currentNode;
  31906. this.refSet.put(ref);
  31907. currentNode = this.xref.fetch(currentNode);
  31908. } catch (e) {
  31909. if (!(e instanceof MissingDataException)) {
  31910. throw e;
  31911. }
  31912. nodesToRevisit.push(currentNode);
  31913. pendingRequests.push({
  31914. begin: e.begin,
  31915. end: e.end
  31916. });
  31917. }
  31918. }
  31919. if (currentNode && currentNode.getBaseStreams) {
  31920. var baseStreams = currentNode.getBaseStreams();
  31921. var foundMissingData = false;
  31922. for (var i = 0; i < baseStreams.length; i++) {
  31923. var stream = baseStreams[i];
  31924. if (stream.getMissingChunks && stream.getMissingChunks().length) {
  31925. foundMissingData = true;
  31926. pendingRequests.push({
  31927. begin: stream.start,
  31928. end: stream.end
  31929. });
  31930. }
  31931. }
  31932. if (foundMissingData) {
  31933. nodesToRevisit.push(currentNode);
  31934. }
  31935. }
  31936. addChildren(currentNode, nodesToVisit);
  31937. }
  31938. if (pendingRequests.length) {
  31939. this.xref.stream.manager.requestRanges(pendingRequests).then(function pendingRequestCallback() {
  31940. nodesToVisit = nodesToRevisit;
  31941. for (var i = 0; i < nodesToRevisit.length; i++) {
  31942. var node = nodesToRevisit[i];
  31943. if (isRef(node)) {
  31944. this.refSet.remove(node);
  31945. }
  31946. }
  31947. this._walk(nodesToVisit);
  31948. }.bind(this), this.capability.reject);
  31949. return;
  31950. }
  31951. this.refSet = null;
  31952. this.capability.resolve();
  31953. }
  31954. };
  31955. return ObjectLoader;
  31956. }();
  31957. exports.Catalog = Catalog;
  31958. exports.ObjectLoader = ObjectLoader;
  31959. exports.XRef = XRef;
  31960. exports.FileSpec = FileSpec;
  31961. /***/ }),
  31962. /* 17 */
  31963. /***/ (function(module, exports, __w_pdfjs_require__) {
  31964. "use strict";
  31965. var sharedUtil = __w_pdfjs_require__(0);
  31966. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  31967. var getStdFontMap = getLookupTableFactory(function (t) {
  31968. t['ArialNarrow'] = 'Helvetica';
  31969. t['ArialNarrow-Bold'] = 'Helvetica-Bold';
  31970. t['ArialNarrow-BoldItalic'] = 'Helvetica-BoldOblique';
  31971. t['ArialNarrow-Italic'] = 'Helvetica-Oblique';
  31972. t['ArialBlack'] = 'Helvetica';
  31973. t['ArialBlack-Bold'] = 'Helvetica-Bold';
  31974. t['ArialBlack-BoldItalic'] = 'Helvetica-BoldOblique';
  31975. t['ArialBlack-Italic'] = 'Helvetica-Oblique';
  31976. t['Arial-Black'] = 'Helvetica';
  31977. t['Arial-Black-Bold'] = 'Helvetica-Bold';
  31978. t['Arial-Black-BoldItalic'] = 'Helvetica-BoldOblique';
  31979. t['Arial-Black-Italic'] = 'Helvetica-Oblique';
  31980. t['Arial'] = 'Helvetica';
  31981. t['Arial-Bold'] = 'Helvetica-Bold';
  31982. t['Arial-BoldItalic'] = 'Helvetica-BoldOblique';
  31983. t['Arial-Italic'] = 'Helvetica-Oblique';
  31984. t['Arial-BoldItalicMT'] = 'Helvetica-BoldOblique';
  31985. t['Arial-BoldMT'] = 'Helvetica-Bold';
  31986. t['Arial-ItalicMT'] = 'Helvetica-Oblique';
  31987. t['ArialMT'] = 'Helvetica';
  31988. t['Courier-Bold'] = 'Courier-Bold';
  31989. t['Courier-BoldItalic'] = 'Courier-BoldOblique';
  31990. t['Courier-Italic'] = 'Courier-Oblique';
  31991. t['CourierNew'] = 'Courier';
  31992. t['CourierNew-Bold'] = 'Courier-Bold';
  31993. t['CourierNew-BoldItalic'] = 'Courier-BoldOblique';
  31994. t['CourierNew-Italic'] = 'Courier-Oblique';
  31995. t['CourierNewPS-BoldItalicMT'] = 'Courier-BoldOblique';
  31996. t['CourierNewPS-BoldMT'] = 'Courier-Bold';
  31997. t['CourierNewPS-ItalicMT'] = 'Courier-Oblique';
  31998. t['CourierNewPSMT'] = 'Courier';
  31999. t['Helvetica'] = 'Helvetica';
  32000. t['Helvetica-Bold'] = 'Helvetica-Bold';
  32001. t['Helvetica-BoldItalic'] = 'Helvetica-BoldOblique';
  32002. t['Helvetica-BoldOblique'] = 'Helvetica-BoldOblique';
  32003. t['Helvetica-Italic'] = 'Helvetica-Oblique';
  32004. t['Helvetica-Oblique'] = 'Helvetica-Oblique';
  32005. t['Symbol-Bold'] = 'Symbol';
  32006. t['Symbol-BoldItalic'] = 'Symbol';
  32007. t['Symbol-Italic'] = 'Symbol';
  32008. t['TimesNewRoman'] = 'Times-Roman';
  32009. t['TimesNewRoman-Bold'] = 'Times-Bold';
  32010. t['TimesNewRoman-BoldItalic'] = 'Times-BoldItalic';
  32011. t['TimesNewRoman-Italic'] = 'Times-Italic';
  32012. t['TimesNewRomanPS'] = 'Times-Roman';
  32013. t['TimesNewRomanPS-Bold'] = 'Times-Bold';
  32014. t['TimesNewRomanPS-BoldItalic'] = 'Times-BoldItalic';
  32015. t['TimesNewRomanPS-BoldItalicMT'] = 'Times-BoldItalic';
  32016. t['TimesNewRomanPS-BoldMT'] = 'Times-Bold';
  32017. t['TimesNewRomanPS-Italic'] = 'Times-Italic';
  32018. t['TimesNewRomanPS-ItalicMT'] = 'Times-Italic';
  32019. t['TimesNewRomanPSMT'] = 'Times-Roman';
  32020. t['TimesNewRomanPSMT-Bold'] = 'Times-Bold';
  32021. t['TimesNewRomanPSMT-BoldItalic'] = 'Times-BoldItalic';
  32022. t['TimesNewRomanPSMT-Italic'] = 'Times-Italic';
  32023. });
  32024. var getNonStdFontMap = getLookupTableFactory(function (t) {
  32025. t['CenturyGothic'] = 'Helvetica';
  32026. t['CenturyGothic-Bold'] = 'Helvetica-Bold';
  32027. t['CenturyGothic-BoldItalic'] = 'Helvetica-BoldOblique';
  32028. t['CenturyGothic-Italic'] = 'Helvetica-Oblique';
  32029. t['ComicSansMS'] = 'Comic Sans MS';
  32030. t['ComicSansMS-Bold'] = 'Comic Sans MS-Bold';
  32031. t['ComicSansMS-BoldItalic'] = 'Comic Sans MS-BoldItalic';
  32032. t['ComicSansMS-Italic'] = 'Comic Sans MS-Italic';
  32033. t['LucidaConsole'] = 'Courier';
  32034. t['LucidaConsole-Bold'] = 'Courier-Bold';
  32035. t['LucidaConsole-BoldItalic'] = 'Courier-BoldOblique';
  32036. t['LucidaConsole-Italic'] = 'Courier-Oblique';
  32037. t['MS-Gothic'] = 'MS Gothic';
  32038. t['MS-Gothic-Bold'] = 'MS Gothic-Bold';
  32039. t['MS-Gothic-BoldItalic'] = 'MS Gothic-BoldItalic';
  32040. t['MS-Gothic-Italic'] = 'MS Gothic-Italic';
  32041. t['MS-Mincho'] = 'MS Mincho';
  32042. t['MS-Mincho-Bold'] = 'MS Mincho-Bold';
  32043. t['MS-Mincho-BoldItalic'] = 'MS Mincho-BoldItalic';
  32044. t['MS-Mincho-Italic'] = 'MS Mincho-Italic';
  32045. t['MS-PGothic'] = 'MS PGothic';
  32046. t['MS-PGothic-Bold'] = 'MS PGothic-Bold';
  32047. t['MS-PGothic-BoldItalic'] = 'MS PGothic-BoldItalic';
  32048. t['MS-PGothic-Italic'] = 'MS PGothic-Italic';
  32049. t['MS-PMincho'] = 'MS PMincho';
  32050. t['MS-PMincho-Bold'] = 'MS PMincho-Bold';
  32051. t['MS-PMincho-BoldItalic'] = 'MS PMincho-BoldItalic';
  32052. t['MS-PMincho-Italic'] = 'MS PMincho-Italic';
  32053. t['NuptialScript'] = 'Times-Italic';
  32054. t['Wingdings'] = 'ZapfDingbats';
  32055. });
  32056. var getSerifFonts = getLookupTableFactory(function (t) {
  32057. t['Adobe Jenson'] = true;
  32058. t['Adobe Text'] = true;
  32059. t['Albertus'] = true;
  32060. t['Aldus'] = true;
  32061. t['Alexandria'] = true;
  32062. t['Algerian'] = true;
  32063. t['American Typewriter'] = true;
  32064. t['Antiqua'] = true;
  32065. t['Apex'] = true;
  32066. t['Arno'] = true;
  32067. t['Aster'] = true;
  32068. t['Aurora'] = true;
  32069. t['Baskerville'] = true;
  32070. t['Bell'] = true;
  32071. t['Bembo'] = true;
  32072. t['Bembo Schoolbook'] = true;
  32073. t['Benguiat'] = true;
  32074. t['Berkeley Old Style'] = true;
  32075. t['Bernhard Modern'] = true;
  32076. t['Berthold City'] = true;
  32077. t['Bodoni'] = true;
  32078. t['Bauer Bodoni'] = true;
  32079. t['Book Antiqua'] = true;
  32080. t['Bookman'] = true;
  32081. t['Bordeaux Roman'] = true;
  32082. t['Californian FB'] = true;
  32083. t['Calisto'] = true;
  32084. t['Calvert'] = true;
  32085. t['Capitals'] = true;
  32086. t['Cambria'] = true;
  32087. t['Cartier'] = true;
  32088. t['Caslon'] = true;
  32089. t['Catull'] = true;
  32090. t['Centaur'] = true;
  32091. t['Century Old Style'] = true;
  32092. t['Century Schoolbook'] = true;
  32093. t['Chaparral'] = true;
  32094. t['Charis SIL'] = true;
  32095. t['Cheltenham'] = true;
  32096. t['Cholla Slab'] = true;
  32097. t['Clarendon'] = true;
  32098. t['Clearface'] = true;
  32099. t['Cochin'] = true;
  32100. t['Colonna'] = true;
  32101. t['Computer Modern'] = true;
  32102. t['Concrete Roman'] = true;
  32103. t['Constantia'] = true;
  32104. t['Cooper Black'] = true;
  32105. t['Corona'] = true;
  32106. t['Ecotype'] = true;
  32107. t['Egyptienne'] = true;
  32108. t['Elephant'] = true;
  32109. t['Excelsior'] = true;
  32110. t['Fairfield'] = true;
  32111. t['FF Scala'] = true;
  32112. t['Folkard'] = true;
  32113. t['Footlight'] = true;
  32114. t['FreeSerif'] = true;
  32115. t['Friz Quadrata'] = true;
  32116. t['Garamond'] = true;
  32117. t['Gentium'] = true;
  32118. t['Georgia'] = true;
  32119. t['Gloucester'] = true;
  32120. t['Goudy Old Style'] = true;
  32121. t['Goudy Schoolbook'] = true;
  32122. t['Goudy Pro Font'] = true;
  32123. t['Granjon'] = true;
  32124. t['Guardian Egyptian'] = true;
  32125. t['Heather'] = true;
  32126. t['Hercules'] = true;
  32127. t['High Tower Text'] = true;
  32128. t['Hiroshige'] = true;
  32129. t['Hoefler Text'] = true;
  32130. t['Humana Serif'] = true;
  32131. t['Imprint'] = true;
  32132. t['Ionic No. 5'] = true;
  32133. t['Janson'] = true;
  32134. t['Joanna'] = true;
  32135. t['Korinna'] = true;
  32136. t['Lexicon'] = true;
  32137. t['Liberation Serif'] = true;
  32138. t['Linux Libertine'] = true;
  32139. t['Literaturnaya'] = true;
  32140. t['Lucida'] = true;
  32141. t['Lucida Bright'] = true;
  32142. t['Melior'] = true;
  32143. t['Memphis'] = true;
  32144. t['Miller'] = true;
  32145. t['Minion'] = true;
  32146. t['Modern'] = true;
  32147. t['Mona Lisa'] = true;
  32148. t['Mrs Eaves'] = true;
  32149. t['MS Serif'] = true;
  32150. t['Museo Slab'] = true;
  32151. t['New York'] = true;
  32152. t['Nimbus Roman'] = true;
  32153. t['NPS Rawlinson Roadway'] = true;
  32154. t['NuptialScript'] = true;
  32155. t['Palatino'] = true;
  32156. t['Perpetua'] = true;
  32157. t['Plantin'] = true;
  32158. t['Plantin Schoolbook'] = true;
  32159. t['Playbill'] = true;
  32160. t['Poor Richard'] = true;
  32161. t['Rawlinson Roadway'] = true;
  32162. t['Renault'] = true;
  32163. t['Requiem'] = true;
  32164. t['Rockwell'] = true;
  32165. t['Roman'] = true;
  32166. t['Rotis Serif'] = true;
  32167. t['Sabon'] = true;
  32168. t['Scala'] = true;
  32169. t['Seagull'] = true;
  32170. t['Sistina'] = true;
  32171. t['Souvenir'] = true;
  32172. t['STIX'] = true;
  32173. t['Stone Informal'] = true;
  32174. t['Stone Serif'] = true;
  32175. t['Sylfaen'] = true;
  32176. t['Times'] = true;
  32177. t['Trajan'] = true;
  32178. t['Trinité'] = true;
  32179. t['Trump Mediaeval'] = true;
  32180. t['Utopia'] = true;
  32181. t['Vale Type'] = true;
  32182. t['Bitstream Vera'] = true;
  32183. t['Vera Serif'] = true;
  32184. t['Versailles'] = true;
  32185. t['Wanted'] = true;
  32186. t['Weiss'] = true;
  32187. t['Wide Latin'] = true;
  32188. t['Windsor'] = true;
  32189. t['XITS'] = true;
  32190. });
  32191. var getSymbolsFonts = getLookupTableFactory(function (t) {
  32192. t['Dingbats'] = true;
  32193. t['Symbol'] = true;
  32194. t['ZapfDingbats'] = true;
  32195. });
  32196. var getGlyphMapForStandardFonts = getLookupTableFactory(function (t) {
  32197. t[2] = 10;
  32198. t[3] = 32;
  32199. t[4] = 33;
  32200. t[5] = 34;
  32201. t[6] = 35;
  32202. t[7] = 36;
  32203. t[8] = 37;
  32204. t[9] = 38;
  32205. t[10] = 39;
  32206. t[11] = 40;
  32207. t[12] = 41;
  32208. t[13] = 42;
  32209. t[14] = 43;
  32210. t[15] = 44;
  32211. t[16] = 45;
  32212. t[17] = 46;
  32213. t[18] = 47;
  32214. t[19] = 48;
  32215. t[20] = 49;
  32216. t[21] = 50;
  32217. t[22] = 51;
  32218. t[23] = 52;
  32219. t[24] = 53;
  32220. t[25] = 54;
  32221. t[26] = 55;
  32222. t[27] = 56;
  32223. t[28] = 57;
  32224. t[29] = 58;
  32225. t[30] = 894;
  32226. t[31] = 60;
  32227. t[32] = 61;
  32228. t[33] = 62;
  32229. t[34] = 63;
  32230. t[35] = 64;
  32231. t[36] = 65;
  32232. t[37] = 66;
  32233. t[38] = 67;
  32234. t[39] = 68;
  32235. t[40] = 69;
  32236. t[41] = 70;
  32237. t[42] = 71;
  32238. t[43] = 72;
  32239. t[44] = 73;
  32240. t[45] = 74;
  32241. t[46] = 75;
  32242. t[47] = 76;
  32243. t[48] = 77;
  32244. t[49] = 78;
  32245. t[50] = 79;
  32246. t[51] = 80;
  32247. t[52] = 81;
  32248. t[53] = 82;
  32249. t[54] = 83;
  32250. t[55] = 84;
  32251. t[56] = 85;
  32252. t[57] = 86;
  32253. t[58] = 87;
  32254. t[59] = 88;
  32255. t[60] = 89;
  32256. t[61] = 90;
  32257. t[62] = 91;
  32258. t[63] = 92;
  32259. t[64] = 93;
  32260. t[65] = 94;
  32261. t[66] = 95;
  32262. t[67] = 96;
  32263. t[68] = 97;
  32264. t[69] = 98;
  32265. t[70] = 99;
  32266. t[71] = 100;
  32267. t[72] = 101;
  32268. t[73] = 102;
  32269. t[74] = 103;
  32270. t[75] = 104;
  32271. t[76] = 105;
  32272. t[77] = 106;
  32273. t[78] = 107;
  32274. t[79] = 108;
  32275. t[80] = 109;
  32276. t[81] = 110;
  32277. t[82] = 111;
  32278. t[83] = 112;
  32279. t[84] = 113;
  32280. t[85] = 114;
  32281. t[86] = 115;
  32282. t[87] = 116;
  32283. t[88] = 117;
  32284. t[89] = 118;
  32285. t[90] = 119;
  32286. t[91] = 120;
  32287. t[92] = 121;
  32288. t[93] = 122;
  32289. t[94] = 123;
  32290. t[95] = 124;
  32291. t[96] = 125;
  32292. t[97] = 126;
  32293. t[98] = 196;
  32294. t[99] = 197;
  32295. t[100] = 199;
  32296. t[101] = 201;
  32297. t[102] = 209;
  32298. t[103] = 214;
  32299. t[104] = 220;
  32300. t[105] = 225;
  32301. t[106] = 224;
  32302. t[107] = 226;
  32303. t[108] = 228;
  32304. t[109] = 227;
  32305. t[110] = 229;
  32306. t[111] = 231;
  32307. t[112] = 233;
  32308. t[113] = 232;
  32309. t[114] = 234;
  32310. t[115] = 235;
  32311. t[116] = 237;
  32312. t[117] = 236;
  32313. t[118] = 238;
  32314. t[119] = 239;
  32315. t[120] = 241;
  32316. t[121] = 243;
  32317. t[122] = 242;
  32318. t[123] = 244;
  32319. t[124] = 246;
  32320. t[125] = 245;
  32321. t[126] = 250;
  32322. t[127] = 249;
  32323. t[128] = 251;
  32324. t[129] = 252;
  32325. t[130] = 8224;
  32326. t[131] = 176;
  32327. t[132] = 162;
  32328. t[133] = 163;
  32329. t[134] = 167;
  32330. t[135] = 8226;
  32331. t[136] = 182;
  32332. t[137] = 223;
  32333. t[138] = 174;
  32334. t[139] = 169;
  32335. t[140] = 8482;
  32336. t[141] = 180;
  32337. t[142] = 168;
  32338. t[143] = 8800;
  32339. t[144] = 198;
  32340. t[145] = 216;
  32341. t[146] = 8734;
  32342. t[147] = 177;
  32343. t[148] = 8804;
  32344. t[149] = 8805;
  32345. t[150] = 165;
  32346. t[151] = 181;
  32347. t[152] = 8706;
  32348. t[153] = 8721;
  32349. t[154] = 8719;
  32350. t[156] = 8747;
  32351. t[157] = 170;
  32352. t[158] = 186;
  32353. t[159] = 8486;
  32354. t[160] = 230;
  32355. t[161] = 248;
  32356. t[162] = 191;
  32357. t[163] = 161;
  32358. t[164] = 172;
  32359. t[165] = 8730;
  32360. t[166] = 402;
  32361. t[167] = 8776;
  32362. t[168] = 8710;
  32363. t[169] = 171;
  32364. t[170] = 187;
  32365. t[171] = 8230;
  32366. t[210] = 218;
  32367. t[223] = 711;
  32368. t[224] = 321;
  32369. t[225] = 322;
  32370. t[227] = 353;
  32371. t[229] = 382;
  32372. t[234] = 253;
  32373. t[252] = 263;
  32374. t[253] = 268;
  32375. t[254] = 269;
  32376. t[258] = 258;
  32377. t[260] = 260;
  32378. t[261] = 261;
  32379. t[265] = 280;
  32380. t[266] = 281;
  32381. t[268] = 283;
  32382. t[269] = 313;
  32383. t[275] = 323;
  32384. t[276] = 324;
  32385. t[278] = 328;
  32386. t[284] = 345;
  32387. t[285] = 346;
  32388. t[286] = 347;
  32389. t[292] = 367;
  32390. t[295] = 377;
  32391. t[296] = 378;
  32392. t[298] = 380;
  32393. t[305] = 963;
  32394. t[306] = 964;
  32395. t[307] = 966;
  32396. t[308] = 8215;
  32397. t[309] = 8252;
  32398. t[310] = 8319;
  32399. t[311] = 8359;
  32400. t[312] = 8592;
  32401. t[313] = 8593;
  32402. t[337] = 9552;
  32403. t[493] = 1039;
  32404. t[494] = 1040;
  32405. t[705] = 1524;
  32406. t[706] = 8362;
  32407. t[710] = 64288;
  32408. t[711] = 64298;
  32409. t[759] = 1617;
  32410. t[761] = 1776;
  32411. t[763] = 1778;
  32412. t[775] = 1652;
  32413. t[777] = 1764;
  32414. t[778] = 1780;
  32415. t[779] = 1781;
  32416. t[780] = 1782;
  32417. t[782] = 771;
  32418. t[783] = 64726;
  32419. t[786] = 8363;
  32420. t[788] = 8532;
  32421. t[790] = 768;
  32422. t[791] = 769;
  32423. t[792] = 768;
  32424. t[795] = 803;
  32425. t[797] = 64336;
  32426. t[798] = 64337;
  32427. t[799] = 64342;
  32428. t[800] = 64343;
  32429. t[801] = 64344;
  32430. t[802] = 64345;
  32431. t[803] = 64362;
  32432. t[804] = 64363;
  32433. t[805] = 64364;
  32434. t[2424] = 7821;
  32435. t[2425] = 7822;
  32436. t[2426] = 7823;
  32437. t[2427] = 7824;
  32438. t[2428] = 7825;
  32439. t[2429] = 7826;
  32440. t[2430] = 7827;
  32441. t[2433] = 7682;
  32442. t[2678] = 8045;
  32443. t[2679] = 8046;
  32444. t[2830] = 1552;
  32445. t[2838] = 686;
  32446. t[2840] = 751;
  32447. t[2842] = 753;
  32448. t[2843] = 754;
  32449. t[2844] = 755;
  32450. t[2846] = 757;
  32451. t[2856] = 767;
  32452. t[2857] = 848;
  32453. t[2858] = 849;
  32454. t[2862] = 853;
  32455. t[2863] = 854;
  32456. t[2864] = 855;
  32457. t[2865] = 861;
  32458. t[2866] = 862;
  32459. t[2906] = 7460;
  32460. t[2908] = 7462;
  32461. t[2909] = 7463;
  32462. t[2910] = 7464;
  32463. t[2912] = 7466;
  32464. t[2913] = 7467;
  32465. t[2914] = 7468;
  32466. t[2916] = 7470;
  32467. t[2917] = 7471;
  32468. t[2918] = 7472;
  32469. t[2920] = 7474;
  32470. t[2921] = 7475;
  32471. t[2922] = 7476;
  32472. t[2924] = 7478;
  32473. t[2925] = 7479;
  32474. t[2926] = 7480;
  32475. t[2928] = 7482;
  32476. t[2929] = 7483;
  32477. t[2930] = 7484;
  32478. t[2932] = 7486;
  32479. t[2933] = 7487;
  32480. t[2934] = 7488;
  32481. t[2936] = 7490;
  32482. t[2937] = 7491;
  32483. t[2938] = 7492;
  32484. t[2940] = 7494;
  32485. t[2941] = 7495;
  32486. t[2942] = 7496;
  32487. t[2944] = 7498;
  32488. t[2946] = 7500;
  32489. t[2948] = 7502;
  32490. t[2950] = 7504;
  32491. t[2951] = 7505;
  32492. t[2952] = 7506;
  32493. t[2954] = 7508;
  32494. t[2955] = 7509;
  32495. t[2956] = 7510;
  32496. t[2958] = 7512;
  32497. t[2959] = 7513;
  32498. t[2960] = 7514;
  32499. t[2962] = 7516;
  32500. t[2963] = 7517;
  32501. t[2964] = 7518;
  32502. t[2966] = 7520;
  32503. t[2967] = 7521;
  32504. t[2968] = 7522;
  32505. t[2970] = 7524;
  32506. t[2971] = 7525;
  32507. t[2972] = 7526;
  32508. t[2974] = 7528;
  32509. t[2975] = 7529;
  32510. t[2976] = 7530;
  32511. t[2978] = 1537;
  32512. t[2979] = 1538;
  32513. t[2980] = 1539;
  32514. t[2982] = 1549;
  32515. t[2983] = 1551;
  32516. t[2984] = 1552;
  32517. t[2986] = 1554;
  32518. t[2987] = 1555;
  32519. t[2988] = 1556;
  32520. t[2990] = 1623;
  32521. t[2991] = 1624;
  32522. t[2995] = 1775;
  32523. t[2999] = 1791;
  32524. t[3002] = 64290;
  32525. t[3003] = 64291;
  32526. t[3004] = 64292;
  32527. t[3006] = 64294;
  32528. t[3007] = 64295;
  32529. t[3008] = 64296;
  32530. t[3011] = 1900;
  32531. t[3014] = 8223;
  32532. t[3015] = 8244;
  32533. t[3017] = 7532;
  32534. t[3018] = 7533;
  32535. t[3019] = 7534;
  32536. t[3075] = 7590;
  32537. t[3076] = 7591;
  32538. t[3079] = 7594;
  32539. t[3080] = 7595;
  32540. t[3083] = 7598;
  32541. t[3084] = 7599;
  32542. t[3087] = 7602;
  32543. t[3088] = 7603;
  32544. t[3091] = 7606;
  32545. t[3092] = 7607;
  32546. t[3095] = 7610;
  32547. t[3096] = 7611;
  32548. t[3099] = 7614;
  32549. t[3100] = 7615;
  32550. t[3103] = 7618;
  32551. t[3104] = 7619;
  32552. t[3107] = 8337;
  32553. t[3108] = 8338;
  32554. t[3116] = 1884;
  32555. t[3119] = 1885;
  32556. t[3120] = 1885;
  32557. t[3123] = 1886;
  32558. t[3124] = 1886;
  32559. t[3127] = 1887;
  32560. t[3128] = 1887;
  32561. t[3131] = 1888;
  32562. t[3132] = 1888;
  32563. t[3135] = 1889;
  32564. t[3136] = 1889;
  32565. t[3139] = 1890;
  32566. t[3140] = 1890;
  32567. t[3143] = 1891;
  32568. t[3144] = 1891;
  32569. t[3147] = 1892;
  32570. t[3148] = 1892;
  32571. t[3153] = 580;
  32572. t[3154] = 581;
  32573. t[3157] = 584;
  32574. t[3158] = 585;
  32575. t[3161] = 588;
  32576. t[3162] = 589;
  32577. t[3165] = 891;
  32578. t[3166] = 892;
  32579. t[3169] = 1274;
  32580. t[3170] = 1275;
  32581. t[3173] = 1278;
  32582. t[3174] = 1279;
  32583. t[3181] = 7622;
  32584. t[3182] = 7623;
  32585. t[3282] = 11799;
  32586. t[3316] = 578;
  32587. t[3379] = 42785;
  32588. t[3393] = 1159;
  32589. t[3416] = 8377;
  32590. });
  32591. var getSupplementalGlyphMapForArialBlack = getLookupTableFactory(function (t) {
  32592. t[227] = 322;
  32593. t[264] = 261;
  32594. t[291] = 346;
  32595. });
  32596. exports.getStdFontMap = getStdFontMap;
  32597. exports.getNonStdFontMap = getNonStdFontMap;
  32598. exports.getSerifFonts = getSerifFonts;
  32599. exports.getSymbolsFonts = getSymbolsFonts;
  32600. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  32601. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  32602. /***/ }),
  32603. /* 18 */
  32604. /***/ (function(module, exports, __w_pdfjs_require__) {
  32605. "use strict";
  32606. var sharedUtil = __w_pdfjs_require__(0);
  32607. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  32608. var getSpecialPUASymbols = getLookupTableFactory(function (t) {
  32609. t[63721] = 0x00A9;
  32610. t[63193] = 0x00A9;
  32611. t[63720] = 0x00AE;
  32612. t[63194] = 0x00AE;
  32613. t[63722] = 0x2122;
  32614. t[63195] = 0x2122;
  32615. t[63729] = 0x23A7;
  32616. t[63730] = 0x23A8;
  32617. t[63731] = 0x23A9;
  32618. t[63740] = 0x23AB;
  32619. t[63741] = 0x23AC;
  32620. t[63742] = 0x23AD;
  32621. t[63726] = 0x23A1;
  32622. t[63727] = 0x23A2;
  32623. t[63728] = 0x23A3;
  32624. t[63737] = 0x23A4;
  32625. t[63738] = 0x23A5;
  32626. t[63739] = 0x23A6;
  32627. t[63723] = 0x239B;
  32628. t[63724] = 0x239C;
  32629. t[63725] = 0x239D;
  32630. t[63734] = 0x239E;
  32631. t[63735] = 0x239F;
  32632. t[63736] = 0x23A0;
  32633. });
  32634. function mapSpecialUnicodeValues(code) {
  32635. if (code >= 0xFFF0 && code <= 0xFFFF) {
  32636. return 0;
  32637. } else if (code >= 0xF600 && code <= 0xF8FF) {
  32638. return getSpecialPUASymbols()[code] || code;
  32639. }
  32640. return code;
  32641. }
  32642. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  32643. var unicode = glyphsUnicodeMap[name];
  32644. if (unicode !== undefined) {
  32645. return unicode;
  32646. }
  32647. if (!name) {
  32648. return -1;
  32649. }
  32650. if (name[0] === 'u') {
  32651. var nameLen = name.length, hexStr;
  32652. if (nameLen === 7 && name[1] === 'n' && name[2] === 'i') {
  32653. hexStr = name.substr(3);
  32654. } else if (nameLen >= 5 && nameLen <= 7) {
  32655. hexStr = name.substr(1);
  32656. } else {
  32657. return -1;
  32658. }
  32659. if (hexStr === hexStr.toUpperCase()) {
  32660. unicode = parseInt(hexStr, 16);
  32661. if (unicode >= 0) {
  32662. return unicode;
  32663. }
  32664. }
  32665. }
  32666. return -1;
  32667. }
  32668. var UnicodeRanges = [
  32669. {
  32670. 'begin': 0x0000,
  32671. 'end': 0x007F
  32672. },
  32673. {
  32674. 'begin': 0x0080,
  32675. 'end': 0x00FF
  32676. },
  32677. {
  32678. 'begin': 0x0100,
  32679. 'end': 0x017F
  32680. },
  32681. {
  32682. 'begin': 0x0180,
  32683. 'end': 0x024F
  32684. },
  32685. {
  32686. 'begin': 0x0250,
  32687. 'end': 0x02AF
  32688. },
  32689. {
  32690. 'begin': 0x02B0,
  32691. 'end': 0x02FF
  32692. },
  32693. {
  32694. 'begin': 0x0300,
  32695. 'end': 0x036F
  32696. },
  32697. {
  32698. 'begin': 0x0370,
  32699. 'end': 0x03FF
  32700. },
  32701. {
  32702. 'begin': 0x2C80,
  32703. 'end': 0x2CFF
  32704. },
  32705. {
  32706. 'begin': 0x0400,
  32707. 'end': 0x04FF
  32708. },
  32709. {
  32710. 'begin': 0x0530,
  32711. 'end': 0x058F
  32712. },
  32713. {
  32714. 'begin': 0x0590,
  32715. 'end': 0x05FF
  32716. },
  32717. {
  32718. 'begin': 0xA500,
  32719. 'end': 0xA63F
  32720. },
  32721. {
  32722. 'begin': 0x0600,
  32723. 'end': 0x06FF
  32724. },
  32725. {
  32726. 'begin': 0x07C0,
  32727. 'end': 0x07FF
  32728. },
  32729. {
  32730. 'begin': 0x0900,
  32731. 'end': 0x097F
  32732. },
  32733. {
  32734. 'begin': 0x0980,
  32735. 'end': 0x09FF
  32736. },
  32737. {
  32738. 'begin': 0x0A00,
  32739. 'end': 0x0A7F
  32740. },
  32741. {
  32742. 'begin': 0x0A80,
  32743. 'end': 0x0AFF
  32744. },
  32745. {
  32746. 'begin': 0x0B00,
  32747. 'end': 0x0B7F
  32748. },
  32749. {
  32750. 'begin': 0x0B80,
  32751. 'end': 0x0BFF
  32752. },
  32753. {
  32754. 'begin': 0x0C00,
  32755. 'end': 0x0C7F
  32756. },
  32757. {
  32758. 'begin': 0x0C80,
  32759. 'end': 0x0CFF
  32760. },
  32761. {
  32762. 'begin': 0x0D00,
  32763. 'end': 0x0D7F
  32764. },
  32765. {
  32766. 'begin': 0x0E00,
  32767. 'end': 0x0E7F
  32768. },
  32769. {
  32770. 'begin': 0x0E80,
  32771. 'end': 0x0EFF
  32772. },
  32773. {
  32774. 'begin': 0x10A0,
  32775. 'end': 0x10FF
  32776. },
  32777. {
  32778. 'begin': 0x1B00,
  32779. 'end': 0x1B7F
  32780. },
  32781. {
  32782. 'begin': 0x1100,
  32783. 'end': 0x11FF
  32784. },
  32785. {
  32786. 'begin': 0x1E00,
  32787. 'end': 0x1EFF
  32788. },
  32789. {
  32790. 'begin': 0x1F00,
  32791. 'end': 0x1FFF
  32792. },
  32793. {
  32794. 'begin': 0x2000,
  32795. 'end': 0x206F
  32796. },
  32797. {
  32798. 'begin': 0x2070,
  32799. 'end': 0x209F
  32800. },
  32801. {
  32802. 'begin': 0x20A0,
  32803. 'end': 0x20CF
  32804. },
  32805. {
  32806. 'begin': 0x20D0,
  32807. 'end': 0x20FF
  32808. },
  32809. {
  32810. 'begin': 0x2100,
  32811. 'end': 0x214F
  32812. },
  32813. {
  32814. 'begin': 0x2150,
  32815. 'end': 0x218F
  32816. },
  32817. {
  32818. 'begin': 0x2190,
  32819. 'end': 0x21FF
  32820. },
  32821. {
  32822. 'begin': 0x2200,
  32823. 'end': 0x22FF
  32824. },
  32825. {
  32826. 'begin': 0x2300,
  32827. 'end': 0x23FF
  32828. },
  32829. {
  32830. 'begin': 0x2400,
  32831. 'end': 0x243F
  32832. },
  32833. {
  32834. 'begin': 0x2440,
  32835. 'end': 0x245F
  32836. },
  32837. {
  32838. 'begin': 0x2460,
  32839. 'end': 0x24FF
  32840. },
  32841. {
  32842. 'begin': 0x2500,
  32843. 'end': 0x257F
  32844. },
  32845. {
  32846. 'begin': 0x2580,
  32847. 'end': 0x259F
  32848. },
  32849. {
  32850. 'begin': 0x25A0,
  32851. 'end': 0x25FF
  32852. },
  32853. {
  32854. 'begin': 0x2600,
  32855. 'end': 0x26FF
  32856. },
  32857. {
  32858. 'begin': 0x2700,
  32859. 'end': 0x27BF
  32860. },
  32861. {
  32862. 'begin': 0x3000,
  32863. 'end': 0x303F
  32864. },
  32865. {
  32866. 'begin': 0x3040,
  32867. 'end': 0x309F
  32868. },
  32869. {
  32870. 'begin': 0x30A0,
  32871. 'end': 0x30FF
  32872. },
  32873. {
  32874. 'begin': 0x3100,
  32875. 'end': 0x312F
  32876. },
  32877. {
  32878. 'begin': 0x3130,
  32879. 'end': 0x318F
  32880. },
  32881. {
  32882. 'begin': 0xA840,
  32883. 'end': 0xA87F
  32884. },
  32885. {
  32886. 'begin': 0x3200,
  32887. 'end': 0x32FF
  32888. },
  32889. {
  32890. 'begin': 0x3300,
  32891. 'end': 0x33FF
  32892. },
  32893. {
  32894. 'begin': 0xAC00,
  32895. 'end': 0xD7AF
  32896. },
  32897. {
  32898. 'begin': 0xD800,
  32899. 'end': 0xDFFF
  32900. },
  32901. {
  32902. 'begin': 0x10900,
  32903. 'end': 0x1091F
  32904. },
  32905. {
  32906. 'begin': 0x4E00,
  32907. 'end': 0x9FFF
  32908. },
  32909. {
  32910. 'begin': 0xE000,
  32911. 'end': 0xF8FF
  32912. },
  32913. {
  32914. 'begin': 0x31C0,
  32915. 'end': 0x31EF
  32916. },
  32917. {
  32918. 'begin': 0xFB00,
  32919. 'end': 0xFB4F
  32920. },
  32921. {
  32922. 'begin': 0xFB50,
  32923. 'end': 0xFDFF
  32924. },
  32925. {
  32926. 'begin': 0xFE20,
  32927. 'end': 0xFE2F
  32928. },
  32929. {
  32930. 'begin': 0xFE10,
  32931. 'end': 0xFE1F
  32932. },
  32933. {
  32934. 'begin': 0xFE50,
  32935. 'end': 0xFE6F
  32936. },
  32937. {
  32938. 'begin': 0xFE70,
  32939. 'end': 0xFEFF
  32940. },
  32941. {
  32942. 'begin': 0xFF00,
  32943. 'end': 0xFFEF
  32944. },
  32945. {
  32946. 'begin': 0xFFF0,
  32947. 'end': 0xFFFF
  32948. },
  32949. {
  32950. 'begin': 0x0F00,
  32951. 'end': 0x0FFF
  32952. },
  32953. {
  32954. 'begin': 0x0700,
  32955. 'end': 0x074F
  32956. },
  32957. {
  32958. 'begin': 0x0780,
  32959. 'end': 0x07BF
  32960. },
  32961. {
  32962. 'begin': 0x0D80,
  32963. 'end': 0x0DFF
  32964. },
  32965. {
  32966. 'begin': 0x1000,
  32967. 'end': 0x109F
  32968. },
  32969. {
  32970. 'begin': 0x1200,
  32971. 'end': 0x137F
  32972. },
  32973. {
  32974. 'begin': 0x13A0,
  32975. 'end': 0x13FF
  32976. },
  32977. {
  32978. 'begin': 0x1400,
  32979. 'end': 0x167F
  32980. },
  32981. {
  32982. 'begin': 0x1680,
  32983. 'end': 0x169F
  32984. },
  32985. {
  32986. 'begin': 0x16A0,
  32987. 'end': 0x16FF
  32988. },
  32989. {
  32990. 'begin': 0x1780,
  32991. 'end': 0x17FF
  32992. },
  32993. {
  32994. 'begin': 0x1800,
  32995. 'end': 0x18AF
  32996. },
  32997. {
  32998. 'begin': 0x2800,
  32999. 'end': 0x28FF
  33000. },
  33001. {
  33002. 'begin': 0xA000,
  33003. 'end': 0xA48F
  33004. },
  33005. {
  33006. 'begin': 0x1700,
  33007. 'end': 0x171F
  33008. },
  33009. {
  33010. 'begin': 0x10300,
  33011. 'end': 0x1032F
  33012. },
  33013. {
  33014. 'begin': 0x10330,
  33015. 'end': 0x1034F
  33016. },
  33017. {
  33018. 'begin': 0x10400,
  33019. 'end': 0x1044F
  33020. },
  33021. {
  33022. 'begin': 0x1D000,
  33023. 'end': 0x1D0FF
  33024. },
  33025. {
  33026. 'begin': 0x1D400,
  33027. 'end': 0x1D7FF
  33028. },
  33029. {
  33030. 'begin': 0xFF000,
  33031. 'end': 0xFFFFD
  33032. },
  33033. {
  33034. 'begin': 0xFE00,
  33035. 'end': 0xFE0F
  33036. },
  33037. {
  33038. 'begin': 0xE0000,
  33039. 'end': 0xE007F
  33040. },
  33041. {
  33042. 'begin': 0x1900,
  33043. 'end': 0x194F
  33044. },
  33045. {
  33046. 'begin': 0x1950,
  33047. 'end': 0x197F
  33048. },
  33049. {
  33050. 'begin': 0x1980,
  33051. 'end': 0x19DF
  33052. },
  33053. {
  33054. 'begin': 0x1A00,
  33055. 'end': 0x1A1F
  33056. },
  33057. {
  33058. 'begin': 0x2C00,
  33059. 'end': 0x2C5F
  33060. },
  33061. {
  33062. 'begin': 0x2D30,
  33063. 'end': 0x2D7F
  33064. },
  33065. {
  33066. 'begin': 0x4DC0,
  33067. 'end': 0x4DFF
  33068. },
  33069. {
  33070. 'begin': 0xA800,
  33071. 'end': 0xA82F
  33072. },
  33073. {
  33074. 'begin': 0x10000,
  33075. 'end': 0x1007F
  33076. },
  33077. {
  33078. 'begin': 0x10140,
  33079. 'end': 0x1018F
  33080. },
  33081. {
  33082. 'begin': 0x10380,
  33083. 'end': 0x1039F
  33084. },
  33085. {
  33086. 'begin': 0x103A0,
  33087. 'end': 0x103DF
  33088. },
  33089. {
  33090. 'begin': 0x10450,
  33091. 'end': 0x1047F
  33092. },
  33093. {
  33094. 'begin': 0x10480,
  33095. 'end': 0x104AF
  33096. },
  33097. {
  33098. 'begin': 0x10800,
  33099. 'end': 0x1083F
  33100. },
  33101. {
  33102. 'begin': 0x10A00,
  33103. 'end': 0x10A5F
  33104. },
  33105. {
  33106. 'begin': 0x1D300,
  33107. 'end': 0x1D35F
  33108. },
  33109. {
  33110. 'begin': 0x12000,
  33111. 'end': 0x123FF
  33112. },
  33113. {
  33114. 'begin': 0x1D360,
  33115. 'end': 0x1D37F
  33116. },
  33117. {
  33118. 'begin': 0x1B80,
  33119. 'end': 0x1BBF
  33120. },
  33121. {
  33122. 'begin': 0x1C00,
  33123. 'end': 0x1C4F
  33124. },
  33125. {
  33126. 'begin': 0x1C50,
  33127. 'end': 0x1C7F
  33128. },
  33129. {
  33130. 'begin': 0xA880,
  33131. 'end': 0xA8DF
  33132. },
  33133. {
  33134. 'begin': 0xA900,
  33135. 'end': 0xA92F
  33136. },
  33137. {
  33138. 'begin': 0xA930,
  33139. 'end': 0xA95F
  33140. },
  33141. {
  33142. 'begin': 0xAA00,
  33143. 'end': 0xAA5F
  33144. },
  33145. {
  33146. 'begin': 0x10190,
  33147. 'end': 0x101CF
  33148. },
  33149. {
  33150. 'begin': 0x101D0,
  33151. 'end': 0x101FF
  33152. },
  33153. {
  33154. 'begin': 0x102A0,
  33155. 'end': 0x102DF
  33156. },
  33157. {
  33158. 'begin': 0x1F030,
  33159. 'end': 0x1F09F
  33160. }
  33161. ];
  33162. function getUnicodeRangeFor(value) {
  33163. for (var i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  33164. var range = UnicodeRanges[i];
  33165. if (value >= range.begin && value < range.end) {
  33166. return i;
  33167. }
  33168. }
  33169. return -1;
  33170. }
  33171. function isRTLRangeFor(value) {
  33172. var range = UnicodeRanges[13];
  33173. if (value >= range.begin && value < range.end) {
  33174. return true;
  33175. }
  33176. range = UnicodeRanges[11];
  33177. if (value >= range.begin && value < range.end) {
  33178. return true;
  33179. }
  33180. return false;
  33181. }
  33182. var getNormalizedUnicodes = getLookupTableFactory(function (t) {
  33183. t['\u00A8'] = '\u0020\u0308';
  33184. t['\u00AF'] = '\u0020\u0304';
  33185. t['\u00B4'] = '\u0020\u0301';
  33186. t['\u00B5'] = '\u03BC';
  33187. t['\u00B8'] = '\u0020\u0327';
  33188. t['\u0132'] = '\u0049\u004A';
  33189. t['\u0133'] = '\u0069\u006A';
  33190. t['\u013F'] = '\u004C\u00B7';
  33191. t['\u0140'] = '\u006C\u00B7';
  33192. t['\u0149'] = '\u02BC\u006E';
  33193. t['\u017F'] = '\u0073';
  33194. t['\u01C4'] = '\u0044\u017D';
  33195. t['\u01C5'] = '\u0044\u017E';
  33196. t['\u01C6'] = '\u0064\u017E';
  33197. t['\u01C7'] = '\u004C\u004A';
  33198. t['\u01C8'] = '\u004C\u006A';
  33199. t['\u01C9'] = '\u006C\u006A';
  33200. t['\u01CA'] = '\u004E\u004A';
  33201. t['\u01CB'] = '\u004E\u006A';
  33202. t['\u01CC'] = '\u006E\u006A';
  33203. t['\u01F1'] = '\u0044\u005A';
  33204. t['\u01F2'] = '\u0044\u007A';
  33205. t['\u01F3'] = '\u0064\u007A';
  33206. t['\u02D8'] = '\u0020\u0306';
  33207. t['\u02D9'] = '\u0020\u0307';
  33208. t['\u02DA'] = '\u0020\u030A';
  33209. t['\u02DB'] = '\u0020\u0328';
  33210. t['\u02DC'] = '\u0020\u0303';
  33211. t['\u02DD'] = '\u0020\u030B';
  33212. t['\u037A'] = '\u0020\u0345';
  33213. t['\u0384'] = '\u0020\u0301';
  33214. t['\u03D0'] = '\u03B2';
  33215. t['\u03D1'] = '\u03B8';
  33216. t['\u03D2'] = '\u03A5';
  33217. t['\u03D5'] = '\u03C6';
  33218. t['\u03D6'] = '\u03C0';
  33219. t['\u03F0'] = '\u03BA';
  33220. t['\u03F1'] = '\u03C1';
  33221. t['\u03F2'] = '\u03C2';
  33222. t['\u03F4'] = '\u0398';
  33223. t['\u03F5'] = '\u03B5';
  33224. t['\u03F9'] = '\u03A3';
  33225. t['\u0587'] = '\u0565\u0582';
  33226. t['\u0675'] = '\u0627\u0674';
  33227. t['\u0676'] = '\u0648\u0674';
  33228. t['\u0677'] = '\u06C7\u0674';
  33229. t['\u0678'] = '\u064A\u0674';
  33230. t['\u0E33'] = '\u0E4D\u0E32';
  33231. t['\u0EB3'] = '\u0ECD\u0EB2';
  33232. t['\u0EDC'] = '\u0EAB\u0E99';
  33233. t['\u0EDD'] = '\u0EAB\u0EA1';
  33234. t['\u0F77'] = '\u0FB2\u0F81';
  33235. t['\u0F79'] = '\u0FB3\u0F81';
  33236. t['\u1E9A'] = '\u0061\u02BE';
  33237. t['\u1FBD'] = '\u0020\u0313';
  33238. t['\u1FBF'] = '\u0020\u0313';
  33239. t['\u1FC0'] = '\u0020\u0342';
  33240. t['\u1FFE'] = '\u0020\u0314';
  33241. t['\u2002'] = '\u0020';
  33242. t['\u2003'] = '\u0020';
  33243. t['\u2004'] = '\u0020';
  33244. t['\u2005'] = '\u0020';
  33245. t['\u2006'] = '\u0020';
  33246. t['\u2008'] = '\u0020';
  33247. t['\u2009'] = '\u0020';
  33248. t['\u200A'] = '\u0020';
  33249. t['\u2017'] = '\u0020\u0333';
  33250. t['\u2024'] = '\u002E';
  33251. t['\u2025'] = '\u002E\u002E';
  33252. t['\u2026'] = '\u002E\u002E\u002E';
  33253. t['\u2033'] = '\u2032\u2032';
  33254. t['\u2034'] = '\u2032\u2032\u2032';
  33255. t['\u2036'] = '\u2035\u2035';
  33256. t['\u2037'] = '\u2035\u2035\u2035';
  33257. t['\u203C'] = '\u0021\u0021';
  33258. t['\u203E'] = '\u0020\u0305';
  33259. t['\u2047'] = '\u003F\u003F';
  33260. t['\u2048'] = '\u003F\u0021';
  33261. t['\u2049'] = '\u0021\u003F';
  33262. t['\u2057'] = '\u2032\u2032\u2032\u2032';
  33263. t['\u205F'] = '\u0020';
  33264. t['\u20A8'] = '\u0052\u0073';
  33265. t['\u2100'] = '\u0061\u002F\u0063';
  33266. t['\u2101'] = '\u0061\u002F\u0073';
  33267. t['\u2103'] = '\u00B0\u0043';
  33268. t['\u2105'] = '\u0063\u002F\u006F';
  33269. t['\u2106'] = '\u0063\u002F\u0075';
  33270. t['\u2107'] = '\u0190';
  33271. t['\u2109'] = '\u00B0\u0046';
  33272. t['\u2116'] = '\u004E\u006F';
  33273. t['\u2121'] = '\u0054\u0045\u004C';
  33274. t['\u2135'] = '\u05D0';
  33275. t['\u2136'] = '\u05D1';
  33276. t['\u2137'] = '\u05D2';
  33277. t['\u2138'] = '\u05D3';
  33278. t['\u213B'] = '\u0046\u0041\u0058';
  33279. t['\u2160'] = '\u0049';
  33280. t['\u2161'] = '\u0049\u0049';
  33281. t['\u2162'] = '\u0049\u0049\u0049';
  33282. t['\u2163'] = '\u0049\u0056';
  33283. t['\u2164'] = '\u0056';
  33284. t['\u2165'] = '\u0056\u0049';
  33285. t['\u2166'] = '\u0056\u0049\u0049';
  33286. t['\u2167'] = '\u0056\u0049\u0049\u0049';
  33287. t['\u2168'] = '\u0049\u0058';
  33288. t['\u2169'] = '\u0058';
  33289. t['\u216A'] = '\u0058\u0049';
  33290. t['\u216B'] = '\u0058\u0049\u0049';
  33291. t['\u216C'] = '\u004C';
  33292. t['\u216D'] = '\u0043';
  33293. t['\u216E'] = '\u0044';
  33294. t['\u216F'] = '\u004D';
  33295. t['\u2170'] = '\u0069';
  33296. t['\u2171'] = '\u0069\u0069';
  33297. t['\u2172'] = '\u0069\u0069\u0069';
  33298. t['\u2173'] = '\u0069\u0076';
  33299. t['\u2174'] = '\u0076';
  33300. t['\u2175'] = '\u0076\u0069';
  33301. t['\u2176'] = '\u0076\u0069\u0069';
  33302. t['\u2177'] = '\u0076\u0069\u0069\u0069';
  33303. t['\u2178'] = '\u0069\u0078';
  33304. t['\u2179'] = '\u0078';
  33305. t['\u217A'] = '\u0078\u0069';
  33306. t['\u217B'] = '\u0078\u0069\u0069';
  33307. t['\u217C'] = '\u006C';
  33308. t['\u217D'] = '\u0063';
  33309. t['\u217E'] = '\u0064';
  33310. t['\u217F'] = '\u006D';
  33311. t['\u222C'] = '\u222B\u222B';
  33312. t['\u222D'] = '\u222B\u222B\u222B';
  33313. t['\u222F'] = '\u222E\u222E';
  33314. t['\u2230'] = '\u222E\u222E\u222E';
  33315. t['\u2474'] = '\u0028\u0031\u0029';
  33316. t['\u2475'] = '\u0028\u0032\u0029';
  33317. t['\u2476'] = '\u0028\u0033\u0029';
  33318. t['\u2477'] = '\u0028\u0034\u0029';
  33319. t['\u2478'] = '\u0028\u0035\u0029';
  33320. t['\u2479'] = '\u0028\u0036\u0029';
  33321. t['\u247A'] = '\u0028\u0037\u0029';
  33322. t['\u247B'] = '\u0028\u0038\u0029';
  33323. t['\u247C'] = '\u0028\u0039\u0029';
  33324. t['\u247D'] = '\u0028\u0031\u0030\u0029';
  33325. t['\u247E'] = '\u0028\u0031\u0031\u0029';
  33326. t['\u247F'] = '\u0028\u0031\u0032\u0029';
  33327. t['\u2480'] = '\u0028\u0031\u0033\u0029';
  33328. t['\u2481'] = '\u0028\u0031\u0034\u0029';
  33329. t['\u2482'] = '\u0028\u0031\u0035\u0029';
  33330. t['\u2483'] = '\u0028\u0031\u0036\u0029';
  33331. t['\u2484'] = '\u0028\u0031\u0037\u0029';
  33332. t['\u2485'] = '\u0028\u0031\u0038\u0029';
  33333. t['\u2486'] = '\u0028\u0031\u0039\u0029';
  33334. t['\u2487'] = '\u0028\u0032\u0030\u0029';
  33335. t['\u2488'] = '\u0031\u002E';
  33336. t['\u2489'] = '\u0032\u002E';
  33337. t['\u248A'] = '\u0033\u002E';
  33338. t['\u248B'] = '\u0034\u002E';
  33339. t['\u248C'] = '\u0035\u002E';
  33340. t['\u248D'] = '\u0036\u002E';
  33341. t['\u248E'] = '\u0037\u002E';
  33342. t['\u248F'] = '\u0038\u002E';
  33343. t['\u2490'] = '\u0039\u002E';
  33344. t['\u2491'] = '\u0031\u0030\u002E';
  33345. t['\u2492'] = '\u0031\u0031\u002E';
  33346. t['\u2493'] = '\u0031\u0032\u002E';
  33347. t['\u2494'] = '\u0031\u0033\u002E';
  33348. t['\u2495'] = '\u0031\u0034\u002E';
  33349. t['\u2496'] = '\u0031\u0035\u002E';
  33350. t['\u2497'] = '\u0031\u0036\u002E';
  33351. t['\u2498'] = '\u0031\u0037\u002E';
  33352. t['\u2499'] = '\u0031\u0038\u002E';
  33353. t['\u249A'] = '\u0031\u0039\u002E';
  33354. t['\u249B'] = '\u0032\u0030\u002E';
  33355. t['\u249C'] = '\u0028\u0061\u0029';
  33356. t['\u249D'] = '\u0028\u0062\u0029';
  33357. t['\u249E'] = '\u0028\u0063\u0029';
  33358. t['\u249F'] = '\u0028\u0064\u0029';
  33359. t['\u24A0'] = '\u0028\u0065\u0029';
  33360. t['\u24A1'] = '\u0028\u0066\u0029';
  33361. t['\u24A2'] = '\u0028\u0067\u0029';
  33362. t['\u24A3'] = '\u0028\u0068\u0029';
  33363. t['\u24A4'] = '\u0028\u0069\u0029';
  33364. t['\u24A5'] = '\u0028\u006A\u0029';
  33365. t['\u24A6'] = '\u0028\u006B\u0029';
  33366. t['\u24A7'] = '\u0028\u006C\u0029';
  33367. t['\u24A8'] = '\u0028\u006D\u0029';
  33368. t['\u24A9'] = '\u0028\u006E\u0029';
  33369. t['\u24AA'] = '\u0028\u006F\u0029';
  33370. t['\u24AB'] = '\u0028\u0070\u0029';
  33371. t['\u24AC'] = '\u0028\u0071\u0029';
  33372. t['\u24AD'] = '\u0028\u0072\u0029';
  33373. t['\u24AE'] = '\u0028\u0073\u0029';
  33374. t['\u24AF'] = '\u0028\u0074\u0029';
  33375. t['\u24B0'] = '\u0028\u0075\u0029';
  33376. t['\u24B1'] = '\u0028\u0076\u0029';
  33377. t['\u24B2'] = '\u0028\u0077\u0029';
  33378. t['\u24B3'] = '\u0028\u0078\u0029';
  33379. t['\u24B4'] = '\u0028\u0079\u0029';
  33380. t['\u24B5'] = '\u0028\u007A\u0029';
  33381. t['\u2A0C'] = '\u222B\u222B\u222B\u222B';
  33382. t['\u2A74'] = '\u003A\u003A\u003D';
  33383. t['\u2A75'] = '\u003D\u003D';
  33384. t['\u2A76'] = '\u003D\u003D\u003D';
  33385. t['\u2E9F'] = '\u6BCD';
  33386. t['\u2EF3'] = '\u9F9F';
  33387. t['\u2F00'] = '\u4E00';
  33388. t['\u2F01'] = '\u4E28';
  33389. t['\u2F02'] = '\u4E36';
  33390. t['\u2F03'] = '\u4E3F';
  33391. t['\u2F04'] = '\u4E59';
  33392. t['\u2F05'] = '\u4E85';
  33393. t['\u2F06'] = '\u4E8C';
  33394. t['\u2F07'] = '\u4EA0';
  33395. t['\u2F08'] = '\u4EBA';
  33396. t['\u2F09'] = '\u513F';
  33397. t['\u2F0A'] = '\u5165';
  33398. t['\u2F0B'] = '\u516B';
  33399. t['\u2F0C'] = '\u5182';
  33400. t['\u2F0D'] = '\u5196';
  33401. t['\u2F0E'] = '\u51AB';
  33402. t['\u2F0F'] = '\u51E0';
  33403. t['\u2F10'] = '\u51F5';
  33404. t['\u2F11'] = '\u5200';
  33405. t['\u2F12'] = '\u529B';
  33406. t['\u2F13'] = '\u52F9';
  33407. t['\u2F14'] = '\u5315';
  33408. t['\u2F15'] = '\u531A';
  33409. t['\u2F16'] = '\u5338';
  33410. t['\u2F17'] = '\u5341';
  33411. t['\u2F18'] = '\u535C';
  33412. t['\u2F19'] = '\u5369';
  33413. t['\u2F1A'] = '\u5382';
  33414. t['\u2F1B'] = '\u53B6';
  33415. t['\u2F1C'] = '\u53C8';
  33416. t['\u2F1D'] = '\u53E3';
  33417. t['\u2F1E'] = '\u56D7';
  33418. t['\u2F1F'] = '\u571F';
  33419. t['\u2F20'] = '\u58EB';
  33420. t['\u2F21'] = '\u5902';
  33421. t['\u2F22'] = '\u590A';
  33422. t['\u2F23'] = '\u5915';
  33423. t['\u2F24'] = '\u5927';
  33424. t['\u2F25'] = '\u5973';
  33425. t['\u2F26'] = '\u5B50';
  33426. t['\u2F27'] = '\u5B80';
  33427. t['\u2F28'] = '\u5BF8';
  33428. t['\u2F29'] = '\u5C0F';
  33429. t['\u2F2A'] = '\u5C22';
  33430. t['\u2F2B'] = '\u5C38';
  33431. t['\u2F2C'] = '\u5C6E';
  33432. t['\u2F2D'] = '\u5C71';
  33433. t['\u2F2E'] = '\u5DDB';
  33434. t['\u2F2F'] = '\u5DE5';
  33435. t['\u2F30'] = '\u5DF1';
  33436. t['\u2F31'] = '\u5DFE';
  33437. t['\u2F32'] = '\u5E72';
  33438. t['\u2F33'] = '\u5E7A';
  33439. t['\u2F34'] = '\u5E7F';
  33440. t['\u2F35'] = '\u5EF4';
  33441. t['\u2F36'] = '\u5EFE';
  33442. t['\u2F37'] = '\u5F0B';
  33443. t['\u2F38'] = '\u5F13';
  33444. t['\u2F39'] = '\u5F50';
  33445. t['\u2F3A'] = '\u5F61';
  33446. t['\u2F3B'] = '\u5F73';
  33447. t['\u2F3C'] = '\u5FC3';
  33448. t['\u2F3D'] = '\u6208';
  33449. t['\u2F3E'] = '\u6236';
  33450. t['\u2F3F'] = '\u624B';
  33451. t['\u2F40'] = '\u652F';
  33452. t['\u2F41'] = '\u6534';
  33453. t['\u2F42'] = '\u6587';
  33454. t['\u2F43'] = '\u6597';
  33455. t['\u2F44'] = '\u65A4';
  33456. t['\u2F45'] = '\u65B9';
  33457. t['\u2F46'] = '\u65E0';
  33458. t['\u2F47'] = '\u65E5';
  33459. t['\u2F48'] = '\u66F0';
  33460. t['\u2F49'] = '\u6708';
  33461. t['\u2F4A'] = '\u6728';
  33462. t['\u2F4B'] = '\u6B20';
  33463. t['\u2F4C'] = '\u6B62';
  33464. t['\u2F4D'] = '\u6B79';
  33465. t['\u2F4E'] = '\u6BB3';
  33466. t['\u2F4F'] = '\u6BCB';
  33467. t['\u2F50'] = '\u6BD4';
  33468. t['\u2F51'] = '\u6BDB';
  33469. t['\u2F52'] = '\u6C0F';
  33470. t['\u2F53'] = '\u6C14';
  33471. t['\u2F54'] = '\u6C34';
  33472. t['\u2F55'] = '\u706B';
  33473. t['\u2F56'] = '\u722A';
  33474. t['\u2F57'] = '\u7236';
  33475. t['\u2F58'] = '\u723B';
  33476. t['\u2F59'] = '\u723F';
  33477. t['\u2F5A'] = '\u7247';
  33478. t['\u2F5B'] = '\u7259';
  33479. t['\u2F5C'] = '\u725B';
  33480. t['\u2F5D'] = '\u72AC';
  33481. t['\u2F5E'] = '\u7384';
  33482. t['\u2F5F'] = '\u7389';
  33483. t['\u2F60'] = '\u74DC';
  33484. t['\u2F61'] = '\u74E6';
  33485. t['\u2F62'] = '\u7518';
  33486. t['\u2F63'] = '\u751F';
  33487. t['\u2F64'] = '\u7528';
  33488. t['\u2F65'] = '\u7530';
  33489. t['\u2F66'] = '\u758B';
  33490. t['\u2F67'] = '\u7592';
  33491. t['\u2F68'] = '\u7676';
  33492. t['\u2F69'] = '\u767D';
  33493. t['\u2F6A'] = '\u76AE';
  33494. t['\u2F6B'] = '\u76BF';
  33495. t['\u2F6C'] = '\u76EE';
  33496. t['\u2F6D'] = '\u77DB';
  33497. t['\u2F6E'] = '\u77E2';
  33498. t['\u2F6F'] = '\u77F3';
  33499. t['\u2F70'] = '\u793A';
  33500. t['\u2F71'] = '\u79B8';
  33501. t['\u2F72'] = '\u79BE';
  33502. t['\u2F73'] = '\u7A74';
  33503. t['\u2F74'] = '\u7ACB';
  33504. t['\u2F75'] = '\u7AF9';
  33505. t['\u2F76'] = '\u7C73';
  33506. t['\u2F77'] = '\u7CF8';
  33507. t['\u2F78'] = '\u7F36';
  33508. t['\u2F79'] = '\u7F51';
  33509. t['\u2F7A'] = '\u7F8A';
  33510. t['\u2F7B'] = '\u7FBD';
  33511. t['\u2F7C'] = '\u8001';
  33512. t['\u2F7D'] = '\u800C';
  33513. t['\u2F7E'] = '\u8012';
  33514. t['\u2F7F'] = '\u8033';
  33515. t['\u2F80'] = '\u807F';
  33516. t['\u2F81'] = '\u8089';
  33517. t['\u2F82'] = '\u81E3';
  33518. t['\u2F83'] = '\u81EA';
  33519. t['\u2F84'] = '\u81F3';
  33520. t['\u2F85'] = '\u81FC';
  33521. t['\u2F86'] = '\u820C';
  33522. t['\u2F87'] = '\u821B';
  33523. t['\u2F88'] = '\u821F';
  33524. t['\u2F89'] = '\u826E';
  33525. t['\u2F8A'] = '\u8272';
  33526. t['\u2F8B'] = '\u8278';
  33527. t['\u2F8C'] = '\u864D';
  33528. t['\u2F8D'] = '\u866B';
  33529. t['\u2F8E'] = '\u8840';
  33530. t['\u2F8F'] = '\u884C';
  33531. t['\u2F90'] = '\u8863';
  33532. t['\u2F91'] = '\u897E';
  33533. t['\u2F92'] = '\u898B';
  33534. t['\u2F93'] = '\u89D2';
  33535. t['\u2F94'] = '\u8A00';
  33536. t['\u2F95'] = '\u8C37';
  33537. t['\u2F96'] = '\u8C46';
  33538. t['\u2F97'] = '\u8C55';
  33539. t['\u2F98'] = '\u8C78';
  33540. t['\u2F99'] = '\u8C9D';
  33541. t['\u2F9A'] = '\u8D64';
  33542. t['\u2F9B'] = '\u8D70';
  33543. t['\u2F9C'] = '\u8DB3';
  33544. t['\u2F9D'] = '\u8EAB';
  33545. t['\u2F9E'] = '\u8ECA';
  33546. t['\u2F9F'] = '\u8F9B';
  33547. t['\u2FA0'] = '\u8FB0';
  33548. t['\u2FA1'] = '\u8FB5';
  33549. t['\u2FA2'] = '\u9091';
  33550. t['\u2FA3'] = '\u9149';
  33551. t['\u2FA4'] = '\u91C6';
  33552. t['\u2FA5'] = '\u91CC';
  33553. t['\u2FA6'] = '\u91D1';
  33554. t['\u2FA7'] = '\u9577';
  33555. t['\u2FA8'] = '\u9580';
  33556. t['\u2FA9'] = '\u961C';
  33557. t['\u2FAA'] = '\u96B6';
  33558. t['\u2FAB'] = '\u96B9';
  33559. t['\u2FAC'] = '\u96E8';
  33560. t['\u2FAD'] = '\u9751';
  33561. t['\u2FAE'] = '\u975E';
  33562. t['\u2FAF'] = '\u9762';
  33563. t['\u2FB0'] = '\u9769';
  33564. t['\u2FB1'] = '\u97CB';
  33565. t['\u2FB2'] = '\u97ED';
  33566. t['\u2FB3'] = '\u97F3';
  33567. t['\u2FB4'] = '\u9801';
  33568. t['\u2FB5'] = '\u98A8';
  33569. t['\u2FB6'] = '\u98DB';
  33570. t['\u2FB7'] = '\u98DF';
  33571. t['\u2FB8'] = '\u9996';
  33572. t['\u2FB9'] = '\u9999';
  33573. t['\u2FBA'] = '\u99AC';
  33574. t['\u2FBB'] = '\u9AA8';
  33575. t['\u2FBC'] = '\u9AD8';
  33576. t['\u2FBD'] = '\u9ADF';
  33577. t['\u2FBE'] = '\u9B25';
  33578. t['\u2FBF'] = '\u9B2F';
  33579. t['\u2FC0'] = '\u9B32';
  33580. t['\u2FC1'] = '\u9B3C';
  33581. t['\u2FC2'] = '\u9B5A';
  33582. t['\u2FC3'] = '\u9CE5';
  33583. t['\u2FC4'] = '\u9E75';
  33584. t['\u2FC5'] = '\u9E7F';
  33585. t['\u2FC6'] = '\u9EA5';
  33586. t['\u2FC7'] = '\u9EBB';
  33587. t['\u2FC8'] = '\u9EC3';
  33588. t['\u2FC9'] = '\u9ECD';
  33589. t['\u2FCA'] = '\u9ED1';
  33590. t['\u2FCB'] = '\u9EF9';
  33591. t['\u2FCC'] = '\u9EFD';
  33592. t['\u2FCD'] = '\u9F0E';
  33593. t['\u2FCE'] = '\u9F13';
  33594. t['\u2FCF'] = '\u9F20';
  33595. t['\u2FD0'] = '\u9F3B';
  33596. t['\u2FD1'] = '\u9F4A';
  33597. t['\u2FD2'] = '\u9F52';
  33598. t['\u2FD3'] = '\u9F8D';
  33599. t['\u2FD4'] = '\u9F9C';
  33600. t['\u2FD5'] = '\u9FA0';
  33601. t['\u3036'] = '\u3012';
  33602. t['\u3038'] = '\u5341';
  33603. t['\u3039'] = '\u5344';
  33604. t['\u303A'] = '\u5345';
  33605. t['\u309B'] = '\u0020\u3099';
  33606. t['\u309C'] = '\u0020\u309A';
  33607. t['\u3131'] = '\u1100';
  33608. t['\u3132'] = '\u1101';
  33609. t['\u3133'] = '\u11AA';
  33610. t['\u3134'] = '\u1102';
  33611. t['\u3135'] = '\u11AC';
  33612. t['\u3136'] = '\u11AD';
  33613. t['\u3137'] = '\u1103';
  33614. t['\u3138'] = '\u1104';
  33615. t['\u3139'] = '\u1105';
  33616. t['\u313A'] = '\u11B0';
  33617. t['\u313B'] = '\u11B1';
  33618. t['\u313C'] = '\u11B2';
  33619. t['\u313D'] = '\u11B3';
  33620. t['\u313E'] = '\u11B4';
  33621. t['\u313F'] = '\u11B5';
  33622. t['\u3140'] = '\u111A';
  33623. t['\u3141'] = '\u1106';
  33624. t['\u3142'] = '\u1107';
  33625. t['\u3143'] = '\u1108';
  33626. t['\u3144'] = '\u1121';
  33627. t['\u3145'] = '\u1109';
  33628. t['\u3146'] = '\u110A';
  33629. t['\u3147'] = '\u110B';
  33630. t['\u3148'] = '\u110C';
  33631. t['\u3149'] = '\u110D';
  33632. t['\u314A'] = '\u110E';
  33633. t['\u314B'] = '\u110F';
  33634. t['\u314C'] = '\u1110';
  33635. t['\u314D'] = '\u1111';
  33636. t['\u314E'] = '\u1112';
  33637. t['\u314F'] = '\u1161';
  33638. t['\u3150'] = '\u1162';
  33639. t['\u3151'] = '\u1163';
  33640. t['\u3152'] = '\u1164';
  33641. t['\u3153'] = '\u1165';
  33642. t['\u3154'] = '\u1166';
  33643. t['\u3155'] = '\u1167';
  33644. t['\u3156'] = '\u1168';
  33645. t['\u3157'] = '\u1169';
  33646. t['\u3158'] = '\u116A';
  33647. t['\u3159'] = '\u116B';
  33648. t['\u315A'] = '\u116C';
  33649. t['\u315B'] = '\u116D';
  33650. t['\u315C'] = '\u116E';
  33651. t['\u315D'] = '\u116F';
  33652. t['\u315E'] = '\u1170';
  33653. t['\u315F'] = '\u1171';
  33654. t['\u3160'] = '\u1172';
  33655. t['\u3161'] = '\u1173';
  33656. t['\u3162'] = '\u1174';
  33657. t['\u3163'] = '\u1175';
  33658. t['\u3164'] = '\u1160';
  33659. t['\u3165'] = '\u1114';
  33660. t['\u3166'] = '\u1115';
  33661. t['\u3167'] = '\u11C7';
  33662. t['\u3168'] = '\u11C8';
  33663. t['\u3169'] = '\u11CC';
  33664. t['\u316A'] = '\u11CE';
  33665. t['\u316B'] = '\u11D3';
  33666. t['\u316C'] = '\u11D7';
  33667. t['\u316D'] = '\u11D9';
  33668. t['\u316E'] = '\u111C';
  33669. t['\u316F'] = '\u11DD';
  33670. t['\u3170'] = '\u11DF';
  33671. t['\u3171'] = '\u111D';
  33672. t['\u3172'] = '\u111E';
  33673. t['\u3173'] = '\u1120';
  33674. t['\u3174'] = '\u1122';
  33675. t['\u3175'] = '\u1123';
  33676. t['\u3176'] = '\u1127';
  33677. t['\u3177'] = '\u1129';
  33678. t['\u3178'] = '\u112B';
  33679. t['\u3179'] = '\u112C';
  33680. t['\u317A'] = '\u112D';
  33681. t['\u317B'] = '\u112E';
  33682. t['\u317C'] = '\u112F';
  33683. t['\u317D'] = '\u1132';
  33684. t['\u317E'] = '\u1136';
  33685. t['\u317F'] = '\u1140';
  33686. t['\u3180'] = '\u1147';
  33687. t['\u3181'] = '\u114C';
  33688. t['\u3182'] = '\u11F1';
  33689. t['\u3183'] = '\u11F2';
  33690. t['\u3184'] = '\u1157';
  33691. t['\u3185'] = '\u1158';
  33692. t['\u3186'] = '\u1159';
  33693. t['\u3187'] = '\u1184';
  33694. t['\u3188'] = '\u1185';
  33695. t['\u3189'] = '\u1188';
  33696. t['\u318A'] = '\u1191';
  33697. t['\u318B'] = '\u1192';
  33698. t['\u318C'] = '\u1194';
  33699. t['\u318D'] = '\u119E';
  33700. t['\u318E'] = '\u11A1';
  33701. t['\u3200'] = '\u0028\u1100\u0029';
  33702. t['\u3201'] = '\u0028\u1102\u0029';
  33703. t['\u3202'] = '\u0028\u1103\u0029';
  33704. t['\u3203'] = '\u0028\u1105\u0029';
  33705. t['\u3204'] = '\u0028\u1106\u0029';
  33706. t['\u3205'] = '\u0028\u1107\u0029';
  33707. t['\u3206'] = '\u0028\u1109\u0029';
  33708. t['\u3207'] = '\u0028\u110B\u0029';
  33709. t['\u3208'] = '\u0028\u110C\u0029';
  33710. t['\u3209'] = '\u0028\u110E\u0029';
  33711. t['\u320A'] = '\u0028\u110F\u0029';
  33712. t['\u320B'] = '\u0028\u1110\u0029';
  33713. t['\u320C'] = '\u0028\u1111\u0029';
  33714. t['\u320D'] = '\u0028\u1112\u0029';
  33715. t['\u320E'] = '\u0028\u1100\u1161\u0029';
  33716. t['\u320F'] = '\u0028\u1102\u1161\u0029';
  33717. t['\u3210'] = '\u0028\u1103\u1161\u0029';
  33718. t['\u3211'] = '\u0028\u1105\u1161\u0029';
  33719. t['\u3212'] = '\u0028\u1106\u1161\u0029';
  33720. t['\u3213'] = '\u0028\u1107\u1161\u0029';
  33721. t['\u3214'] = '\u0028\u1109\u1161\u0029';
  33722. t['\u3215'] = '\u0028\u110B\u1161\u0029';
  33723. t['\u3216'] = '\u0028\u110C\u1161\u0029';
  33724. t['\u3217'] = '\u0028\u110E\u1161\u0029';
  33725. t['\u3218'] = '\u0028\u110F\u1161\u0029';
  33726. t['\u3219'] = '\u0028\u1110\u1161\u0029';
  33727. t['\u321A'] = '\u0028\u1111\u1161\u0029';
  33728. t['\u321B'] = '\u0028\u1112\u1161\u0029';
  33729. t['\u321C'] = '\u0028\u110C\u116E\u0029';
  33730. t['\u321D'] = '\u0028\u110B\u1169\u110C\u1165\u11AB\u0029';
  33731. t['\u321E'] = '\u0028\u110B\u1169\u1112\u116E\u0029';
  33732. t['\u3220'] = '\u0028\u4E00\u0029';
  33733. t['\u3221'] = '\u0028\u4E8C\u0029';
  33734. t['\u3222'] = '\u0028\u4E09\u0029';
  33735. t['\u3223'] = '\u0028\u56DB\u0029';
  33736. t['\u3224'] = '\u0028\u4E94\u0029';
  33737. t['\u3225'] = '\u0028\u516D\u0029';
  33738. t['\u3226'] = '\u0028\u4E03\u0029';
  33739. t['\u3227'] = '\u0028\u516B\u0029';
  33740. t['\u3228'] = '\u0028\u4E5D\u0029';
  33741. t['\u3229'] = '\u0028\u5341\u0029';
  33742. t['\u322A'] = '\u0028\u6708\u0029';
  33743. t['\u322B'] = '\u0028\u706B\u0029';
  33744. t['\u322C'] = '\u0028\u6C34\u0029';
  33745. t['\u322D'] = '\u0028\u6728\u0029';
  33746. t['\u322E'] = '\u0028\u91D1\u0029';
  33747. t['\u322F'] = '\u0028\u571F\u0029';
  33748. t['\u3230'] = '\u0028\u65E5\u0029';
  33749. t['\u3231'] = '\u0028\u682A\u0029';
  33750. t['\u3232'] = '\u0028\u6709\u0029';
  33751. t['\u3233'] = '\u0028\u793E\u0029';
  33752. t['\u3234'] = '\u0028\u540D\u0029';
  33753. t['\u3235'] = '\u0028\u7279\u0029';
  33754. t['\u3236'] = '\u0028\u8CA1\u0029';
  33755. t['\u3237'] = '\u0028\u795D\u0029';
  33756. t['\u3238'] = '\u0028\u52B4\u0029';
  33757. t['\u3239'] = '\u0028\u4EE3\u0029';
  33758. t['\u323A'] = '\u0028\u547C\u0029';
  33759. t['\u323B'] = '\u0028\u5B66\u0029';
  33760. t['\u323C'] = '\u0028\u76E3\u0029';
  33761. t['\u323D'] = '\u0028\u4F01\u0029';
  33762. t['\u323E'] = '\u0028\u8CC7\u0029';
  33763. t['\u323F'] = '\u0028\u5354\u0029';
  33764. t['\u3240'] = '\u0028\u796D\u0029';
  33765. t['\u3241'] = '\u0028\u4F11\u0029';
  33766. t['\u3242'] = '\u0028\u81EA\u0029';
  33767. t['\u3243'] = '\u0028\u81F3\u0029';
  33768. t['\u32C0'] = '\u0031\u6708';
  33769. t['\u32C1'] = '\u0032\u6708';
  33770. t['\u32C2'] = '\u0033\u6708';
  33771. t['\u32C3'] = '\u0034\u6708';
  33772. t['\u32C4'] = '\u0035\u6708';
  33773. t['\u32C5'] = '\u0036\u6708';
  33774. t['\u32C6'] = '\u0037\u6708';
  33775. t['\u32C7'] = '\u0038\u6708';
  33776. t['\u32C8'] = '\u0039\u6708';
  33777. t['\u32C9'] = '\u0031\u0030\u6708';
  33778. t['\u32CA'] = '\u0031\u0031\u6708';
  33779. t['\u32CB'] = '\u0031\u0032\u6708';
  33780. t['\u3358'] = '\u0030\u70B9';
  33781. t['\u3359'] = '\u0031\u70B9';
  33782. t['\u335A'] = '\u0032\u70B9';
  33783. t['\u335B'] = '\u0033\u70B9';
  33784. t['\u335C'] = '\u0034\u70B9';
  33785. t['\u335D'] = '\u0035\u70B9';
  33786. t['\u335E'] = '\u0036\u70B9';
  33787. t['\u335F'] = '\u0037\u70B9';
  33788. t['\u3360'] = '\u0038\u70B9';
  33789. t['\u3361'] = '\u0039\u70B9';
  33790. t['\u3362'] = '\u0031\u0030\u70B9';
  33791. t['\u3363'] = '\u0031\u0031\u70B9';
  33792. t['\u3364'] = '\u0031\u0032\u70B9';
  33793. t['\u3365'] = '\u0031\u0033\u70B9';
  33794. t['\u3366'] = '\u0031\u0034\u70B9';
  33795. t['\u3367'] = '\u0031\u0035\u70B9';
  33796. t['\u3368'] = '\u0031\u0036\u70B9';
  33797. t['\u3369'] = '\u0031\u0037\u70B9';
  33798. t['\u336A'] = '\u0031\u0038\u70B9';
  33799. t['\u336B'] = '\u0031\u0039\u70B9';
  33800. t['\u336C'] = '\u0032\u0030\u70B9';
  33801. t['\u336D'] = '\u0032\u0031\u70B9';
  33802. t['\u336E'] = '\u0032\u0032\u70B9';
  33803. t['\u336F'] = '\u0032\u0033\u70B9';
  33804. t['\u3370'] = '\u0032\u0034\u70B9';
  33805. t['\u33E0'] = '\u0031\u65E5';
  33806. t['\u33E1'] = '\u0032\u65E5';
  33807. t['\u33E2'] = '\u0033\u65E5';
  33808. t['\u33E3'] = '\u0034\u65E5';
  33809. t['\u33E4'] = '\u0035\u65E5';
  33810. t['\u33E5'] = '\u0036\u65E5';
  33811. t['\u33E6'] = '\u0037\u65E5';
  33812. t['\u33E7'] = '\u0038\u65E5';
  33813. t['\u33E8'] = '\u0039\u65E5';
  33814. t['\u33E9'] = '\u0031\u0030\u65E5';
  33815. t['\u33EA'] = '\u0031\u0031\u65E5';
  33816. t['\u33EB'] = '\u0031\u0032\u65E5';
  33817. t['\u33EC'] = '\u0031\u0033\u65E5';
  33818. t['\u33ED'] = '\u0031\u0034\u65E5';
  33819. t['\u33EE'] = '\u0031\u0035\u65E5';
  33820. t['\u33EF'] = '\u0031\u0036\u65E5';
  33821. t['\u33F0'] = '\u0031\u0037\u65E5';
  33822. t['\u33F1'] = '\u0031\u0038\u65E5';
  33823. t['\u33F2'] = '\u0031\u0039\u65E5';
  33824. t['\u33F3'] = '\u0032\u0030\u65E5';
  33825. t['\u33F4'] = '\u0032\u0031\u65E5';
  33826. t['\u33F5'] = '\u0032\u0032\u65E5';
  33827. t['\u33F6'] = '\u0032\u0033\u65E5';
  33828. t['\u33F7'] = '\u0032\u0034\u65E5';
  33829. t['\u33F8'] = '\u0032\u0035\u65E5';
  33830. t['\u33F9'] = '\u0032\u0036\u65E5';
  33831. t['\u33FA'] = '\u0032\u0037\u65E5';
  33832. t['\u33FB'] = '\u0032\u0038\u65E5';
  33833. t['\u33FC'] = '\u0032\u0039\u65E5';
  33834. t['\u33FD'] = '\u0033\u0030\u65E5';
  33835. t['\u33FE'] = '\u0033\u0031\u65E5';
  33836. t['\uFB00'] = '\u0066\u0066';
  33837. t['\uFB01'] = '\u0066\u0069';
  33838. t['\uFB02'] = '\u0066\u006C';
  33839. t['\uFB03'] = '\u0066\u0066\u0069';
  33840. t['\uFB04'] = '\u0066\u0066\u006C';
  33841. t['\uFB05'] = '\u017F\u0074';
  33842. t['\uFB06'] = '\u0073\u0074';
  33843. t['\uFB13'] = '\u0574\u0576';
  33844. t['\uFB14'] = '\u0574\u0565';
  33845. t['\uFB15'] = '\u0574\u056B';
  33846. t['\uFB16'] = '\u057E\u0576';
  33847. t['\uFB17'] = '\u0574\u056D';
  33848. t['\uFB4F'] = '\u05D0\u05DC';
  33849. t['\uFB50'] = '\u0671';
  33850. t['\uFB51'] = '\u0671';
  33851. t['\uFB52'] = '\u067B';
  33852. t['\uFB53'] = '\u067B';
  33853. t['\uFB54'] = '\u067B';
  33854. t['\uFB55'] = '\u067B';
  33855. t['\uFB56'] = '\u067E';
  33856. t['\uFB57'] = '\u067E';
  33857. t['\uFB58'] = '\u067E';
  33858. t['\uFB59'] = '\u067E';
  33859. t['\uFB5A'] = '\u0680';
  33860. t['\uFB5B'] = '\u0680';
  33861. t['\uFB5C'] = '\u0680';
  33862. t['\uFB5D'] = '\u0680';
  33863. t['\uFB5E'] = '\u067A';
  33864. t['\uFB5F'] = '\u067A';
  33865. t['\uFB60'] = '\u067A';
  33866. t['\uFB61'] = '\u067A';
  33867. t['\uFB62'] = '\u067F';
  33868. t['\uFB63'] = '\u067F';
  33869. t['\uFB64'] = '\u067F';
  33870. t['\uFB65'] = '\u067F';
  33871. t['\uFB66'] = '\u0679';
  33872. t['\uFB67'] = '\u0679';
  33873. t['\uFB68'] = '\u0679';
  33874. t['\uFB69'] = '\u0679';
  33875. t['\uFB6A'] = '\u06A4';
  33876. t['\uFB6B'] = '\u06A4';
  33877. t['\uFB6C'] = '\u06A4';
  33878. t['\uFB6D'] = '\u06A4';
  33879. t['\uFB6E'] = '\u06A6';
  33880. t['\uFB6F'] = '\u06A6';
  33881. t['\uFB70'] = '\u06A6';
  33882. t['\uFB71'] = '\u06A6';
  33883. t['\uFB72'] = '\u0684';
  33884. t['\uFB73'] = '\u0684';
  33885. t['\uFB74'] = '\u0684';
  33886. t['\uFB75'] = '\u0684';
  33887. t['\uFB76'] = '\u0683';
  33888. t['\uFB77'] = '\u0683';
  33889. t['\uFB78'] = '\u0683';
  33890. t['\uFB79'] = '\u0683';
  33891. t['\uFB7A'] = '\u0686';
  33892. t['\uFB7B'] = '\u0686';
  33893. t['\uFB7C'] = '\u0686';
  33894. t['\uFB7D'] = '\u0686';
  33895. t['\uFB7E'] = '\u0687';
  33896. t['\uFB7F'] = '\u0687';
  33897. t['\uFB80'] = '\u0687';
  33898. t['\uFB81'] = '\u0687';
  33899. t['\uFB82'] = '\u068D';
  33900. t['\uFB83'] = '\u068D';
  33901. t['\uFB84'] = '\u068C';
  33902. t['\uFB85'] = '\u068C';
  33903. t['\uFB86'] = '\u068E';
  33904. t['\uFB87'] = '\u068E';
  33905. t['\uFB88'] = '\u0688';
  33906. t['\uFB89'] = '\u0688';
  33907. t['\uFB8A'] = '\u0698';
  33908. t['\uFB8B'] = '\u0698';
  33909. t['\uFB8C'] = '\u0691';
  33910. t['\uFB8D'] = '\u0691';
  33911. t['\uFB8E'] = '\u06A9';
  33912. t['\uFB8F'] = '\u06A9';
  33913. t['\uFB90'] = '\u06A9';
  33914. t['\uFB91'] = '\u06A9';
  33915. t['\uFB92'] = '\u06AF';
  33916. t['\uFB93'] = '\u06AF';
  33917. t['\uFB94'] = '\u06AF';
  33918. t['\uFB95'] = '\u06AF';
  33919. t['\uFB96'] = '\u06B3';
  33920. t['\uFB97'] = '\u06B3';
  33921. t['\uFB98'] = '\u06B3';
  33922. t['\uFB99'] = '\u06B3';
  33923. t['\uFB9A'] = '\u06B1';
  33924. t['\uFB9B'] = '\u06B1';
  33925. t['\uFB9C'] = '\u06B1';
  33926. t['\uFB9D'] = '\u06B1';
  33927. t['\uFB9E'] = '\u06BA';
  33928. t['\uFB9F'] = '\u06BA';
  33929. t['\uFBA0'] = '\u06BB';
  33930. t['\uFBA1'] = '\u06BB';
  33931. t['\uFBA2'] = '\u06BB';
  33932. t['\uFBA3'] = '\u06BB';
  33933. t['\uFBA4'] = '\u06C0';
  33934. t['\uFBA5'] = '\u06C0';
  33935. t['\uFBA6'] = '\u06C1';
  33936. t['\uFBA7'] = '\u06C1';
  33937. t['\uFBA8'] = '\u06C1';
  33938. t['\uFBA9'] = '\u06C1';
  33939. t['\uFBAA'] = '\u06BE';
  33940. t['\uFBAB'] = '\u06BE';
  33941. t['\uFBAC'] = '\u06BE';
  33942. t['\uFBAD'] = '\u06BE';
  33943. t['\uFBAE'] = '\u06D2';
  33944. t['\uFBAF'] = '\u06D2';
  33945. t['\uFBB0'] = '\u06D3';
  33946. t['\uFBB1'] = '\u06D3';
  33947. t['\uFBD3'] = '\u06AD';
  33948. t['\uFBD4'] = '\u06AD';
  33949. t['\uFBD5'] = '\u06AD';
  33950. t['\uFBD6'] = '\u06AD';
  33951. t['\uFBD7'] = '\u06C7';
  33952. t['\uFBD8'] = '\u06C7';
  33953. t['\uFBD9'] = '\u06C6';
  33954. t['\uFBDA'] = '\u06C6';
  33955. t['\uFBDB'] = '\u06C8';
  33956. t['\uFBDC'] = '\u06C8';
  33957. t['\uFBDD'] = '\u0677';
  33958. t['\uFBDE'] = '\u06CB';
  33959. t['\uFBDF'] = '\u06CB';
  33960. t['\uFBE0'] = '\u06C5';
  33961. t['\uFBE1'] = '\u06C5';
  33962. t['\uFBE2'] = '\u06C9';
  33963. t['\uFBE3'] = '\u06C9';
  33964. t['\uFBE4'] = '\u06D0';
  33965. t['\uFBE5'] = '\u06D0';
  33966. t['\uFBE6'] = '\u06D0';
  33967. t['\uFBE7'] = '\u06D0';
  33968. t['\uFBE8'] = '\u0649';
  33969. t['\uFBE9'] = '\u0649';
  33970. t['\uFBEA'] = '\u0626\u0627';
  33971. t['\uFBEB'] = '\u0626\u0627';
  33972. t['\uFBEC'] = '\u0626\u06D5';
  33973. t['\uFBED'] = '\u0626\u06D5';
  33974. t['\uFBEE'] = '\u0626\u0648';
  33975. t['\uFBEF'] = '\u0626\u0648';
  33976. t['\uFBF0'] = '\u0626\u06C7';
  33977. t['\uFBF1'] = '\u0626\u06C7';
  33978. t['\uFBF2'] = '\u0626\u06C6';
  33979. t['\uFBF3'] = '\u0626\u06C6';
  33980. t['\uFBF4'] = '\u0626\u06C8';
  33981. t['\uFBF5'] = '\u0626\u06C8';
  33982. t['\uFBF6'] = '\u0626\u06D0';
  33983. t['\uFBF7'] = '\u0626\u06D0';
  33984. t['\uFBF8'] = '\u0626\u06D0';
  33985. t['\uFBF9'] = '\u0626\u0649';
  33986. t['\uFBFA'] = '\u0626\u0649';
  33987. t['\uFBFB'] = '\u0626\u0649';
  33988. t['\uFBFC'] = '\u06CC';
  33989. t['\uFBFD'] = '\u06CC';
  33990. t['\uFBFE'] = '\u06CC';
  33991. t['\uFBFF'] = '\u06CC';
  33992. t['\uFC00'] = '\u0626\u062C';
  33993. t['\uFC01'] = '\u0626\u062D';
  33994. t['\uFC02'] = '\u0626\u0645';
  33995. t['\uFC03'] = '\u0626\u0649';
  33996. t['\uFC04'] = '\u0626\u064A';
  33997. t['\uFC05'] = '\u0628\u062C';
  33998. t['\uFC06'] = '\u0628\u062D';
  33999. t['\uFC07'] = '\u0628\u062E';
  34000. t['\uFC08'] = '\u0628\u0645';
  34001. t['\uFC09'] = '\u0628\u0649';
  34002. t['\uFC0A'] = '\u0628\u064A';
  34003. t['\uFC0B'] = '\u062A\u062C';
  34004. t['\uFC0C'] = '\u062A\u062D';
  34005. t['\uFC0D'] = '\u062A\u062E';
  34006. t['\uFC0E'] = '\u062A\u0645';
  34007. t['\uFC0F'] = '\u062A\u0649';
  34008. t['\uFC10'] = '\u062A\u064A';
  34009. t['\uFC11'] = '\u062B\u062C';
  34010. t['\uFC12'] = '\u062B\u0645';
  34011. t['\uFC13'] = '\u062B\u0649';
  34012. t['\uFC14'] = '\u062B\u064A';
  34013. t['\uFC15'] = '\u062C\u062D';
  34014. t['\uFC16'] = '\u062C\u0645';
  34015. t['\uFC17'] = '\u062D\u062C';
  34016. t['\uFC18'] = '\u062D\u0645';
  34017. t['\uFC19'] = '\u062E\u062C';
  34018. t['\uFC1A'] = '\u062E\u062D';
  34019. t['\uFC1B'] = '\u062E\u0645';
  34020. t['\uFC1C'] = '\u0633\u062C';
  34021. t['\uFC1D'] = '\u0633\u062D';
  34022. t['\uFC1E'] = '\u0633\u062E';
  34023. t['\uFC1F'] = '\u0633\u0645';
  34024. t['\uFC20'] = '\u0635\u062D';
  34025. t['\uFC21'] = '\u0635\u0645';
  34026. t['\uFC22'] = '\u0636\u062C';
  34027. t['\uFC23'] = '\u0636\u062D';
  34028. t['\uFC24'] = '\u0636\u062E';
  34029. t['\uFC25'] = '\u0636\u0645';
  34030. t['\uFC26'] = '\u0637\u062D';
  34031. t['\uFC27'] = '\u0637\u0645';
  34032. t['\uFC28'] = '\u0638\u0645';
  34033. t['\uFC29'] = '\u0639\u062C';
  34034. t['\uFC2A'] = '\u0639\u0645';
  34035. t['\uFC2B'] = '\u063A\u062C';
  34036. t['\uFC2C'] = '\u063A\u0645';
  34037. t['\uFC2D'] = '\u0641\u062C';
  34038. t['\uFC2E'] = '\u0641\u062D';
  34039. t['\uFC2F'] = '\u0641\u062E';
  34040. t['\uFC30'] = '\u0641\u0645';
  34041. t['\uFC31'] = '\u0641\u0649';
  34042. t['\uFC32'] = '\u0641\u064A';
  34043. t['\uFC33'] = '\u0642\u062D';
  34044. t['\uFC34'] = '\u0642\u0645';
  34045. t['\uFC35'] = '\u0642\u0649';
  34046. t['\uFC36'] = '\u0642\u064A';
  34047. t['\uFC37'] = '\u0643\u0627';
  34048. t['\uFC38'] = '\u0643\u062C';
  34049. t['\uFC39'] = '\u0643\u062D';
  34050. t['\uFC3A'] = '\u0643\u062E';
  34051. t['\uFC3B'] = '\u0643\u0644';
  34052. t['\uFC3C'] = '\u0643\u0645';
  34053. t['\uFC3D'] = '\u0643\u0649';
  34054. t['\uFC3E'] = '\u0643\u064A';
  34055. t['\uFC3F'] = '\u0644\u062C';
  34056. t['\uFC40'] = '\u0644\u062D';
  34057. t['\uFC41'] = '\u0644\u062E';
  34058. t['\uFC42'] = '\u0644\u0645';
  34059. t['\uFC43'] = '\u0644\u0649';
  34060. t['\uFC44'] = '\u0644\u064A';
  34061. t['\uFC45'] = '\u0645\u062C';
  34062. t['\uFC46'] = '\u0645\u062D';
  34063. t['\uFC47'] = '\u0645\u062E';
  34064. t['\uFC48'] = '\u0645\u0645';
  34065. t['\uFC49'] = '\u0645\u0649';
  34066. t['\uFC4A'] = '\u0645\u064A';
  34067. t['\uFC4B'] = '\u0646\u062C';
  34068. t['\uFC4C'] = '\u0646\u062D';
  34069. t['\uFC4D'] = '\u0646\u062E';
  34070. t['\uFC4E'] = '\u0646\u0645';
  34071. t['\uFC4F'] = '\u0646\u0649';
  34072. t['\uFC50'] = '\u0646\u064A';
  34073. t['\uFC51'] = '\u0647\u062C';
  34074. t['\uFC52'] = '\u0647\u0645';
  34075. t['\uFC53'] = '\u0647\u0649';
  34076. t['\uFC54'] = '\u0647\u064A';
  34077. t['\uFC55'] = '\u064A\u062C';
  34078. t['\uFC56'] = '\u064A\u062D';
  34079. t['\uFC57'] = '\u064A\u062E';
  34080. t['\uFC58'] = '\u064A\u0645';
  34081. t['\uFC59'] = '\u064A\u0649';
  34082. t['\uFC5A'] = '\u064A\u064A';
  34083. t['\uFC5B'] = '\u0630\u0670';
  34084. t['\uFC5C'] = '\u0631\u0670';
  34085. t['\uFC5D'] = '\u0649\u0670';
  34086. t['\uFC5E'] = '\u0020\u064C\u0651';
  34087. t['\uFC5F'] = '\u0020\u064D\u0651';
  34088. t['\uFC60'] = '\u0020\u064E\u0651';
  34089. t['\uFC61'] = '\u0020\u064F\u0651';
  34090. t['\uFC62'] = '\u0020\u0650\u0651';
  34091. t['\uFC63'] = '\u0020\u0651\u0670';
  34092. t['\uFC64'] = '\u0626\u0631';
  34093. t['\uFC65'] = '\u0626\u0632';
  34094. t['\uFC66'] = '\u0626\u0645';
  34095. t['\uFC67'] = '\u0626\u0646';
  34096. t['\uFC68'] = '\u0626\u0649';
  34097. t['\uFC69'] = '\u0626\u064A';
  34098. t['\uFC6A'] = '\u0628\u0631';
  34099. t['\uFC6B'] = '\u0628\u0632';
  34100. t['\uFC6C'] = '\u0628\u0645';
  34101. t['\uFC6D'] = '\u0628\u0646';
  34102. t['\uFC6E'] = '\u0628\u0649';
  34103. t['\uFC6F'] = '\u0628\u064A';
  34104. t['\uFC70'] = '\u062A\u0631';
  34105. t['\uFC71'] = '\u062A\u0632';
  34106. t['\uFC72'] = '\u062A\u0645';
  34107. t['\uFC73'] = '\u062A\u0646';
  34108. t['\uFC74'] = '\u062A\u0649';
  34109. t['\uFC75'] = '\u062A\u064A';
  34110. t['\uFC76'] = '\u062B\u0631';
  34111. t['\uFC77'] = '\u062B\u0632';
  34112. t['\uFC78'] = '\u062B\u0645';
  34113. t['\uFC79'] = '\u062B\u0646';
  34114. t['\uFC7A'] = '\u062B\u0649';
  34115. t['\uFC7B'] = '\u062B\u064A';
  34116. t['\uFC7C'] = '\u0641\u0649';
  34117. t['\uFC7D'] = '\u0641\u064A';
  34118. t['\uFC7E'] = '\u0642\u0649';
  34119. t['\uFC7F'] = '\u0642\u064A';
  34120. t['\uFC80'] = '\u0643\u0627';
  34121. t['\uFC81'] = '\u0643\u0644';
  34122. t['\uFC82'] = '\u0643\u0645';
  34123. t['\uFC83'] = '\u0643\u0649';
  34124. t['\uFC84'] = '\u0643\u064A';
  34125. t['\uFC85'] = '\u0644\u0645';
  34126. t['\uFC86'] = '\u0644\u0649';
  34127. t['\uFC87'] = '\u0644\u064A';
  34128. t['\uFC88'] = '\u0645\u0627';
  34129. t['\uFC89'] = '\u0645\u0645';
  34130. t['\uFC8A'] = '\u0646\u0631';
  34131. t['\uFC8B'] = '\u0646\u0632';
  34132. t['\uFC8C'] = '\u0646\u0645';
  34133. t['\uFC8D'] = '\u0646\u0646';
  34134. t['\uFC8E'] = '\u0646\u0649';
  34135. t['\uFC8F'] = '\u0646\u064A';
  34136. t['\uFC90'] = '\u0649\u0670';
  34137. t['\uFC91'] = '\u064A\u0631';
  34138. t['\uFC92'] = '\u064A\u0632';
  34139. t['\uFC93'] = '\u064A\u0645';
  34140. t['\uFC94'] = '\u064A\u0646';
  34141. t['\uFC95'] = '\u064A\u0649';
  34142. t['\uFC96'] = '\u064A\u064A';
  34143. t['\uFC97'] = '\u0626\u062C';
  34144. t['\uFC98'] = '\u0626\u062D';
  34145. t['\uFC99'] = '\u0626\u062E';
  34146. t['\uFC9A'] = '\u0626\u0645';
  34147. t['\uFC9B'] = '\u0626\u0647';
  34148. t['\uFC9C'] = '\u0628\u062C';
  34149. t['\uFC9D'] = '\u0628\u062D';
  34150. t['\uFC9E'] = '\u0628\u062E';
  34151. t['\uFC9F'] = '\u0628\u0645';
  34152. t['\uFCA0'] = '\u0628\u0647';
  34153. t['\uFCA1'] = '\u062A\u062C';
  34154. t['\uFCA2'] = '\u062A\u062D';
  34155. t['\uFCA3'] = '\u062A\u062E';
  34156. t['\uFCA4'] = '\u062A\u0645';
  34157. t['\uFCA5'] = '\u062A\u0647';
  34158. t['\uFCA6'] = '\u062B\u0645';
  34159. t['\uFCA7'] = '\u062C\u062D';
  34160. t['\uFCA8'] = '\u062C\u0645';
  34161. t['\uFCA9'] = '\u062D\u062C';
  34162. t['\uFCAA'] = '\u062D\u0645';
  34163. t['\uFCAB'] = '\u062E\u062C';
  34164. t['\uFCAC'] = '\u062E\u0645';
  34165. t['\uFCAD'] = '\u0633\u062C';
  34166. t['\uFCAE'] = '\u0633\u062D';
  34167. t['\uFCAF'] = '\u0633\u062E';
  34168. t['\uFCB0'] = '\u0633\u0645';
  34169. t['\uFCB1'] = '\u0635\u062D';
  34170. t['\uFCB2'] = '\u0635\u062E';
  34171. t['\uFCB3'] = '\u0635\u0645';
  34172. t['\uFCB4'] = '\u0636\u062C';
  34173. t['\uFCB5'] = '\u0636\u062D';
  34174. t['\uFCB6'] = '\u0636\u062E';
  34175. t['\uFCB7'] = '\u0636\u0645';
  34176. t['\uFCB8'] = '\u0637\u062D';
  34177. t['\uFCB9'] = '\u0638\u0645';
  34178. t['\uFCBA'] = '\u0639\u062C';
  34179. t['\uFCBB'] = '\u0639\u0645';
  34180. t['\uFCBC'] = '\u063A\u062C';
  34181. t['\uFCBD'] = '\u063A\u0645';
  34182. t['\uFCBE'] = '\u0641\u062C';
  34183. t['\uFCBF'] = '\u0641\u062D';
  34184. t['\uFCC0'] = '\u0641\u062E';
  34185. t['\uFCC1'] = '\u0641\u0645';
  34186. t['\uFCC2'] = '\u0642\u062D';
  34187. t['\uFCC3'] = '\u0642\u0645';
  34188. t['\uFCC4'] = '\u0643\u062C';
  34189. t['\uFCC5'] = '\u0643\u062D';
  34190. t['\uFCC6'] = '\u0643\u062E';
  34191. t['\uFCC7'] = '\u0643\u0644';
  34192. t['\uFCC8'] = '\u0643\u0645';
  34193. t['\uFCC9'] = '\u0644\u062C';
  34194. t['\uFCCA'] = '\u0644\u062D';
  34195. t['\uFCCB'] = '\u0644\u062E';
  34196. t['\uFCCC'] = '\u0644\u0645';
  34197. t['\uFCCD'] = '\u0644\u0647';
  34198. t['\uFCCE'] = '\u0645\u062C';
  34199. t['\uFCCF'] = '\u0645\u062D';
  34200. t['\uFCD0'] = '\u0645\u062E';
  34201. t['\uFCD1'] = '\u0645\u0645';
  34202. t['\uFCD2'] = '\u0646\u062C';
  34203. t['\uFCD3'] = '\u0646\u062D';
  34204. t['\uFCD4'] = '\u0646\u062E';
  34205. t['\uFCD5'] = '\u0646\u0645';
  34206. t['\uFCD6'] = '\u0646\u0647';
  34207. t['\uFCD7'] = '\u0647\u062C';
  34208. t['\uFCD8'] = '\u0647\u0645';
  34209. t['\uFCD9'] = '\u0647\u0670';
  34210. t['\uFCDA'] = '\u064A\u062C';
  34211. t['\uFCDB'] = '\u064A\u062D';
  34212. t['\uFCDC'] = '\u064A\u062E';
  34213. t['\uFCDD'] = '\u064A\u0645';
  34214. t['\uFCDE'] = '\u064A\u0647';
  34215. t['\uFCDF'] = '\u0626\u0645';
  34216. t['\uFCE0'] = '\u0626\u0647';
  34217. t['\uFCE1'] = '\u0628\u0645';
  34218. t['\uFCE2'] = '\u0628\u0647';
  34219. t['\uFCE3'] = '\u062A\u0645';
  34220. t['\uFCE4'] = '\u062A\u0647';
  34221. t['\uFCE5'] = '\u062B\u0645';
  34222. t['\uFCE6'] = '\u062B\u0647';
  34223. t['\uFCE7'] = '\u0633\u0645';
  34224. t['\uFCE8'] = '\u0633\u0647';
  34225. t['\uFCE9'] = '\u0634\u0645';
  34226. t['\uFCEA'] = '\u0634\u0647';
  34227. t['\uFCEB'] = '\u0643\u0644';
  34228. t['\uFCEC'] = '\u0643\u0645';
  34229. t['\uFCED'] = '\u0644\u0645';
  34230. t['\uFCEE'] = '\u0646\u0645';
  34231. t['\uFCEF'] = '\u0646\u0647';
  34232. t['\uFCF0'] = '\u064A\u0645';
  34233. t['\uFCF1'] = '\u064A\u0647';
  34234. t['\uFCF2'] = '\u0640\u064E\u0651';
  34235. t['\uFCF3'] = '\u0640\u064F\u0651';
  34236. t['\uFCF4'] = '\u0640\u0650\u0651';
  34237. t['\uFCF5'] = '\u0637\u0649';
  34238. t['\uFCF6'] = '\u0637\u064A';
  34239. t['\uFCF7'] = '\u0639\u0649';
  34240. t['\uFCF8'] = '\u0639\u064A';
  34241. t['\uFCF9'] = '\u063A\u0649';
  34242. t['\uFCFA'] = '\u063A\u064A';
  34243. t['\uFCFB'] = '\u0633\u0649';
  34244. t['\uFCFC'] = '\u0633\u064A';
  34245. t['\uFCFD'] = '\u0634\u0649';
  34246. t['\uFCFE'] = '\u0634\u064A';
  34247. t['\uFCFF'] = '\u062D\u0649';
  34248. t['\uFD00'] = '\u062D\u064A';
  34249. t['\uFD01'] = '\u062C\u0649';
  34250. t['\uFD02'] = '\u062C\u064A';
  34251. t['\uFD03'] = '\u062E\u0649';
  34252. t['\uFD04'] = '\u062E\u064A';
  34253. t['\uFD05'] = '\u0635\u0649';
  34254. t['\uFD06'] = '\u0635\u064A';
  34255. t['\uFD07'] = '\u0636\u0649';
  34256. t['\uFD08'] = '\u0636\u064A';
  34257. t['\uFD09'] = '\u0634\u062C';
  34258. t['\uFD0A'] = '\u0634\u062D';
  34259. t['\uFD0B'] = '\u0634\u062E';
  34260. t['\uFD0C'] = '\u0634\u0645';
  34261. t['\uFD0D'] = '\u0634\u0631';
  34262. t['\uFD0E'] = '\u0633\u0631';
  34263. t['\uFD0F'] = '\u0635\u0631';
  34264. t['\uFD10'] = '\u0636\u0631';
  34265. t['\uFD11'] = '\u0637\u0649';
  34266. t['\uFD12'] = '\u0637\u064A';
  34267. t['\uFD13'] = '\u0639\u0649';
  34268. t['\uFD14'] = '\u0639\u064A';
  34269. t['\uFD15'] = '\u063A\u0649';
  34270. t['\uFD16'] = '\u063A\u064A';
  34271. t['\uFD17'] = '\u0633\u0649';
  34272. t['\uFD18'] = '\u0633\u064A';
  34273. t['\uFD19'] = '\u0634\u0649';
  34274. t['\uFD1A'] = '\u0634\u064A';
  34275. t['\uFD1B'] = '\u062D\u0649';
  34276. t['\uFD1C'] = '\u062D\u064A';
  34277. t['\uFD1D'] = '\u062C\u0649';
  34278. t['\uFD1E'] = '\u062C\u064A';
  34279. t['\uFD1F'] = '\u062E\u0649';
  34280. t['\uFD20'] = '\u062E\u064A';
  34281. t['\uFD21'] = '\u0635\u0649';
  34282. t['\uFD22'] = '\u0635\u064A';
  34283. t['\uFD23'] = '\u0636\u0649';
  34284. t['\uFD24'] = '\u0636\u064A';
  34285. t['\uFD25'] = '\u0634\u062C';
  34286. t['\uFD26'] = '\u0634\u062D';
  34287. t['\uFD27'] = '\u0634\u062E';
  34288. t['\uFD28'] = '\u0634\u0645';
  34289. t['\uFD29'] = '\u0634\u0631';
  34290. t['\uFD2A'] = '\u0633\u0631';
  34291. t['\uFD2B'] = '\u0635\u0631';
  34292. t['\uFD2C'] = '\u0636\u0631';
  34293. t['\uFD2D'] = '\u0634\u062C';
  34294. t['\uFD2E'] = '\u0634\u062D';
  34295. t['\uFD2F'] = '\u0634\u062E';
  34296. t['\uFD30'] = '\u0634\u0645';
  34297. t['\uFD31'] = '\u0633\u0647';
  34298. t['\uFD32'] = '\u0634\u0647';
  34299. t['\uFD33'] = '\u0637\u0645';
  34300. t['\uFD34'] = '\u0633\u062C';
  34301. t['\uFD35'] = '\u0633\u062D';
  34302. t['\uFD36'] = '\u0633\u062E';
  34303. t['\uFD37'] = '\u0634\u062C';
  34304. t['\uFD38'] = '\u0634\u062D';
  34305. t['\uFD39'] = '\u0634\u062E';
  34306. t['\uFD3A'] = '\u0637\u0645';
  34307. t['\uFD3B'] = '\u0638\u0645';
  34308. t['\uFD3C'] = '\u0627\u064B';
  34309. t['\uFD3D'] = '\u0627\u064B';
  34310. t['\uFD50'] = '\u062A\u062C\u0645';
  34311. t['\uFD51'] = '\u062A\u062D\u062C';
  34312. t['\uFD52'] = '\u062A\u062D\u062C';
  34313. t['\uFD53'] = '\u062A\u062D\u0645';
  34314. t['\uFD54'] = '\u062A\u062E\u0645';
  34315. t['\uFD55'] = '\u062A\u0645\u062C';
  34316. t['\uFD56'] = '\u062A\u0645\u062D';
  34317. t['\uFD57'] = '\u062A\u0645\u062E';
  34318. t['\uFD58'] = '\u062C\u0645\u062D';
  34319. t['\uFD59'] = '\u062C\u0645\u062D';
  34320. t['\uFD5A'] = '\u062D\u0645\u064A';
  34321. t['\uFD5B'] = '\u062D\u0645\u0649';
  34322. t['\uFD5C'] = '\u0633\u062D\u062C';
  34323. t['\uFD5D'] = '\u0633\u062C\u062D';
  34324. t['\uFD5E'] = '\u0633\u062C\u0649';
  34325. t['\uFD5F'] = '\u0633\u0645\u062D';
  34326. t['\uFD60'] = '\u0633\u0645\u062D';
  34327. t['\uFD61'] = '\u0633\u0645\u062C';
  34328. t['\uFD62'] = '\u0633\u0645\u0645';
  34329. t['\uFD63'] = '\u0633\u0645\u0645';
  34330. t['\uFD64'] = '\u0635\u062D\u062D';
  34331. t['\uFD65'] = '\u0635\u062D\u062D';
  34332. t['\uFD66'] = '\u0635\u0645\u0645';
  34333. t['\uFD67'] = '\u0634\u062D\u0645';
  34334. t['\uFD68'] = '\u0634\u062D\u0645';
  34335. t['\uFD69'] = '\u0634\u062C\u064A';
  34336. t['\uFD6A'] = '\u0634\u0645\u062E';
  34337. t['\uFD6B'] = '\u0634\u0645\u062E';
  34338. t['\uFD6C'] = '\u0634\u0645\u0645';
  34339. t['\uFD6D'] = '\u0634\u0645\u0645';
  34340. t['\uFD6E'] = '\u0636\u062D\u0649';
  34341. t['\uFD6F'] = '\u0636\u062E\u0645';
  34342. t['\uFD70'] = '\u0636\u062E\u0645';
  34343. t['\uFD71'] = '\u0637\u0645\u062D';
  34344. t['\uFD72'] = '\u0637\u0645\u062D';
  34345. t['\uFD73'] = '\u0637\u0645\u0645';
  34346. t['\uFD74'] = '\u0637\u0645\u064A';
  34347. t['\uFD75'] = '\u0639\u062C\u0645';
  34348. t['\uFD76'] = '\u0639\u0645\u0645';
  34349. t['\uFD77'] = '\u0639\u0645\u0645';
  34350. t['\uFD78'] = '\u0639\u0645\u0649';
  34351. t['\uFD79'] = '\u063A\u0645\u0645';
  34352. t['\uFD7A'] = '\u063A\u0645\u064A';
  34353. t['\uFD7B'] = '\u063A\u0645\u0649';
  34354. t['\uFD7C'] = '\u0641\u062E\u0645';
  34355. t['\uFD7D'] = '\u0641\u062E\u0645';
  34356. t['\uFD7E'] = '\u0642\u0645\u062D';
  34357. t['\uFD7F'] = '\u0642\u0645\u0645';
  34358. t['\uFD80'] = '\u0644\u062D\u0645';
  34359. t['\uFD81'] = '\u0644\u062D\u064A';
  34360. t['\uFD82'] = '\u0644\u062D\u0649';
  34361. t['\uFD83'] = '\u0644\u062C\u062C';
  34362. t['\uFD84'] = '\u0644\u062C\u062C';
  34363. t['\uFD85'] = '\u0644\u062E\u0645';
  34364. t['\uFD86'] = '\u0644\u062E\u0645';
  34365. t['\uFD87'] = '\u0644\u0645\u062D';
  34366. t['\uFD88'] = '\u0644\u0645\u062D';
  34367. t['\uFD89'] = '\u0645\u062D\u062C';
  34368. t['\uFD8A'] = '\u0645\u062D\u0645';
  34369. t['\uFD8B'] = '\u0645\u062D\u064A';
  34370. t['\uFD8C'] = '\u0645\u062C\u062D';
  34371. t['\uFD8D'] = '\u0645\u062C\u0645';
  34372. t['\uFD8E'] = '\u0645\u062E\u062C';
  34373. t['\uFD8F'] = '\u0645\u062E\u0645';
  34374. t['\uFD92'] = '\u0645\u062C\u062E';
  34375. t['\uFD93'] = '\u0647\u0645\u062C';
  34376. t['\uFD94'] = '\u0647\u0645\u0645';
  34377. t['\uFD95'] = '\u0646\u062D\u0645';
  34378. t['\uFD96'] = '\u0646\u062D\u0649';
  34379. t['\uFD97'] = '\u0646\u062C\u0645';
  34380. t['\uFD98'] = '\u0646\u062C\u0645';
  34381. t['\uFD99'] = '\u0646\u062C\u0649';
  34382. t['\uFD9A'] = '\u0646\u0645\u064A';
  34383. t['\uFD9B'] = '\u0646\u0645\u0649';
  34384. t['\uFD9C'] = '\u064A\u0645\u0645';
  34385. t['\uFD9D'] = '\u064A\u0645\u0645';
  34386. t['\uFD9E'] = '\u0628\u062E\u064A';
  34387. t['\uFD9F'] = '\u062A\u062C\u064A';
  34388. t['\uFDA0'] = '\u062A\u062C\u0649';
  34389. t['\uFDA1'] = '\u062A\u062E\u064A';
  34390. t['\uFDA2'] = '\u062A\u062E\u0649';
  34391. t['\uFDA3'] = '\u062A\u0645\u064A';
  34392. t['\uFDA4'] = '\u062A\u0645\u0649';
  34393. t['\uFDA5'] = '\u062C\u0645\u064A';
  34394. t['\uFDA6'] = '\u062C\u062D\u0649';
  34395. t['\uFDA7'] = '\u062C\u0645\u0649';
  34396. t['\uFDA8'] = '\u0633\u062E\u0649';
  34397. t['\uFDA9'] = '\u0635\u062D\u064A';
  34398. t['\uFDAA'] = '\u0634\u062D\u064A';
  34399. t['\uFDAB'] = '\u0636\u062D\u064A';
  34400. t['\uFDAC'] = '\u0644\u062C\u064A';
  34401. t['\uFDAD'] = '\u0644\u0645\u064A';
  34402. t['\uFDAE'] = '\u064A\u062D\u064A';
  34403. t['\uFDAF'] = '\u064A\u062C\u064A';
  34404. t['\uFDB0'] = '\u064A\u0645\u064A';
  34405. t['\uFDB1'] = '\u0645\u0645\u064A';
  34406. t['\uFDB2'] = '\u0642\u0645\u064A';
  34407. t['\uFDB3'] = '\u0646\u062D\u064A';
  34408. t['\uFDB4'] = '\u0642\u0645\u062D';
  34409. t['\uFDB5'] = '\u0644\u062D\u0645';
  34410. t['\uFDB6'] = '\u0639\u0645\u064A';
  34411. t['\uFDB7'] = '\u0643\u0645\u064A';
  34412. t['\uFDB8'] = '\u0646\u062C\u062D';
  34413. t['\uFDB9'] = '\u0645\u062E\u064A';
  34414. t['\uFDBA'] = '\u0644\u062C\u0645';
  34415. t['\uFDBB'] = '\u0643\u0645\u0645';
  34416. t['\uFDBC'] = '\u0644\u062C\u0645';
  34417. t['\uFDBD'] = '\u0646\u062C\u062D';
  34418. t['\uFDBE'] = '\u062C\u062D\u064A';
  34419. t['\uFDBF'] = '\u062D\u062C\u064A';
  34420. t['\uFDC0'] = '\u0645\u062C\u064A';
  34421. t['\uFDC1'] = '\u0641\u0645\u064A';
  34422. t['\uFDC2'] = '\u0628\u062D\u064A';
  34423. t['\uFDC3'] = '\u0643\u0645\u0645';
  34424. t['\uFDC4'] = '\u0639\u062C\u0645';
  34425. t['\uFDC5'] = '\u0635\u0645\u0645';
  34426. t['\uFDC6'] = '\u0633\u062E\u064A';
  34427. t['\uFDC7'] = '\u0646\u062C\u064A';
  34428. t['\uFE49'] = '\u203E';
  34429. t['\uFE4A'] = '\u203E';
  34430. t['\uFE4B'] = '\u203E';
  34431. t['\uFE4C'] = '\u203E';
  34432. t['\uFE4D'] = '\u005F';
  34433. t['\uFE4E'] = '\u005F';
  34434. t['\uFE4F'] = '\u005F';
  34435. t['\uFE80'] = '\u0621';
  34436. t['\uFE81'] = '\u0622';
  34437. t['\uFE82'] = '\u0622';
  34438. t['\uFE83'] = '\u0623';
  34439. t['\uFE84'] = '\u0623';
  34440. t['\uFE85'] = '\u0624';
  34441. t['\uFE86'] = '\u0624';
  34442. t['\uFE87'] = '\u0625';
  34443. t['\uFE88'] = '\u0625';
  34444. t['\uFE89'] = '\u0626';
  34445. t['\uFE8A'] = '\u0626';
  34446. t['\uFE8B'] = '\u0626';
  34447. t['\uFE8C'] = '\u0626';
  34448. t['\uFE8D'] = '\u0627';
  34449. t['\uFE8E'] = '\u0627';
  34450. t['\uFE8F'] = '\u0628';
  34451. t['\uFE90'] = '\u0628';
  34452. t['\uFE91'] = '\u0628';
  34453. t['\uFE92'] = '\u0628';
  34454. t['\uFE93'] = '\u0629';
  34455. t['\uFE94'] = '\u0629';
  34456. t['\uFE95'] = '\u062A';
  34457. t['\uFE96'] = '\u062A';
  34458. t['\uFE97'] = '\u062A';
  34459. t['\uFE98'] = '\u062A';
  34460. t['\uFE99'] = '\u062B';
  34461. t['\uFE9A'] = '\u062B';
  34462. t['\uFE9B'] = '\u062B';
  34463. t['\uFE9C'] = '\u062B';
  34464. t['\uFE9D'] = '\u062C';
  34465. t['\uFE9E'] = '\u062C';
  34466. t['\uFE9F'] = '\u062C';
  34467. t['\uFEA0'] = '\u062C';
  34468. t['\uFEA1'] = '\u062D';
  34469. t['\uFEA2'] = '\u062D';
  34470. t['\uFEA3'] = '\u062D';
  34471. t['\uFEA4'] = '\u062D';
  34472. t['\uFEA5'] = '\u062E';
  34473. t['\uFEA6'] = '\u062E';
  34474. t['\uFEA7'] = '\u062E';
  34475. t['\uFEA8'] = '\u062E';
  34476. t['\uFEA9'] = '\u062F';
  34477. t['\uFEAA'] = '\u062F';
  34478. t['\uFEAB'] = '\u0630';
  34479. t['\uFEAC'] = '\u0630';
  34480. t['\uFEAD'] = '\u0631';
  34481. t['\uFEAE'] = '\u0631';
  34482. t['\uFEAF'] = '\u0632';
  34483. t['\uFEB0'] = '\u0632';
  34484. t['\uFEB1'] = '\u0633';
  34485. t['\uFEB2'] = '\u0633';
  34486. t['\uFEB3'] = '\u0633';
  34487. t['\uFEB4'] = '\u0633';
  34488. t['\uFEB5'] = '\u0634';
  34489. t['\uFEB6'] = '\u0634';
  34490. t['\uFEB7'] = '\u0634';
  34491. t['\uFEB8'] = '\u0634';
  34492. t['\uFEB9'] = '\u0635';
  34493. t['\uFEBA'] = '\u0635';
  34494. t['\uFEBB'] = '\u0635';
  34495. t['\uFEBC'] = '\u0635';
  34496. t['\uFEBD'] = '\u0636';
  34497. t['\uFEBE'] = '\u0636';
  34498. t['\uFEBF'] = '\u0636';
  34499. t['\uFEC0'] = '\u0636';
  34500. t['\uFEC1'] = '\u0637';
  34501. t['\uFEC2'] = '\u0637';
  34502. t['\uFEC3'] = '\u0637';
  34503. t['\uFEC4'] = '\u0637';
  34504. t['\uFEC5'] = '\u0638';
  34505. t['\uFEC6'] = '\u0638';
  34506. t['\uFEC7'] = '\u0638';
  34507. t['\uFEC8'] = '\u0638';
  34508. t['\uFEC9'] = '\u0639';
  34509. t['\uFECA'] = '\u0639';
  34510. t['\uFECB'] = '\u0639';
  34511. t['\uFECC'] = '\u0639';
  34512. t['\uFECD'] = '\u063A';
  34513. t['\uFECE'] = '\u063A';
  34514. t['\uFECF'] = '\u063A';
  34515. t['\uFED0'] = '\u063A';
  34516. t['\uFED1'] = '\u0641';
  34517. t['\uFED2'] = '\u0641';
  34518. t['\uFED3'] = '\u0641';
  34519. t['\uFED4'] = '\u0641';
  34520. t['\uFED5'] = '\u0642';
  34521. t['\uFED6'] = '\u0642';
  34522. t['\uFED7'] = '\u0642';
  34523. t['\uFED8'] = '\u0642';
  34524. t['\uFED9'] = '\u0643';
  34525. t['\uFEDA'] = '\u0643';
  34526. t['\uFEDB'] = '\u0643';
  34527. t['\uFEDC'] = '\u0643';
  34528. t['\uFEDD'] = '\u0644';
  34529. t['\uFEDE'] = '\u0644';
  34530. t['\uFEDF'] = '\u0644';
  34531. t['\uFEE0'] = '\u0644';
  34532. t['\uFEE1'] = '\u0645';
  34533. t['\uFEE2'] = '\u0645';
  34534. t['\uFEE3'] = '\u0645';
  34535. t['\uFEE4'] = '\u0645';
  34536. t['\uFEE5'] = '\u0646';
  34537. t['\uFEE6'] = '\u0646';
  34538. t['\uFEE7'] = '\u0646';
  34539. t['\uFEE8'] = '\u0646';
  34540. t['\uFEE9'] = '\u0647';
  34541. t['\uFEEA'] = '\u0647';
  34542. t['\uFEEB'] = '\u0647';
  34543. t['\uFEEC'] = '\u0647';
  34544. t['\uFEED'] = '\u0648';
  34545. t['\uFEEE'] = '\u0648';
  34546. t['\uFEEF'] = '\u0649';
  34547. t['\uFEF0'] = '\u0649';
  34548. t['\uFEF1'] = '\u064A';
  34549. t['\uFEF2'] = '\u064A';
  34550. t['\uFEF3'] = '\u064A';
  34551. t['\uFEF4'] = '\u064A';
  34552. t['\uFEF5'] = '\u0644\u0622';
  34553. t['\uFEF6'] = '\u0644\u0622';
  34554. t['\uFEF7'] = '\u0644\u0623';
  34555. t['\uFEF8'] = '\u0644\u0623';
  34556. t['\uFEF9'] = '\u0644\u0625';
  34557. t['\uFEFA'] = '\u0644\u0625';
  34558. t['\uFEFB'] = '\u0644\u0627';
  34559. t['\uFEFC'] = '\u0644\u0627';
  34560. });
  34561. function reverseIfRtl(chars) {
  34562. var charsLength = chars.length;
  34563. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  34564. return chars;
  34565. }
  34566. var s = '';
  34567. for (var ii = charsLength - 1; ii >= 0; ii--) {
  34568. s += chars[ii];
  34569. }
  34570. return s;
  34571. }
  34572. exports.mapSpecialUnicodeValues = mapSpecialUnicodeValues;
  34573. exports.reverseIfRtl = reverseIfRtl;
  34574. exports.getUnicodeRangeFor = getUnicodeRangeFor;
  34575. exports.getNormalizedUnicodes = getNormalizedUnicodes;
  34576. exports.getUnicodeForGlyph = getUnicodeForGlyph;
  34577. /***/ }),
  34578. /* 19 */
  34579. /***/ (function(module, exports, __w_pdfjs_require__) {
  34580. "use strict";
  34581. var sharedUtil = __w_pdfjs_require__(0);
  34582. var coreWorker = __w_pdfjs_require__(8);
  34583. var globalScope = sharedUtil.globalScope;
  34584. var OK_RESPONSE = 200;
  34585. var PARTIAL_CONTENT_RESPONSE = 206;
  34586. function NetworkManager(url, args) {
  34587. this.url = url;
  34588. args = args || {};
  34589. this.isHttp = /^https?:/i.test(url);
  34590. this.httpHeaders = this.isHttp && args.httpHeaders || {};
  34591. this.withCredentials = args.withCredentials || false;
  34592. this.getXhr = args.getXhr || function NetworkManager_getXhr() {
  34593. return new XMLHttpRequest();
  34594. };
  34595. this.currXhrId = 0;
  34596. this.pendingRequests = Object.create(null);
  34597. this.loadedRequests = Object.create(null);
  34598. }
  34599. function getArrayBuffer(xhr) {
  34600. var data = xhr.response;
  34601. if (typeof data !== 'string') {
  34602. return data;
  34603. }
  34604. var length = data.length;
  34605. var array = new Uint8Array(length);
  34606. for (var i = 0; i < length; i++) {
  34607. array[i] = data.charCodeAt(i) & 0xFF;
  34608. }
  34609. return array.buffer;
  34610. }
  34611. var supportsMozChunked = function supportsMozChunkedClosure() {
  34612. try {
  34613. var x = new XMLHttpRequest();
  34614. x.open('GET', globalScope.location.href);
  34615. x.responseType = 'moz-chunked-arraybuffer';
  34616. return x.responseType === 'moz-chunked-arraybuffer';
  34617. } catch (e) {
  34618. return false;
  34619. }
  34620. }();
  34621. NetworkManager.prototype = {
  34622. requestRange: function NetworkManager_requestRange(begin, end, listeners) {
  34623. var args = {
  34624. begin: begin,
  34625. end: end
  34626. };
  34627. for (var prop in listeners) {
  34628. args[prop] = listeners[prop];
  34629. }
  34630. return this.request(args);
  34631. },
  34632. requestFull: function NetworkManager_requestFull(listeners) {
  34633. return this.request(listeners);
  34634. },
  34635. request: function NetworkManager_request(args) {
  34636. var xhr = this.getXhr();
  34637. var xhrId = this.currXhrId++;
  34638. var pendingRequest = this.pendingRequests[xhrId] = { xhr: xhr };
  34639. xhr.open('GET', this.url);
  34640. xhr.withCredentials = this.withCredentials;
  34641. for (var property in this.httpHeaders) {
  34642. var value = this.httpHeaders[property];
  34643. if (typeof value === 'undefined') {
  34644. continue;
  34645. }
  34646. xhr.setRequestHeader(property, value);
  34647. }
  34648. if (this.isHttp && 'begin' in args && 'end' in args) {
  34649. var rangeStr = args.begin + '-' + (args.end - 1);
  34650. xhr.setRequestHeader('Range', 'bytes=' + rangeStr);
  34651. pendingRequest.expectedStatus = 206;
  34652. } else {
  34653. pendingRequest.expectedStatus = 200;
  34654. }
  34655. var useMozChunkedLoading = supportsMozChunked && !!args.onProgressiveData;
  34656. if (useMozChunkedLoading) {
  34657. xhr.responseType = 'moz-chunked-arraybuffer';
  34658. pendingRequest.onProgressiveData = args.onProgressiveData;
  34659. pendingRequest.mozChunked = true;
  34660. } else {
  34661. xhr.responseType = 'arraybuffer';
  34662. }
  34663. if (args.onError) {
  34664. xhr.onerror = function (evt) {
  34665. args.onError(xhr.status);
  34666. };
  34667. }
  34668. xhr.onreadystatechange = this.onStateChange.bind(this, xhrId);
  34669. xhr.onprogress = this.onProgress.bind(this, xhrId);
  34670. pendingRequest.onHeadersReceived = args.onHeadersReceived;
  34671. pendingRequest.onDone = args.onDone;
  34672. pendingRequest.onError = args.onError;
  34673. pendingRequest.onProgress = args.onProgress;
  34674. xhr.send(null);
  34675. return xhrId;
  34676. },
  34677. onProgress: function NetworkManager_onProgress(xhrId, evt) {
  34678. var pendingRequest = this.pendingRequests[xhrId];
  34679. if (!pendingRequest) {
  34680. return;
  34681. }
  34682. if (pendingRequest.mozChunked) {
  34683. var chunk = getArrayBuffer(pendingRequest.xhr);
  34684. pendingRequest.onProgressiveData(chunk);
  34685. }
  34686. var onProgress = pendingRequest.onProgress;
  34687. if (onProgress) {
  34688. onProgress(evt);
  34689. }
  34690. },
  34691. onStateChange: function NetworkManager_onStateChange(xhrId, evt) {
  34692. var pendingRequest = this.pendingRequests[xhrId];
  34693. if (!pendingRequest) {
  34694. return;
  34695. }
  34696. var xhr = pendingRequest.xhr;
  34697. if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) {
  34698. pendingRequest.onHeadersReceived();
  34699. delete pendingRequest.onHeadersReceived;
  34700. }
  34701. if (xhr.readyState !== 4) {
  34702. return;
  34703. }
  34704. if (!(xhrId in this.pendingRequests)) {
  34705. return;
  34706. }
  34707. delete this.pendingRequests[xhrId];
  34708. if (xhr.status === 0 && this.isHttp) {
  34709. if (pendingRequest.onError) {
  34710. pendingRequest.onError(xhr.status);
  34711. }
  34712. return;
  34713. }
  34714. var xhrStatus = xhr.status || OK_RESPONSE;
  34715. var ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE;
  34716. if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) {
  34717. if (pendingRequest.onError) {
  34718. pendingRequest.onError(xhr.status);
  34719. }
  34720. return;
  34721. }
  34722. this.loadedRequests[xhrId] = true;
  34723. var chunk = getArrayBuffer(xhr);
  34724. if (xhrStatus === PARTIAL_CONTENT_RESPONSE) {
  34725. var rangeHeader = xhr.getResponseHeader('Content-Range');
  34726. var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader);
  34727. var begin = parseInt(matches[1], 10);
  34728. pendingRequest.onDone({
  34729. begin: begin,
  34730. chunk: chunk
  34731. });
  34732. } else if (pendingRequest.onProgressiveData) {
  34733. pendingRequest.onDone(null);
  34734. } else if (chunk) {
  34735. pendingRequest.onDone({
  34736. begin: 0,
  34737. chunk: chunk
  34738. });
  34739. } else if (pendingRequest.onError) {
  34740. pendingRequest.onError(xhr.status);
  34741. }
  34742. },
  34743. hasPendingRequests: function NetworkManager_hasPendingRequests() {
  34744. for (var xhrId in this.pendingRequests) {
  34745. return true;
  34746. }
  34747. return false;
  34748. },
  34749. getRequestXhr: function NetworkManager_getXhr(xhrId) {
  34750. return this.pendingRequests[xhrId].xhr;
  34751. },
  34752. isStreamingRequest: function NetworkManager_isStreamingRequest(xhrId) {
  34753. return !!this.pendingRequests[xhrId].onProgressiveData;
  34754. },
  34755. isPendingRequest: function NetworkManager_isPendingRequest(xhrId) {
  34756. return xhrId in this.pendingRequests;
  34757. },
  34758. isLoadedRequest: function NetworkManager_isLoadedRequest(xhrId) {
  34759. return xhrId in this.loadedRequests;
  34760. },
  34761. abortAllRequests: function NetworkManager_abortAllRequests() {
  34762. for (var xhrId in this.pendingRequests) {
  34763. this.abortRequest(xhrId | 0);
  34764. }
  34765. },
  34766. abortRequest: function NetworkManager_abortRequest(xhrId) {
  34767. var xhr = this.pendingRequests[xhrId].xhr;
  34768. delete this.pendingRequests[xhrId];
  34769. xhr.abort();
  34770. }
  34771. };
  34772. var assert = sharedUtil.assert;
  34773. var createPromiseCapability = sharedUtil.createPromiseCapability;
  34774. var isInt = sharedUtil.isInt;
  34775. var MissingPDFException = sharedUtil.MissingPDFException;
  34776. var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
  34777. function PDFNetworkStream(options) {
  34778. this._options = options;
  34779. var source = options.source;
  34780. this._manager = new NetworkManager(source.url, {
  34781. httpHeaders: source.httpHeaders,
  34782. withCredentials: source.withCredentials
  34783. });
  34784. this._rangeChunkSize = source.rangeChunkSize;
  34785. this._fullRequestReader = null;
  34786. this._rangeRequestReaders = [];
  34787. }
  34788. PDFNetworkStream.prototype = {
  34789. _onRangeRequestReaderClosed: function PDFNetworkStream_onRangeRequestReaderClosed(reader) {
  34790. var i = this._rangeRequestReaders.indexOf(reader);
  34791. if (i >= 0) {
  34792. this._rangeRequestReaders.splice(i, 1);
  34793. }
  34794. },
  34795. getFullReader: function PDFNetworkStream_getFullReader() {
  34796. assert(!this._fullRequestReader);
  34797. this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._options);
  34798. return this._fullRequestReader;
  34799. },
  34800. getRangeReader: function PDFNetworkStream_getRangeReader(begin, end) {
  34801. var reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end);
  34802. reader.onClosed = this._onRangeRequestReaderClosed.bind(this);
  34803. this._rangeRequestReaders.push(reader);
  34804. return reader;
  34805. },
  34806. cancelAllRequests: function PDFNetworkStream_cancelAllRequests(reason) {
  34807. if (this._fullRequestReader) {
  34808. this._fullRequestReader.cancel(reason);
  34809. }
  34810. var readers = this._rangeRequestReaders.slice(0);
  34811. readers.forEach(function (reader) {
  34812. reader.cancel(reason);
  34813. });
  34814. }
  34815. };
  34816. function PDFNetworkStreamFullRequestReader(manager, options) {
  34817. this._manager = manager;
  34818. var source = options.source;
  34819. var args = {
  34820. onHeadersReceived: this._onHeadersReceived.bind(this),
  34821. onProgressiveData: source.disableStream ? null : this._onProgressiveData.bind(this),
  34822. onDone: this._onDone.bind(this),
  34823. onError: this._onError.bind(this),
  34824. onProgress: this._onProgress.bind(this)
  34825. };
  34826. this._url = source.url;
  34827. this._fullRequestId = manager.requestFull(args);
  34828. this._headersReceivedCapability = createPromiseCapability();
  34829. this._disableRange = options.disableRange || false;
  34830. this._contentLength = source.length;
  34831. this._rangeChunkSize = source.rangeChunkSize;
  34832. if (!this._rangeChunkSize && !this._disableRange) {
  34833. this._disableRange = true;
  34834. }
  34835. this._isStreamingSupported = false;
  34836. this._isRangeSupported = false;
  34837. this._cachedChunks = [];
  34838. this._requests = [];
  34839. this._done = false;
  34840. this._storedError = undefined;
  34841. this.onProgress = null;
  34842. }
  34843. PDFNetworkStreamFullRequestReader.prototype = {
  34844. _validateRangeRequestCapabilities: function PDFNetworkStreamFullRequestReader_validateRangeRequestCapabilities() {
  34845. if (this._disableRange) {
  34846. return false;
  34847. }
  34848. var networkManager = this._manager;
  34849. if (!networkManager.isHttp) {
  34850. return false;
  34851. }
  34852. var fullRequestXhrId = this._fullRequestId;
  34853. var fullRequestXhr = networkManager.getRequestXhr(fullRequestXhrId);
  34854. if (fullRequestXhr.getResponseHeader('Accept-Ranges') !== 'bytes') {
  34855. return false;
  34856. }
  34857. var contentEncoding = fullRequestXhr.getResponseHeader('Content-Encoding') || 'identity';
  34858. if (contentEncoding !== 'identity') {
  34859. return false;
  34860. }
  34861. var length = fullRequestXhr.getResponseHeader('Content-Length');
  34862. length = parseInt(length, 10);
  34863. if (!isInt(length)) {
  34864. return false;
  34865. }
  34866. this._contentLength = length;
  34867. if (length <= 2 * this._rangeChunkSize) {
  34868. return false;
  34869. }
  34870. return true;
  34871. },
  34872. _onHeadersReceived: function PDFNetworkStreamFullRequestReader_onHeadersReceived() {
  34873. if (this._validateRangeRequestCapabilities()) {
  34874. this._isRangeSupported = true;
  34875. }
  34876. var networkManager = this._manager;
  34877. var fullRequestXhrId = this._fullRequestId;
  34878. if (networkManager.isStreamingRequest(fullRequestXhrId)) {
  34879. this._isStreamingSupported = true;
  34880. } else if (this._isRangeSupported) {
  34881. networkManager.abortRequest(fullRequestXhrId);
  34882. }
  34883. this._headersReceivedCapability.resolve();
  34884. },
  34885. _onProgressiveData: function PDFNetworkStreamFullRequestReader_onProgressiveData(chunk) {
  34886. if (this._requests.length > 0) {
  34887. var requestCapability = this._requests.shift();
  34888. requestCapability.resolve({
  34889. value: chunk,
  34890. done: false
  34891. });
  34892. } else {
  34893. this._cachedChunks.push(chunk);
  34894. }
  34895. },
  34896. _onDone: function PDFNetworkStreamFullRequestReader_onDone(args) {
  34897. if (args) {
  34898. this._onProgressiveData(args.chunk);
  34899. }
  34900. this._done = true;
  34901. if (this._cachedChunks.length > 0) {
  34902. return;
  34903. }
  34904. this._requests.forEach(function (requestCapability) {
  34905. requestCapability.resolve({
  34906. value: undefined,
  34907. done: true
  34908. });
  34909. });
  34910. this._requests = [];
  34911. },
  34912. _onError: function PDFNetworkStreamFullRequestReader_onError(status) {
  34913. var url = this._url;
  34914. var exception;
  34915. if (status === 404 || status === 0 && /^file:/.test(url)) {
  34916. exception = new MissingPDFException('Missing PDF "' + url + '".');
  34917. } else {
  34918. exception = new UnexpectedResponseException('Unexpected server response (' + status + ') while retrieving PDF "' + url + '".', status);
  34919. }
  34920. this._storedError = exception;
  34921. this._headersReceivedCapability.reject(exception);
  34922. this._requests.forEach(function (requestCapability) {
  34923. requestCapability.reject(exception);
  34924. });
  34925. this._requests = [];
  34926. this._cachedChunks = [];
  34927. },
  34928. _onProgress: function PDFNetworkStreamFullRequestReader_onProgress(data) {
  34929. if (this.onProgress) {
  34930. this.onProgress({
  34931. loaded: data.loaded,
  34932. total: data.lengthComputable ? data.total : this._contentLength
  34933. });
  34934. }
  34935. },
  34936. get isRangeSupported() {
  34937. return this._isRangeSupported;
  34938. },
  34939. get isStreamingSupported() {
  34940. return this._isStreamingSupported;
  34941. },
  34942. get contentLength() {
  34943. return this._contentLength;
  34944. },
  34945. get headersReady() {
  34946. return this._headersReceivedCapability.promise;
  34947. },
  34948. read: function PDFNetworkStreamFullRequestReader_read() {
  34949. if (this._storedError) {
  34950. return Promise.reject(this._storedError);
  34951. }
  34952. if (this._cachedChunks.length > 0) {
  34953. var chunk = this._cachedChunks.shift();
  34954. return Promise.resolve(chunk);
  34955. }
  34956. if (this._done) {
  34957. return Promise.resolve({
  34958. value: undefined,
  34959. done: true
  34960. });
  34961. }
  34962. var requestCapability = createPromiseCapability();
  34963. this._requests.push(requestCapability);
  34964. return requestCapability.promise;
  34965. },
  34966. cancel: function PDFNetworkStreamFullRequestReader_cancel(reason) {
  34967. this._done = true;
  34968. this._headersReceivedCapability.reject(reason);
  34969. this._requests.forEach(function (requestCapability) {
  34970. requestCapability.resolve({
  34971. value: undefined,
  34972. done: true
  34973. });
  34974. });
  34975. this._requests = [];
  34976. if (this._manager.isPendingRequest(this._fullRequestId)) {
  34977. this._manager.abortRequest(this._fullRequestId);
  34978. }
  34979. this._fullRequestReader = null;
  34980. }
  34981. };
  34982. function PDFNetworkStreamRangeRequestReader(manager, begin, end) {
  34983. this._manager = manager;
  34984. var args = {
  34985. onDone: this._onDone.bind(this),
  34986. onProgress: this._onProgress.bind(this)
  34987. };
  34988. this._requestId = manager.requestRange(begin, end, args);
  34989. this._requests = [];
  34990. this._queuedChunk = null;
  34991. this._done = false;
  34992. this.onProgress = null;
  34993. this.onClosed = null;
  34994. }
  34995. PDFNetworkStreamRangeRequestReader.prototype = {
  34996. _close: function PDFNetworkStreamRangeRequestReader_close() {
  34997. if (this.onClosed) {
  34998. this.onClosed(this);
  34999. }
  35000. },
  35001. _onDone: function PDFNetworkStreamRangeRequestReader_onDone(data) {
  35002. var chunk = data.chunk;
  35003. if (this._requests.length > 0) {
  35004. var requestCapability = this._requests.shift();
  35005. requestCapability.resolve({
  35006. value: chunk,
  35007. done: false
  35008. });
  35009. } else {
  35010. this._queuedChunk = chunk;
  35011. }
  35012. this._done = true;
  35013. this._requests.forEach(function (requestCapability) {
  35014. requestCapability.resolve({
  35015. value: undefined,
  35016. done: true
  35017. });
  35018. });
  35019. this._requests = [];
  35020. this._close();
  35021. },
  35022. _onProgress: function PDFNetworkStreamRangeRequestReader_onProgress(evt) {
  35023. if (!this.isStreamingSupported && this.onProgress) {
  35024. this.onProgress({ loaded: evt.loaded });
  35025. }
  35026. },
  35027. get isStreamingSupported() {
  35028. return false;
  35029. },
  35030. read: function PDFNetworkStreamRangeRequestReader_read() {
  35031. if (this._queuedChunk !== null) {
  35032. var chunk = this._queuedChunk;
  35033. this._queuedChunk = null;
  35034. return Promise.resolve({
  35035. value: chunk,
  35036. done: false
  35037. });
  35038. }
  35039. if (this._done) {
  35040. return Promise.resolve({
  35041. value: undefined,
  35042. done: true
  35043. });
  35044. }
  35045. var requestCapability = createPromiseCapability();
  35046. this._requests.push(requestCapability);
  35047. return requestCapability.promise;
  35048. },
  35049. cancel: function PDFNetworkStreamRangeRequestReader_cancel(reason) {
  35050. this._done = true;
  35051. this._requests.forEach(function (requestCapability) {
  35052. requestCapability.resolve({
  35053. value: undefined,
  35054. done: true
  35055. });
  35056. });
  35057. this._requests = [];
  35058. if (this._manager.isPendingRequest(this._requestId)) {
  35059. this._manager.abortRequest(this._requestId);
  35060. }
  35061. this._close();
  35062. }
  35063. };
  35064. coreWorker.setPDFNetworkStreamClass(PDFNetworkStream);
  35065. exports.PDFNetworkStream = PDFNetworkStream;
  35066. exports.NetworkManager = NetworkManager;
  35067. /***/ }),
  35068. /* 20 */
  35069. /***/ (function(module, exports, __w_pdfjs_require__) {
  35070. "use strict";
  35071. var sharedUtil = __w_pdfjs_require__(0);
  35072. var corePrimitives = __w_pdfjs_require__(1);
  35073. var coreStream = __w_pdfjs_require__(2);
  35074. var coreColorSpace = __w_pdfjs_require__(3);
  35075. var coreObj = __w_pdfjs_require__(16);
  35076. var coreEvaluator = __w_pdfjs_require__(14);
  35077. var AnnotationBorderStyleType = sharedUtil.AnnotationBorderStyleType;
  35078. var AnnotationFieldFlag = sharedUtil.AnnotationFieldFlag;
  35079. var AnnotationFlag = sharedUtil.AnnotationFlag;
  35080. var AnnotationType = sharedUtil.AnnotationType;
  35081. var OPS = sharedUtil.OPS;
  35082. var Util = sharedUtil.Util;
  35083. var isArray = sharedUtil.isArray;
  35084. var isInt = sharedUtil.isInt;
  35085. var stringToBytes = sharedUtil.stringToBytes;
  35086. var stringToPDFString = sharedUtil.stringToPDFString;
  35087. var warn = sharedUtil.warn;
  35088. var Dict = corePrimitives.Dict;
  35089. var isDict = corePrimitives.isDict;
  35090. var isName = corePrimitives.isName;
  35091. var isRef = corePrimitives.isRef;
  35092. var isStream = corePrimitives.isStream;
  35093. var Stream = coreStream.Stream;
  35094. var ColorSpace = coreColorSpace.ColorSpace;
  35095. var Catalog = coreObj.Catalog;
  35096. var ObjectLoader = coreObj.ObjectLoader;
  35097. var FileSpec = coreObj.FileSpec;
  35098. var OperatorList = coreEvaluator.OperatorList;
  35099. function AnnotationFactory() {
  35100. }
  35101. AnnotationFactory.prototype = {
  35102. create: function AnnotationFactory_create(xref, ref, pdfManager, idFactory) {
  35103. var dict = xref.fetchIfRef(ref);
  35104. if (!isDict(dict)) {
  35105. return;
  35106. }
  35107. var id = isRef(ref) ? ref.toString() : 'annot_' + idFactory.createObjId();
  35108. var subtype = dict.get('Subtype');
  35109. subtype = isName(subtype) ? subtype.name : null;
  35110. var parameters = {
  35111. xref: xref,
  35112. dict: dict,
  35113. ref: isRef(ref) ? ref : null,
  35114. subtype: subtype,
  35115. id: id,
  35116. pdfManager: pdfManager
  35117. };
  35118. switch (subtype) {
  35119. case 'Link':
  35120. return new LinkAnnotation(parameters);
  35121. case 'Text':
  35122. return new TextAnnotation(parameters);
  35123. case 'Widget':
  35124. var fieldType = Util.getInheritableProperty(dict, 'FT');
  35125. fieldType = isName(fieldType) ? fieldType.name : null;
  35126. switch (fieldType) {
  35127. case 'Tx':
  35128. return new TextWidgetAnnotation(parameters);
  35129. case 'Btn':
  35130. return new ButtonWidgetAnnotation(parameters);
  35131. case 'Ch':
  35132. return new ChoiceWidgetAnnotation(parameters);
  35133. }
  35134. warn('Unimplemented widget field type "' + fieldType + '", ' + 'falling back to base field type.');
  35135. return new WidgetAnnotation(parameters);
  35136. case 'Popup':
  35137. return new PopupAnnotation(parameters);
  35138. case 'Highlight':
  35139. return new HighlightAnnotation(parameters);
  35140. case 'Underline':
  35141. return new UnderlineAnnotation(parameters);
  35142. case 'Squiggly':
  35143. return new SquigglyAnnotation(parameters);
  35144. case 'StrikeOut':
  35145. return new StrikeOutAnnotation(parameters);
  35146. case 'FileAttachment':
  35147. return new FileAttachmentAnnotation(parameters);
  35148. default:
  35149. if (!subtype) {
  35150. warn('Annotation is missing the required /Subtype.');
  35151. } else {
  35152. warn('Unimplemented annotation type "' + subtype + '", ' + 'falling back to base annotation.');
  35153. }
  35154. return new Annotation(parameters);
  35155. }
  35156. }
  35157. };
  35158. var Annotation = function AnnotationClosure() {
  35159. function getTransformMatrix(rect, bbox, matrix) {
  35160. var bounds = Util.getAxialAlignedBoundingBox(bbox, matrix);
  35161. var minX = bounds[0];
  35162. var minY = bounds[1];
  35163. var maxX = bounds[2];
  35164. var maxY = bounds[3];
  35165. if (minX === maxX || minY === maxY) {
  35166. return [
  35167. 1,
  35168. 0,
  35169. 0,
  35170. 1,
  35171. rect[0],
  35172. rect[1]
  35173. ];
  35174. }
  35175. var xRatio = (rect[2] - rect[0]) / (maxX - minX);
  35176. var yRatio = (rect[3] - rect[1]) / (maxY - minY);
  35177. return [
  35178. xRatio,
  35179. 0,
  35180. 0,
  35181. yRatio,
  35182. rect[0] - minX * xRatio,
  35183. rect[1] - minY * yRatio
  35184. ];
  35185. }
  35186. function Annotation(params) {
  35187. var dict = params.dict;
  35188. this.setFlags(dict.get('F'));
  35189. this.setRectangle(dict.getArray('Rect'));
  35190. this.setColor(dict.getArray('C'));
  35191. this.setBorderStyle(dict);
  35192. this.setAppearance(dict);
  35193. this.data = {};
  35194. this.data.id = params.id;
  35195. this.data.subtype = params.subtype;
  35196. this.data.annotationFlags = this.flags;
  35197. this.data.rect = this.rectangle;
  35198. this.data.color = this.color;
  35199. this.data.borderStyle = this.borderStyle;
  35200. this.data.hasAppearance = !!this.appearance;
  35201. }
  35202. Annotation.prototype = {
  35203. _hasFlag: function Annotation_hasFlag(flags, flag) {
  35204. return !!(flags & flag);
  35205. },
  35206. _isViewable: function Annotation_isViewable(flags) {
  35207. return !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.HIDDEN) && !this._hasFlag(flags, AnnotationFlag.NOVIEW);
  35208. },
  35209. _isPrintable: function AnnotationFlag_isPrintable(flags) {
  35210. return this._hasFlag(flags, AnnotationFlag.PRINT) && !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.HIDDEN);
  35211. },
  35212. get viewable() {
  35213. if (this.flags === 0) {
  35214. return true;
  35215. }
  35216. return this._isViewable(this.flags);
  35217. },
  35218. get printable() {
  35219. if (this.flags === 0) {
  35220. return false;
  35221. }
  35222. return this._isPrintable(this.flags);
  35223. },
  35224. setFlags: function Annotation_setFlags(flags) {
  35225. this.flags = isInt(flags) && flags > 0 ? flags : 0;
  35226. },
  35227. hasFlag: function Annotation_hasFlag(flag) {
  35228. return this._hasFlag(this.flags, flag);
  35229. },
  35230. setRectangle: function Annotation_setRectangle(rectangle) {
  35231. if (isArray(rectangle) && rectangle.length === 4) {
  35232. this.rectangle = Util.normalizeRect(rectangle);
  35233. } else {
  35234. this.rectangle = [
  35235. 0,
  35236. 0,
  35237. 0,
  35238. 0
  35239. ];
  35240. }
  35241. },
  35242. setColor: function Annotation_setColor(color) {
  35243. var rgbColor = new Uint8Array(3);
  35244. if (!isArray(color)) {
  35245. this.color = rgbColor;
  35246. return;
  35247. }
  35248. switch (color.length) {
  35249. case 0:
  35250. this.color = null;
  35251. break;
  35252. case 1:
  35253. ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  35254. this.color = rgbColor;
  35255. break;
  35256. case 3:
  35257. ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  35258. this.color = rgbColor;
  35259. break;
  35260. case 4:
  35261. ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  35262. this.color = rgbColor;
  35263. break;
  35264. default:
  35265. this.color = rgbColor;
  35266. break;
  35267. }
  35268. },
  35269. setBorderStyle: function Annotation_setBorderStyle(borderStyle) {
  35270. this.borderStyle = new AnnotationBorderStyle();
  35271. if (!isDict(borderStyle)) {
  35272. return;
  35273. }
  35274. if (borderStyle.has('BS')) {
  35275. var dict = borderStyle.get('BS');
  35276. var dictType = dict.get('Type');
  35277. if (!dictType || isName(dictType, 'Border')) {
  35278. this.borderStyle.setWidth(dict.get('W'));
  35279. this.borderStyle.setStyle(dict.get('S'));
  35280. this.borderStyle.setDashArray(dict.getArray('D'));
  35281. }
  35282. } else if (borderStyle.has('Border')) {
  35283. var array = borderStyle.getArray('Border');
  35284. if (isArray(array) && array.length >= 3) {
  35285. this.borderStyle.setHorizontalCornerRadius(array[0]);
  35286. this.borderStyle.setVerticalCornerRadius(array[1]);
  35287. this.borderStyle.setWidth(array[2]);
  35288. if (array.length === 4) {
  35289. this.borderStyle.setDashArray(array[3]);
  35290. }
  35291. }
  35292. } else {
  35293. this.borderStyle.setWidth(0);
  35294. }
  35295. },
  35296. setAppearance: function Annotation_setAppearance(dict) {
  35297. this.appearance = null;
  35298. var appearanceStates = dict.get('AP');
  35299. if (!isDict(appearanceStates)) {
  35300. return;
  35301. }
  35302. var normalAppearanceState = appearanceStates.get('N');
  35303. if (isStream(normalAppearanceState)) {
  35304. this.appearance = normalAppearanceState;
  35305. return;
  35306. }
  35307. if (!isDict(normalAppearanceState)) {
  35308. return;
  35309. }
  35310. var as = dict.get('AS');
  35311. if (!isName(as) || !normalAppearanceState.has(as.name)) {
  35312. return;
  35313. }
  35314. this.appearance = normalAppearanceState.get(as.name);
  35315. },
  35316. _preparePopup: function Annotation_preparePopup(dict) {
  35317. if (!dict.has('C')) {
  35318. this.data.color = null;
  35319. }
  35320. this.data.hasPopup = dict.has('Popup');
  35321. this.data.title = stringToPDFString(dict.get('T') || '');
  35322. this.data.contents = stringToPDFString(dict.get('Contents') || '');
  35323. },
  35324. loadResources: function Annotation_loadResources(keys) {
  35325. return new Promise(function (resolve, reject) {
  35326. this.appearance.dict.getAsync('Resources').then(function (resources) {
  35327. if (!resources) {
  35328. resolve();
  35329. return;
  35330. }
  35331. var objectLoader = new ObjectLoader(resources.map, keys, resources.xref);
  35332. objectLoader.load().then(function () {
  35333. resolve(resources);
  35334. }, reject);
  35335. }, reject);
  35336. }.bind(this));
  35337. },
  35338. getOperatorList: function Annotation_getOperatorList(evaluator, task, renderForms) {
  35339. if (!this.appearance) {
  35340. return Promise.resolve(new OperatorList());
  35341. }
  35342. var data = this.data;
  35343. var appearanceDict = this.appearance.dict;
  35344. var resourcesPromise = this.loadResources([
  35345. 'ExtGState',
  35346. 'ColorSpace',
  35347. 'Pattern',
  35348. 'Shading',
  35349. 'XObject',
  35350. 'Font'
  35351. ]);
  35352. var bbox = appearanceDict.getArray('BBox') || [
  35353. 0,
  35354. 0,
  35355. 1,
  35356. 1
  35357. ];
  35358. var matrix = appearanceDict.getArray('Matrix') || [
  35359. 1,
  35360. 0,
  35361. 0,
  35362. 1,
  35363. 0,
  35364. 0
  35365. ];
  35366. var transform = getTransformMatrix(data.rect, bbox, matrix);
  35367. var self = this;
  35368. return resourcesPromise.then(function (resources) {
  35369. var opList = new OperatorList();
  35370. opList.addOp(OPS.beginAnnotation, [
  35371. data.rect,
  35372. transform,
  35373. matrix
  35374. ]);
  35375. return evaluator.getOperatorList(self.appearance, task, resources, opList).then(function () {
  35376. opList.addOp(OPS.endAnnotation, []);
  35377. self.appearance.reset();
  35378. return opList;
  35379. });
  35380. });
  35381. }
  35382. };
  35383. return Annotation;
  35384. }();
  35385. var AnnotationBorderStyle = function AnnotationBorderStyleClosure() {
  35386. function AnnotationBorderStyle() {
  35387. this.width = 1;
  35388. this.style = AnnotationBorderStyleType.SOLID;
  35389. this.dashArray = [3];
  35390. this.horizontalCornerRadius = 0;
  35391. this.verticalCornerRadius = 0;
  35392. }
  35393. AnnotationBorderStyle.prototype = {
  35394. setWidth: function AnnotationBorderStyle_setWidth(width) {
  35395. if (width === (width | 0)) {
  35396. this.width = width;
  35397. }
  35398. },
  35399. setStyle: function AnnotationBorderStyle_setStyle(style) {
  35400. if (!style) {
  35401. return;
  35402. }
  35403. switch (style.name) {
  35404. case 'S':
  35405. this.style = AnnotationBorderStyleType.SOLID;
  35406. break;
  35407. case 'D':
  35408. this.style = AnnotationBorderStyleType.DASHED;
  35409. break;
  35410. case 'B':
  35411. this.style = AnnotationBorderStyleType.BEVELED;
  35412. break;
  35413. case 'I':
  35414. this.style = AnnotationBorderStyleType.INSET;
  35415. break;
  35416. case 'U':
  35417. this.style = AnnotationBorderStyleType.UNDERLINE;
  35418. break;
  35419. default:
  35420. break;
  35421. }
  35422. },
  35423. setDashArray: function AnnotationBorderStyle_setDashArray(dashArray) {
  35424. if (isArray(dashArray) && dashArray.length > 0) {
  35425. var isValid = true;
  35426. var allZeros = true;
  35427. for (var i = 0, len = dashArray.length; i < len; i++) {
  35428. var element = dashArray[i];
  35429. var validNumber = +element >= 0;
  35430. if (!validNumber) {
  35431. isValid = false;
  35432. break;
  35433. } else if (element > 0) {
  35434. allZeros = false;
  35435. }
  35436. }
  35437. if (isValid && !allZeros) {
  35438. this.dashArray = dashArray;
  35439. } else {
  35440. this.width = 0;
  35441. }
  35442. } else if (dashArray) {
  35443. this.width = 0;
  35444. }
  35445. },
  35446. setHorizontalCornerRadius: function AnnotationBorderStyle_setHorizontalCornerRadius(radius) {
  35447. if (radius === (radius | 0)) {
  35448. this.horizontalCornerRadius = radius;
  35449. }
  35450. },
  35451. setVerticalCornerRadius: function AnnotationBorderStyle_setVerticalCornerRadius(radius) {
  35452. if (radius === (radius | 0)) {
  35453. this.verticalCornerRadius = radius;
  35454. }
  35455. }
  35456. };
  35457. return AnnotationBorderStyle;
  35458. }();
  35459. var WidgetAnnotation = function WidgetAnnotationClosure() {
  35460. function WidgetAnnotation(params) {
  35461. Annotation.call(this, params);
  35462. var dict = params.dict;
  35463. var data = this.data;
  35464. data.annotationType = AnnotationType.WIDGET;
  35465. data.fieldName = this._constructFieldName(dict);
  35466. data.fieldValue = Util.getInheritableProperty(dict, 'V', true);
  35467. data.alternativeText = stringToPDFString(dict.get('TU') || '');
  35468. data.defaultAppearance = Util.getInheritableProperty(dict, 'DA') || '';
  35469. var fieldType = Util.getInheritableProperty(dict, 'FT');
  35470. data.fieldType = isName(fieldType) ? fieldType.name : null;
  35471. this.fieldResources = Util.getInheritableProperty(dict, 'DR') || Dict.empty;
  35472. data.fieldFlags = Util.getInheritableProperty(dict, 'Ff');
  35473. if (!isInt(data.fieldFlags) || data.fieldFlags < 0) {
  35474. data.fieldFlags = 0;
  35475. }
  35476. data.readOnly = this.hasFieldFlag(AnnotationFieldFlag.READONLY);
  35477. if (data.fieldType === 'Sig') {
  35478. this.setFlags(AnnotationFlag.HIDDEN);
  35479. }
  35480. }
  35481. Util.inherit(WidgetAnnotation, Annotation, {
  35482. _constructFieldName: function WidgetAnnotation_constructFieldName(dict) {
  35483. if (!dict.has('T') && !dict.has('Parent')) {
  35484. warn('Unknown field name, falling back to empty field name.');
  35485. return '';
  35486. }
  35487. if (!dict.has('Parent')) {
  35488. return stringToPDFString(dict.get('T'));
  35489. }
  35490. var fieldName = [];
  35491. if (dict.has('T')) {
  35492. fieldName.unshift(stringToPDFString(dict.get('T')));
  35493. }
  35494. var loopDict = dict;
  35495. while (loopDict.has('Parent')) {
  35496. loopDict = loopDict.get('Parent');
  35497. if (!isDict(loopDict)) {
  35498. break;
  35499. }
  35500. if (loopDict.has('T')) {
  35501. fieldName.unshift(stringToPDFString(loopDict.get('T')));
  35502. }
  35503. }
  35504. return fieldName.join('.');
  35505. },
  35506. hasFieldFlag: function WidgetAnnotation_hasFieldFlag(flag) {
  35507. return !!(this.data.fieldFlags & flag);
  35508. }
  35509. });
  35510. return WidgetAnnotation;
  35511. }();
  35512. var TextWidgetAnnotation = function TextWidgetAnnotationClosure() {
  35513. function TextWidgetAnnotation(params) {
  35514. WidgetAnnotation.call(this, params);
  35515. this.data.fieldValue = stringToPDFString(this.data.fieldValue || '');
  35516. var alignment = Util.getInheritableProperty(params.dict, 'Q');
  35517. if (!isInt(alignment) || alignment < 0 || alignment > 2) {
  35518. alignment = null;
  35519. }
  35520. this.data.textAlignment = alignment;
  35521. var maximumLength = Util.getInheritableProperty(params.dict, 'MaxLen');
  35522. if (!isInt(maximumLength) || maximumLength < 0) {
  35523. maximumLength = null;
  35524. }
  35525. this.data.maxLen = maximumLength;
  35526. this.data.multiLine = this.hasFieldFlag(AnnotationFieldFlag.MULTILINE);
  35527. this.data.comb = this.hasFieldFlag(AnnotationFieldFlag.COMB) && !this.hasFieldFlag(AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== null;
  35528. }
  35529. Util.inherit(TextWidgetAnnotation, WidgetAnnotation, {
  35530. getOperatorList: function TextWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  35531. var operatorList = new OperatorList();
  35532. if (renderForms) {
  35533. return Promise.resolve(operatorList);
  35534. }
  35535. if (this.appearance) {
  35536. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  35537. }
  35538. if (!this.data.defaultAppearance) {
  35539. return Promise.resolve(operatorList);
  35540. }
  35541. var stream = new Stream(stringToBytes(this.data.defaultAppearance));
  35542. return evaluator.getOperatorList(stream, task, this.fieldResources, operatorList).then(function () {
  35543. return operatorList;
  35544. });
  35545. }
  35546. });
  35547. return TextWidgetAnnotation;
  35548. }();
  35549. var ButtonWidgetAnnotation = function ButtonWidgetAnnotationClosure() {
  35550. function ButtonWidgetAnnotation(params) {
  35551. WidgetAnnotation.call(this, params);
  35552. this.data.checkBox = !this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  35553. if (this.data.checkBox) {
  35554. if (!isName(this.data.fieldValue)) {
  35555. return;
  35556. }
  35557. this.data.fieldValue = this.data.fieldValue.name;
  35558. }
  35559. this.data.radioButton = this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  35560. if (this.data.radioButton) {
  35561. this.data.fieldValue = this.data.buttonValue = null;
  35562. var fieldParent = params.dict.get('Parent');
  35563. if (isDict(fieldParent) && fieldParent.has('V')) {
  35564. var fieldParentValue = fieldParent.get('V');
  35565. if (isName(fieldParentValue)) {
  35566. this.data.fieldValue = fieldParentValue.name;
  35567. }
  35568. }
  35569. var appearanceStates = params.dict.get('AP');
  35570. if (!isDict(appearanceStates)) {
  35571. return;
  35572. }
  35573. var normalAppearanceState = appearanceStates.get('N');
  35574. if (!isDict(normalAppearanceState)) {
  35575. return;
  35576. }
  35577. var keys = normalAppearanceState.getKeys();
  35578. for (var i = 0, ii = keys.length; i < ii; i++) {
  35579. if (keys[i] !== 'Off') {
  35580. this.data.buttonValue = keys[i];
  35581. break;
  35582. }
  35583. }
  35584. }
  35585. }
  35586. Util.inherit(ButtonWidgetAnnotation, WidgetAnnotation, {
  35587. getOperatorList: function ButtonWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  35588. var operatorList = new OperatorList();
  35589. if (renderForms) {
  35590. return Promise.resolve(operatorList);
  35591. }
  35592. if (this.appearance) {
  35593. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  35594. }
  35595. return Promise.resolve(operatorList);
  35596. }
  35597. });
  35598. return ButtonWidgetAnnotation;
  35599. }();
  35600. var ChoiceWidgetAnnotation = function ChoiceWidgetAnnotationClosure() {
  35601. function ChoiceWidgetAnnotation(params) {
  35602. WidgetAnnotation.call(this, params);
  35603. this.data.options = [];
  35604. var options = Util.getInheritableProperty(params.dict, 'Opt');
  35605. if (isArray(options)) {
  35606. var xref = params.xref;
  35607. for (var i = 0, ii = options.length; i < ii; i++) {
  35608. var option = xref.fetchIfRef(options[i]);
  35609. var isOptionArray = isArray(option);
  35610. this.data.options[i] = {
  35611. exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option,
  35612. displayValue: isOptionArray ? xref.fetchIfRef(option[1]) : option
  35613. };
  35614. }
  35615. }
  35616. if (!isArray(this.data.fieldValue)) {
  35617. this.data.fieldValue = [this.data.fieldValue];
  35618. }
  35619. this.data.combo = this.hasFieldFlag(AnnotationFieldFlag.COMBO);
  35620. this.data.multiSelect = this.hasFieldFlag(AnnotationFieldFlag.MULTISELECT);
  35621. }
  35622. Util.inherit(ChoiceWidgetAnnotation, WidgetAnnotation, {
  35623. getOperatorList: function ChoiceWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
  35624. var operatorList = new OperatorList();
  35625. if (renderForms) {
  35626. return Promise.resolve(operatorList);
  35627. }
  35628. return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
  35629. }
  35630. });
  35631. return ChoiceWidgetAnnotation;
  35632. }();
  35633. var TextAnnotation = function TextAnnotationClosure() {
  35634. var DEFAULT_ICON_SIZE = 22;
  35635. function TextAnnotation(parameters) {
  35636. Annotation.call(this, parameters);
  35637. this.data.annotationType = AnnotationType.TEXT;
  35638. if (this.data.hasAppearance) {
  35639. this.data.name = 'NoIcon';
  35640. } else {
  35641. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  35642. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  35643. this.data.name = parameters.dict.has('Name') ? parameters.dict.get('Name').name : 'Note';
  35644. }
  35645. this._preparePopup(parameters.dict);
  35646. }
  35647. Util.inherit(TextAnnotation, Annotation, {});
  35648. return TextAnnotation;
  35649. }();
  35650. var LinkAnnotation = function LinkAnnotationClosure() {
  35651. function LinkAnnotation(params) {
  35652. Annotation.call(this, params);
  35653. var data = this.data;
  35654. data.annotationType = AnnotationType.LINK;
  35655. Catalog.parseDestDictionary({
  35656. destDict: params.dict,
  35657. resultObj: data,
  35658. docBaseUrl: params.pdfManager.docBaseUrl
  35659. });
  35660. }
  35661. Util.inherit(LinkAnnotation, Annotation, {});
  35662. return LinkAnnotation;
  35663. }();
  35664. var PopupAnnotation = function PopupAnnotationClosure() {
  35665. function PopupAnnotation(parameters) {
  35666. Annotation.call(this, parameters);
  35667. this.data.annotationType = AnnotationType.POPUP;
  35668. var dict = parameters.dict;
  35669. var parentItem = dict.get('Parent');
  35670. if (!parentItem) {
  35671. warn('Popup annotation has a missing or invalid parent annotation.');
  35672. return;
  35673. }
  35674. this.data.parentId = dict.getRaw('Parent').toString();
  35675. this.data.title = stringToPDFString(parentItem.get('T') || '');
  35676. this.data.contents = stringToPDFString(parentItem.get('Contents') || '');
  35677. if (!parentItem.has('C')) {
  35678. this.data.color = null;
  35679. } else {
  35680. this.setColor(parentItem.getArray('C'));
  35681. this.data.color = this.color;
  35682. }
  35683. if (!this.viewable) {
  35684. var parentFlags = parentItem.get('F');
  35685. if (this._isViewable(parentFlags)) {
  35686. this.setFlags(parentFlags);
  35687. }
  35688. }
  35689. }
  35690. Util.inherit(PopupAnnotation, Annotation, {});
  35691. return PopupAnnotation;
  35692. }();
  35693. var HighlightAnnotation = function HighlightAnnotationClosure() {
  35694. function HighlightAnnotation(parameters) {
  35695. Annotation.call(this, parameters);
  35696. this.data.annotationType = AnnotationType.HIGHLIGHT;
  35697. this._preparePopup(parameters.dict);
  35698. this.data.borderStyle.setWidth(0);
  35699. }
  35700. Util.inherit(HighlightAnnotation, Annotation, {});
  35701. return HighlightAnnotation;
  35702. }();
  35703. var UnderlineAnnotation = function UnderlineAnnotationClosure() {
  35704. function UnderlineAnnotation(parameters) {
  35705. Annotation.call(this, parameters);
  35706. this.data.annotationType = AnnotationType.UNDERLINE;
  35707. this._preparePopup(parameters.dict);
  35708. this.data.borderStyle.setWidth(0);
  35709. }
  35710. Util.inherit(UnderlineAnnotation, Annotation, {});
  35711. return UnderlineAnnotation;
  35712. }();
  35713. var SquigglyAnnotation = function SquigglyAnnotationClosure() {
  35714. function SquigglyAnnotation(parameters) {
  35715. Annotation.call(this, parameters);
  35716. this.data.annotationType = AnnotationType.SQUIGGLY;
  35717. this._preparePopup(parameters.dict);
  35718. this.data.borderStyle.setWidth(0);
  35719. }
  35720. Util.inherit(SquigglyAnnotation, Annotation, {});
  35721. return SquigglyAnnotation;
  35722. }();
  35723. var StrikeOutAnnotation = function StrikeOutAnnotationClosure() {
  35724. function StrikeOutAnnotation(parameters) {
  35725. Annotation.call(this, parameters);
  35726. this.data.annotationType = AnnotationType.STRIKEOUT;
  35727. this._preparePopup(parameters.dict);
  35728. this.data.borderStyle.setWidth(0);
  35729. }
  35730. Util.inherit(StrikeOutAnnotation, Annotation, {});
  35731. return StrikeOutAnnotation;
  35732. }();
  35733. var FileAttachmentAnnotation = function FileAttachmentAnnotationClosure() {
  35734. function FileAttachmentAnnotation(parameters) {
  35735. Annotation.call(this, parameters);
  35736. var file = new FileSpec(parameters.dict.get('FS'), parameters.xref);
  35737. this.data.annotationType = AnnotationType.FILEATTACHMENT;
  35738. this.data.file = file.serializable;
  35739. this._preparePopup(parameters.dict);
  35740. }
  35741. Util.inherit(FileAttachmentAnnotation, Annotation, {});
  35742. return FileAttachmentAnnotation;
  35743. }();
  35744. exports.Annotation = Annotation;
  35745. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  35746. exports.AnnotationFactory = AnnotationFactory;
  35747. /***/ }),
  35748. /* 21 */
  35749. /***/ (function(module, exports, __w_pdfjs_require__) {
  35750. "use strict";
  35751. var sharedUtil = __w_pdfjs_require__(0);
  35752. var warn = sharedUtil.warn;
  35753. var baseTypes = [
  35754. 'BN',
  35755. 'BN',
  35756. 'BN',
  35757. 'BN',
  35758. 'BN',
  35759. 'BN',
  35760. 'BN',
  35761. 'BN',
  35762. 'BN',
  35763. 'S',
  35764. 'B',
  35765. 'S',
  35766. 'WS',
  35767. 'B',
  35768. 'BN',
  35769. 'BN',
  35770. 'BN',
  35771. 'BN',
  35772. 'BN',
  35773. 'BN',
  35774. 'BN',
  35775. 'BN',
  35776. 'BN',
  35777. 'BN',
  35778. 'BN',
  35779. 'BN',
  35780. 'BN',
  35781. 'BN',
  35782. 'B',
  35783. 'B',
  35784. 'B',
  35785. 'S',
  35786. 'WS',
  35787. 'ON',
  35788. 'ON',
  35789. 'ET',
  35790. 'ET',
  35791. 'ET',
  35792. 'ON',
  35793. 'ON',
  35794. 'ON',
  35795. 'ON',
  35796. 'ON',
  35797. 'ES',
  35798. 'CS',
  35799. 'ES',
  35800. 'CS',
  35801. 'CS',
  35802. 'EN',
  35803. 'EN',
  35804. 'EN',
  35805. 'EN',
  35806. 'EN',
  35807. 'EN',
  35808. 'EN',
  35809. 'EN',
  35810. 'EN',
  35811. 'EN',
  35812. 'CS',
  35813. 'ON',
  35814. 'ON',
  35815. 'ON',
  35816. 'ON',
  35817. 'ON',
  35818. 'ON',
  35819. 'L',
  35820. 'L',
  35821. 'L',
  35822. 'L',
  35823. 'L',
  35824. 'L',
  35825. 'L',
  35826. 'L',
  35827. 'L',
  35828. 'L',
  35829. 'L',
  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. 'ON',
  35846. 'ON',
  35847. 'ON',
  35848. 'ON',
  35849. 'ON',
  35850. 'ON',
  35851. 'L',
  35852. 'L',
  35853. 'L',
  35854. 'L',
  35855. 'L',
  35856. 'L',
  35857. 'L',
  35858. 'L',
  35859. 'L',
  35860. 'L',
  35861. 'L',
  35862. 'L',
  35863. 'L',
  35864. 'L',
  35865. 'L',
  35866. 'L',
  35867. 'L',
  35868. 'L',
  35869. 'L',
  35870. 'L',
  35871. 'L',
  35872. 'L',
  35873. 'L',
  35874. 'L',
  35875. 'L',
  35876. 'L',
  35877. 'ON',
  35878. 'ON',
  35879. 'ON',
  35880. 'ON',
  35881. 'BN',
  35882. 'BN',
  35883. 'BN',
  35884. 'BN',
  35885. 'BN',
  35886. 'BN',
  35887. 'B',
  35888. 'BN',
  35889. 'BN',
  35890. 'BN',
  35891. 'BN',
  35892. 'BN',
  35893. 'BN',
  35894. 'BN',
  35895. 'BN',
  35896. 'BN',
  35897. 'BN',
  35898. 'BN',
  35899. 'BN',
  35900. 'BN',
  35901. 'BN',
  35902. 'BN',
  35903. 'BN',
  35904. 'BN',
  35905. 'BN',
  35906. 'BN',
  35907. 'BN',
  35908. 'BN',
  35909. 'BN',
  35910. 'BN',
  35911. 'BN',
  35912. 'BN',
  35913. 'BN',
  35914. 'CS',
  35915. 'ON',
  35916. 'ET',
  35917. 'ET',
  35918. 'ET',
  35919. 'ET',
  35920. 'ON',
  35921. 'ON',
  35922. 'ON',
  35923. 'ON',
  35924. 'L',
  35925. 'ON',
  35926. 'ON',
  35927. 'BN',
  35928. 'ON',
  35929. 'ON',
  35930. 'ET',
  35931. 'ET',
  35932. 'EN',
  35933. 'EN',
  35934. 'ON',
  35935. 'L',
  35936. 'ON',
  35937. 'ON',
  35938. 'ON',
  35939. 'EN',
  35940. 'L',
  35941. 'ON',
  35942. 'ON',
  35943. 'ON',
  35944. 'ON',
  35945. 'ON',
  35946. 'L',
  35947. 'L',
  35948. 'L',
  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. 'ON',
  35970. 'L',
  35971. 'L',
  35972. 'L',
  35973. 'L',
  35974. 'L',
  35975. 'L',
  35976. 'L',
  35977. 'L',
  35978. 'L',
  35979. 'L',
  35980. 'L',
  35981. 'L',
  35982. 'L',
  35983. 'L',
  35984. 'L',
  35985. 'L',
  35986. 'L',
  35987. 'L',
  35988. 'L',
  35989. 'L',
  35990. 'L',
  35991. 'L',
  35992. 'L',
  35993. 'L',
  35994. 'L',
  35995. 'L',
  35996. 'L',
  35997. 'L',
  35998. 'L',
  35999. 'L',
  36000. 'L',
  36001. 'ON',
  36002. 'L',
  36003. 'L',
  36004. 'L',
  36005. 'L',
  36006. 'L',
  36007. 'L',
  36008. 'L',
  36009. 'L'
  36010. ];
  36011. var arabicTypes = [
  36012. 'AN',
  36013. 'AN',
  36014. 'AN',
  36015. 'AN',
  36016. 'AN',
  36017. 'AN',
  36018. 'ON',
  36019. 'ON',
  36020. 'AL',
  36021. 'ET',
  36022. 'ET',
  36023. 'AL',
  36024. 'CS',
  36025. 'AL',
  36026. 'ON',
  36027. 'ON',
  36028. 'NSM',
  36029. 'NSM',
  36030. 'NSM',
  36031. 'NSM',
  36032. 'NSM',
  36033. 'NSM',
  36034. 'NSM',
  36035. 'NSM',
  36036. 'NSM',
  36037. 'NSM',
  36038. 'NSM',
  36039. 'AL',
  36040. 'AL',
  36041. '',
  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. 'AL',
  36067. 'AL',
  36068. 'AL',
  36069. 'AL',
  36070. 'AL',
  36071. 'AL',
  36072. 'AL',
  36073. 'AL',
  36074. 'AL',
  36075. 'AL',
  36076. 'AL',
  36077. 'AL',
  36078. 'AL',
  36079. 'AL',
  36080. 'AL',
  36081. 'AL',
  36082. 'AL',
  36083. 'AL',
  36084. 'AL',
  36085. 'AL',
  36086. 'AL',
  36087. 'NSM',
  36088. 'NSM',
  36089. 'NSM',
  36090. 'NSM',
  36091. 'NSM',
  36092. 'NSM',
  36093. 'NSM',
  36094. 'NSM',
  36095. 'NSM',
  36096. 'NSM',
  36097. 'NSM',
  36098. 'NSM',
  36099. 'NSM',
  36100. 'NSM',
  36101. 'NSM',
  36102. 'NSM',
  36103. 'NSM',
  36104. 'NSM',
  36105. 'NSM',
  36106. 'NSM',
  36107. 'NSM',
  36108. 'AN',
  36109. 'AN',
  36110. 'AN',
  36111. 'AN',
  36112. 'AN',
  36113. 'AN',
  36114. 'AN',
  36115. 'AN',
  36116. 'AN',
  36117. 'AN',
  36118. 'ET',
  36119. 'AN',
  36120. 'AN',
  36121. 'AL',
  36122. 'AL',
  36123. 'AL',
  36124. 'NSM',
  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. 'AL',
  36206. 'AL',
  36207. 'AL',
  36208. 'AL',
  36209. 'AL',
  36210. 'AL',
  36211. 'AL',
  36212. 'AL',
  36213. 'AL',
  36214. 'AL',
  36215. 'AL',
  36216. 'AL',
  36217. 'AL',
  36218. 'AL',
  36219. 'AL',
  36220. 'AL',
  36221. 'AL',
  36222. 'AL',
  36223. 'AL',
  36224. 'AL',
  36225. 'AL',
  36226. 'NSM',
  36227. 'NSM',
  36228. 'NSM',
  36229. 'NSM',
  36230. 'NSM',
  36231. 'NSM',
  36232. 'NSM',
  36233. 'AN',
  36234. 'ON',
  36235. 'NSM',
  36236. 'NSM',
  36237. 'NSM',
  36238. 'NSM',
  36239. 'NSM',
  36240. 'NSM',
  36241. 'AL',
  36242. 'AL',
  36243. 'NSM',
  36244. 'NSM',
  36245. 'ON',
  36246. 'NSM',
  36247. 'NSM',
  36248. 'NSM',
  36249. 'NSM',
  36250. 'AL',
  36251. 'AL',
  36252. 'EN',
  36253. 'EN',
  36254. 'EN',
  36255. 'EN',
  36256. 'EN',
  36257. 'EN',
  36258. 'EN',
  36259. 'EN',
  36260. 'EN',
  36261. 'EN',
  36262. 'AL',
  36263. 'AL',
  36264. 'AL',
  36265. 'AL',
  36266. 'AL',
  36267. 'AL'
  36268. ];
  36269. function isOdd(i) {
  36270. return (i & 1) !== 0;
  36271. }
  36272. function isEven(i) {
  36273. return (i & 1) === 0;
  36274. }
  36275. function findUnequal(arr, start, value) {
  36276. for (var j = start, jj = arr.length; j < jj; ++j) {
  36277. if (arr[j] !== value) {
  36278. return j;
  36279. }
  36280. }
  36281. return j;
  36282. }
  36283. function setValues(arr, start, end, value) {
  36284. for (var j = start; j < end; ++j) {
  36285. arr[j] = value;
  36286. }
  36287. }
  36288. function reverseValues(arr, start, end) {
  36289. for (var i = start, j = end - 1; i < j; ++i, --j) {
  36290. var temp = arr[i];
  36291. arr[i] = arr[j];
  36292. arr[j] = temp;
  36293. }
  36294. }
  36295. function createBidiText(str, isLTR, vertical) {
  36296. return {
  36297. str: str,
  36298. dir: vertical ? 'ttb' : isLTR ? 'ltr' : 'rtl'
  36299. };
  36300. }
  36301. var chars = [];
  36302. var types = [];
  36303. function bidi(str, startLevel, vertical) {
  36304. var isLTR = true;
  36305. var strLength = str.length;
  36306. if (strLength === 0 || vertical) {
  36307. return createBidiText(str, isLTR, vertical);
  36308. }
  36309. chars.length = strLength;
  36310. types.length = strLength;
  36311. var numBidi = 0;
  36312. var i, ii;
  36313. for (i = 0; i < strLength; ++i) {
  36314. chars[i] = str.charAt(i);
  36315. var charCode = str.charCodeAt(i);
  36316. var charType = 'L';
  36317. if (charCode <= 0x00ff) {
  36318. charType = baseTypes[charCode];
  36319. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  36320. charType = 'R';
  36321. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  36322. charType = arabicTypes[charCode & 0xff];
  36323. if (!charType) {
  36324. warn('Bidi: invalid Unicode character ' + charCode.toString(16));
  36325. }
  36326. } else if (0x0700 <= charCode && charCode <= 0x08AC) {
  36327. charType = 'AL';
  36328. }
  36329. if (charType === 'R' || charType === 'AL' || charType === 'AN') {
  36330. numBidi++;
  36331. }
  36332. types[i] = charType;
  36333. }
  36334. if (numBidi === 0) {
  36335. isLTR = true;
  36336. return createBidiText(str, isLTR);
  36337. }
  36338. if (startLevel === -1) {
  36339. if (numBidi / strLength < 0.3) {
  36340. isLTR = true;
  36341. startLevel = 0;
  36342. } else {
  36343. isLTR = false;
  36344. startLevel = 1;
  36345. }
  36346. }
  36347. var levels = [];
  36348. for (i = 0; i < strLength; ++i) {
  36349. levels[i] = startLevel;
  36350. }
  36351. var e = isOdd(startLevel) ? 'R' : 'L';
  36352. var sor = e;
  36353. var eor = sor;
  36354. var lastType = sor;
  36355. for (i = 0; i < strLength; ++i) {
  36356. if (types[i] === 'NSM') {
  36357. types[i] = lastType;
  36358. } else {
  36359. lastType = types[i];
  36360. }
  36361. }
  36362. lastType = sor;
  36363. var t;
  36364. for (i = 0; i < strLength; ++i) {
  36365. t = types[i];
  36366. if (t === 'EN') {
  36367. types[i] = lastType === 'AL' ? 'AN' : 'EN';
  36368. } else if (t === 'R' || t === 'L' || t === 'AL') {
  36369. lastType = t;
  36370. }
  36371. }
  36372. for (i = 0; i < strLength; ++i) {
  36373. t = types[i];
  36374. if (t === 'AL') {
  36375. types[i] = 'R';
  36376. }
  36377. }
  36378. for (i = 1; i < strLength - 1; ++i) {
  36379. if (types[i] === 'ES' && types[i - 1] === 'EN' && types[i + 1] === 'EN') {
  36380. types[i] = 'EN';
  36381. }
  36382. if (types[i] === 'CS' && (types[i - 1] === 'EN' || types[i - 1] === 'AN') && types[i + 1] === types[i - 1]) {
  36383. types[i] = types[i - 1];
  36384. }
  36385. }
  36386. for (i = 0; i < strLength; ++i) {
  36387. if (types[i] === 'EN') {
  36388. var j;
  36389. for (j = i - 1; j >= 0; --j) {
  36390. if (types[j] !== 'ET') {
  36391. break;
  36392. }
  36393. types[j] = 'EN';
  36394. }
  36395. for (j = i + 1; j < strLength; ++j) {
  36396. if (types[j] !== 'ET') {
  36397. break;
  36398. }
  36399. types[j] = 'EN';
  36400. }
  36401. }
  36402. }
  36403. for (i = 0; i < strLength; ++i) {
  36404. t = types[i];
  36405. if (t === 'WS' || t === 'ES' || t === 'ET' || t === 'CS') {
  36406. types[i] = 'ON';
  36407. }
  36408. }
  36409. lastType = sor;
  36410. for (i = 0; i < strLength; ++i) {
  36411. t = types[i];
  36412. if (t === 'EN') {
  36413. types[i] = lastType === 'L' ? 'L' : 'EN';
  36414. } else if (t === 'R' || t === 'L') {
  36415. lastType = t;
  36416. }
  36417. }
  36418. for (i = 0; i < strLength; ++i) {
  36419. if (types[i] === 'ON') {
  36420. var end = findUnequal(types, i + 1, 'ON');
  36421. var before = sor;
  36422. if (i > 0) {
  36423. before = types[i - 1];
  36424. }
  36425. var after = eor;
  36426. if (end + 1 < strLength) {
  36427. after = types[end + 1];
  36428. }
  36429. if (before !== 'L') {
  36430. before = 'R';
  36431. }
  36432. if (after !== 'L') {
  36433. after = 'R';
  36434. }
  36435. if (before === after) {
  36436. setValues(types, i, end, before);
  36437. }
  36438. i = end - 1;
  36439. }
  36440. }
  36441. for (i = 0; i < strLength; ++i) {
  36442. if (types[i] === 'ON') {
  36443. types[i] = e;
  36444. }
  36445. }
  36446. for (i = 0; i < strLength; ++i) {
  36447. t = types[i];
  36448. if (isEven(levels[i])) {
  36449. if (t === 'R') {
  36450. levels[i] += 1;
  36451. } else if (t === 'AN' || t === 'EN') {
  36452. levels[i] += 2;
  36453. }
  36454. } else {
  36455. if (t === 'L' || t === 'AN' || t === 'EN') {
  36456. levels[i] += 1;
  36457. }
  36458. }
  36459. }
  36460. var highestLevel = -1;
  36461. var lowestOddLevel = 99;
  36462. var level;
  36463. for (i = 0, ii = levels.length; i < ii; ++i) {
  36464. level = levels[i];
  36465. if (highestLevel < level) {
  36466. highestLevel = level;
  36467. }
  36468. if (lowestOddLevel > level && isOdd(level)) {
  36469. lowestOddLevel = level;
  36470. }
  36471. }
  36472. for (level = highestLevel; level >= lowestOddLevel; --level) {
  36473. var start = -1;
  36474. for (i = 0, ii = levels.length; i < ii; ++i) {
  36475. if (levels[i] < level) {
  36476. if (start >= 0) {
  36477. reverseValues(chars, start, i);
  36478. start = -1;
  36479. }
  36480. } else if (start < 0) {
  36481. start = i;
  36482. }
  36483. }
  36484. if (start >= 0) {
  36485. reverseValues(chars, start, levels.length);
  36486. }
  36487. }
  36488. for (i = 0, ii = chars.length; i < ii; ++i) {
  36489. var ch = chars[i];
  36490. if (ch === '<' || ch === '>') {
  36491. chars[i] = '';
  36492. }
  36493. }
  36494. return createBidiText(chars.join(''), isLTR);
  36495. }
  36496. exports.bidi = bidi;
  36497. /***/ }),
  36498. /* 22 */
  36499. /***/ (function(module, exports, __w_pdfjs_require__) {
  36500. "use strict";
  36501. var ISOAdobeCharset = [
  36502. '.notdef',
  36503. 'space',
  36504. 'exclam',
  36505. 'quotedbl',
  36506. 'numbersign',
  36507. 'dollar',
  36508. 'percent',
  36509. 'ampersand',
  36510. 'quoteright',
  36511. 'parenleft',
  36512. 'parenright',
  36513. 'asterisk',
  36514. 'plus',
  36515. 'comma',
  36516. 'hyphen',
  36517. 'period',
  36518. 'slash',
  36519. 'zero',
  36520. 'one',
  36521. 'two',
  36522. 'three',
  36523. 'four',
  36524. 'five',
  36525. 'six',
  36526. 'seven',
  36527. 'eight',
  36528. 'nine',
  36529. 'colon',
  36530. 'semicolon',
  36531. 'less',
  36532. 'equal',
  36533. 'greater',
  36534. 'question',
  36535. 'at',
  36536. 'A',
  36537. 'B',
  36538. 'C',
  36539. 'D',
  36540. 'E',
  36541. 'F',
  36542. 'G',
  36543. 'H',
  36544. 'I',
  36545. 'J',
  36546. 'K',
  36547. 'L',
  36548. 'M',
  36549. 'N',
  36550. 'O',
  36551. 'P',
  36552. 'Q',
  36553. 'R',
  36554. 'S',
  36555. 'T',
  36556. 'U',
  36557. 'V',
  36558. 'W',
  36559. 'X',
  36560. 'Y',
  36561. 'Z',
  36562. 'bracketleft',
  36563. 'backslash',
  36564. 'bracketright',
  36565. 'asciicircum',
  36566. 'underscore',
  36567. 'quoteleft',
  36568. 'a',
  36569. 'b',
  36570. 'c',
  36571. 'd',
  36572. 'e',
  36573. 'f',
  36574. 'g',
  36575. 'h',
  36576. 'i',
  36577. 'j',
  36578. 'k',
  36579. 'l',
  36580. 'm',
  36581. 'n',
  36582. 'o',
  36583. 'p',
  36584. 'q',
  36585. 'r',
  36586. 's',
  36587. 't',
  36588. 'u',
  36589. 'v',
  36590. 'w',
  36591. 'x',
  36592. 'y',
  36593. 'z',
  36594. 'braceleft',
  36595. 'bar',
  36596. 'braceright',
  36597. 'asciitilde',
  36598. 'exclamdown',
  36599. 'cent',
  36600. 'sterling',
  36601. 'fraction',
  36602. 'yen',
  36603. 'florin',
  36604. 'section',
  36605. 'currency',
  36606. 'quotesingle',
  36607. 'quotedblleft',
  36608. 'guillemotleft',
  36609. 'guilsinglleft',
  36610. 'guilsinglright',
  36611. 'fi',
  36612. 'fl',
  36613. 'endash',
  36614. 'dagger',
  36615. 'daggerdbl',
  36616. 'periodcentered',
  36617. 'paragraph',
  36618. 'bullet',
  36619. 'quotesinglbase',
  36620. 'quotedblbase',
  36621. 'quotedblright',
  36622. 'guillemotright',
  36623. 'ellipsis',
  36624. 'perthousand',
  36625. 'questiondown',
  36626. 'grave',
  36627. 'acute',
  36628. 'circumflex',
  36629. 'tilde',
  36630. 'macron',
  36631. 'breve',
  36632. 'dotaccent',
  36633. 'dieresis',
  36634. 'ring',
  36635. 'cedilla',
  36636. 'hungarumlaut',
  36637. 'ogonek',
  36638. 'caron',
  36639. 'emdash',
  36640. 'AE',
  36641. 'ordfeminine',
  36642. 'Lslash',
  36643. 'Oslash',
  36644. 'OE',
  36645. 'ordmasculine',
  36646. 'ae',
  36647. 'dotlessi',
  36648. 'lslash',
  36649. 'oslash',
  36650. 'oe',
  36651. 'germandbls',
  36652. 'onesuperior',
  36653. 'logicalnot',
  36654. 'mu',
  36655. 'trademark',
  36656. 'Eth',
  36657. 'onehalf',
  36658. 'plusminus',
  36659. 'Thorn',
  36660. 'onequarter',
  36661. 'divide',
  36662. 'brokenbar',
  36663. 'degree',
  36664. 'thorn',
  36665. 'threequarters',
  36666. 'twosuperior',
  36667. 'registered',
  36668. 'minus',
  36669. 'eth',
  36670. 'multiply',
  36671. 'threesuperior',
  36672. 'copyright',
  36673. 'Aacute',
  36674. 'Acircumflex',
  36675. 'Adieresis',
  36676. 'Agrave',
  36677. 'Aring',
  36678. 'Atilde',
  36679. 'Ccedilla',
  36680. 'Eacute',
  36681. 'Ecircumflex',
  36682. 'Edieresis',
  36683. 'Egrave',
  36684. 'Iacute',
  36685. 'Icircumflex',
  36686. 'Idieresis',
  36687. 'Igrave',
  36688. 'Ntilde',
  36689. 'Oacute',
  36690. 'Ocircumflex',
  36691. 'Odieresis',
  36692. 'Ograve',
  36693. 'Otilde',
  36694. 'Scaron',
  36695. 'Uacute',
  36696. 'Ucircumflex',
  36697. 'Udieresis',
  36698. 'Ugrave',
  36699. 'Yacute',
  36700. 'Ydieresis',
  36701. 'Zcaron',
  36702. 'aacute',
  36703. 'acircumflex',
  36704. 'adieresis',
  36705. 'agrave',
  36706. 'aring',
  36707. 'atilde',
  36708. 'ccedilla',
  36709. 'eacute',
  36710. 'ecircumflex',
  36711. 'edieresis',
  36712. 'egrave',
  36713. 'iacute',
  36714. 'icircumflex',
  36715. 'idieresis',
  36716. 'igrave',
  36717. 'ntilde',
  36718. 'oacute',
  36719. 'ocircumflex',
  36720. 'odieresis',
  36721. 'ograve',
  36722. 'otilde',
  36723. 'scaron',
  36724. 'uacute',
  36725. 'ucircumflex',
  36726. 'udieresis',
  36727. 'ugrave',
  36728. 'yacute',
  36729. 'ydieresis',
  36730. 'zcaron'
  36731. ];
  36732. var ExpertCharset = [
  36733. '.notdef',
  36734. 'space',
  36735. 'exclamsmall',
  36736. 'Hungarumlautsmall',
  36737. 'dollaroldstyle',
  36738. 'dollarsuperior',
  36739. 'ampersandsmall',
  36740. 'Acutesmall',
  36741. 'parenleftsuperior',
  36742. 'parenrightsuperior',
  36743. 'twodotenleader',
  36744. 'onedotenleader',
  36745. 'comma',
  36746. 'hyphen',
  36747. 'period',
  36748. 'fraction',
  36749. 'zerooldstyle',
  36750. 'oneoldstyle',
  36751. 'twooldstyle',
  36752. 'threeoldstyle',
  36753. 'fouroldstyle',
  36754. 'fiveoldstyle',
  36755. 'sixoldstyle',
  36756. 'sevenoldstyle',
  36757. 'eightoldstyle',
  36758. 'nineoldstyle',
  36759. 'colon',
  36760. 'semicolon',
  36761. 'commasuperior',
  36762. 'threequartersemdash',
  36763. 'periodsuperior',
  36764. 'questionsmall',
  36765. 'asuperior',
  36766. 'bsuperior',
  36767. 'centsuperior',
  36768. 'dsuperior',
  36769. 'esuperior',
  36770. 'isuperior',
  36771. 'lsuperior',
  36772. 'msuperior',
  36773. 'nsuperior',
  36774. 'osuperior',
  36775. 'rsuperior',
  36776. 'ssuperior',
  36777. 'tsuperior',
  36778. 'ff',
  36779. 'fi',
  36780. 'fl',
  36781. 'ffi',
  36782. 'ffl',
  36783. 'parenleftinferior',
  36784. 'parenrightinferior',
  36785. 'Circumflexsmall',
  36786. 'hyphensuperior',
  36787. 'Gravesmall',
  36788. 'Asmall',
  36789. 'Bsmall',
  36790. 'Csmall',
  36791. 'Dsmall',
  36792. 'Esmall',
  36793. 'Fsmall',
  36794. 'Gsmall',
  36795. 'Hsmall',
  36796. 'Ismall',
  36797. 'Jsmall',
  36798. 'Ksmall',
  36799. 'Lsmall',
  36800. 'Msmall',
  36801. 'Nsmall',
  36802. 'Osmall',
  36803. 'Psmall',
  36804. 'Qsmall',
  36805. 'Rsmall',
  36806. 'Ssmall',
  36807. 'Tsmall',
  36808. 'Usmall',
  36809. 'Vsmall',
  36810. 'Wsmall',
  36811. 'Xsmall',
  36812. 'Ysmall',
  36813. 'Zsmall',
  36814. 'colonmonetary',
  36815. 'onefitted',
  36816. 'rupiah',
  36817. 'Tildesmall',
  36818. 'exclamdownsmall',
  36819. 'centoldstyle',
  36820. 'Lslashsmall',
  36821. 'Scaronsmall',
  36822. 'Zcaronsmall',
  36823. 'Dieresissmall',
  36824. 'Brevesmall',
  36825. 'Caronsmall',
  36826. 'Dotaccentsmall',
  36827. 'Macronsmall',
  36828. 'figuredash',
  36829. 'hypheninferior',
  36830. 'Ogoneksmall',
  36831. 'Ringsmall',
  36832. 'Cedillasmall',
  36833. 'onequarter',
  36834. 'onehalf',
  36835. 'threequarters',
  36836. 'questiondownsmall',
  36837. 'oneeighth',
  36838. 'threeeighths',
  36839. 'fiveeighths',
  36840. 'seveneighths',
  36841. 'onethird',
  36842. 'twothirds',
  36843. 'zerosuperior',
  36844. 'onesuperior',
  36845. 'twosuperior',
  36846. 'threesuperior',
  36847. 'foursuperior',
  36848. 'fivesuperior',
  36849. 'sixsuperior',
  36850. 'sevensuperior',
  36851. 'eightsuperior',
  36852. 'ninesuperior',
  36853. 'zeroinferior',
  36854. 'oneinferior',
  36855. 'twoinferior',
  36856. 'threeinferior',
  36857. 'fourinferior',
  36858. 'fiveinferior',
  36859. 'sixinferior',
  36860. 'seveninferior',
  36861. 'eightinferior',
  36862. 'nineinferior',
  36863. 'centinferior',
  36864. 'dollarinferior',
  36865. 'periodinferior',
  36866. 'commainferior',
  36867. 'Agravesmall',
  36868. 'Aacutesmall',
  36869. 'Acircumflexsmall',
  36870. 'Atildesmall',
  36871. 'Adieresissmall',
  36872. 'Aringsmall',
  36873. 'AEsmall',
  36874. 'Ccedillasmall',
  36875. 'Egravesmall',
  36876. 'Eacutesmall',
  36877. 'Ecircumflexsmall',
  36878. 'Edieresissmall',
  36879. 'Igravesmall',
  36880. 'Iacutesmall',
  36881. 'Icircumflexsmall',
  36882. 'Idieresissmall',
  36883. 'Ethsmall',
  36884. 'Ntildesmall',
  36885. 'Ogravesmall',
  36886. 'Oacutesmall',
  36887. 'Ocircumflexsmall',
  36888. 'Otildesmall',
  36889. 'Odieresissmall',
  36890. 'OEsmall',
  36891. 'Oslashsmall',
  36892. 'Ugravesmall',
  36893. 'Uacutesmall',
  36894. 'Ucircumflexsmall',
  36895. 'Udieresissmall',
  36896. 'Yacutesmall',
  36897. 'Thornsmall',
  36898. 'Ydieresissmall'
  36899. ];
  36900. var ExpertSubsetCharset = [
  36901. '.notdef',
  36902. 'space',
  36903. 'dollaroldstyle',
  36904. 'dollarsuperior',
  36905. 'parenleftsuperior',
  36906. 'parenrightsuperior',
  36907. 'twodotenleader',
  36908. 'onedotenleader',
  36909. 'comma',
  36910. 'hyphen',
  36911. 'period',
  36912. 'fraction',
  36913. 'zerooldstyle',
  36914. 'oneoldstyle',
  36915. 'twooldstyle',
  36916. 'threeoldstyle',
  36917. 'fouroldstyle',
  36918. 'fiveoldstyle',
  36919. 'sixoldstyle',
  36920. 'sevenoldstyle',
  36921. 'eightoldstyle',
  36922. 'nineoldstyle',
  36923. 'colon',
  36924. 'semicolon',
  36925. 'commasuperior',
  36926. 'threequartersemdash',
  36927. 'periodsuperior',
  36928. 'asuperior',
  36929. 'bsuperior',
  36930. 'centsuperior',
  36931. 'dsuperior',
  36932. 'esuperior',
  36933. 'isuperior',
  36934. 'lsuperior',
  36935. 'msuperior',
  36936. 'nsuperior',
  36937. 'osuperior',
  36938. 'rsuperior',
  36939. 'ssuperior',
  36940. 'tsuperior',
  36941. 'ff',
  36942. 'fi',
  36943. 'fl',
  36944. 'ffi',
  36945. 'ffl',
  36946. 'parenleftinferior',
  36947. 'parenrightinferior',
  36948. 'hyphensuperior',
  36949. 'colonmonetary',
  36950. 'onefitted',
  36951. 'rupiah',
  36952. 'centoldstyle',
  36953. 'figuredash',
  36954. 'hypheninferior',
  36955. 'onequarter',
  36956. 'onehalf',
  36957. 'threequarters',
  36958. 'oneeighth',
  36959. 'threeeighths',
  36960. 'fiveeighths',
  36961. 'seveneighths',
  36962. 'onethird',
  36963. 'twothirds',
  36964. 'zerosuperior',
  36965. 'onesuperior',
  36966. 'twosuperior',
  36967. 'threesuperior',
  36968. 'foursuperior',
  36969. 'fivesuperior',
  36970. 'sixsuperior',
  36971. 'sevensuperior',
  36972. 'eightsuperior',
  36973. 'ninesuperior',
  36974. 'zeroinferior',
  36975. 'oneinferior',
  36976. 'twoinferior',
  36977. 'threeinferior',
  36978. 'fourinferior',
  36979. 'fiveinferior',
  36980. 'sixinferior',
  36981. 'seveninferior',
  36982. 'eightinferior',
  36983. 'nineinferior',
  36984. 'centinferior',
  36985. 'dollarinferior',
  36986. 'periodinferior',
  36987. 'commainferior'
  36988. ];
  36989. exports.ISOAdobeCharset = ISOAdobeCharset;
  36990. exports.ExpertCharset = ExpertCharset;
  36991. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  36992. /***/ }),
  36993. /* 23 */
  36994. /***/ (function(module, exports, __w_pdfjs_require__) {
  36995. "use strict";
  36996. var sharedUtil = __w_pdfjs_require__(0);
  36997. var corePrimitives = __w_pdfjs_require__(1);
  36998. var coreStream = __w_pdfjs_require__(2);
  36999. var coreParser = __w_pdfjs_require__(5);
  37000. var Util = sharedUtil.Util;
  37001. var assert = sharedUtil.assert;
  37002. var warn = sharedUtil.warn;
  37003. var error = sharedUtil.error;
  37004. var isInt = sharedUtil.isInt;
  37005. var isString = sharedUtil.isString;
  37006. var MissingDataException = sharedUtil.MissingDataException;
  37007. var CMapCompressionType = sharedUtil.CMapCompressionType;
  37008. var isEOF = corePrimitives.isEOF;
  37009. var isName = corePrimitives.isName;
  37010. var isCmd = corePrimitives.isCmd;
  37011. var isStream = corePrimitives.isStream;
  37012. var Stream = coreStream.Stream;
  37013. var Lexer = coreParser.Lexer;
  37014. var BUILT_IN_CMAPS = [
  37015. 'Adobe-GB1-UCS2',
  37016. 'Adobe-CNS1-UCS2',
  37017. 'Adobe-Japan1-UCS2',
  37018. 'Adobe-Korea1-UCS2',
  37019. '78-EUC-H',
  37020. '78-EUC-V',
  37021. '78-H',
  37022. '78-RKSJ-H',
  37023. '78-RKSJ-V',
  37024. '78-V',
  37025. '78ms-RKSJ-H',
  37026. '78ms-RKSJ-V',
  37027. '83pv-RKSJ-H',
  37028. '90ms-RKSJ-H',
  37029. '90ms-RKSJ-V',
  37030. '90msp-RKSJ-H',
  37031. '90msp-RKSJ-V',
  37032. '90pv-RKSJ-H',
  37033. '90pv-RKSJ-V',
  37034. 'Add-H',
  37035. 'Add-RKSJ-H',
  37036. 'Add-RKSJ-V',
  37037. 'Add-V',
  37038. 'Adobe-CNS1-0',
  37039. 'Adobe-CNS1-1',
  37040. 'Adobe-CNS1-2',
  37041. 'Adobe-CNS1-3',
  37042. 'Adobe-CNS1-4',
  37043. 'Adobe-CNS1-5',
  37044. 'Adobe-CNS1-6',
  37045. 'Adobe-GB1-0',
  37046. 'Adobe-GB1-1',
  37047. 'Adobe-GB1-2',
  37048. 'Adobe-GB1-3',
  37049. 'Adobe-GB1-4',
  37050. 'Adobe-GB1-5',
  37051. 'Adobe-Japan1-0',
  37052. 'Adobe-Japan1-1',
  37053. 'Adobe-Japan1-2',
  37054. 'Adobe-Japan1-3',
  37055. 'Adobe-Japan1-4',
  37056. 'Adobe-Japan1-5',
  37057. 'Adobe-Japan1-6',
  37058. 'Adobe-Korea1-0',
  37059. 'Adobe-Korea1-1',
  37060. 'Adobe-Korea1-2',
  37061. 'B5-H',
  37062. 'B5-V',
  37063. 'B5pc-H',
  37064. 'B5pc-V',
  37065. 'CNS-EUC-H',
  37066. 'CNS-EUC-V',
  37067. 'CNS1-H',
  37068. 'CNS1-V',
  37069. 'CNS2-H',
  37070. 'CNS2-V',
  37071. 'ETHK-B5-H',
  37072. 'ETHK-B5-V',
  37073. 'ETen-B5-H',
  37074. 'ETen-B5-V',
  37075. 'ETenms-B5-H',
  37076. 'ETenms-B5-V',
  37077. 'EUC-H',
  37078. 'EUC-V',
  37079. 'Ext-H',
  37080. 'Ext-RKSJ-H',
  37081. 'Ext-RKSJ-V',
  37082. 'Ext-V',
  37083. 'GB-EUC-H',
  37084. 'GB-EUC-V',
  37085. 'GB-H',
  37086. 'GB-V',
  37087. 'GBK-EUC-H',
  37088. 'GBK-EUC-V',
  37089. 'GBK2K-H',
  37090. 'GBK2K-V',
  37091. 'GBKp-EUC-H',
  37092. 'GBKp-EUC-V',
  37093. 'GBT-EUC-H',
  37094. 'GBT-EUC-V',
  37095. 'GBT-H',
  37096. 'GBT-V',
  37097. 'GBTpc-EUC-H',
  37098. 'GBTpc-EUC-V',
  37099. 'GBpc-EUC-H',
  37100. 'GBpc-EUC-V',
  37101. 'H',
  37102. 'HKdla-B5-H',
  37103. 'HKdla-B5-V',
  37104. 'HKdlb-B5-H',
  37105. 'HKdlb-B5-V',
  37106. 'HKgccs-B5-H',
  37107. 'HKgccs-B5-V',
  37108. 'HKm314-B5-H',
  37109. 'HKm314-B5-V',
  37110. 'HKm471-B5-H',
  37111. 'HKm471-B5-V',
  37112. 'HKscs-B5-H',
  37113. 'HKscs-B5-V',
  37114. 'Hankaku',
  37115. 'Hiragana',
  37116. 'KSC-EUC-H',
  37117. 'KSC-EUC-V',
  37118. 'KSC-H',
  37119. 'KSC-Johab-H',
  37120. 'KSC-Johab-V',
  37121. 'KSC-V',
  37122. 'KSCms-UHC-H',
  37123. 'KSCms-UHC-HW-H',
  37124. 'KSCms-UHC-HW-V',
  37125. 'KSCms-UHC-V',
  37126. 'KSCpc-EUC-H',
  37127. 'KSCpc-EUC-V',
  37128. 'Katakana',
  37129. 'NWP-H',
  37130. 'NWP-V',
  37131. 'RKSJ-H',
  37132. 'RKSJ-V',
  37133. 'Roman',
  37134. 'UniCNS-UCS2-H',
  37135. 'UniCNS-UCS2-V',
  37136. 'UniCNS-UTF16-H',
  37137. 'UniCNS-UTF16-V',
  37138. 'UniCNS-UTF32-H',
  37139. 'UniCNS-UTF32-V',
  37140. 'UniCNS-UTF8-H',
  37141. 'UniCNS-UTF8-V',
  37142. 'UniGB-UCS2-H',
  37143. 'UniGB-UCS2-V',
  37144. 'UniGB-UTF16-H',
  37145. 'UniGB-UTF16-V',
  37146. 'UniGB-UTF32-H',
  37147. 'UniGB-UTF32-V',
  37148. 'UniGB-UTF8-H',
  37149. 'UniGB-UTF8-V',
  37150. 'UniJIS-UCS2-H',
  37151. 'UniJIS-UCS2-HW-H',
  37152. 'UniJIS-UCS2-HW-V',
  37153. 'UniJIS-UCS2-V',
  37154. 'UniJIS-UTF16-H',
  37155. 'UniJIS-UTF16-V',
  37156. 'UniJIS-UTF32-H',
  37157. 'UniJIS-UTF32-V',
  37158. 'UniJIS-UTF8-H',
  37159. 'UniJIS-UTF8-V',
  37160. 'UniJIS2004-UTF16-H',
  37161. 'UniJIS2004-UTF16-V',
  37162. 'UniJIS2004-UTF32-H',
  37163. 'UniJIS2004-UTF32-V',
  37164. 'UniJIS2004-UTF8-H',
  37165. 'UniJIS2004-UTF8-V',
  37166. 'UniJISPro-UCS2-HW-V',
  37167. 'UniJISPro-UCS2-V',
  37168. 'UniJISPro-UTF8-V',
  37169. 'UniJISX0213-UTF32-H',
  37170. 'UniJISX0213-UTF32-V',
  37171. 'UniJISX02132004-UTF32-H',
  37172. 'UniJISX02132004-UTF32-V',
  37173. 'UniKS-UCS2-H',
  37174. 'UniKS-UCS2-V',
  37175. 'UniKS-UTF16-H',
  37176. 'UniKS-UTF16-V',
  37177. 'UniKS-UTF32-H',
  37178. 'UniKS-UTF32-V',
  37179. 'UniKS-UTF8-H',
  37180. 'UniKS-UTF8-V',
  37181. 'V',
  37182. 'WP-Symbol'
  37183. ];
  37184. var CMap = function CMapClosure() {
  37185. function CMap(builtInCMap) {
  37186. this.codespaceRanges = [
  37187. [],
  37188. [],
  37189. [],
  37190. []
  37191. ];
  37192. this.numCodespaceRanges = 0;
  37193. this._map = [];
  37194. this.name = '';
  37195. this.vertical = false;
  37196. this.useCMap = null;
  37197. this.builtInCMap = builtInCMap;
  37198. }
  37199. CMap.prototype = {
  37200. addCodespaceRange: function (n, low, high) {
  37201. this.codespaceRanges[n - 1].push(low, high);
  37202. this.numCodespaceRanges++;
  37203. },
  37204. mapCidRange: function (low, high, dstLow) {
  37205. while (low <= high) {
  37206. this._map[low++] = dstLow++;
  37207. }
  37208. },
  37209. mapBfRange: function (low, high, dstLow) {
  37210. var lastByte = dstLow.length - 1;
  37211. while (low <= high) {
  37212. this._map[low++] = dstLow;
  37213. dstLow = dstLow.substr(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
  37214. }
  37215. },
  37216. mapBfRangeToArray: function (low, high, array) {
  37217. var i = 0, ii = array.length;
  37218. while (low <= high && i < ii) {
  37219. this._map[low] = array[i++];
  37220. ++low;
  37221. }
  37222. },
  37223. mapOne: function (src, dst) {
  37224. this._map[src] = dst;
  37225. },
  37226. lookup: function (code) {
  37227. return this._map[code];
  37228. },
  37229. contains: function (code) {
  37230. return this._map[code] !== undefined;
  37231. },
  37232. forEach: function (callback) {
  37233. var map = this._map;
  37234. var length = map.length;
  37235. var i;
  37236. if (length <= 0x10000) {
  37237. for (i = 0; i < length; i++) {
  37238. if (map[i] !== undefined) {
  37239. callback(i, map[i]);
  37240. }
  37241. }
  37242. } else {
  37243. for (i in this._map) {
  37244. callback(i, map[i]);
  37245. }
  37246. }
  37247. },
  37248. charCodeOf: function (value) {
  37249. return this._map.indexOf(value);
  37250. },
  37251. getMap: function () {
  37252. return this._map;
  37253. },
  37254. readCharCode: function (str, offset, out) {
  37255. var c = 0;
  37256. var codespaceRanges = this.codespaceRanges;
  37257. var codespaceRangesLen = this.codespaceRanges.length;
  37258. for (var n = 0; n < codespaceRangesLen; n++) {
  37259. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  37260. var codespaceRange = codespaceRanges[n];
  37261. for (var k = 0, kk = codespaceRange.length; k < kk;) {
  37262. var low = codespaceRange[k++];
  37263. var high = codespaceRange[k++];
  37264. if (c >= low && c <= high) {
  37265. out.charcode = c;
  37266. out.length = n + 1;
  37267. return;
  37268. }
  37269. }
  37270. }
  37271. out.charcode = 0;
  37272. out.length = 1;
  37273. },
  37274. get length() {
  37275. return this._map.length;
  37276. },
  37277. get isIdentityCMap() {
  37278. if (!(this.name === 'Identity-H' || this.name === 'Identity-V')) {
  37279. return false;
  37280. }
  37281. if (this._map.length !== 0x10000) {
  37282. return false;
  37283. }
  37284. for (var i = 0; i < 0x10000; i++) {
  37285. if (this._map[i] !== i) {
  37286. return false;
  37287. }
  37288. }
  37289. return true;
  37290. }
  37291. };
  37292. return CMap;
  37293. }();
  37294. var IdentityCMap = function IdentityCMapClosure() {
  37295. function IdentityCMap(vertical, n) {
  37296. CMap.call(this);
  37297. this.vertical = vertical;
  37298. this.addCodespaceRange(n, 0, 0xffff);
  37299. }
  37300. Util.inherit(IdentityCMap, CMap, {});
  37301. IdentityCMap.prototype = {
  37302. addCodespaceRange: CMap.prototype.addCodespaceRange,
  37303. mapCidRange: function (low, high, dstLow) {
  37304. error('should not call mapCidRange');
  37305. },
  37306. mapBfRange: function (low, high, dstLow) {
  37307. error('should not call mapBfRange');
  37308. },
  37309. mapBfRangeToArray: function (low, high, array) {
  37310. error('should not call mapBfRangeToArray');
  37311. },
  37312. mapOne: function (src, dst) {
  37313. error('should not call mapCidOne');
  37314. },
  37315. lookup: function (code) {
  37316. return isInt(code) && code <= 0xffff ? code : undefined;
  37317. },
  37318. contains: function (code) {
  37319. return isInt(code) && code <= 0xffff;
  37320. },
  37321. forEach: function (callback) {
  37322. for (var i = 0; i <= 0xffff; i++) {
  37323. callback(i, i);
  37324. }
  37325. },
  37326. charCodeOf: function (value) {
  37327. return isInt(value) && value <= 0xffff ? value : -1;
  37328. },
  37329. getMap: function () {
  37330. var map = new Array(0x10000);
  37331. for (var i = 0; i <= 0xffff; i++) {
  37332. map[i] = i;
  37333. }
  37334. return map;
  37335. },
  37336. readCharCode: CMap.prototype.readCharCode,
  37337. get length() {
  37338. return 0x10000;
  37339. },
  37340. get isIdentityCMap() {
  37341. error('should not access .isIdentityCMap');
  37342. }
  37343. };
  37344. return IdentityCMap;
  37345. }();
  37346. var BinaryCMapReader = function BinaryCMapReaderClosure() {
  37347. function hexToInt(a, size) {
  37348. var n = 0;
  37349. for (var i = 0; i <= size; i++) {
  37350. n = n << 8 | a[i];
  37351. }
  37352. return n >>> 0;
  37353. }
  37354. function hexToStr(a, size) {
  37355. if (size === 1) {
  37356. return String.fromCharCode(a[0], a[1]);
  37357. }
  37358. if (size === 3) {
  37359. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  37360. }
  37361. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  37362. }
  37363. function addHex(a, b, size) {
  37364. var c = 0;
  37365. for (var i = size; i >= 0; i--) {
  37366. c += a[i] + b[i];
  37367. a[i] = c & 255;
  37368. c >>= 8;
  37369. }
  37370. }
  37371. function incHex(a, size) {
  37372. var c = 1;
  37373. for (var i = size; i >= 0 && c > 0; i--) {
  37374. c += a[i];
  37375. a[i] = c & 255;
  37376. c >>= 8;
  37377. }
  37378. }
  37379. var MAX_NUM_SIZE = 16;
  37380. var MAX_ENCODED_NUM_SIZE = 19;
  37381. function BinaryCMapStream(data) {
  37382. this.buffer = data;
  37383. this.pos = 0;
  37384. this.end = data.length;
  37385. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  37386. }
  37387. BinaryCMapStream.prototype = {
  37388. readByte: function () {
  37389. if (this.pos >= this.end) {
  37390. return -1;
  37391. }
  37392. return this.buffer[this.pos++];
  37393. },
  37394. readNumber: function () {
  37395. var n = 0;
  37396. var last;
  37397. do {
  37398. var b = this.readByte();
  37399. if (b < 0) {
  37400. error('unexpected EOF in bcmap');
  37401. }
  37402. last = !(b & 0x80);
  37403. n = n << 7 | b & 0x7F;
  37404. } while (!last);
  37405. return n;
  37406. },
  37407. readSigned: function () {
  37408. var n = this.readNumber();
  37409. return n & 1 ? ~(n >>> 1) : n >>> 1;
  37410. },
  37411. readHex: function (num, size) {
  37412. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  37413. this.pos += size + 1;
  37414. },
  37415. readHexNumber: function (num, size) {
  37416. var last;
  37417. var stack = this.tmpBuf, sp = 0;
  37418. do {
  37419. var b = this.readByte();
  37420. if (b < 0) {
  37421. error('unexpected EOF in bcmap');
  37422. }
  37423. last = !(b & 0x80);
  37424. stack[sp++] = b & 0x7F;
  37425. } while (!last);
  37426. var i = size, buffer = 0, bufferSize = 0;
  37427. while (i >= 0) {
  37428. while (bufferSize < 8 && stack.length > 0) {
  37429. buffer = stack[--sp] << bufferSize | buffer;
  37430. bufferSize += 7;
  37431. }
  37432. num[i] = buffer & 255;
  37433. i--;
  37434. buffer >>= 8;
  37435. bufferSize -= 8;
  37436. }
  37437. },
  37438. readHexSigned: function (num, size) {
  37439. this.readHexNumber(num, size);
  37440. var sign = num[size] & 1 ? 255 : 0;
  37441. var c = 0;
  37442. for (var i = 0; i <= size; i++) {
  37443. c = (c & 1) << 8 | num[i];
  37444. num[i] = c >> 1 ^ sign;
  37445. }
  37446. },
  37447. readString: function () {
  37448. var len = this.readNumber();
  37449. var s = '';
  37450. for (var i = 0; i < len; i++) {
  37451. s += String.fromCharCode(this.readNumber());
  37452. }
  37453. return s;
  37454. }
  37455. };
  37456. function processBinaryCMap(data, cMap, extend) {
  37457. return new Promise(function (resolve, reject) {
  37458. var stream = new BinaryCMapStream(data);
  37459. var header = stream.readByte();
  37460. cMap.vertical = !!(header & 1);
  37461. var useCMap = null;
  37462. var start = new Uint8Array(MAX_NUM_SIZE);
  37463. var end = new Uint8Array(MAX_NUM_SIZE);
  37464. var char = new Uint8Array(MAX_NUM_SIZE);
  37465. var charCode = new Uint8Array(MAX_NUM_SIZE);
  37466. var tmp = new Uint8Array(MAX_NUM_SIZE);
  37467. var code;
  37468. var b;
  37469. while ((b = stream.readByte()) >= 0) {
  37470. var type = b >> 5;
  37471. if (type === 7) {
  37472. switch (b & 0x1F) {
  37473. case 0:
  37474. stream.readString();
  37475. break;
  37476. case 1:
  37477. useCMap = stream.readString();
  37478. break;
  37479. }
  37480. continue;
  37481. }
  37482. var sequence = !!(b & 0x10);
  37483. var dataSize = b & 15;
  37484. assert(dataSize + 1 <= MAX_NUM_SIZE);
  37485. var ucs2DataSize = 1;
  37486. var subitemsCount = stream.readNumber();
  37487. var i;
  37488. switch (type) {
  37489. case 0:
  37490. stream.readHex(start, dataSize);
  37491. stream.readHexNumber(end, dataSize);
  37492. addHex(end, start, dataSize);
  37493. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  37494. for (i = 1; i < subitemsCount; i++) {
  37495. incHex(end, dataSize);
  37496. stream.readHexNumber(start, dataSize);
  37497. addHex(start, end, dataSize);
  37498. stream.readHexNumber(end, dataSize);
  37499. addHex(end, start, dataSize);
  37500. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  37501. }
  37502. break;
  37503. case 1:
  37504. stream.readHex(start, dataSize);
  37505. stream.readHexNumber(end, dataSize);
  37506. addHex(end, start, dataSize);
  37507. code = stream.readNumber();
  37508. for (i = 1; i < subitemsCount; i++) {
  37509. incHex(end, dataSize);
  37510. stream.readHexNumber(start, dataSize);
  37511. addHex(start, end, dataSize);
  37512. stream.readHexNumber(end, dataSize);
  37513. addHex(end, start, dataSize);
  37514. code = stream.readNumber();
  37515. }
  37516. break;
  37517. case 2:
  37518. stream.readHex(char, dataSize);
  37519. code = stream.readNumber();
  37520. cMap.mapOne(hexToInt(char, dataSize), code);
  37521. for (i = 1; i < subitemsCount; i++) {
  37522. incHex(char, dataSize);
  37523. if (!sequence) {
  37524. stream.readHexNumber(tmp, dataSize);
  37525. addHex(char, tmp, dataSize);
  37526. }
  37527. code = stream.readSigned() + (code + 1);
  37528. cMap.mapOne(hexToInt(char, dataSize), code);
  37529. }
  37530. break;
  37531. case 3:
  37532. stream.readHex(start, dataSize);
  37533. stream.readHexNumber(end, dataSize);
  37534. addHex(end, start, dataSize);
  37535. code = stream.readNumber();
  37536. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  37537. for (i = 1; i < subitemsCount; i++) {
  37538. incHex(end, dataSize);
  37539. if (!sequence) {
  37540. stream.readHexNumber(start, dataSize);
  37541. addHex(start, end, dataSize);
  37542. } else {
  37543. start.set(end);
  37544. }
  37545. stream.readHexNumber(end, dataSize);
  37546. addHex(end, start, dataSize);
  37547. code = stream.readNumber();
  37548. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  37549. }
  37550. break;
  37551. case 4:
  37552. stream.readHex(char, ucs2DataSize);
  37553. stream.readHex(charCode, dataSize);
  37554. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  37555. for (i = 1; i < subitemsCount; i++) {
  37556. incHex(char, ucs2DataSize);
  37557. if (!sequence) {
  37558. stream.readHexNumber(tmp, ucs2DataSize);
  37559. addHex(char, tmp, ucs2DataSize);
  37560. }
  37561. incHex(charCode, dataSize);
  37562. stream.readHexSigned(tmp, dataSize);
  37563. addHex(charCode, tmp, dataSize);
  37564. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  37565. }
  37566. break;
  37567. case 5:
  37568. stream.readHex(start, ucs2DataSize);
  37569. stream.readHexNumber(end, ucs2DataSize);
  37570. addHex(end, start, ucs2DataSize);
  37571. stream.readHex(charCode, dataSize);
  37572. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  37573. for (i = 1; i < subitemsCount; i++) {
  37574. incHex(end, ucs2DataSize);
  37575. if (!sequence) {
  37576. stream.readHexNumber(start, ucs2DataSize);
  37577. addHex(start, end, ucs2DataSize);
  37578. } else {
  37579. start.set(end);
  37580. }
  37581. stream.readHexNumber(end, ucs2DataSize);
  37582. addHex(end, start, ucs2DataSize);
  37583. stream.readHex(charCode, dataSize);
  37584. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  37585. }
  37586. break;
  37587. default:
  37588. reject(new Error('processBinaryCMap: Unknown type: ' + type));
  37589. return;
  37590. }
  37591. }
  37592. if (useCMap) {
  37593. resolve(extend(useCMap));
  37594. return;
  37595. }
  37596. resolve(cMap);
  37597. });
  37598. }
  37599. function BinaryCMapReader() {
  37600. }
  37601. BinaryCMapReader.prototype = { process: processBinaryCMap };
  37602. return BinaryCMapReader;
  37603. }();
  37604. var CMapFactory = function CMapFactoryClosure() {
  37605. function strToInt(str) {
  37606. var a = 0;
  37607. for (var i = 0; i < str.length; i++) {
  37608. a = a << 8 | str.charCodeAt(i);
  37609. }
  37610. return a >>> 0;
  37611. }
  37612. function expectString(obj) {
  37613. if (!isString(obj)) {
  37614. error('Malformed CMap: expected string.');
  37615. }
  37616. }
  37617. function expectInt(obj) {
  37618. if (!isInt(obj)) {
  37619. error('Malformed CMap: expected int.');
  37620. }
  37621. }
  37622. function parseBfChar(cMap, lexer) {
  37623. while (true) {
  37624. var obj = lexer.getObj();
  37625. if (isEOF(obj)) {
  37626. break;
  37627. }
  37628. if (isCmd(obj, 'endbfchar')) {
  37629. return;
  37630. }
  37631. expectString(obj);
  37632. var src = strToInt(obj);
  37633. obj = lexer.getObj();
  37634. expectString(obj);
  37635. var dst = obj;
  37636. cMap.mapOne(src, dst);
  37637. }
  37638. }
  37639. function parseBfRange(cMap, lexer) {
  37640. while (true) {
  37641. var obj = lexer.getObj();
  37642. if (isEOF(obj)) {
  37643. break;
  37644. }
  37645. if (isCmd(obj, 'endbfrange')) {
  37646. return;
  37647. }
  37648. expectString(obj);
  37649. var low = strToInt(obj);
  37650. obj = lexer.getObj();
  37651. expectString(obj);
  37652. var high = strToInt(obj);
  37653. obj = lexer.getObj();
  37654. if (isInt(obj) || isString(obj)) {
  37655. var dstLow = isInt(obj) ? String.fromCharCode(obj) : obj;
  37656. cMap.mapBfRange(low, high, dstLow);
  37657. } else if (isCmd(obj, '[')) {
  37658. obj = lexer.getObj();
  37659. var array = [];
  37660. while (!isCmd(obj, ']') && !isEOF(obj)) {
  37661. array.push(obj);
  37662. obj = lexer.getObj();
  37663. }
  37664. cMap.mapBfRangeToArray(low, high, array);
  37665. } else {
  37666. break;
  37667. }
  37668. }
  37669. error('Invalid bf range.');
  37670. }
  37671. function parseCidChar(cMap, lexer) {
  37672. while (true) {
  37673. var obj = lexer.getObj();
  37674. if (isEOF(obj)) {
  37675. break;
  37676. }
  37677. if (isCmd(obj, 'endcidchar')) {
  37678. return;
  37679. }
  37680. expectString(obj);
  37681. var src = strToInt(obj);
  37682. obj = lexer.getObj();
  37683. expectInt(obj);
  37684. var dst = obj;
  37685. cMap.mapOne(src, dst);
  37686. }
  37687. }
  37688. function parseCidRange(cMap, lexer) {
  37689. while (true) {
  37690. var obj = lexer.getObj();
  37691. if (isEOF(obj)) {
  37692. break;
  37693. }
  37694. if (isCmd(obj, 'endcidrange')) {
  37695. return;
  37696. }
  37697. expectString(obj);
  37698. var low = strToInt(obj);
  37699. obj = lexer.getObj();
  37700. expectString(obj);
  37701. var high = strToInt(obj);
  37702. obj = lexer.getObj();
  37703. expectInt(obj);
  37704. var dstLow = obj;
  37705. cMap.mapCidRange(low, high, dstLow);
  37706. }
  37707. }
  37708. function parseCodespaceRange(cMap, lexer) {
  37709. while (true) {
  37710. var obj = lexer.getObj();
  37711. if (isEOF(obj)) {
  37712. break;
  37713. }
  37714. if (isCmd(obj, 'endcodespacerange')) {
  37715. return;
  37716. }
  37717. if (!isString(obj)) {
  37718. break;
  37719. }
  37720. var low = strToInt(obj);
  37721. obj = lexer.getObj();
  37722. if (!isString(obj)) {
  37723. break;
  37724. }
  37725. var high = strToInt(obj);
  37726. cMap.addCodespaceRange(obj.length, low, high);
  37727. }
  37728. error('Invalid codespace range.');
  37729. }
  37730. function parseWMode(cMap, lexer) {
  37731. var obj = lexer.getObj();
  37732. if (isInt(obj)) {
  37733. cMap.vertical = !!obj;
  37734. }
  37735. }
  37736. function parseCMapName(cMap, lexer) {
  37737. var obj = lexer.getObj();
  37738. if (isName(obj) && isString(obj.name)) {
  37739. cMap.name = obj.name;
  37740. }
  37741. }
  37742. function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  37743. var previous;
  37744. var embededUseCMap;
  37745. objLoop:
  37746. while (true) {
  37747. try {
  37748. var obj = lexer.getObj();
  37749. if (isEOF(obj)) {
  37750. break;
  37751. } else if (isName(obj)) {
  37752. if (obj.name === 'WMode') {
  37753. parseWMode(cMap, lexer);
  37754. } else if (obj.name === 'CMapName') {
  37755. parseCMapName(cMap, lexer);
  37756. }
  37757. previous = obj;
  37758. } else if (isCmd(obj)) {
  37759. switch (obj.cmd) {
  37760. case 'endcmap':
  37761. break objLoop;
  37762. case 'usecmap':
  37763. if (isName(previous)) {
  37764. embededUseCMap = previous.name;
  37765. }
  37766. break;
  37767. case 'begincodespacerange':
  37768. parseCodespaceRange(cMap, lexer);
  37769. break;
  37770. case 'beginbfchar':
  37771. parseBfChar(cMap, lexer);
  37772. break;
  37773. case 'begincidchar':
  37774. parseCidChar(cMap, lexer);
  37775. break;
  37776. case 'beginbfrange':
  37777. parseBfRange(cMap, lexer);
  37778. break;
  37779. case 'begincidrange':
  37780. parseCidRange(cMap, lexer);
  37781. break;
  37782. }
  37783. }
  37784. } catch (ex) {
  37785. if (ex instanceof MissingDataException) {
  37786. throw ex;
  37787. }
  37788. warn('Invalid cMap data: ' + ex);
  37789. continue;
  37790. }
  37791. }
  37792. if (!useCMap && embededUseCMap) {
  37793. useCMap = embededUseCMap;
  37794. }
  37795. if (useCMap) {
  37796. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  37797. }
  37798. return Promise.resolve(cMap);
  37799. }
  37800. function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  37801. return createBuiltInCMap(useCMap, fetchBuiltInCMap).then(function (newCMap) {
  37802. cMap.useCMap = newCMap;
  37803. if (cMap.numCodespaceRanges === 0) {
  37804. var useCodespaceRanges = cMap.useCMap.codespaceRanges;
  37805. for (var i = 0; i < useCodespaceRanges.length; i++) {
  37806. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  37807. }
  37808. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  37809. }
  37810. cMap.useCMap.forEach(function (key, value) {
  37811. if (!cMap.contains(key)) {
  37812. cMap.mapOne(key, cMap.useCMap.lookup(key));
  37813. }
  37814. });
  37815. return cMap;
  37816. });
  37817. }
  37818. function createBuiltInCMap(name, fetchBuiltInCMap) {
  37819. if (name === 'Identity-H') {
  37820. return Promise.resolve(new IdentityCMap(false, 2));
  37821. } else if (name === 'Identity-V') {
  37822. return Promise.resolve(new IdentityCMap(true, 2));
  37823. }
  37824. if (BUILT_IN_CMAPS.indexOf(name) === -1) {
  37825. return Promise.reject(new Error('Unknown cMap name: ' + name));
  37826. }
  37827. assert(fetchBuiltInCMap, 'Built-in CMap parameters are not provided.');
  37828. return fetchBuiltInCMap(name).then(function (data) {
  37829. var cMapData = data.cMapData, compressionType = data.compressionType;
  37830. var cMap = new CMap(true);
  37831. if (compressionType === CMapCompressionType.BINARY) {
  37832. return new BinaryCMapReader().process(cMapData, cMap, function (useCMap) {
  37833. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  37834. });
  37835. }
  37836. assert(compressionType === CMapCompressionType.NONE, 'TODO: Only BINARY/NONE CMap compression is currently supported.');
  37837. var lexer = new Lexer(new Stream(cMapData));
  37838. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  37839. });
  37840. }
  37841. return {
  37842. create: function (params) {
  37843. var encoding = params.encoding;
  37844. var fetchBuiltInCMap = params.fetchBuiltInCMap;
  37845. var useCMap = params.useCMap;
  37846. if (isName(encoding)) {
  37847. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  37848. } else if (isStream(encoding)) {
  37849. var cMap = new CMap();
  37850. var lexer = new Lexer(encoding);
  37851. return parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap).then(function (parsedCMap) {
  37852. if (parsedCMap.isIdentityCMap) {
  37853. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  37854. }
  37855. return parsedCMap;
  37856. });
  37857. }
  37858. return Promise.reject(new Error('Encoding required.'));
  37859. }
  37860. };
  37861. }();
  37862. exports.CMap = CMap;
  37863. exports.CMapFactory = CMapFactory;
  37864. exports.IdentityCMap = IdentityCMap;
  37865. /***/ }),
  37866. /* 24 */
  37867. /***/ (function(module, exports, __w_pdfjs_require__) {
  37868. "use strict";
  37869. var sharedUtil = __w_pdfjs_require__(0);
  37870. var corePrimitives = __w_pdfjs_require__(1);
  37871. var coreStream = __w_pdfjs_require__(2);
  37872. var coreObj = __w_pdfjs_require__(16);
  37873. var coreParser = __w_pdfjs_require__(5);
  37874. var coreCrypto = __w_pdfjs_require__(13);
  37875. var coreEvaluator = __w_pdfjs_require__(14);
  37876. var coreAnnotation = __w_pdfjs_require__(20);
  37877. var OPS = sharedUtil.OPS;
  37878. var MissingDataException = sharedUtil.MissingDataException;
  37879. var Util = sharedUtil.Util;
  37880. var assert = sharedUtil.assert;
  37881. var error = sharedUtil.error;
  37882. var info = sharedUtil.info;
  37883. var isArray = sharedUtil.isArray;
  37884. var isArrayBuffer = sharedUtil.isArrayBuffer;
  37885. var isNum = sharedUtil.isNum;
  37886. var isString = sharedUtil.isString;
  37887. var shadow = sharedUtil.shadow;
  37888. var stringToBytes = sharedUtil.stringToBytes;
  37889. var stringToPDFString = sharedUtil.stringToPDFString;
  37890. var warn = sharedUtil.warn;
  37891. var isSpace = sharedUtil.isSpace;
  37892. var Dict = corePrimitives.Dict;
  37893. var isDict = corePrimitives.isDict;
  37894. var isName = corePrimitives.isName;
  37895. var isStream = corePrimitives.isStream;
  37896. var NullStream = coreStream.NullStream;
  37897. var Stream = coreStream.Stream;
  37898. var StreamsSequenceStream = coreStream.StreamsSequenceStream;
  37899. var Catalog = coreObj.Catalog;
  37900. var ObjectLoader = coreObj.ObjectLoader;
  37901. var XRef = coreObj.XRef;
  37902. var Linearization = coreParser.Linearization;
  37903. var calculateMD5 = coreCrypto.calculateMD5;
  37904. var OperatorList = coreEvaluator.OperatorList;
  37905. var PartialEvaluator = coreEvaluator.PartialEvaluator;
  37906. var AnnotationFactory = coreAnnotation.AnnotationFactory;
  37907. var Page = function PageClosure() {
  37908. var DEFAULT_USER_UNIT = 1.0;
  37909. var LETTER_SIZE_MEDIABOX = [
  37910. 0,
  37911. 0,
  37912. 612,
  37913. 792
  37914. ];
  37915. function isAnnotationRenderable(annotation, intent) {
  37916. return intent === 'display' && annotation.viewable || intent === 'print' && annotation.printable;
  37917. }
  37918. function Page(pdfManager, xref, pageIndex, pageDict, ref, fontCache, builtInCMapCache) {
  37919. this.pdfManager = pdfManager;
  37920. this.pageIndex = pageIndex;
  37921. this.pageDict = pageDict;
  37922. this.xref = xref;
  37923. this.ref = ref;
  37924. this.fontCache = fontCache;
  37925. this.builtInCMapCache = builtInCMapCache;
  37926. this.evaluatorOptions = pdfManager.evaluatorOptions;
  37927. this.resourcesPromise = null;
  37928. var uniquePrefix = 'p' + this.pageIndex + '_';
  37929. var idCounters = { obj: 0 };
  37930. this.idFactory = {
  37931. createObjId: function () {
  37932. return uniquePrefix + ++idCounters.obj;
  37933. }
  37934. };
  37935. }
  37936. Page.prototype = {
  37937. getPageProp: function Page_getPageProp(key) {
  37938. return this.pageDict.get(key);
  37939. },
  37940. getInheritedPageProp: function Page_getInheritedPageProp(key, getArray) {
  37941. var dict = this.pageDict, valueArray = null, loopCount = 0;
  37942. var MAX_LOOP_COUNT = 100;
  37943. getArray = getArray || false;
  37944. while (dict) {
  37945. var value = getArray ? dict.getArray(key) : dict.get(key);
  37946. if (value !== undefined) {
  37947. if (!valueArray) {
  37948. valueArray = [];
  37949. }
  37950. valueArray.push(value);
  37951. }
  37952. if (++loopCount > MAX_LOOP_COUNT) {
  37953. warn('getInheritedPageProp: maximum loop count exceeded for ' + key);
  37954. return valueArray ? valueArray[0] : undefined;
  37955. }
  37956. dict = dict.get('Parent');
  37957. }
  37958. if (!valueArray) {
  37959. return undefined;
  37960. }
  37961. if (valueArray.length === 1 || !isDict(valueArray[0])) {
  37962. return valueArray[0];
  37963. }
  37964. return Dict.merge(this.xref, valueArray);
  37965. },
  37966. get content() {
  37967. return this.getPageProp('Contents');
  37968. },
  37969. get resources() {
  37970. return shadow(this, 'resources', this.getInheritedPageProp('Resources') || Dict.empty);
  37971. },
  37972. get mediaBox() {
  37973. var mediaBox = this.getInheritedPageProp('MediaBox', true);
  37974. if (!isArray(mediaBox) || mediaBox.length !== 4) {
  37975. return shadow(this, 'mediaBox', LETTER_SIZE_MEDIABOX);
  37976. }
  37977. return shadow(this, 'mediaBox', mediaBox);
  37978. },
  37979. get cropBox() {
  37980. var cropBox = this.getInheritedPageProp('CropBox', true);
  37981. if (!isArray(cropBox) || cropBox.length !== 4) {
  37982. return shadow(this, 'cropBox', this.mediaBox);
  37983. }
  37984. return shadow(this, 'cropBox', cropBox);
  37985. },
  37986. get userUnit() {
  37987. var obj = this.getPageProp('UserUnit');
  37988. if (!isNum(obj) || obj <= 0) {
  37989. obj = DEFAULT_USER_UNIT;
  37990. }
  37991. return shadow(this, 'userUnit', obj);
  37992. },
  37993. get view() {
  37994. var mediaBox = this.mediaBox, cropBox = this.cropBox;
  37995. if (mediaBox === cropBox) {
  37996. return shadow(this, 'view', mediaBox);
  37997. }
  37998. var intersection = Util.intersect(cropBox, mediaBox);
  37999. return shadow(this, 'view', intersection || mediaBox);
  38000. },
  38001. get rotate() {
  38002. var rotate = this.getInheritedPageProp('Rotate') || 0;
  38003. if (rotate % 90 !== 0) {
  38004. rotate = 0;
  38005. } else if (rotate >= 360) {
  38006. rotate = rotate % 360;
  38007. } else if (rotate < 0) {
  38008. rotate = (rotate % 360 + 360) % 360;
  38009. }
  38010. return shadow(this, 'rotate', rotate);
  38011. },
  38012. getContentStream: function Page_getContentStream() {
  38013. var content = this.content;
  38014. var stream;
  38015. if (isArray(content)) {
  38016. var xref = this.xref;
  38017. var i, n = content.length;
  38018. var streams = [];
  38019. for (i = 0; i < n; ++i) {
  38020. streams.push(xref.fetchIfRef(content[i]));
  38021. }
  38022. stream = new StreamsSequenceStream(streams);
  38023. } else if (isStream(content)) {
  38024. stream = content;
  38025. } else {
  38026. stream = new NullStream();
  38027. }
  38028. return stream;
  38029. },
  38030. loadResources: function Page_loadResources(keys) {
  38031. if (!this.resourcesPromise) {
  38032. this.resourcesPromise = this.pdfManager.ensure(this, 'resources');
  38033. }
  38034. return this.resourcesPromise.then(function resourceSuccess() {
  38035. var objectLoader = new ObjectLoader(this.resources.map, keys, this.xref);
  38036. return objectLoader.load();
  38037. }.bind(this));
  38038. },
  38039. getOperatorList: function Page_getOperatorList(handler, task, intent, renderInteractiveForms) {
  38040. var self = this;
  38041. var pdfManager = this.pdfManager;
  38042. var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', []);
  38043. var resourcesPromise = this.loadResources([
  38044. 'ExtGState',
  38045. 'ColorSpace',
  38046. 'Pattern',
  38047. 'Shading',
  38048. 'XObject',
  38049. 'Font'
  38050. ]);
  38051. var partialEvaluator = new PartialEvaluator(pdfManager, this.xref, handler, this.pageIndex, this.idFactory, this.fontCache, this.builtInCMapCache, this.evaluatorOptions);
  38052. var dataPromises = Promise.all([
  38053. contentStreamPromise,
  38054. resourcesPromise
  38055. ]);
  38056. var pageListPromise = dataPromises.then(function (data) {
  38057. var contentStream = data[0];
  38058. var opList = new OperatorList(intent, handler, self.pageIndex);
  38059. handler.send('StartRenderPage', {
  38060. transparency: partialEvaluator.hasBlendModes(self.resources),
  38061. pageIndex: self.pageIndex,
  38062. intent: intent
  38063. });
  38064. return partialEvaluator.getOperatorList(contentStream, task, self.resources, opList).then(function () {
  38065. return opList;
  38066. });
  38067. });
  38068. var annotationsPromise = pdfManager.ensure(this, 'annotations');
  38069. return Promise.all([
  38070. pageListPromise,
  38071. annotationsPromise
  38072. ]).then(function (datas) {
  38073. var pageOpList = datas[0];
  38074. var annotations = datas[1];
  38075. if (annotations.length === 0) {
  38076. pageOpList.flush(true);
  38077. return pageOpList;
  38078. }
  38079. var i, ii, opListPromises = [];
  38080. for (i = 0, ii = annotations.length; i < ii; i++) {
  38081. if (isAnnotationRenderable(annotations[i], intent)) {
  38082. opListPromises.push(annotations[i].getOperatorList(partialEvaluator, task, renderInteractiveForms));
  38083. }
  38084. }
  38085. return Promise.all(opListPromises).then(function (opLists) {
  38086. pageOpList.addOp(OPS.beginAnnotations, []);
  38087. for (i = 0, ii = opLists.length; i < ii; i++) {
  38088. pageOpList.addOpList(opLists[i]);
  38089. }
  38090. pageOpList.addOp(OPS.endAnnotations, []);
  38091. pageOpList.flush(true);
  38092. return pageOpList;
  38093. });
  38094. });
  38095. },
  38096. extractTextContent: function Page_extractTextContent(task, normalizeWhitespace, combineTextItems) {
  38097. var handler = {
  38098. on: function nullHandlerOn() {
  38099. },
  38100. send: function nullHandlerSend() {
  38101. }
  38102. };
  38103. var self = this;
  38104. var pdfManager = this.pdfManager;
  38105. var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', []);
  38106. var resourcesPromise = this.loadResources([
  38107. 'ExtGState',
  38108. 'XObject',
  38109. 'Font'
  38110. ]);
  38111. var dataPromises = Promise.all([
  38112. contentStreamPromise,
  38113. resourcesPromise
  38114. ]);
  38115. return dataPromises.then(function (data) {
  38116. var contentStream = data[0];
  38117. var partialEvaluator = new PartialEvaluator(pdfManager, self.xref, handler, self.pageIndex, self.idFactory, self.fontCache, self.builtInCMapCache, self.evaluatorOptions);
  38118. return partialEvaluator.getTextContent(contentStream, task, self.resources, null, normalizeWhitespace, combineTextItems);
  38119. });
  38120. },
  38121. getAnnotationsData: function Page_getAnnotationsData(intent) {
  38122. var annotations = this.annotations;
  38123. var annotationsData = [];
  38124. for (var i = 0, n = annotations.length; i < n; ++i) {
  38125. if (!intent || isAnnotationRenderable(annotations[i], intent)) {
  38126. annotationsData.push(annotations[i].data);
  38127. }
  38128. }
  38129. return annotationsData;
  38130. },
  38131. get annotations() {
  38132. var annotations = [];
  38133. var annotationRefs = this.getInheritedPageProp('Annots') || [];
  38134. var annotationFactory = new AnnotationFactory();
  38135. for (var i = 0, n = annotationRefs.length; i < n; ++i) {
  38136. var annotationRef = annotationRefs[i];
  38137. var annotation = annotationFactory.create(this.xref, annotationRef, this.pdfManager, this.idFactory);
  38138. if (annotation) {
  38139. annotations.push(annotation);
  38140. }
  38141. }
  38142. return shadow(this, 'annotations', annotations);
  38143. }
  38144. };
  38145. return Page;
  38146. }();
  38147. var PDFDocument = function PDFDocumentClosure() {
  38148. var FINGERPRINT_FIRST_BYTES = 1024;
  38149. var EMPTY_FINGERPRINT = '\x00\x00\x00\x00\x00\x00\x00' + '\x00\x00\x00\x00\x00\x00\x00\x00\x00';
  38150. function PDFDocument(pdfManager, arg) {
  38151. var stream;
  38152. if (isStream(arg)) {
  38153. stream = arg;
  38154. } else if (isArrayBuffer(arg)) {
  38155. stream = new Stream(arg);
  38156. } else {
  38157. error('PDFDocument: Unknown argument type');
  38158. }
  38159. assert(stream.length > 0, 'stream must have data');
  38160. this.pdfManager = pdfManager;
  38161. this.stream = stream;
  38162. this.xref = new XRef(stream, pdfManager);
  38163. }
  38164. function find(stream, needle, limit, backwards) {
  38165. var pos = stream.pos;
  38166. var end = stream.end;
  38167. var strBuf = [];
  38168. if (pos + limit > end) {
  38169. limit = end - pos;
  38170. }
  38171. for (var n = 0; n < limit; ++n) {
  38172. strBuf.push(String.fromCharCode(stream.getByte()));
  38173. }
  38174. var str = strBuf.join('');
  38175. stream.pos = pos;
  38176. var index = backwards ? str.lastIndexOf(needle) : str.indexOf(needle);
  38177. if (index === -1) {
  38178. return false;
  38179. }
  38180. stream.pos += index;
  38181. return true;
  38182. }
  38183. var DocumentInfoValidators = {
  38184. get entries() {
  38185. return shadow(this, 'entries', {
  38186. Title: isString,
  38187. Author: isString,
  38188. Subject: isString,
  38189. Keywords: isString,
  38190. Creator: isString,
  38191. Producer: isString,
  38192. CreationDate: isString,
  38193. ModDate: isString,
  38194. Trapped: isName
  38195. });
  38196. }
  38197. };
  38198. PDFDocument.prototype = {
  38199. parse: function PDFDocument_parse(recoveryMode) {
  38200. this.setup(recoveryMode);
  38201. var version = this.catalog.catDict.get('Version');
  38202. if (isName(version)) {
  38203. this.pdfFormatVersion = version.name;
  38204. }
  38205. try {
  38206. this.acroForm = this.catalog.catDict.get('AcroForm');
  38207. if (this.acroForm) {
  38208. this.xfa = this.acroForm.get('XFA');
  38209. var fields = this.acroForm.get('Fields');
  38210. if ((!fields || !isArray(fields) || fields.length === 0) && !this.xfa) {
  38211. this.acroForm = null;
  38212. }
  38213. }
  38214. } catch (ex) {
  38215. if (ex instanceof MissingDataException) {
  38216. throw ex;
  38217. }
  38218. info('Something wrong with AcroForm entry');
  38219. this.acroForm = null;
  38220. }
  38221. },
  38222. get linearization() {
  38223. var linearization = null;
  38224. if (this.stream.length) {
  38225. try {
  38226. linearization = Linearization.create(this.stream);
  38227. } catch (err) {
  38228. if (err instanceof MissingDataException) {
  38229. throw err;
  38230. }
  38231. info(err);
  38232. }
  38233. }
  38234. return shadow(this, 'linearization', linearization);
  38235. },
  38236. get startXRef() {
  38237. var stream = this.stream;
  38238. var startXRef = 0;
  38239. var linearization = this.linearization;
  38240. if (linearization) {
  38241. stream.reset();
  38242. if (find(stream, 'endobj', 1024)) {
  38243. startXRef = stream.pos + 6;
  38244. }
  38245. } else {
  38246. var step = 1024;
  38247. var found = false, pos = stream.end;
  38248. while (!found && pos > 0) {
  38249. pos -= step - 'startxref'.length;
  38250. if (pos < 0) {
  38251. pos = 0;
  38252. }
  38253. stream.pos = pos;
  38254. found = find(stream, 'startxref', step, true);
  38255. }
  38256. if (found) {
  38257. stream.skip(9);
  38258. var ch;
  38259. do {
  38260. ch = stream.getByte();
  38261. } while (isSpace(ch));
  38262. var str = '';
  38263. while (ch >= 0x20 && ch <= 0x39) {
  38264. str += String.fromCharCode(ch);
  38265. ch = stream.getByte();
  38266. }
  38267. startXRef = parseInt(str, 10);
  38268. if (isNaN(startXRef)) {
  38269. startXRef = 0;
  38270. }
  38271. }
  38272. }
  38273. return shadow(this, 'startXRef', startXRef);
  38274. },
  38275. get mainXRefEntriesOffset() {
  38276. var mainXRefEntriesOffset = 0;
  38277. var linearization = this.linearization;
  38278. if (linearization) {
  38279. mainXRefEntriesOffset = linearization.mainXRefEntriesOffset;
  38280. }
  38281. return shadow(this, 'mainXRefEntriesOffset', mainXRefEntriesOffset);
  38282. },
  38283. checkHeader: function PDFDocument_checkHeader() {
  38284. var stream = this.stream;
  38285. stream.reset();
  38286. if (find(stream, '%PDF-', 1024)) {
  38287. stream.moveStart();
  38288. var MAX_VERSION_LENGTH = 12;
  38289. var version = '', ch;
  38290. while ((ch = stream.getByte()) > 0x20) {
  38291. if (version.length >= MAX_VERSION_LENGTH) {
  38292. break;
  38293. }
  38294. version += String.fromCharCode(ch);
  38295. }
  38296. if (!this.pdfFormatVersion) {
  38297. this.pdfFormatVersion = version.substring(5);
  38298. }
  38299. return;
  38300. }
  38301. },
  38302. parseStartXRef: function PDFDocument_parseStartXRef() {
  38303. var startXRef = this.startXRef;
  38304. this.xref.setStartXRef(startXRef);
  38305. },
  38306. setup: function PDFDocument_setup(recoveryMode) {
  38307. this.xref.parse(recoveryMode);
  38308. var self = this;
  38309. var pageFactory = {
  38310. createPage: function (pageIndex, dict, ref, fontCache, builtInCMapCache) {
  38311. return new Page(self.pdfManager, self.xref, pageIndex, dict, ref, fontCache, builtInCMapCache);
  38312. }
  38313. };
  38314. this.catalog = new Catalog(this.pdfManager, this.xref, pageFactory);
  38315. },
  38316. get numPages() {
  38317. var linearization = this.linearization;
  38318. var num = linearization ? linearization.numPages : this.catalog.numPages;
  38319. return shadow(this, 'numPages', num);
  38320. },
  38321. get documentInfo() {
  38322. var docInfo = {
  38323. PDFFormatVersion: this.pdfFormatVersion,
  38324. IsAcroFormPresent: !!this.acroForm,
  38325. IsXFAPresent: !!this.xfa
  38326. };
  38327. var infoDict;
  38328. try {
  38329. infoDict = this.xref.trailer.get('Info');
  38330. } catch (err) {
  38331. if (err instanceof MissingDataException) {
  38332. throw err;
  38333. }
  38334. info('The document information dictionary is invalid.');
  38335. }
  38336. if (infoDict) {
  38337. var validEntries = DocumentInfoValidators.entries;
  38338. for (var key in validEntries) {
  38339. if (infoDict.has(key)) {
  38340. var value = infoDict.get(key);
  38341. if (validEntries[key](value)) {
  38342. docInfo[key] = typeof value !== 'string' ? value : stringToPDFString(value);
  38343. } else {
  38344. info('Bad value in document info for "' + key + '"');
  38345. }
  38346. }
  38347. }
  38348. }
  38349. return shadow(this, 'documentInfo', docInfo);
  38350. },
  38351. get fingerprint() {
  38352. var xref = this.xref, hash, fileID = '';
  38353. var idArray = xref.trailer.get('ID');
  38354. if (idArray && isArray(idArray) && idArray[0] && isString(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) {
  38355. hash = stringToBytes(idArray[0]);
  38356. } else {
  38357. if (this.stream.ensureRange) {
  38358. this.stream.ensureRange(0, Math.min(FINGERPRINT_FIRST_BYTES, this.stream.end));
  38359. }
  38360. hash = calculateMD5(this.stream.bytes.subarray(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  38361. }
  38362. for (var i = 0, n = hash.length; i < n; i++) {
  38363. var hex = hash[i].toString(16);
  38364. fileID += hex.length === 1 ? '0' + hex : hex;
  38365. }
  38366. return shadow(this, 'fingerprint', fileID);
  38367. },
  38368. getPage: function PDFDocument_getPage(pageIndex) {
  38369. return this.catalog.getPage(pageIndex);
  38370. },
  38371. cleanup: function PDFDocument_cleanup() {
  38372. return this.catalog.cleanup();
  38373. }
  38374. };
  38375. return PDFDocument;
  38376. }();
  38377. exports.Page = Page;
  38378. exports.PDFDocument = PDFDocument;
  38379. /***/ }),
  38380. /* 25 */
  38381. /***/ (function(module, exports, __w_pdfjs_require__) {
  38382. "use strict";
  38383. var sharedUtil = __w_pdfjs_require__(0);
  38384. var coreStream = __w_pdfjs_require__(2);
  38385. var coreGlyphList = __w_pdfjs_require__(7);
  38386. var coreEncodings = __w_pdfjs_require__(4);
  38387. var coreCFFParser = __w_pdfjs_require__(11);
  38388. var Util = sharedUtil.Util;
  38389. var bytesToString = sharedUtil.bytesToString;
  38390. var error = sharedUtil.error;
  38391. var Stream = coreStream.Stream;
  38392. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  38393. var StandardEncoding = coreEncodings.StandardEncoding;
  38394. var CFFParser = coreCFFParser.CFFParser;
  38395. var FontRendererFactory = function FontRendererFactoryClosure() {
  38396. function getLong(data, offset) {
  38397. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  38398. }
  38399. function getUshort(data, offset) {
  38400. return data[offset] << 8 | data[offset + 1];
  38401. }
  38402. function parseCmap(data, start, end) {
  38403. var offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16);
  38404. var format = getUshort(data, start + offset);
  38405. var ranges, p, i;
  38406. if (format === 4) {
  38407. getUshort(data, start + offset + 2);
  38408. var segCount = getUshort(data, start + offset + 6) >> 1;
  38409. p = start + offset + 14;
  38410. ranges = [];
  38411. for (i = 0; i < segCount; i++, p += 2) {
  38412. ranges[i] = { end: getUshort(data, p) };
  38413. }
  38414. p += 2;
  38415. for (i = 0; i < segCount; i++, p += 2) {
  38416. ranges[i].start = getUshort(data, p);
  38417. }
  38418. for (i = 0; i < segCount; i++, p += 2) {
  38419. ranges[i].idDelta = getUshort(data, p);
  38420. }
  38421. for (i = 0; i < segCount; i++, p += 2) {
  38422. var idOffset = getUshort(data, p);
  38423. if (idOffset === 0) {
  38424. continue;
  38425. }
  38426. ranges[i].ids = [];
  38427. for (var j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  38428. ranges[i].ids[j] = getUshort(data, p + idOffset);
  38429. idOffset += 2;
  38430. }
  38431. }
  38432. return ranges;
  38433. } else if (format === 12) {
  38434. getLong(data, start + offset + 4);
  38435. var groups = getLong(data, start + offset + 12);
  38436. p = start + offset + 16;
  38437. ranges = [];
  38438. for (i = 0; i < groups; i++) {
  38439. ranges.push({
  38440. start: getLong(data, p),
  38441. end: getLong(data, p + 4),
  38442. idDelta: getLong(data, p + 8) - getLong(data, p)
  38443. });
  38444. p += 12;
  38445. }
  38446. return ranges;
  38447. }
  38448. error('not supported cmap: ' + format);
  38449. }
  38450. function parseCff(data, start, end, seacAnalysisEnabled) {
  38451. var properties = {};
  38452. var parser = new CFFParser(new Stream(data, start, end - start), properties, seacAnalysisEnabled);
  38453. var cff = parser.parse();
  38454. return {
  38455. glyphs: cff.charStrings.objects,
  38456. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  38457. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects
  38458. };
  38459. }
  38460. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  38461. var itemSize, itemDecode;
  38462. if (isGlyphLocationsLong) {
  38463. itemSize = 4;
  38464. itemDecode = function fontItemDecodeLong(data, offset) {
  38465. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  38466. };
  38467. } else {
  38468. itemSize = 2;
  38469. itemDecode = function fontItemDecode(data, offset) {
  38470. return data[offset] << 9 | data[offset + 1] << 1;
  38471. };
  38472. }
  38473. var glyphs = [];
  38474. var startOffset = itemDecode(loca, 0);
  38475. for (var j = itemSize; j < loca.length; j += itemSize) {
  38476. var endOffset = itemDecode(loca, j);
  38477. glyphs.push(glyf.subarray(startOffset, endOffset));
  38478. startOffset = endOffset;
  38479. }
  38480. return glyphs;
  38481. }
  38482. function lookupCmap(ranges, unicode) {
  38483. var code = unicode.charCodeAt(0), gid = 0;
  38484. var l = 0, r = ranges.length - 1;
  38485. while (l < r) {
  38486. var c = l + r + 1 >> 1;
  38487. if (code < ranges[c].start) {
  38488. r = c - 1;
  38489. } else {
  38490. l = c;
  38491. }
  38492. }
  38493. if (ranges[l].start <= code && code <= ranges[l].end) {
  38494. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xFFFF;
  38495. }
  38496. return {
  38497. charCode: code,
  38498. glyphId: gid
  38499. };
  38500. }
  38501. function compileGlyf(code, cmds, font) {
  38502. function moveTo(x, y) {
  38503. cmds.push({
  38504. cmd: 'moveTo',
  38505. args: [
  38506. x,
  38507. y
  38508. ]
  38509. });
  38510. }
  38511. function lineTo(x, y) {
  38512. cmds.push({
  38513. cmd: 'lineTo',
  38514. args: [
  38515. x,
  38516. y
  38517. ]
  38518. });
  38519. }
  38520. function quadraticCurveTo(xa, ya, x, y) {
  38521. cmds.push({
  38522. cmd: 'quadraticCurveTo',
  38523. args: [
  38524. xa,
  38525. ya,
  38526. x,
  38527. y
  38528. ]
  38529. });
  38530. }
  38531. var i = 0;
  38532. var numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16;
  38533. var flags;
  38534. var x = 0, y = 0;
  38535. i += 10;
  38536. if (numberOfContours < 0) {
  38537. do {
  38538. flags = code[i] << 8 | code[i + 1];
  38539. var glyphIndex = code[i + 2] << 8 | code[i + 3];
  38540. i += 4;
  38541. var arg1, arg2;
  38542. if (flags & 0x01) {
  38543. arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16;
  38544. arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16;
  38545. i += 4;
  38546. } else {
  38547. arg1 = code[i++];
  38548. arg2 = code[i++];
  38549. }
  38550. if (flags & 0x02) {
  38551. x = arg1;
  38552. y = arg2;
  38553. } else {
  38554. x = 0;
  38555. y = 0;
  38556. }
  38557. var scaleX = 1, scaleY = 1, scale01 = 0, scale10 = 0;
  38558. if (flags & 0x08) {
  38559. scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  38560. i += 2;
  38561. } else if (flags & 0x40) {
  38562. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  38563. scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  38564. i += 4;
  38565. } else if (flags & 0x80) {
  38566. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  38567. scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  38568. scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824;
  38569. scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824;
  38570. i += 8;
  38571. }
  38572. var subglyph = font.glyphs[glyphIndex];
  38573. if (subglyph) {
  38574. cmds.push({ cmd: 'save' });
  38575. cmds.push({
  38576. cmd: 'transform',
  38577. args: [
  38578. scaleX,
  38579. scale01,
  38580. scale10,
  38581. scaleY,
  38582. x,
  38583. y
  38584. ]
  38585. });
  38586. compileGlyf(subglyph, cmds, font);
  38587. cmds.push({ cmd: 'restore' });
  38588. }
  38589. } while (flags & 0x20);
  38590. } else {
  38591. var endPtsOfContours = [];
  38592. var j, jj;
  38593. for (j = 0; j < numberOfContours; j++) {
  38594. endPtsOfContours.push(code[i] << 8 | code[i + 1]);
  38595. i += 2;
  38596. }
  38597. var instructionLength = code[i] << 8 | code[i + 1];
  38598. i += 2 + instructionLength;
  38599. var numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
  38600. var points = [];
  38601. while (points.length < numberOfPoints) {
  38602. flags = code[i++];
  38603. var repeat = 1;
  38604. if (flags & 0x08) {
  38605. repeat += code[i++];
  38606. }
  38607. while (repeat-- > 0) {
  38608. points.push({ flags: flags });
  38609. }
  38610. }
  38611. for (j = 0; j < numberOfPoints; j++) {
  38612. switch (points[j].flags & 0x12) {
  38613. case 0x00:
  38614. x += (code[i] << 24 | code[i + 1] << 16) >> 16;
  38615. i += 2;
  38616. break;
  38617. case 0x02:
  38618. x -= code[i++];
  38619. break;
  38620. case 0x12:
  38621. x += code[i++];
  38622. break;
  38623. }
  38624. points[j].x = x;
  38625. }
  38626. for (j = 0; j < numberOfPoints; j++) {
  38627. switch (points[j].flags & 0x24) {
  38628. case 0x00:
  38629. y += (code[i] << 24 | code[i + 1] << 16) >> 16;
  38630. i += 2;
  38631. break;
  38632. case 0x04:
  38633. y -= code[i++];
  38634. break;
  38635. case 0x24:
  38636. y += code[i++];
  38637. break;
  38638. }
  38639. points[j].y = y;
  38640. }
  38641. var startPoint = 0;
  38642. for (i = 0; i < numberOfContours; i++) {
  38643. var endPoint = endPtsOfContours[i];
  38644. var contour = points.slice(startPoint, endPoint + 1);
  38645. if (contour[0].flags & 1) {
  38646. contour.push(contour[0]);
  38647. } else if (contour[contour.length - 1].flags & 1) {
  38648. contour.unshift(contour[contour.length - 1]);
  38649. } else {
  38650. var p = {
  38651. flags: 1,
  38652. x: (contour[0].x + contour[contour.length - 1].x) / 2,
  38653. y: (contour[0].y + contour[contour.length - 1].y) / 2
  38654. };
  38655. contour.unshift(p);
  38656. contour.push(p);
  38657. }
  38658. moveTo(contour[0].x, contour[0].y);
  38659. for (j = 1, jj = contour.length; j < jj; j++) {
  38660. if (contour[j].flags & 1) {
  38661. lineTo(contour[j].x, contour[j].y);
  38662. } else if (contour[j + 1].flags & 1) {
  38663. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  38664. j++;
  38665. } else {
  38666. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  38667. }
  38668. }
  38669. startPoint = endPoint + 1;
  38670. }
  38671. }
  38672. }
  38673. function compileCharString(code, cmds, font) {
  38674. var stack = [];
  38675. var x = 0, y = 0;
  38676. var stems = 0;
  38677. function moveTo(x, y) {
  38678. cmds.push({
  38679. cmd: 'moveTo',
  38680. args: [
  38681. x,
  38682. y
  38683. ]
  38684. });
  38685. }
  38686. function lineTo(x, y) {
  38687. cmds.push({
  38688. cmd: 'lineTo',
  38689. args: [
  38690. x,
  38691. y
  38692. ]
  38693. });
  38694. }
  38695. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  38696. cmds.push({
  38697. cmd: 'bezierCurveTo',
  38698. args: [
  38699. x1,
  38700. y1,
  38701. x2,
  38702. y2,
  38703. x,
  38704. y
  38705. ]
  38706. });
  38707. }
  38708. function parse(code) {
  38709. var i = 0;
  38710. while (i < code.length) {
  38711. var stackClean = false;
  38712. var v = code[i++];
  38713. var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  38714. switch (v) {
  38715. case 1:
  38716. stems += stack.length >> 1;
  38717. stackClean = true;
  38718. break;
  38719. case 3:
  38720. stems += stack.length >> 1;
  38721. stackClean = true;
  38722. break;
  38723. case 4:
  38724. y += stack.pop();
  38725. moveTo(x, y);
  38726. stackClean = true;
  38727. break;
  38728. case 5:
  38729. while (stack.length > 0) {
  38730. x += stack.shift();
  38731. y += stack.shift();
  38732. lineTo(x, y);
  38733. }
  38734. break;
  38735. case 6:
  38736. while (stack.length > 0) {
  38737. x += stack.shift();
  38738. lineTo(x, y);
  38739. if (stack.length === 0) {
  38740. break;
  38741. }
  38742. y += stack.shift();
  38743. lineTo(x, y);
  38744. }
  38745. break;
  38746. case 7:
  38747. while (stack.length > 0) {
  38748. y += stack.shift();
  38749. lineTo(x, y);
  38750. if (stack.length === 0) {
  38751. break;
  38752. }
  38753. x += stack.shift();
  38754. lineTo(x, y);
  38755. }
  38756. break;
  38757. case 8:
  38758. while (stack.length > 0) {
  38759. xa = x + stack.shift();
  38760. ya = y + stack.shift();
  38761. xb = xa + stack.shift();
  38762. yb = ya + stack.shift();
  38763. x = xb + stack.shift();
  38764. y = yb + stack.shift();
  38765. bezierCurveTo(xa, ya, xb, yb, x, y);
  38766. }
  38767. break;
  38768. case 10:
  38769. n = stack.pop() + font.subrsBias;
  38770. subrCode = font.subrs[n];
  38771. if (subrCode) {
  38772. parse(subrCode);
  38773. }
  38774. break;
  38775. case 11:
  38776. return;
  38777. case 12:
  38778. v = code[i++];
  38779. switch (v) {
  38780. case 34:
  38781. xa = x + stack.shift();
  38782. xb = xa + stack.shift();
  38783. y1 = y + stack.shift();
  38784. x = xb + stack.shift();
  38785. bezierCurveTo(xa, y, xb, y1, x, y1);
  38786. xa = x + stack.shift();
  38787. xb = xa + stack.shift();
  38788. x = xb + stack.shift();
  38789. bezierCurveTo(xa, y1, xb, y, x, y);
  38790. break;
  38791. case 35:
  38792. xa = x + stack.shift();
  38793. ya = y + stack.shift();
  38794. xb = xa + stack.shift();
  38795. yb = ya + stack.shift();
  38796. x = xb + stack.shift();
  38797. y = yb + stack.shift();
  38798. bezierCurveTo(xa, ya, xb, yb, x, y);
  38799. xa = x + stack.shift();
  38800. ya = y + stack.shift();
  38801. xb = xa + stack.shift();
  38802. yb = ya + stack.shift();
  38803. x = xb + stack.shift();
  38804. y = yb + stack.shift();
  38805. bezierCurveTo(xa, ya, xb, yb, x, y);
  38806. stack.pop();
  38807. break;
  38808. case 36:
  38809. xa = x + stack.shift();
  38810. y1 = y + stack.shift();
  38811. xb = xa + stack.shift();
  38812. y2 = y1 + stack.shift();
  38813. x = xb + stack.shift();
  38814. bezierCurveTo(xa, y1, xb, y2, x, y2);
  38815. xa = x + stack.shift();
  38816. xb = xa + stack.shift();
  38817. y3 = y2 + stack.shift();
  38818. x = xb + stack.shift();
  38819. bezierCurveTo(xa, y2, xb, y3, x, y);
  38820. break;
  38821. case 37:
  38822. var x0 = x, y0 = y;
  38823. xa = x + stack.shift();
  38824. ya = y + stack.shift();
  38825. xb = xa + stack.shift();
  38826. yb = ya + stack.shift();
  38827. x = xb + stack.shift();
  38828. y = yb + stack.shift();
  38829. bezierCurveTo(xa, ya, xb, yb, x, y);
  38830. xa = x + stack.shift();
  38831. ya = y + stack.shift();
  38832. xb = xa + stack.shift();
  38833. yb = ya + stack.shift();
  38834. x = xb;
  38835. y = yb;
  38836. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  38837. x += stack.shift();
  38838. } else {
  38839. y += stack.shift();
  38840. }
  38841. bezierCurveTo(xa, ya, xb, yb, x, y);
  38842. break;
  38843. default:
  38844. error('unknown operator: 12 ' + v);
  38845. }
  38846. break;
  38847. case 14:
  38848. if (stack.length >= 4) {
  38849. var achar = stack.pop();
  38850. var bchar = stack.pop();
  38851. y = stack.pop();
  38852. x = stack.pop();
  38853. cmds.push({ cmd: 'save' });
  38854. cmds.push({
  38855. cmd: 'translate',
  38856. args: [
  38857. x,
  38858. y
  38859. ]
  38860. });
  38861. var cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[achar]]));
  38862. compileCharString(font.glyphs[cmap.glyphId], cmds, font);
  38863. cmds.push({ cmd: 'restore' });
  38864. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[bchar]]));
  38865. compileCharString(font.glyphs[cmap.glyphId], cmds, font);
  38866. }
  38867. return;
  38868. case 18:
  38869. stems += stack.length >> 1;
  38870. stackClean = true;
  38871. break;
  38872. case 19:
  38873. stems += stack.length >> 1;
  38874. i += stems + 7 >> 3;
  38875. stackClean = true;
  38876. break;
  38877. case 20:
  38878. stems += stack.length >> 1;
  38879. i += stems + 7 >> 3;
  38880. stackClean = true;
  38881. break;
  38882. case 21:
  38883. y += stack.pop();
  38884. x += stack.pop();
  38885. moveTo(x, y);
  38886. stackClean = true;
  38887. break;
  38888. case 22:
  38889. x += stack.pop();
  38890. moveTo(x, y);
  38891. stackClean = true;
  38892. break;
  38893. case 23:
  38894. stems += stack.length >> 1;
  38895. stackClean = true;
  38896. break;
  38897. case 24:
  38898. while (stack.length > 2) {
  38899. xa = x + stack.shift();
  38900. ya = y + stack.shift();
  38901. xb = xa + stack.shift();
  38902. yb = ya + stack.shift();
  38903. x = xb + stack.shift();
  38904. y = yb + stack.shift();
  38905. bezierCurveTo(xa, ya, xb, yb, x, y);
  38906. }
  38907. x += stack.shift();
  38908. y += stack.shift();
  38909. lineTo(x, y);
  38910. break;
  38911. case 25:
  38912. while (stack.length > 6) {
  38913. x += stack.shift();
  38914. y += stack.shift();
  38915. lineTo(x, y);
  38916. }
  38917. xa = x + stack.shift();
  38918. ya = y + stack.shift();
  38919. xb = xa + stack.shift();
  38920. yb = ya + stack.shift();
  38921. x = xb + stack.shift();
  38922. y = yb + stack.shift();
  38923. bezierCurveTo(xa, ya, xb, yb, x, y);
  38924. break;
  38925. case 26:
  38926. if (stack.length % 2) {
  38927. x += stack.shift();
  38928. }
  38929. while (stack.length > 0) {
  38930. xa = x;
  38931. ya = y + stack.shift();
  38932. xb = xa + stack.shift();
  38933. yb = ya + stack.shift();
  38934. x = xb;
  38935. y = yb + stack.shift();
  38936. bezierCurveTo(xa, ya, xb, yb, x, y);
  38937. }
  38938. break;
  38939. case 27:
  38940. if (stack.length % 2) {
  38941. y += stack.shift();
  38942. }
  38943. while (stack.length > 0) {
  38944. xa = x + stack.shift();
  38945. ya = y;
  38946. xb = xa + stack.shift();
  38947. yb = ya + stack.shift();
  38948. x = xb + stack.shift();
  38949. y = yb;
  38950. bezierCurveTo(xa, ya, xb, yb, x, y);
  38951. }
  38952. break;
  38953. case 28:
  38954. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  38955. i += 2;
  38956. break;
  38957. case 29:
  38958. n = stack.pop() + font.gsubrsBias;
  38959. subrCode = font.gsubrs[n];
  38960. if (subrCode) {
  38961. parse(subrCode);
  38962. }
  38963. break;
  38964. case 30:
  38965. while (stack.length > 0) {
  38966. xa = x;
  38967. ya = y + stack.shift();
  38968. xb = xa + stack.shift();
  38969. yb = ya + stack.shift();
  38970. x = xb + stack.shift();
  38971. y = yb + (stack.length === 1 ? stack.shift() : 0);
  38972. bezierCurveTo(xa, ya, xb, yb, x, y);
  38973. if (stack.length === 0) {
  38974. break;
  38975. }
  38976. xa = x + stack.shift();
  38977. ya = y;
  38978. xb = xa + stack.shift();
  38979. yb = ya + stack.shift();
  38980. y = yb + stack.shift();
  38981. x = xb + (stack.length === 1 ? stack.shift() : 0);
  38982. bezierCurveTo(xa, ya, xb, yb, x, y);
  38983. }
  38984. break;
  38985. case 31:
  38986. while (stack.length > 0) {
  38987. xa = x + stack.shift();
  38988. ya = y;
  38989. xb = xa + stack.shift();
  38990. yb = ya + stack.shift();
  38991. y = yb + stack.shift();
  38992. x = xb + (stack.length === 1 ? stack.shift() : 0);
  38993. bezierCurveTo(xa, ya, xb, yb, x, y);
  38994. if (stack.length === 0) {
  38995. break;
  38996. }
  38997. xa = x;
  38998. ya = y + stack.shift();
  38999. xb = xa + stack.shift();
  39000. yb = ya + stack.shift();
  39001. x = xb + stack.shift();
  39002. y = yb + (stack.length === 1 ? stack.shift() : 0);
  39003. bezierCurveTo(xa, ya, xb, yb, x, y);
  39004. }
  39005. break;
  39006. default:
  39007. if (v < 32) {
  39008. error('unknown operator: ' + v);
  39009. }
  39010. if (v < 247) {
  39011. stack.push(v - 139);
  39012. } else if (v < 251) {
  39013. stack.push((v - 247) * 256 + code[i++] + 108);
  39014. } else if (v < 255) {
  39015. stack.push(-(v - 251) * 256 - code[i++] - 108);
  39016. } else {
  39017. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  39018. i += 4;
  39019. }
  39020. break;
  39021. }
  39022. if (stackClean) {
  39023. stack.length = 0;
  39024. }
  39025. }
  39026. }
  39027. parse(code);
  39028. }
  39029. var noop = '';
  39030. function CompiledFont(fontMatrix) {
  39031. this.compiledGlyphs = Object.create(null);
  39032. this.compiledCharCodeToGlyphId = Object.create(null);
  39033. this.fontMatrix = fontMatrix;
  39034. }
  39035. CompiledFont.prototype = {
  39036. getPathJs: function (unicode) {
  39037. var cmap = lookupCmap(this.cmap, unicode);
  39038. var fn = this.compiledGlyphs[cmap.glyphId];
  39039. if (!fn) {
  39040. fn = this.compileGlyph(this.glyphs[cmap.glyphId]);
  39041. this.compiledGlyphs[cmap.glyphId] = fn;
  39042. }
  39043. if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
  39044. this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId;
  39045. }
  39046. return fn;
  39047. },
  39048. compileGlyph: function (code) {
  39049. if (!code || code.length === 0 || code[0] === 14) {
  39050. return noop;
  39051. }
  39052. var cmds = [];
  39053. cmds.push({ cmd: 'save' });
  39054. cmds.push({
  39055. cmd: 'transform',
  39056. args: this.fontMatrix.slice()
  39057. });
  39058. cmds.push({
  39059. cmd: 'scale',
  39060. args: [
  39061. 'size',
  39062. '-size'
  39063. ]
  39064. });
  39065. this.compileGlyphImpl(code, cmds);
  39066. cmds.push({ cmd: 'restore' });
  39067. return cmds;
  39068. },
  39069. compileGlyphImpl: function () {
  39070. error('Children classes should implement this.');
  39071. },
  39072. hasBuiltPath: function (unicode) {
  39073. var cmap = lookupCmap(this.cmap, unicode);
  39074. return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCode] !== undefined;
  39075. }
  39076. };
  39077. function TrueTypeCompiled(glyphs, cmap, fontMatrix) {
  39078. fontMatrix = fontMatrix || [
  39079. 0.000488,
  39080. 0,
  39081. 0,
  39082. 0.000488,
  39083. 0,
  39084. 0
  39085. ];
  39086. CompiledFont.call(this, fontMatrix);
  39087. this.glyphs = glyphs;
  39088. this.cmap = cmap;
  39089. }
  39090. Util.inherit(TrueTypeCompiled, CompiledFont, {
  39091. compileGlyphImpl: function (code, cmds) {
  39092. compileGlyf(code, cmds, this);
  39093. }
  39094. });
  39095. function Type2Compiled(cffInfo, cmap, fontMatrix, glyphNameMap) {
  39096. fontMatrix = fontMatrix || [
  39097. 0.001,
  39098. 0,
  39099. 0,
  39100. 0.001,
  39101. 0,
  39102. 0
  39103. ];
  39104. CompiledFont.call(this, fontMatrix);
  39105. this.glyphs = cffInfo.glyphs;
  39106. this.gsubrs = cffInfo.gsubrs || [];
  39107. this.subrs = cffInfo.subrs || [];
  39108. this.cmap = cmap;
  39109. this.glyphNameMap = glyphNameMap || getGlyphsUnicode();
  39110. this.gsubrsBias = this.gsubrs.length < 1240 ? 107 : this.gsubrs.length < 33900 ? 1131 : 32768;
  39111. this.subrsBias = this.subrs.length < 1240 ? 107 : this.subrs.length < 33900 ? 1131 : 32768;
  39112. }
  39113. Util.inherit(Type2Compiled, CompiledFont, {
  39114. compileGlyphImpl: function (code, cmds) {
  39115. compileCharString(code, cmds, this);
  39116. }
  39117. });
  39118. return {
  39119. create: function FontRendererFactory_create(font, seacAnalysisEnabled) {
  39120. var data = new Uint8Array(font.data);
  39121. var cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  39122. var numTables = getUshort(data, 4);
  39123. for (var i = 0, p = 12; i < numTables; i++, p += 16) {
  39124. var tag = bytesToString(data.subarray(p, p + 4));
  39125. var offset = getLong(data, p + 8);
  39126. var length = getLong(data, p + 12);
  39127. switch (tag) {
  39128. case 'cmap':
  39129. cmap = parseCmap(data, offset, offset + length);
  39130. break;
  39131. case 'glyf':
  39132. glyf = data.subarray(offset, offset + length);
  39133. break;
  39134. case 'loca':
  39135. loca = data.subarray(offset, offset + length);
  39136. break;
  39137. case 'head':
  39138. unitsPerEm = getUshort(data, offset + 18);
  39139. indexToLocFormat = getUshort(data, offset + 50);
  39140. break;
  39141. case 'CFF ':
  39142. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  39143. break;
  39144. }
  39145. }
  39146. if (glyf) {
  39147. var fontMatrix = !unitsPerEm ? font.fontMatrix : [
  39148. 1 / unitsPerEm,
  39149. 0,
  39150. 0,
  39151. 1 / unitsPerEm,
  39152. 0,
  39153. 0
  39154. ];
  39155. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  39156. }
  39157. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  39158. }
  39159. };
  39160. }();
  39161. exports.FontRendererFactory = FontRendererFactory;
  39162. /***/ }),
  39163. /* 26 */
  39164. /***/ (function(module, exports, __w_pdfjs_require__) {
  39165. "use strict";
  39166. var sharedUtil = __w_pdfjs_require__(0);
  39167. var corePrimitives = __w_pdfjs_require__(1);
  39168. var coreStream = __w_pdfjs_require__(2);
  39169. var coreGlyphList = __w_pdfjs_require__(7);
  39170. var coreFontRenderer = __w_pdfjs_require__(25);
  39171. var coreEncodings = __w_pdfjs_require__(4);
  39172. var coreStandardFonts = __w_pdfjs_require__(17);
  39173. var coreUnicode = __w_pdfjs_require__(18);
  39174. var coreType1Parser = __w_pdfjs_require__(35);
  39175. var coreCFFParser = __w_pdfjs_require__(11);
  39176. var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
  39177. var FontType = sharedUtil.FontType;
  39178. var assert = sharedUtil.assert;
  39179. var bytesToString = sharedUtil.bytesToString;
  39180. var error = sharedUtil.error;
  39181. var info = sharedUtil.info;
  39182. var isArray = sharedUtil.isArray;
  39183. var isInt = sharedUtil.isInt;
  39184. var isNum = sharedUtil.isNum;
  39185. var readUint32 = sharedUtil.readUint32;
  39186. var shadow = sharedUtil.shadow;
  39187. var string32 = sharedUtil.string32;
  39188. var warn = sharedUtil.warn;
  39189. var MissingDataException = sharedUtil.MissingDataException;
  39190. var isSpace = sharedUtil.isSpace;
  39191. var Stream = coreStream.Stream;
  39192. var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
  39193. var getDingbatsGlyphsUnicode = coreGlyphList.getDingbatsGlyphsUnicode;
  39194. var FontRendererFactory = coreFontRenderer.FontRendererFactory;
  39195. var StandardEncoding = coreEncodings.StandardEncoding;
  39196. var MacRomanEncoding = coreEncodings.MacRomanEncoding;
  39197. var SymbolSetEncoding = coreEncodings.SymbolSetEncoding;
  39198. var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding;
  39199. var getEncoding = coreEncodings.getEncoding;
  39200. var getStdFontMap = coreStandardFonts.getStdFontMap;
  39201. var getNonStdFontMap = coreStandardFonts.getNonStdFontMap;
  39202. var getGlyphMapForStandardFonts = coreStandardFonts.getGlyphMapForStandardFonts;
  39203. var getSupplementalGlyphMapForArialBlack = coreStandardFonts.getSupplementalGlyphMapForArialBlack;
  39204. var getUnicodeRangeFor = coreUnicode.getUnicodeRangeFor;
  39205. var mapSpecialUnicodeValues = coreUnicode.mapSpecialUnicodeValues;
  39206. var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph;
  39207. var Type1Parser = coreType1Parser.Type1Parser;
  39208. var CFFStandardStrings = coreCFFParser.CFFStandardStrings;
  39209. var CFFParser = coreCFFParser.CFFParser;
  39210. var CFFCompiler = coreCFFParser.CFFCompiler;
  39211. var CFF = coreCFFParser.CFF;
  39212. var CFFHeader = coreCFFParser.CFFHeader;
  39213. var CFFTopDict = coreCFFParser.CFFTopDict;
  39214. var CFFPrivateDict = coreCFFParser.CFFPrivateDict;
  39215. var CFFStrings = coreCFFParser.CFFStrings;
  39216. var CFFIndex = coreCFFParser.CFFIndex;
  39217. var CFFCharset = coreCFFParser.CFFCharset;
  39218. var PRIVATE_USE_OFFSET_START = 0xE000;
  39219. var PRIVATE_USE_OFFSET_END = 0xF8FF;
  39220. var SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = false;
  39221. var PDF_GLYPH_SPACE_UNITS = 1000;
  39222. var SEAC_ANALYSIS_ENABLED = false;
  39223. var FontFlags = {
  39224. FixedPitch: 1,
  39225. Serif: 2,
  39226. Symbolic: 4,
  39227. Script: 8,
  39228. Nonsymbolic: 32,
  39229. Italic: 64,
  39230. AllCap: 65536,
  39231. SmallCap: 131072,
  39232. ForceBold: 262144
  39233. };
  39234. var MacStandardGlyphOrdering = [
  39235. '.notdef',
  39236. '.null',
  39237. 'nonmarkingreturn',
  39238. 'space',
  39239. 'exclam',
  39240. 'quotedbl',
  39241. 'numbersign',
  39242. 'dollar',
  39243. 'percent',
  39244. 'ampersand',
  39245. 'quotesingle',
  39246. 'parenleft',
  39247. 'parenright',
  39248. 'asterisk',
  39249. 'plus',
  39250. 'comma',
  39251. 'hyphen',
  39252. 'period',
  39253. 'slash',
  39254. 'zero',
  39255. 'one',
  39256. 'two',
  39257. 'three',
  39258. 'four',
  39259. 'five',
  39260. 'six',
  39261. 'seven',
  39262. 'eight',
  39263. 'nine',
  39264. 'colon',
  39265. 'semicolon',
  39266. 'less',
  39267. 'equal',
  39268. 'greater',
  39269. 'question',
  39270. 'at',
  39271. 'A',
  39272. 'B',
  39273. 'C',
  39274. 'D',
  39275. 'E',
  39276. 'F',
  39277. 'G',
  39278. 'H',
  39279. 'I',
  39280. 'J',
  39281. 'K',
  39282. 'L',
  39283. 'M',
  39284. 'N',
  39285. 'O',
  39286. 'P',
  39287. 'Q',
  39288. 'R',
  39289. 'S',
  39290. 'T',
  39291. 'U',
  39292. 'V',
  39293. 'W',
  39294. 'X',
  39295. 'Y',
  39296. 'Z',
  39297. 'bracketleft',
  39298. 'backslash',
  39299. 'bracketright',
  39300. 'asciicircum',
  39301. 'underscore',
  39302. 'grave',
  39303. 'a',
  39304. 'b',
  39305. 'c',
  39306. 'd',
  39307. 'e',
  39308. 'f',
  39309. 'g',
  39310. 'h',
  39311. 'i',
  39312. 'j',
  39313. 'k',
  39314. 'l',
  39315. 'm',
  39316. 'n',
  39317. 'o',
  39318. 'p',
  39319. 'q',
  39320. 'r',
  39321. 's',
  39322. 't',
  39323. 'u',
  39324. 'v',
  39325. 'w',
  39326. 'x',
  39327. 'y',
  39328. 'z',
  39329. 'braceleft',
  39330. 'bar',
  39331. 'braceright',
  39332. 'asciitilde',
  39333. 'Adieresis',
  39334. 'Aring',
  39335. 'Ccedilla',
  39336. 'Eacute',
  39337. 'Ntilde',
  39338. 'Odieresis',
  39339. 'Udieresis',
  39340. 'aacute',
  39341. 'agrave',
  39342. 'acircumflex',
  39343. 'adieresis',
  39344. 'atilde',
  39345. 'aring',
  39346. 'ccedilla',
  39347. 'eacute',
  39348. 'egrave',
  39349. 'ecircumflex',
  39350. 'edieresis',
  39351. 'iacute',
  39352. 'igrave',
  39353. 'icircumflex',
  39354. 'idieresis',
  39355. 'ntilde',
  39356. 'oacute',
  39357. 'ograve',
  39358. 'ocircumflex',
  39359. 'odieresis',
  39360. 'otilde',
  39361. 'uacute',
  39362. 'ugrave',
  39363. 'ucircumflex',
  39364. 'udieresis',
  39365. 'dagger',
  39366. 'degree',
  39367. 'cent',
  39368. 'sterling',
  39369. 'section',
  39370. 'bullet',
  39371. 'paragraph',
  39372. 'germandbls',
  39373. 'registered',
  39374. 'copyright',
  39375. 'trademark',
  39376. 'acute',
  39377. 'dieresis',
  39378. 'notequal',
  39379. 'AE',
  39380. 'Oslash',
  39381. 'infinity',
  39382. 'plusminus',
  39383. 'lessequal',
  39384. 'greaterequal',
  39385. 'yen',
  39386. 'mu',
  39387. 'partialdiff',
  39388. 'summation',
  39389. 'product',
  39390. 'pi',
  39391. 'integral',
  39392. 'ordfeminine',
  39393. 'ordmasculine',
  39394. 'Omega',
  39395. 'ae',
  39396. 'oslash',
  39397. 'questiondown',
  39398. 'exclamdown',
  39399. 'logicalnot',
  39400. 'radical',
  39401. 'florin',
  39402. 'approxequal',
  39403. 'Delta',
  39404. 'guillemotleft',
  39405. 'guillemotright',
  39406. 'ellipsis',
  39407. 'nonbreakingspace',
  39408. 'Agrave',
  39409. 'Atilde',
  39410. 'Otilde',
  39411. 'OE',
  39412. 'oe',
  39413. 'endash',
  39414. 'emdash',
  39415. 'quotedblleft',
  39416. 'quotedblright',
  39417. 'quoteleft',
  39418. 'quoteright',
  39419. 'divide',
  39420. 'lozenge',
  39421. 'ydieresis',
  39422. 'Ydieresis',
  39423. 'fraction',
  39424. 'currency',
  39425. 'guilsinglleft',
  39426. 'guilsinglright',
  39427. 'fi',
  39428. 'fl',
  39429. 'daggerdbl',
  39430. 'periodcentered',
  39431. 'quotesinglbase',
  39432. 'quotedblbase',
  39433. 'perthousand',
  39434. 'Acircumflex',
  39435. 'Ecircumflex',
  39436. 'Aacute',
  39437. 'Edieresis',
  39438. 'Egrave',
  39439. 'Iacute',
  39440. 'Icircumflex',
  39441. 'Idieresis',
  39442. 'Igrave',
  39443. 'Oacute',
  39444. 'Ocircumflex',
  39445. 'apple',
  39446. 'Ograve',
  39447. 'Uacute',
  39448. 'Ucircumflex',
  39449. 'Ugrave',
  39450. 'dotlessi',
  39451. 'circumflex',
  39452. 'tilde',
  39453. 'macron',
  39454. 'breve',
  39455. 'dotaccent',
  39456. 'ring',
  39457. 'cedilla',
  39458. 'hungarumlaut',
  39459. 'ogonek',
  39460. 'caron',
  39461. 'Lslash',
  39462. 'lslash',
  39463. 'Scaron',
  39464. 'scaron',
  39465. 'Zcaron',
  39466. 'zcaron',
  39467. 'brokenbar',
  39468. 'Eth',
  39469. 'eth',
  39470. 'Yacute',
  39471. 'yacute',
  39472. 'Thorn',
  39473. 'thorn',
  39474. 'minus',
  39475. 'multiply',
  39476. 'onesuperior',
  39477. 'twosuperior',
  39478. 'threesuperior',
  39479. 'onehalf',
  39480. 'onequarter',
  39481. 'threequarters',
  39482. 'franc',
  39483. 'Gbreve',
  39484. 'gbreve',
  39485. 'Idotaccent',
  39486. 'Scedilla',
  39487. 'scedilla',
  39488. 'Cacute',
  39489. 'cacute',
  39490. 'Ccaron',
  39491. 'ccaron',
  39492. 'dcroat'
  39493. ];
  39494. function adjustWidths(properties) {
  39495. if (!properties.fontMatrix) {
  39496. return;
  39497. }
  39498. if (properties.fontMatrix[0] === FONT_IDENTITY_MATRIX[0]) {
  39499. return;
  39500. }
  39501. var scale = 0.001 / properties.fontMatrix[0];
  39502. var glyphsWidths = properties.widths;
  39503. for (var glyph in glyphsWidths) {
  39504. glyphsWidths[glyph] *= scale;
  39505. }
  39506. properties.defaultWidth *= scale;
  39507. }
  39508. function adjustToUnicode(properties, builtInEncoding) {
  39509. if (properties.hasIncludedToUnicodeMap) {
  39510. return;
  39511. }
  39512. if (properties.hasEncoding) {
  39513. return;
  39514. }
  39515. if (builtInEncoding === properties.defaultEncoding) {
  39516. return;
  39517. }
  39518. if (properties.toUnicode instanceof IdentityToUnicodeMap) {
  39519. return;
  39520. }
  39521. var toUnicode = [], glyphsUnicodeMap = getGlyphsUnicode();
  39522. for (var charCode in builtInEncoding) {
  39523. var glyphName = builtInEncoding[charCode];
  39524. var unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  39525. if (unicode !== -1) {
  39526. toUnicode[charCode] = String.fromCharCode(unicode);
  39527. }
  39528. }
  39529. properties.toUnicode.amend(toUnicode);
  39530. }
  39531. function getFontType(type, subtype) {
  39532. switch (type) {
  39533. case 'Type1':
  39534. return subtype === 'Type1C' ? FontType.TYPE1C : FontType.TYPE1;
  39535. case 'CIDFontType0':
  39536. return subtype === 'CIDFontType0C' ? FontType.CIDFONTTYPE0C : FontType.CIDFONTTYPE0;
  39537. case 'OpenType':
  39538. return FontType.OPENTYPE;
  39539. case 'TrueType':
  39540. return FontType.TRUETYPE;
  39541. case 'CIDFontType2':
  39542. return FontType.CIDFONTTYPE2;
  39543. case 'MMType1':
  39544. return FontType.MMTYPE1;
  39545. case 'Type0':
  39546. return FontType.TYPE0;
  39547. default:
  39548. return FontType.UNKNOWN;
  39549. }
  39550. }
  39551. function recoverGlyphName(name, glyphsUnicodeMap) {
  39552. if (glyphsUnicodeMap[name] !== undefined) {
  39553. return name;
  39554. }
  39555. var unicode = getUnicodeForGlyph(name, glyphsUnicodeMap);
  39556. if (unicode !== -1) {
  39557. for (var key in glyphsUnicodeMap) {
  39558. if (glyphsUnicodeMap[key] === unicode) {
  39559. return key;
  39560. }
  39561. }
  39562. }
  39563. info('Unable to recover a standard glyph name for: ' + name);
  39564. return name;
  39565. }
  39566. var Glyph = function GlyphClosure() {
  39567. function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  39568. this.fontChar = fontChar;
  39569. this.unicode = unicode;
  39570. this.accent = accent;
  39571. this.width = width;
  39572. this.vmetric = vmetric;
  39573. this.operatorListId = operatorListId;
  39574. this.isSpace = isSpace;
  39575. this.isInFont = isInFont;
  39576. }
  39577. Glyph.prototype.matchesForCache = function (fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  39578. 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;
  39579. };
  39580. return Glyph;
  39581. }();
  39582. var ToUnicodeMap = function ToUnicodeMapClosure() {
  39583. function ToUnicodeMap(cmap) {
  39584. this._map = cmap;
  39585. }
  39586. ToUnicodeMap.prototype = {
  39587. get length() {
  39588. return this._map.length;
  39589. },
  39590. forEach: function (callback) {
  39591. for (var charCode in this._map) {
  39592. callback(charCode, this._map[charCode].charCodeAt(0));
  39593. }
  39594. },
  39595. has: function (i) {
  39596. return this._map[i] !== undefined;
  39597. },
  39598. get: function (i) {
  39599. return this._map[i];
  39600. },
  39601. charCodeOf: function (v) {
  39602. return this._map.indexOf(v);
  39603. },
  39604. amend: function (map) {
  39605. for (var charCode in map) {
  39606. this._map[charCode] = map[charCode];
  39607. }
  39608. }
  39609. };
  39610. return ToUnicodeMap;
  39611. }();
  39612. var IdentityToUnicodeMap = function IdentityToUnicodeMapClosure() {
  39613. function IdentityToUnicodeMap(firstChar, lastChar) {
  39614. this.firstChar = firstChar;
  39615. this.lastChar = lastChar;
  39616. }
  39617. IdentityToUnicodeMap.prototype = {
  39618. get length() {
  39619. return this.lastChar + 1 - this.firstChar;
  39620. },
  39621. forEach: function (callback) {
  39622. for (var i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  39623. callback(i, i);
  39624. }
  39625. },
  39626. has: function (i) {
  39627. return this.firstChar <= i && i <= this.lastChar;
  39628. },
  39629. get: function (i) {
  39630. if (this.firstChar <= i && i <= this.lastChar) {
  39631. return String.fromCharCode(i);
  39632. }
  39633. return undefined;
  39634. },
  39635. charCodeOf: function (v) {
  39636. return isInt(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  39637. },
  39638. amend: function (map) {
  39639. error('Should not call amend()');
  39640. }
  39641. };
  39642. return IdentityToUnicodeMap;
  39643. }();
  39644. var OpenTypeFileBuilder = function OpenTypeFileBuilderClosure() {
  39645. function writeInt16(dest, offset, num) {
  39646. dest[offset] = num >> 8 & 0xFF;
  39647. dest[offset + 1] = num & 0xFF;
  39648. }
  39649. function writeInt32(dest, offset, num) {
  39650. dest[offset] = num >> 24 & 0xFF;
  39651. dest[offset + 1] = num >> 16 & 0xFF;
  39652. dest[offset + 2] = num >> 8 & 0xFF;
  39653. dest[offset + 3] = num & 0xFF;
  39654. }
  39655. function writeData(dest, offset, data) {
  39656. var i, ii;
  39657. if (data instanceof Uint8Array) {
  39658. dest.set(data, offset);
  39659. } else if (typeof data === 'string') {
  39660. for (i = 0, ii = data.length; i < ii; i++) {
  39661. dest[offset++] = data.charCodeAt(i) & 0xFF;
  39662. }
  39663. } else {
  39664. for (i = 0, ii = data.length; i < ii; i++) {
  39665. dest[offset++] = data[i] & 0xFF;
  39666. }
  39667. }
  39668. }
  39669. function OpenTypeFileBuilder(sfnt) {
  39670. this.sfnt = sfnt;
  39671. this.tables = Object.create(null);
  39672. }
  39673. OpenTypeFileBuilder.getSearchParams = function OpenTypeFileBuilder_getSearchParams(entriesCount, entrySize) {
  39674. var maxPower2 = 1, log2 = 0;
  39675. while ((maxPower2 ^ entriesCount) > maxPower2) {
  39676. maxPower2 <<= 1;
  39677. log2++;
  39678. }
  39679. var searchRange = maxPower2 * entrySize;
  39680. return {
  39681. range: searchRange,
  39682. entry: log2,
  39683. rangeShift: entrySize * entriesCount - searchRange
  39684. };
  39685. };
  39686. var OTF_HEADER_SIZE = 12;
  39687. var OTF_TABLE_ENTRY_SIZE = 16;
  39688. OpenTypeFileBuilder.prototype = {
  39689. toArray: function OpenTypeFileBuilder_toArray() {
  39690. var sfnt = this.sfnt;
  39691. var tables = this.tables;
  39692. var tablesNames = Object.keys(tables);
  39693. tablesNames.sort();
  39694. var numTables = tablesNames.length;
  39695. var i, j, jj, table, tableName;
  39696. var offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  39697. var tableOffsets = [offset];
  39698. for (i = 0; i < numTables; i++) {
  39699. table = tables[tablesNames[i]];
  39700. var paddedLength = (table.length + 3 & ~3) >>> 0;
  39701. offset += paddedLength;
  39702. tableOffsets.push(offset);
  39703. }
  39704. var file = new Uint8Array(offset);
  39705. for (i = 0; i < numTables; i++) {
  39706. table = tables[tablesNames[i]];
  39707. writeData(file, tableOffsets[i], table);
  39708. }
  39709. if (sfnt === 'true') {
  39710. sfnt = string32(0x00010000);
  39711. }
  39712. file[0] = sfnt.charCodeAt(0) & 0xFF;
  39713. file[1] = sfnt.charCodeAt(1) & 0xFF;
  39714. file[2] = sfnt.charCodeAt(2) & 0xFF;
  39715. file[3] = sfnt.charCodeAt(3) & 0xFF;
  39716. writeInt16(file, 4, numTables);
  39717. var searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  39718. writeInt16(file, 6, searchParams.range);
  39719. writeInt16(file, 8, searchParams.entry);
  39720. writeInt16(file, 10, searchParams.rangeShift);
  39721. offset = OTF_HEADER_SIZE;
  39722. for (i = 0; i < numTables; i++) {
  39723. tableName = tablesNames[i];
  39724. file[offset] = tableName.charCodeAt(0) & 0xFF;
  39725. file[offset + 1] = tableName.charCodeAt(1) & 0xFF;
  39726. file[offset + 2] = tableName.charCodeAt(2) & 0xFF;
  39727. file[offset + 3] = tableName.charCodeAt(3) & 0xFF;
  39728. var checksum = 0;
  39729. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  39730. var quad = readUint32(file, j);
  39731. checksum = checksum + quad >>> 0;
  39732. }
  39733. writeInt32(file, offset + 4, checksum);
  39734. writeInt32(file, offset + 8, tableOffsets[i]);
  39735. writeInt32(file, offset + 12, tables[tableName].length);
  39736. offset += OTF_TABLE_ENTRY_SIZE;
  39737. }
  39738. return file;
  39739. },
  39740. addTable: function OpenTypeFileBuilder_addTable(tag, data) {
  39741. if (tag in this.tables) {
  39742. throw new Error('Table ' + tag + ' already exists');
  39743. }
  39744. this.tables[tag] = data;
  39745. }
  39746. };
  39747. return OpenTypeFileBuilder;
  39748. }();
  39749. var ProblematicCharRanges = new Int32Array([
  39750. 0x0000,
  39751. 0x0020,
  39752. 0x007F,
  39753. 0x00A1,
  39754. 0x00AD,
  39755. 0x00AE,
  39756. 0x0600,
  39757. 0x0780,
  39758. 0x08A0,
  39759. 0x10A0,
  39760. 0x1780,
  39761. 0x1800,
  39762. 0x1C00,
  39763. 0x1C50,
  39764. 0x2000,
  39765. 0x2010,
  39766. 0x2011,
  39767. 0x2012,
  39768. 0x2028,
  39769. 0x2030,
  39770. 0x205F,
  39771. 0x2070,
  39772. 0x25CC,
  39773. 0x25CD,
  39774. 0x3000,
  39775. 0x3001,
  39776. 0xAA60,
  39777. 0xAA80,
  39778. 0xFFF0,
  39779. 0x10000
  39780. ]);
  39781. var Font = function FontClosure() {
  39782. function Font(name, file, properties) {
  39783. var charCode, glyphName, unicode;
  39784. this.name = name;
  39785. this.loadedName = properties.loadedName;
  39786. this.isType3Font = properties.isType3Font;
  39787. this.sizes = [];
  39788. this.missingFile = false;
  39789. this.glyphCache = Object.create(null);
  39790. this.isSerifFont = !!(properties.flags & FontFlags.Serif);
  39791. this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  39792. this.isMonospace = !!(properties.flags & FontFlags.FixedPitch);
  39793. var type = properties.type;
  39794. var subtype = properties.subtype;
  39795. this.type = type;
  39796. this.fallbackName = this.isMonospace ? 'monospace' : this.isSerifFont ? 'serif' : 'sans-serif';
  39797. this.differences = properties.differences;
  39798. this.widths = properties.widths;
  39799. this.defaultWidth = properties.defaultWidth;
  39800. this.composite = properties.composite;
  39801. this.wideChars = properties.wideChars;
  39802. this.cMap = properties.cMap;
  39803. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  39804. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  39805. this.fontMatrix = properties.fontMatrix;
  39806. this.bbox = properties.bbox;
  39807. this.toUnicode = properties.toUnicode;
  39808. this.toFontChar = [];
  39809. if (properties.type === 'Type3') {
  39810. for (charCode = 0; charCode < 256; charCode++) {
  39811. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  39812. }
  39813. this.fontType = FontType.TYPE3;
  39814. return;
  39815. }
  39816. this.cidEncoding = properties.cidEncoding;
  39817. this.vertical = properties.vertical;
  39818. if (this.vertical) {
  39819. this.vmetrics = properties.vmetrics;
  39820. this.defaultVMetrics = properties.defaultVMetrics;
  39821. }
  39822. var glyphsUnicodeMap;
  39823. if (!file || file.isEmpty) {
  39824. if (file) {
  39825. warn('Font file is empty in "' + name + '" (' + this.loadedName + ')');
  39826. }
  39827. this.missingFile = true;
  39828. var fontName = name.replace(/[,_]/g, '-');
  39829. var stdFontMap = getStdFontMap(), nonStdFontMap = getNonStdFontMap();
  39830. var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  39831. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  39832. this.bold = fontName.search(/bold/gi) !== -1;
  39833. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  39834. this.black = name.search(/Black/g) !== -1;
  39835. this.remeasure = Object.keys(this.widths).length > 0;
  39836. if (isStandardFont && type === 'CIDFontType2' && properties.cidEncoding.indexOf('Identity-') === 0) {
  39837. var GlyphMapForStandardFonts = getGlyphMapForStandardFonts();
  39838. var map = [];
  39839. for (charCode in GlyphMapForStandardFonts) {
  39840. map[+charCode] = GlyphMapForStandardFonts[charCode];
  39841. }
  39842. if (/Arial-?Black/i.test(name)) {
  39843. var SupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack();
  39844. for (charCode in SupplementalGlyphMapForArialBlack) {
  39845. map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
  39846. }
  39847. }
  39848. var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
  39849. if (!isIdentityUnicode) {
  39850. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  39851. map[+charCode] = unicodeCharCode;
  39852. });
  39853. }
  39854. this.toFontChar = map;
  39855. this.toUnicode = new ToUnicodeMap(map);
  39856. } else if (/Symbol/i.test(fontName)) {
  39857. this.toFontChar = buildToFontChar(SymbolSetEncoding, getGlyphsUnicode(), properties.differences);
  39858. } else if (/Dingbats/i.test(fontName)) {
  39859. if (/Wingdings/i.test(name)) {
  39860. warn('Non-embedded Wingdings font, falling back to ZapfDingbats.');
  39861. }
  39862. this.toFontChar = buildToFontChar(ZapfDingbatsEncoding, getDingbatsGlyphsUnicode(), properties.differences);
  39863. } else if (isStandardFont) {
  39864. this.toFontChar = buildToFontChar(properties.defaultEncoding, getGlyphsUnicode(), properties.differences);
  39865. } else {
  39866. glyphsUnicodeMap = getGlyphsUnicode();
  39867. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  39868. if (!this.composite) {
  39869. glyphName = properties.differences[charCode] || properties.defaultEncoding[charCode];
  39870. unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  39871. if (unicode !== -1) {
  39872. unicodeCharCode = unicode;
  39873. }
  39874. }
  39875. this.toFontChar[charCode] = unicodeCharCode;
  39876. }.bind(this));
  39877. }
  39878. this.loadedName = fontName.split('-')[0];
  39879. this.loading = false;
  39880. this.fontType = getFontType(type, subtype);
  39881. return;
  39882. }
  39883. if (subtype === 'Type1C') {
  39884. if (type !== 'Type1' && type !== 'MMType1') {
  39885. if (isTrueTypeFile(file)) {
  39886. subtype = 'TrueType';
  39887. } else {
  39888. type = 'Type1';
  39889. }
  39890. } else if (isOpenTypeFile(file)) {
  39891. type = subtype = 'OpenType';
  39892. }
  39893. }
  39894. if (subtype === 'CIDFontType0C' && type !== 'CIDFontType0') {
  39895. type = 'CIDFontType0';
  39896. }
  39897. if (subtype === 'OpenType') {
  39898. type = 'OpenType';
  39899. }
  39900. if (type === 'CIDFontType0') {
  39901. if (isType1File(file)) {
  39902. subtype = 'CIDFontType0';
  39903. } else if (isOpenTypeFile(file)) {
  39904. type = subtype = 'OpenType';
  39905. } else {
  39906. subtype = 'CIDFontType0C';
  39907. }
  39908. }
  39909. var data;
  39910. switch (type) {
  39911. case 'MMType1':
  39912. info('MMType1 font (' + name + '), falling back to Type1.');
  39913. case 'Type1':
  39914. case 'CIDFontType0':
  39915. this.mimetype = 'font/opentype';
  39916. var cff = subtype === 'Type1C' || subtype === 'CIDFontType0C' ? new CFFFont(file, properties) : new Type1Font(name, file, properties);
  39917. adjustWidths(properties);
  39918. data = this.convert(name, cff, properties);
  39919. break;
  39920. case 'OpenType':
  39921. case 'TrueType':
  39922. case 'CIDFontType2':
  39923. this.mimetype = 'font/opentype';
  39924. data = this.checkAndRepair(name, file, properties);
  39925. if (this.isOpenType) {
  39926. adjustWidths(properties);
  39927. type = 'OpenType';
  39928. }
  39929. break;
  39930. default:
  39931. error('Font ' + type + ' is not supported');
  39932. break;
  39933. }
  39934. this.data = data;
  39935. this.fontType = getFontType(type, subtype);
  39936. this.fontMatrix = properties.fontMatrix;
  39937. this.widths = properties.widths;
  39938. this.defaultWidth = properties.defaultWidth;
  39939. this.toUnicode = properties.toUnicode;
  39940. this.encoding = properties.baseEncoding;
  39941. this.seacMap = properties.seacMap;
  39942. this.loading = true;
  39943. }
  39944. Font.getFontID = function () {
  39945. var ID = 1;
  39946. return function Font_getFontID() {
  39947. return String(ID++);
  39948. };
  39949. }();
  39950. function int16(b0, b1) {
  39951. return (b0 << 8) + b1;
  39952. }
  39953. function signedInt16(b0, b1) {
  39954. var value = (b0 << 8) + b1;
  39955. return value & 1 << 15 ? value - 0x10000 : value;
  39956. }
  39957. function int32(b0, b1, b2, b3) {
  39958. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  39959. }
  39960. function string16(value) {
  39961. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  39962. }
  39963. function safeString16(value) {
  39964. value = value > 0x7FFF ? 0x7FFF : value < -0x8000 ? -0x8000 : value;
  39965. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  39966. }
  39967. function isTrueTypeFile(file) {
  39968. var header = file.peekBytes(4);
  39969. return readUint32(header, 0) === 0x00010000;
  39970. }
  39971. function isOpenTypeFile(file) {
  39972. var header = file.peekBytes(4);
  39973. return bytesToString(header) === 'OTTO';
  39974. }
  39975. function isType1File(file) {
  39976. var header = file.peekBytes(2);
  39977. if (header[0] === 0x25 && header[1] === 0x21) {
  39978. return true;
  39979. }
  39980. if (header[0] === 0x80 && header[1] === 0x01) {
  39981. return true;
  39982. }
  39983. return false;
  39984. }
  39985. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  39986. var toFontChar = [], unicode;
  39987. for (var i = 0, ii = encoding.length; i < ii; i++) {
  39988. unicode = getUnicodeForGlyph(encoding[i], glyphsUnicodeMap);
  39989. if (unicode !== -1) {
  39990. toFontChar[i] = unicode;
  39991. }
  39992. }
  39993. for (var charCode in differences) {
  39994. unicode = getUnicodeForGlyph(differences[charCode], glyphsUnicodeMap);
  39995. if (unicode !== -1) {
  39996. toFontChar[+charCode] = unicode;
  39997. }
  39998. }
  39999. return toFontChar;
  40000. }
  40001. function isProblematicUnicodeLocation(code) {
  40002. var i = 0, j = ProblematicCharRanges.length - 1;
  40003. while (i < j) {
  40004. var c = i + j + 1 >> 1;
  40005. if (code < ProblematicCharRanges[c]) {
  40006. j = c - 1;
  40007. } else {
  40008. i = c;
  40009. }
  40010. }
  40011. return !(i & 1);
  40012. }
  40013. function adjustMapping(charCodeToGlyphId, properties) {
  40014. var toUnicode = properties.toUnicode;
  40015. var isSymbolic = !!(properties.flags & FontFlags.Symbolic);
  40016. var isIdentityUnicode = properties.toUnicode instanceof IdentityToUnicodeMap;
  40017. var newMap = Object.create(null);
  40018. var toFontChar = [];
  40019. var usedFontCharCodes = [];
  40020. var nextAvailableFontCharCode = PRIVATE_USE_OFFSET_START;
  40021. for (var originalCharCode in charCodeToGlyphId) {
  40022. originalCharCode |= 0;
  40023. var glyphId = charCodeToGlyphId[originalCharCode];
  40024. var fontCharCode = originalCharCode;
  40025. var hasUnicodeValue = false;
  40026. if (!isIdentityUnicode && toUnicode.has(originalCharCode)) {
  40027. hasUnicodeValue = true;
  40028. var unicode = toUnicode.get(fontCharCode);
  40029. if (unicode.length === 1) {
  40030. fontCharCode = unicode.charCodeAt(0);
  40031. }
  40032. }
  40033. if ((usedFontCharCodes[fontCharCode] !== undefined || isProblematicUnicodeLocation(fontCharCode) || isSymbolic && !hasUnicodeValue) && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END) {
  40034. do {
  40035. fontCharCode = nextAvailableFontCharCode++;
  40036. if (SKIP_PRIVATE_USE_RANGE_F000_TO_F01F && fontCharCode === 0xF000) {
  40037. fontCharCode = 0xF020;
  40038. nextAvailableFontCharCode = fontCharCode + 1;
  40039. }
  40040. } while (usedFontCharCodes[fontCharCode] !== undefined && nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END);
  40041. }
  40042. newMap[fontCharCode] = glyphId;
  40043. toFontChar[originalCharCode] = fontCharCode;
  40044. usedFontCharCodes[fontCharCode] = true;
  40045. }
  40046. return {
  40047. toFontChar: toFontChar,
  40048. charCodeToGlyphId: newMap,
  40049. nextAvailableFontCharCode: nextAvailableFontCharCode
  40050. };
  40051. }
  40052. function getRanges(glyphs, numGlyphs) {
  40053. var codes = [];
  40054. for (var charCode in glyphs) {
  40055. if (glyphs[charCode] >= numGlyphs) {
  40056. continue;
  40057. }
  40058. codes.push({
  40059. fontCharCode: charCode | 0,
  40060. glyphId: glyphs[charCode]
  40061. });
  40062. }
  40063. codes.sort(function fontGetRangesSort(a, b) {
  40064. return a.fontCharCode - b.fontCharCode;
  40065. });
  40066. var ranges = [];
  40067. var length = codes.length;
  40068. for (var n = 0; n < length;) {
  40069. var start = codes[n].fontCharCode;
  40070. var codeIndices = [codes[n].glyphId];
  40071. ++n;
  40072. var end = start;
  40073. while (n < length && end + 1 === codes[n].fontCharCode) {
  40074. codeIndices.push(codes[n].glyphId);
  40075. ++end;
  40076. ++n;
  40077. if (end === 0xFFFF) {
  40078. break;
  40079. }
  40080. }
  40081. ranges.push([
  40082. start,
  40083. end,
  40084. codeIndices
  40085. ]);
  40086. }
  40087. return ranges;
  40088. }
  40089. function createCmapTable(glyphs, numGlyphs) {
  40090. var ranges = getRanges(glyphs, numGlyphs);
  40091. var numTables = ranges[ranges.length - 1][1] > 0xFFFF ? 2 : 1;
  40092. var cmap = '\x00\x00' + string16(numTables) + '\x00\x03' + '\x00\x01' + string32(4 + numTables * 8);
  40093. var i, ii, j, jj;
  40094. for (i = ranges.length - 1; i >= 0; --i) {
  40095. if (ranges[i][0] <= 0xFFFF) {
  40096. break;
  40097. }
  40098. }
  40099. var bmpLength = i + 1;
  40100. if (ranges[i][0] < 0xFFFF && ranges[i][1] === 0xFFFF) {
  40101. ranges[i][1] = 0xFFFE;
  40102. }
  40103. var trailingRangesCount = ranges[i][1] < 0xFFFF ? 1 : 0;
  40104. var segCount = bmpLength + trailingRangesCount;
  40105. var searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2);
  40106. var startCount = '';
  40107. var endCount = '';
  40108. var idDeltas = '';
  40109. var idRangeOffsets = '';
  40110. var glyphsIds = '';
  40111. var bias = 0;
  40112. var range, start, end, codes;
  40113. for (i = 0, ii = bmpLength; i < ii; i++) {
  40114. range = ranges[i];
  40115. start = range[0];
  40116. end = range[1];
  40117. startCount += string16(start);
  40118. endCount += string16(end);
  40119. codes = range[2];
  40120. var contiguous = true;
  40121. for (j = 1, jj = codes.length; j < jj; ++j) {
  40122. if (codes[j] !== codes[j - 1] + 1) {
  40123. contiguous = false;
  40124. break;
  40125. }
  40126. }
  40127. if (!contiguous) {
  40128. var offset = (segCount - i) * 2 + bias * 2;
  40129. bias += end - start + 1;
  40130. idDeltas += string16(0);
  40131. idRangeOffsets += string16(offset);
  40132. for (j = 0, jj = codes.length; j < jj; ++j) {
  40133. glyphsIds += string16(codes[j]);
  40134. }
  40135. } else {
  40136. var startCode = codes[0];
  40137. idDeltas += string16(startCode - start & 0xFFFF);
  40138. idRangeOffsets += string16(0);
  40139. }
  40140. }
  40141. if (trailingRangesCount > 0) {
  40142. endCount += '\xFF\xFF';
  40143. startCount += '\xFF\xFF';
  40144. idDeltas += '\x00\x01';
  40145. idRangeOffsets += '\x00\x00';
  40146. }
  40147. var format314 = '\x00\x00' + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + '\x00\x00' + startCount + idDeltas + idRangeOffsets + glyphsIds;
  40148. var format31012 = '';
  40149. var header31012 = '';
  40150. if (numTables > 1) {
  40151. cmap += '\x00\x03' + '\x00\x0A' + string32(4 + numTables * 8 + 4 + format314.length);
  40152. format31012 = '';
  40153. for (i = 0, ii = ranges.length; i < ii; i++) {
  40154. range = ranges[i];
  40155. start = range[0];
  40156. codes = range[2];
  40157. var code = codes[0];
  40158. for (j = 1, jj = codes.length; j < jj; ++j) {
  40159. if (codes[j] !== codes[j - 1] + 1) {
  40160. end = range[0] + j - 1;
  40161. format31012 += string32(start) + string32(end) + string32(code);
  40162. start = end + 1;
  40163. code = codes[j];
  40164. }
  40165. }
  40166. format31012 += string32(start) + string32(range[1]) + string32(code);
  40167. }
  40168. header31012 = '\x00\x0C' + '\x00\x00' + string32(format31012.length + 16) + '\x00\x00\x00\x00' + string32(format31012.length / 12);
  40169. }
  40170. return cmap + '\x00\x04' + string16(format314.length + 4) + format314 + header31012 + format31012;
  40171. }
  40172. function validateOS2Table(os2) {
  40173. var stream = new Stream(os2.data);
  40174. var version = stream.getUint16();
  40175. stream.getBytes(60);
  40176. var selection = stream.getUint16();
  40177. if (version < 4 && selection & 0x0300) {
  40178. return false;
  40179. }
  40180. var firstChar = stream.getUint16();
  40181. var lastChar = stream.getUint16();
  40182. if (firstChar > lastChar) {
  40183. return false;
  40184. }
  40185. stream.getBytes(6);
  40186. var usWinAscent = stream.getUint16();
  40187. if (usWinAscent === 0) {
  40188. return false;
  40189. }
  40190. os2.data[8] = os2.data[9] = 0;
  40191. return true;
  40192. }
  40193. function createOS2Table(properties, charstrings, override) {
  40194. override = override || {
  40195. unitsPerEm: 0,
  40196. yMax: 0,
  40197. yMin: 0,
  40198. ascent: 0,
  40199. descent: 0
  40200. };
  40201. var ulUnicodeRange1 = 0;
  40202. var ulUnicodeRange2 = 0;
  40203. var ulUnicodeRange3 = 0;
  40204. var ulUnicodeRange4 = 0;
  40205. var firstCharIndex = null;
  40206. var lastCharIndex = 0;
  40207. if (charstrings) {
  40208. for (var code in charstrings) {
  40209. code |= 0;
  40210. if (firstCharIndex > code || !firstCharIndex) {
  40211. firstCharIndex = code;
  40212. }
  40213. if (lastCharIndex < code) {
  40214. lastCharIndex = code;
  40215. }
  40216. var position = getUnicodeRangeFor(code);
  40217. if (position < 32) {
  40218. ulUnicodeRange1 |= 1 << position;
  40219. } else if (position < 64) {
  40220. ulUnicodeRange2 |= 1 << position - 32;
  40221. } else if (position < 96) {
  40222. ulUnicodeRange3 |= 1 << position - 64;
  40223. } else if (position < 123) {
  40224. ulUnicodeRange4 |= 1 << position - 96;
  40225. } else {
  40226. error('Unicode ranges Bits > 123 are reserved for internal usage');
  40227. }
  40228. }
  40229. } else {
  40230. firstCharIndex = 0;
  40231. lastCharIndex = 255;
  40232. }
  40233. var bbox = properties.bbox || [
  40234. 0,
  40235. 0,
  40236. 0,
  40237. 0
  40238. ];
  40239. var unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0];
  40240. var scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  40241. var typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  40242. var typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  40243. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  40244. typoDescent = -typoDescent;
  40245. }
  40246. var winAscent = override.yMax || typoAscent;
  40247. var winDescent = -override.yMin || -typoDescent;
  40248. 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';
  40249. }
  40250. function createPostTable(properties) {
  40251. var angle = Math.floor(properties.italicAngle * Math.pow(2, 16));
  40252. 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';
  40253. }
  40254. function createNameTable(name, proto) {
  40255. if (!proto) {
  40256. proto = [
  40257. [],
  40258. []
  40259. ];
  40260. }
  40261. var strings = [
  40262. proto[0][0] || 'Original licence',
  40263. proto[0][1] || name,
  40264. proto[0][2] || 'Unknown',
  40265. proto[0][3] || 'uniqueID',
  40266. proto[0][4] || name,
  40267. proto[0][5] || 'Version 0.11',
  40268. proto[0][6] || '',
  40269. proto[0][7] || 'Unknown',
  40270. proto[0][8] || 'Unknown',
  40271. proto[0][9] || 'Unknown'
  40272. ];
  40273. var stringsUnicode = [];
  40274. var i, ii, j, jj, str;
  40275. for (i = 0, ii = strings.length; i < ii; i++) {
  40276. str = proto[1][i] || strings[i];
  40277. var strBufUnicode = [];
  40278. for (j = 0, jj = str.length; j < jj; j++) {
  40279. strBufUnicode.push(string16(str.charCodeAt(j)));
  40280. }
  40281. stringsUnicode.push(strBufUnicode.join(''));
  40282. }
  40283. var names = [
  40284. strings,
  40285. stringsUnicode
  40286. ];
  40287. var platforms = [
  40288. '\x00\x01',
  40289. '\x00\x03'
  40290. ];
  40291. var encodings = [
  40292. '\x00\x00',
  40293. '\x00\x01'
  40294. ];
  40295. var languages = [
  40296. '\x00\x00',
  40297. '\x04\x09'
  40298. ];
  40299. var namesRecordCount = strings.length * platforms.length;
  40300. var nameTable = '\x00\x00' + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  40301. var strOffset = 0;
  40302. for (i = 0, ii = platforms.length; i < ii; i++) {
  40303. var strs = names[i];
  40304. for (j = 0, jj = strs.length; j < jj; j++) {
  40305. str = strs[j];
  40306. var nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  40307. nameTable += nameRecord;
  40308. strOffset += str.length;
  40309. }
  40310. }
  40311. nameTable += strings.join('') + stringsUnicode.join('');
  40312. return nameTable;
  40313. }
  40314. Font.prototype = {
  40315. name: null,
  40316. font: null,
  40317. mimetype: null,
  40318. encoding: null,
  40319. get renderer() {
  40320. var renderer = FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED);
  40321. return shadow(this, 'renderer', renderer);
  40322. },
  40323. exportData: function Font_exportData() {
  40324. var data = {};
  40325. for (var i in this) {
  40326. if (this.hasOwnProperty(i)) {
  40327. data[i] = this[i];
  40328. }
  40329. }
  40330. return data;
  40331. },
  40332. checkAndRepair: function Font_checkAndRepair(name, font, properties) {
  40333. function readTableEntry(file) {
  40334. var tag = bytesToString(file.getBytes(4));
  40335. var checksum = file.getInt32() >>> 0;
  40336. var offset = file.getInt32() >>> 0;
  40337. var length = file.getInt32() >>> 0;
  40338. var previousPosition = file.pos;
  40339. file.pos = file.start ? file.start : 0;
  40340. file.skip(offset);
  40341. var data = file.getBytes(length);
  40342. file.pos = previousPosition;
  40343. if (tag === 'head') {
  40344. data[8] = data[9] = data[10] = data[11] = 0;
  40345. data[17] |= 0x20;
  40346. }
  40347. return {
  40348. tag: tag,
  40349. checksum: checksum,
  40350. length: length,
  40351. offset: offset,
  40352. data: data
  40353. };
  40354. }
  40355. function readOpenTypeHeader(ttf) {
  40356. return {
  40357. version: bytesToString(ttf.getBytes(4)),
  40358. numTables: ttf.getUint16(),
  40359. searchRange: ttf.getUint16(),
  40360. entrySelector: ttf.getUint16(),
  40361. rangeShift: ttf.getUint16()
  40362. };
  40363. }
  40364. function readCmapTable(cmap, font, isSymbolicFont, hasEncoding) {
  40365. if (!cmap) {
  40366. warn('No cmap table available.');
  40367. return {
  40368. platformId: -1,
  40369. encodingId: -1,
  40370. mappings: [],
  40371. hasShortCmap: false
  40372. };
  40373. }
  40374. var segment;
  40375. var start = (font.start ? font.start : 0) + cmap.offset;
  40376. font.pos = start;
  40377. font.getUint16();
  40378. var numTables = font.getUint16();
  40379. var potentialTable;
  40380. var canBreak = false;
  40381. for (var i = 0; i < numTables; i++) {
  40382. var platformId = font.getUint16();
  40383. var encodingId = font.getUint16();
  40384. var offset = font.getInt32() >>> 0;
  40385. var useTable = false;
  40386. if (platformId === 0 && encodingId === 0) {
  40387. useTable = true;
  40388. } else if (platformId === 1 && encodingId === 0) {
  40389. useTable = true;
  40390. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  40391. useTable = true;
  40392. if (!isSymbolicFont) {
  40393. canBreak = true;
  40394. }
  40395. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  40396. useTable = true;
  40397. canBreak = true;
  40398. }
  40399. if (useTable) {
  40400. potentialTable = {
  40401. platformId: platformId,
  40402. encodingId: encodingId,
  40403. offset: offset
  40404. };
  40405. }
  40406. if (canBreak) {
  40407. break;
  40408. }
  40409. }
  40410. if (potentialTable) {
  40411. font.pos = start + potentialTable.offset;
  40412. }
  40413. if (!potentialTable || font.peekByte() === -1) {
  40414. warn('Could not find a preferred cmap table.');
  40415. return {
  40416. platformId: -1,
  40417. encodingId: -1,
  40418. mappings: [],
  40419. hasShortCmap: false
  40420. };
  40421. }
  40422. var format = font.getUint16();
  40423. font.getUint16();
  40424. font.getUint16();
  40425. var hasShortCmap = false;
  40426. var mappings = [];
  40427. var j, glyphId;
  40428. if (format === 0) {
  40429. for (j = 0; j < 256; j++) {
  40430. var index = font.getByte();
  40431. if (!index) {
  40432. continue;
  40433. }
  40434. mappings.push({
  40435. charCode: j,
  40436. glyphId: index
  40437. });
  40438. }
  40439. hasShortCmap = true;
  40440. } else if (format === 4) {
  40441. var segCount = font.getUint16() >> 1;
  40442. font.getBytes(6);
  40443. var segIndex, segments = [];
  40444. for (segIndex = 0; segIndex < segCount; segIndex++) {
  40445. segments.push({ end: font.getUint16() });
  40446. }
  40447. font.getUint16();
  40448. for (segIndex = 0; segIndex < segCount; segIndex++) {
  40449. segments[segIndex].start = font.getUint16();
  40450. }
  40451. for (segIndex = 0; segIndex < segCount; segIndex++) {
  40452. segments[segIndex].delta = font.getUint16();
  40453. }
  40454. var offsetsCount = 0;
  40455. for (segIndex = 0; segIndex < segCount; segIndex++) {
  40456. segment = segments[segIndex];
  40457. var rangeOffset = font.getUint16();
  40458. if (!rangeOffset) {
  40459. segment.offsetIndex = -1;
  40460. continue;
  40461. }
  40462. var offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  40463. segment.offsetIndex = offsetIndex;
  40464. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  40465. }
  40466. var offsets = [];
  40467. for (j = 0; j < offsetsCount; j++) {
  40468. offsets.push(font.getUint16());
  40469. }
  40470. for (segIndex = 0; segIndex < segCount; segIndex++) {
  40471. segment = segments[segIndex];
  40472. start = segment.start;
  40473. var end = segment.end;
  40474. var delta = segment.delta;
  40475. offsetIndex = segment.offsetIndex;
  40476. for (j = start; j <= end; j++) {
  40477. if (j === 0xFFFF) {
  40478. continue;
  40479. }
  40480. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  40481. glyphId = glyphId + delta & 0xFFFF;
  40482. if (glyphId === 0) {
  40483. continue;
  40484. }
  40485. mappings.push({
  40486. charCode: j,
  40487. glyphId: glyphId
  40488. });
  40489. }
  40490. }
  40491. } else if (format === 6) {
  40492. var firstCode = font.getUint16();
  40493. var entryCount = font.getUint16();
  40494. for (j = 0; j < entryCount; j++) {
  40495. glyphId = font.getUint16();
  40496. var charCode = firstCode + j;
  40497. mappings.push({
  40498. charCode: charCode,
  40499. glyphId: glyphId
  40500. });
  40501. }
  40502. } else {
  40503. warn('cmap table has unsupported format: ' + format);
  40504. return {
  40505. platformId: -1,
  40506. encodingId: -1,
  40507. mappings: [],
  40508. hasShortCmap: false
  40509. };
  40510. }
  40511. mappings.sort(function (a, b) {
  40512. return a.charCode - b.charCode;
  40513. });
  40514. for (i = 1; i < mappings.length; i++) {
  40515. if (mappings[i - 1].charCode === mappings[i].charCode) {
  40516. mappings.splice(i, 1);
  40517. i--;
  40518. }
  40519. }
  40520. return {
  40521. platformId: potentialTable.platformId,
  40522. encodingId: potentialTable.encodingId,
  40523. mappings: mappings,
  40524. hasShortCmap: hasShortCmap
  40525. };
  40526. }
  40527. function sanitizeMetrics(font, header, metrics, numGlyphs) {
  40528. if (!header) {
  40529. if (metrics) {
  40530. metrics.data = null;
  40531. }
  40532. return;
  40533. }
  40534. font.pos = (font.start ? font.start : 0) + header.offset;
  40535. font.pos += header.length - 2;
  40536. var numOfMetrics = font.getUint16();
  40537. if (numOfMetrics > numGlyphs) {
  40538. info('The numOfMetrics (' + numOfMetrics + ') should not be ' + 'greater than the numGlyphs (' + numGlyphs + ')');
  40539. numOfMetrics = numGlyphs;
  40540. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  40541. header.data[35] = numOfMetrics & 0x00ff;
  40542. }
  40543. var numOfSidebearings = numGlyphs - numOfMetrics;
  40544. var numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  40545. if (numMissing > 0) {
  40546. var entries = new Uint8Array(metrics.length + numMissing * 2);
  40547. entries.set(metrics.data);
  40548. metrics.data = entries;
  40549. }
  40550. }
  40551. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  40552. if (sourceEnd - sourceStart <= 12) {
  40553. return 0;
  40554. }
  40555. var glyf = source.subarray(sourceStart, sourceEnd);
  40556. var contoursCount = glyf[0] << 8 | glyf[1];
  40557. if (contoursCount & 0x8000) {
  40558. dest.set(glyf, destStart);
  40559. return glyf.length;
  40560. }
  40561. var i, j = 10, flagsCount = 0;
  40562. for (i = 0; i < contoursCount; i++) {
  40563. var endPoint = glyf[j] << 8 | glyf[j + 1];
  40564. flagsCount = endPoint + 1;
  40565. j += 2;
  40566. }
  40567. var instructionsStart = j;
  40568. var instructionsLength = glyf[j] << 8 | glyf[j + 1];
  40569. j += 2 + instructionsLength;
  40570. var instructionsEnd = j;
  40571. var coordinatesLength = 0;
  40572. for (i = 0; i < flagsCount; i++) {
  40573. var flag = glyf[j++];
  40574. if (flag & 0xC0) {
  40575. glyf[j - 1] = flag & 0x3F;
  40576. }
  40577. var xyLength = (flag & 2 ? 1 : flag & 16 ? 0 : 2) + (flag & 4 ? 1 : flag & 32 ? 0 : 2);
  40578. coordinatesLength += xyLength;
  40579. if (flag & 8) {
  40580. var repeat = glyf[j++];
  40581. i += repeat;
  40582. coordinatesLength += repeat * xyLength;
  40583. }
  40584. }
  40585. if (coordinatesLength === 0) {
  40586. return 0;
  40587. }
  40588. var glyphDataLength = j + coordinatesLength;
  40589. if (glyphDataLength > glyf.length) {
  40590. return 0;
  40591. }
  40592. if (!hintsValid && instructionsLength > 0) {
  40593. dest.set(glyf.subarray(0, instructionsStart), destStart);
  40594. dest.set([
  40595. 0,
  40596. 0
  40597. ], destStart + instructionsStart);
  40598. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  40599. glyphDataLength -= instructionsLength;
  40600. if (glyf.length - glyphDataLength > 3) {
  40601. glyphDataLength = glyphDataLength + 3 & ~3;
  40602. }
  40603. return glyphDataLength;
  40604. }
  40605. if (glyf.length - glyphDataLength > 3) {
  40606. glyphDataLength = glyphDataLength + 3 & ~3;
  40607. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  40608. return glyphDataLength;
  40609. }
  40610. dest.set(glyf, destStart);
  40611. return glyf.length;
  40612. }
  40613. function sanitizeHead(head, numGlyphs, locaLength) {
  40614. var data = head.data;
  40615. var version = int32(data[0], data[1], data[2], data[3]);
  40616. if (version >> 16 !== 1) {
  40617. info('Attempting to fix invalid version in head table: ' + version);
  40618. data[0] = 0;
  40619. data[1] = 1;
  40620. data[2] = 0;
  40621. data[3] = 0;
  40622. }
  40623. var indexToLocFormat = int16(data[50], data[51]);
  40624. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  40625. info('Attempting to fix invalid indexToLocFormat in head table: ' + indexToLocFormat);
  40626. var numGlyphsPlusOne = numGlyphs + 1;
  40627. if (locaLength === numGlyphsPlusOne << 1) {
  40628. data[50] = 0;
  40629. data[51] = 0;
  40630. } else if (locaLength === numGlyphsPlusOne << 2) {
  40631. data[50] = 0;
  40632. data[51] = 1;
  40633. } else {
  40634. warn('Could not fix indexToLocFormat: ' + indexToLocFormat);
  40635. }
  40636. }
  40637. }
  40638. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry) {
  40639. var itemSize, itemDecode, itemEncode;
  40640. if (isGlyphLocationsLong) {
  40641. itemSize = 4;
  40642. itemDecode = function fontItemDecodeLong(data, offset) {
  40643. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  40644. };
  40645. itemEncode = function fontItemEncodeLong(data, offset, value) {
  40646. data[offset] = value >>> 24 & 0xFF;
  40647. data[offset + 1] = value >> 16 & 0xFF;
  40648. data[offset + 2] = value >> 8 & 0xFF;
  40649. data[offset + 3] = value & 0xFF;
  40650. };
  40651. } else {
  40652. itemSize = 2;
  40653. itemDecode = function fontItemDecode(data, offset) {
  40654. return data[offset] << 9 | data[offset + 1] << 1;
  40655. };
  40656. itemEncode = function fontItemEncode(data, offset, value) {
  40657. data[offset] = value >> 9 & 0xFF;
  40658. data[offset + 1] = value >> 1 & 0xFF;
  40659. };
  40660. }
  40661. var locaData = loca.data;
  40662. var locaDataSize = itemSize * (1 + numGlyphs);
  40663. if (locaData.length !== locaDataSize) {
  40664. locaData = new Uint8Array(locaDataSize);
  40665. locaData.set(loca.data.subarray(0, locaDataSize));
  40666. loca.data = locaData;
  40667. }
  40668. var oldGlyfData = glyf.data;
  40669. var oldGlyfDataLength = oldGlyfData.length;
  40670. var newGlyfData = new Uint8Array(oldGlyfDataLength);
  40671. var startOffset = itemDecode(locaData, 0);
  40672. var writeOffset = 0;
  40673. var missingGlyphData = Object.create(null);
  40674. itemEncode(locaData, 0, writeOffset);
  40675. var i, j;
  40676. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  40677. var endOffset = itemDecode(locaData, j);
  40678. if (endOffset > oldGlyfDataLength && (oldGlyfDataLength + 3 & ~3) === endOffset) {
  40679. endOffset = oldGlyfDataLength;
  40680. }
  40681. if (endOffset > oldGlyfDataLength) {
  40682. itemEncode(locaData, j, writeOffset);
  40683. startOffset = endOffset;
  40684. continue;
  40685. }
  40686. if (startOffset === endOffset) {
  40687. missingGlyphData[i] = true;
  40688. }
  40689. var newLength = sanitizeGlyph(oldGlyfData, startOffset, endOffset, newGlyfData, writeOffset, hintsValid);
  40690. writeOffset += newLength;
  40691. itemEncode(locaData, j, writeOffset);
  40692. startOffset = endOffset;
  40693. }
  40694. if (writeOffset === 0) {
  40695. var simpleGlyph = new Uint8Array([
  40696. 0,
  40697. 1,
  40698. 0,
  40699. 0,
  40700. 0,
  40701. 0,
  40702. 0,
  40703. 0,
  40704. 0,
  40705. 0,
  40706. 0,
  40707. 0,
  40708. 0,
  40709. 0,
  40710. 49,
  40711. 0
  40712. ]);
  40713. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  40714. itemEncode(locaData, j, simpleGlyph.length);
  40715. }
  40716. glyf.data = simpleGlyph;
  40717. return missingGlyphData;
  40718. }
  40719. if (dupFirstEntry) {
  40720. var firstEntryLength = itemDecode(locaData, itemSize);
  40721. if (newGlyfData.length > firstEntryLength + writeOffset) {
  40722. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  40723. } else {
  40724. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  40725. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  40726. }
  40727. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  40728. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  40729. } else {
  40730. glyf.data = newGlyfData.subarray(0, writeOffset);
  40731. }
  40732. return missingGlyphData;
  40733. }
  40734. function readPostScriptTable(post, properties, maxpNumGlyphs) {
  40735. var start = (font.start ? font.start : 0) + post.offset;
  40736. font.pos = start;
  40737. var length = post.length, end = start + length;
  40738. var version = font.getInt32();
  40739. font.getBytes(28);
  40740. var glyphNames;
  40741. var valid = true;
  40742. var i;
  40743. switch (version) {
  40744. case 0x00010000:
  40745. glyphNames = MacStandardGlyphOrdering;
  40746. break;
  40747. case 0x00020000:
  40748. var numGlyphs = font.getUint16();
  40749. if (numGlyphs !== maxpNumGlyphs) {
  40750. valid = false;
  40751. break;
  40752. }
  40753. var glyphNameIndexes = [];
  40754. for (i = 0; i < numGlyphs; ++i) {
  40755. var index = font.getUint16();
  40756. if (index >= 32768) {
  40757. valid = false;
  40758. break;
  40759. }
  40760. glyphNameIndexes.push(index);
  40761. }
  40762. if (!valid) {
  40763. break;
  40764. }
  40765. var customNames = [];
  40766. var strBuf = [];
  40767. while (font.pos < end) {
  40768. var stringLength = font.getByte();
  40769. strBuf.length = stringLength;
  40770. for (i = 0; i < stringLength; ++i) {
  40771. strBuf[i] = String.fromCharCode(font.getByte());
  40772. }
  40773. customNames.push(strBuf.join(''));
  40774. }
  40775. glyphNames = [];
  40776. for (i = 0; i < numGlyphs; ++i) {
  40777. var j = glyphNameIndexes[i];
  40778. if (j < 258) {
  40779. glyphNames.push(MacStandardGlyphOrdering[j]);
  40780. continue;
  40781. }
  40782. glyphNames.push(customNames[j - 258]);
  40783. }
  40784. break;
  40785. case 0x00030000:
  40786. break;
  40787. default:
  40788. warn('Unknown/unsupported post table version ' + version);
  40789. valid = false;
  40790. if (properties.defaultEncoding) {
  40791. glyphNames = properties.defaultEncoding;
  40792. }
  40793. break;
  40794. }
  40795. properties.glyphNames = glyphNames;
  40796. return valid;
  40797. }
  40798. function readNameTable(nameTable) {
  40799. var start = (font.start ? font.start : 0) + nameTable.offset;
  40800. font.pos = start;
  40801. var names = [
  40802. [],
  40803. []
  40804. ];
  40805. var length = nameTable.length, end = start + length;
  40806. var format = font.getUint16();
  40807. var FORMAT_0_HEADER_LENGTH = 6;
  40808. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  40809. return names;
  40810. }
  40811. var numRecords = font.getUint16();
  40812. var stringsStart = font.getUint16();
  40813. var records = [];
  40814. var NAME_RECORD_LENGTH = 12;
  40815. var i, ii;
  40816. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  40817. var r = {
  40818. platform: font.getUint16(),
  40819. encoding: font.getUint16(),
  40820. language: font.getUint16(),
  40821. name: font.getUint16(),
  40822. length: font.getUint16(),
  40823. offset: font.getUint16()
  40824. };
  40825. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  40826. records.push(r);
  40827. }
  40828. }
  40829. for (i = 0, ii = records.length; i < ii; i++) {
  40830. var record = records[i];
  40831. if (record.length <= 0) {
  40832. continue;
  40833. }
  40834. var pos = start + stringsStart + record.offset;
  40835. if (pos + record.length > end) {
  40836. continue;
  40837. }
  40838. font.pos = pos;
  40839. var nameIndex = record.name;
  40840. if (record.encoding) {
  40841. var str = '';
  40842. for (var j = 0, jj = record.length; j < jj; j += 2) {
  40843. str += String.fromCharCode(font.getUint16());
  40844. }
  40845. names[1][nameIndex] = str;
  40846. } else {
  40847. names[0][nameIndex] = bytesToString(font.getBytes(record.length));
  40848. }
  40849. }
  40850. return names;
  40851. }
  40852. var TTOpsStackDeltas = [
  40853. 0,
  40854. 0,
  40855. 0,
  40856. 0,
  40857. 0,
  40858. 0,
  40859. 0,
  40860. 0,
  40861. -2,
  40862. -2,
  40863. -2,
  40864. -2,
  40865. 0,
  40866. 0,
  40867. -2,
  40868. -5,
  40869. -1,
  40870. -1,
  40871. -1,
  40872. -1,
  40873. -1,
  40874. -1,
  40875. -1,
  40876. -1,
  40877. 0,
  40878. 0,
  40879. -1,
  40880. 0,
  40881. -1,
  40882. -1,
  40883. -1,
  40884. -1,
  40885. 1,
  40886. -1,
  40887. -999,
  40888. 0,
  40889. 1,
  40890. 0,
  40891. -1,
  40892. -2,
  40893. 0,
  40894. -1,
  40895. -2,
  40896. -1,
  40897. -1,
  40898. 0,
  40899. -1,
  40900. -1,
  40901. 0,
  40902. 0,
  40903. -999,
  40904. -999,
  40905. -1,
  40906. -1,
  40907. -1,
  40908. -1,
  40909. -2,
  40910. -999,
  40911. -2,
  40912. -2,
  40913. -999,
  40914. 0,
  40915. -2,
  40916. -2,
  40917. 0,
  40918. 0,
  40919. -2,
  40920. 0,
  40921. -2,
  40922. 0,
  40923. 0,
  40924. 0,
  40925. -2,
  40926. -1,
  40927. -1,
  40928. 1,
  40929. 1,
  40930. 0,
  40931. 0,
  40932. -1,
  40933. -1,
  40934. -1,
  40935. -1,
  40936. -1,
  40937. -1,
  40938. -1,
  40939. 0,
  40940. 0,
  40941. -1,
  40942. 0,
  40943. -1,
  40944. -1,
  40945. 0,
  40946. -999,
  40947. -1,
  40948. -1,
  40949. -1,
  40950. -1,
  40951. -1,
  40952. -1,
  40953. 0,
  40954. 0,
  40955. 0,
  40956. 0,
  40957. 0,
  40958. 0,
  40959. 0,
  40960. 0,
  40961. 0,
  40962. 0,
  40963. 0,
  40964. 0,
  40965. -2,
  40966. -999,
  40967. -999,
  40968. -999,
  40969. -999,
  40970. -999,
  40971. -1,
  40972. -1,
  40973. -2,
  40974. -2,
  40975. 0,
  40976. 0,
  40977. 0,
  40978. 0,
  40979. -1,
  40980. -1,
  40981. -999,
  40982. -2,
  40983. -2,
  40984. 0,
  40985. 0,
  40986. -1,
  40987. -2,
  40988. -2,
  40989. 0,
  40990. 0,
  40991. 0,
  40992. -1,
  40993. -1,
  40994. -1,
  40995. -2
  40996. ];
  40997. function sanitizeTTProgram(table, ttContext) {
  40998. var data = table.data;
  40999. var i = 0, j, n, b, funcId, pc, lastEndf = 0, lastDeff = 0;
  41000. var stack = [];
  41001. var callstack = [];
  41002. var functionsCalled = [];
  41003. var tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  41004. var inFDEF = false, ifLevel = 0, inELSE = 0;
  41005. for (var ii = data.length; i < ii;) {
  41006. var op = data[i++];
  41007. if (op === 0x40) {
  41008. n = data[i++];
  41009. if (inFDEF || inELSE) {
  41010. i += n;
  41011. } else {
  41012. for (j = 0; j < n; j++) {
  41013. stack.push(data[i++]);
  41014. }
  41015. }
  41016. } else if (op === 0x41) {
  41017. n = data[i++];
  41018. if (inFDEF || inELSE) {
  41019. i += n * 2;
  41020. } else {
  41021. for (j = 0; j < n; j++) {
  41022. b = data[i++];
  41023. stack.push(b << 8 | data[i++]);
  41024. }
  41025. }
  41026. } else if ((op & 0xF8) === 0xB0) {
  41027. n = op - 0xB0 + 1;
  41028. if (inFDEF || inELSE) {
  41029. i += n;
  41030. } else {
  41031. for (j = 0; j < n; j++) {
  41032. stack.push(data[i++]);
  41033. }
  41034. }
  41035. } else if ((op & 0xF8) === 0xB8) {
  41036. n = op - 0xB8 + 1;
  41037. if (inFDEF || inELSE) {
  41038. i += n * 2;
  41039. } else {
  41040. for (j = 0; j < n; j++) {
  41041. b = data[i++];
  41042. stack.push(b << 8 | data[i++]);
  41043. }
  41044. }
  41045. } else if (op === 0x2B && !tooComplexToFollowFunctions) {
  41046. if (!inFDEF && !inELSE) {
  41047. funcId = stack[stack.length - 1];
  41048. ttContext.functionsUsed[funcId] = true;
  41049. if (funcId in ttContext.functionsStackDeltas) {
  41050. stack.length += ttContext.functionsStackDeltas[funcId];
  41051. } else if (funcId in ttContext.functionsDefined && functionsCalled.indexOf(funcId) < 0) {
  41052. callstack.push({
  41053. data: data,
  41054. i: i,
  41055. stackTop: stack.length - 1
  41056. });
  41057. functionsCalled.push(funcId);
  41058. pc = ttContext.functionsDefined[funcId];
  41059. if (!pc) {
  41060. warn('TT: CALL non-existent function');
  41061. ttContext.hintsValid = false;
  41062. return;
  41063. }
  41064. data = pc.data;
  41065. i = pc.i;
  41066. }
  41067. }
  41068. } else if (op === 0x2C && !tooComplexToFollowFunctions) {
  41069. if (inFDEF || inELSE) {
  41070. warn('TT: nested FDEFs not allowed');
  41071. tooComplexToFollowFunctions = true;
  41072. }
  41073. inFDEF = true;
  41074. lastDeff = i;
  41075. funcId = stack.pop();
  41076. ttContext.functionsDefined[funcId] = {
  41077. data: data,
  41078. i: i
  41079. };
  41080. } else if (op === 0x2D) {
  41081. if (inFDEF) {
  41082. inFDEF = false;
  41083. lastEndf = i;
  41084. } else {
  41085. pc = callstack.pop();
  41086. if (!pc) {
  41087. warn('TT: ENDF bad stack');
  41088. ttContext.hintsValid = false;
  41089. return;
  41090. }
  41091. funcId = functionsCalled.pop();
  41092. data = pc.data;
  41093. i = pc.i;
  41094. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  41095. }
  41096. } else if (op === 0x89) {
  41097. if (inFDEF || inELSE) {
  41098. warn('TT: nested IDEFs not allowed');
  41099. tooComplexToFollowFunctions = true;
  41100. }
  41101. inFDEF = true;
  41102. lastDeff = i;
  41103. } else if (op === 0x58) {
  41104. ++ifLevel;
  41105. } else if (op === 0x1B) {
  41106. inELSE = ifLevel;
  41107. } else if (op === 0x59) {
  41108. if (inELSE === ifLevel) {
  41109. inELSE = 0;
  41110. }
  41111. --ifLevel;
  41112. } else if (op === 0x1C) {
  41113. if (!inFDEF && !inELSE) {
  41114. var offset = stack[stack.length - 1];
  41115. if (offset > 0) {
  41116. i += offset - 1;
  41117. }
  41118. }
  41119. }
  41120. if (!inFDEF && !inELSE) {
  41121. var stackDelta = op <= 0x8E ? TTOpsStackDeltas[op] : op >= 0xC0 && op <= 0xDF ? -1 : op >= 0xE0 ? -2 : 0;
  41122. if (op >= 0x71 && op <= 0x75) {
  41123. n = stack.pop();
  41124. if (!isNaN(n)) {
  41125. stackDelta = -n * 2;
  41126. }
  41127. }
  41128. while (stackDelta < 0 && stack.length > 0) {
  41129. stack.pop();
  41130. stackDelta++;
  41131. }
  41132. while (stackDelta > 0) {
  41133. stack.push(NaN);
  41134. stackDelta--;
  41135. }
  41136. }
  41137. }
  41138. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  41139. var content = [data];
  41140. if (i > data.length) {
  41141. content.push(new Uint8Array(i - data.length));
  41142. }
  41143. if (lastDeff > lastEndf) {
  41144. warn('TT: complementing a missing function tail');
  41145. content.push(new Uint8Array([
  41146. 0x22,
  41147. 0x2D
  41148. ]));
  41149. }
  41150. foldTTTable(table, content);
  41151. }
  41152. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  41153. if (ttContext.tooComplexToFollowFunctions) {
  41154. return;
  41155. }
  41156. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  41157. warn('TT: more functions defined than expected');
  41158. ttContext.hintsValid = false;
  41159. return;
  41160. }
  41161. for (var j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  41162. if (j > maxFunctionDefs) {
  41163. warn('TT: invalid function id: ' + j);
  41164. ttContext.hintsValid = false;
  41165. return;
  41166. }
  41167. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  41168. warn('TT: undefined function: ' + j);
  41169. ttContext.hintsValid = false;
  41170. return;
  41171. }
  41172. }
  41173. }
  41174. function foldTTTable(table, content) {
  41175. if (content.length > 1) {
  41176. var newLength = 0;
  41177. var j, jj;
  41178. for (j = 0, jj = content.length; j < jj; j++) {
  41179. newLength += content[j].length;
  41180. }
  41181. newLength = newLength + 3 & ~3;
  41182. var result = new Uint8Array(newLength);
  41183. var pos = 0;
  41184. for (j = 0, jj = content.length; j < jj; j++) {
  41185. result.set(content[j], pos);
  41186. pos += content[j].length;
  41187. }
  41188. table.data = result;
  41189. table.length = newLength;
  41190. }
  41191. }
  41192. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  41193. var ttContext = {
  41194. functionsDefined: [],
  41195. functionsUsed: [],
  41196. functionsStackDeltas: [],
  41197. tooComplexToFollowFunctions: false,
  41198. hintsValid: true
  41199. };
  41200. if (fpgm) {
  41201. sanitizeTTProgram(fpgm, ttContext);
  41202. }
  41203. if (prep) {
  41204. sanitizeTTProgram(prep, ttContext);
  41205. }
  41206. if (fpgm) {
  41207. checkInvalidFunctions(ttContext, maxFunctionDefs);
  41208. }
  41209. if (cvt && cvt.length & 1) {
  41210. var cvtData = new Uint8Array(cvt.length + 1);
  41211. cvtData.set(cvt.data);
  41212. cvt.data = cvtData;
  41213. }
  41214. return ttContext.hintsValid;
  41215. }
  41216. font = new Stream(new Uint8Array(font.getBytes()));
  41217. var VALID_TABLES = [
  41218. 'OS/2',
  41219. 'cmap',
  41220. 'head',
  41221. 'hhea',
  41222. 'hmtx',
  41223. 'maxp',
  41224. 'name',
  41225. 'post',
  41226. 'loca',
  41227. 'glyf',
  41228. 'fpgm',
  41229. 'prep',
  41230. 'cvt ',
  41231. 'CFF '
  41232. ];
  41233. var header = readOpenTypeHeader(font);
  41234. var numTables = header.numTables;
  41235. var cff, cffFile;
  41236. var tables = Object.create(null);
  41237. tables['OS/2'] = null;
  41238. tables['cmap'] = null;
  41239. tables['head'] = null;
  41240. tables['hhea'] = null;
  41241. tables['hmtx'] = null;
  41242. tables['maxp'] = null;
  41243. tables['name'] = null;
  41244. tables['post'] = null;
  41245. var table;
  41246. for (var i = 0; i < numTables; i++) {
  41247. table = readTableEntry(font);
  41248. if (VALID_TABLES.indexOf(table.tag) < 0) {
  41249. continue;
  41250. }
  41251. if (table.length === 0) {
  41252. continue;
  41253. }
  41254. tables[table.tag] = table;
  41255. }
  41256. var isTrueType = !tables['CFF '];
  41257. if (!isTrueType) {
  41258. if (header.version === 'OTTO' && !properties.composite || !tables['head'] || !tables['hhea'] || !tables['maxp'] || !tables['post']) {
  41259. cffFile = new Stream(tables['CFF '].data);
  41260. cff = new CFFFont(cffFile, properties);
  41261. adjustWidths(properties);
  41262. return this.convert(name, cff, properties);
  41263. }
  41264. delete tables['glyf'];
  41265. delete tables['loca'];
  41266. delete tables['fpgm'];
  41267. delete tables['prep'];
  41268. delete tables['cvt '];
  41269. this.isOpenType = true;
  41270. } else {
  41271. if (!tables['loca']) {
  41272. error('Required "loca" table is not found');
  41273. }
  41274. if (!tables['glyf']) {
  41275. warn('Required "glyf" table is not found -- trying to recover.');
  41276. tables['glyf'] = {
  41277. tag: 'glyf',
  41278. data: new Uint8Array(0)
  41279. };
  41280. }
  41281. this.isOpenType = false;
  41282. }
  41283. if (!tables['maxp']) {
  41284. error('Required "maxp" table is not found');
  41285. }
  41286. font.pos = (font.start || 0) + tables['maxp'].offset;
  41287. var version = font.getInt32();
  41288. var numGlyphs = font.getUint16();
  41289. var maxFunctionDefs = 0;
  41290. if (version >= 0x00010000 && tables['maxp'].length >= 22) {
  41291. font.pos += 8;
  41292. var maxZones = font.getUint16();
  41293. if (maxZones > 2) {
  41294. tables['maxp'].data[14] = 0;
  41295. tables['maxp'].data[15] = 2;
  41296. }
  41297. font.pos += 4;
  41298. maxFunctionDefs = font.getUint16();
  41299. }
  41300. var dupFirstEntry = false;
  41301. if (properties.type === 'CIDFontType2' && properties.toUnicode && properties.toUnicode.get(0) > '\u0000') {
  41302. dupFirstEntry = true;
  41303. numGlyphs++;
  41304. tables['maxp'].data[4] = numGlyphs >> 8;
  41305. tables['maxp'].data[5] = numGlyphs & 255;
  41306. }
  41307. var hintsValid = sanitizeTTPrograms(tables['fpgm'], tables['prep'], tables['cvt '], maxFunctionDefs);
  41308. if (!hintsValid) {
  41309. delete tables['fpgm'];
  41310. delete tables['prep'];
  41311. delete tables['cvt '];
  41312. }
  41313. sanitizeMetrics(font, tables['hhea'], tables['hmtx'], numGlyphs);
  41314. if (!tables['head']) {
  41315. error('Required "head" table is not found');
  41316. }
  41317. sanitizeHead(tables['head'], numGlyphs, isTrueType ? tables['loca'].length : 0);
  41318. var missingGlyphs = Object.create(null);
  41319. if (isTrueType) {
  41320. var isGlyphLocationsLong = int16(tables['head'].data[50], tables['head'].data[51]);
  41321. missingGlyphs = sanitizeGlyphLocations(tables['loca'], tables['glyf'], numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry);
  41322. }
  41323. if (!tables['hhea']) {
  41324. error('Required "hhea" table is not found');
  41325. }
  41326. if (tables['hhea'].data[10] === 0 && tables['hhea'].data[11] === 0) {
  41327. tables['hhea'].data[10] = 0xFF;
  41328. tables['hhea'].data[11] = 0xFF;
  41329. }
  41330. var metricsOverride = {
  41331. unitsPerEm: int16(tables['head'].data[18], tables['head'].data[19]),
  41332. yMax: int16(tables['head'].data[42], tables['head'].data[43]),
  41333. yMin: signedInt16(tables['head'].data[38], tables['head'].data[39]),
  41334. ascent: int16(tables['hhea'].data[4], tables['hhea'].data[5]),
  41335. descent: signedInt16(tables['hhea'].data[6], tables['hhea'].data[7])
  41336. };
  41337. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  41338. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  41339. if (tables['post']) {
  41340. var valid = readPostScriptTable(tables['post'], properties, numGlyphs);
  41341. if (!valid) {
  41342. tables['post'] = null;
  41343. }
  41344. }
  41345. var charCodeToGlyphId = [], charCode;
  41346. var toUnicode = properties.toUnicode, widths = properties.widths;
  41347. var skipToUnicode = toUnicode instanceof IdentityToUnicodeMap || toUnicode.length === 0x10000;
  41348. function hasGlyph(glyphId, charCode, widthCode) {
  41349. if (!missingGlyphs[glyphId]) {
  41350. return true;
  41351. }
  41352. if (!skipToUnicode && charCode >= 0 && toUnicode.has(charCode)) {
  41353. return true;
  41354. }
  41355. if (widths && widthCode >= 0 && isNum(widths[widthCode])) {
  41356. return true;
  41357. }
  41358. return false;
  41359. }
  41360. if (properties.composite) {
  41361. var cidToGidMap = properties.cidToGidMap || [];
  41362. var isCidToGidMapEmpty = cidToGidMap.length === 0;
  41363. properties.cMap.forEach(function (charCode, cid) {
  41364. assert(cid <= 0xffff, 'Max size of CID is 65,535');
  41365. var glyphId = -1;
  41366. if (isCidToGidMapEmpty) {
  41367. glyphId = cid;
  41368. } else if (cidToGidMap[cid] !== undefined) {
  41369. glyphId = cidToGidMap[cid];
  41370. }
  41371. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId, charCode, cid)) {
  41372. charCodeToGlyphId[charCode] = glyphId;
  41373. }
  41374. });
  41375. if (dupFirstEntry && (isCidToGidMapEmpty || !charCodeToGlyphId[0])) {
  41376. charCodeToGlyphId[0] = numGlyphs - 1;
  41377. }
  41378. } else {
  41379. var cmapTable = readCmapTable(tables['cmap'], font, this.isSymbolicFont, properties.hasEncoding);
  41380. var cmapPlatformId = cmapTable.platformId;
  41381. var cmapEncodingId = cmapTable.encodingId;
  41382. var cmapMappings = cmapTable.mappings;
  41383. var cmapMappingsLength = cmapMappings.length;
  41384. if (properties.hasEncoding && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0) || cmapPlatformId === -1 && cmapEncodingId === -1 && !!getEncoding(properties.baseEncodingName)) {
  41385. var baseEncoding = [];
  41386. if (properties.baseEncodingName === 'MacRomanEncoding' || properties.baseEncodingName === 'WinAnsiEncoding') {
  41387. baseEncoding = getEncoding(properties.baseEncodingName);
  41388. }
  41389. var glyphsUnicodeMap = getGlyphsUnicode();
  41390. for (charCode = 0; charCode < 256; charCode++) {
  41391. var glyphName, standardGlyphName;
  41392. if (this.differences && charCode in this.differences) {
  41393. glyphName = this.differences[charCode];
  41394. } else if (charCode in baseEncoding && baseEncoding[charCode] !== '') {
  41395. glyphName = baseEncoding[charCode];
  41396. } else {
  41397. glyphName = StandardEncoding[charCode];
  41398. }
  41399. if (!glyphName) {
  41400. continue;
  41401. }
  41402. standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  41403. var unicodeOrCharCode, isUnicode = false;
  41404. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  41405. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  41406. isUnicode = true;
  41407. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  41408. unicodeOrCharCode = MacRomanEncoding.indexOf(standardGlyphName);
  41409. }
  41410. var found = false;
  41411. for (i = 0; i < cmapMappingsLength; ++i) {
  41412. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  41413. continue;
  41414. }
  41415. var code = isUnicode ? charCode : unicodeOrCharCode;
  41416. if (hasGlyph(cmapMappings[i].glyphId, code, -1)) {
  41417. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  41418. found = true;
  41419. break;
  41420. }
  41421. }
  41422. if (!found && properties.glyphNames) {
  41423. var glyphId = properties.glyphNames.indexOf(glyphName);
  41424. if (glyphId === -1 && standardGlyphName !== glyphName) {
  41425. glyphId = properties.glyphNames.indexOf(standardGlyphName);
  41426. }
  41427. if (glyphId > 0 && hasGlyph(glyphId, -1, -1)) {
  41428. charCodeToGlyphId[charCode] = glyphId;
  41429. found = true;
  41430. }
  41431. }
  41432. if (!found) {
  41433. charCodeToGlyphId[charCode] = 0;
  41434. }
  41435. }
  41436. } else if (cmapPlatformId === 0 && cmapEncodingId === 0) {
  41437. for (i = 0; i < cmapMappingsLength; ++i) {
  41438. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  41439. }
  41440. } else {
  41441. for (i = 0; i < cmapMappingsLength; ++i) {
  41442. charCode = cmapMappings[i].charCode & 0xFF;
  41443. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  41444. }
  41445. }
  41446. }
  41447. if (charCodeToGlyphId.length === 0) {
  41448. charCodeToGlyphId[0] = 0;
  41449. }
  41450. var newMapping = adjustMapping(charCodeToGlyphId, properties);
  41451. this.toFontChar = newMapping.toFontChar;
  41452. tables['cmap'] = {
  41453. tag: 'cmap',
  41454. data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphs)
  41455. };
  41456. if (!tables['OS/2'] || !validateOS2Table(tables['OS/2'])) {
  41457. tables['OS/2'] = {
  41458. tag: 'OS/2',
  41459. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  41460. };
  41461. }
  41462. if (!tables['post']) {
  41463. tables['post'] = {
  41464. tag: 'post',
  41465. data: createPostTable(properties)
  41466. };
  41467. }
  41468. if (!isTrueType) {
  41469. try {
  41470. cffFile = new Stream(tables['CFF '].data);
  41471. var parser = new CFFParser(cffFile, properties, SEAC_ANALYSIS_ENABLED);
  41472. cff = parser.parse();
  41473. var compiler = new CFFCompiler(cff);
  41474. tables['CFF '].data = compiler.compile();
  41475. } catch (e) {
  41476. warn('Failed to compile font ' + properties.loadedName);
  41477. }
  41478. }
  41479. if (!tables['name']) {
  41480. tables['name'] = {
  41481. tag: 'name',
  41482. data: createNameTable(this.name)
  41483. };
  41484. } else {
  41485. var namePrototype = readNameTable(tables['name']);
  41486. tables['name'].data = createNameTable(name, namePrototype);
  41487. }
  41488. var builder = new OpenTypeFileBuilder(header.version);
  41489. for (var tableTag in tables) {
  41490. builder.addTable(tableTag, tables[tableTag].data);
  41491. }
  41492. return builder.toArray();
  41493. },
  41494. convert: function Font_convert(fontName, font, properties) {
  41495. properties.fixedPitch = false;
  41496. if (properties.builtInEncoding) {
  41497. adjustToUnicode(properties, properties.builtInEncoding);
  41498. }
  41499. var mapping = font.getGlyphMapping(properties);
  41500. var newMapping = adjustMapping(mapping, properties);
  41501. this.toFontChar = newMapping.toFontChar;
  41502. var numGlyphs = font.numGlyphs;
  41503. function getCharCodes(charCodeToGlyphId, glyphId) {
  41504. var charCodes = null;
  41505. for (var charCode in charCodeToGlyphId) {
  41506. if (glyphId === charCodeToGlyphId[charCode]) {
  41507. if (!charCodes) {
  41508. charCodes = [];
  41509. }
  41510. charCodes.push(charCode | 0);
  41511. }
  41512. }
  41513. return charCodes;
  41514. }
  41515. function createCharCode(charCodeToGlyphId, glyphId) {
  41516. for (var charCode in charCodeToGlyphId) {
  41517. if (glyphId === charCodeToGlyphId[charCode]) {
  41518. return charCode | 0;
  41519. }
  41520. }
  41521. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  41522. return newMapping.nextAvailableFontCharCode++;
  41523. }
  41524. var seacs = font.seacs;
  41525. if (SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  41526. var matrix = properties.fontMatrix || FONT_IDENTITY_MATRIX;
  41527. var charset = font.getCharset();
  41528. var seacMap = Object.create(null);
  41529. for (var glyphId in seacs) {
  41530. glyphId |= 0;
  41531. var seac = seacs[glyphId];
  41532. var baseGlyphName = StandardEncoding[seac[2]];
  41533. var accentGlyphName = StandardEncoding[seac[3]];
  41534. var baseGlyphId = charset.indexOf(baseGlyphName);
  41535. var accentGlyphId = charset.indexOf(accentGlyphName);
  41536. if (baseGlyphId < 0 || accentGlyphId < 0) {
  41537. continue;
  41538. }
  41539. var accentOffset = {
  41540. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  41541. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  41542. };
  41543. var charCodes = getCharCodes(mapping, glyphId);
  41544. if (!charCodes) {
  41545. continue;
  41546. }
  41547. for (var i = 0, ii = charCodes.length; i < ii; i++) {
  41548. var charCode = charCodes[i];
  41549. var charCodeToGlyphId = newMapping.charCodeToGlyphId;
  41550. var baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  41551. var accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  41552. seacMap[charCode] = {
  41553. baseFontCharCode: baseFontCharCode,
  41554. accentFontCharCode: accentFontCharCode,
  41555. accentOffset: accentOffset
  41556. };
  41557. }
  41558. }
  41559. properties.seacMap = seacMap;
  41560. }
  41561. var unitsPerEm = 1 / (properties.fontMatrix || FONT_IDENTITY_MATRIX)[0];
  41562. var builder = new OpenTypeFileBuilder('\x4F\x54\x54\x4F');
  41563. builder.addTable('CFF ', font.data);
  41564. builder.addTable('OS/2', createOS2Table(properties, newMapping.charCodeToGlyphId));
  41565. builder.addTable('cmap', createCmapTable(newMapping.charCodeToGlyphId, numGlyphs));
  41566. 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');
  41567. 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));
  41568. builder.addTable('hmtx', function fontFieldsHmtx() {
  41569. var charstrings = font.charstrings;
  41570. var cffWidths = font.cff ? font.cff.widths : null;
  41571. var hmtx = '\x00\x00\x00\x00';
  41572. for (var i = 1, ii = numGlyphs; i < ii; i++) {
  41573. var width = 0;
  41574. if (charstrings) {
  41575. var charstring = charstrings[i - 1];
  41576. width = 'width' in charstring ? charstring.width : 0;
  41577. } else if (cffWidths) {
  41578. width = Math.ceil(cffWidths[i] || 0);
  41579. }
  41580. hmtx += string16(width) + string16(0);
  41581. }
  41582. return hmtx;
  41583. }());
  41584. builder.addTable('maxp', '\x00\x00\x50\x00' + string16(numGlyphs));
  41585. builder.addTable('name', createNameTable(fontName));
  41586. builder.addTable('post', createPostTable(properties));
  41587. return builder.toArray();
  41588. },
  41589. get spaceWidth() {
  41590. if ('_shadowWidth' in this) {
  41591. return this._shadowWidth;
  41592. }
  41593. var possibleSpaceReplacements = [
  41594. 'space',
  41595. 'minus',
  41596. 'one',
  41597. 'i',
  41598. 'I'
  41599. ];
  41600. var width;
  41601. for (var i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  41602. var glyphName = possibleSpaceReplacements[i];
  41603. if (glyphName in this.widths) {
  41604. width = this.widths[glyphName];
  41605. break;
  41606. }
  41607. var glyphsUnicodeMap = getGlyphsUnicode();
  41608. var glyphUnicode = glyphsUnicodeMap[glyphName];
  41609. var charcode = 0;
  41610. if (this.composite) {
  41611. if (this.cMap.contains(glyphUnicode)) {
  41612. charcode = this.cMap.lookup(glyphUnicode);
  41613. }
  41614. }
  41615. if (!charcode && this.toUnicode) {
  41616. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  41617. }
  41618. if (charcode <= 0) {
  41619. charcode = glyphUnicode;
  41620. }
  41621. width = this.widths[charcode];
  41622. if (width) {
  41623. break;
  41624. }
  41625. }
  41626. width = width || this.defaultWidth;
  41627. this._shadowWidth = width;
  41628. return width;
  41629. },
  41630. charToGlyph: function Font_charToGlyph(charcode, isSpace) {
  41631. var fontCharCode, width, operatorListId;
  41632. var widthCode = charcode;
  41633. if (this.cMap && this.cMap.contains(charcode)) {
  41634. widthCode = this.cMap.lookup(charcode);
  41635. }
  41636. width = this.widths[widthCode];
  41637. width = isNum(width) ? width : this.defaultWidth;
  41638. var vmetric = this.vmetrics && this.vmetrics[widthCode];
  41639. var unicode = this.toUnicode.get(charcode) || charcode;
  41640. if (typeof unicode === 'number') {
  41641. unicode = String.fromCharCode(unicode);
  41642. }
  41643. var isInFont = charcode in this.toFontChar;
  41644. fontCharCode = this.toFontChar[charcode] || charcode;
  41645. if (this.missingFile) {
  41646. fontCharCode = mapSpecialUnicodeValues(fontCharCode);
  41647. }
  41648. if (this.isType3Font) {
  41649. operatorListId = fontCharCode;
  41650. }
  41651. var accent = null;
  41652. if (this.seacMap && this.seacMap[charcode]) {
  41653. isInFont = true;
  41654. var seac = this.seacMap[charcode];
  41655. fontCharCode = seac.baseFontCharCode;
  41656. accent = {
  41657. fontChar: String.fromCharCode(seac.accentFontCharCode),
  41658. offset: seac.accentOffset
  41659. };
  41660. }
  41661. var fontChar = String.fromCharCode(fontCharCode);
  41662. var glyph = this.glyphCache[charcode];
  41663. if (!glyph || !glyph.matchesForCache(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  41664. glyph = new Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  41665. this.glyphCache[charcode] = glyph;
  41666. }
  41667. return glyph;
  41668. },
  41669. charsToGlyphs: function Font_charsToGlyphs(chars) {
  41670. var charsCache = this.charsCache;
  41671. var glyphs, glyph, charcode;
  41672. if (charsCache) {
  41673. glyphs = charsCache[chars];
  41674. if (glyphs) {
  41675. return glyphs;
  41676. }
  41677. }
  41678. if (!charsCache) {
  41679. charsCache = this.charsCache = Object.create(null);
  41680. }
  41681. glyphs = [];
  41682. var charsCacheKey = chars;
  41683. var i = 0, ii;
  41684. if (this.cMap) {
  41685. var c = Object.create(null);
  41686. while (i < chars.length) {
  41687. this.cMap.readCharCode(chars, i, c);
  41688. charcode = c.charcode;
  41689. var length = c.length;
  41690. i += length;
  41691. var isSpace = length === 1 && chars.charCodeAt(i - 1) === 0x20;
  41692. glyph = this.charToGlyph(charcode, isSpace);
  41693. glyphs.push(glyph);
  41694. }
  41695. } else {
  41696. for (i = 0, ii = chars.length; i < ii; ++i) {
  41697. charcode = chars.charCodeAt(i);
  41698. glyph = this.charToGlyph(charcode, charcode === 0x20);
  41699. glyphs.push(glyph);
  41700. }
  41701. }
  41702. return charsCache[charsCacheKey] = glyphs;
  41703. }
  41704. };
  41705. return Font;
  41706. }();
  41707. var ErrorFont = function ErrorFontClosure() {
  41708. function ErrorFont(error) {
  41709. this.error = error;
  41710. this.loadedName = 'g_font_error';
  41711. this.loading = false;
  41712. }
  41713. ErrorFont.prototype = {
  41714. charsToGlyphs: function ErrorFont_charsToGlyphs() {
  41715. return [];
  41716. },
  41717. exportData: function ErrorFont_exportData() {
  41718. return { error: this.error };
  41719. }
  41720. };
  41721. return ErrorFont;
  41722. }();
  41723. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  41724. var charCodeToGlyphId = Object.create(null);
  41725. var glyphId, charCode, baseEncoding;
  41726. var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  41727. if (properties.baseEncodingName) {
  41728. baseEncoding = getEncoding(properties.baseEncodingName);
  41729. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  41730. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  41731. if (glyphId >= 0) {
  41732. charCodeToGlyphId[charCode] = glyphId;
  41733. } else {
  41734. charCodeToGlyphId[charCode] = 0;
  41735. }
  41736. }
  41737. } else if (isSymbolicFont) {
  41738. for (charCode in builtInEncoding) {
  41739. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  41740. }
  41741. } else {
  41742. baseEncoding = StandardEncoding;
  41743. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  41744. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  41745. if (glyphId >= 0) {
  41746. charCodeToGlyphId[charCode] = glyphId;
  41747. } else {
  41748. charCodeToGlyphId[charCode] = 0;
  41749. }
  41750. }
  41751. }
  41752. var differences = properties.differences, glyphsUnicodeMap;
  41753. if (differences) {
  41754. for (charCode in differences) {
  41755. var glyphName = differences[charCode];
  41756. glyphId = glyphNames.indexOf(glyphName);
  41757. if (glyphId === -1) {
  41758. if (!glyphsUnicodeMap) {
  41759. glyphsUnicodeMap = getGlyphsUnicode();
  41760. }
  41761. var standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  41762. if (standardGlyphName !== glyphName) {
  41763. glyphId = glyphNames.indexOf(standardGlyphName);
  41764. }
  41765. }
  41766. if (glyphId >= 0) {
  41767. charCodeToGlyphId[charCode] = glyphId;
  41768. } else {
  41769. charCodeToGlyphId[charCode] = 0;
  41770. }
  41771. }
  41772. }
  41773. return charCodeToGlyphId;
  41774. }
  41775. var Type1Font = function Type1FontClosure() {
  41776. function findBlock(streamBytes, signature, startIndex) {
  41777. var streamBytesLength = streamBytes.length;
  41778. var signatureLength = signature.length;
  41779. var scanLength = streamBytesLength - signatureLength;
  41780. var i = startIndex, j, found = false;
  41781. while (i < scanLength) {
  41782. j = 0;
  41783. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  41784. j++;
  41785. }
  41786. if (j >= signatureLength) {
  41787. i += j;
  41788. while (i < streamBytesLength && isSpace(streamBytes[i])) {
  41789. i++;
  41790. }
  41791. found = true;
  41792. break;
  41793. }
  41794. i++;
  41795. }
  41796. return {
  41797. found: found,
  41798. length: i
  41799. };
  41800. }
  41801. function getHeaderBlock(stream, suggestedLength) {
  41802. var EEXEC_SIGNATURE = [
  41803. 0x65,
  41804. 0x65,
  41805. 0x78,
  41806. 0x65,
  41807. 0x63
  41808. ];
  41809. var streamStartPos = stream.pos;
  41810. var headerBytes, headerBytesLength, block;
  41811. try {
  41812. headerBytes = stream.getBytes(suggestedLength);
  41813. headerBytesLength = headerBytes.length;
  41814. } catch (ex) {
  41815. if (ex instanceof MissingDataException) {
  41816. throw ex;
  41817. }
  41818. }
  41819. if (headerBytesLength === suggestedLength) {
  41820. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  41821. if (block.found && block.length === suggestedLength) {
  41822. return {
  41823. stream: new Stream(headerBytes),
  41824. length: suggestedLength
  41825. };
  41826. }
  41827. }
  41828. warn('Invalid "Length1" property in Type1 font -- trying to recover.');
  41829. stream.pos = streamStartPos;
  41830. var SCAN_BLOCK_LENGTH = 2048;
  41831. var actualLength;
  41832. while (true) {
  41833. var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  41834. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  41835. if (block.length === 0) {
  41836. break;
  41837. }
  41838. stream.pos += block.length;
  41839. if (block.found) {
  41840. actualLength = stream.pos - streamStartPos;
  41841. break;
  41842. }
  41843. }
  41844. stream.pos = streamStartPos;
  41845. if (actualLength) {
  41846. return {
  41847. stream: new Stream(stream.getBytes(actualLength)),
  41848. length: actualLength
  41849. };
  41850. }
  41851. warn('Unable to recover "Length1" property in Type1 font -- using as is.');
  41852. return {
  41853. stream: new Stream(stream.getBytes(suggestedLength)),
  41854. length: suggestedLength
  41855. };
  41856. }
  41857. function getEexecBlock(stream, suggestedLength) {
  41858. var eexecBytes = stream.getBytes();
  41859. return {
  41860. stream: new Stream(eexecBytes),
  41861. length: eexecBytes.length
  41862. };
  41863. }
  41864. function Type1Font(name, file, properties) {
  41865. var PFB_HEADER_SIZE = 6;
  41866. var headerBlockLength = properties.length1;
  41867. var eexecBlockLength = properties.length2;
  41868. var pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  41869. var pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  41870. if (pfbHeaderPresent) {
  41871. file.skip(PFB_HEADER_SIZE);
  41872. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  41873. }
  41874. var headerBlock = getHeaderBlock(file, headerBlockLength);
  41875. headerBlockLength = headerBlock.length;
  41876. var headerBlockParser = new Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED);
  41877. headerBlockParser.extractFontHeader(properties);
  41878. if (pfbHeaderPresent) {
  41879. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  41880. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  41881. }
  41882. var eexecBlock = getEexecBlock(file, eexecBlockLength);
  41883. eexecBlockLength = eexecBlock.length;
  41884. var eexecBlockParser = new Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED);
  41885. var data = eexecBlockParser.extractFontProgram();
  41886. for (var info in data.properties) {
  41887. properties[info] = data.properties[info];
  41888. }
  41889. var charstrings = data.charstrings;
  41890. var type2Charstrings = this.getType2Charstrings(charstrings);
  41891. var subrs = this.getType2Subrs(data.subrs);
  41892. this.charstrings = charstrings;
  41893. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  41894. this.seacs = this.getSeacs(data.charstrings);
  41895. }
  41896. Type1Font.prototype = {
  41897. get numGlyphs() {
  41898. return this.charstrings.length + 1;
  41899. },
  41900. getCharset: function Type1Font_getCharset() {
  41901. var charset = ['.notdef'];
  41902. var charstrings = this.charstrings;
  41903. for (var glyphId = 0; glyphId < charstrings.length; glyphId++) {
  41904. charset.push(charstrings[glyphId].glyphName);
  41905. }
  41906. return charset;
  41907. },
  41908. getGlyphMapping: function Type1Font_getGlyphMapping(properties) {
  41909. var charstrings = this.charstrings;
  41910. var glyphNames = ['.notdef'], glyphId;
  41911. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  41912. glyphNames.push(charstrings[glyphId].glyphName);
  41913. }
  41914. var encoding = properties.builtInEncoding;
  41915. if (encoding) {
  41916. var builtInEncoding = Object.create(null);
  41917. for (var charCode in encoding) {
  41918. glyphId = glyphNames.indexOf(encoding[charCode]);
  41919. if (glyphId >= 0) {
  41920. builtInEncoding[charCode] = glyphId;
  41921. }
  41922. }
  41923. }
  41924. return type1FontGlyphMapping(properties, builtInEncoding, glyphNames);
  41925. },
  41926. getSeacs: function Type1Font_getSeacs(charstrings) {
  41927. var i, ii;
  41928. var seacMap = [];
  41929. for (i = 0, ii = charstrings.length; i < ii; i++) {
  41930. var charstring = charstrings[i];
  41931. if (charstring.seac) {
  41932. seacMap[i + 1] = charstring.seac;
  41933. }
  41934. }
  41935. return seacMap;
  41936. },
  41937. getType2Charstrings: function Type1Font_getType2Charstrings(type1Charstrings) {
  41938. var type2Charstrings = [];
  41939. for (var i = 0, ii = type1Charstrings.length; i < ii; i++) {
  41940. type2Charstrings.push(type1Charstrings[i].charstring);
  41941. }
  41942. return type2Charstrings;
  41943. },
  41944. getType2Subrs: function Type1Font_getType2Subrs(type1Subrs) {
  41945. var bias = 0;
  41946. var count = type1Subrs.length;
  41947. if (count < 1133) {
  41948. bias = 107;
  41949. } else if (count < 33769) {
  41950. bias = 1131;
  41951. } else {
  41952. bias = 32768;
  41953. }
  41954. var type2Subrs = [];
  41955. var i;
  41956. for (i = 0; i < bias; i++) {
  41957. type2Subrs.push([0x0B]);
  41958. }
  41959. for (i = 0; i < count; i++) {
  41960. type2Subrs.push(type1Subrs[i]);
  41961. }
  41962. return type2Subrs;
  41963. },
  41964. wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) {
  41965. var cff = new CFF();
  41966. cff.header = new CFFHeader(1, 0, 4, 4);
  41967. cff.names = [name];
  41968. var topDict = new CFFTopDict();
  41969. topDict.setByName('version', 391);
  41970. topDict.setByName('Notice', 392);
  41971. topDict.setByName('FullName', 393);
  41972. topDict.setByName('FamilyName', 394);
  41973. topDict.setByName('Weight', 395);
  41974. topDict.setByName('Encoding', null);
  41975. topDict.setByName('FontMatrix', properties.fontMatrix);
  41976. topDict.setByName('FontBBox', properties.bbox);
  41977. topDict.setByName('charset', null);
  41978. topDict.setByName('CharStrings', null);
  41979. topDict.setByName('Private', null);
  41980. cff.topDict = topDict;
  41981. var strings = new CFFStrings();
  41982. strings.add('Version 0.11');
  41983. strings.add('See original notice');
  41984. strings.add(name);
  41985. strings.add(name);
  41986. strings.add('Medium');
  41987. cff.strings = strings;
  41988. cff.globalSubrIndex = new CFFIndex();
  41989. var count = glyphs.length;
  41990. var charsetArray = [0];
  41991. var i, ii;
  41992. for (i = 0; i < count; i++) {
  41993. var index = CFFStandardStrings.indexOf(charstrings[i].glyphName);
  41994. if (index === -1) {
  41995. index = 0;
  41996. }
  41997. charsetArray.push(index >> 8 & 0xff, index & 0xff);
  41998. }
  41999. cff.charset = new CFFCharset(false, 0, [], charsetArray);
  42000. var charStringsIndex = new CFFIndex();
  42001. charStringsIndex.add([
  42002. 0x8B,
  42003. 0x0E
  42004. ]);
  42005. for (i = 0; i < count; i++) {
  42006. var glyph = glyphs[i];
  42007. if (glyph.length === 0) {
  42008. charStringsIndex.add([
  42009. 0x8B,
  42010. 0x0E
  42011. ]);
  42012. continue;
  42013. }
  42014. charStringsIndex.add(glyph);
  42015. }
  42016. cff.charStrings = charStringsIndex;
  42017. var privateDict = new CFFPrivateDict();
  42018. privateDict.setByName('Subrs', null);
  42019. var fields = [
  42020. 'BlueValues',
  42021. 'OtherBlues',
  42022. 'FamilyBlues',
  42023. 'FamilyOtherBlues',
  42024. 'StemSnapH',
  42025. 'StemSnapV',
  42026. 'BlueShift',
  42027. 'BlueFuzz',
  42028. 'BlueScale',
  42029. 'LanguageGroup',
  42030. 'ExpansionFactor',
  42031. 'ForceBold',
  42032. 'StdHW',
  42033. 'StdVW'
  42034. ];
  42035. for (i = 0, ii = fields.length; i < ii; i++) {
  42036. var field = fields[i];
  42037. if (!(field in properties.privateData)) {
  42038. continue;
  42039. }
  42040. var value = properties.privateData[field];
  42041. if (isArray(value)) {
  42042. for (var j = value.length - 1; j > 0; j--) {
  42043. value[j] -= value[j - 1];
  42044. }
  42045. }
  42046. privateDict.setByName(field, value);
  42047. }
  42048. cff.topDict.privateDict = privateDict;
  42049. var subrIndex = new CFFIndex();
  42050. for (i = 0, ii = subrs.length; i < ii; i++) {
  42051. subrIndex.add(subrs[i]);
  42052. }
  42053. privateDict.subrsIndex = subrIndex;
  42054. var compiler = new CFFCompiler(cff);
  42055. return compiler.compile();
  42056. }
  42057. };
  42058. return Type1Font;
  42059. }();
  42060. var CFFFont = function CFFFontClosure() {
  42061. function CFFFont(file, properties) {
  42062. this.properties = properties;
  42063. var parser = new CFFParser(file, properties, SEAC_ANALYSIS_ENABLED);
  42064. this.cff = parser.parse();
  42065. var compiler = new CFFCompiler(this.cff);
  42066. this.seacs = this.cff.seacs;
  42067. try {
  42068. this.data = compiler.compile();
  42069. } catch (e) {
  42070. warn('Failed to compile font ' + properties.loadedName);
  42071. this.data = file;
  42072. }
  42073. }
  42074. CFFFont.prototype = {
  42075. get numGlyphs() {
  42076. return this.cff.charStrings.count;
  42077. },
  42078. getCharset: function CFFFont_getCharset() {
  42079. return this.cff.charset.charset;
  42080. },
  42081. getGlyphMapping: function CFFFont_getGlyphMapping() {
  42082. var cff = this.cff;
  42083. var properties = this.properties;
  42084. var charsets = cff.charset.charset;
  42085. var charCodeToGlyphId;
  42086. var glyphId;
  42087. if (properties.composite) {
  42088. charCodeToGlyphId = Object.create(null);
  42089. if (cff.isCIDFont) {
  42090. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  42091. var cid = charsets[glyphId];
  42092. var charCode = properties.cMap.charCodeOf(cid);
  42093. charCodeToGlyphId[charCode] = glyphId;
  42094. }
  42095. } else {
  42096. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  42097. charCodeToGlyphId[glyphId] = glyphId;
  42098. }
  42099. }
  42100. return charCodeToGlyphId;
  42101. }
  42102. var encoding = cff.encoding ? cff.encoding.encoding : null;
  42103. charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets);
  42104. return charCodeToGlyphId;
  42105. }
  42106. };
  42107. return CFFFont;
  42108. }();
  42109. (function checkSeacSupport() {
  42110. if (typeof navigator !== 'undefined' && /Windows/.test(navigator.userAgent)) {
  42111. SEAC_ANALYSIS_ENABLED = true;
  42112. }
  42113. }());
  42114. (function checkChromeWindows() {
  42115. if (typeof navigator !== 'undefined' && /Windows.*Chrome/.test(navigator.userAgent)) {
  42116. SKIP_PRIVATE_USE_RANGE_F000_TO_F01F = true;
  42117. }
  42118. }());
  42119. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  42120. exports.PRIVATE_USE_OFFSET_START = PRIVATE_USE_OFFSET_START;
  42121. exports.PRIVATE_USE_OFFSET_END = PRIVATE_USE_OFFSET_END;
  42122. exports.ErrorFont = ErrorFont;
  42123. exports.Font = Font;
  42124. exports.FontFlags = FontFlags;
  42125. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  42126. exports.ProblematicCharRanges = ProblematicCharRanges;
  42127. exports.ToUnicodeMap = ToUnicodeMap;
  42128. exports.getFontType = getFontType;
  42129. /***/ }),
  42130. /* 27 */
  42131. /***/ (function(module, exports, __w_pdfjs_require__) {
  42132. "use strict";
  42133. var sharedUtil = __w_pdfjs_require__(0);
  42134. var corePrimitives = __w_pdfjs_require__(1);
  42135. var coreColorSpace = __w_pdfjs_require__(3);
  42136. var coreStream = __w_pdfjs_require__(2);
  42137. var coreJpx = __w_pdfjs_require__(15);
  42138. var ImageKind = sharedUtil.ImageKind;
  42139. var assert = sharedUtil.assert;
  42140. var error = sharedUtil.error;
  42141. var info = sharedUtil.info;
  42142. var isArray = sharedUtil.isArray;
  42143. var warn = sharedUtil.warn;
  42144. var Name = corePrimitives.Name;
  42145. var isStream = corePrimitives.isStream;
  42146. var ColorSpace = coreColorSpace.ColorSpace;
  42147. var DecodeStream = coreStream.DecodeStream;
  42148. var JpegStream = coreStream.JpegStream;
  42149. var JpxImage = coreJpx.JpxImage;
  42150. var PDFImage = function PDFImageClosure() {
  42151. function handleImageData(image, nativeDecoder) {
  42152. if (nativeDecoder && nativeDecoder.canDecode(image)) {
  42153. return nativeDecoder.decode(image);
  42154. }
  42155. return Promise.resolve(image);
  42156. }
  42157. function decodeAndClamp(value, addend, coefficient, max) {
  42158. value = addend + value * coefficient;
  42159. return value < 0 ? 0 : value > max ? max : value;
  42160. }
  42161. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  42162. var length = w2 * h2;
  42163. var dest = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
  42164. var xRatio = w1 / w2;
  42165. var yRatio = h1 / h2;
  42166. var i, j, py, newIndex = 0, oldIndex;
  42167. var xScaled = new Uint16Array(w2);
  42168. var w1Scanline = w1;
  42169. for (i = 0; i < w2; i++) {
  42170. xScaled[i] = Math.floor(i * xRatio);
  42171. }
  42172. for (i = 0; i < h2; i++) {
  42173. py = Math.floor(i * yRatio) * w1Scanline;
  42174. for (j = 0; j < w2; j++) {
  42175. oldIndex = py + xScaled[j];
  42176. dest[newIndex++] = src[oldIndex];
  42177. }
  42178. }
  42179. return dest;
  42180. }
  42181. function PDFImage(xref, res, image, inline, smask, mask, isMask) {
  42182. this.image = image;
  42183. var dict = image.dict;
  42184. if (dict.has('Filter')) {
  42185. var filter = dict.get('Filter').name;
  42186. if (filter === 'JPXDecode') {
  42187. var jpxImage = new JpxImage();
  42188. jpxImage.parseImageProperties(image.stream);
  42189. image.stream.reset();
  42190. image.bitsPerComponent = jpxImage.bitsPerComponent;
  42191. image.numComps = jpxImage.componentsCount;
  42192. } else if (filter === 'JBIG2Decode') {
  42193. image.bitsPerComponent = 1;
  42194. image.numComps = 1;
  42195. }
  42196. }
  42197. this.width = dict.get('Width', 'W');
  42198. this.height = dict.get('Height', 'H');
  42199. if (this.width < 1 || this.height < 1) {
  42200. error('Invalid image width: ' + this.width + ' or height: ' + this.height);
  42201. }
  42202. this.interpolate = dict.get('Interpolate', 'I') || false;
  42203. this.imageMask = dict.get('ImageMask', 'IM') || false;
  42204. this.matte = dict.get('Matte') || false;
  42205. var bitsPerComponent = image.bitsPerComponent;
  42206. if (!bitsPerComponent) {
  42207. bitsPerComponent = dict.get('BitsPerComponent', 'BPC');
  42208. if (!bitsPerComponent) {
  42209. if (this.imageMask) {
  42210. bitsPerComponent = 1;
  42211. } else {
  42212. error('Bits per component missing in image: ' + this.imageMask);
  42213. }
  42214. }
  42215. }
  42216. this.bpc = bitsPerComponent;
  42217. if (!this.imageMask) {
  42218. var colorSpace = dict.get('ColorSpace', 'CS');
  42219. if (!colorSpace) {
  42220. info('JPX images (which do not require color spaces)');
  42221. switch (image.numComps) {
  42222. case 1:
  42223. colorSpace = Name.get('DeviceGray');
  42224. break;
  42225. case 3:
  42226. colorSpace = Name.get('DeviceRGB');
  42227. break;
  42228. case 4:
  42229. colorSpace = Name.get('DeviceCMYK');
  42230. break;
  42231. default:
  42232. error('JPX images with ' + this.numComps + ' color components not supported.');
  42233. }
  42234. }
  42235. this.colorSpace = ColorSpace.parse(colorSpace, xref, res);
  42236. this.numComps = this.colorSpace.numComps;
  42237. }
  42238. this.decode = dict.getArray('Decode', 'D');
  42239. this.needsDecode = false;
  42240. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode) || isMask && !ColorSpace.isDefaultDecode(this.decode, 1))) {
  42241. this.needsDecode = true;
  42242. var max = (1 << bitsPerComponent) - 1;
  42243. this.decodeCoefficients = [];
  42244. this.decodeAddends = [];
  42245. for (var i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  42246. var dmin = this.decode[i];
  42247. var dmax = this.decode[i + 1];
  42248. this.decodeCoefficients[j] = dmax - dmin;
  42249. this.decodeAddends[j] = max * dmin;
  42250. }
  42251. }
  42252. if (smask) {
  42253. this.smask = new PDFImage(xref, res, smask, false);
  42254. } else if (mask) {
  42255. if (isStream(mask)) {
  42256. var maskDict = mask.dict, imageMask = maskDict.get('ImageMask', 'IM');
  42257. if (!imageMask) {
  42258. warn('Ignoring /Mask in image without /ImageMask.');
  42259. } else {
  42260. this.mask = new PDFImage(xref, res, mask, false, null, null, true);
  42261. }
  42262. } else {
  42263. this.mask = mask;
  42264. }
  42265. }
  42266. }
  42267. PDFImage.buildImage = function PDFImage_buildImage(handler, xref, res, image, inline, nativeDecoder) {
  42268. var imagePromise = handleImageData(image, nativeDecoder);
  42269. var smaskPromise;
  42270. var maskPromise;
  42271. var smask = image.dict.get('SMask');
  42272. var mask = image.dict.get('Mask');
  42273. if (smask) {
  42274. smaskPromise = handleImageData(smask, nativeDecoder);
  42275. maskPromise = Promise.resolve(null);
  42276. } else {
  42277. smaskPromise = Promise.resolve(null);
  42278. if (mask) {
  42279. if (isStream(mask)) {
  42280. maskPromise = handleImageData(mask, nativeDecoder);
  42281. } else if (isArray(mask)) {
  42282. maskPromise = Promise.resolve(mask);
  42283. } else {
  42284. warn('Unsupported mask format.');
  42285. maskPromise = Promise.resolve(null);
  42286. }
  42287. } else {
  42288. maskPromise = Promise.resolve(null);
  42289. }
  42290. }
  42291. return Promise.all([
  42292. imagePromise,
  42293. smaskPromise,
  42294. maskPromise
  42295. ]).then(function (results) {
  42296. var imageData = results[0];
  42297. var smaskData = results[1];
  42298. var maskData = results[2];
  42299. return new PDFImage(xref, res, imageData, inline, smaskData, maskData);
  42300. });
  42301. };
  42302. PDFImage.createMask = function PDFImage_createMask(imgArray, width, height, imageIsFromDecodeStream, inverseDecode) {
  42303. var computedLength = (width + 7 >> 3) * height;
  42304. var actualLength = imgArray.byteLength;
  42305. var haveFullData = computedLength === actualLength;
  42306. var data, i;
  42307. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  42308. data = imgArray;
  42309. } else if (!inverseDecode) {
  42310. data = new Uint8Array(actualLength);
  42311. data.set(imgArray);
  42312. } else {
  42313. data = new Uint8Array(computedLength);
  42314. data.set(imgArray);
  42315. for (i = actualLength; i < computedLength; i++) {
  42316. data[i] = 0xff;
  42317. }
  42318. }
  42319. if (inverseDecode) {
  42320. for (i = 0; i < actualLength; i++) {
  42321. data[i] = ~data[i];
  42322. }
  42323. }
  42324. return {
  42325. data: data,
  42326. width: width,
  42327. height: height
  42328. };
  42329. };
  42330. PDFImage.prototype = {
  42331. get drawWidth() {
  42332. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  42333. },
  42334. get drawHeight() {
  42335. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  42336. },
  42337. decodeBuffer: function PDFImage_decodeBuffer(buffer) {
  42338. var bpc = this.bpc;
  42339. var numComps = this.numComps;
  42340. var decodeAddends = this.decodeAddends;
  42341. var decodeCoefficients = this.decodeCoefficients;
  42342. var max = (1 << bpc) - 1;
  42343. var i, ii;
  42344. if (bpc === 1) {
  42345. for (i = 0, ii = buffer.length; i < ii; i++) {
  42346. buffer[i] = +!buffer[i];
  42347. }
  42348. return;
  42349. }
  42350. var index = 0;
  42351. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  42352. for (var j = 0; j < numComps; j++) {
  42353. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  42354. index++;
  42355. }
  42356. }
  42357. },
  42358. getComponents: function PDFImage_getComponents(buffer) {
  42359. var bpc = this.bpc;
  42360. if (bpc === 8) {
  42361. return buffer;
  42362. }
  42363. var width = this.width;
  42364. var height = this.height;
  42365. var numComps = this.numComps;
  42366. var length = width * height * numComps;
  42367. var bufferPos = 0;
  42368. var output = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
  42369. var rowComps = width * numComps;
  42370. var max = (1 << bpc) - 1;
  42371. var i = 0, ii, buf;
  42372. if (bpc === 1) {
  42373. var mask, loop1End, loop2End;
  42374. for (var j = 0; j < height; j++) {
  42375. loop1End = i + (rowComps & ~7);
  42376. loop2End = i + rowComps;
  42377. while (i < loop1End) {
  42378. buf = buffer[bufferPos++];
  42379. output[i] = buf >> 7 & 1;
  42380. output[i + 1] = buf >> 6 & 1;
  42381. output[i + 2] = buf >> 5 & 1;
  42382. output[i + 3] = buf >> 4 & 1;
  42383. output[i + 4] = buf >> 3 & 1;
  42384. output[i + 5] = buf >> 2 & 1;
  42385. output[i + 6] = buf >> 1 & 1;
  42386. output[i + 7] = buf & 1;
  42387. i += 8;
  42388. }
  42389. if (i < loop2End) {
  42390. buf = buffer[bufferPos++];
  42391. mask = 128;
  42392. while (i < loop2End) {
  42393. output[i++] = +!!(buf & mask);
  42394. mask >>= 1;
  42395. }
  42396. }
  42397. }
  42398. } else {
  42399. var bits = 0;
  42400. buf = 0;
  42401. for (i = 0, ii = length; i < ii; ++i) {
  42402. if (i % rowComps === 0) {
  42403. buf = 0;
  42404. bits = 0;
  42405. }
  42406. while (bits < bpc) {
  42407. buf = buf << 8 | buffer[bufferPos++];
  42408. bits += 8;
  42409. }
  42410. var remainingBits = bits - bpc;
  42411. var value = buf >> remainingBits;
  42412. output[i] = value < 0 ? 0 : value > max ? max : value;
  42413. buf = buf & (1 << remainingBits) - 1;
  42414. bits = remainingBits;
  42415. }
  42416. }
  42417. return output;
  42418. },
  42419. fillOpacity: function PDFImage_fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  42420. var smask = this.smask;
  42421. var mask = this.mask;
  42422. var alphaBuf, sw, sh, i, ii, j;
  42423. if (smask) {
  42424. sw = smask.width;
  42425. sh = smask.height;
  42426. alphaBuf = new Uint8Array(sw * sh);
  42427. smask.fillGrayBuffer(alphaBuf);
  42428. if (sw !== width || sh !== height) {
  42429. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  42430. }
  42431. } else if (mask) {
  42432. if (mask instanceof PDFImage) {
  42433. sw = mask.width;
  42434. sh = mask.height;
  42435. alphaBuf = new Uint8Array(sw * sh);
  42436. mask.numComps = 1;
  42437. mask.fillGrayBuffer(alphaBuf);
  42438. for (i = 0, ii = sw * sh; i < ii; ++i) {
  42439. alphaBuf[i] = 255 - alphaBuf[i];
  42440. }
  42441. if (sw !== width || sh !== height) {
  42442. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  42443. }
  42444. } else if (isArray(mask)) {
  42445. alphaBuf = new Uint8Array(width * height);
  42446. var numComps = this.numComps;
  42447. for (i = 0, ii = width * height; i < ii; ++i) {
  42448. var opacity = 0;
  42449. var imageOffset = i * numComps;
  42450. for (j = 0; j < numComps; ++j) {
  42451. var color = image[imageOffset + j];
  42452. var maskOffset = j * 2;
  42453. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  42454. opacity = 255;
  42455. break;
  42456. }
  42457. }
  42458. alphaBuf[i] = opacity;
  42459. }
  42460. } else {
  42461. error('Unknown mask format.');
  42462. }
  42463. }
  42464. if (alphaBuf) {
  42465. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  42466. rgbaBuf[j] = alphaBuf[i];
  42467. }
  42468. } else {
  42469. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  42470. rgbaBuf[j] = 255;
  42471. }
  42472. }
  42473. },
  42474. undoPreblend: function PDFImage_undoPreblend(buffer, width, height) {
  42475. var matte = this.smask && this.smask.matte;
  42476. if (!matte) {
  42477. return;
  42478. }
  42479. var matteRgb = this.colorSpace.getRgb(matte, 0);
  42480. var matteR = matteRgb[0];
  42481. var matteG = matteRgb[1];
  42482. var matteB = matteRgb[2];
  42483. var length = width * height * 4;
  42484. var r, g, b;
  42485. for (var i = 0; i < length; i += 4) {
  42486. var alpha = buffer[i + 3];
  42487. if (alpha === 0) {
  42488. buffer[i] = 255;
  42489. buffer[i + 1] = 255;
  42490. buffer[i + 2] = 255;
  42491. continue;
  42492. }
  42493. var k = 255 / alpha;
  42494. r = (buffer[i] - matteR) * k + matteR;
  42495. g = (buffer[i + 1] - matteG) * k + matteG;
  42496. b = (buffer[i + 2] - matteB) * k + matteB;
  42497. buffer[i] = r <= 0 ? 0 : r >= 255 ? 255 : r | 0;
  42498. buffer[i + 1] = g <= 0 ? 0 : g >= 255 ? 255 : g | 0;
  42499. buffer[i + 2] = b <= 0 ? 0 : b >= 255 ? 255 : b | 0;
  42500. }
  42501. },
  42502. createImageData: function PDFImage_createImageData(forceRGBA) {
  42503. var drawWidth = this.drawWidth;
  42504. var drawHeight = this.drawHeight;
  42505. var imgData = {
  42506. width: drawWidth,
  42507. height: drawHeight
  42508. };
  42509. var numComps = this.numComps;
  42510. var originalWidth = this.width;
  42511. var originalHeight = this.height;
  42512. var bpc = this.bpc;
  42513. var rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  42514. var imgArray;
  42515. if (!forceRGBA) {
  42516. var kind;
  42517. if (this.colorSpace.name === 'DeviceGray' && bpc === 1) {
  42518. kind = ImageKind.GRAYSCALE_1BPP;
  42519. } else if (this.colorSpace.name === 'DeviceRGB' && bpc === 8 && !this.needsDecode) {
  42520. kind = ImageKind.RGB_24BPP;
  42521. }
  42522. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  42523. imgData.kind = kind;
  42524. imgArray = this.getImageBytes(originalHeight * rowBytes);
  42525. if (this.image instanceof DecodeStream) {
  42526. imgData.data = imgArray;
  42527. } else {
  42528. var newArray = new Uint8Array(imgArray.length);
  42529. newArray.set(imgArray);
  42530. imgData.data = newArray;
  42531. }
  42532. if (this.needsDecode) {
  42533. assert(kind === ImageKind.GRAYSCALE_1BPP);
  42534. var buffer = imgData.data;
  42535. for (var i = 0, ii = buffer.length; i < ii; i++) {
  42536. buffer[i] ^= 0xff;
  42537. }
  42538. }
  42539. return imgData;
  42540. }
  42541. if (this.image instanceof JpegStream && !this.smask && !this.mask && (this.colorSpace.name === 'DeviceGray' || this.colorSpace.name === 'DeviceRGB' || this.colorSpace.name === 'DeviceCMYK')) {
  42542. imgData.kind = ImageKind.RGB_24BPP;
  42543. imgData.data = this.getImageBytes(originalHeight * rowBytes, drawWidth, drawHeight, true);
  42544. return imgData;
  42545. }
  42546. }
  42547. imgArray = this.getImageBytes(originalHeight * rowBytes);
  42548. var actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  42549. var comps = this.getComponents(imgArray);
  42550. var alpha01, maybeUndoPreblend;
  42551. if (!forceRGBA && !this.smask && !this.mask) {
  42552. imgData.kind = ImageKind.RGB_24BPP;
  42553. imgData.data = new Uint8Array(drawWidth * drawHeight * 3);
  42554. alpha01 = 0;
  42555. maybeUndoPreblend = false;
  42556. } else {
  42557. imgData.kind = ImageKind.RGBA_32BPP;
  42558. imgData.data = new Uint8Array(drawWidth * drawHeight * 4);
  42559. alpha01 = 1;
  42560. maybeUndoPreblend = true;
  42561. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  42562. }
  42563. if (this.needsDecode) {
  42564. this.decodeBuffer(comps);
  42565. }
  42566. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  42567. if (maybeUndoPreblend) {
  42568. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  42569. }
  42570. return imgData;
  42571. },
  42572. fillGrayBuffer: function PDFImage_fillGrayBuffer(buffer) {
  42573. var numComps = this.numComps;
  42574. if (numComps !== 1) {
  42575. error('Reading gray scale from a color image: ' + numComps);
  42576. }
  42577. var width = this.width;
  42578. var height = this.height;
  42579. var bpc = this.bpc;
  42580. var rowBytes = width * numComps * bpc + 7 >> 3;
  42581. var imgArray = this.getImageBytes(height * rowBytes);
  42582. var comps = this.getComponents(imgArray);
  42583. var i, length;
  42584. if (bpc === 1) {
  42585. length = width * height;
  42586. if (this.needsDecode) {
  42587. for (i = 0; i < length; ++i) {
  42588. buffer[i] = comps[i] - 1 & 255;
  42589. }
  42590. } else {
  42591. for (i = 0; i < length; ++i) {
  42592. buffer[i] = -comps[i] & 255;
  42593. }
  42594. }
  42595. return;
  42596. }
  42597. if (this.needsDecode) {
  42598. this.decodeBuffer(comps);
  42599. }
  42600. length = width * height;
  42601. var scale = 255 / ((1 << bpc) - 1);
  42602. for (i = 0; i < length; ++i) {
  42603. buffer[i] = scale * comps[i] | 0;
  42604. }
  42605. },
  42606. getImageBytes: function PDFImage_getImageBytes(length, drawWidth, drawHeight, forceRGB) {
  42607. this.image.reset();
  42608. this.image.drawWidth = drawWidth || this.width;
  42609. this.image.drawHeight = drawHeight || this.height;
  42610. this.image.forceRGB = !!forceRGB;
  42611. return this.image.getBytes(length);
  42612. }
  42613. };
  42614. return PDFImage;
  42615. }();
  42616. exports.PDFImage = PDFImage;
  42617. /***/ }),
  42618. /* 28 */
  42619. /***/ (function(module, exports, __w_pdfjs_require__) {
  42620. "use strict";
  42621. var sharedUtil = __w_pdfjs_require__(0);
  42622. var coreArithmeticDecoder = __w_pdfjs_require__(10);
  42623. var error = sharedUtil.error;
  42624. var log2 = sharedUtil.log2;
  42625. var readInt8 = sharedUtil.readInt8;
  42626. var readUint16 = sharedUtil.readUint16;
  42627. var readUint32 = sharedUtil.readUint32;
  42628. var shadow = sharedUtil.shadow;
  42629. var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder;
  42630. var Jbig2Image = function Jbig2ImageClosure() {
  42631. function ContextCache() {
  42632. }
  42633. ContextCache.prototype = {
  42634. getContexts: function (id) {
  42635. if (id in this) {
  42636. return this[id];
  42637. }
  42638. return this[id] = new Int8Array(1 << 16);
  42639. }
  42640. };
  42641. function DecodingContext(data, start, end) {
  42642. this.data = data;
  42643. this.start = start;
  42644. this.end = end;
  42645. }
  42646. DecodingContext.prototype = {
  42647. get decoder() {
  42648. var decoder = new ArithmeticDecoder(this.data, this.start, this.end);
  42649. return shadow(this, 'decoder', decoder);
  42650. },
  42651. get contextCache() {
  42652. var cache = new ContextCache();
  42653. return shadow(this, 'contextCache', cache);
  42654. }
  42655. };
  42656. function decodeInteger(contextCache, procedure, decoder) {
  42657. var contexts = contextCache.getContexts(procedure);
  42658. var prev = 1;
  42659. function readBits(length) {
  42660. var v = 0;
  42661. for (var i = 0; i < length; i++) {
  42662. var bit = decoder.readBit(contexts, prev);
  42663. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  42664. v = v << 1 | bit;
  42665. }
  42666. return v >>> 0;
  42667. }
  42668. var sign = readBits(1);
  42669. 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);
  42670. return sign === 0 ? value : value > 0 ? -value : null;
  42671. }
  42672. function decodeIAID(contextCache, decoder, codeLength) {
  42673. var contexts = contextCache.getContexts('IAID');
  42674. var prev = 1;
  42675. for (var i = 0; i < codeLength; i++) {
  42676. var bit = decoder.readBit(contexts, prev);
  42677. prev = prev << 1 | bit;
  42678. }
  42679. if (codeLength < 31) {
  42680. return prev & (1 << codeLength) - 1;
  42681. }
  42682. return prev & 0x7FFFFFFF;
  42683. }
  42684. var SegmentTypes = [
  42685. 'SymbolDictionary',
  42686. null,
  42687. null,
  42688. null,
  42689. 'IntermediateTextRegion',
  42690. null,
  42691. 'ImmediateTextRegion',
  42692. 'ImmediateLosslessTextRegion',
  42693. null,
  42694. null,
  42695. null,
  42696. null,
  42697. null,
  42698. null,
  42699. null,
  42700. null,
  42701. 'patternDictionary',
  42702. null,
  42703. null,
  42704. null,
  42705. 'IntermediateHalftoneRegion',
  42706. null,
  42707. 'ImmediateHalftoneRegion',
  42708. 'ImmediateLosslessHalftoneRegion',
  42709. null,
  42710. null,
  42711. null,
  42712. null,
  42713. null,
  42714. null,
  42715. null,
  42716. null,
  42717. null,
  42718. null,
  42719. null,
  42720. null,
  42721. 'IntermediateGenericRegion',
  42722. null,
  42723. 'ImmediateGenericRegion',
  42724. 'ImmediateLosslessGenericRegion',
  42725. 'IntermediateGenericRefinementRegion',
  42726. null,
  42727. 'ImmediateGenericRefinementRegion',
  42728. 'ImmediateLosslessGenericRefinementRegion',
  42729. null,
  42730. null,
  42731. null,
  42732. null,
  42733. 'PageInformation',
  42734. 'EndOfPage',
  42735. 'EndOfStripe',
  42736. 'EndOfFile',
  42737. 'Profiles',
  42738. 'Tables',
  42739. null,
  42740. null,
  42741. null,
  42742. null,
  42743. null,
  42744. null,
  42745. null,
  42746. null,
  42747. 'Extension'
  42748. ];
  42749. var CodingTemplates = [
  42750. [
  42751. {
  42752. x: -1,
  42753. y: -2
  42754. },
  42755. {
  42756. x: 0,
  42757. y: -2
  42758. },
  42759. {
  42760. x: 1,
  42761. y: -2
  42762. },
  42763. {
  42764. x: -2,
  42765. y: -1
  42766. },
  42767. {
  42768. x: -1,
  42769. y: -1
  42770. },
  42771. {
  42772. x: 0,
  42773. y: -1
  42774. },
  42775. {
  42776. x: 1,
  42777. y: -1
  42778. },
  42779. {
  42780. x: 2,
  42781. y: -1
  42782. },
  42783. {
  42784. x: -4,
  42785. y: 0
  42786. },
  42787. {
  42788. x: -3,
  42789. y: 0
  42790. },
  42791. {
  42792. x: -2,
  42793. y: 0
  42794. },
  42795. {
  42796. x: -1,
  42797. y: 0
  42798. }
  42799. ],
  42800. [
  42801. {
  42802. x: -1,
  42803. y: -2
  42804. },
  42805. {
  42806. x: 0,
  42807. y: -2
  42808. },
  42809. {
  42810. x: 1,
  42811. y: -2
  42812. },
  42813. {
  42814. x: 2,
  42815. y: -2
  42816. },
  42817. {
  42818. x: -2,
  42819. y: -1
  42820. },
  42821. {
  42822. x: -1,
  42823. y: -1
  42824. },
  42825. {
  42826. x: 0,
  42827. y: -1
  42828. },
  42829. {
  42830. x: 1,
  42831. y: -1
  42832. },
  42833. {
  42834. x: 2,
  42835. y: -1
  42836. },
  42837. {
  42838. x: -3,
  42839. y: 0
  42840. },
  42841. {
  42842. x: -2,
  42843. y: 0
  42844. },
  42845. {
  42846. x: -1,
  42847. y: 0
  42848. }
  42849. ],
  42850. [
  42851. {
  42852. x: -1,
  42853. y: -2
  42854. },
  42855. {
  42856. x: 0,
  42857. y: -2
  42858. },
  42859. {
  42860. x: 1,
  42861. y: -2
  42862. },
  42863. {
  42864. x: -2,
  42865. y: -1
  42866. },
  42867. {
  42868. x: -1,
  42869. y: -1
  42870. },
  42871. {
  42872. x: 0,
  42873. y: -1
  42874. },
  42875. {
  42876. x: 1,
  42877. y: -1
  42878. },
  42879. {
  42880. x: -2,
  42881. y: 0
  42882. },
  42883. {
  42884. x: -1,
  42885. y: 0
  42886. }
  42887. ],
  42888. [
  42889. {
  42890. x: -3,
  42891. y: -1
  42892. },
  42893. {
  42894. x: -2,
  42895. y: -1
  42896. },
  42897. {
  42898. x: -1,
  42899. y: -1
  42900. },
  42901. {
  42902. x: 0,
  42903. y: -1
  42904. },
  42905. {
  42906. x: 1,
  42907. y: -1
  42908. },
  42909. {
  42910. x: -4,
  42911. y: 0
  42912. },
  42913. {
  42914. x: -3,
  42915. y: 0
  42916. },
  42917. {
  42918. x: -2,
  42919. y: 0
  42920. },
  42921. {
  42922. x: -1,
  42923. y: 0
  42924. }
  42925. ]
  42926. ];
  42927. var RefinementTemplates = [
  42928. {
  42929. coding: [
  42930. {
  42931. x: 0,
  42932. y: -1
  42933. },
  42934. {
  42935. x: 1,
  42936. y: -1
  42937. },
  42938. {
  42939. x: -1,
  42940. y: 0
  42941. }
  42942. ],
  42943. reference: [
  42944. {
  42945. x: 0,
  42946. y: -1
  42947. },
  42948. {
  42949. x: 1,
  42950. y: -1
  42951. },
  42952. {
  42953. x: -1,
  42954. y: 0
  42955. },
  42956. {
  42957. x: 0,
  42958. y: 0
  42959. },
  42960. {
  42961. x: 1,
  42962. y: 0
  42963. },
  42964. {
  42965. x: -1,
  42966. y: 1
  42967. },
  42968. {
  42969. x: 0,
  42970. y: 1
  42971. },
  42972. {
  42973. x: 1,
  42974. y: 1
  42975. }
  42976. ]
  42977. },
  42978. {
  42979. coding: [
  42980. {
  42981. x: -1,
  42982. y: -1
  42983. },
  42984. {
  42985. x: 0,
  42986. y: -1
  42987. },
  42988. {
  42989. x: 1,
  42990. y: -1
  42991. },
  42992. {
  42993. x: -1,
  42994. y: 0
  42995. }
  42996. ],
  42997. reference: [
  42998. {
  42999. x: 0,
  43000. y: -1
  43001. },
  43002. {
  43003. x: -1,
  43004. y: 0
  43005. },
  43006. {
  43007. x: 0,
  43008. y: 0
  43009. },
  43010. {
  43011. x: 1,
  43012. y: 0
  43013. },
  43014. {
  43015. x: 0,
  43016. y: 1
  43017. },
  43018. {
  43019. x: 1,
  43020. y: 1
  43021. }
  43022. ]
  43023. }
  43024. ];
  43025. var ReusedContexts = [
  43026. 0x9B25,
  43027. 0x0795,
  43028. 0x00E5,
  43029. 0x0195
  43030. ];
  43031. var RefinementReusedContexts = [
  43032. 0x0020,
  43033. 0x0008
  43034. ];
  43035. function decodeBitmapTemplate0(width, height, decodingContext) {
  43036. var decoder = decodingContext.decoder;
  43037. var contexts = decodingContext.contextCache.getContexts('GB');
  43038. var contextLabel, i, j, pixel, row, row1, row2, bitmap = [];
  43039. var OLD_PIXEL_MASK = 0x7BF7;
  43040. for (i = 0; i < height; i++) {
  43041. row = bitmap[i] = new Uint8Array(width);
  43042. row1 = i < 1 ? row : bitmap[i - 1];
  43043. row2 = i < 2 ? row : bitmap[i - 2];
  43044. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  43045. for (j = 0; j < width; j++) {
  43046. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  43047. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  43048. }
  43049. }
  43050. return bitmap;
  43051. }
  43052. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  43053. if (mmr) {
  43054. error('JBIG2 error: MMR encoding is not supported');
  43055. }
  43056. 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) {
  43057. return decodeBitmapTemplate0(width, height, decodingContext);
  43058. }
  43059. var useskip = !!skip;
  43060. var template = CodingTemplates[templateIndex].concat(at);
  43061. template.sort(function (a, b) {
  43062. return a.y - b.y || a.x - b.x;
  43063. });
  43064. var templateLength = template.length;
  43065. var templateX = new Int8Array(templateLength);
  43066. var templateY = new Int8Array(templateLength);
  43067. var changingTemplateEntries = [];
  43068. var reuseMask = 0, minX = 0, maxX = 0, minY = 0;
  43069. var c, k;
  43070. for (k = 0; k < templateLength; k++) {
  43071. templateX[k] = template[k].x;
  43072. templateY[k] = template[k].y;
  43073. minX = Math.min(minX, template[k].x);
  43074. maxX = Math.max(maxX, template[k].x);
  43075. minY = Math.min(minY, template[k].y);
  43076. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  43077. reuseMask |= 1 << templateLength - 1 - k;
  43078. } else {
  43079. changingTemplateEntries.push(k);
  43080. }
  43081. }
  43082. var changingEntriesLength = changingTemplateEntries.length;
  43083. var changingTemplateX = new Int8Array(changingEntriesLength);
  43084. var changingTemplateY = new Int8Array(changingEntriesLength);
  43085. var changingTemplateBit = new Uint16Array(changingEntriesLength);
  43086. for (c = 0; c < changingEntriesLength; c++) {
  43087. k = changingTemplateEntries[c];
  43088. changingTemplateX[c] = template[k].x;
  43089. changingTemplateY[c] = template[k].y;
  43090. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  43091. }
  43092. var sbb_left = -minX;
  43093. var sbb_top = -minY;
  43094. var sbb_right = width - maxX;
  43095. var pseudoPixelContext = ReusedContexts[templateIndex];
  43096. var row = new Uint8Array(width);
  43097. var bitmap = [];
  43098. var decoder = decodingContext.decoder;
  43099. var contexts = decodingContext.contextCache.getContexts('GB');
  43100. var ltp = 0, j, i0, j0, contextLabel = 0, bit, shift;
  43101. for (var i = 0; i < height; i++) {
  43102. if (prediction) {
  43103. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  43104. ltp ^= sltp;
  43105. if (ltp) {
  43106. bitmap.push(row);
  43107. continue;
  43108. }
  43109. }
  43110. row = new Uint8Array(row);
  43111. bitmap.push(row);
  43112. for (j = 0; j < width; j++) {
  43113. if (useskip && skip[i][j]) {
  43114. row[j] = 0;
  43115. continue;
  43116. }
  43117. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  43118. contextLabel = contextLabel << 1 & reuseMask;
  43119. for (k = 0; k < changingEntriesLength; k++) {
  43120. i0 = i + changingTemplateY[k];
  43121. j0 = j + changingTemplateX[k];
  43122. bit = bitmap[i0][j0];
  43123. if (bit) {
  43124. bit = changingTemplateBit[k];
  43125. contextLabel |= bit;
  43126. }
  43127. }
  43128. } else {
  43129. contextLabel = 0;
  43130. shift = templateLength - 1;
  43131. for (k = 0; k < templateLength; k++, shift--) {
  43132. j0 = j + templateX[k];
  43133. if (j0 >= 0 && j0 < width) {
  43134. i0 = i + templateY[k];
  43135. if (i0 >= 0) {
  43136. bit = bitmap[i0][j0];
  43137. if (bit) {
  43138. contextLabel |= bit << shift;
  43139. }
  43140. }
  43141. }
  43142. }
  43143. }
  43144. var pixel = decoder.readBit(contexts, contextLabel);
  43145. row[j] = pixel;
  43146. }
  43147. }
  43148. return bitmap;
  43149. }
  43150. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  43151. var codingTemplate = RefinementTemplates[templateIndex].coding;
  43152. if (templateIndex === 0) {
  43153. codingTemplate = codingTemplate.concat([at[0]]);
  43154. }
  43155. var codingTemplateLength = codingTemplate.length;
  43156. var codingTemplateX = new Int32Array(codingTemplateLength);
  43157. var codingTemplateY = new Int32Array(codingTemplateLength);
  43158. var k;
  43159. for (k = 0; k < codingTemplateLength; k++) {
  43160. codingTemplateX[k] = codingTemplate[k].x;
  43161. codingTemplateY[k] = codingTemplate[k].y;
  43162. }
  43163. var referenceTemplate = RefinementTemplates[templateIndex].reference;
  43164. if (templateIndex === 0) {
  43165. referenceTemplate = referenceTemplate.concat([at[1]]);
  43166. }
  43167. var referenceTemplateLength = referenceTemplate.length;
  43168. var referenceTemplateX = new Int32Array(referenceTemplateLength);
  43169. var referenceTemplateY = new Int32Array(referenceTemplateLength);
  43170. for (k = 0; k < referenceTemplateLength; k++) {
  43171. referenceTemplateX[k] = referenceTemplate[k].x;
  43172. referenceTemplateY[k] = referenceTemplate[k].y;
  43173. }
  43174. var referenceWidth = referenceBitmap[0].length;
  43175. var referenceHeight = referenceBitmap.length;
  43176. var pseudoPixelContext = RefinementReusedContexts[templateIndex];
  43177. var bitmap = [];
  43178. var decoder = decodingContext.decoder;
  43179. var contexts = decodingContext.contextCache.getContexts('GR');
  43180. var ltp = 0;
  43181. for (var i = 0; i < height; i++) {
  43182. if (prediction) {
  43183. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  43184. ltp ^= sltp;
  43185. if (ltp) {
  43186. error('JBIG2 error: prediction is not supported');
  43187. }
  43188. }
  43189. var row = new Uint8Array(width);
  43190. bitmap.push(row);
  43191. for (var j = 0; j < width; j++) {
  43192. var i0, j0;
  43193. var contextLabel = 0;
  43194. for (k = 0; k < codingTemplateLength; k++) {
  43195. i0 = i + codingTemplateY[k];
  43196. j0 = j + codingTemplateX[k];
  43197. if (i0 < 0 || j0 < 0 || j0 >= width) {
  43198. contextLabel <<= 1;
  43199. } else {
  43200. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  43201. }
  43202. }
  43203. for (k = 0; k < referenceTemplateLength; k++) {
  43204. i0 = i + referenceTemplateY[k] + offsetY;
  43205. j0 = j + referenceTemplateX[k] + offsetX;
  43206. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  43207. contextLabel <<= 1;
  43208. } else {
  43209. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  43210. }
  43211. }
  43212. var pixel = decoder.readBit(contexts, contextLabel);
  43213. row[j] = pixel;
  43214. }
  43215. }
  43216. return bitmap;
  43217. }
  43218. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext) {
  43219. if (huffman) {
  43220. error('JBIG2 error: huffman is not supported');
  43221. }
  43222. var newSymbols = [];
  43223. var currentHeight = 0;
  43224. var symbolCodeLength = log2(symbols.length + numberOfNewSymbols);
  43225. var decoder = decodingContext.decoder;
  43226. var contextCache = decodingContext.contextCache;
  43227. while (newSymbols.length < numberOfNewSymbols) {
  43228. var deltaHeight = decodeInteger(contextCache, 'IADH', decoder);
  43229. currentHeight += deltaHeight;
  43230. var currentWidth = 0;
  43231. while (true) {
  43232. var deltaWidth = decodeInteger(contextCache, 'IADW', decoder);
  43233. if (deltaWidth === null) {
  43234. break;
  43235. }
  43236. currentWidth += deltaWidth;
  43237. var bitmap;
  43238. if (refinement) {
  43239. var numberOfInstances = decodeInteger(contextCache, 'IAAI', decoder);
  43240. if (numberOfInstances > 1) {
  43241. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext);
  43242. } else {
  43243. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  43244. var rdx = decodeInteger(contextCache, 'IARDX', decoder);
  43245. var rdy = decodeInteger(contextCache, 'IARDY', decoder);
  43246. var symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  43247. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  43248. }
  43249. } else {
  43250. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  43251. }
  43252. newSymbols.push(bitmap);
  43253. }
  43254. }
  43255. var exportedSymbols = [];
  43256. var flags = [], currentFlag = false;
  43257. var totalSymbolsLength = symbols.length + numberOfNewSymbols;
  43258. while (flags.length < totalSymbolsLength) {
  43259. var runLength = decodeInteger(contextCache, 'IAEX', decoder);
  43260. while (runLength--) {
  43261. flags.push(currentFlag);
  43262. }
  43263. currentFlag = !currentFlag;
  43264. }
  43265. for (var i = 0, ii = symbols.length; i < ii; i++) {
  43266. if (flags[i]) {
  43267. exportedSymbols.push(symbols[i]);
  43268. }
  43269. }
  43270. for (var j = 0; j < numberOfNewSymbols; i++, j++) {
  43271. if (flags[i]) {
  43272. exportedSymbols.push(newSymbols[j]);
  43273. }
  43274. }
  43275. return exportedSymbols;
  43276. }
  43277. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext) {
  43278. if (huffman) {
  43279. error('JBIG2 error: huffman is not supported');
  43280. }
  43281. var bitmap = [];
  43282. var i, row;
  43283. for (i = 0; i < height; i++) {
  43284. row = new Uint8Array(width);
  43285. if (defaultPixelValue) {
  43286. for (var j = 0; j < width; j++) {
  43287. row[j] = defaultPixelValue;
  43288. }
  43289. }
  43290. bitmap.push(row);
  43291. }
  43292. var decoder = decodingContext.decoder;
  43293. var contextCache = decodingContext.contextCache;
  43294. var stripT = -decodeInteger(contextCache, 'IADT', decoder);
  43295. var firstS = 0;
  43296. i = 0;
  43297. while (i < numberOfSymbolInstances) {
  43298. var deltaT = decodeInteger(contextCache, 'IADT', decoder);
  43299. stripT += deltaT;
  43300. var deltaFirstS = decodeInteger(contextCache, 'IAFS', decoder);
  43301. firstS += deltaFirstS;
  43302. var currentS = firstS;
  43303. do {
  43304. var currentT = stripSize === 1 ? 0 : decodeInteger(contextCache, 'IAIT', decoder);
  43305. var t = stripSize * stripT + currentT;
  43306. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  43307. var applyRefinement = refinement && decodeInteger(contextCache, 'IARI', decoder);
  43308. var symbolBitmap = inputSymbols[symbolId];
  43309. var symbolWidth = symbolBitmap[0].length;
  43310. var symbolHeight = symbolBitmap.length;
  43311. if (applyRefinement) {
  43312. var rdw = decodeInteger(contextCache, 'IARDW', decoder);
  43313. var rdh = decodeInteger(contextCache, 'IARDH', decoder);
  43314. var rdx = decodeInteger(contextCache, 'IARDX', decoder);
  43315. var rdy = decodeInteger(contextCache, 'IARDY', decoder);
  43316. symbolWidth += rdw;
  43317. symbolHeight += rdh;
  43318. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  43319. }
  43320. var offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight);
  43321. var offsetS = currentS - (referenceCorner & 2 ? symbolWidth : 0);
  43322. var s2, t2, symbolRow;
  43323. if (transposed) {
  43324. for (s2 = 0; s2 < symbolHeight; s2++) {
  43325. row = bitmap[offsetS + s2];
  43326. if (!row) {
  43327. continue;
  43328. }
  43329. symbolRow = symbolBitmap[s2];
  43330. var maxWidth = Math.min(width - offsetT, symbolWidth);
  43331. switch (combinationOperator) {
  43332. case 0:
  43333. for (t2 = 0; t2 < maxWidth; t2++) {
  43334. row[offsetT + t2] |= symbolRow[t2];
  43335. }
  43336. break;
  43337. case 2:
  43338. for (t2 = 0; t2 < maxWidth; t2++) {
  43339. row[offsetT + t2] ^= symbolRow[t2];
  43340. }
  43341. break;
  43342. default:
  43343. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  43344. }
  43345. }
  43346. currentS += symbolHeight - 1;
  43347. } else {
  43348. for (t2 = 0; t2 < symbolHeight; t2++) {
  43349. row = bitmap[offsetT + t2];
  43350. if (!row) {
  43351. continue;
  43352. }
  43353. symbolRow = symbolBitmap[t2];
  43354. switch (combinationOperator) {
  43355. case 0:
  43356. for (s2 = 0; s2 < symbolWidth; s2++) {
  43357. row[offsetS + s2] |= symbolRow[s2];
  43358. }
  43359. break;
  43360. case 2:
  43361. for (s2 = 0; s2 < symbolWidth; s2++) {
  43362. row[offsetS + s2] ^= symbolRow[s2];
  43363. }
  43364. break;
  43365. default:
  43366. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  43367. }
  43368. }
  43369. currentS += symbolWidth - 1;
  43370. }
  43371. i++;
  43372. var deltaS = decodeInteger(contextCache, 'IADS', decoder);
  43373. if (deltaS === null) {
  43374. break;
  43375. }
  43376. currentS += deltaS + dsOffset;
  43377. } while (true);
  43378. }
  43379. return bitmap;
  43380. }
  43381. function readSegmentHeader(data, start) {
  43382. var segmentHeader = {};
  43383. segmentHeader.number = readUint32(data, start);
  43384. var flags = data[start + 4];
  43385. var segmentType = flags & 0x3F;
  43386. if (!SegmentTypes[segmentType]) {
  43387. error('JBIG2 error: invalid segment type: ' + segmentType);
  43388. }
  43389. segmentHeader.type = segmentType;
  43390. segmentHeader.typeName = SegmentTypes[segmentType];
  43391. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  43392. var pageAssociationFieldSize = !!(flags & 0x40);
  43393. var referredFlags = data[start + 5];
  43394. var referredToCount = referredFlags >> 5 & 7;
  43395. var retainBits = [referredFlags & 31];
  43396. var position = start + 6;
  43397. if (referredFlags === 7) {
  43398. referredToCount = readUint32(data, position - 1) & 0x1FFFFFFF;
  43399. position += 3;
  43400. var bytes = referredToCount + 7 >> 3;
  43401. retainBits[0] = data[position++];
  43402. while (--bytes > 0) {
  43403. retainBits.push(data[position++]);
  43404. }
  43405. } else if (referredFlags === 5 || referredFlags === 6) {
  43406. error('JBIG2 error: invalid referred-to flags');
  43407. }
  43408. segmentHeader.retainBits = retainBits;
  43409. var referredToSegmentNumberSize = segmentHeader.number <= 256 ? 1 : segmentHeader.number <= 65536 ? 2 : 4;
  43410. var referredTo = [];
  43411. var i, ii;
  43412. for (i = 0; i < referredToCount; i++) {
  43413. var number = referredToSegmentNumberSize === 1 ? data[position] : referredToSegmentNumberSize === 2 ? readUint16(data, position) : readUint32(data, position);
  43414. referredTo.push(number);
  43415. position += referredToSegmentNumberSize;
  43416. }
  43417. segmentHeader.referredTo = referredTo;
  43418. if (!pageAssociationFieldSize) {
  43419. segmentHeader.pageAssociation = data[position++];
  43420. } else {
  43421. segmentHeader.pageAssociation = readUint32(data, position);
  43422. position += 4;
  43423. }
  43424. segmentHeader.length = readUint32(data, position);
  43425. position += 4;
  43426. if (segmentHeader.length === 0xFFFFFFFF) {
  43427. if (segmentType === 38) {
  43428. var genericRegionInfo = readRegionSegmentInformation(data, position);
  43429. var genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  43430. var genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  43431. var searchPatternLength = 6;
  43432. var searchPattern = new Uint8Array(searchPatternLength);
  43433. if (!genericRegionMmr) {
  43434. searchPattern[0] = 0xFF;
  43435. searchPattern[1] = 0xAC;
  43436. }
  43437. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xFF;
  43438. searchPattern[3] = genericRegionInfo.height >> 16 & 0xFF;
  43439. searchPattern[4] = genericRegionInfo.height >> 8 & 0xFF;
  43440. searchPattern[5] = genericRegionInfo.height & 0xFF;
  43441. for (i = position, ii = data.length; i < ii; i++) {
  43442. var j = 0;
  43443. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  43444. j++;
  43445. }
  43446. if (j === searchPatternLength) {
  43447. segmentHeader.length = i + searchPatternLength;
  43448. break;
  43449. }
  43450. }
  43451. if (segmentHeader.length === 0xFFFFFFFF) {
  43452. error('JBIG2 error: segment end was not found');
  43453. }
  43454. } else {
  43455. error('JBIG2 error: invalid unknown segment length');
  43456. }
  43457. }
  43458. segmentHeader.headerEnd = position;
  43459. return segmentHeader;
  43460. }
  43461. function readSegments(header, data, start, end) {
  43462. var segments = [];
  43463. var position = start;
  43464. while (position < end) {
  43465. var segmentHeader = readSegmentHeader(data, position);
  43466. position = segmentHeader.headerEnd;
  43467. var segment = {
  43468. header: segmentHeader,
  43469. data: data
  43470. };
  43471. if (!header.randomAccess) {
  43472. segment.start = position;
  43473. position += segmentHeader.length;
  43474. segment.end = position;
  43475. }
  43476. segments.push(segment);
  43477. if (segmentHeader.type === 51) {
  43478. break;
  43479. }
  43480. }
  43481. if (header.randomAccess) {
  43482. for (var i = 0, ii = segments.length; i < ii; i++) {
  43483. segments[i].start = position;
  43484. position += segments[i].header.length;
  43485. segments[i].end = position;
  43486. }
  43487. }
  43488. return segments;
  43489. }
  43490. function readRegionSegmentInformation(data, start) {
  43491. return {
  43492. width: readUint32(data, start),
  43493. height: readUint32(data, start + 4),
  43494. x: readUint32(data, start + 8),
  43495. y: readUint32(data, start + 12),
  43496. combinationOperator: data[start + 16] & 7
  43497. };
  43498. }
  43499. var RegionSegmentInformationFieldLength = 17;
  43500. function processSegment(segment, visitor) {
  43501. var header = segment.header;
  43502. var data = segment.data, position = segment.start, end = segment.end;
  43503. var args, at, i, atLength;
  43504. switch (header.type) {
  43505. case 0:
  43506. var dictionary = {};
  43507. var dictionaryFlags = readUint16(data, position);
  43508. dictionary.huffman = !!(dictionaryFlags & 1);
  43509. dictionary.refinement = !!(dictionaryFlags & 2);
  43510. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  43511. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  43512. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  43513. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  43514. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  43515. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  43516. dictionary.template = dictionaryFlags >> 10 & 3;
  43517. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  43518. position += 2;
  43519. if (!dictionary.huffman) {
  43520. atLength = dictionary.template === 0 ? 4 : 1;
  43521. at = [];
  43522. for (i = 0; i < atLength; i++) {
  43523. at.push({
  43524. x: readInt8(data, position),
  43525. y: readInt8(data, position + 1)
  43526. });
  43527. position += 2;
  43528. }
  43529. dictionary.at = at;
  43530. }
  43531. if (dictionary.refinement && !dictionary.refinementTemplate) {
  43532. at = [];
  43533. for (i = 0; i < 2; i++) {
  43534. at.push({
  43535. x: readInt8(data, position),
  43536. y: readInt8(data, position + 1)
  43537. });
  43538. position += 2;
  43539. }
  43540. dictionary.refinementAt = at;
  43541. }
  43542. dictionary.numberOfExportedSymbols = readUint32(data, position);
  43543. position += 4;
  43544. dictionary.numberOfNewSymbols = readUint32(data, position);
  43545. position += 4;
  43546. args = [
  43547. dictionary,
  43548. header.number,
  43549. header.referredTo,
  43550. data,
  43551. position,
  43552. end
  43553. ];
  43554. break;
  43555. case 6:
  43556. case 7:
  43557. var textRegion = {};
  43558. textRegion.info = readRegionSegmentInformation(data, position);
  43559. position += RegionSegmentInformationFieldLength;
  43560. var textRegionSegmentFlags = readUint16(data, position);
  43561. position += 2;
  43562. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  43563. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  43564. textRegion.stripSize = 1 << (textRegionSegmentFlags >> 2 & 3);
  43565. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  43566. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  43567. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  43568. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  43569. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  43570. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  43571. if (textRegion.huffman) {
  43572. var textRegionHuffmanFlags = readUint16(data, position);
  43573. position += 2;
  43574. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  43575. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  43576. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  43577. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  43578. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  43579. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  43580. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  43581. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 14);
  43582. }
  43583. if (textRegion.refinement && !textRegion.refinementTemplate) {
  43584. at = [];
  43585. for (i = 0; i < 2; i++) {
  43586. at.push({
  43587. x: readInt8(data, position),
  43588. y: readInt8(data, position + 1)
  43589. });
  43590. position += 2;
  43591. }
  43592. textRegion.refinementAt = at;
  43593. }
  43594. textRegion.numberOfSymbolInstances = readUint32(data, position);
  43595. position += 4;
  43596. if (textRegion.huffman) {
  43597. error('JBIG2 error: huffman is not supported');
  43598. }
  43599. args = [
  43600. textRegion,
  43601. header.referredTo,
  43602. data,
  43603. position,
  43604. end
  43605. ];
  43606. break;
  43607. case 38:
  43608. case 39:
  43609. var genericRegion = {};
  43610. genericRegion.info = readRegionSegmentInformation(data, position);
  43611. position += RegionSegmentInformationFieldLength;
  43612. var genericRegionSegmentFlags = data[position++];
  43613. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  43614. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  43615. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  43616. if (!genericRegion.mmr) {
  43617. atLength = genericRegion.template === 0 ? 4 : 1;
  43618. at = [];
  43619. for (i = 0; i < atLength; i++) {
  43620. at.push({
  43621. x: readInt8(data, position),
  43622. y: readInt8(data, position + 1)
  43623. });
  43624. position += 2;
  43625. }
  43626. genericRegion.at = at;
  43627. }
  43628. args = [
  43629. genericRegion,
  43630. data,
  43631. position,
  43632. end
  43633. ];
  43634. break;
  43635. case 48:
  43636. var pageInfo = {
  43637. width: readUint32(data, position),
  43638. height: readUint32(data, position + 4),
  43639. resolutionX: readUint32(data, position + 8),
  43640. resolutionY: readUint32(data, position + 12)
  43641. };
  43642. if (pageInfo.height === 0xFFFFFFFF) {
  43643. delete pageInfo.height;
  43644. }
  43645. var pageSegmentFlags = data[position + 16];
  43646. readUint16(data, position + 17);
  43647. pageInfo.lossless = !!(pageSegmentFlags & 1);
  43648. pageInfo.refinement = !!(pageSegmentFlags & 2);
  43649. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  43650. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  43651. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  43652. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  43653. args = [pageInfo];
  43654. break;
  43655. case 49:
  43656. break;
  43657. case 50:
  43658. break;
  43659. case 51:
  43660. break;
  43661. case 62:
  43662. break;
  43663. default:
  43664. error('JBIG2 error: segment type ' + header.typeName + '(' + header.type + ') is not implemented');
  43665. }
  43666. var callbackName = 'on' + header.typeName;
  43667. if (callbackName in visitor) {
  43668. visitor[callbackName].apply(visitor, args);
  43669. }
  43670. }
  43671. function processSegments(segments, visitor) {
  43672. for (var i = 0, ii = segments.length; i < ii; i++) {
  43673. processSegment(segments[i], visitor);
  43674. }
  43675. }
  43676. function parseJbig2(data, start, end) {
  43677. var position = start;
  43678. 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) {
  43679. error('JBIG2 error: invalid header');
  43680. }
  43681. var header = {};
  43682. position += 8;
  43683. var flags = data[position++];
  43684. header.randomAccess = !(flags & 1);
  43685. if (!(flags & 2)) {
  43686. header.numberOfPages = readUint32(data, position);
  43687. position += 4;
  43688. }
  43689. readSegments(header, data, position, end);
  43690. error('Not implemented');
  43691. }
  43692. function parseJbig2Chunks(chunks) {
  43693. var visitor = new SimpleSegmentVisitor();
  43694. for (var i = 0, ii = chunks.length; i < ii; i++) {
  43695. var chunk = chunks[i];
  43696. var segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  43697. processSegments(segments, visitor);
  43698. }
  43699. return visitor.buffer;
  43700. }
  43701. function SimpleSegmentVisitor() {
  43702. }
  43703. SimpleSegmentVisitor.prototype = {
  43704. onPageInformation: function SimpleSegmentVisitor_onPageInformation(info) {
  43705. this.currentPageInfo = info;
  43706. var rowSize = info.width + 7 >> 3;
  43707. var buffer = new Uint8Array(rowSize * info.height);
  43708. if (info.defaultPixelValue) {
  43709. for (var i = 0, ii = buffer.length; i < ii; i++) {
  43710. buffer[i] = 0xFF;
  43711. }
  43712. }
  43713. this.buffer = buffer;
  43714. },
  43715. drawBitmap: function SimpleSegmentVisitor_drawBitmap(regionInfo, bitmap) {
  43716. var pageInfo = this.currentPageInfo;
  43717. var width = regionInfo.width, height = regionInfo.height;
  43718. var rowSize = pageInfo.width + 7 >> 3;
  43719. var combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  43720. var buffer = this.buffer;
  43721. var mask0 = 128 >> (regionInfo.x & 7);
  43722. var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  43723. var i, j, mask, offset;
  43724. switch (combinationOperator) {
  43725. case 0:
  43726. for (i = 0; i < height; i++) {
  43727. mask = mask0;
  43728. offset = offset0;
  43729. for (j = 0; j < width; j++) {
  43730. if (bitmap[i][j]) {
  43731. buffer[offset] |= mask;
  43732. }
  43733. mask >>= 1;
  43734. if (!mask) {
  43735. mask = 128;
  43736. offset++;
  43737. }
  43738. }
  43739. offset0 += rowSize;
  43740. }
  43741. break;
  43742. case 2:
  43743. for (i = 0; i < height; i++) {
  43744. mask = mask0;
  43745. offset = offset0;
  43746. for (j = 0; j < width; j++) {
  43747. if (bitmap[i][j]) {
  43748. buffer[offset] ^= mask;
  43749. }
  43750. mask >>= 1;
  43751. if (!mask) {
  43752. mask = 128;
  43753. offset++;
  43754. }
  43755. }
  43756. offset0 += rowSize;
  43757. }
  43758. break;
  43759. default:
  43760. error('JBIG2 error: operator ' + combinationOperator + ' is not supported');
  43761. }
  43762. },
  43763. onImmediateGenericRegion: function SimpleSegmentVisitor_onImmediateGenericRegion(region, data, start, end) {
  43764. var regionInfo = region.info;
  43765. var decodingContext = new DecodingContext(data, start, end);
  43766. var bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  43767. this.drawBitmap(regionInfo, bitmap);
  43768. },
  43769. onImmediateLosslessGenericRegion: function SimpleSegmentVisitor_onImmediateLosslessGenericRegion() {
  43770. this.onImmediateGenericRegion.apply(this, arguments);
  43771. },
  43772. onSymbolDictionary: function SimpleSegmentVisitor_onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  43773. var huffmanTables;
  43774. if (dictionary.huffman) {
  43775. error('JBIG2 error: huffman is not supported');
  43776. }
  43777. var symbols = this.symbols;
  43778. if (!symbols) {
  43779. this.symbols = symbols = {};
  43780. }
  43781. var inputSymbols = [];
  43782. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  43783. inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]);
  43784. }
  43785. var decodingContext = new DecodingContext(data, start, end);
  43786. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext);
  43787. },
  43788. onImmediateTextRegion: function SimpleSegmentVisitor_onImmediateTextRegion(region, referredSegments, data, start, end) {
  43789. var regionInfo = region.info;
  43790. var huffmanTables;
  43791. var symbols = this.symbols;
  43792. var inputSymbols = [];
  43793. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  43794. inputSymbols = inputSymbols.concat(symbols[referredSegments[i]]);
  43795. }
  43796. var symbolCodeLength = log2(inputSymbols.length);
  43797. var decodingContext = new DecodingContext(data, start, end);
  43798. 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);
  43799. this.drawBitmap(regionInfo, bitmap);
  43800. },
  43801. onImmediateLosslessTextRegion: function SimpleSegmentVisitor_onImmediateLosslessTextRegion() {
  43802. this.onImmediateTextRegion.apply(this, arguments);
  43803. }
  43804. };
  43805. function Jbig2Image() {
  43806. }
  43807. Jbig2Image.prototype = {
  43808. parseChunks: function Jbig2Image_parseChunks(chunks) {
  43809. return parseJbig2Chunks(chunks);
  43810. }
  43811. };
  43812. return Jbig2Image;
  43813. }();
  43814. exports.Jbig2Image = Jbig2Image;
  43815. /***/ }),
  43816. /* 29 */
  43817. /***/ (function(module, exports, __w_pdfjs_require__) {
  43818. "use strict";
  43819. var sharedUtil = __w_pdfjs_require__(0);
  43820. var warn = sharedUtil.warn;
  43821. var error = sharedUtil.error;
  43822. var JpegImage = function JpegImageClosure() {
  43823. var dctZigZag = new Uint8Array([
  43824. 0,
  43825. 1,
  43826. 8,
  43827. 16,
  43828. 9,
  43829. 2,
  43830. 3,
  43831. 10,
  43832. 17,
  43833. 24,
  43834. 32,
  43835. 25,
  43836. 18,
  43837. 11,
  43838. 4,
  43839. 5,
  43840. 12,
  43841. 19,
  43842. 26,
  43843. 33,
  43844. 40,
  43845. 48,
  43846. 41,
  43847. 34,
  43848. 27,
  43849. 20,
  43850. 13,
  43851. 6,
  43852. 7,
  43853. 14,
  43854. 21,
  43855. 28,
  43856. 35,
  43857. 42,
  43858. 49,
  43859. 56,
  43860. 57,
  43861. 50,
  43862. 43,
  43863. 36,
  43864. 29,
  43865. 22,
  43866. 15,
  43867. 23,
  43868. 30,
  43869. 37,
  43870. 44,
  43871. 51,
  43872. 58,
  43873. 59,
  43874. 52,
  43875. 45,
  43876. 38,
  43877. 31,
  43878. 39,
  43879. 46,
  43880. 53,
  43881. 60,
  43882. 61,
  43883. 54,
  43884. 47,
  43885. 55,
  43886. 62,
  43887. 63
  43888. ]);
  43889. var dctCos1 = 4017;
  43890. var dctSin1 = 799;
  43891. var dctCos3 = 3406;
  43892. var dctSin3 = 2276;
  43893. var dctCos6 = 1567;
  43894. var dctSin6 = 3784;
  43895. var dctSqrt2 = 5793;
  43896. var dctSqrt1d2 = 2896;
  43897. function JpegImage() {
  43898. this.decodeTransform = null;
  43899. this.colorTransform = -1;
  43900. }
  43901. function buildHuffmanTable(codeLengths, values) {
  43902. var k = 0, code = [], i, j, length = 16;
  43903. while (length > 0 && !codeLengths[length - 1]) {
  43904. length--;
  43905. }
  43906. code.push({
  43907. children: [],
  43908. index: 0
  43909. });
  43910. var p = code[0], q;
  43911. for (i = 0; i < length; i++) {
  43912. for (j = 0; j < codeLengths[i]; j++) {
  43913. p = code.pop();
  43914. p.children[p.index] = values[k];
  43915. while (p.index > 0) {
  43916. p = code.pop();
  43917. }
  43918. p.index++;
  43919. code.push(p);
  43920. while (code.length <= i) {
  43921. code.push(q = {
  43922. children: [],
  43923. index: 0
  43924. });
  43925. p.children[p.index] = q.children;
  43926. p = q;
  43927. }
  43928. k++;
  43929. }
  43930. if (i + 1 < length) {
  43931. code.push(q = {
  43932. children: [],
  43933. index: 0
  43934. });
  43935. p.children[p.index] = q.children;
  43936. p = q;
  43937. }
  43938. }
  43939. return code[0].children;
  43940. }
  43941. function getBlockBufferOffset(component, row, col) {
  43942. return 64 * ((component.blocksPerLine + 1) * row + col);
  43943. }
  43944. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive) {
  43945. var mcusPerLine = frame.mcusPerLine;
  43946. var progressive = frame.progressive;
  43947. var startOffset = offset, bitsData = 0, bitsCount = 0;
  43948. function readBit() {
  43949. if (bitsCount > 0) {
  43950. bitsCount--;
  43951. return bitsData >> bitsCount & 1;
  43952. }
  43953. bitsData = data[offset++];
  43954. if (bitsData === 0xFF) {
  43955. var nextByte = data[offset++];
  43956. if (nextByte) {
  43957. error('JPEG error: unexpected marker ' + (bitsData << 8 | nextByte).toString(16));
  43958. }
  43959. }
  43960. bitsCount = 7;
  43961. return bitsData >>> 7;
  43962. }
  43963. function decodeHuffman(tree) {
  43964. var node = tree;
  43965. while (true) {
  43966. node = node[readBit()];
  43967. if (typeof node === 'number') {
  43968. return node;
  43969. }
  43970. if (typeof node !== 'object') {
  43971. error('JPEG error: invalid huffman sequence');
  43972. }
  43973. }
  43974. }
  43975. function receive(length) {
  43976. var n = 0;
  43977. while (length > 0) {
  43978. n = n << 1 | readBit();
  43979. length--;
  43980. }
  43981. return n;
  43982. }
  43983. function receiveAndExtend(length) {
  43984. if (length === 1) {
  43985. return readBit() === 1 ? 1 : -1;
  43986. }
  43987. var n = receive(length);
  43988. if (n >= 1 << length - 1) {
  43989. return n;
  43990. }
  43991. return n + (-1 << length) + 1;
  43992. }
  43993. function decodeBaseline(component, offset) {
  43994. var t = decodeHuffman(component.huffmanTableDC);
  43995. var diff = t === 0 ? 0 : receiveAndExtend(t);
  43996. component.blockData[offset] = component.pred += diff;
  43997. var k = 1;
  43998. while (k < 64) {
  43999. var rs = decodeHuffman(component.huffmanTableAC);
  44000. var s = rs & 15, r = rs >> 4;
  44001. if (s === 0) {
  44002. if (r < 15) {
  44003. break;
  44004. }
  44005. k += 16;
  44006. continue;
  44007. }
  44008. k += r;
  44009. var z = dctZigZag[k];
  44010. component.blockData[offset + z] = receiveAndExtend(s);
  44011. k++;
  44012. }
  44013. }
  44014. function decodeDCFirst(component, offset) {
  44015. var t = decodeHuffman(component.huffmanTableDC);
  44016. var diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  44017. component.blockData[offset] = component.pred += diff;
  44018. }
  44019. function decodeDCSuccessive(component, offset) {
  44020. component.blockData[offset] |= readBit() << successive;
  44021. }
  44022. var eobrun = 0;
  44023. function decodeACFirst(component, offset) {
  44024. if (eobrun > 0) {
  44025. eobrun--;
  44026. return;
  44027. }
  44028. var k = spectralStart, e = spectralEnd;
  44029. while (k <= e) {
  44030. var rs = decodeHuffman(component.huffmanTableAC);
  44031. var s = rs & 15, r = rs >> 4;
  44032. if (s === 0) {
  44033. if (r < 15) {
  44034. eobrun = receive(r) + (1 << r) - 1;
  44035. break;
  44036. }
  44037. k += 16;
  44038. continue;
  44039. }
  44040. k += r;
  44041. var z = dctZigZag[k];
  44042. component.blockData[offset + z] = receiveAndExtend(s) * (1 << successive);
  44043. k++;
  44044. }
  44045. }
  44046. var successiveACState = 0, successiveACNextValue;
  44047. function decodeACSuccessive(component, offset) {
  44048. var k = spectralStart;
  44049. var e = spectralEnd;
  44050. var r = 0;
  44051. var s;
  44052. var rs;
  44053. while (k <= e) {
  44054. var z = dctZigZag[k];
  44055. switch (successiveACState) {
  44056. case 0:
  44057. rs = decodeHuffman(component.huffmanTableAC);
  44058. s = rs & 15;
  44059. r = rs >> 4;
  44060. if (s === 0) {
  44061. if (r < 15) {
  44062. eobrun = receive(r) + (1 << r);
  44063. successiveACState = 4;
  44064. } else {
  44065. r = 16;
  44066. successiveACState = 1;
  44067. }
  44068. } else {
  44069. if (s !== 1) {
  44070. error('JPEG error: invalid ACn encoding');
  44071. }
  44072. successiveACNextValue = receiveAndExtend(s);
  44073. successiveACState = r ? 2 : 3;
  44074. }
  44075. continue;
  44076. case 1:
  44077. case 2:
  44078. if (component.blockData[offset + z]) {
  44079. component.blockData[offset + z] += readBit() << successive;
  44080. } else {
  44081. r--;
  44082. if (r === 0) {
  44083. successiveACState = successiveACState === 2 ? 3 : 0;
  44084. }
  44085. }
  44086. break;
  44087. case 3:
  44088. if (component.blockData[offset + z]) {
  44089. component.blockData[offset + z] += readBit() << successive;
  44090. } else {
  44091. component.blockData[offset + z] = successiveACNextValue << successive;
  44092. successiveACState = 0;
  44093. }
  44094. break;
  44095. case 4:
  44096. if (component.blockData[offset + z]) {
  44097. component.blockData[offset + z] += readBit() << successive;
  44098. }
  44099. break;
  44100. }
  44101. k++;
  44102. }
  44103. if (successiveACState === 4) {
  44104. eobrun--;
  44105. if (eobrun === 0) {
  44106. successiveACState = 0;
  44107. }
  44108. }
  44109. }
  44110. function decodeMcu(component, decode, mcu, row, col) {
  44111. var mcuRow = mcu / mcusPerLine | 0;
  44112. var mcuCol = mcu % mcusPerLine;
  44113. var blockRow = mcuRow * component.v + row;
  44114. var blockCol = mcuCol * component.h + col;
  44115. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  44116. decode(component, offset);
  44117. }
  44118. function decodeBlock(component, decode, mcu) {
  44119. var blockRow = mcu / component.blocksPerLine | 0;
  44120. var blockCol = mcu % component.blocksPerLine;
  44121. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  44122. decode(component, offset);
  44123. }
  44124. var componentsLength = components.length;
  44125. var component, i, j, k, n;
  44126. var decodeFn;
  44127. if (progressive) {
  44128. if (spectralStart === 0) {
  44129. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  44130. } else {
  44131. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  44132. }
  44133. } else {
  44134. decodeFn = decodeBaseline;
  44135. }
  44136. var mcu = 0, marker;
  44137. var mcuExpected;
  44138. if (componentsLength === 1) {
  44139. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  44140. } else {
  44141. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  44142. }
  44143. var h, v;
  44144. while (mcu < mcuExpected) {
  44145. var mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  44146. for (i = 0; i < componentsLength; i++) {
  44147. components[i].pred = 0;
  44148. }
  44149. eobrun = 0;
  44150. if (componentsLength === 1) {
  44151. component = components[0];
  44152. for (n = 0; n < mcuToRead; n++) {
  44153. decodeBlock(component, decodeFn, mcu);
  44154. mcu++;
  44155. }
  44156. } else {
  44157. for (n = 0; n < mcuToRead; n++) {
  44158. for (i = 0; i < componentsLength; i++) {
  44159. component = components[i];
  44160. h = component.h;
  44161. v = component.v;
  44162. for (j = 0; j < v; j++) {
  44163. for (k = 0; k < h; k++) {
  44164. decodeMcu(component, decodeFn, mcu, j, k);
  44165. }
  44166. }
  44167. }
  44168. mcu++;
  44169. }
  44170. }
  44171. bitsCount = 0;
  44172. marker = data[offset] << 8 | data[offset + 1];
  44173. while (data[offset] === 0x00 && offset < data.length - 1) {
  44174. offset++;
  44175. marker = data[offset] << 8 | data[offset + 1];
  44176. }
  44177. if (marker <= 0xFF00) {
  44178. error('JPEG error: marker was not found');
  44179. }
  44180. if (marker >= 0xFFD0 && marker <= 0xFFD7) {
  44181. offset += 2;
  44182. } else {
  44183. break;
  44184. }
  44185. }
  44186. return offset - startOffset;
  44187. }
  44188. function quantizeAndInverse(component, blockBufferOffset, p) {
  44189. var qt = component.quantizationTable, blockData = component.blockData;
  44190. var v0, v1, v2, v3, v4, v5, v6, v7;
  44191. var p0, p1, p2, p3, p4, p5, p6, p7;
  44192. var t;
  44193. if (!qt) {
  44194. error('JPEG error: missing required Quantization Table.');
  44195. }
  44196. for (var row = 0; row < 64; row += 8) {
  44197. p0 = blockData[blockBufferOffset + row];
  44198. p1 = blockData[blockBufferOffset + row + 1];
  44199. p2 = blockData[blockBufferOffset + row + 2];
  44200. p3 = blockData[blockBufferOffset + row + 3];
  44201. p4 = blockData[blockBufferOffset + row + 4];
  44202. p5 = blockData[blockBufferOffset + row + 5];
  44203. p6 = blockData[blockBufferOffset + row + 6];
  44204. p7 = blockData[blockBufferOffset + row + 7];
  44205. p0 *= qt[row];
  44206. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  44207. t = dctSqrt2 * p0 + 512 >> 10;
  44208. p[row] = t;
  44209. p[row + 1] = t;
  44210. p[row + 2] = t;
  44211. p[row + 3] = t;
  44212. p[row + 4] = t;
  44213. p[row + 5] = t;
  44214. p[row + 6] = t;
  44215. p[row + 7] = t;
  44216. continue;
  44217. }
  44218. p1 *= qt[row + 1];
  44219. p2 *= qt[row + 2];
  44220. p3 *= qt[row + 3];
  44221. p4 *= qt[row + 4];
  44222. p5 *= qt[row + 5];
  44223. p6 *= qt[row + 6];
  44224. p7 *= qt[row + 7];
  44225. v0 = dctSqrt2 * p0 + 128 >> 8;
  44226. v1 = dctSqrt2 * p4 + 128 >> 8;
  44227. v2 = p2;
  44228. v3 = p6;
  44229. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  44230. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  44231. v5 = p3 << 4;
  44232. v6 = p5 << 4;
  44233. v0 = v0 + v1 + 1 >> 1;
  44234. v1 = v0 - v1;
  44235. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  44236. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  44237. v3 = t;
  44238. v4 = v4 + v6 + 1 >> 1;
  44239. v6 = v4 - v6;
  44240. v7 = v7 + v5 + 1 >> 1;
  44241. v5 = v7 - v5;
  44242. v0 = v0 + v3 + 1 >> 1;
  44243. v3 = v0 - v3;
  44244. v1 = v1 + v2 + 1 >> 1;
  44245. v2 = v1 - v2;
  44246. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  44247. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  44248. v7 = t;
  44249. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  44250. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  44251. v6 = t;
  44252. p[row] = v0 + v7;
  44253. p[row + 7] = v0 - v7;
  44254. p[row + 1] = v1 + v6;
  44255. p[row + 6] = v1 - v6;
  44256. p[row + 2] = v2 + v5;
  44257. p[row + 5] = v2 - v5;
  44258. p[row + 3] = v3 + v4;
  44259. p[row + 4] = v3 - v4;
  44260. }
  44261. for (var col = 0; col < 8; ++col) {
  44262. p0 = p[col];
  44263. p1 = p[col + 8];
  44264. p2 = p[col + 16];
  44265. p3 = p[col + 24];
  44266. p4 = p[col + 32];
  44267. p5 = p[col + 40];
  44268. p6 = p[col + 48];
  44269. p7 = p[col + 56];
  44270. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  44271. t = dctSqrt2 * p0 + 8192 >> 14;
  44272. t = t < -2040 ? 0 : t >= 2024 ? 255 : t + 2056 >> 4;
  44273. blockData[blockBufferOffset + col] = t;
  44274. blockData[blockBufferOffset + col + 8] = t;
  44275. blockData[blockBufferOffset + col + 16] = t;
  44276. blockData[blockBufferOffset + col + 24] = t;
  44277. blockData[blockBufferOffset + col + 32] = t;
  44278. blockData[blockBufferOffset + col + 40] = t;
  44279. blockData[blockBufferOffset + col + 48] = t;
  44280. blockData[blockBufferOffset + col + 56] = t;
  44281. continue;
  44282. }
  44283. v0 = dctSqrt2 * p0 + 2048 >> 12;
  44284. v1 = dctSqrt2 * p4 + 2048 >> 12;
  44285. v2 = p2;
  44286. v3 = p6;
  44287. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  44288. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  44289. v5 = p3;
  44290. v6 = p5;
  44291. v0 = (v0 + v1 + 1 >> 1) + 4112;
  44292. v1 = v0 - v1;
  44293. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  44294. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  44295. v3 = t;
  44296. v4 = v4 + v6 + 1 >> 1;
  44297. v6 = v4 - v6;
  44298. v7 = v7 + v5 + 1 >> 1;
  44299. v5 = v7 - v5;
  44300. v0 = v0 + v3 + 1 >> 1;
  44301. v3 = v0 - v3;
  44302. v1 = v1 + v2 + 1 >> 1;
  44303. v2 = v1 - v2;
  44304. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  44305. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  44306. v7 = t;
  44307. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  44308. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  44309. v6 = t;
  44310. p0 = v0 + v7;
  44311. p7 = v0 - v7;
  44312. p1 = v1 + v6;
  44313. p6 = v1 - v6;
  44314. p2 = v2 + v5;
  44315. p5 = v2 - v5;
  44316. p3 = v3 + v4;
  44317. p4 = v3 - v4;
  44318. p0 = p0 < 16 ? 0 : p0 >= 4080 ? 255 : p0 >> 4;
  44319. p1 = p1 < 16 ? 0 : p1 >= 4080 ? 255 : p1 >> 4;
  44320. p2 = p2 < 16 ? 0 : p2 >= 4080 ? 255 : p2 >> 4;
  44321. p3 = p3 < 16 ? 0 : p3 >= 4080 ? 255 : p3 >> 4;
  44322. p4 = p4 < 16 ? 0 : p4 >= 4080 ? 255 : p4 >> 4;
  44323. p5 = p5 < 16 ? 0 : p5 >= 4080 ? 255 : p5 >> 4;
  44324. p6 = p6 < 16 ? 0 : p6 >= 4080 ? 255 : p6 >> 4;
  44325. p7 = p7 < 16 ? 0 : p7 >= 4080 ? 255 : p7 >> 4;
  44326. blockData[blockBufferOffset + col] = p0;
  44327. blockData[blockBufferOffset + col + 8] = p1;
  44328. blockData[blockBufferOffset + col + 16] = p2;
  44329. blockData[blockBufferOffset + col + 24] = p3;
  44330. blockData[blockBufferOffset + col + 32] = p4;
  44331. blockData[blockBufferOffset + col + 40] = p5;
  44332. blockData[blockBufferOffset + col + 48] = p6;
  44333. blockData[blockBufferOffset + col + 56] = p7;
  44334. }
  44335. }
  44336. function buildComponentData(frame, component) {
  44337. var blocksPerLine = component.blocksPerLine;
  44338. var blocksPerColumn = component.blocksPerColumn;
  44339. var computationBuffer = new Int16Array(64);
  44340. for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  44341. for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  44342. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  44343. quantizeAndInverse(component, offset, computationBuffer);
  44344. }
  44345. }
  44346. return component.blockData;
  44347. }
  44348. function clamp0to255(a) {
  44349. return a <= 0 ? 0 : a >= 255 ? 255 : a;
  44350. }
  44351. JpegImage.prototype = {
  44352. parse: function parse(data) {
  44353. function readUint16() {
  44354. var value = data[offset] << 8 | data[offset + 1];
  44355. offset += 2;
  44356. return value;
  44357. }
  44358. function readDataBlock() {
  44359. function isValidMarkerAt(pos) {
  44360. if (pos < data.length - 1) {
  44361. return data[pos] === 0xFF && data[pos + 1] >= 0xC0 && data[pos + 1] <= 0xFE;
  44362. }
  44363. return true;
  44364. }
  44365. var length = readUint16();
  44366. var endOffset = offset + length - 2;
  44367. if (!isValidMarkerAt(endOffset)) {
  44368. warn('readDataBlock - incorrect length, next marker is: ' + (data[endOffset] << 8 | data[endOffset + 1]).toString('16'));
  44369. var pos = offset;
  44370. while (!isValidMarkerAt(pos)) {
  44371. pos++;
  44372. }
  44373. endOffset = pos;
  44374. }
  44375. var array = data.subarray(offset, endOffset);
  44376. offset += array.length;
  44377. return array;
  44378. }
  44379. function prepareComponents(frame) {
  44380. var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  44381. var mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  44382. for (var i = 0; i < frame.components.length; i++) {
  44383. component = frame.components[i];
  44384. var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  44385. var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  44386. var blocksPerLineForMcu = mcusPerLine * component.h;
  44387. var blocksPerColumnForMcu = mcusPerColumn * component.v;
  44388. var blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  44389. component.blockData = new Int16Array(blocksBufferSize);
  44390. component.blocksPerLine = blocksPerLine;
  44391. component.blocksPerColumn = blocksPerColumn;
  44392. }
  44393. frame.mcusPerLine = mcusPerLine;
  44394. frame.mcusPerColumn = mcusPerColumn;
  44395. }
  44396. var offset = 0;
  44397. var jfif = null;
  44398. var adobe = null;
  44399. var frame, resetInterval;
  44400. var quantizationTables = [];
  44401. var huffmanTablesAC = [], huffmanTablesDC = [];
  44402. var fileMarker = readUint16();
  44403. if (fileMarker !== 0xFFD8) {
  44404. error('JPEG error: SOI not found');
  44405. }
  44406. fileMarker = readUint16();
  44407. while (fileMarker !== 0xFFD9) {
  44408. var i, j, l;
  44409. switch (fileMarker) {
  44410. case 0xFFE0:
  44411. case 0xFFE1:
  44412. case 0xFFE2:
  44413. case 0xFFE3:
  44414. case 0xFFE4:
  44415. case 0xFFE5:
  44416. case 0xFFE6:
  44417. case 0xFFE7:
  44418. case 0xFFE8:
  44419. case 0xFFE9:
  44420. case 0xFFEA:
  44421. case 0xFFEB:
  44422. case 0xFFEC:
  44423. case 0xFFED:
  44424. case 0xFFEE:
  44425. case 0xFFEF:
  44426. case 0xFFFE:
  44427. var appData = readDataBlock();
  44428. if (fileMarker === 0xFFE0) {
  44429. if (appData[0] === 0x4A && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  44430. jfif = {
  44431. version: {
  44432. major: appData[5],
  44433. minor: appData[6]
  44434. },
  44435. densityUnits: appData[7],
  44436. xDensity: appData[8] << 8 | appData[9],
  44437. yDensity: appData[10] << 8 | appData[11],
  44438. thumbWidth: appData[12],
  44439. thumbHeight: appData[13],
  44440. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  44441. };
  44442. }
  44443. }
  44444. if (fileMarker === 0xFFEE) {
  44445. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6F && appData[3] === 0x62 && appData[4] === 0x65) {
  44446. adobe = {
  44447. version: appData[5] << 8 | appData[6],
  44448. flags0: appData[7] << 8 | appData[8],
  44449. flags1: appData[9] << 8 | appData[10],
  44450. transformCode: appData[11]
  44451. };
  44452. }
  44453. }
  44454. break;
  44455. case 0xFFDB:
  44456. var quantizationTablesLength = readUint16();
  44457. var quantizationTablesEnd = quantizationTablesLength + offset - 2;
  44458. var z;
  44459. while (offset < quantizationTablesEnd) {
  44460. var quantizationTableSpec = data[offset++];
  44461. var tableData = new Uint16Array(64);
  44462. if (quantizationTableSpec >> 4 === 0) {
  44463. for (j = 0; j < 64; j++) {
  44464. z = dctZigZag[j];
  44465. tableData[z] = data[offset++];
  44466. }
  44467. } else if (quantizationTableSpec >> 4 === 1) {
  44468. for (j = 0; j < 64; j++) {
  44469. z = dctZigZag[j];
  44470. tableData[z] = readUint16();
  44471. }
  44472. } else {
  44473. error('JPEG error: DQT - invalid table spec');
  44474. }
  44475. quantizationTables[quantizationTableSpec & 15] = tableData;
  44476. }
  44477. break;
  44478. case 0xFFC0:
  44479. case 0xFFC1:
  44480. case 0xFFC2:
  44481. if (frame) {
  44482. error('JPEG error: Only single frame JPEGs supported');
  44483. }
  44484. readUint16();
  44485. frame = {};
  44486. frame.extended = fileMarker === 0xFFC1;
  44487. frame.progressive = fileMarker === 0xFFC2;
  44488. frame.precision = data[offset++];
  44489. frame.scanLines = readUint16();
  44490. frame.samplesPerLine = readUint16();
  44491. frame.components = [];
  44492. frame.componentIds = {};
  44493. var componentsCount = data[offset++], componentId;
  44494. var maxH = 0, maxV = 0;
  44495. for (i = 0; i < componentsCount; i++) {
  44496. componentId = data[offset];
  44497. var h = data[offset + 1] >> 4;
  44498. var v = data[offset + 1] & 15;
  44499. if (maxH < h) {
  44500. maxH = h;
  44501. }
  44502. if (maxV < v) {
  44503. maxV = v;
  44504. }
  44505. var qId = data[offset + 2];
  44506. l = frame.components.push({
  44507. h: h,
  44508. v: v,
  44509. quantizationId: qId,
  44510. quantizationTable: null
  44511. });
  44512. frame.componentIds[componentId] = l - 1;
  44513. offset += 3;
  44514. }
  44515. frame.maxH = maxH;
  44516. frame.maxV = maxV;
  44517. prepareComponents(frame);
  44518. break;
  44519. case 0xFFC4:
  44520. var huffmanLength = readUint16();
  44521. for (i = 2; i < huffmanLength;) {
  44522. var huffmanTableSpec = data[offset++];
  44523. var codeLengths = new Uint8Array(16);
  44524. var codeLengthSum = 0;
  44525. for (j = 0; j < 16; j++, offset++) {
  44526. codeLengthSum += codeLengths[j] = data[offset];
  44527. }
  44528. var huffmanValues = new Uint8Array(codeLengthSum);
  44529. for (j = 0; j < codeLengthSum; j++, offset++) {
  44530. huffmanValues[j] = data[offset];
  44531. }
  44532. i += 17 + codeLengthSum;
  44533. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  44534. }
  44535. break;
  44536. case 0xFFDD:
  44537. readUint16();
  44538. resetInterval = readUint16();
  44539. break;
  44540. case 0xFFDA:
  44541. readUint16();
  44542. var selectorsCount = data[offset++];
  44543. var components = [], component;
  44544. for (i = 0; i < selectorsCount; i++) {
  44545. var componentIndex = frame.componentIds[data[offset++]];
  44546. component = frame.components[componentIndex];
  44547. var tableSpec = data[offset++];
  44548. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  44549. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  44550. components.push(component);
  44551. }
  44552. var spectralStart = data[offset++];
  44553. var spectralEnd = data[offset++];
  44554. var successiveApproximation = data[offset++];
  44555. var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15);
  44556. offset += processed;
  44557. break;
  44558. case 0xFFFF:
  44559. if (data[offset] !== 0xFF) {
  44560. offset--;
  44561. }
  44562. break;
  44563. default:
  44564. if (data[offset - 3] === 0xFF && data[offset - 2] >= 0xC0 && data[offset - 2] <= 0xFE) {
  44565. offset -= 3;
  44566. break;
  44567. }
  44568. error('JPEG error: unknown marker ' + fileMarker.toString(16));
  44569. }
  44570. fileMarker = readUint16();
  44571. }
  44572. this.width = frame.samplesPerLine;
  44573. this.height = frame.scanLines;
  44574. this.jfif = jfif;
  44575. this.adobe = adobe;
  44576. this.components = [];
  44577. for (i = 0; i < frame.components.length; i++) {
  44578. component = frame.components[i];
  44579. var quantizationTable = quantizationTables[component.quantizationId];
  44580. if (quantizationTable) {
  44581. component.quantizationTable = quantizationTable;
  44582. }
  44583. this.components.push({
  44584. output: buildComponentData(frame, component),
  44585. scaleX: component.h / frame.maxH,
  44586. scaleY: component.v / frame.maxV,
  44587. blocksPerLine: component.blocksPerLine,
  44588. blocksPerColumn: component.blocksPerColumn
  44589. });
  44590. }
  44591. this.numComponents = this.components.length;
  44592. },
  44593. _getLinearizedBlockData: function getLinearizedBlockData(width, height) {
  44594. var scaleX = this.width / width, scaleY = this.height / height;
  44595. var component, componentScaleX, componentScaleY, blocksPerScanline;
  44596. var x, y, i, j, k;
  44597. var index;
  44598. var offset = 0;
  44599. var output;
  44600. var numComponents = this.components.length;
  44601. var dataLength = width * height * numComponents;
  44602. var data = new Uint8Array(dataLength);
  44603. var xScaleBlockOffset = new Uint32Array(width);
  44604. var mask3LSB = 0xfffffff8;
  44605. for (i = 0; i < numComponents; i++) {
  44606. component = this.components[i];
  44607. componentScaleX = component.scaleX * scaleX;
  44608. componentScaleY = component.scaleY * scaleY;
  44609. offset = i;
  44610. output = component.output;
  44611. blocksPerScanline = component.blocksPerLine + 1 << 3;
  44612. for (x = 0; x < width; x++) {
  44613. j = 0 | x * componentScaleX;
  44614. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  44615. }
  44616. for (y = 0; y < height; y++) {
  44617. j = 0 | y * componentScaleY;
  44618. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  44619. for (x = 0; x < width; x++) {
  44620. data[offset] = output[index + xScaleBlockOffset[x]];
  44621. offset += numComponents;
  44622. }
  44623. }
  44624. }
  44625. var transform = this.decodeTransform;
  44626. if (transform) {
  44627. for (i = 0; i < dataLength;) {
  44628. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  44629. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  44630. }
  44631. }
  44632. }
  44633. return data;
  44634. },
  44635. _isColorConversionNeeded: function isColorConversionNeeded() {
  44636. if (this.adobe && this.adobe.transformCode) {
  44637. return true;
  44638. } else if (this.numComponents === 3) {
  44639. if (!this.adobe && this.colorTransform === 0) {
  44640. return false;
  44641. }
  44642. return true;
  44643. }
  44644. if (!this.adobe && this.colorTransform === 1) {
  44645. return true;
  44646. }
  44647. return false;
  44648. },
  44649. _convertYccToRgb: function convertYccToRgb(data) {
  44650. var Y, Cb, Cr;
  44651. for (var i = 0, length = data.length; i < length; i += 3) {
  44652. Y = data[i];
  44653. Cb = data[i + 1];
  44654. Cr = data[i + 2];
  44655. data[i] = clamp0to255(Y - 179.456 + 1.402 * Cr);
  44656. data[i + 1] = clamp0to255(Y + 135.459 - 0.344 * Cb - 0.714 * Cr);
  44657. data[i + 2] = clamp0to255(Y - 226.816 + 1.772 * Cb);
  44658. }
  44659. return data;
  44660. },
  44661. _convertYcckToRgb: function convertYcckToRgb(data) {
  44662. var Y, Cb, Cr, k;
  44663. var offset = 0;
  44664. for (var i = 0, length = data.length; i < length; i += 4) {
  44665. Y = data[i];
  44666. Cb = data[i + 1];
  44667. Cr = data[i + 2];
  44668. k = data[i + 3];
  44669. 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);
  44670. 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);
  44671. 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);
  44672. data[offset++] = clamp0to255(r);
  44673. data[offset++] = clamp0to255(g);
  44674. data[offset++] = clamp0to255(b);
  44675. }
  44676. return data;
  44677. },
  44678. _convertYcckToCmyk: function convertYcckToCmyk(data) {
  44679. var Y, Cb, Cr;
  44680. for (var i = 0, length = data.length; i < length; i += 4) {
  44681. Y = data[i];
  44682. Cb = data[i + 1];
  44683. Cr = data[i + 2];
  44684. data[i] = clamp0to255(434.456 - Y - 1.402 * Cr);
  44685. data[i + 1] = clamp0to255(119.541 - Y + 0.344 * Cb + 0.714 * Cr);
  44686. data[i + 2] = clamp0to255(481.816 - Y - 1.772 * Cb);
  44687. }
  44688. return data;
  44689. },
  44690. _convertCmykToRgb: function convertCmykToRgb(data) {
  44691. var c, m, y, k;
  44692. var offset = 0;
  44693. var min = -255 * 255 * 255;
  44694. var scale = 1 / 255 / 255;
  44695. for (var i = 0, length = data.length; i < length; i += 4) {
  44696. c = data[i];
  44697. m = data[i + 1];
  44698. y = data[i + 2];
  44699. k = data[i + 3];
  44700. 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);
  44701. 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);
  44702. 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);
  44703. data[offset++] = r >= 0 ? 255 : r <= min ? 0 : 255 + r * scale | 0;
  44704. data[offset++] = g >= 0 ? 255 : g <= min ? 0 : 255 + g * scale | 0;
  44705. data[offset++] = b >= 0 ? 255 : b <= min ? 0 : 255 + b * scale | 0;
  44706. }
  44707. return data;
  44708. },
  44709. getData: function getData(width, height, forceRGBoutput) {
  44710. if (this.numComponents > 4) {
  44711. error('JPEG error: Unsupported color mode');
  44712. }
  44713. var data = this._getLinearizedBlockData(width, height);
  44714. if (this.numComponents === 1 && forceRGBoutput) {
  44715. var dataLength = data.length;
  44716. var rgbData = new Uint8Array(dataLength * 3);
  44717. var offset = 0;
  44718. for (var i = 0; i < dataLength; i++) {
  44719. var grayColor = data[i];
  44720. rgbData[offset++] = grayColor;
  44721. rgbData[offset++] = grayColor;
  44722. rgbData[offset++] = grayColor;
  44723. }
  44724. return rgbData;
  44725. } else if (this.numComponents === 3 && this._isColorConversionNeeded()) {
  44726. return this._convertYccToRgb(data);
  44727. } else if (this.numComponents === 4) {
  44728. if (this._isColorConversionNeeded()) {
  44729. if (forceRGBoutput) {
  44730. return this._convertYcckToRgb(data);
  44731. }
  44732. return this._convertYcckToCmyk(data);
  44733. } else if (forceRGBoutput) {
  44734. return this._convertCmykToRgb(data);
  44735. }
  44736. }
  44737. return data;
  44738. }
  44739. };
  44740. return JpegImage;
  44741. }();
  44742. exports.JpegImage = JpegImage;
  44743. /***/ }),
  44744. /* 30 */
  44745. /***/ (function(module, exports, __w_pdfjs_require__) {
  44746. "use strict";
  44747. var sharedUtil = __w_pdfjs_require__(0);
  44748. var getLookupTableFactory = sharedUtil.getLookupTableFactory;
  44749. var getMetrics = getLookupTableFactory(function (t) {
  44750. t['Courier'] = 600;
  44751. t['Courier-Bold'] = 600;
  44752. t['Courier-BoldOblique'] = 600;
  44753. t['Courier-Oblique'] = 600;
  44754. t['Helvetica'] = getLookupTableFactory(function (t) {
  44755. t['space'] = 278;
  44756. t['exclam'] = 278;
  44757. t['quotedbl'] = 355;
  44758. t['numbersign'] = 556;
  44759. t['dollar'] = 556;
  44760. t['percent'] = 889;
  44761. t['ampersand'] = 667;
  44762. t['quoteright'] = 222;
  44763. t['parenleft'] = 333;
  44764. t['parenright'] = 333;
  44765. t['asterisk'] = 389;
  44766. t['plus'] = 584;
  44767. t['comma'] = 278;
  44768. t['hyphen'] = 333;
  44769. t['period'] = 278;
  44770. t['slash'] = 278;
  44771. t['zero'] = 556;
  44772. t['one'] = 556;
  44773. t['two'] = 556;
  44774. t['three'] = 556;
  44775. t['four'] = 556;
  44776. t['five'] = 556;
  44777. t['six'] = 556;
  44778. t['seven'] = 556;
  44779. t['eight'] = 556;
  44780. t['nine'] = 556;
  44781. t['colon'] = 278;
  44782. t['semicolon'] = 278;
  44783. t['less'] = 584;
  44784. t['equal'] = 584;
  44785. t['greater'] = 584;
  44786. t['question'] = 556;
  44787. t['at'] = 1015;
  44788. t['A'] = 667;
  44789. t['B'] = 667;
  44790. t['C'] = 722;
  44791. t['D'] = 722;
  44792. t['E'] = 667;
  44793. t['F'] = 611;
  44794. t['G'] = 778;
  44795. t['H'] = 722;
  44796. t['I'] = 278;
  44797. t['J'] = 500;
  44798. t['K'] = 667;
  44799. t['L'] = 556;
  44800. t['M'] = 833;
  44801. t['N'] = 722;
  44802. t['O'] = 778;
  44803. t['P'] = 667;
  44804. t['Q'] = 778;
  44805. t['R'] = 722;
  44806. t['S'] = 667;
  44807. t['T'] = 611;
  44808. t['U'] = 722;
  44809. t['V'] = 667;
  44810. t['W'] = 944;
  44811. t['X'] = 667;
  44812. t['Y'] = 667;
  44813. t['Z'] = 611;
  44814. t['bracketleft'] = 278;
  44815. t['backslash'] = 278;
  44816. t['bracketright'] = 278;
  44817. t['asciicircum'] = 469;
  44818. t['underscore'] = 556;
  44819. t['quoteleft'] = 222;
  44820. t['a'] = 556;
  44821. t['b'] = 556;
  44822. t['c'] = 500;
  44823. t['d'] = 556;
  44824. t['e'] = 556;
  44825. t['f'] = 278;
  44826. t['g'] = 556;
  44827. t['h'] = 556;
  44828. t['i'] = 222;
  44829. t['j'] = 222;
  44830. t['k'] = 500;
  44831. t['l'] = 222;
  44832. t['m'] = 833;
  44833. t['n'] = 556;
  44834. t['o'] = 556;
  44835. t['p'] = 556;
  44836. t['q'] = 556;
  44837. t['r'] = 333;
  44838. t['s'] = 500;
  44839. t['t'] = 278;
  44840. t['u'] = 556;
  44841. t['v'] = 500;
  44842. t['w'] = 722;
  44843. t['x'] = 500;
  44844. t['y'] = 500;
  44845. t['z'] = 500;
  44846. t['braceleft'] = 334;
  44847. t['bar'] = 260;
  44848. t['braceright'] = 334;
  44849. t['asciitilde'] = 584;
  44850. t['exclamdown'] = 333;
  44851. t['cent'] = 556;
  44852. t['sterling'] = 556;
  44853. t['fraction'] = 167;
  44854. t['yen'] = 556;
  44855. t['florin'] = 556;
  44856. t['section'] = 556;
  44857. t['currency'] = 556;
  44858. t['quotesingle'] = 191;
  44859. t['quotedblleft'] = 333;
  44860. t['guillemotleft'] = 556;
  44861. t['guilsinglleft'] = 333;
  44862. t['guilsinglright'] = 333;
  44863. t['fi'] = 500;
  44864. t['fl'] = 500;
  44865. t['endash'] = 556;
  44866. t['dagger'] = 556;
  44867. t['daggerdbl'] = 556;
  44868. t['periodcentered'] = 278;
  44869. t['paragraph'] = 537;
  44870. t['bullet'] = 350;
  44871. t['quotesinglbase'] = 222;
  44872. t['quotedblbase'] = 333;
  44873. t['quotedblright'] = 333;
  44874. t['guillemotright'] = 556;
  44875. t['ellipsis'] = 1000;
  44876. t['perthousand'] = 1000;
  44877. t['questiondown'] = 611;
  44878. t['grave'] = 333;
  44879. t['acute'] = 333;
  44880. t['circumflex'] = 333;
  44881. t['tilde'] = 333;
  44882. t['macron'] = 333;
  44883. t['breve'] = 333;
  44884. t['dotaccent'] = 333;
  44885. t['dieresis'] = 333;
  44886. t['ring'] = 333;
  44887. t['cedilla'] = 333;
  44888. t['hungarumlaut'] = 333;
  44889. t['ogonek'] = 333;
  44890. t['caron'] = 333;
  44891. t['emdash'] = 1000;
  44892. t['AE'] = 1000;
  44893. t['ordfeminine'] = 370;
  44894. t['Lslash'] = 556;
  44895. t['Oslash'] = 778;
  44896. t['OE'] = 1000;
  44897. t['ordmasculine'] = 365;
  44898. t['ae'] = 889;
  44899. t['dotlessi'] = 278;
  44900. t['lslash'] = 222;
  44901. t['oslash'] = 611;
  44902. t['oe'] = 944;
  44903. t['germandbls'] = 611;
  44904. t['Idieresis'] = 278;
  44905. t['eacute'] = 556;
  44906. t['abreve'] = 556;
  44907. t['uhungarumlaut'] = 556;
  44908. t['ecaron'] = 556;
  44909. t['Ydieresis'] = 667;
  44910. t['divide'] = 584;
  44911. t['Yacute'] = 667;
  44912. t['Acircumflex'] = 667;
  44913. t['aacute'] = 556;
  44914. t['Ucircumflex'] = 722;
  44915. t['yacute'] = 500;
  44916. t['scommaaccent'] = 500;
  44917. t['ecircumflex'] = 556;
  44918. t['Uring'] = 722;
  44919. t['Udieresis'] = 722;
  44920. t['aogonek'] = 556;
  44921. t['Uacute'] = 722;
  44922. t['uogonek'] = 556;
  44923. t['Edieresis'] = 667;
  44924. t['Dcroat'] = 722;
  44925. t['commaaccent'] = 250;
  44926. t['copyright'] = 737;
  44927. t['Emacron'] = 667;
  44928. t['ccaron'] = 500;
  44929. t['aring'] = 556;
  44930. t['Ncommaaccent'] = 722;
  44931. t['lacute'] = 222;
  44932. t['agrave'] = 556;
  44933. t['Tcommaaccent'] = 611;
  44934. t['Cacute'] = 722;
  44935. t['atilde'] = 556;
  44936. t['Edotaccent'] = 667;
  44937. t['scaron'] = 500;
  44938. t['scedilla'] = 500;
  44939. t['iacute'] = 278;
  44940. t['lozenge'] = 471;
  44941. t['Rcaron'] = 722;
  44942. t['Gcommaaccent'] = 778;
  44943. t['ucircumflex'] = 556;
  44944. t['acircumflex'] = 556;
  44945. t['Amacron'] = 667;
  44946. t['rcaron'] = 333;
  44947. t['ccedilla'] = 500;
  44948. t['Zdotaccent'] = 611;
  44949. t['Thorn'] = 667;
  44950. t['Omacron'] = 778;
  44951. t['Racute'] = 722;
  44952. t['Sacute'] = 667;
  44953. t['dcaron'] = 643;
  44954. t['Umacron'] = 722;
  44955. t['uring'] = 556;
  44956. t['threesuperior'] = 333;
  44957. t['Ograve'] = 778;
  44958. t['Agrave'] = 667;
  44959. t['Abreve'] = 667;
  44960. t['multiply'] = 584;
  44961. t['uacute'] = 556;
  44962. t['Tcaron'] = 611;
  44963. t['partialdiff'] = 476;
  44964. t['ydieresis'] = 500;
  44965. t['Nacute'] = 722;
  44966. t['icircumflex'] = 278;
  44967. t['Ecircumflex'] = 667;
  44968. t['adieresis'] = 556;
  44969. t['edieresis'] = 556;
  44970. t['cacute'] = 500;
  44971. t['nacute'] = 556;
  44972. t['umacron'] = 556;
  44973. t['Ncaron'] = 722;
  44974. t['Iacute'] = 278;
  44975. t['plusminus'] = 584;
  44976. t['brokenbar'] = 260;
  44977. t['registered'] = 737;
  44978. t['Gbreve'] = 778;
  44979. t['Idotaccent'] = 278;
  44980. t['summation'] = 600;
  44981. t['Egrave'] = 667;
  44982. t['racute'] = 333;
  44983. t['omacron'] = 556;
  44984. t['Zacute'] = 611;
  44985. t['Zcaron'] = 611;
  44986. t['greaterequal'] = 549;
  44987. t['Eth'] = 722;
  44988. t['Ccedilla'] = 722;
  44989. t['lcommaaccent'] = 222;
  44990. t['tcaron'] = 317;
  44991. t['eogonek'] = 556;
  44992. t['Uogonek'] = 722;
  44993. t['Aacute'] = 667;
  44994. t['Adieresis'] = 667;
  44995. t['egrave'] = 556;
  44996. t['zacute'] = 500;
  44997. t['iogonek'] = 222;
  44998. t['Oacute'] = 778;
  44999. t['oacute'] = 556;
  45000. t['amacron'] = 556;
  45001. t['sacute'] = 500;
  45002. t['idieresis'] = 278;
  45003. t['Ocircumflex'] = 778;
  45004. t['Ugrave'] = 722;
  45005. t['Delta'] = 612;
  45006. t['thorn'] = 556;
  45007. t['twosuperior'] = 333;
  45008. t['Odieresis'] = 778;
  45009. t['mu'] = 556;
  45010. t['igrave'] = 278;
  45011. t['ohungarumlaut'] = 556;
  45012. t['Eogonek'] = 667;
  45013. t['dcroat'] = 556;
  45014. t['threequarters'] = 834;
  45015. t['Scedilla'] = 667;
  45016. t['lcaron'] = 299;
  45017. t['Kcommaaccent'] = 667;
  45018. t['Lacute'] = 556;
  45019. t['trademark'] = 1000;
  45020. t['edotaccent'] = 556;
  45021. t['Igrave'] = 278;
  45022. t['Imacron'] = 278;
  45023. t['Lcaron'] = 556;
  45024. t['onehalf'] = 834;
  45025. t['lessequal'] = 549;
  45026. t['ocircumflex'] = 556;
  45027. t['ntilde'] = 556;
  45028. t['Uhungarumlaut'] = 722;
  45029. t['Eacute'] = 667;
  45030. t['emacron'] = 556;
  45031. t['gbreve'] = 556;
  45032. t['onequarter'] = 834;
  45033. t['Scaron'] = 667;
  45034. t['Scommaaccent'] = 667;
  45035. t['Ohungarumlaut'] = 778;
  45036. t['degree'] = 400;
  45037. t['ograve'] = 556;
  45038. t['Ccaron'] = 722;
  45039. t['ugrave'] = 556;
  45040. t['radical'] = 453;
  45041. t['Dcaron'] = 722;
  45042. t['rcommaaccent'] = 333;
  45043. t['Ntilde'] = 722;
  45044. t['otilde'] = 556;
  45045. t['Rcommaaccent'] = 722;
  45046. t['Lcommaaccent'] = 556;
  45047. t['Atilde'] = 667;
  45048. t['Aogonek'] = 667;
  45049. t['Aring'] = 667;
  45050. t['Otilde'] = 778;
  45051. t['zdotaccent'] = 500;
  45052. t['Ecaron'] = 667;
  45053. t['Iogonek'] = 278;
  45054. t['kcommaaccent'] = 500;
  45055. t['minus'] = 584;
  45056. t['Icircumflex'] = 278;
  45057. t['ncaron'] = 556;
  45058. t['tcommaaccent'] = 278;
  45059. t['logicalnot'] = 584;
  45060. t['odieresis'] = 556;
  45061. t['udieresis'] = 556;
  45062. t['notequal'] = 549;
  45063. t['gcommaaccent'] = 556;
  45064. t['eth'] = 556;
  45065. t['zcaron'] = 500;
  45066. t['ncommaaccent'] = 556;
  45067. t['onesuperior'] = 333;
  45068. t['imacron'] = 278;
  45069. t['Euro'] = 556;
  45070. });
  45071. t['Helvetica-Bold'] = getLookupTableFactory(function (t) {
  45072. t['space'] = 278;
  45073. t['exclam'] = 333;
  45074. t['quotedbl'] = 474;
  45075. t['numbersign'] = 556;
  45076. t['dollar'] = 556;
  45077. t['percent'] = 889;
  45078. t['ampersand'] = 722;
  45079. t['quoteright'] = 278;
  45080. t['parenleft'] = 333;
  45081. t['parenright'] = 333;
  45082. t['asterisk'] = 389;
  45083. t['plus'] = 584;
  45084. t['comma'] = 278;
  45085. t['hyphen'] = 333;
  45086. t['period'] = 278;
  45087. t['slash'] = 278;
  45088. t['zero'] = 556;
  45089. t['one'] = 556;
  45090. t['two'] = 556;
  45091. t['three'] = 556;
  45092. t['four'] = 556;
  45093. t['five'] = 556;
  45094. t['six'] = 556;
  45095. t['seven'] = 556;
  45096. t['eight'] = 556;
  45097. t['nine'] = 556;
  45098. t['colon'] = 333;
  45099. t['semicolon'] = 333;
  45100. t['less'] = 584;
  45101. t['equal'] = 584;
  45102. t['greater'] = 584;
  45103. t['question'] = 611;
  45104. t['at'] = 975;
  45105. t['A'] = 722;
  45106. t['B'] = 722;
  45107. t['C'] = 722;
  45108. t['D'] = 722;
  45109. t['E'] = 667;
  45110. t['F'] = 611;
  45111. t['G'] = 778;
  45112. t['H'] = 722;
  45113. t['I'] = 278;
  45114. t['J'] = 556;
  45115. t['K'] = 722;
  45116. t['L'] = 611;
  45117. t['M'] = 833;
  45118. t['N'] = 722;
  45119. t['O'] = 778;
  45120. t['P'] = 667;
  45121. t['Q'] = 778;
  45122. t['R'] = 722;
  45123. t['S'] = 667;
  45124. t['T'] = 611;
  45125. t['U'] = 722;
  45126. t['V'] = 667;
  45127. t['W'] = 944;
  45128. t['X'] = 667;
  45129. t['Y'] = 667;
  45130. t['Z'] = 611;
  45131. t['bracketleft'] = 333;
  45132. t['backslash'] = 278;
  45133. t['bracketright'] = 333;
  45134. t['asciicircum'] = 584;
  45135. t['underscore'] = 556;
  45136. t['quoteleft'] = 278;
  45137. t['a'] = 556;
  45138. t['b'] = 611;
  45139. t['c'] = 556;
  45140. t['d'] = 611;
  45141. t['e'] = 556;
  45142. t['f'] = 333;
  45143. t['g'] = 611;
  45144. t['h'] = 611;
  45145. t['i'] = 278;
  45146. t['j'] = 278;
  45147. t['k'] = 556;
  45148. t['l'] = 278;
  45149. t['m'] = 889;
  45150. t['n'] = 611;
  45151. t['o'] = 611;
  45152. t['p'] = 611;
  45153. t['q'] = 611;
  45154. t['r'] = 389;
  45155. t['s'] = 556;
  45156. t['t'] = 333;
  45157. t['u'] = 611;
  45158. t['v'] = 556;
  45159. t['w'] = 778;
  45160. t['x'] = 556;
  45161. t['y'] = 556;
  45162. t['z'] = 500;
  45163. t['braceleft'] = 389;
  45164. t['bar'] = 280;
  45165. t['braceright'] = 389;
  45166. t['asciitilde'] = 584;
  45167. t['exclamdown'] = 333;
  45168. t['cent'] = 556;
  45169. t['sterling'] = 556;
  45170. t['fraction'] = 167;
  45171. t['yen'] = 556;
  45172. t['florin'] = 556;
  45173. t['section'] = 556;
  45174. t['currency'] = 556;
  45175. t['quotesingle'] = 238;
  45176. t['quotedblleft'] = 500;
  45177. t['guillemotleft'] = 556;
  45178. t['guilsinglleft'] = 333;
  45179. t['guilsinglright'] = 333;
  45180. t['fi'] = 611;
  45181. t['fl'] = 611;
  45182. t['endash'] = 556;
  45183. t['dagger'] = 556;
  45184. t['daggerdbl'] = 556;
  45185. t['periodcentered'] = 278;
  45186. t['paragraph'] = 556;
  45187. t['bullet'] = 350;
  45188. t['quotesinglbase'] = 278;
  45189. t['quotedblbase'] = 500;
  45190. t['quotedblright'] = 500;
  45191. t['guillemotright'] = 556;
  45192. t['ellipsis'] = 1000;
  45193. t['perthousand'] = 1000;
  45194. t['questiondown'] = 611;
  45195. t['grave'] = 333;
  45196. t['acute'] = 333;
  45197. t['circumflex'] = 333;
  45198. t['tilde'] = 333;
  45199. t['macron'] = 333;
  45200. t['breve'] = 333;
  45201. t['dotaccent'] = 333;
  45202. t['dieresis'] = 333;
  45203. t['ring'] = 333;
  45204. t['cedilla'] = 333;
  45205. t['hungarumlaut'] = 333;
  45206. t['ogonek'] = 333;
  45207. t['caron'] = 333;
  45208. t['emdash'] = 1000;
  45209. t['AE'] = 1000;
  45210. t['ordfeminine'] = 370;
  45211. t['Lslash'] = 611;
  45212. t['Oslash'] = 778;
  45213. t['OE'] = 1000;
  45214. t['ordmasculine'] = 365;
  45215. t['ae'] = 889;
  45216. t['dotlessi'] = 278;
  45217. t['lslash'] = 278;
  45218. t['oslash'] = 611;
  45219. t['oe'] = 944;
  45220. t['germandbls'] = 611;
  45221. t['Idieresis'] = 278;
  45222. t['eacute'] = 556;
  45223. t['abreve'] = 556;
  45224. t['uhungarumlaut'] = 611;
  45225. t['ecaron'] = 556;
  45226. t['Ydieresis'] = 667;
  45227. t['divide'] = 584;
  45228. t['Yacute'] = 667;
  45229. t['Acircumflex'] = 722;
  45230. t['aacute'] = 556;
  45231. t['Ucircumflex'] = 722;
  45232. t['yacute'] = 556;
  45233. t['scommaaccent'] = 556;
  45234. t['ecircumflex'] = 556;
  45235. t['Uring'] = 722;
  45236. t['Udieresis'] = 722;
  45237. t['aogonek'] = 556;
  45238. t['Uacute'] = 722;
  45239. t['uogonek'] = 611;
  45240. t['Edieresis'] = 667;
  45241. t['Dcroat'] = 722;
  45242. t['commaaccent'] = 250;
  45243. t['copyright'] = 737;
  45244. t['Emacron'] = 667;
  45245. t['ccaron'] = 556;
  45246. t['aring'] = 556;
  45247. t['Ncommaaccent'] = 722;
  45248. t['lacute'] = 278;
  45249. t['agrave'] = 556;
  45250. t['Tcommaaccent'] = 611;
  45251. t['Cacute'] = 722;
  45252. t['atilde'] = 556;
  45253. t['Edotaccent'] = 667;
  45254. t['scaron'] = 556;
  45255. t['scedilla'] = 556;
  45256. t['iacute'] = 278;
  45257. t['lozenge'] = 494;
  45258. t['Rcaron'] = 722;
  45259. t['Gcommaaccent'] = 778;
  45260. t['ucircumflex'] = 611;
  45261. t['acircumflex'] = 556;
  45262. t['Amacron'] = 722;
  45263. t['rcaron'] = 389;
  45264. t['ccedilla'] = 556;
  45265. t['Zdotaccent'] = 611;
  45266. t['Thorn'] = 667;
  45267. t['Omacron'] = 778;
  45268. t['Racute'] = 722;
  45269. t['Sacute'] = 667;
  45270. t['dcaron'] = 743;
  45271. t['Umacron'] = 722;
  45272. t['uring'] = 611;
  45273. t['threesuperior'] = 333;
  45274. t['Ograve'] = 778;
  45275. t['Agrave'] = 722;
  45276. t['Abreve'] = 722;
  45277. t['multiply'] = 584;
  45278. t['uacute'] = 611;
  45279. t['Tcaron'] = 611;
  45280. t['partialdiff'] = 494;
  45281. t['ydieresis'] = 556;
  45282. t['Nacute'] = 722;
  45283. t['icircumflex'] = 278;
  45284. t['Ecircumflex'] = 667;
  45285. t['adieresis'] = 556;
  45286. t['edieresis'] = 556;
  45287. t['cacute'] = 556;
  45288. t['nacute'] = 611;
  45289. t['umacron'] = 611;
  45290. t['Ncaron'] = 722;
  45291. t['Iacute'] = 278;
  45292. t['plusminus'] = 584;
  45293. t['brokenbar'] = 280;
  45294. t['registered'] = 737;
  45295. t['Gbreve'] = 778;
  45296. t['Idotaccent'] = 278;
  45297. t['summation'] = 600;
  45298. t['Egrave'] = 667;
  45299. t['racute'] = 389;
  45300. t['omacron'] = 611;
  45301. t['Zacute'] = 611;
  45302. t['Zcaron'] = 611;
  45303. t['greaterequal'] = 549;
  45304. t['Eth'] = 722;
  45305. t['Ccedilla'] = 722;
  45306. t['lcommaaccent'] = 278;
  45307. t['tcaron'] = 389;
  45308. t['eogonek'] = 556;
  45309. t['Uogonek'] = 722;
  45310. t['Aacute'] = 722;
  45311. t['Adieresis'] = 722;
  45312. t['egrave'] = 556;
  45313. t['zacute'] = 500;
  45314. t['iogonek'] = 278;
  45315. t['Oacute'] = 778;
  45316. t['oacute'] = 611;
  45317. t['amacron'] = 556;
  45318. t['sacute'] = 556;
  45319. t['idieresis'] = 278;
  45320. t['Ocircumflex'] = 778;
  45321. t['Ugrave'] = 722;
  45322. t['Delta'] = 612;
  45323. t['thorn'] = 611;
  45324. t['twosuperior'] = 333;
  45325. t['Odieresis'] = 778;
  45326. t['mu'] = 611;
  45327. t['igrave'] = 278;
  45328. t['ohungarumlaut'] = 611;
  45329. t['Eogonek'] = 667;
  45330. t['dcroat'] = 611;
  45331. t['threequarters'] = 834;
  45332. t['Scedilla'] = 667;
  45333. t['lcaron'] = 400;
  45334. t['Kcommaaccent'] = 722;
  45335. t['Lacute'] = 611;
  45336. t['trademark'] = 1000;
  45337. t['edotaccent'] = 556;
  45338. t['Igrave'] = 278;
  45339. t['Imacron'] = 278;
  45340. t['Lcaron'] = 611;
  45341. t['onehalf'] = 834;
  45342. t['lessequal'] = 549;
  45343. t['ocircumflex'] = 611;
  45344. t['ntilde'] = 611;
  45345. t['Uhungarumlaut'] = 722;
  45346. t['Eacute'] = 667;
  45347. t['emacron'] = 556;
  45348. t['gbreve'] = 611;
  45349. t['onequarter'] = 834;
  45350. t['Scaron'] = 667;
  45351. t['Scommaaccent'] = 667;
  45352. t['Ohungarumlaut'] = 778;
  45353. t['degree'] = 400;
  45354. t['ograve'] = 611;
  45355. t['Ccaron'] = 722;
  45356. t['ugrave'] = 611;
  45357. t['radical'] = 549;
  45358. t['Dcaron'] = 722;
  45359. t['rcommaaccent'] = 389;
  45360. t['Ntilde'] = 722;
  45361. t['otilde'] = 611;
  45362. t['Rcommaaccent'] = 722;
  45363. t['Lcommaaccent'] = 611;
  45364. t['Atilde'] = 722;
  45365. t['Aogonek'] = 722;
  45366. t['Aring'] = 722;
  45367. t['Otilde'] = 778;
  45368. t['zdotaccent'] = 500;
  45369. t['Ecaron'] = 667;
  45370. t['Iogonek'] = 278;
  45371. t['kcommaaccent'] = 556;
  45372. t['minus'] = 584;
  45373. t['Icircumflex'] = 278;
  45374. t['ncaron'] = 611;
  45375. t['tcommaaccent'] = 333;
  45376. t['logicalnot'] = 584;
  45377. t['odieresis'] = 611;
  45378. t['udieresis'] = 611;
  45379. t['notequal'] = 549;
  45380. t['gcommaaccent'] = 611;
  45381. t['eth'] = 611;
  45382. t['zcaron'] = 500;
  45383. t['ncommaaccent'] = 611;
  45384. t['onesuperior'] = 333;
  45385. t['imacron'] = 278;
  45386. t['Euro'] = 556;
  45387. });
  45388. t['Helvetica-BoldOblique'] = getLookupTableFactory(function (t) {
  45389. t['space'] = 278;
  45390. t['exclam'] = 333;
  45391. t['quotedbl'] = 474;
  45392. t['numbersign'] = 556;
  45393. t['dollar'] = 556;
  45394. t['percent'] = 889;
  45395. t['ampersand'] = 722;
  45396. t['quoteright'] = 278;
  45397. t['parenleft'] = 333;
  45398. t['parenright'] = 333;
  45399. t['asterisk'] = 389;
  45400. t['plus'] = 584;
  45401. t['comma'] = 278;
  45402. t['hyphen'] = 333;
  45403. t['period'] = 278;
  45404. t['slash'] = 278;
  45405. t['zero'] = 556;
  45406. t['one'] = 556;
  45407. t['two'] = 556;
  45408. t['three'] = 556;
  45409. t['four'] = 556;
  45410. t['five'] = 556;
  45411. t['six'] = 556;
  45412. t['seven'] = 556;
  45413. t['eight'] = 556;
  45414. t['nine'] = 556;
  45415. t['colon'] = 333;
  45416. t['semicolon'] = 333;
  45417. t['less'] = 584;
  45418. t['equal'] = 584;
  45419. t['greater'] = 584;
  45420. t['question'] = 611;
  45421. t['at'] = 975;
  45422. t['A'] = 722;
  45423. t['B'] = 722;
  45424. t['C'] = 722;
  45425. t['D'] = 722;
  45426. t['E'] = 667;
  45427. t['F'] = 611;
  45428. t['G'] = 778;
  45429. t['H'] = 722;
  45430. t['I'] = 278;
  45431. t['J'] = 556;
  45432. t['K'] = 722;
  45433. t['L'] = 611;
  45434. t['M'] = 833;
  45435. t['N'] = 722;
  45436. t['O'] = 778;
  45437. t['P'] = 667;
  45438. t['Q'] = 778;
  45439. t['R'] = 722;
  45440. t['S'] = 667;
  45441. t['T'] = 611;
  45442. t['U'] = 722;
  45443. t['V'] = 667;
  45444. t['W'] = 944;
  45445. t['X'] = 667;
  45446. t['Y'] = 667;
  45447. t['Z'] = 611;
  45448. t['bracketleft'] = 333;
  45449. t['backslash'] = 278;
  45450. t['bracketright'] = 333;
  45451. t['asciicircum'] = 584;
  45452. t['underscore'] = 556;
  45453. t['quoteleft'] = 278;
  45454. t['a'] = 556;
  45455. t['b'] = 611;
  45456. t['c'] = 556;
  45457. t['d'] = 611;
  45458. t['e'] = 556;
  45459. t['f'] = 333;
  45460. t['g'] = 611;
  45461. t['h'] = 611;
  45462. t['i'] = 278;
  45463. t['j'] = 278;
  45464. t['k'] = 556;
  45465. t['l'] = 278;
  45466. t['m'] = 889;
  45467. t['n'] = 611;
  45468. t['o'] = 611;
  45469. t['p'] = 611;
  45470. t['q'] = 611;
  45471. t['r'] = 389;
  45472. t['s'] = 556;
  45473. t['t'] = 333;
  45474. t['u'] = 611;
  45475. t['v'] = 556;
  45476. t['w'] = 778;
  45477. t['x'] = 556;
  45478. t['y'] = 556;
  45479. t['z'] = 500;
  45480. t['braceleft'] = 389;
  45481. t['bar'] = 280;
  45482. t['braceright'] = 389;
  45483. t['asciitilde'] = 584;
  45484. t['exclamdown'] = 333;
  45485. t['cent'] = 556;
  45486. t['sterling'] = 556;
  45487. t['fraction'] = 167;
  45488. t['yen'] = 556;
  45489. t['florin'] = 556;
  45490. t['section'] = 556;
  45491. t['currency'] = 556;
  45492. t['quotesingle'] = 238;
  45493. t['quotedblleft'] = 500;
  45494. t['guillemotleft'] = 556;
  45495. t['guilsinglleft'] = 333;
  45496. t['guilsinglright'] = 333;
  45497. t['fi'] = 611;
  45498. t['fl'] = 611;
  45499. t['endash'] = 556;
  45500. t['dagger'] = 556;
  45501. t['daggerdbl'] = 556;
  45502. t['periodcentered'] = 278;
  45503. t['paragraph'] = 556;
  45504. t['bullet'] = 350;
  45505. t['quotesinglbase'] = 278;
  45506. t['quotedblbase'] = 500;
  45507. t['quotedblright'] = 500;
  45508. t['guillemotright'] = 556;
  45509. t['ellipsis'] = 1000;
  45510. t['perthousand'] = 1000;
  45511. t['questiondown'] = 611;
  45512. t['grave'] = 333;
  45513. t['acute'] = 333;
  45514. t['circumflex'] = 333;
  45515. t['tilde'] = 333;
  45516. t['macron'] = 333;
  45517. t['breve'] = 333;
  45518. t['dotaccent'] = 333;
  45519. t['dieresis'] = 333;
  45520. t['ring'] = 333;
  45521. t['cedilla'] = 333;
  45522. t['hungarumlaut'] = 333;
  45523. t['ogonek'] = 333;
  45524. t['caron'] = 333;
  45525. t['emdash'] = 1000;
  45526. t['AE'] = 1000;
  45527. t['ordfeminine'] = 370;
  45528. t['Lslash'] = 611;
  45529. t['Oslash'] = 778;
  45530. t['OE'] = 1000;
  45531. t['ordmasculine'] = 365;
  45532. t['ae'] = 889;
  45533. t['dotlessi'] = 278;
  45534. t['lslash'] = 278;
  45535. t['oslash'] = 611;
  45536. t['oe'] = 944;
  45537. t['germandbls'] = 611;
  45538. t['Idieresis'] = 278;
  45539. t['eacute'] = 556;
  45540. t['abreve'] = 556;
  45541. t['uhungarumlaut'] = 611;
  45542. t['ecaron'] = 556;
  45543. t['Ydieresis'] = 667;
  45544. t['divide'] = 584;
  45545. t['Yacute'] = 667;
  45546. t['Acircumflex'] = 722;
  45547. t['aacute'] = 556;
  45548. t['Ucircumflex'] = 722;
  45549. t['yacute'] = 556;
  45550. t['scommaaccent'] = 556;
  45551. t['ecircumflex'] = 556;
  45552. t['Uring'] = 722;
  45553. t['Udieresis'] = 722;
  45554. t['aogonek'] = 556;
  45555. t['Uacute'] = 722;
  45556. t['uogonek'] = 611;
  45557. t['Edieresis'] = 667;
  45558. t['Dcroat'] = 722;
  45559. t['commaaccent'] = 250;
  45560. t['copyright'] = 737;
  45561. t['Emacron'] = 667;
  45562. t['ccaron'] = 556;
  45563. t['aring'] = 556;
  45564. t['Ncommaaccent'] = 722;
  45565. t['lacute'] = 278;
  45566. t['agrave'] = 556;
  45567. t['Tcommaaccent'] = 611;
  45568. t['Cacute'] = 722;
  45569. t['atilde'] = 556;
  45570. t['Edotaccent'] = 667;
  45571. t['scaron'] = 556;
  45572. t['scedilla'] = 556;
  45573. t['iacute'] = 278;
  45574. t['lozenge'] = 494;
  45575. t['Rcaron'] = 722;
  45576. t['Gcommaaccent'] = 778;
  45577. t['ucircumflex'] = 611;
  45578. t['acircumflex'] = 556;
  45579. t['Amacron'] = 722;
  45580. t['rcaron'] = 389;
  45581. t['ccedilla'] = 556;
  45582. t['Zdotaccent'] = 611;
  45583. t['Thorn'] = 667;
  45584. t['Omacron'] = 778;
  45585. t['Racute'] = 722;
  45586. t['Sacute'] = 667;
  45587. t['dcaron'] = 743;
  45588. t['Umacron'] = 722;
  45589. t['uring'] = 611;
  45590. t['threesuperior'] = 333;
  45591. t['Ograve'] = 778;
  45592. t['Agrave'] = 722;
  45593. t['Abreve'] = 722;
  45594. t['multiply'] = 584;
  45595. t['uacute'] = 611;
  45596. t['Tcaron'] = 611;
  45597. t['partialdiff'] = 494;
  45598. t['ydieresis'] = 556;
  45599. t['Nacute'] = 722;
  45600. t['icircumflex'] = 278;
  45601. t['Ecircumflex'] = 667;
  45602. t['adieresis'] = 556;
  45603. t['edieresis'] = 556;
  45604. t['cacute'] = 556;
  45605. t['nacute'] = 611;
  45606. t['umacron'] = 611;
  45607. t['Ncaron'] = 722;
  45608. t['Iacute'] = 278;
  45609. t['plusminus'] = 584;
  45610. t['brokenbar'] = 280;
  45611. t['registered'] = 737;
  45612. t['Gbreve'] = 778;
  45613. t['Idotaccent'] = 278;
  45614. t['summation'] = 600;
  45615. t['Egrave'] = 667;
  45616. t['racute'] = 389;
  45617. t['omacron'] = 611;
  45618. t['Zacute'] = 611;
  45619. t['Zcaron'] = 611;
  45620. t['greaterequal'] = 549;
  45621. t['Eth'] = 722;
  45622. t['Ccedilla'] = 722;
  45623. t['lcommaaccent'] = 278;
  45624. t['tcaron'] = 389;
  45625. t['eogonek'] = 556;
  45626. t['Uogonek'] = 722;
  45627. t['Aacute'] = 722;
  45628. t['Adieresis'] = 722;
  45629. t['egrave'] = 556;
  45630. t['zacute'] = 500;
  45631. t['iogonek'] = 278;
  45632. t['Oacute'] = 778;
  45633. t['oacute'] = 611;
  45634. t['amacron'] = 556;
  45635. t['sacute'] = 556;
  45636. t['idieresis'] = 278;
  45637. t['Ocircumflex'] = 778;
  45638. t['Ugrave'] = 722;
  45639. t['Delta'] = 612;
  45640. t['thorn'] = 611;
  45641. t['twosuperior'] = 333;
  45642. t['Odieresis'] = 778;
  45643. t['mu'] = 611;
  45644. t['igrave'] = 278;
  45645. t['ohungarumlaut'] = 611;
  45646. t['Eogonek'] = 667;
  45647. t['dcroat'] = 611;
  45648. t['threequarters'] = 834;
  45649. t['Scedilla'] = 667;
  45650. t['lcaron'] = 400;
  45651. t['Kcommaaccent'] = 722;
  45652. t['Lacute'] = 611;
  45653. t['trademark'] = 1000;
  45654. t['edotaccent'] = 556;
  45655. t['Igrave'] = 278;
  45656. t['Imacron'] = 278;
  45657. t['Lcaron'] = 611;
  45658. t['onehalf'] = 834;
  45659. t['lessequal'] = 549;
  45660. t['ocircumflex'] = 611;
  45661. t['ntilde'] = 611;
  45662. t['Uhungarumlaut'] = 722;
  45663. t['Eacute'] = 667;
  45664. t['emacron'] = 556;
  45665. t['gbreve'] = 611;
  45666. t['onequarter'] = 834;
  45667. t['Scaron'] = 667;
  45668. t['Scommaaccent'] = 667;
  45669. t['Ohungarumlaut'] = 778;
  45670. t['degree'] = 400;
  45671. t['ograve'] = 611;
  45672. t['Ccaron'] = 722;
  45673. t['ugrave'] = 611;
  45674. t['radical'] = 549;
  45675. t['Dcaron'] = 722;
  45676. t['rcommaaccent'] = 389;
  45677. t['Ntilde'] = 722;
  45678. t['otilde'] = 611;
  45679. t['Rcommaaccent'] = 722;
  45680. t['Lcommaaccent'] = 611;
  45681. t['Atilde'] = 722;
  45682. t['Aogonek'] = 722;
  45683. t['Aring'] = 722;
  45684. t['Otilde'] = 778;
  45685. t['zdotaccent'] = 500;
  45686. t['Ecaron'] = 667;
  45687. t['Iogonek'] = 278;
  45688. t['kcommaaccent'] = 556;
  45689. t['minus'] = 584;
  45690. t['Icircumflex'] = 278;
  45691. t['ncaron'] = 611;
  45692. t['tcommaaccent'] = 333;
  45693. t['logicalnot'] = 584;
  45694. t['odieresis'] = 611;
  45695. t['udieresis'] = 611;
  45696. t['notequal'] = 549;
  45697. t['gcommaaccent'] = 611;
  45698. t['eth'] = 611;
  45699. t['zcaron'] = 500;
  45700. t['ncommaaccent'] = 611;
  45701. t['onesuperior'] = 333;
  45702. t['imacron'] = 278;
  45703. t['Euro'] = 556;
  45704. });
  45705. t['Helvetica-Oblique'] = getLookupTableFactory(function (t) {
  45706. t['space'] = 278;
  45707. t['exclam'] = 278;
  45708. t['quotedbl'] = 355;
  45709. t['numbersign'] = 556;
  45710. t['dollar'] = 556;
  45711. t['percent'] = 889;
  45712. t['ampersand'] = 667;
  45713. t['quoteright'] = 222;
  45714. t['parenleft'] = 333;
  45715. t['parenright'] = 333;
  45716. t['asterisk'] = 389;
  45717. t['plus'] = 584;
  45718. t['comma'] = 278;
  45719. t['hyphen'] = 333;
  45720. t['period'] = 278;
  45721. t['slash'] = 278;
  45722. t['zero'] = 556;
  45723. t['one'] = 556;
  45724. t['two'] = 556;
  45725. t['three'] = 556;
  45726. t['four'] = 556;
  45727. t['five'] = 556;
  45728. t['six'] = 556;
  45729. t['seven'] = 556;
  45730. t['eight'] = 556;
  45731. t['nine'] = 556;
  45732. t['colon'] = 278;
  45733. t['semicolon'] = 278;
  45734. t['less'] = 584;
  45735. t['equal'] = 584;
  45736. t['greater'] = 584;
  45737. t['question'] = 556;
  45738. t['at'] = 1015;
  45739. t['A'] = 667;
  45740. t['B'] = 667;
  45741. t['C'] = 722;
  45742. t['D'] = 722;
  45743. t['E'] = 667;
  45744. t['F'] = 611;
  45745. t['G'] = 778;
  45746. t['H'] = 722;
  45747. t['I'] = 278;
  45748. t['J'] = 500;
  45749. t['K'] = 667;
  45750. t['L'] = 556;
  45751. t['M'] = 833;
  45752. t['N'] = 722;
  45753. t['O'] = 778;
  45754. t['P'] = 667;
  45755. t['Q'] = 778;
  45756. t['R'] = 722;
  45757. t['S'] = 667;
  45758. t['T'] = 611;
  45759. t['U'] = 722;
  45760. t['V'] = 667;
  45761. t['W'] = 944;
  45762. t['X'] = 667;
  45763. t['Y'] = 667;
  45764. t['Z'] = 611;
  45765. t['bracketleft'] = 278;
  45766. t['backslash'] = 278;
  45767. t['bracketright'] = 278;
  45768. t['asciicircum'] = 469;
  45769. t['underscore'] = 556;
  45770. t['quoteleft'] = 222;
  45771. t['a'] = 556;
  45772. t['b'] = 556;
  45773. t['c'] = 500;
  45774. t['d'] = 556;
  45775. t['e'] = 556;
  45776. t['f'] = 278;
  45777. t['g'] = 556;
  45778. t['h'] = 556;
  45779. t['i'] = 222;
  45780. t['j'] = 222;
  45781. t['k'] = 500;
  45782. t['l'] = 222;
  45783. t['m'] = 833;
  45784. t['n'] = 556;
  45785. t['o'] = 556;
  45786. t['p'] = 556;
  45787. t['q'] = 556;
  45788. t['r'] = 333;
  45789. t['s'] = 500;
  45790. t['t'] = 278;
  45791. t['u'] = 556;
  45792. t['v'] = 500;
  45793. t['w'] = 722;
  45794. t['x'] = 500;
  45795. t['y'] = 500;
  45796. t['z'] = 500;
  45797. t['braceleft'] = 334;
  45798. t['bar'] = 260;
  45799. t['braceright'] = 334;
  45800. t['asciitilde'] = 584;
  45801. t['exclamdown'] = 333;
  45802. t['cent'] = 556;
  45803. t['sterling'] = 556;
  45804. t['fraction'] = 167;
  45805. t['yen'] = 556;
  45806. t['florin'] = 556;
  45807. t['section'] = 556;
  45808. t['currency'] = 556;
  45809. t['quotesingle'] = 191;
  45810. t['quotedblleft'] = 333;
  45811. t['guillemotleft'] = 556;
  45812. t['guilsinglleft'] = 333;
  45813. t['guilsinglright'] = 333;
  45814. t['fi'] = 500;
  45815. t['fl'] = 500;
  45816. t['endash'] = 556;
  45817. t['dagger'] = 556;
  45818. t['daggerdbl'] = 556;
  45819. t['periodcentered'] = 278;
  45820. t['paragraph'] = 537;
  45821. t['bullet'] = 350;
  45822. t['quotesinglbase'] = 222;
  45823. t['quotedblbase'] = 333;
  45824. t['quotedblright'] = 333;
  45825. t['guillemotright'] = 556;
  45826. t['ellipsis'] = 1000;
  45827. t['perthousand'] = 1000;
  45828. t['questiondown'] = 611;
  45829. t['grave'] = 333;
  45830. t['acute'] = 333;
  45831. t['circumflex'] = 333;
  45832. t['tilde'] = 333;
  45833. t['macron'] = 333;
  45834. t['breve'] = 333;
  45835. t['dotaccent'] = 333;
  45836. t['dieresis'] = 333;
  45837. t['ring'] = 333;
  45838. t['cedilla'] = 333;
  45839. t['hungarumlaut'] = 333;
  45840. t['ogonek'] = 333;
  45841. t['caron'] = 333;
  45842. t['emdash'] = 1000;
  45843. t['AE'] = 1000;
  45844. t['ordfeminine'] = 370;
  45845. t['Lslash'] = 556;
  45846. t['Oslash'] = 778;
  45847. t['OE'] = 1000;
  45848. t['ordmasculine'] = 365;
  45849. t['ae'] = 889;
  45850. t['dotlessi'] = 278;
  45851. t['lslash'] = 222;
  45852. t['oslash'] = 611;
  45853. t['oe'] = 944;
  45854. t['germandbls'] = 611;
  45855. t['Idieresis'] = 278;
  45856. t['eacute'] = 556;
  45857. t['abreve'] = 556;
  45858. t['uhungarumlaut'] = 556;
  45859. t['ecaron'] = 556;
  45860. t['Ydieresis'] = 667;
  45861. t['divide'] = 584;
  45862. t['Yacute'] = 667;
  45863. t['Acircumflex'] = 667;
  45864. t['aacute'] = 556;
  45865. t['Ucircumflex'] = 722;
  45866. t['yacute'] = 500;
  45867. t['scommaaccent'] = 500;
  45868. t['ecircumflex'] = 556;
  45869. t['Uring'] = 722;
  45870. t['Udieresis'] = 722;
  45871. t['aogonek'] = 556;
  45872. t['Uacute'] = 722;
  45873. t['uogonek'] = 556;
  45874. t['Edieresis'] = 667;
  45875. t['Dcroat'] = 722;
  45876. t['commaaccent'] = 250;
  45877. t['copyright'] = 737;
  45878. t['Emacron'] = 667;
  45879. t['ccaron'] = 500;
  45880. t['aring'] = 556;
  45881. t['Ncommaaccent'] = 722;
  45882. t['lacute'] = 222;
  45883. t['agrave'] = 556;
  45884. t['Tcommaaccent'] = 611;
  45885. t['Cacute'] = 722;
  45886. t['atilde'] = 556;
  45887. t['Edotaccent'] = 667;
  45888. t['scaron'] = 500;
  45889. t['scedilla'] = 500;
  45890. t['iacute'] = 278;
  45891. t['lozenge'] = 471;
  45892. t['Rcaron'] = 722;
  45893. t['Gcommaaccent'] = 778;
  45894. t['ucircumflex'] = 556;
  45895. t['acircumflex'] = 556;
  45896. t['Amacron'] = 667;
  45897. t['rcaron'] = 333;
  45898. t['ccedilla'] = 500;
  45899. t['Zdotaccent'] = 611;
  45900. t['Thorn'] = 667;
  45901. t['Omacron'] = 778;
  45902. t['Racute'] = 722;
  45903. t['Sacute'] = 667;
  45904. t['dcaron'] = 643;
  45905. t['Umacron'] = 722;
  45906. t['uring'] = 556;
  45907. t['threesuperior'] = 333;
  45908. t['Ograve'] = 778;
  45909. t['Agrave'] = 667;
  45910. t['Abreve'] = 667;
  45911. t['multiply'] = 584;
  45912. t['uacute'] = 556;
  45913. t['Tcaron'] = 611;
  45914. t['partialdiff'] = 476;
  45915. t['ydieresis'] = 500;
  45916. t['Nacute'] = 722;
  45917. t['icircumflex'] = 278;
  45918. t['Ecircumflex'] = 667;
  45919. t['adieresis'] = 556;
  45920. t['edieresis'] = 556;
  45921. t['cacute'] = 500;
  45922. t['nacute'] = 556;
  45923. t['umacron'] = 556;
  45924. t['Ncaron'] = 722;
  45925. t['Iacute'] = 278;
  45926. t['plusminus'] = 584;
  45927. t['brokenbar'] = 260;
  45928. t['registered'] = 737;
  45929. t['Gbreve'] = 778;
  45930. t['Idotaccent'] = 278;
  45931. t['summation'] = 600;
  45932. t['Egrave'] = 667;
  45933. t['racute'] = 333;
  45934. t['omacron'] = 556;
  45935. t['Zacute'] = 611;
  45936. t['Zcaron'] = 611;
  45937. t['greaterequal'] = 549;
  45938. t['Eth'] = 722;
  45939. t['Ccedilla'] = 722;
  45940. t['lcommaaccent'] = 222;
  45941. t['tcaron'] = 317;
  45942. t['eogonek'] = 556;
  45943. t['Uogonek'] = 722;
  45944. t['Aacute'] = 667;
  45945. t['Adieresis'] = 667;
  45946. t['egrave'] = 556;
  45947. t['zacute'] = 500;
  45948. t['iogonek'] = 222;
  45949. t['Oacute'] = 778;
  45950. t['oacute'] = 556;
  45951. t['amacron'] = 556;
  45952. t['sacute'] = 500;
  45953. t['idieresis'] = 278;
  45954. t['Ocircumflex'] = 778;
  45955. t['Ugrave'] = 722;
  45956. t['Delta'] = 612;
  45957. t['thorn'] = 556;
  45958. t['twosuperior'] = 333;
  45959. t['Odieresis'] = 778;
  45960. t['mu'] = 556;
  45961. t['igrave'] = 278;
  45962. t['ohungarumlaut'] = 556;
  45963. t['Eogonek'] = 667;
  45964. t['dcroat'] = 556;
  45965. t['threequarters'] = 834;
  45966. t['Scedilla'] = 667;
  45967. t['lcaron'] = 299;
  45968. t['Kcommaaccent'] = 667;
  45969. t['Lacute'] = 556;
  45970. t['trademark'] = 1000;
  45971. t['edotaccent'] = 556;
  45972. t['Igrave'] = 278;
  45973. t['Imacron'] = 278;
  45974. t['Lcaron'] = 556;
  45975. t['onehalf'] = 834;
  45976. t['lessequal'] = 549;
  45977. t['ocircumflex'] = 556;
  45978. t['ntilde'] = 556;
  45979. t['Uhungarumlaut'] = 722;
  45980. t['Eacute'] = 667;
  45981. t['emacron'] = 556;
  45982. t['gbreve'] = 556;
  45983. t['onequarter'] = 834;
  45984. t['Scaron'] = 667;
  45985. t['Scommaaccent'] = 667;
  45986. t['Ohungarumlaut'] = 778;
  45987. t['degree'] = 400;
  45988. t['ograve'] = 556;
  45989. t['Ccaron'] = 722;
  45990. t['ugrave'] = 556;
  45991. t['radical'] = 453;
  45992. t['Dcaron'] = 722;
  45993. t['rcommaaccent'] = 333;
  45994. t['Ntilde'] = 722;
  45995. t['otilde'] = 556;
  45996. t['Rcommaaccent'] = 722;
  45997. t['Lcommaaccent'] = 556;
  45998. t['Atilde'] = 667;
  45999. t['Aogonek'] = 667;
  46000. t['Aring'] = 667;
  46001. t['Otilde'] = 778;
  46002. t['zdotaccent'] = 500;
  46003. t['Ecaron'] = 667;
  46004. t['Iogonek'] = 278;
  46005. t['kcommaaccent'] = 500;
  46006. t['minus'] = 584;
  46007. t['Icircumflex'] = 278;
  46008. t['ncaron'] = 556;
  46009. t['tcommaaccent'] = 278;
  46010. t['logicalnot'] = 584;
  46011. t['odieresis'] = 556;
  46012. t['udieresis'] = 556;
  46013. t['notequal'] = 549;
  46014. t['gcommaaccent'] = 556;
  46015. t['eth'] = 556;
  46016. t['zcaron'] = 500;
  46017. t['ncommaaccent'] = 556;
  46018. t['onesuperior'] = 333;
  46019. t['imacron'] = 278;
  46020. t['Euro'] = 556;
  46021. });
  46022. t['Symbol'] = getLookupTableFactory(function (t) {
  46023. t['space'] = 250;
  46024. t['exclam'] = 333;
  46025. t['universal'] = 713;
  46026. t['numbersign'] = 500;
  46027. t['existential'] = 549;
  46028. t['percent'] = 833;
  46029. t['ampersand'] = 778;
  46030. t['suchthat'] = 439;
  46031. t['parenleft'] = 333;
  46032. t['parenright'] = 333;
  46033. t['asteriskmath'] = 500;
  46034. t['plus'] = 549;
  46035. t['comma'] = 250;
  46036. t['minus'] = 549;
  46037. t['period'] = 250;
  46038. t['slash'] = 278;
  46039. t['zero'] = 500;
  46040. t['one'] = 500;
  46041. t['two'] = 500;
  46042. t['three'] = 500;
  46043. t['four'] = 500;
  46044. t['five'] = 500;
  46045. t['six'] = 500;
  46046. t['seven'] = 500;
  46047. t['eight'] = 500;
  46048. t['nine'] = 500;
  46049. t['colon'] = 278;
  46050. t['semicolon'] = 278;
  46051. t['less'] = 549;
  46052. t['equal'] = 549;
  46053. t['greater'] = 549;
  46054. t['question'] = 444;
  46055. t['congruent'] = 549;
  46056. t['Alpha'] = 722;
  46057. t['Beta'] = 667;
  46058. t['Chi'] = 722;
  46059. t['Delta'] = 612;
  46060. t['Epsilon'] = 611;
  46061. t['Phi'] = 763;
  46062. t['Gamma'] = 603;
  46063. t['Eta'] = 722;
  46064. t['Iota'] = 333;
  46065. t['theta1'] = 631;
  46066. t['Kappa'] = 722;
  46067. t['Lambda'] = 686;
  46068. t['Mu'] = 889;
  46069. t['Nu'] = 722;
  46070. t['Omicron'] = 722;
  46071. t['Pi'] = 768;
  46072. t['Theta'] = 741;
  46073. t['Rho'] = 556;
  46074. t['Sigma'] = 592;
  46075. t['Tau'] = 611;
  46076. t['Upsilon'] = 690;
  46077. t['sigma1'] = 439;
  46078. t['Omega'] = 768;
  46079. t['Xi'] = 645;
  46080. t['Psi'] = 795;
  46081. t['Zeta'] = 611;
  46082. t['bracketleft'] = 333;
  46083. t['therefore'] = 863;
  46084. t['bracketright'] = 333;
  46085. t['perpendicular'] = 658;
  46086. t['underscore'] = 500;
  46087. t['radicalex'] = 500;
  46088. t['alpha'] = 631;
  46089. t['beta'] = 549;
  46090. t['chi'] = 549;
  46091. t['delta'] = 494;
  46092. t['epsilon'] = 439;
  46093. t['phi'] = 521;
  46094. t['gamma'] = 411;
  46095. t['eta'] = 603;
  46096. t['iota'] = 329;
  46097. t['phi1'] = 603;
  46098. t['kappa'] = 549;
  46099. t['lambda'] = 549;
  46100. t['mu'] = 576;
  46101. t['nu'] = 521;
  46102. t['omicron'] = 549;
  46103. t['pi'] = 549;
  46104. t['theta'] = 521;
  46105. t['rho'] = 549;
  46106. t['sigma'] = 603;
  46107. t['tau'] = 439;
  46108. t['upsilon'] = 576;
  46109. t['omega1'] = 713;
  46110. t['omega'] = 686;
  46111. t['xi'] = 493;
  46112. t['psi'] = 686;
  46113. t['zeta'] = 494;
  46114. t['braceleft'] = 480;
  46115. t['bar'] = 200;
  46116. t['braceright'] = 480;
  46117. t['similar'] = 549;
  46118. t['Euro'] = 750;
  46119. t['Upsilon1'] = 620;
  46120. t['minute'] = 247;
  46121. t['lessequal'] = 549;
  46122. t['fraction'] = 167;
  46123. t['infinity'] = 713;
  46124. t['florin'] = 500;
  46125. t['club'] = 753;
  46126. t['diamond'] = 753;
  46127. t['heart'] = 753;
  46128. t['spade'] = 753;
  46129. t['arrowboth'] = 1042;
  46130. t['arrowleft'] = 987;
  46131. t['arrowup'] = 603;
  46132. t['arrowright'] = 987;
  46133. t['arrowdown'] = 603;
  46134. t['degree'] = 400;
  46135. t['plusminus'] = 549;
  46136. t['second'] = 411;
  46137. t['greaterequal'] = 549;
  46138. t['multiply'] = 549;
  46139. t['proportional'] = 713;
  46140. t['partialdiff'] = 494;
  46141. t['bullet'] = 460;
  46142. t['divide'] = 549;
  46143. t['notequal'] = 549;
  46144. t['equivalence'] = 549;
  46145. t['approxequal'] = 549;
  46146. t['ellipsis'] = 1000;
  46147. t['arrowvertex'] = 603;
  46148. t['arrowhorizex'] = 1000;
  46149. t['carriagereturn'] = 658;
  46150. t['aleph'] = 823;
  46151. t['Ifraktur'] = 686;
  46152. t['Rfraktur'] = 795;
  46153. t['weierstrass'] = 987;
  46154. t['circlemultiply'] = 768;
  46155. t['circleplus'] = 768;
  46156. t['emptyset'] = 823;
  46157. t['intersection'] = 768;
  46158. t['union'] = 768;
  46159. t['propersuperset'] = 713;
  46160. t['reflexsuperset'] = 713;
  46161. t['notsubset'] = 713;
  46162. t['propersubset'] = 713;
  46163. t['reflexsubset'] = 713;
  46164. t['element'] = 713;
  46165. t['notelement'] = 713;
  46166. t['angle'] = 768;
  46167. t['gradient'] = 713;
  46168. t['registerserif'] = 790;
  46169. t['copyrightserif'] = 790;
  46170. t['trademarkserif'] = 890;
  46171. t['product'] = 823;
  46172. t['radical'] = 549;
  46173. t['dotmath'] = 250;
  46174. t['logicalnot'] = 713;
  46175. t['logicaland'] = 603;
  46176. t['logicalor'] = 603;
  46177. t['arrowdblboth'] = 1042;
  46178. t['arrowdblleft'] = 987;
  46179. t['arrowdblup'] = 603;
  46180. t['arrowdblright'] = 987;
  46181. t['arrowdbldown'] = 603;
  46182. t['lozenge'] = 494;
  46183. t['angleleft'] = 329;
  46184. t['registersans'] = 790;
  46185. t['copyrightsans'] = 790;
  46186. t['trademarksans'] = 786;
  46187. t['summation'] = 713;
  46188. t['parenlefttp'] = 384;
  46189. t['parenleftex'] = 384;
  46190. t['parenleftbt'] = 384;
  46191. t['bracketlefttp'] = 384;
  46192. t['bracketleftex'] = 384;
  46193. t['bracketleftbt'] = 384;
  46194. t['bracelefttp'] = 494;
  46195. t['braceleftmid'] = 494;
  46196. t['braceleftbt'] = 494;
  46197. t['braceex'] = 494;
  46198. t['angleright'] = 329;
  46199. t['integral'] = 274;
  46200. t['integraltp'] = 686;
  46201. t['integralex'] = 686;
  46202. t['integralbt'] = 686;
  46203. t['parenrighttp'] = 384;
  46204. t['parenrightex'] = 384;
  46205. t['parenrightbt'] = 384;
  46206. t['bracketrighttp'] = 384;
  46207. t['bracketrightex'] = 384;
  46208. t['bracketrightbt'] = 384;
  46209. t['bracerighttp'] = 494;
  46210. t['bracerightmid'] = 494;
  46211. t['bracerightbt'] = 494;
  46212. t['apple'] = 790;
  46213. });
  46214. t['Times-Roman'] = getLookupTableFactory(function (t) {
  46215. t['space'] = 250;
  46216. t['exclam'] = 333;
  46217. t['quotedbl'] = 408;
  46218. t['numbersign'] = 500;
  46219. t['dollar'] = 500;
  46220. t['percent'] = 833;
  46221. t['ampersand'] = 778;
  46222. t['quoteright'] = 333;
  46223. t['parenleft'] = 333;
  46224. t['parenright'] = 333;
  46225. t['asterisk'] = 500;
  46226. t['plus'] = 564;
  46227. t['comma'] = 250;
  46228. t['hyphen'] = 333;
  46229. t['period'] = 250;
  46230. t['slash'] = 278;
  46231. t['zero'] = 500;
  46232. t['one'] = 500;
  46233. t['two'] = 500;
  46234. t['three'] = 500;
  46235. t['four'] = 500;
  46236. t['five'] = 500;
  46237. t['six'] = 500;
  46238. t['seven'] = 500;
  46239. t['eight'] = 500;
  46240. t['nine'] = 500;
  46241. t['colon'] = 278;
  46242. t['semicolon'] = 278;
  46243. t['less'] = 564;
  46244. t['equal'] = 564;
  46245. t['greater'] = 564;
  46246. t['question'] = 444;
  46247. t['at'] = 921;
  46248. t['A'] = 722;
  46249. t['B'] = 667;
  46250. t['C'] = 667;
  46251. t['D'] = 722;
  46252. t['E'] = 611;
  46253. t['F'] = 556;
  46254. t['G'] = 722;
  46255. t['H'] = 722;
  46256. t['I'] = 333;
  46257. t['J'] = 389;
  46258. t['K'] = 722;
  46259. t['L'] = 611;
  46260. t['M'] = 889;
  46261. t['N'] = 722;
  46262. t['O'] = 722;
  46263. t['P'] = 556;
  46264. t['Q'] = 722;
  46265. t['R'] = 667;
  46266. t['S'] = 556;
  46267. t['T'] = 611;
  46268. t['U'] = 722;
  46269. t['V'] = 722;
  46270. t['W'] = 944;
  46271. t['X'] = 722;
  46272. t['Y'] = 722;
  46273. t['Z'] = 611;
  46274. t['bracketleft'] = 333;
  46275. t['backslash'] = 278;
  46276. t['bracketright'] = 333;
  46277. t['asciicircum'] = 469;
  46278. t['underscore'] = 500;
  46279. t['quoteleft'] = 333;
  46280. t['a'] = 444;
  46281. t['b'] = 500;
  46282. t['c'] = 444;
  46283. t['d'] = 500;
  46284. t['e'] = 444;
  46285. t['f'] = 333;
  46286. t['g'] = 500;
  46287. t['h'] = 500;
  46288. t['i'] = 278;
  46289. t['j'] = 278;
  46290. t['k'] = 500;
  46291. t['l'] = 278;
  46292. t['m'] = 778;
  46293. t['n'] = 500;
  46294. t['o'] = 500;
  46295. t['p'] = 500;
  46296. t['q'] = 500;
  46297. t['r'] = 333;
  46298. t['s'] = 389;
  46299. t['t'] = 278;
  46300. t['u'] = 500;
  46301. t['v'] = 500;
  46302. t['w'] = 722;
  46303. t['x'] = 500;
  46304. t['y'] = 500;
  46305. t['z'] = 444;
  46306. t['braceleft'] = 480;
  46307. t['bar'] = 200;
  46308. t['braceright'] = 480;
  46309. t['asciitilde'] = 541;
  46310. t['exclamdown'] = 333;
  46311. t['cent'] = 500;
  46312. t['sterling'] = 500;
  46313. t['fraction'] = 167;
  46314. t['yen'] = 500;
  46315. t['florin'] = 500;
  46316. t['section'] = 500;
  46317. t['currency'] = 500;
  46318. t['quotesingle'] = 180;
  46319. t['quotedblleft'] = 444;
  46320. t['guillemotleft'] = 500;
  46321. t['guilsinglleft'] = 333;
  46322. t['guilsinglright'] = 333;
  46323. t['fi'] = 556;
  46324. t['fl'] = 556;
  46325. t['endash'] = 500;
  46326. t['dagger'] = 500;
  46327. t['daggerdbl'] = 500;
  46328. t['periodcentered'] = 250;
  46329. t['paragraph'] = 453;
  46330. t['bullet'] = 350;
  46331. t['quotesinglbase'] = 333;
  46332. t['quotedblbase'] = 444;
  46333. t['quotedblright'] = 444;
  46334. t['guillemotright'] = 500;
  46335. t['ellipsis'] = 1000;
  46336. t['perthousand'] = 1000;
  46337. t['questiondown'] = 444;
  46338. t['grave'] = 333;
  46339. t['acute'] = 333;
  46340. t['circumflex'] = 333;
  46341. t['tilde'] = 333;
  46342. t['macron'] = 333;
  46343. t['breve'] = 333;
  46344. t['dotaccent'] = 333;
  46345. t['dieresis'] = 333;
  46346. t['ring'] = 333;
  46347. t['cedilla'] = 333;
  46348. t['hungarumlaut'] = 333;
  46349. t['ogonek'] = 333;
  46350. t['caron'] = 333;
  46351. t['emdash'] = 1000;
  46352. t['AE'] = 889;
  46353. t['ordfeminine'] = 276;
  46354. t['Lslash'] = 611;
  46355. t['Oslash'] = 722;
  46356. t['OE'] = 889;
  46357. t['ordmasculine'] = 310;
  46358. t['ae'] = 667;
  46359. t['dotlessi'] = 278;
  46360. t['lslash'] = 278;
  46361. t['oslash'] = 500;
  46362. t['oe'] = 722;
  46363. t['germandbls'] = 500;
  46364. t['Idieresis'] = 333;
  46365. t['eacute'] = 444;
  46366. t['abreve'] = 444;
  46367. t['uhungarumlaut'] = 500;
  46368. t['ecaron'] = 444;
  46369. t['Ydieresis'] = 722;
  46370. t['divide'] = 564;
  46371. t['Yacute'] = 722;
  46372. t['Acircumflex'] = 722;
  46373. t['aacute'] = 444;
  46374. t['Ucircumflex'] = 722;
  46375. t['yacute'] = 500;
  46376. t['scommaaccent'] = 389;
  46377. t['ecircumflex'] = 444;
  46378. t['Uring'] = 722;
  46379. t['Udieresis'] = 722;
  46380. t['aogonek'] = 444;
  46381. t['Uacute'] = 722;
  46382. t['uogonek'] = 500;
  46383. t['Edieresis'] = 611;
  46384. t['Dcroat'] = 722;
  46385. t['commaaccent'] = 250;
  46386. t['copyright'] = 760;
  46387. t['Emacron'] = 611;
  46388. t['ccaron'] = 444;
  46389. t['aring'] = 444;
  46390. t['Ncommaaccent'] = 722;
  46391. t['lacute'] = 278;
  46392. t['agrave'] = 444;
  46393. t['Tcommaaccent'] = 611;
  46394. t['Cacute'] = 667;
  46395. t['atilde'] = 444;
  46396. t['Edotaccent'] = 611;
  46397. t['scaron'] = 389;
  46398. t['scedilla'] = 389;
  46399. t['iacute'] = 278;
  46400. t['lozenge'] = 471;
  46401. t['Rcaron'] = 667;
  46402. t['Gcommaaccent'] = 722;
  46403. t['ucircumflex'] = 500;
  46404. t['acircumflex'] = 444;
  46405. t['Amacron'] = 722;
  46406. t['rcaron'] = 333;
  46407. t['ccedilla'] = 444;
  46408. t['Zdotaccent'] = 611;
  46409. t['Thorn'] = 556;
  46410. t['Omacron'] = 722;
  46411. t['Racute'] = 667;
  46412. t['Sacute'] = 556;
  46413. t['dcaron'] = 588;
  46414. t['Umacron'] = 722;
  46415. t['uring'] = 500;
  46416. t['threesuperior'] = 300;
  46417. t['Ograve'] = 722;
  46418. t['Agrave'] = 722;
  46419. t['Abreve'] = 722;
  46420. t['multiply'] = 564;
  46421. t['uacute'] = 500;
  46422. t['Tcaron'] = 611;
  46423. t['partialdiff'] = 476;
  46424. t['ydieresis'] = 500;
  46425. t['Nacute'] = 722;
  46426. t['icircumflex'] = 278;
  46427. t['Ecircumflex'] = 611;
  46428. t['adieresis'] = 444;
  46429. t['edieresis'] = 444;
  46430. t['cacute'] = 444;
  46431. t['nacute'] = 500;
  46432. t['umacron'] = 500;
  46433. t['Ncaron'] = 722;
  46434. t['Iacute'] = 333;
  46435. t['plusminus'] = 564;
  46436. t['brokenbar'] = 200;
  46437. t['registered'] = 760;
  46438. t['Gbreve'] = 722;
  46439. t['Idotaccent'] = 333;
  46440. t['summation'] = 600;
  46441. t['Egrave'] = 611;
  46442. t['racute'] = 333;
  46443. t['omacron'] = 500;
  46444. t['Zacute'] = 611;
  46445. t['Zcaron'] = 611;
  46446. t['greaterequal'] = 549;
  46447. t['Eth'] = 722;
  46448. t['Ccedilla'] = 667;
  46449. t['lcommaaccent'] = 278;
  46450. t['tcaron'] = 326;
  46451. t['eogonek'] = 444;
  46452. t['Uogonek'] = 722;
  46453. t['Aacute'] = 722;
  46454. t['Adieresis'] = 722;
  46455. t['egrave'] = 444;
  46456. t['zacute'] = 444;
  46457. t['iogonek'] = 278;
  46458. t['Oacute'] = 722;
  46459. t['oacute'] = 500;
  46460. t['amacron'] = 444;
  46461. t['sacute'] = 389;
  46462. t['idieresis'] = 278;
  46463. t['Ocircumflex'] = 722;
  46464. t['Ugrave'] = 722;
  46465. t['Delta'] = 612;
  46466. t['thorn'] = 500;
  46467. t['twosuperior'] = 300;
  46468. t['Odieresis'] = 722;
  46469. t['mu'] = 500;
  46470. t['igrave'] = 278;
  46471. t['ohungarumlaut'] = 500;
  46472. t['Eogonek'] = 611;
  46473. t['dcroat'] = 500;
  46474. t['threequarters'] = 750;
  46475. t['Scedilla'] = 556;
  46476. t['lcaron'] = 344;
  46477. t['Kcommaaccent'] = 722;
  46478. t['Lacute'] = 611;
  46479. t['trademark'] = 980;
  46480. t['edotaccent'] = 444;
  46481. t['Igrave'] = 333;
  46482. t['Imacron'] = 333;
  46483. t['Lcaron'] = 611;
  46484. t['onehalf'] = 750;
  46485. t['lessequal'] = 549;
  46486. t['ocircumflex'] = 500;
  46487. t['ntilde'] = 500;
  46488. t['Uhungarumlaut'] = 722;
  46489. t['Eacute'] = 611;
  46490. t['emacron'] = 444;
  46491. t['gbreve'] = 500;
  46492. t['onequarter'] = 750;
  46493. t['Scaron'] = 556;
  46494. t['Scommaaccent'] = 556;
  46495. t['Ohungarumlaut'] = 722;
  46496. t['degree'] = 400;
  46497. t['ograve'] = 500;
  46498. t['Ccaron'] = 667;
  46499. t['ugrave'] = 500;
  46500. t['radical'] = 453;
  46501. t['Dcaron'] = 722;
  46502. t['rcommaaccent'] = 333;
  46503. t['Ntilde'] = 722;
  46504. t['otilde'] = 500;
  46505. t['Rcommaaccent'] = 667;
  46506. t['Lcommaaccent'] = 611;
  46507. t['Atilde'] = 722;
  46508. t['Aogonek'] = 722;
  46509. t['Aring'] = 722;
  46510. t['Otilde'] = 722;
  46511. t['zdotaccent'] = 444;
  46512. t['Ecaron'] = 611;
  46513. t['Iogonek'] = 333;
  46514. t['kcommaaccent'] = 500;
  46515. t['minus'] = 564;
  46516. t['Icircumflex'] = 333;
  46517. t['ncaron'] = 500;
  46518. t['tcommaaccent'] = 278;
  46519. t['logicalnot'] = 564;
  46520. t['odieresis'] = 500;
  46521. t['udieresis'] = 500;
  46522. t['notequal'] = 549;
  46523. t['gcommaaccent'] = 500;
  46524. t['eth'] = 500;
  46525. t['zcaron'] = 444;
  46526. t['ncommaaccent'] = 500;
  46527. t['onesuperior'] = 300;
  46528. t['imacron'] = 278;
  46529. t['Euro'] = 500;
  46530. });
  46531. t['Times-Bold'] = getLookupTableFactory(function (t) {
  46532. t['space'] = 250;
  46533. t['exclam'] = 333;
  46534. t['quotedbl'] = 555;
  46535. t['numbersign'] = 500;
  46536. t['dollar'] = 500;
  46537. t['percent'] = 1000;
  46538. t['ampersand'] = 833;
  46539. t['quoteright'] = 333;
  46540. t['parenleft'] = 333;
  46541. t['parenright'] = 333;
  46542. t['asterisk'] = 500;
  46543. t['plus'] = 570;
  46544. t['comma'] = 250;
  46545. t['hyphen'] = 333;
  46546. t['period'] = 250;
  46547. t['slash'] = 278;
  46548. t['zero'] = 500;
  46549. t['one'] = 500;
  46550. t['two'] = 500;
  46551. t['three'] = 500;
  46552. t['four'] = 500;
  46553. t['five'] = 500;
  46554. t['six'] = 500;
  46555. t['seven'] = 500;
  46556. t['eight'] = 500;
  46557. t['nine'] = 500;
  46558. t['colon'] = 333;
  46559. t['semicolon'] = 333;
  46560. t['less'] = 570;
  46561. t['equal'] = 570;
  46562. t['greater'] = 570;
  46563. t['question'] = 500;
  46564. t['at'] = 930;
  46565. t['A'] = 722;
  46566. t['B'] = 667;
  46567. t['C'] = 722;
  46568. t['D'] = 722;
  46569. t['E'] = 667;
  46570. t['F'] = 611;
  46571. t['G'] = 778;
  46572. t['H'] = 778;
  46573. t['I'] = 389;
  46574. t['J'] = 500;
  46575. t['K'] = 778;
  46576. t['L'] = 667;
  46577. t['M'] = 944;
  46578. t['N'] = 722;
  46579. t['O'] = 778;
  46580. t['P'] = 611;
  46581. t['Q'] = 778;
  46582. t['R'] = 722;
  46583. t['S'] = 556;
  46584. t['T'] = 667;
  46585. t['U'] = 722;
  46586. t['V'] = 722;
  46587. t['W'] = 1000;
  46588. t['X'] = 722;
  46589. t['Y'] = 722;
  46590. t['Z'] = 667;
  46591. t['bracketleft'] = 333;
  46592. t['backslash'] = 278;
  46593. t['bracketright'] = 333;
  46594. t['asciicircum'] = 581;
  46595. t['underscore'] = 500;
  46596. t['quoteleft'] = 333;
  46597. t['a'] = 500;
  46598. t['b'] = 556;
  46599. t['c'] = 444;
  46600. t['d'] = 556;
  46601. t['e'] = 444;
  46602. t['f'] = 333;
  46603. t['g'] = 500;
  46604. t['h'] = 556;
  46605. t['i'] = 278;
  46606. t['j'] = 333;
  46607. t['k'] = 556;
  46608. t['l'] = 278;
  46609. t['m'] = 833;
  46610. t['n'] = 556;
  46611. t['o'] = 500;
  46612. t['p'] = 556;
  46613. t['q'] = 556;
  46614. t['r'] = 444;
  46615. t['s'] = 389;
  46616. t['t'] = 333;
  46617. t['u'] = 556;
  46618. t['v'] = 500;
  46619. t['w'] = 722;
  46620. t['x'] = 500;
  46621. t['y'] = 500;
  46622. t['z'] = 444;
  46623. t['braceleft'] = 394;
  46624. t['bar'] = 220;
  46625. t['braceright'] = 394;
  46626. t['asciitilde'] = 520;
  46627. t['exclamdown'] = 333;
  46628. t['cent'] = 500;
  46629. t['sterling'] = 500;
  46630. t['fraction'] = 167;
  46631. t['yen'] = 500;
  46632. t['florin'] = 500;
  46633. t['section'] = 500;
  46634. t['currency'] = 500;
  46635. t['quotesingle'] = 278;
  46636. t['quotedblleft'] = 500;
  46637. t['guillemotleft'] = 500;
  46638. t['guilsinglleft'] = 333;
  46639. t['guilsinglright'] = 333;
  46640. t['fi'] = 556;
  46641. t['fl'] = 556;
  46642. t['endash'] = 500;
  46643. t['dagger'] = 500;
  46644. t['daggerdbl'] = 500;
  46645. t['periodcentered'] = 250;
  46646. t['paragraph'] = 540;
  46647. t['bullet'] = 350;
  46648. t['quotesinglbase'] = 333;
  46649. t['quotedblbase'] = 500;
  46650. t['quotedblright'] = 500;
  46651. t['guillemotright'] = 500;
  46652. t['ellipsis'] = 1000;
  46653. t['perthousand'] = 1000;
  46654. t['questiondown'] = 500;
  46655. t['grave'] = 333;
  46656. t['acute'] = 333;
  46657. t['circumflex'] = 333;
  46658. t['tilde'] = 333;
  46659. t['macron'] = 333;
  46660. t['breve'] = 333;
  46661. t['dotaccent'] = 333;
  46662. t['dieresis'] = 333;
  46663. t['ring'] = 333;
  46664. t['cedilla'] = 333;
  46665. t['hungarumlaut'] = 333;
  46666. t['ogonek'] = 333;
  46667. t['caron'] = 333;
  46668. t['emdash'] = 1000;
  46669. t['AE'] = 1000;
  46670. t['ordfeminine'] = 300;
  46671. t['Lslash'] = 667;
  46672. t['Oslash'] = 778;
  46673. t['OE'] = 1000;
  46674. t['ordmasculine'] = 330;
  46675. t['ae'] = 722;
  46676. t['dotlessi'] = 278;
  46677. t['lslash'] = 278;
  46678. t['oslash'] = 500;
  46679. t['oe'] = 722;
  46680. t['germandbls'] = 556;
  46681. t['Idieresis'] = 389;
  46682. t['eacute'] = 444;
  46683. t['abreve'] = 500;
  46684. t['uhungarumlaut'] = 556;
  46685. t['ecaron'] = 444;
  46686. t['Ydieresis'] = 722;
  46687. t['divide'] = 570;
  46688. t['Yacute'] = 722;
  46689. t['Acircumflex'] = 722;
  46690. t['aacute'] = 500;
  46691. t['Ucircumflex'] = 722;
  46692. t['yacute'] = 500;
  46693. t['scommaaccent'] = 389;
  46694. t['ecircumflex'] = 444;
  46695. t['Uring'] = 722;
  46696. t['Udieresis'] = 722;
  46697. t['aogonek'] = 500;
  46698. t['Uacute'] = 722;
  46699. t['uogonek'] = 556;
  46700. t['Edieresis'] = 667;
  46701. t['Dcroat'] = 722;
  46702. t['commaaccent'] = 250;
  46703. t['copyright'] = 747;
  46704. t['Emacron'] = 667;
  46705. t['ccaron'] = 444;
  46706. t['aring'] = 500;
  46707. t['Ncommaaccent'] = 722;
  46708. t['lacute'] = 278;
  46709. t['agrave'] = 500;
  46710. t['Tcommaaccent'] = 667;
  46711. t['Cacute'] = 722;
  46712. t['atilde'] = 500;
  46713. t['Edotaccent'] = 667;
  46714. t['scaron'] = 389;
  46715. t['scedilla'] = 389;
  46716. t['iacute'] = 278;
  46717. t['lozenge'] = 494;
  46718. t['Rcaron'] = 722;
  46719. t['Gcommaaccent'] = 778;
  46720. t['ucircumflex'] = 556;
  46721. t['acircumflex'] = 500;
  46722. t['Amacron'] = 722;
  46723. t['rcaron'] = 444;
  46724. t['ccedilla'] = 444;
  46725. t['Zdotaccent'] = 667;
  46726. t['Thorn'] = 611;
  46727. t['Omacron'] = 778;
  46728. t['Racute'] = 722;
  46729. t['Sacute'] = 556;
  46730. t['dcaron'] = 672;
  46731. t['Umacron'] = 722;
  46732. t['uring'] = 556;
  46733. t['threesuperior'] = 300;
  46734. t['Ograve'] = 778;
  46735. t['Agrave'] = 722;
  46736. t['Abreve'] = 722;
  46737. t['multiply'] = 570;
  46738. t['uacute'] = 556;
  46739. t['Tcaron'] = 667;
  46740. t['partialdiff'] = 494;
  46741. t['ydieresis'] = 500;
  46742. t['Nacute'] = 722;
  46743. t['icircumflex'] = 278;
  46744. t['Ecircumflex'] = 667;
  46745. t['adieresis'] = 500;
  46746. t['edieresis'] = 444;
  46747. t['cacute'] = 444;
  46748. t['nacute'] = 556;
  46749. t['umacron'] = 556;
  46750. t['Ncaron'] = 722;
  46751. t['Iacute'] = 389;
  46752. t['plusminus'] = 570;
  46753. t['brokenbar'] = 220;
  46754. t['registered'] = 747;
  46755. t['Gbreve'] = 778;
  46756. t['Idotaccent'] = 389;
  46757. t['summation'] = 600;
  46758. t['Egrave'] = 667;
  46759. t['racute'] = 444;
  46760. t['omacron'] = 500;
  46761. t['Zacute'] = 667;
  46762. t['Zcaron'] = 667;
  46763. t['greaterequal'] = 549;
  46764. t['Eth'] = 722;
  46765. t['Ccedilla'] = 722;
  46766. t['lcommaaccent'] = 278;
  46767. t['tcaron'] = 416;
  46768. t['eogonek'] = 444;
  46769. t['Uogonek'] = 722;
  46770. t['Aacute'] = 722;
  46771. t['Adieresis'] = 722;
  46772. t['egrave'] = 444;
  46773. t['zacute'] = 444;
  46774. t['iogonek'] = 278;
  46775. t['Oacute'] = 778;
  46776. t['oacute'] = 500;
  46777. t['amacron'] = 500;
  46778. t['sacute'] = 389;
  46779. t['idieresis'] = 278;
  46780. t['Ocircumflex'] = 778;
  46781. t['Ugrave'] = 722;
  46782. t['Delta'] = 612;
  46783. t['thorn'] = 556;
  46784. t['twosuperior'] = 300;
  46785. t['Odieresis'] = 778;
  46786. t['mu'] = 556;
  46787. t['igrave'] = 278;
  46788. t['ohungarumlaut'] = 500;
  46789. t['Eogonek'] = 667;
  46790. t['dcroat'] = 556;
  46791. t['threequarters'] = 750;
  46792. t['Scedilla'] = 556;
  46793. t['lcaron'] = 394;
  46794. t['Kcommaaccent'] = 778;
  46795. t['Lacute'] = 667;
  46796. t['trademark'] = 1000;
  46797. t['edotaccent'] = 444;
  46798. t['Igrave'] = 389;
  46799. t['Imacron'] = 389;
  46800. t['Lcaron'] = 667;
  46801. t['onehalf'] = 750;
  46802. t['lessequal'] = 549;
  46803. t['ocircumflex'] = 500;
  46804. t['ntilde'] = 556;
  46805. t['Uhungarumlaut'] = 722;
  46806. t['Eacute'] = 667;
  46807. t['emacron'] = 444;
  46808. t['gbreve'] = 500;
  46809. t['onequarter'] = 750;
  46810. t['Scaron'] = 556;
  46811. t['Scommaaccent'] = 556;
  46812. t['Ohungarumlaut'] = 778;
  46813. t['degree'] = 400;
  46814. t['ograve'] = 500;
  46815. t['Ccaron'] = 722;
  46816. t['ugrave'] = 556;
  46817. t['radical'] = 549;
  46818. t['Dcaron'] = 722;
  46819. t['rcommaaccent'] = 444;
  46820. t['Ntilde'] = 722;
  46821. t['otilde'] = 500;
  46822. t['Rcommaaccent'] = 722;
  46823. t['Lcommaaccent'] = 667;
  46824. t['Atilde'] = 722;
  46825. t['Aogonek'] = 722;
  46826. t['Aring'] = 722;
  46827. t['Otilde'] = 778;
  46828. t['zdotaccent'] = 444;
  46829. t['Ecaron'] = 667;
  46830. t['Iogonek'] = 389;
  46831. t['kcommaaccent'] = 556;
  46832. t['minus'] = 570;
  46833. t['Icircumflex'] = 389;
  46834. t['ncaron'] = 556;
  46835. t['tcommaaccent'] = 333;
  46836. t['logicalnot'] = 570;
  46837. t['odieresis'] = 500;
  46838. t['udieresis'] = 556;
  46839. t['notequal'] = 549;
  46840. t['gcommaaccent'] = 500;
  46841. t['eth'] = 500;
  46842. t['zcaron'] = 444;
  46843. t['ncommaaccent'] = 556;
  46844. t['onesuperior'] = 300;
  46845. t['imacron'] = 278;
  46846. t['Euro'] = 500;
  46847. });
  46848. t['Times-BoldItalic'] = getLookupTableFactory(function (t) {
  46849. t['space'] = 250;
  46850. t['exclam'] = 389;
  46851. t['quotedbl'] = 555;
  46852. t['numbersign'] = 500;
  46853. t['dollar'] = 500;
  46854. t['percent'] = 833;
  46855. t['ampersand'] = 778;
  46856. t['quoteright'] = 333;
  46857. t['parenleft'] = 333;
  46858. t['parenright'] = 333;
  46859. t['asterisk'] = 500;
  46860. t['plus'] = 570;
  46861. t['comma'] = 250;
  46862. t['hyphen'] = 333;
  46863. t['period'] = 250;
  46864. t['slash'] = 278;
  46865. t['zero'] = 500;
  46866. t['one'] = 500;
  46867. t['two'] = 500;
  46868. t['three'] = 500;
  46869. t['four'] = 500;
  46870. t['five'] = 500;
  46871. t['six'] = 500;
  46872. t['seven'] = 500;
  46873. t['eight'] = 500;
  46874. t['nine'] = 500;
  46875. t['colon'] = 333;
  46876. t['semicolon'] = 333;
  46877. t['less'] = 570;
  46878. t['equal'] = 570;
  46879. t['greater'] = 570;
  46880. t['question'] = 500;
  46881. t['at'] = 832;
  46882. t['A'] = 667;
  46883. t['B'] = 667;
  46884. t['C'] = 667;
  46885. t['D'] = 722;
  46886. t['E'] = 667;
  46887. t['F'] = 667;
  46888. t['G'] = 722;
  46889. t['H'] = 778;
  46890. t['I'] = 389;
  46891. t['J'] = 500;
  46892. t['K'] = 667;
  46893. t['L'] = 611;
  46894. t['M'] = 889;
  46895. t['N'] = 722;
  46896. t['O'] = 722;
  46897. t['P'] = 611;
  46898. t['Q'] = 722;
  46899. t['R'] = 667;
  46900. t['S'] = 556;
  46901. t['T'] = 611;
  46902. t['U'] = 722;
  46903. t['V'] = 667;
  46904. t['W'] = 889;
  46905. t['X'] = 667;
  46906. t['Y'] = 611;
  46907. t['Z'] = 611;
  46908. t['bracketleft'] = 333;
  46909. t['backslash'] = 278;
  46910. t['bracketright'] = 333;
  46911. t['asciicircum'] = 570;
  46912. t['underscore'] = 500;
  46913. t['quoteleft'] = 333;
  46914. t['a'] = 500;
  46915. t['b'] = 500;
  46916. t['c'] = 444;
  46917. t['d'] = 500;
  46918. t['e'] = 444;
  46919. t['f'] = 333;
  46920. t['g'] = 500;
  46921. t['h'] = 556;
  46922. t['i'] = 278;
  46923. t['j'] = 278;
  46924. t['k'] = 500;
  46925. t['l'] = 278;
  46926. t['m'] = 778;
  46927. t['n'] = 556;
  46928. t['o'] = 500;
  46929. t['p'] = 500;
  46930. t['q'] = 500;
  46931. t['r'] = 389;
  46932. t['s'] = 389;
  46933. t['t'] = 278;
  46934. t['u'] = 556;
  46935. t['v'] = 444;
  46936. t['w'] = 667;
  46937. t['x'] = 500;
  46938. t['y'] = 444;
  46939. t['z'] = 389;
  46940. t['braceleft'] = 348;
  46941. t['bar'] = 220;
  46942. t['braceright'] = 348;
  46943. t['asciitilde'] = 570;
  46944. t['exclamdown'] = 389;
  46945. t['cent'] = 500;
  46946. t['sterling'] = 500;
  46947. t['fraction'] = 167;
  46948. t['yen'] = 500;
  46949. t['florin'] = 500;
  46950. t['section'] = 500;
  46951. t['currency'] = 500;
  46952. t['quotesingle'] = 278;
  46953. t['quotedblleft'] = 500;
  46954. t['guillemotleft'] = 500;
  46955. t['guilsinglleft'] = 333;
  46956. t['guilsinglright'] = 333;
  46957. t['fi'] = 556;
  46958. t['fl'] = 556;
  46959. t['endash'] = 500;
  46960. t['dagger'] = 500;
  46961. t['daggerdbl'] = 500;
  46962. t['periodcentered'] = 250;
  46963. t['paragraph'] = 500;
  46964. t['bullet'] = 350;
  46965. t['quotesinglbase'] = 333;
  46966. t['quotedblbase'] = 500;
  46967. t['quotedblright'] = 500;
  46968. t['guillemotright'] = 500;
  46969. t['ellipsis'] = 1000;
  46970. t['perthousand'] = 1000;
  46971. t['questiondown'] = 500;
  46972. t['grave'] = 333;
  46973. t['acute'] = 333;
  46974. t['circumflex'] = 333;
  46975. t['tilde'] = 333;
  46976. t['macron'] = 333;
  46977. t['breve'] = 333;
  46978. t['dotaccent'] = 333;
  46979. t['dieresis'] = 333;
  46980. t['ring'] = 333;
  46981. t['cedilla'] = 333;
  46982. t['hungarumlaut'] = 333;
  46983. t['ogonek'] = 333;
  46984. t['caron'] = 333;
  46985. t['emdash'] = 1000;
  46986. t['AE'] = 944;
  46987. t['ordfeminine'] = 266;
  46988. t['Lslash'] = 611;
  46989. t['Oslash'] = 722;
  46990. t['OE'] = 944;
  46991. t['ordmasculine'] = 300;
  46992. t['ae'] = 722;
  46993. t['dotlessi'] = 278;
  46994. t['lslash'] = 278;
  46995. t['oslash'] = 500;
  46996. t['oe'] = 722;
  46997. t['germandbls'] = 500;
  46998. t['Idieresis'] = 389;
  46999. t['eacute'] = 444;
  47000. t['abreve'] = 500;
  47001. t['uhungarumlaut'] = 556;
  47002. t['ecaron'] = 444;
  47003. t['Ydieresis'] = 611;
  47004. t['divide'] = 570;
  47005. t['Yacute'] = 611;
  47006. t['Acircumflex'] = 667;
  47007. t['aacute'] = 500;
  47008. t['Ucircumflex'] = 722;
  47009. t['yacute'] = 444;
  47010. t['scommaaccent'] = 389;
  47011. t['ecircumflex'] = 444;
  47012. t['Uring'] = 722;
  47013. t['Udieresis'] = 722;
  47014. t['aogonek'] = 500;
  47015. t['Uacute'] = 722;
  47016. t['uogonek'] = 556;
  47017. t['Edieresis'] = 667;
  47018. t['Dcroat'] = 722;
  47019. t['commaaccent'] = 250;
  47020. t['copyright'] = 747;
  47021. t['Emacron'] = 667;
  47022. t['ccaron'] = 444;
  47023. t['aring'] = 500;
  47024. t['Ncommaaccent'] = 722;
  47025. t['lacute'] = 278;
  47026. t['agrave'] = 500;
  47027. t['Tcommaaccent'] = 611;
  47028. t['Cacute'] = 667;
  47029. t['atilde'] = 500;
  47030. t['Edotaccent'] = 667;
  47031. t['scaron'] = 389;
  47032. t['scedilla'] = 389;
  47033. t['iacute'] = 278;
  47034. t['lozenge'] = 494;
  47035. t['Rcaron'] = 667;
  47036. t['Gcommaaccent'] = 722;
  47037. t['ucircumflex'] = 556;
  47038. t['acircumflex'] = 500;
  47039. t['Amacron'] = 667;
  47040. t['rcaron'] = 389;
  47041. t['ccedilla'] = 444;
  47042. t['Zdotaccent'] = 611;
  47043. t['Thorn'] = 611;
  47044. t['Omacron'] = 722;
  47045. t['Racute'] = 667;
  47046. t['Sacute'] = 556;
  47047. t['dcaron'] = 608;
  47048. t['Umacron'] = 722;
  47049. t['uring'] = 556;
  47050. t['threesuperior'] = 300;
  47051. t['Ograve'] = 722;
  47052. t['Agrave'] = 667;
  47053. t['Abreve'] = 667;
  47054. t['multiply'] = 570;
  47055. t['uacute'] = 556;
  47056. t['Tcaron'] = 611;
  47057. t['partialdiff'] = 494;
  47058. t['ydieresis'] = 444;
  47059. t['Nacute'] = 722;
  47060. t['icircumflex'] = 278;
  47061. t['Ecircumflex'] = 667;
  47062. t['adieresis'] = 500;
  47063. t['edieresis'] = 444;
  47064. t['cacute'] = 444;
  47065. t['nacute'] = 556;
  47066. t['umacron'] = 556;
  47067. t['Ncaron'] = 722;
  47068. t['Iacute'] = 389;
  47069. t['plusminus'] = 570;
  47070. t['brokenbar'] = 220;
  47071. t['registered'] = 747;
  47072. t['Gbreve'] = 722;
  47073. t['Idotaccent'] = 389;
  47074. t['summation'] = 600;
  47075. t['Egrave'] = 667;
  47076. t['racute'] = 389;
  47077. t['omacron'] = 500;
  47078. t['Zacute'] = 611;
  47079. t['Zcaron'] = 611;
  47080. t['greaterequal'] = 549;
  47081. t['Eth'] = 722;
  47082. t['Ccedilla'] = 667;
  47083. t['lcommaaccent'] = 278;
  47084. t['tcaron'] = 366;
  47085. t['eogonek'] = 444;
  47086. t['Uogonek'] = 722;
  47087. t['Aacute'] = 667;
  47088. t['Adieresis'] = 667;
  47089. t['egrave'] = 444;
  47090. t['zacute'] = 389;
  47091. t['iogonek'] = 278;
  47092. t['Oacute'] = 722;
  47093. t['oacute'] = 500;
  47094. t['amacron'] = 500;
  47095. t['sacute'] = 389;
  47096. t['idieresis'] = 278;
  47097. t['Ocircumflex'] = 722;
  47098. t['Ugrave'] = 722;
  47099. t['Delta'] = 612;
  47100. t['thorn'] = 500;
  47101. t['twosuperior'] = 300;
  47102. t['Odieresis'] = 722;
  47103. t['mu'] = 576;
  47104. t['igrave'] = 278;
  47105. t['ohungarumlaut'] = 500;
  47106. t['Eogonek'] = 667;
  47107. t['dcroat'] = 500;
  47108. t['threequarters'] = 750;
  47109. t['Scedilla'] = 556;
  47110. t['lcaron'] = 382;
  47111. t['Kcommaaccent'] = 667;
  47112. t['Lacute'] = 611;
  47113. t['trademark'] = 1000;
  47114. t['edotaccent'] = 444;
  47115. t['Igrave'] = 389;
  47116. t['Imacron'] = 389;
  47117. t['Lcaron'] = 611;
  47118. t['onehalf'] = 750;
  47119. t['lessequal'] = 549;
  47120. t['ocircumflex'] = 500;
  47121. t['ntilde'] = 556;
  47122. t['Uhungarumlaut'] = 722;
  47123. t['Eacute'] = 667;
  47124. t['emacron'] = 444;
  47125. t['gbreve'] = 500;
  47126. t['onequarter'] = 750;
  47127. t['Scaron'] = 556;
  47128. t['Scommaaccent'] = 556;
  47129. t['Ohungarumlaut'] = 722;
  47130. t['degree'] = 400;
  47131. t['ograve'] = 500;
  47132. t['Ccaron'] = 667;
  47133. t['ugrave'] = 556;
  47134. t['radical'] = 549;
  47135. t['Dcaron'] = 722;
  47136. t['rcommaaccent'] = 389;
  47137. t['Ntilde'] = 722;
  47138. t['otilde'] = 500;
  47139. t['Rcommaaccent'] = 667;
  47140. t['Lcommaaccent'] = 611;
  47141. t['Atilde'] = 667;
  47142. t['Aogonek'] = 667;
  47143. t['Aring'] = 667;
  47144. t['Otilde'] = 722;
  47145. t['zdotaccent'] = 389;
  47146. t['Ecaron'] = 667;
  47147. t['Iogonek'] = 389;
  47148. t['kcommaaccent'] = 500;
  47149. t['minus'] = 606;
  47150. t['Icircumflex'] = 389;
  47151. t['ncaron'] = 556;
  47152. t['tcommaaccent'] = 278;
  47153. t['logicalnot'] = 606;
  47154. t['odieresis'] = 500;
  47155. t['udieresis'] = 556;
  47156. t['notequal'] = 549;
  47157. t['gcommaaccent'] = 500;
  47158. t['eth'] = 500;
  47159. t['zcaron'] = 389;
  47160. t['ncommaaccent'] = 556;
  47161. t['onesuperior'] = 300;
  47162. t['imacron'] = 278;
  47163. t['Euro'] = 500;
  47164. });
  47165. t['Times-Italic'] = getLookupTableFactory(function (t) {
  47166. t['space'] = 250;
  47167. t['exclam'] = 333;
  47168. t['quotedbl'] = 420;
  47169. t['numbersign'] = 500;
  47170. t['dollar'] = 500;
  47171. t['percent'] = 833;
  47172. t['ampersand'] = 778;
  47173. t['quoteright'] = 333;
  47174. t['parenleft'] = 333;
  47175. t['parenright'] = 333;
  47176. t['asterisk'] = 500;
  47177. t['plus'] = 675;
  47178. t['comma'] = 250;
  47179. t['hyphen'] = 333;
  47180. t['period'] = 250;
  47181. t['slash'] = 278;
  47182. t['zero'] = 500;
  47183. t['one'] = 500;
  47184. t['two'] = 500;
  47185. t['three'] = 500;
  47186. t['four'] = 500;
  47187. t['five'] = 500;
  47188. t['six'] = 500;
  47189. t['seven'] = 500;
  47190. t['eight'] = 500;
  47191. t['nine'] = 500;
  47192. t['colon'] = 333;
  47193. t['semicolon'] = 333;
  47194. t['less'] = 675;
  47195. t['equal'] = 675;
  47196. t['greater'] = 675;
  47197. t['question'] = 500;
  47198. t['at'] = 920;
  47199. t['A'] = 611;
  47200. t['B'] = 611;
  47201. t['C'] = 667;
  47202. t['D'] = 722;
  47203. t['E'] = 611;
  47204. t['F'] = 611;
  47205. t['G'] = 722;
  47206. t['H'] = 722;
  47207. t['I'] = 333;
  47208. t['J'] = 444;
  47209. t['K'] = 667;
  47210. t['L'] = 556;
  47211. t['M'] = 833;
  47212. t['N'] = 667;
  47213. t['O'] = 722;
  47214. t['P'] = 611;
  47215. t['Q'] = 722;
  47216. t['R'] = 611;
  47217. t['S'] = 500;
  47218. t['T'] = 556;
  47219. t['U'] = 722;
  47220. t['V'] = 611;
  47221. t['W'] = 833;
  47222. t['X'] = 611;
  47223. t['Y'] = 556;
  47224. t['Z'] = 556;
  47225. t['bracketleft'] = 389;
  47226. t['backslash'] = 278;
  47227. t['bracketright'] = 389;
  47228. t['asciicircum'] = 422;
  47229. t['underscore'] = 500;
  47230. t['quoteleft'] = 333;
  47231. t['a'] = 500;
  47232. t['b'] = 500;
  47233. t['c'] = 444;
  47234. t['d'] = 500;
  47235. t['e'] = 444;
  47236. t['f'] = 278;
  47237. t['g'] = 500;
  47238. t['h'] = 500;
  47239. t['i'] = 278;
  47240. t['j'] = 278;
  47241. t['k'] = 444;
  47242. t['l'] = 278;
  47243. t['m'] = 722;
  47244. t['n'] = 500;
  47245. t['o'] = 500;
  47246. t['p'] = 500;
  47247. t['q'] = 500;
  47248. t['r'] = 389;
  47249. t['s'] = 389;
  47250. t['t'] = 278;
  47251. t['u'] = 500;
  47252. t['v'] = 444;
  47253. t['w'] = 667;
  47254. t['x'] = 444;
  47255. t['y'] = 444;
  47256. t['z'] = 389;
  47257. t['braceleft'] = 400;
  47258. t['bar'] = 275;
  47259. t['braceright'] = 400;
  47260. t['asciitilde'] = 541;
  47261. t['exclamdown'] = 389;
  47262. t['cent'] = 500;
  47263. t['sterling'] = 500;
  47264. t['fraction'] = 167;
  47265. t['yen'] = 500;
  47266. t['florin'] = 500;
  47267. t['section'] = 500;
  47268. t['currency'] = 500;
  47269. t['quotesingle'] = 214;
  47270. t['quotedblleft'] = 556;
  47271. t['guillemotleft'] = 500;
  47272. t['guilsinglleft'] = 333;
  47273. t['guilsinglright'] = 333;
  47274. t['fi'] = 500;
  47275. t['fl'] = 500;
  47276. t['endash'] = 500;
  47277. t['dagger'] = 500;
  47278. t['daggerdbl'] = 500;
  47279. t['periodcentered'] = 250;
  47280. t['paragraph'] = 523;
  47281. t['bullet'] = 350;
  47282. t['quotesinglbase'] = 333;
  47283. t['quotedblbase'] = 556;
  47284. t['quotedblright'] = 556;
  47285. t['guillemotright'] = 500;
  47286. t['ellipsis'] = 889;
  47287. t['perthousand'] = 1000;
  47288. t['questiondown'] = 500;
  47289. t['grave'] = 333;
  47290. t['acute'] = 333;
  47291. t['circumflex'] = 333;
  47292. t['tilde'] = 333;
  47293. t['macron'] = 333;
  47294. t['breve'] = 333;
  47295. t['dotaccent'] = 333;
  47296. t['dieresis'] = 333;
  47297. t['ring'] = 333;
  47298. t['cedilla'] = 333;
  47299. t['hungarumlaut'] = 333;
  47300. t['ogonek'] = 333;
  47301. t['caron'] = 333;
  47302. t['emdash'] = 889;
  47303. t['AE'] = 889;
  47304. t['ordfeminine'] = 276;
  47305. t['Lslash'] = 556;
  47306. t['Oslash'] = 722;
  47307. t['OE'] = 944;
  47308. t['ordmasculine'] = 310;
  47309. t['ae'] = 667;
  47310. t['dotlessi'] = 278;
  47311. t['lslash'] = 278;
  47312. t['oslash'] = 500;
  47313. t['oe'] = 667;
  47314. t['germandbls'] = 500;
  47315. t['Idieresis'] = 333;
  47316. t['eacute'] = 444;
  47317. t['abreve'] = 500;
  47318. t['uhungarumlaut'] = 500;
  47319. t['ecaron'] = 444;
  47320. t['Ydieresis'] = 556;
  47321. t['divide'] = 675;
  47322. t['Yacute'] = 556;
  47323. t['Acircumflex'] = 611;
  47324. t['aacute'] = 500;
  47325. t['Ucircumflex'] = 722;
  47326. t['yacute'] = 444;
  47327. t['scommaaccent'] = 389;
  47328. t['ecircumflex'] = 444;
  47329. t['Uring'] = 722;
  47330. t['Udieresis'] = 722;
  47331. t['aogonek'] = 500;
  47332. t['Uacute'] = 722;
  47333. t['uogonek'] = 500;
  47334. t['Edieresis'] = 611;
  47335. t['Dcroat'] = 722;
  47336. t['commaaccent'] = 250;
  47337. t['copyright'] = 760;
  47338. t['Emacron'] = 611;
  47339. t['ccaron'] = 444;
  47340. t['aring'] = 500;
  47341. t['Ncommaaccent'] = 667;
  47342. t['lacute'] = 278;
  47343. t['agrave'] = 500;
  47344. t['Tcommaaccent'] = 556;
  47345. t['Cacute'] = 667;
  47346. t['atilde'] = 500;
  47347. t['Edotaccent'] = 611;
  47348. t['scaron'] = 389;
  47349. t['scedilla'] = 389;
  47350. t['iacute'] = 278;
  47351. t['lozenge'] = 471;
  47352. t['Rcaron'] = 611;
  47353. t['Gcommaaccent'] = 722;
  47354. t['ucircumflex'] = 500;
  47355. t['acircumflex'] = 500;
  47356. t['Amacron'] = 611;
  47357. t['rcaron'] = 389;
  47358. t['ccedilla'] = 444;
  47359. t['Zdotaccent'] = 556;
  47360. t['Thorn'] = 611;
  47361. t['Omacron'] = 722;
  47362. t['Racute'] = 611;
  47363. t['Sacute'] = 500;
  47364. t['dcaron'] = 544;
  47365. t['Umacron'] = 722;
  47366. t['uring'] = 500;
  47367. t['threesuperior'] = 300;
  47368. t['Ograve'] = 722;
  47369. t['Agrave'] = 611;
  47370. t['Abreve'] = 611;
  47371. t['multiply'] = 675;
  47372. t['uacute'] = 500;
  47373. t['Tcaron'] = 556;
  47374. t['partialdiff'] = 476;
  47375. t['ydieresis'] = 444;
  47376. t['Nacute'] = 667;
  47377. t['icircumflex'] = 278;
  47378. t['Ecircumflex'] = 611;
  47379. t['adieresis'] = 500;
  47380. t['edieresis'] = 444;
  47381. t['cacute'] = 444;
  47382. t['nacute'] = 500;
  47383. t['umacron'] = 500;
  47384. t['Ncaron'] = 667;
  47385. t['Iacute'] = 333;
  47386. t['plusminus'] = 675;
  47387. t['brokenbar'] = 275;
  47388. t['registered'] = 760;
  47389. t['Gbreve'] = 722;
  47390. t['Idotaccent'] = 333;
  47391. t['summation'] = 600;
  47392. t['Egrave'] = 611;
  47393. t['racute'] = 389;
  47394. t['omacron'] = 500;
  47395. t['Zacute'] = 556;
  47396. t['Zcaron'] = 556;
  47397. t['greaterequal'] = 549;
  47398. t['Eth'] = 722;
  47399. t['Ccedilla'] = 667;
  47400. t['lcommaaccent'] = 278;
  47401. t['tcaron'] = 300;
  47402. t['eogonek'] = 444;
  47403. t['Uogonek'] = 722;
  47404. t['Aacute'] = 611;
  47405. t['Adieresis'] = 611;
  47406. t['egrave'] = 444;
  47407. t['zacute'] = 389;
  47408. t['iogonek'] = 278;
  47409. t['Oacute'] = 722;
  47410. t['oacute'] = 500;
  47411. t['amacron'] = 500;
  47412. t['sacute'] = 389;
  47413. t['idieresis'] = 278;
  47414. t['Ocircumflex'] = 722;
  47415. t['Ugrave'] = 722;
  47416. t['Delta'] = 612;
  47417. t['thorn'] = 500;
  47418. t['twosuperior'] = 300;
  47419. t['Odieresis'] = 722;
  47420. t['mu'] = 500;
  47421. t['igrave'] = 278;
  47422. t['ohungarumlaut'] = 500;
  47423. t['Eogonek'] = 611;
  47424. t['dcroat'] = 500;
  47425. t['threequarters'] = 750;
  47426. t['Scedilla'] = 500;
  47427. t['lcaron'] = 300;
  47428. t['Kcommaaccent'] = 667;
  47429. t['Lacute'] = 556;
  47430. t['trademark'] = 980;
  47431. t['edotaccent'] = 444;
  47432. t['Igrave'] = 333;
  47433. t['Imacron'] = 333;
  47434. t['Lcaron'] = 611;
  47435. t['onehalf'] = 750;
  47436. t['lessequal'] = 549;
  47437. t['ocircumflex'] = 500;
  47438. t['ntilde'] = 500;
  47439. t['Uhungarumlaut'] = 722;
  47440. t['Eacute'] = 611;
  47441. t['emacron'] = 444;
  47442. t['gbreve'] = 500;
  47443. t['onequarter'] = 750;
  47444. t['Scaron'] = 500;
  47445. t['Scommaaccent'] = 500;
  47446. t['Ohungarumlaut'] = 722;
  47447. t['degree'] = 400;
  47448. t['ograve'] = 500;
  47449. t['Ccaron'] = 667;
  47450. t['ugrave'] = 500;
  47451. t['radical'] = 453;
  47452. t['Dcaron'] = 722;
  47453. t['rcommaaccent'] = 389;
  47454. t['Ntilde'] = 667;
  47455. t['otilde'] = 500;
  47456. t['Rcommaaccent'] = 611;
  47457. t['Lcommaaccent'] = 556;
  47458. t['Atilde'] = 611;
  47459. t['Aogonek'] = 611;
  47460. t['Aring'] = 611;
  47461. t['Otilde'] = 722;
  47462. t['zdotaccent'] = 389;
  47463. t['Ecaron'] = 611;
  47464. t['Iogonek'] = 333;
  47465. t['kcommaaccent'] = 444;
  47466. t['minus'] = 675;
  47467. t['Icircumflex'] = 333;
  47468. t['ncaron'] = 500;
  47469. t['tcommaaccent'] = 278;
  47470. t['logicalnot'] = 675;
  47471. t['odieresis'] = 500;
  47472. t['udieresis'] = 500;
  47473. t['notequal'] = 549;
  47474. t['gcommaaccent'] = 500;
  47475. t['eth'] = 500;
  47476. t['zcaron'] = 389;
  47477. t['ncommaaccent'] = 500;
  47478. t['onesuperior'] = 300;
  47479. t['imacron'] = 278;
  47480. t['Euro'] = 500;
  47481. });
  47482. t['ZapfDingbats'] = getLookupTableFactory(function (t) {
  47483. t['space'] = 278;
  47484. t['a1'] = 974;
  47485. t['a2'] = 961;
  47486. t['a202'] = 974;
  47487. t['a3'] = 980;
  47488. t['a4'] = 719;
  47489. t['a5'] = 789;
  47490. t['a119'] = 790;
  47491. t['a118'] = 791;
  47492. t['a117'] = 690;
  47493. t['a11'] = 960;
  47494. t['a12'] = 939;
  47495. t['a13'] = 549;
  47496. t['a14'] = 855;
  47497. t['a15'] = 911;
  47498. t['a16'] = 933;
  47499. t['a105'] = 911;
  47500. t['a17'] = 945;
  47501. t['a18'] = 974;
  47502. t['a19'] = 755;
  47503. t['a20'] = 846;
  47504. t['a21'] = 762;
  47505. t['a22'] = 761;
  47506. t['a23'] = 571;
  47507. t['a24'] = 677;
  47508. t['a25'] = 763;
  47509. t['a26'] = 760;
  47510. t['a27'] = 759;
  47511. t['a28'] = 754;
  47512. t['a6'] = 494;
  47513. t['a7'] = 552;
  47514. t['a8'] = 537;
  47515. t['a9'] = 577;
  47516. t['a10'] = 692;
  47517. t['a29'] = 786;
  47518. t['a30'] = 788;
  47519. t['a31'] = 788;
  47520. t['a32'] = 790;
  47521. t['a33'] = 793;
  47522. t['a34'] = 794;
  47523. t['a35'] = 816;
  47524. t['a36'] = 823;
  47525. t['a37'] = 789;
  47526. t['a38'] = 841;
  47527. t['a39'] = 823;
  47528. t['a40'] = 833;
  47529. t['a41'] = 816;
  47530. t['a42'] = 831;
  47531. t['a43'] = 923;
  47532. t['a44'] = 744;
  47533. t['a45'] = 723;
  47534. t['a46'] = 749;
  47535. t['a47'] = 790;
  47536. t['a48'] = 792;
  47537. t['a49'] = 695;
  47538. t['a50'] = 776;
  47539. t['a51'] = 768;
  47540. t['a52'] = 792;
  47541. t['a53'] = 759;
  47542. t['a54'] = 707;
  47543. t['a55'] = 708;
  47544. t['a56'] = 682;
  47545. t['a57'] = 701;
  47546. t['a58'] = 826;
  47547. t['a59'] = 815;
  47548. t['a60'] = 789;
  47549. t['a61'] = 789;
  47550. t['a62'] = 707;
  47551. t['a63'] = 687;
  47552. t['a64'] = 696;
  47553. t['a65'] = 689;
  47554. t['a66'] = 786;
  47555. t['a67'] = 787;
  47556. t['a68'] = 713;
  47557. t['a69'] = 791;
  47558. t['a70'] = 785;
  47559. t['a71'] = 791;
  47560. t['a72'] = 873;
  47561. t['a73'] = 761;
  47562. t['a74'] = 762;
  47563. t['a203'] = 762;
  47564. t['a75'] = 759;
  47565. t['a204'] = 759;
  47566. t['a76'] = 892;
  47567. t['a77'] = 892;
  47568. t['a78'] = 788;
  47569. t['a79'] = 784;
  47570. t['a81'] = 438;
  47571. t['a82'] = 138;
  47572. t['a83'] = 277;
  47573. t['a84'] = 415;
  47574. t['a97'] = 392;
  47575. t['a98'] = 392;
  47576. t['a99'] = 668;
  47577. t['a100'] = 668;
  47578. t['a89'] = 390;
  47579. t['a90'] = 390;
  47580. t['a93'] = 317;
  47581. t['a94'] = 317;
  47582. t['a91'] = 276;
  47583. t['a92'] = 276;
  47584. t['a205'] = 509;
  47585. t['a85'] = 509;
  47586. t['a206'] = 410;
  47587. t['a86'] = 410;
  47588. t['a87'] = 234;
  47589. t['a88'] = 234;
  47590. t['a95'] = 334;
  47591. t['a96'] = 334;
  47592. t['a101'] = 732;
  47593. t['a102'] = 544;
  47594. t['a103'] = 544;
  47595. t['a104'] = 910;
  47596. t['a106'] = 667;
  47597. t['a107'] = 760;
  47598. t['a108'] = 760;
  47599. t['a112'] = 776;
  47600. t['a111'] = 595;
  47601. t['a110'] = 694;
  47602. t['a109'] = 626;
  47603. t['a120'] = 788;
  47604. t['a121'] = 788;
  47605. t['a122'] = 788;
  47606. t['a123'] = 788;
  47607. t['a124'] = 788;
  47608. t['a125'] = 788;
  47609. t['a126'] = 788;
  47610. t['a127'] = 788;
  47611. t['a128'] = 788;
  47612. t['a129'] = 788;
  47613. t['a130'] = 788;
  47614. t['a131'] = 788;
  47615. t['a132'] = 788;
  47616. t['a133'] = 788;
  47617. t['a134'] = 788;
  47618. t['a135'] = 788;
  47619. t['a136'] = 788;
  47620. t['a137'] = 788;
  47621. t['a138'] = 788;
  47622. t['a139'] = 788;
  47623. t['a140'] = 788;
  47624. t['a141'] = 788;
  47625. t['a142'] = 788;
  47626. t['a143'] = 788;
  47627. t['a144'] = 788;
  47628. t['a145'] = 788;
  47629. t['a146'] = 788;
  47630. t['a147'] = 788;
  47631. t['a148'] = 788;
  47632. t['a149'] = 788;
  47633. t['a150'] = 788;
  47634. t['a151'] = 788;
  47635. t['a152'] = 788;
  47636. t['a153'] = 788;
  47637. t['a154'] = 788;
  47638. t['a155'] = 788;
  47639. t['a156'] = 788;
  47640. t['a157'] = 788;
  47641. t['a158'] = 788;
  47642. t['a159'] = 788;
  47643. t['a160'] = 894;
  47644. t['a161'] = 838;
  47645. t['a163'] = 1016;
  47646. t['a164'] = 458;
  47647. t['a196'] = 748;
  47648. t['a165'] = 924;
  47649. t['a192'] = 748;
  47650. t['a166'] = 918;
  47651. t['a167'] = 927;
  47652. t['a168'] = 928;
  47653. t['a169'] = 928;
  47654. t['a170'] = 834;
  47655. t['a171'] = 873;
  47656. t['a172'] = 828;
  47657. t['a173'] = 924;
  47658. t['a162'] = 924;
  47659. t['a174'] = 917;
  47660. t['a175'] = 930;
  47661. t['a176'] = 931;
  47662. t['a177'] = 463;
  47663. t['a178'] = 883;
  47664. t['a179'] = 836;
  47665. t['a193'] = 836;
  47666. t['a180'] = 867;
  47667. t['a199'] = 867;
  47668. t['a181'] = 696;
  47669. t['a200'] = 696;
  47670. t['a182'] = 874;
  47671. t['a201'] = 874;
  47672. t['a183'] = 760;
  47673. t['a184'] = 946;
  47674. t['a197'] = 771;
  47675. t['a185'] = 865;
  47676. t['a194'] = 771;
  47677. t['a198'] = 888;
  47678. t['a186'] = 967;
  47679. t['a195'] = 888;
  47680. t['a187'] = 831;
  47681. t['a188'] = 873;
  47682. t['a189'] = 927;
  47683. t['a190'] = 970;
  47684. t['a191'] = 918;
  47685. });
  47686. });
  47687. exports.getMetrics = getMetrics;
  47688. /***/ }),
  47689. /* 31 */
  47690. /***/ (function(module, exports, __w_pdfjs_require__) {
  47691. "use strict";
  47692. var sharedUtil = __w_pdfjs_require__(0);
  47693. var Uint32ArrayView = sharedUtil.Uint32ArrayView;
  47694. var MurmurHash3_64 = function MurmurHash3_64Closure(seed) {
  47695. var MASK_HIGH = 0xffff0000;
  47696. var MASK_LOW = 0xffff;
  47697. function MurmurHash3_64(seed) {
  47698. var SEED = 0xc3d2e1f0;
  47699. this.h1 = seed ? seed & 0xffffffff : SEED;
  47700. this.h2 = seed ? seed & 0xffffffff : SEED;
  47701. }
  47702. var alwaysUseUint32ArrayView = false;
  47703. try {
  47704. new Uint32Array(new Uint8Array(5).buffer, 0, 1);
  47705. } catch (e) {
  47706. alwaysUseUint32ArrayView = true;
  47707. }
  47708. MurmurHash3_64.prototype = {
  47709. update: function MurmurHash3_64_update(input) {
  47710. var useUint32ArrayView = alwaysUseUint32ArrayView;
  47711. var i;
  47712. if (typeof input === 'string') {
  47713. var data = new Uint8Array(input.length * 2);
  47714. var length = 0;
  47715. for (i = 0; i < input.length; i++) {
  47716. var code = input.charCodeAt(i);
  47717. if (code <= 0xff) {
  47718. data[length++] = code;
  47719. } else {
  47720. data[length++] = code >>> 8;
  47721. data[length++] = code & 0xff;
  47722. }
  47723. }
  47724. } else if (input instanceof Uint8Array) {
  47725. data = input;
  47726. length = data.length;
  47727. } else if (typeof input === 'object' && 'length' in input) {
  47728. data = input;
  47729. length = data.length;
  47730. useUint32ArrayView = true;
  47731. } else {
  47732. throw new Error('Wrong data format in MurmurHash3_64_update. ' + 'Input must be a string or array.');
  47733. }
  47734. var blockCounts = length >> 2;
  47735. var tailLength = length - blockCounts * 4;
  47736. var dataUint32 = useUint32ArrayView ? new Uint32ArrayView(data, blockCounts) : new Uint32Array(data.buffer, 0, blockCounts);
  47737. var k1 = 0;
  47738. var k2 = 0;
  47739. var h1 = this.h1;
  47740. var h2 = this.h2;
  47741. var C1 = 0xcc9e2d51;
  47742. var C2 = 0x1b873593;
  47743. var C1_LOW = C1 & MASK_LOW;
  47744. var C2_LOW = C2 & MASK_LOW;
  47745. for (i = 0; i < blockCounts; i++) {
  47746. if (i & 1) {
  47747. k1 = dataUint32[i];
  47748. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  47749. k1 = k1 << 15 | k1 >>> 17;
  47750. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  47751. h1 ^= k1;
  47752. h1 = h1 << 13 | h1 >>> 19;
  47753. h1 = h1 * 5 + 0xe6546b64;
  47754. } else {
  47755. k2 = dataUint32[i];
  47756. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  47757. k2 = k2 << 15 | k2 >>> 17;
  47758. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  47759. h2 ^= k2;
  47760. h2 = h2 << 13 | h2 >>> 19;
  47761. h2 = h2 * 5 + 0xe6546b64;
  47762. }
  47763. }
  47764. k1 = 0;
  47765. switch (tailLength) {
  47766. case 3:
  47767. k1 ^= data[blockCounts * 4 + 2] << 16;
  47768. case 2:
  47769. k1 ^= data[blockCounts * 4 + 1] << 8;
  47770. case 1:
  47771. k1 ^= data[blockCounts * 4];
  47772. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  47773. k1 = k1 << 15 | k1 >>> 17;
  47774. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  47775. if (blockCounts & 1) {
  47776. h1 ^= k1;
  47777. } else {
  47778. h2 ^= k1;
  47779. }
  47780. }
  47781. this.h1 = h1;
  47782. this.h2 = h2;
  47783. return this;
  47784. },
  47785. hexdigest: function MurmurHash3_64_hexdigest() {
  47786. var h1 = this.h1;
  47787. var h2 = this.h2;
  47788. h1 ^= h2 >>> 1;
  47789. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  47790. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  47791. h1 ^= h2 >>> 1;
  47792. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  47793. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  47794. h1 ^= h2 >>> 1;
  47795. for (var i = 0, arr = [
  47796. h1,
  47797. h2
  47798. ], str = ''; i < arr.length; i++) {
  47799. var hex = (arr[i] >>> 0).toString(16);
  47800. while (hex.length < 8) {
  47801. hex = '0' + hex;
  47802. }
  47803. str += hex;
  47804. }
  47805. return str;
  47806. }
  47807. };
  47808. return MurmurHash3_64;
  47809. }();
  47810. exports.MurmurHash3_64 = MurmurHash3_64;
  47811. /***/ }),
  47812. /* 32 */
  47813. /***/ (function(module, exports, __w_pdfjs_require__) {
  47814. "use strict";
  47815. var sharedUtil = __w_pdfjs_require__(0);
  47816. var corePrimitives = __w_pdfjs_require__(1);
  47817. var coreFunction = __w_pdfjs_require__(6);
  47818. var coreColorSpace = __w_pdfjs_require__(3);
  47819. var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES;
  47820. var MissingDataException = sharedUtil.MissingDataException;
  47821. var Util = sharedUtil.Util;
  47822. var assert = sharedUtil.assert;
  47823. var error = sharedUtil.error;
  47824. var info = sharedUtil.info;
  47825. var warn = sharedUtil.warn;
  47826. var isStream = corePrimitives.isStream;
  47827. var PDFFunction = coreFunction.PDFFunction;
  47828. var ColorSpace = coreColorSpace.ColorSpace;
  47829. var ShadingType = {
  47830. FUNCTION_BASED: 1,
  47831. AXIAL: 2,
  47832. RADIAL: 3,
  47833. FREE_FORM_MESH: 4,
  47834. LATTICE_FORM_MESH: 5,
  47835. COONS_PATCH_MESH: 6,
  47836. TENSOR_PATCH_MESH: 7
  47837. };
  47838. var Pattern = function PatternClosure() {
  47839. function Pattern() {
  47840. error('should not call Pattern constructor');
  47841. }
  47842. Pattern.prototype = {
  47843. getPattern: function Pattern_getPattern(ctx) {
  47844. error('Should not call Pattern.getStyle: ' + ctx);
  47845. }
  47846. };
  47847. Pattern.parseShading = function Pattern_parseShading(shading, matrix, xref, res, handler) {
  47848. var dict = isStream(shading) ? shading.dict : shading;
  47849. var type = dict.get('ShadingType');
  47850. try {
  47851. switch (type) {
  47852. case ShadingType.AXIAL:
  47853. case ShadingType.RADIAL:
  47854. return new Shadings.RadialAxial(dict, matrix, xref, res);
  47855. case ShadingType.FREE_FORM_MESH:
  47856. case ShadingType.LATTICE_FORM_MESH:
  47857. case ShadingType.COONS_PATCH_MESH:
  47858. case ShadingType.TENSOR_PATCH_MESH:
  47859. return new Shadings.Mesh(shading, matrix, xref, res);
  47860. default:
  47861. throw new Error('Unsupported ShadingType: ' + type);
  47862. }
  47863. } catch (ex) {
  47864. if (ex instanceof MissingDataException) {
  47865. throw ex;
  47866. }
  47867. handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.shadingPattern });
  47868. warn(ex);
  47869. return new Shadings.Dummy();
  47870. }
  47871. };
  47872. return Pattern;
  47873. }();
  47874. var Shadings = {};
  47875. Shadings.SMALL_NUMBER = 1e-6;
  47876. Shadings.RadialAxial = function RadialAxialClosure() {
  47877. function RadialAxial(dict, matrix, xref, res) {
  47878. this.matrix = matrix;
  47879. this.coordsArr = dict.getArray('Coords');
  47880. this.shadingType = dict.get('ShadingType');
  47881. this.type = 'Pattern';
  47882. var cs = dict.get('ColorSpace', 'CS');
  47883. cs = ColorSpace.parse(cs, xref, res);
  47884. this.cs = cs;
  47885. var t0 = 0.0, t1 = 1.0;
  47886. if (dict.has('Domain')) {
  47887. var domainArr = dict.getArray('Domain');
  47888. t0 = domainArr[0];
  47889. t1 = domainArr[1];
  47890. }
  47891. var extendStart = false, extendEnd = false;
  47892. if (dict.has('Extend')) {
  47893. var extendArr = dict.getArray('Extend');
  47894. extendStart = extendArr[0];
  47895. extendEnd = extendArr[1];
  47896. }
  47897. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  47898. var x1 = this.coordsArr[0];
  47899. var y1 = this.coordsArr[1];
  47900. var r1 = this.coordsArr[2];
  47901. var x2 = this.coordsArr[3];
  47902. var y2 = this.coordsArr[4];
  47903. var r2 = this.coordsArr[5];
  47904. var distance = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  47905. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  47906. warn('Unsupported radial gradient.');
  47907. }
  47908. }
  47909. this.extendStart = extendStart;
  47910. this.extendEnd = extendEnd;
  47911. var fnObj = dict.get('Function');
  47912. var fn = PDFFunction.parseArray(xref, fnObj);
  47913. var diff = t1 - t0;
  47914. var step = diff / 10;
  47915. var colorStops = this.colorStops = [];
  47916. if (t0 >= t1 || step <= 0) {
  47917. info('Bad shading domain.');
  47918. return;
  47919. }
  47920. var color = new Float32Array(cs.numComps), ratio = new Float32Array(1);
  47921. var rgbColor;
  47922. for (var i = t0; i <= t1; i += step) {
  47923. ratio[0] = i;
  47924. fn(ratio, 0, color, 0);
  47925. rgbColor = cs.getRgb(color, 0);
  47926. var cssColor = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  47927. colorStops.push([
  47928. (i - t0) / diff,
  47929. cssColor
  47930. ]);
  47931. }
  47932. var background = 'transparent';
  47933. if (dict.has('Background')) {
  47934. rgbColor = cs.getRgb(dict.get('Background'), 0);
  47935. background = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
  47936. }
  47937. if (!extendStart) {
  47938. colorStops.unshift([
  47939. 0,
  47940. background
  47941. ]);
  47942. colorStops[1][0] += Shadings.SMALL_NUMBER;
  47943. }
  47944. if (!extendEnd) {
  47945. colorStops[colorStops.length - 1][0] -= Shadings.SMALL_NUMBER;
  47946. colorStops.push([
  47947. 1,
  47948. background
  47949. ]);
  47950. }
  47951. this.colorStops = colorStops;
  47952. }
  47953. RadialAxial.prototype = {
  47954. getIR: function RadialAxial_getIR() {
  47955. var coordsArr = this.coordsArr;
  47956. var shadingType = this.shadingType;
  47957. var type, p0, p1, r0, r1;
  47958. if (shadingType === ShadingType.AXIAL) {
  47959. p0 = [
  47960. coordsArr[0],
  47961. coordsArr[1]
  47962. ];
  47963. p1 = [
  47964. coordsArr[2],
  47965. coordsArr[3]
  47966. ];
  47967. r0 = null;
  47968. r1 = null;
  47969. type = 'axial';
  47970. } else if (shadingType === ShadingType.RADIAL) {
  47971. p0 = [
  47972. coordsArr[0],
  47973. coordsArr[1]
  47974. ];
  47975. p1 = [
  47976. coordsArr[3],
  47977. coordsArr[4]
  47978. ];
  47979. r0 = coordsArr[2];
  47980. r1 = coordsArr[5];
  47981. type = 'radial';
  47982. } else {
  47983. error('getPattern type unknown: ' + shadingType);
  47984. }
  47985. var matrix = this.matrix;
  47986. if (matrix) {
  47987. p0 = Util.applyTransform(p0, matrix);
  47988. p1 = Util.applyTransform(p1, matrix);
  47989. if (shadingType === ShadingType.RADIAL) {
  47990. var scale = Util.singularValueDecompose2dScale(matrix);
  47991. r0 *= scale[0];
  47992. r1 *= scale[1];
  47993. }
  47994. }
  47995. return [
  47996. 'RadialAxial',
  47997. type,
  47998. this.colorStops,
  47999. p0,
  48000. p1,
  48001. r0,
  48002. r1
  48003. ];
  48004. }
  48005. };
  48006. return RadialAxial;
  48007. }();
  48008. Shadings.Mesh = function MeshClosure() {
  48009. function MeshStreamReader(stream, context) {
  48010. this.stream = stream;
  48011. this.context = context;
  48012. this.buffer = 0;
  48013. this.bufferLength = 0;
  48014. var numComps = context.numComps;
  48015. this.tmpCompsBuf = new Float32Array(numComps);
  48016. var csNumComps = context.colorSpace.numComps;
  48017. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  48018. }
  48019. MeshStreamReader.prototype = {
  48020. get hasData() {
  48021. if (this.stream.end) {
  48022. return this.stream.pos < this.stream.end;
  48023. }
  48024. if (this.bufferLength > 0) {
  48025. return true;
  48026. }
  48027. var nextByte = this.stream.getByte();
  48028. if (nextByte < 0) {
  48029. return false;
  48030. }
  48031. this.buffer = nextByte;
  48032. this.bufferLength = 8;
  48033. return true;
  48034. },
  48035. readBits: function MeshStreamReader_readBits(n) {
  48036. var buffer = this.buffer;
  48037. var bufferLength = this.bufferLength;
  48038. if (n === 32) {
  48039. if (bufferLength === 0) {
  48040. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  48041. }
  48042. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  48043. var nextByte = this.stream.getByte();
  48044. this.buffer = nextByte & (1 << bufferLength) - 1;
  48045. return (buffer << 8 - bufferLength | (nextByte & 0xFF) >> bufferLength) >>> 0;
  48046. }
  48047. if (n === 8 && bufferLength === 0) {
  48048. return this.stream.getByte();
  48049. }
  48050. while (bufferLength < n) {
  48051. buffer = buffer << 8 | this.stream.getByte();
  48052. bufferLength += 8;
  48053. }
  48054. bufferLength -= n;
  48055. this.bufferLength = bufferLength;
  48056. this.buffer = buffer & (1 << bufferLength) - 1;
  48057. return buffer >> bufferLength;
  48058. },
  48059. align: function MeshStreamReader_align() {
  48060. this.buffer = 0;
  48061. this.bufferLength = 0;
  48062. },
  48063. readFlag: function MeshStreamReader_readFlag() {
  48064. return this.readBits(this.context.bitsPerFlag);
  48065. },
  48066. readCoordinate: function MeshStreamReader_readCoordinate() {
  48067. var bitsPerCoordinate = this.context.bitsPerCoordinate;
  48068. var xi = this.readBits(bitsPerCoordinate);
  48069. var yi = this.readBits(bitsPerCoordinate);
  48070. var decode = this.context.decode;
  48071. var scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  48072. return [
  48073. xi * scale * (decode[1] - decode[0]) + decode[0],
  48074. yi * scale * (decode[3] - decode[2]) + decode[2]
  48075. ];
  48076. },
  48077. readComponents: function MeshStreamReader_readComponents() {
  48078. var numComps = this.context.numComps;
  48079. var bitsPerComponent = this.context.bitsPerComponent;
  48080. var scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  48081. var decode = this.context.decode;
  48082. var components = this.tmpCompsBuf;
  48083. for (var i = 0, j = 4; i < numComps; i++, j += 2) {
  48084. var ci = this.readBits(bitsPerComponent);
  48085. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  48086. }
  48087. var color = this.tmpCsCompsBuf;
  48088. if (this.context.colorFn) {
  48089. this.context.colorFn(components, 0, color, 0);
  48090. }
  48091. return this.context.colorSpace.getRgb(color, 0);
  48092. }
  48093. };
  48094. function decodeType4Shading(mesh, reader) {
  48095. var coords = mesh.coords;
  48096. var colors = mesh.colors;
  48097. var operators = [];
  48098. var ps = [];
  48099. var verticesLeft = 0;
  48100. while (reader.hasData) {
  48101. var f = reader.readFlag();
  48102. var coord = reader.readCoordinate();
  48103. var color = reader.readComponents();
  48104. if (verticesLeft === 0) {
  48105. assert(0 <= f && f <= 2, 'Unknown type4 flag');
  48106. switch (f) {
  48107. case 0:
  48108. verticesLeft = 3;
  48109. break;
  48110. case 1:
  48111. ps.push(ps[ps.length - 2], ps[ps.length - 1]);
  48112. verticesLeft = 1;
  48113. break;
  48114. case 2:
  48115. ps.push(ps[ps.length - 3], ps[ps.length - 1]);
  48116. verticesLeft = 1;
  48117. break;
  48118. }
  48119. operators.push(f);
  48120. }
  48121. ps.push(coords.length);
  48122. coords.push(coord);
  48123. colors.push(color);
  48124. verticesLeft--;
  48125. reader.align();
  48126. }
  48127. mesh.figures.push({
  48128. type: 'triangles',
  48129. coords: new Int32Array(ps),
  48130. colors: new Int32Array(ps)
  48131. });
  48132. }
  48133. function decodeType5Shading(mesh, reader, verticesPerRow) {
  48134. var coords = mesh.coords;
  48135. var colors = mesh.colors;
  48136. var ps = [];
  48137. while (reader.hasData) {
  48138. var coord = reader.readCoordinate();
  48139. var color = reader.readComponents();
  48140. ps.push(coords.length);
  48141. coords.push(coord);
  48142. colors.push(color);
  48143. }
  48144. mesh.figures.push({
  48145. type: 'lattice',
  48146. coords: new Int32Array(ps),
  48147. colors: new Int32Array(ps),
  48148. verticesPerRow: verticesPerRow
  48149. });
  48150. }
  48151. var MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3;
  48152. var MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20;
  48153. var TRIANGLE_DENSITY = 20;
  48154. var getB = function getBClosure() {
  48155. function buildB(count) {
  48156. var lut = [];
  48157. for (var i = 0; i <= count; i++) {
  48158. var t = i / count, t_ = 1 - t;
  48159. lut.push(new Float32Array([
  48160. t_ * t_ * t_,
  48161. 3 * t * t_ * t_,
  48162. 3 * t * t * t_,
  48163. t * t * t
  48164. ]));
  48165. }
  48166. return lut;
  48167. }
  48168. var cache = [];
  48169. return function getB(count) {
  48170. if (!cache[count]) {
  48171. cache[count] = buildB(count);
  48172. }
  48173. return cache[count];
  48174. };
  48175. }();
  48176. function buildFigureFromPatch(mesh, index) {
  48177. var figure = mesh.figures[index];
  48178. assert(figure.type === 'patch', 'Unexpected patch mesh figure');
  48179. var coords = mesh.coords, colors = mesh.colors;
  48180. var pi = figure.coords;
  48181. var ci = figure.colors;
  48182. var figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  48183. var figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  48184. var figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  48185. var figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  48186. var splitXBy = Math.ceil((figureMaxX - figureMinX) * TRIANGLE_DENSITY / (mesh.bounds[2] - mesh.bounds[0]));
  48187. splitXBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  48188. var splitYBy = Math.ceil((figureMaxY - figureMinY) * TRIANGLE_DENSITY / (mesh.bounds[3] - mesh.bounds[1]));
  48189. splitYBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  48190. var verticesPerRow = splitXBy + 1;
  48191. var figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  48192. var figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  48193. var k = 0;
  48194. var cl = new Uint8Array(3), cr = new Uint8Array(3);
  48195. var c0 = colors[ci[0]], c1 = colors[ci[1]], c2 = colors[ci[2]], c3 = colors[ci[3]];
  48196. var bRow = getB(splitYBy), bCol = getB(splitXBy);
  48197. for (var row = 0; row <= splitYBy; row++) {
  48198. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  48199. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  48200. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  48201. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  48202. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  48203. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  48204. for (var col = 0; col <= splitXBy; col++, k++) {
  48205. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  48206. continue;
  48207. }
  48208. var x = 0, y = 0;
  48209. var q = 0;
  48210. for (var i = 0; i <= 3; i++) {
  48211. for (var j = 0; j <= 3; j++, q++) {
  48212. var m = bRow[row][i] * bCol[col][j];
  48213. x += coords[pi[q]][0] * m;
  48214. y += coords[pi[q]][1] * m;
  48215. }
  48216. }
  48217. figureCoords[k] = coords.length;
  48218. coords.push([
  48219. x,
  48220. y
  48221. ]);
  48222. figureColors[k] = colors.length;
  48223. var newColor = new Uint8Array(3);
  48224. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  48225. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  48226. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  48227. colors.push(newColor);
  48228. }
  48229. }
  48230. figureCoords[0] = pi[0];
  48231. figureColors[0] = ci[0];
  48232. figureCoords[splitXBy] = pi[3];
  48233. figureColors[splitXBy] = ci[1];
  48234. figureCoords[verticesPerRow * splitYBy] = pi[12];
  48235. figureColors[verticesPerRow * splitYBy] = ci[2];
  48236. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  48237. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  48238. mesh.figures[index] = {
  48239. type: 'lattice',
  48240. coords: figureCoords,
  48241. colors: figureColors,
  48242. verticesPerRow: verticesPerRow
  48243. };
  48244. }
  48245. function decodeType6Shading(mesh, reader) {
  48246. var coords = mesh.coords;
  48247. var colors = mesh.colors;
  48248. var ps = new Int32Array(16);
  48249. var cs = new Int32Array(4);
  48250. while (reader.hasData) {
  48251. var f = reader.readFlag();
  48252. assert(0 <= f && f <= 3, 'Unknown type6 flag');
  48253. var i, ii;
  48254. var pi = coords.length;
  48255. for (i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  48256. coords.push(reader.readCoordinate());
  48257. }
  48258. var ci = colors.length;
  48259. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  48260. colors.push(reader.readComponents());
  48261. }
  48262. var tmp1, tmp2, tmp3, tmp4;
  48263. switch (f) {
  48264. case 0:
  48265. ps[12] = pi + 3;
  48266. ps[13] = pi + 4;
  48267. ps[14] = pi + 5;
  48268. ps[15] = pi + 6;
  48269. ps[8] = pi + 2;
  48270. ps[11] = pi + 7;
  48271. ps[4] = pi + 1;
  48272. ps[7] = pi + 8;
  48273. ps[0] = pi;
  48274. ps[1] = pi + 11;
  48275. ps[2] = pi + 10;
  48276. ps[3] = pi + 9;
  48277. cs[2] = ci + 1;
  48278. cs[3] = ci + 2;
  48279. cs[0] = ci;
  48280. cs[1] = ci + 3;
  48281. break;
  48282. case 1:
  48283. tmp1 = ps[12];
  48284. tmp2 = ps[13];
  48285. tmp3 = ps[14];
  48286. tmp4 = ps[15];
  48287. ps[12] = tmp4;
  48288. ps[13] = pi + 0;
  48289. ps[14] = pi + 1;
  48290. ps[15] = pi + 2;
  48291. ps[8] = tmp3;
  48292. ps[11] = pi + 3;
  48293. ps[4] = tmp2;
  48294. ps[7] = pi + 4;
  48295. ps[0] = tmp1;
  48296. ps[1] = pi + 7;
  48297. ps[2] = pi + 6;
  48298. ps[3] = pi + 5;
  48299. tmp1 = cs[2];
  48300. tmp2 = cs[3];
  48301. cs[2] = tmp2;
  48302. cs[3] = ci;
  48303. cs[0] = tmp1;
  48304. cs[1] = ci + 1;
  48305. break;
  48306. case 2:
  48307. tmp1 = ps[15];
  48308. tmp2 = ps[11];
  48309. ps[12] = ps[3];
  48310. ps[13] = pi + 0;
  48311. ps[14] = pi + 1;
  48312. ps[15] = pi + 2;
  48313. ps[8] = ps[7];
  48314. ps[11] = pi + 3;
  48315. ps[4] = tmp2;
  48316. ps[7] = pi + 4;
  48317. ps[0] = tmp1;
  48318. ps[1] = pi + 7;
  48319. ps[2] = pi + 6;
  48320. ps[3] = pi + 5;
  48321. tmp1 = cs[3];
  48322. cs[2] = cs[1];
  48323. cs[3] = ci;
  48324. cs[0] = tmp1;
  48325. cs[1] = ci + 1;
  48326. break;
  48327. case 3:
  48328. ps[12] = ps[0];
  48329. ps[13] = pi + 0;
  48330. ps[14] = pi + 1;
  48331. ps[15] = pi + 2;
  48332. ps[8] = ps[1];
  48333. ps[11] = pi + 3;
  48334. ps[4] = ps[2];
  48335. ps[7] = pi + 4;
  48336. ps[0] = ps[3];
  48337. ps[1] = pi + 7;
  48338. ps[2] = pi + 6;
  48339. ps[3] = pi + 5;
  48340. cs[2] = cs[0];
  48341. cs[3] = ci;
  48342. cs[0] = cs[1];
  48343. cs[1] = ci + 1;
  48344. break;
  48345. }
  48346. ps[5] = coords.length;
  48347. coords.push([
  48348. (-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,
  48349. (-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
  48350. ]);
  48351. ps[6] = coords.length;
  48352. coords.push([
  48353. (-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,
  48354. (-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
  48355. ]);
  48356. ps[9] = coords.length;
  48357. coords.push([
  48358. (-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,
  48359. (-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
  48360. ]);
  48361. ps[10] = coords.length;
  48362. coords.push([
  48363. (-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,
  48364. (-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
  48365. ]);
  48366. mesh.figures.push({
  48367. type: 'patch',
  48368. coords: new Int32Array(ps),
  48369. colors: new Int32Array(cs)
  48370. });
  48371. }
  48372. }
  48373. function decodeType7Shading(mesh, reader) {
  48374. var coords = mesh.coords;
  48375. var colors = mesh.colors;
  48376. var ps = new Int32Array(16);
  48377. var cs = new Int32Array(4);
  48378. while (reader.hasData) {
  48379. var f = reader.readFlag();
  48380. assert(0 <= f && f <= 3, 'Unknown type7 flag');
  48381. var i, ii;
  48382. var pi = coords.length;
  48383. for (i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  48384. coords.push(reader.readCoordinate());
  48385. }
  48386. var ci = colors.length;
  48387. for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  48388. colors.push(reader.readComponents());
  48389. }
  48390. var tmp1, tmp2, tmp3, tmp4;
  48391. switch (f) {
  48392. case 0:
  48393. ps[12] = pi + 3;
  48394. ps[13] = pi + 4;
  48395. ps[14] = pi + 5;
  48396. ps[15] = pi + 6;
  48397. ps[8] = pi + 2;
  48398. ps[9] = pi + 13;
  48399. ps[10] = pi + 14;
  48400. ps[11] = pi + 7;
  48401. ps[4] = pi + 1;
  48402. ps[5] = pi + 12;
  48403. ps[6] = pi + 15;
  48404. ps[7] = pi + 8;
  48405. ps[0] = pi;
  48406. ps[1] = pi + 11;
  48407. ps[2] = pi + 10;
  48408. ps[3] = pi + 9;
  48409. cs[2] = ci + 1;
  48410. cs[3] = ci + 2;
  48411. cs[0] = ci;
  48412. cs[1] = ci + 3;
  48413. break;
  48414. case 1:
  48415. tmp1 = ps[12];
  48416. tmp2 = ps[13];
  48417. tmp3 = ps[14];
  48418. tmp4 = ps[15];
  48419. ps[12] = tmp4;
  48420. ps[13] = pi + 0;
  48421. ps[14] = pi + 1;
  48422. ps[15] = pi + 2;
  48423. ps[8] = tmp3;
  48424. ps[9] = pi + 9;
  48425. ps[10] = pi + 10;
  48426. ps[11] = pi + 3;
  48427. ps[4] = tmp2;
  48428. ps[5] = pi + 8;
  48429. ps[6] = pi + 11;
  48430. ps[7] = pi + 4;
  48431. ps[0] = tmp1;
  48432. ps[1] = pi + 7;
  48433. ps[2] = pi + 6;
  48434. ps[3] = pi + 5;
  48435. tmp1 = cs[2];
  48436. tmp2 = cs[3];
  48437. cs[2] = tmp2;
  48438. cs[3] = ci;
  48439. cs[0] = tmp1;
  48440. cs[1] = ci + 1;
  48441. break;
  48442. case 2:
  48443. tmp1 = ps[15];
  48444. tmp2 = ps[11];
  48445. ps[12] = ps[3];
  48446. ps[13] = pi + 0;
  48447. ps[14] = pi + 1;
  48448. ps[15] = pi + 2;
  48449. ps[8] = ps[7];
  48450. ps[9] = pi + 9;
  48451. ps[10] = pi + 10;
  48452. ps[11] = pi + 3;
  48453. ps[4] = tmp2;
  48454. ps[5] = pi + 8;
  48455. ps[6] = pi + 11;
  48456. ps[7] = pi + 4;
  48457. ps[0] = tmp1;
  48458. ps[1] = pi + 7;
  48459. ps[2] = pi + 6;
  48460. ps[3] = pi + 5;
  48461. tmp1 = cs[3];
  48462. cs[2] = cs[1];
  48463. cs[3] = ci;
  48464. cs[0] = tmp1;
  48465. cs[1] = ci + 1;
  48466. break;
  48467. case 3:
  48468. ps[12] = ps[0];
  48469. ps[13] = pi + 0;
  48470. ps[14] = pi + 1;
  48471. ps[15] = pi + 2;
  48472. ps[8] = ps[1];
  48473. ps[9] = pi + 9;
  48474. ps[10] = pi + 10;
  48475. ps[11] = pi + 3;
  48476. ps[4] = ps[2];
  48477. ps[5] = pi + 8;
  48478. ps[6] = pi + 11;
  48479. ps[7] = pi + 4;
  48480. ps[0] = ps[3];
  48481. ps[1] = pi + 7;
  48482. ps[2] = pi + 6;
  48483. ps[3] = pi + 5;
  48484. cs[2] = cs[0];
  48485. cs[3] = ci;
  48486. cs[0] = cs[1];
  48487. cs[1] = ci + 1;
  48488. break;
  48489. }
  48490. mesh.figures.push({
  48491. type: 'patch',
  48492. coords: new Int32Array(ps),
  48493. colors: new Int32Array(cs)
  48494. });
  48495. }
  48496. }
  48497. function updateBounds(mesh) {
  48498. var minX = mesh.coords[0][0], minY = mesh.coords[0][1], maxX = minX, maxY = minY;
  48499. for (var i = 1, ii = mesh.coords.length; i < ii; i++) {
  48500. var x = mesh.coords[i][0], y = mesh.coords[i][1];
  48501. minX = minX > x ? x : minX;
  48502. minY = minY > y ? y : minY;
  48503. maxX = maxX < x ? x : maxX;
  48504. maxY = maxY < y ? y : maxY;
  48505. }
  48506. mesh.bounds = [
  48507. minX,
  48508. minY,
  48509. maxX,
  48510. maxY
  48511. ];
  48512. }
  48513. function packData(mesh) {
  48514. var i, ii, j, jj;
  48515. var coords = mesh.coords;
  48516. var coordsPacked = new Float32Array(coords.length * 2);
  48517. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  48518. var xy = coords[i];
  48519. coordsPacked[j++] = xy[0];
  48520. coordsPacked[j++] = xy[1];
  48521. }
  48522. mesh.coords = coordsPacked;
  48523. var colors = mesh.colors;
  48524. var colorsPacked = new Uint8Array(colors.length * 3);
  48525. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  48526. var c = colors[i];
  48527. colorsPacked[j++] = c[0];
  48528. colorsPacked[j++] = c[1];
  48529. colorsPacked[j++] = c[2];
  48530. }
  48531. mesh.colors = colorsPacked;
  48532. var figures = mesh.figures;
  48533. for (i = 0, ii = figures.length; i < ii; i++) {
  48534. var figure = figures[i], ps = figure.coords, cs = figure.colors;
  48535. for (j = 0, jj = ps.length; j < jj; j++) {
  48536. ps[j] *= 2;
  48537. cs[j] *= 3;
  48538. }
  48539. }
  48540. }
  48541. function Mesh(stream, matrix, xref, res) {
  48542. assert(isStream(stream), 'Mesh data is not a stream');
  48543. var dict = stream.dict;
  48544. this.matrix = matrix;
  48545. this.shadingType = dict.get('ShadingType');
  48546. this.type = 'Pattern';
  48547. this.bbox = dict.getArray('BBox');
  48548. var cs = dict.get('ColorSpace', 'CS');
  48549. cs = ColorSpace.parse(cs, xref, res);
  48550. this.cs = cs;
  48551. this.background = dict.has('Background') ? cs.getRgb(dict.get('Background'), 0) : null;
  48552. var fnObj = dict.get('Function');
  48553. var fn = fnObj ? PDFFunction.parseArray(xref, fnObj) : null;
  48554. this.coords = [];
  48555. this.colors = [];
  48556. this.figures = [];
  48557. var decodeContext = {
  48558. bitsPerCoordinate: dict.get('BitsPerCoordinate'),
  48559. bitsPerComponent: dict.get('BitsPerComponent'),
  48560. bitsPerFlag: dict.get('BitsPerFlag'),
  48561. decode: dict.getArray('Decode'),
  48562. colorFn: fn,
  48563. colorSpace: cs,
  48564. numComps: fn ? 1 : cs.numComps
  48565. };
  48566. var reader = new MeshStreamReader(stream, decodeContext);
  48567. var patchMesh = false;
  48568. switch (this.shadingType) {
  48569. case ShadingType.FREE_FORM_MESH:
  48570. decodeType4Shading(this, reader);
  48571. break;
  48572. case ShadingType.LATTICE_FORM_MESH:
  48573. var verticesPerRow = dict.get('VerticesPerRow') | 0;
  48574. assert(verticesPerRow >= 2, 'Invalid VerticesPerRow');
  48575. decodeType5Shading(this, reader, verticesPerRow);
  48576. break;
  48577. case ShadingType.COONS_PATCH_MESH:
  48578. decodeType6Shading(this, reader);
  48579. patchMesh = true;
  48580. break;
  48581. case ShadingType.TENSOR_PATCH_MESH:
  48582. decodeType7Shading(this, reader);
  48583. patchMesh = true;
  48584. break;
  48585. default:
  48586. error('Unsupported mesh type.');
  48587. break;
  48588. }
  48589. if (patchMesh) {
  48590. updateBounds(this);
  48591. for (var i = 0, ii = this.figures.length; i < ii; i++) {
  48592. buildFigureFromPatch(this, i);
  48593. }
  48594. }
  48595. updateBounds(this);
  48596. packData(this);
  48597. }
  48598. Mesh.prototype = {
  48599. getIR: function Mesh_getIR() {
  48600. return [
  48601. 'Mesh',
  48602. this.shadingType,
  48603. this.coords,
  48604. this.colors,
  48605. this.figures,
  48606. this.bounds,
  48607. this.matrix,
  48608. this.bbox,
  48609. this.background
  48610. ];
  48611. }
  48612. };
  48613. return Mesh;
  48614. }();
  48615. Shadings.Dummy = function DummyClosure() {
  48616. function Dummy() {
  48617. this.type = 'Pattern';
  48618. }
  48619. Dummy.prototype = {
  48620. getIR: function Dummy_getIR() {
  48621. return ['Dummy'];
  48622. }
  48623. };
  48624. return Dummy;
  48625. }();
  48626. function getTilingPatternIR(operatorList, dict, args) {
  48627. var matrix = dict.getArray('Matrix');
  48628. var bbox = dict.getArray('BBox');
  48629. var xstep = dict.get('XStep');
  48630. var ystep = dict.get('YStep');
  48631. var paintType = dict.get('PaintType');
  48632. var tilingType = dict.get('TilingType');
  48633. return [
  48634. 'TilingPattern',
  48635. args,
  48636. operatorList,
  48637. matrix,
  48638. bbox,
  48639. xstep,
  48640. ystep,
  48641. paintType,
  48642. tilingType
  48643. ];
  48644. }
  48645. exports.Pattern = Pattern;
  48646. exports.getTilingPatternIR = getTilingPatternIR;
  48647. /***/ }),
  48648. /* 33 */
  48649. /***/ (function(module, exports, __w_pdfjs_require__) {
  48650. "use strict";
  48651. var sharedUtil = __w_pdfjs_require__(0);
  48652. var coreStream = __w_pdfjs_require__(2);
  48653. var coreChunkedStream = __w_pdfjs_require__(12);
  48654. var coreDocument = __w_pdfjs_require__(24);
  48655. var warn = sharedUtil.warn;
  48656. var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
  48657. var shadow = sharedUtil.shadow;
  48658. var NotImplementedException = sharedUtil.NotImplementedException;
  48659. var MissingDataException = sharedUtil.MissingDataException;
  48660. var createPromiseCapability = sharedUtil.createPromiseCapability;
  48661. var Util = sharedUtil.Util;
  48662. var Stream = coreStream.Stream;
  48663. var ChunkedStreamManager = coreChunkedStream.ChunkedStreamManager;
  48664. var PDFDocument = coreDocument.PDFDocument;
  48665. var BasePdfManager = function BasePdfManagerClosure() {
  48666. function BasePdfManager() {
  48667. throw new Error('Cannot initialize BaseManagerManager');
  48668. }
  48669. BasePdfManager.prototype = {
  48670. get docId() {
  48671. return this._docId;
  48672. },
  48673. get password() {
  48674. return this._password;
  48675. },
  48676. get docBaseUrl() {
  48677. var docBaseUrl = null;
  48678. if (this._docBaseUrl) {
  48679. var absoluteUrl = createValidAbsoluteUrl(this._docBaseUrl);
  48680. if (absoluteUrl) {
  48681. docBaseUrl = absoluteUrl.href;
  48682. } else {
  48683. warn('Invalid absolute docBaseUrl: "' + this._docBaseUrl + '".');
  48684. }
  48685. }
  48686. return shadow(this, 'docBaseUrl', docBaseUrl);
  48687. },
  48688. onLoadedStream: function BasePdfManager_onLoadedStream() {
  48689. throw new NotImplementedException();
  48690. },
  48691. ensureDoc: function BasePdfManager_ensureDoc(prop, args) {
  48692. return this.ensure(this.pdfDocument, prop, args);
  48693. },
  48694. ensureXRef: function BasePdfManager_ensureXRef(prop, args) {
  48695. return this.ensure(this.pdfDocument.xref, prop, args);
  48696. },
  48697. ensureCatalog: function BasePdfManager_ensureCatalog(prop, args) {
  48698. return this.ensure(this.pdfDocument.catalog, prop, args);
  48699. },
  48700. getPage: function BasePdfManager_getPage(pageIndex) {
  48701. return this.pdfDocument.getPage(pageIndex);
  48702. },
  48703. cleanup: function BasePdfManager_cleanup() {
  48704. return this.pdfDocument.cleanup();
  48705. },
  48706. ensure: function BasePdfManager_ensure(obj, prop, args) {
  48707. return new NotImplementedException();
  48708. },
  48709. requestRange: function BasePdfManager_requestRange(begin, end) {
  48710. return new NotImplementedException();
  48711. },
  48712. requestLoadedStream: function BasePdfManager_requestLoadedStream() {
  48713. return new NotImplementedException();
  48714. },
  48715. sendProgressiveData: function BasePdfManager_sendProgressiveData(chunk) {
  48716. return new NotImplementedException();
  48717. },
  48718. updatePassword: function BasePdfManager_updatePassword(password) {
  48719. this._password = password;
  48720. },
  48721. terminate: function BasePdfManager_terminate() {
  48722. return new NotImplementedException();
  48723. }
  48724. };
  48725. return BasePdfManager;
  48726. }();
  48727. var LocalPdfManager = function LocalPdfManagerClosure() {
  48728. function LocalPdfManager(docId, data, password, evaluatorOptions, docBaseUrl) {
  48729. this._docId = docId;
  48730. this._password = password;
  48731. this._docBaseUrl = docBaseUrl;
  48732. this.evaluatorOptions = evaluatorOptions;
  48733. var stream = new Stream(data);
  48734. this.pdfDocument = new PDFDocument(this, stream);
  48735. this._loadedStreamCapability = createPromiseCapability();
  48736. this._loadedStreamCapability.resolve(stream);
  48737. }
  48738. Util.inherit(LocalPdfManager, BasePdfManager, {
  48739. ensure: function LocalPdfManager_ensure(obj, prop, args) {
  48740. return new Promise(function (resolve, reject) {
  48741. try {
  48742. var value = obj[prop];
  48743. var result;
  48744. if (typeof value === 'function') {
  48745. result = value.apply(obj, args);
  48746. } else {
  48747. result = value;
  48748. }
  48749. resolve(result);
  48750. } catch (e) {
  48751. reject(e);
  48752. }
  48753. });
  48754. },
  48755. requestRange: function LocalPdfManager_requestRange(begin, end) {
  48756. return Promise.resolve();
  48757. },
  48758. requestLoadedStream: function LocalPdfManager_requestLoadedStream() {
  48759. },
  48760. onLoadedStream: function LocalPdfManager_onLoadedStream() {
  48761. return this._loadedStreamCapability.promise;
  48762. },
  48763. terminate: function LocalPdfManager_terminate() {
  48764. }
  48765. });
  48766. return LocalPdfManager;
  48767. }();
  48768. var NetworkPdfManager = function NetworkPdfManagerClosure() {
  48769. function NetworkPdfManager(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {
  48770. this._docId = docId;
  48771. this._password = args.password;
  48772. this._docBaseUrl = docBaseUrl;
  48773. this.msgHandler = args.msgHandler;
  48774. this.evaluatorOptions = evaluatorOptions;
  48775. var params = {
  48776. msgHandler: args.msgHandler,
  48777. url: args.url,
  48778. length: args.length,
  48779. disableAutoFetch: args.disableAutoFetch,
  48780. rangeChunkSize: args.rangeChunkSize
  48781. };
  48782. this.streamManager = new ChunkedStreamManager(pdfNetworkStream, params);
  48783. this.pdfDocument = new PDFDocument(this, this.streamManager.getStream());
  48784. }
  48785. Util.inherit(NetworkPdfManager, BasePdfManager, {
  48786. ensure: function NetworkPdfManager_ensure(obj, prop, args) {
  48787. var pdfManager = this;
  48788. return new Promise(function (resolve, reject) {
  48789. function ensureHelper() {
  48790. try {
  48791. var result;
  48792. var value = obj[prop];
  48793. if (typeof value === 'function') {
  48794. result = value.apply(obj, args);
  48795. } else {
  48796. result = value;
  48797. }
  48798. resolve(result);
  48799. } catch (e) {
  48800. if (!(e instanceof MissingDataException)) {
  48801. reject(e);
  48802. return;
  48803. }
  48804. pdfManager.streamManager.requestRange(e.begin, e.end).then(ensureHelper, reject);
  48805. }
  48806. }
  48807. ensureHelper();
  48808. });
  48809. },
  48810. requestRange: function NetworkPdfManager_requestRange(begin, end) {
  48811. return this.streamManager.requestRange(begin, end);
  48812. },
  48813. requestLoadedStream: function NetworkPdfManager_requestLoadedStream() {
  48814. this.streamManager.requestAllChunks();
  48815. },
  48816. sendProgressiveData: function NetworkPdfManager_sendProgressiveData(chunk) {
  48817. this.streamManager.onReceiveData({ chunk: chunk });
  48818. },
  48819. onLoadedStream: function NetworkPdfManager_onLoadedStream() {
  48820. return this.streamManager.onLoadedStream();
  48821. },
  48822. terminate: function NetworkPdfManager_terminate() {
  48823. this.streamManager.abort();
  48824. }
  48825. });
  48826. return NetworkPdfManager;
  48827. }();
  48828. exports.LocalPdfManager = LocalPdfManager;
  48829. exports.NetworkPdfManager = NetworkPdfManager;
  48830. /***/ }),
  48831. /* 34 */
  48832. /***/ (function(module, exports, __w_pdfjs_require__) {
  48833. "use strict";
  48834. var sharedUtil = __w_pdfjs_require__(0);
  48835. var corePrimitives = __w_pdfjs_require__(1);
  48836. var error = sharedUtil.error;
  48837. var isSpace = sharedUtil.isSpace;
  48838. var EOF = corePrimitives.EOF;
  48839. var PostScriptParser = function PostScriptParserClosure() {
  48840. function PostScriptParser(lexer) {
  48841. this.lexer = lexer;
  48842. this.operators = [];
  48843. this.token = null;
  48844. this.prev = null;
  48845. }
  48846. PostScriptParser.prototype = {
  48847. nextToken: function PostScriptParser_nextToken() {
  48848. this.prev = this.token;
  48849. this.token = this.lexer.getToken();
  48850. },
  48851. accept: function PostScriptParser_accept(type) {
  48852. if (this.token.type === type) {
  48853. this.nextToken();
  48854. return true;
  48855. }
  48856. return false;
  48857. },
  48858. expect: function PostScriptParser_expect(type) {
  48859. if (this.accept(type)) {
  48860. return true;
  48861. }
  48862. error('Unexpected symbol: found ' + this.token.type + ' expected ' + type + '.');
  48863. },
  48864. parse: function PostScriptParser_parse() {
  48865. this.nextToken();
  48866. this.expect(PostScriptTokenTypes.LBRACE);
  48867. this.parseBlock();
  48868. this.expect(PostScriptTokenTypes.RBRACE);
  48869. return this.operators;
  48870. },
  48871. parseBlock: function PostScriptParser_parseBlock() {
  48872. while (true) {
  48873. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  48874. this.operators.push(this.prev.value);
  48875. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  48876. this.operators.push(this.prev.value);
  48877. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  48878. this.parseCondition();
  48879. } else {
  48880. return;
  48881. }
  48882. }
  48883. },
  48884. parseCondition: function PostScriptParser_parseCondition() {
  48885. var conditionLocation = this.operators.length;
  48886. this.operators.push(null, null);
  48887. this.parseBlock();
  48888. this.expect(PostScriptTokenTypes.RBRACE);
  48889. if (this.accept(PostScriptTokenTypes.IF)) {
  48890. this.operators[conditionLocation] = this.operators.length;
  48891. this.operators[conditionLocation + 1] = 'jz';
  48892. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  48893. var jumpLocation = this.operators.length;
  48894. this.operators.push(null, null);
  48895. var endOfTrue = this.operators.length;
  48896. this.parseBlock();
  48897. this.expect(PostScriptTokenTypes.RBRACE);
  48898. this.expect(PostScriptTokenTypes.IFELSE);
  48899. this.operators[jumpLocation] = this.operators.length;
  48900. this.operators[jumpLocation + 1] = 'j';
  48901. this.operators[conditionLocation] = endOfTrue;
  48902. this.operators[conditionLocation + 1] = 'jz';
  48903. } else {
  48904. error('PS Function: error parsing conditional.');
  48905. }
  48906. }
  48907. };
  48908. return PostScriptParser;
  48909. }();
  48910. var PostScriptTokenTypes = {
  48911. LBRACE: 0,
  48912. RBRACE: 1,
  48913. NUMBER: 2,
  48914. OPERATOR: 3,
  48915. IF: 4,
  48916. IFELSE: 5
  48917. };
  48918. var PostScriptToken = function PostScriptTokenClosure() {
  48919. function PostScriptToken(type, value) {
  48920. this.type = type;
  48921. this.value = value;
  48922. }
  48923. var opCache = Object.create(null);
  48924. PostScriptToken.getOperator = function PostScriptToken_getOperator(op) {
  48925. var opValue = opCache[op];
  48926. if (opValue) {
  48927. return opValue;
  48928. }
  48929. return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  48930. };
  48931. PostScriptToken.LBRACE = new PostScriptToken(PostScriptTokenTypes.LBRACE, '{');
  48932. PostScriptToken.RBRACE = new PostScriptToken(PostScriptTokenTypes.RBRACE, '}');
  48933. PostScriptToken.IF = new PostScriptToken(PostScriptTokenTypes.IF, 'IF');
  48934. PostScriptToken.IFELSE = new PostScriptToken(PostScriptTokenTypes.IFELSE, 'IFELSE');
  48935. return PostScriptToken;
  48936. }();
  48937. var PostScriptLexer = function PostScriptLexerClosure() {
  48938. function PostScriptLexer(stream) {
  48939. this.stream = stream;
  48940. this.nextChar();
  48941. this.strBuf = [];
  48942. }
  48943. PostScriptLexer.prototype = {
  48944. nextChar: function PostScriptLexer_nextChar() {
  48945. return this.currentChar = this.stream.getByte();
  48946. },
  48947. getToken: function PostScriptLexer_getToken() {
  48948. var comment = false;
  48949. var ch = this.currentChar;
  48950. while (true) {
  48951. if (ch < 0) {
  48952. return EOF;
  48953. }
  48954. if (comment) {
  48955. if (ch === 0x0A || ch === 0x0D) {
  48956. comment = false;
  48957. }
  48958. } else if (ch === 0x25) {
  48959. comment = true;
  48960. } else if (!isSpace(ch)) {
  48961. break;
  48962. }
  48963. ch = this.nextChar();
  48964. }
  48965. switch (ch | 0) {
  48966. case 0x30:
  48967. case 0x31:
  48968. case 0x32:
  48969. case 0x33:
  48970. case 0x34:
  48971. case 0x35:
  48972. case 0x36:
  48973. case 0x37:
  48974. case 0x38:
  48975. case 0x39:
  48976. case 0x2B:
  48977. case 0x2D:
  48978. case 0x2E:
  48979. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  48980. case 0x7B:
  48981. this.nextChar();
  48982. return PostScriptToken.LBRACE;
  48983. case 0x7D:
  48984. this.nextChar();
  48985. return PostScriptToken.RBRACE;
  48986. }
  48987. var strBuf = this.strBuf;
  48988. strBuf.length = 0;
  48989. strBuf[0] = String.fromCharCode(ch);
  48990. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5A || ch >= 0x61 && ch <= 0x7A)) {
  48991. strBuf.push(String.fromCharCode(ch));
  48992. }
  48993. var str = strBuf.join('');
  48994. switch (str.toLowerCase()) {
  48995. case 'if':
  48996. return PostScriptToken.IF;
  48997. case 'ifelse':
  48998. return PostScriptToken.IFELSE;
  48999. default:
  49000. return PostScriptToken.getOperator(str);
  49001. }
  49002. },
  49003. getNumber: function PostScriptLexer_getNumber() {
  49004. var ch = this.currentChar;
  49005. var strBuf = this.strBuf;
  49006. strBuf.length = 0;
  49007. strBuf[0] = String.fromCharCode(ch);
  49008. while ((ch = this.nextChar()) >= 0) {
  49009. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2D || ch === 0x2E) {
  49010. strBuf.push(String.fromCharCode(ch));
  49011. } else {
  49012. break;
  49013. }
  49014. }
  49015. var value = parseFloat(strBuf.join(''));
  49016. if (isNaN(value)) {
  49017. error('Invalid floating point number: ' + value);
  49018. }
  49019. return value;
  49020. }
  49021. };
  49022. return PostScriptLexer;
  49023. }();
  49024. exports.PostScriptLexer = PostScriptLexer;
  49025. exports.PostScriptParser = PostScriptParser;
  49026. /***/ }),
  49027. /* 35 */
  49028. /***/ (function(module, exports, __w_pdfjs_require__) {
  49029. "use strict";
  49030. var sharedUtil = __w_pdfjs_require__(0);
  49031. var coreStream = __w_pdfjs_require__(2);
  49032. var coreEncodings = __w_pdfjs_require__(4);
  49033. var warn = sharedUtil.warn;
  49034. var isSpace = sharedUtil.isSpace;
  49035. var Stream = coreStream.Stream;
  49036. var getEncoding = coreEncodings.getEncoding;
  49037. var HINTING_ENABLED = false;
  49038. var Type1CharString = function Type1CharStringClosure() {
  49039. var COMMAND_MAP = {
  49040. 'hstem': [1],
  49041. 'vstem': [3],
  49042. 'vmoveto': [4],
  49043. 'rlineto': [5],
  49044. 'hlineto': [6],
  49045. 'vlineto': [7],
  49046. 'rrcurveto': [8],
  49047. 'callsubr': [10],
  49048. 'flex': [
  49049. 12,
  49050. 35
  49051. ],
  49052. 'drop': [
  49053. 12,
  49054. 18
  49055. ],
  49056. 'endchar': [14],
  49057. 'rmoveto': [21],
  49058. 'hmoveto': [22],
  49059. 'vhcurveto': [30],
  49060. 'hvcurveto': [31]
  49061. };
  49062. function Type1CharString() {
  49063. this.width = 0;
  49064. this.lsb = 0;
  49065. this.flexing = false;
  49066. this.output = [];
  49067. this.stack = [];
  49068. }
  49069. Type1CharString.prototype = {
  49070. convert: function Type1CharString_convert(encoded, subrs, seacAnalysisEnabled) {
  49071. var count = encoded.length;
  49072. var error = false;
  49073. var wx, sbx, subrNumber;
  49074. for (var i = 0; i < count; i++) {
  49075. var value = encoded[i];
  49076. if (value < 32) {
  49077. if (value === 12) {
  49078. value = (value << 8) + encoded[++i];
  49079. }
  49080. switch (value) {
  49081. case 1:
  49082. if (!HINTING_ENABLED) {
  49083. this.stack = [];
  49084. break;
  49085. }
  49086. error = this.executeCommand(2, COMMAND_MAP.hstem);
  49087. break;
  49088. case 3:
  49089. if (!HINTING_ENABLED) {
  49090. this.stack = [];
  49091. break;
  49092. }
  49093. error = this.executeCommand(2, COMMAND_MAP.vstem);
  49094. break;
  49095. case 4:
  49096. if (this.flexing) {
  49097. if (this.stack.length < 1) {
  49098. error = true;
  49099. break;
  49100. }
  49101. var dy = this.stack.pop();
  49102. this.stack.push(0, dy);
  49103. break;
  49104. }
  49105. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  49106. break;
  49107. case 5:
  49108. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  49109. break;
  49110. case 6:
  49111. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  49112. break;
  49113. case 7:
  49114. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  49115. break;
  49116. case 8:
  49117. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  49118. break;
  49119. case 9:
  49120. this.stack = [];
  49121. break;
  49122. case 10:
  49123. if (this.stack.length < 1) {
  49124. error = true;
  49125. break;
  49126. }
  49127. subrNumber = this.stack.pop();
  49128. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  49129. break;
  49130. case 11:
  49131. return error;
  49132. case 13:
  49133. if (this.stack.length < 2) {
  49134. error = true;
  49135. break;
  49136. }
  49137. wx = this.stack.pop();
  49138. sbx = this.stack.pop();
  49139. this.lsb = sbx;
  49140. this.width = wx;
  49141. this.stack.push(wx, sbx);
  49142. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  49143. break;
  49144. case 14:
  49145. this.output.push(COMMAND_MAP.endchar[0]);
  49146. break;
  49147. case 21:
  49148. if (this.flexing) {
  49149. break;
  49150. }
  49151. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  49152. break;
  49153. case 22:
  49154. if (this.flexing) {
  49155. this.stack.push(0);
  49156. break;
  49157. }
  49158. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  49159. break;
  49160. case 30:
  49161. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  49162. break;
  49163. case 31:
  49164. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  49165. break;
  49166. case (12 << 8) + 0:
  49167. this.stack = [];
  49168. break;
  49169. case (12 << 8) + 1:
  49170. if (!HINTING_ENABLED) {
  49171. this.stack = [];
  49172. break;
  49173. }
  49174. error = this.executeCommand(2, COMMAND_MAP.vstem);
  49175. break;
  49176. case (12 << 8) + 2:
  49177. if (!HINTING_ENABLED) {
  49178. this.stack = [];
  49179. break;
  49180. }
  49181. error = this.executeCommand(2, COMMAND_MAP.hstem);
  49182. break;
  49183. case (12 << 8) + 6:
  49184. if (seacAnalysisEnabled) {
  49185. this.seac = this.stack.splice(-4, 4);
  49186. error = this.executeCommand(0, COMMAND_MAP.endchar);
  49187. } else {
  49188. error = this.executeCommand(4, COMMAND_MAP.endchar);
  49189. }
  49190. break;
  49191. case (12 << 8) + 7:
  49192. if (this.stack.length < 4) {
  49193. error = true;
  49194. break;
  49195. }
  49196. this.stack.pop();
  49197. wx = this.stack.pop();
  49198. var sby = this.stack.pop();
  49199. sbx = this.stack.pop();
  49200. this.lsb = sbx;
  49201. this.width = wx;
  49202. this.stack.push(wx, sbx, sby);
  49203. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  49204. break;
  49205. case (12 << 8) + 12:
  49206. if (this.stack.length < 2) {
  49207. error = true;
  49208. break;
  49209. }
  49210. var num2 = this.stack.pop();
  49211. var num1 = this.stack.pop();
  49212. this.stack.push(num1 / num2);
  49213. break;
  49214. case (12 << 8) + 16:
  49215. if (this.stack.length < 2) {
  49216. error = true;
  49217. break;
  49218. }
  49219. subrNumber = this.stack.pop();
  49220. var numArgs = this.stack.pop();
  49221. if (subrNumber === 0 && numArgs === 3) {
  49222. var flexArgs = this.stack.splice(this.stack.length - 17, 17);
  49223. 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]);
  49224. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  49225. this.flexing = false;
  49226. this.stack.push(flexArgs[15], flexArgs[16]);
  49227. } else if (subrNumber === 1 && numArgs === 0) {
  49228. this.flexing = true;
  49229. }
  49230. break;
  49231. case (12 << 8) + 17:
  49232. break;
  49233. case (12 << 8) + 33:
  49234. this.stack = [];
  49235. break;
  49236. default:
  49237. warn('Unknown type 1 charstring command of "' + value + '"');
  49238. break;
  49239. }
  49240. if (error) {
  49241. break;
  49242. }
  49243. continue;
  49244. } else if (value <= 246) {
  49245. value = value - 139;
  49246. } else if (value <= 250) {
  49247. value = (value - 247) * 256 + encoded[++i] + 108;
  49248. } else if (value <= 254) {
  49249. value = -((value - 251) * 256) - encoded[++i] - 108;
  49250. } else {
  49251. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  49252. }
  49253. this.stack.push(value);
  49254. }
  49255. return error;
  49256. },
  49257. executeCommand: function (howManyArgs, command, keepStack) {
  49258. var stackLength = this.stack.length;
  49259. if (howManyArgs > stackLength) {
  49260. return true;
  49261. }
  49262. var start = stackLength - howManyArgs;
  49263. for (var i = start; i < stackLength; i++) {
  49264. var value = this.stack[i];
  49265. if (value === (value | 0)) {
  49266. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  49267. } else {
  49268. value = 65536 * value | 0;
  49269. this.output.push(255, value >> 24 & 0xFF, value >> 16 & 0xFF, value >> 8 & 0xFF, value & 0xFF);
  49270. }
  49271. }
  49272. this.output.push.apply(this.output, command);
  49273. if (keepStack) {
  49274. this.stack.splice(start, howManyArgs);
  49275. } else {
  49276. this.stack.length = 0;
  49277. }
  49278. return false;
  49279. }
  49280. };
  49281. return Type1CharString;
  49282. }();
  49283. var Type1Parser = function Type1ParserClosure() {
  49284. var EEXEC_ENCRYPT_KEY = 55665;
  49285. var CHAR_STRS_ENCRYPT_KEY = 4330;
  49286. function isHexDigit(code) {
  49287. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  49288. }
  49289. function decrypt(data, key, discardNumber) {
  49290. if (discardNumber >= data.length) {
  49291. return new Uint8Array(0);
  49292. }
  49293. var r = key | 0, c1 = 52845, c2 = 22719, i, j;
  49294. for (i = 0; i < discardNumber; i++) {
  49295. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  49296. }
  49297. var count = data.length - discardNumber;
  49298. var decrypted = new Uint8Array(count);
  49299. for (i = discardNumber, j = 0; j < count; i++, j++) {
  49300. var value = data[i];
  49301. decrypted[j] = value ^ r >> 8;
  49302. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  49303. }
  49304. return decrypted;
  49305. }
  49306. function decryptAscii(data, key, discardNumber) {
  49307. var r = key | 0, c1 = 52845, c2 = 22719;
  49308. var count = data.length, maybeLength = count >>> 1;
  49309. var decrypted = new Uint8Array(maybeLength);
  49310. var i, j;
  49311. for (i = 0, j = 0; i < count; i++) {
  49312. var digit1 = data[i];
  49313. if (!isHexDigit(digit1)) {
  49314. continue;
  49315. }
  49316. i++;
  49317. var digit2;
  49318. while (i < count && !isHexDigit(digit2 = data[i])) {
  49319. i++;
  49320. }
  49321. if (i < count) {
  49322. var value = parseInt(String.fromCharCode(digit1, digit2), 16);
  49323. decrypted[j++] = value ^ r >> 8;
  49324. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  49325. }
  49326. }
  49327. return Array.prototype.slice.call(decrypted, discardNumber, j);
  49328. }
  49329. function isSpecial(c) {
  49330. return c === 0x2F || c === 0x5B || c === 0x5D || c === 0x7B || c === 0x7D || c === 0x28 || c === 0x29;
  49331. }
  49332. function Type1Parser(stream, encrypted, seacAnalysisEnabled) {
  49333. if (encrypted) {
  49334. var data = stream.getBytes();
  49335. var isBinary = !(isHexDigit(data[0]) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]));
  49336. stream = new Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  49337. }
  49338. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  49339. this.stream = stream;
  49340. this.nextChar();
  49341. }
  49342. Type1Parser.prototype = {
  49343. readNumberArray: function Type1Parser_readNumberArray() {
  49344. this.getToken();
  49345. var array = [];
  49346. while (true) {
  49347. var token = this.getToken();
  49348. if (token === null || token === ']' || token === '}') {
  49349. break;
  49350. }
  49351. array.push(parseFloat(token || 0));
  49352. }
  49353. return array;
  49354. },
  49355. readNumber: function Type1Parser_readNumber() {
  49356. var token = this.getToken();
  49357. return parseFloat(token || 0);
  49358. },
  49359. readInt: function Type1Parser_readInt() {
  49360. var token = this.getToken();
  49361. return parseInt(token || 0, 10) | 0;
  49362. },
  49363. readBoolean: function Type1Parser_readBoolean() {
  49364. var token = this.getToken();
  49365. return token === 'true' ? 1 : 0;
  49366. },
  49367. nextChar: function Type1_nextChar() {
  49368. return this.currentChar = this.stream.getByte();
  49369. },
  49370. getToken: function Type1Parser_getToken() {
  49371. var comment = false;
  49372. var ch = this.currentChar;
  49373. while (true) {
  49374. if (ch === -1) {
  49375. return null;
  49376. }
  49377. if (comment) {
  49378. if (ch === 0x0A || ch === 0x0D) {
  49379. comment = false;
  49380. }
  49381. } else if (ch === 0x25) {
  49382. comment = true;
  49383. } else if (!isSpace(ch)) {
  49384. break;
  49385. }
  49386. ch = this.nextChar();
  49387. }
  49388. if (isSpecial(ch)) {
  49389. this.nextChar();
  49390. return String.fromCharCode(ch);
  49391. }
  49392. var token = '';
  49393. do {
  49394. token += String.fromCharCode(ch);
  49395. ch = this.nextChar();
  49396. } while (ch >= 0 && !isSpace(ch) && !isSpecial(ch));
  49397. return token;
  49398. },
  49399. extractFontProgram: function Type1Parser_extractFontProgram() {
  49400. var stream = this.stream;
  49401. var subrs = [], charstrings = [];
  49402. var privateData = Object.create(null);
  49403. privateData['lenIV'] = 4;
  49404. var program = {
  49405. subrs: [],
  49406. charstrings: [],
  49407. properties: { 'privateData': privateData }
  49408. };
  49409. var token, length, data, lenIV, encoded;
  49410. while ((token = this.getToken()) !== null) {
  49411. if (token !== '/') {
  49412. continue;
  49413. }
  49414. token = this.getToken();
  49415. switch (token) {
  49416. case 'CharStrings':
  49417. this.getToken();
  49418. this.getToken();
  49419. this.getToken();
  49420. this.getToken();
  49421. while (true) {
  49422. token = this.getToken();
  49423. if (token === null || token === 'end') {
  49424. break;
  49425. }
  49426. if (token !== '/') {
  49427. continue;
  49428. }
  49429. var glyph = this.getToken();
  49430. length = this.readInt();
  49431. this.getToken();
  49432. data = stream.makeSubStream(stream.pos, length);
  49433. lenIV = program.properties.privateData['lenIV'];
  49434. encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV);
  49435. stream.skip(length);
  49436. this.nextChar();
  49437. token = this.getToken();
  49438. if (token === 'noaccess') {
  49439. this.getToken();
  49440. }
  49441. charstrings.push({
  49442. glyph: glyph,
  49443. encoded: encoded
  49444. });
  49445. }
  49446. break;
  49447. case 'Subrs':
  49448. this.readInt();
  49449. this.getToken();
  49450. while ((token = this.getToken()) === 'dup') {
  49451. var index = this.readInt();
  49452. length = this.readInt();
  49453. this.getToken();
  49454. data = stream.makeSubStream(stream.pos, length);
  49455. lenIV = program.properties.privateData['lenIV'];
  49456. encoded = decrypt(data.getBytes(), CHAR_STRS_ENCRYPT_KEY, lenIV);
  49457. stream.skip(length);
  49458. this.nextChar();
  49459. token = this.getToken();
  49460. if (token === 'noaccess') {
  49461. this.getToken();
  49462. }
  49463. subrs[index] = encoded;
  49464. }
  49465. break;
  49466. case 'BlueValues':
  49467. case 'OtherBlues':
  49468. case 'FamilyBlues':
  49469. case 'FamilyOtherBlues':
  49470. var blueArray = this.readNumberArray();
  49471. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  49472. program.properties.privateData[token] = blueArray;
  49473. }
  49474. break;
  49475. case 'StemSnapH':
  49476. case 'StemSnapV':
  49477. program.properties.privateData[token] = this.readNumberArray();
  49478. break;
  49479. case 'StdHW':
  49480. case 'StdVW':
  49481. program.properties.privateData[token] = this.readNumberArray()[0];
  49482. break;
  49483. case 'BlueShift':
  49484. case 'lenIV':
  49485. case 'BlueFuzz':
  49486. case 'BlueScale':
  49487. case 'LanguageGroup':
  49488. case 'ExpansionFactor':
  49489. program.properties.privateData[token] = this.readNumber();
  49490. break;
  49491. case 'ForceBold':
  49492. program.properties.privateData[token] = this.readBoolean();
  49493. break;
  49494. }
  49495. }
  49496. for (var i = 0; i < charstrings.length; i++) {
  49497. glyph = charstrings[i].glyph;
  49498. encoded = charstrings[i].encoded;
  49499. var charString = new Type1CharString();
  49500. var error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  49501. var output = charString.output;
  49502. if (error) {
  49503. output = [14];
  49504. }
  49505. program.charstrings.push({
  49506. glyphName: glyph,
  49507. charstring: output,
  49508. width: charString.width,
  49509. lsb: charString.lsb,
  49510. seac: charString.seac
  49511. });
  49512. }
  49513. return program;
  49514. },
  49515. extractFontHeader: function Type1Parser_extractFontHeader(properties) {
  49516. var token;
  49517. while ((token = this.getToken()) !== null) {
  49518. if (token !== '/') {
  49519. continue;
  49520. }
  49521. token = this.getToken();
  49522. switch (token) {
  49523. case 'FontMatrix':
  49524. var matrix = this.readNumberArray();
  49525. properties.fontMatrix = matrix;
  49526. break;
  49527. case 'Encoding':
  49528. var encodingArg = this.getToken();
  49529. var encoding;
  49530. if (!/^\d+$/.test(encodingArg)) {
  49531. encoding = getEncoding(encodingArg);
  49532. } else {
  49533. encoding = [];
  49534. var size = parseInt(encodingArg, 10) | 0;
  49535. this.getToken();
  49536. for (var j = 0; j < size; j++) {
  49537. token = this.getToken();
  49538. while (token !== 'dup' && token !== 'def') {
  49539. token = this.getToken();
  49540. if (token === null) {
  49541. return;
  49542. }
  49543. }
  49544. if (token === 'def') {
  49545. break;
  49546. }
  49547. var index = this.readInt();
  49548. this.getToken();
  49549. var glyph = this.getToken();
  49550. encoding[index] = glyph;
  49551. this.getToken();
  49552. }
  49553. }
  49554. properties.builtInEncoding = encoding;
  49555. break;
  49556. case 'FontBBox':
  49557. var fontBBox = this.readNumberArray();
  49558. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  49559. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  49560. properties.ascentScaled = true;
  49561. break;
  49562. }
  49563. }
  49564. }
  49565. };
  49566. return Type1Parser;
  49567. }();
  49568. exports.Type1Parser = Type1Parser;
  49569. /***/ }),
  49570. /* 36 */
  49571. /***/ (function(module, exports, __w_pdfjs_require__) {
  49572. "use strict";
  49573. var pdfjsVersion = '1.7.381';
  49574. var pdfjsBuild = '68f2bf3b';
  49575. var pdfjsCoreWorker = __w_pdfjs_require__(8);
  49576. {
  49577. __w_pdfjs_require__(19);
  49578. }
  49579. exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
  49580. /***/ }),
  49581. /* 37 */
  49582. /***/ (function(module, exports, __w_pdfjs_require__) {
  49583. "use strict";
  49584. /* WEBPACK VAR INJECTION */(function(global) {
  49585. if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) {
  49586. var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this;
  49587. var userAgent = typeof navigator !== 'undefined' && navigator.userAgent || '';
  49588. var isAndroid = /Android/.test(userAgent);
  49589. var isAndroidPre3 = /Android\s[0-2][^\d]/.test(userAgent);
  49590. var isAndroidPre5 = /Android\s[0-4][^\d]/.test(userAgent);
  49591. var isChrome = userAgent.indexOf('Chrom') >= 0;
  49592. var isChromeWithRangeBug = /Chrome\/(39|40)\./.test(userAgent);
  49593. var isIOSChrome = userAgent.indexOf('CriOS') >= 0;
  49594. var isIE = userAgent.indexOf('Trident') >= 0;
  49595. var isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent);
  49596. var isOpera = userAgent.indexOf('Opera') >= 0;
  49597. var isSafari = /Safari\//.test(userAgent) && !/(Chrome\/|Android\s)/.test(userAgent);
  49598. var hasDOM = typeof window === 'object' && typeof document === 'object';
  49599. if (typeof PDFJS === 'undefined') {
  49600. globalScope.PDFJS = {};
  49601. }
  49602. PDFJS.compatibilityChecked = true;
  49603. (function checkTypedArrayCompatibility() {
  49604. if (typeof Uint8Array !== 'undefined') {
  49605. if (typeof Uint8Array.prototype.subarray === 'undefined') {
  49606. Uint8Array.prototype.subarray = function subarray(start, end) {
  49607. return new Uint8Array(this.slice(start, end));
  49608. };
  49609. Float32Array.prototype.subarray = function subarray(start, end) {
  49610. return new Float32Array(this.slice(start, end));
  49611. };
  49612. }
  49613. if (typeof Float64Array === 'undefined') {
  49614. globalScope.Float64Array = Float32Array;
  49615. }
  49616. return;
  49617. }
  49618. function subarray(start, end) {
  49619. return new TypedArray(this.slice(start, end));
  49620. }
  49621. function setArrayOffset(array, offset) {
  49622. if (arguments.length < 2) {
  49623. offset = 0;
  49624. }
  49625. for (var i = 0, n = array.length; i < n; ++i, ++offset) {
  49626. this[offset] = array[i] & 0xFF;
  49627. }
  49628. }
  49629. function TypedArray(arg1) {
  49630. var result, i, n;
  49631. if (typeof arg1 === 'number') {
  49632. result = [];
  49633. for (i = 0; i < arg1; ++i) {
  49634. result[i] = 0;
  49635. }
  49636. } else if ('slice' in arg1) {
  49637. result = arg1.slice(0);
  49638. } else {
  49639. result = [];
  49640. for (i = 0, n = arg1.length; i < n; ++i) {
  49641. result[i] = arg1[i];
  49642. }
  49643. }
  49644. result.subarray = subarray;
  49645. result.buffer = result;
  49646. result.byteLength = result.length;
  49647. result.set = setArrayOffset;
  49648. if (typeof arg1 === 'object' && arg1.buffer) {
  49649. result.buffer = arg1.buffer;
  49650. }
  49651. return result;
  49652. }
  49653. globalScope.Uint8Array = TypedArray;
  49654. globalScope.Int8Array = TypedArray;
  49655. globalScope.Uint32Array = TypedArray;
  49656. globalScope.Int32Array = TypedArray;
  49657. globalScope.Uint16Array = TypedArray;
  49658. globalScope.Float32Array = TypedArray;
  49659. globalScope.Float64Array = TypedArray;
  49660. }());
  49661. (function normalizeURLObject() {
  49662. if (!globalScope.URL) {
  49663. globalScope.URL = globalScope.webkitURL;
  49664. }
  49665. }());
  49666. (function checkObjectDefinePropertyCompatibility() {
  49667. if (typeof Object.defineProperty !== 'undefined') {
  49668. var definePropertyPossible = true;
  49669. try {
  49670. if (hasDOM) {
  49671. Object.defineProperty(new Image(), 'id', { value: 'test' });
  49672. }
  49673. var Test = function Test() {
  49674. };
  49675. Test.prototype = {
  49676. get id() {
  49677. }
  49678. };
  49679. Object.defineProperty(new Test(), 'id', {
  49680. value: '',
  49681. configurable: true,
  49682. enumerable: true,
  49683. writable: false
  49684. });
  49685. } catch (e) {
  49686. definePropertyPossible = false;
  49687. }
  49688. if (definePropertyPossible) {
  49689. return;
  49690. }
  49691. }
  49692. Object.defineProperty = function objectDefineProperty(obj, name, def) {
  49693. delete obj[name];
  49694. if ('get' in def) {
  49695. obj.__defineGetter__(name, def['get']);
  49696. }
  49697. if ('set' in def) {
  49698. obj.__defineSetter__(name, def['set']);
  49699. }
  49700. if ('value' in def) {
  49701. obj.__defineSetter__(name, function objectDefinePropertySetter(value) {
  49702. this.__defineGetter__(name, function objectDefinePropertyGetter() {
  49703. return value;
  49704. });
  49705. return value;
  49706. });
  49707. obj[name] = def.value;
  49708. }
  49709. };
  49710. }());
  49711. (function checkXMLHttpRequestResponseCompatibility() {
  49712. if (typeof XMLHttpRequest === 'undefined') {
  49713. return;
  49714. }
  49715. var xhrPrototype = XMLHttpRequest.prototype;
  49716. var xhr = new XMLHttpRequest();
  49717. if (!('overrideMimeType' in xhr)) {
  49718. Object.defineProperty(xhrPrototype, 'overrideMimeType', {
  49719. value: function xmlHttpRequestOverrideMimeType(mimeType) {
  49720. }
  49721. });
  49722. }
  49723. if ('responseType' in xhr) {
  49724. return;
  49725. }
  49726. Object.defineProperty(xhrPrototype, 'responseType', {
  49727. get: function xmlHttpRequestGetResponseType() {
  49728. return this._responseType || 'text';
  49729. },
  49730. set: function xmlHttpRequestSetResponseType(value) {
  49731. if (value === 'text' || value === 'arraybuffer') {
  49732. this._responseType = value;
  49733. if (value === 'arraybuffer' && typeof this.overrideMimeType === 'function') {
  49734. this.overrideMimeType('text/plain; charset=x-user-defined');
  49735. }
  49736. }
  49737. }
  49738. });
  49739. if (typeof VBArray !== 'undefined') {
  49740. Object.defineProperty(xhrPrototype, 'response', {
  49741. get: function xmlHttpRequestResponseGet() {
  49742. if (this.responseType === 'arraybuffer') {
  49743. return new Uint8Array(new VBArray(this.responseBody).toArray());
  49744. }
  49745. return this.responseText;
  49746. }
  49747. });
  49748. return;
  49749. }
  49750. Object.defineProperty(xhrPrototype, 'response', {
  49751. get: function xmlHttpRequestResponseGet() {
  49752. if (this.responseType !== 'arraybuffer') {
  49753. return this.responseText;
  49754. }
  49755. var text = this.responseText;
  49756. var i, n = text.length;
  49757. var result = new Uint8Array(n);
  49758. for (i = 0; i < n; ++i) {
  49759. result[i] = text.charCodeAt(i) & 0xFF;
  49760. }
  49761. return result.buffer;
  49762. }
  49763. });
  49764. }());
  49765. (function checkWindowBtoaCompatibility() {
  49766. if ('btoa' in globalScope) {
  49767. return;
  49768. }
  49769. var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  49770. globalScope.btoa = function (chars) {
  49771. var buffer = '';
  49772. var i, n;
  49773. for (i = 0, n = chars.length; i < n; i += 3) {
  49774. var b1 = chars.charCodeAt(i) & 0xFF;
  49775. var b2 = chars.charCodeAt(i + 1) & 0xFF;
  49776. var b3 = chars.charCodeAt(i + 2) & 0xFF;
  49777. var d1 = b1 >> 2, d2 = (b1 & 3) << 4 | b2 >> 4;
  49778. var d3 = i + 1 < n ? (b2 & 0xF) << 2 | b3 >> 6 : 64;
  49779. var d4 = i + 2 < n ? b3 & 0x3F : 64;
  49780. buffer += digits.charAt(d1) + digits.charAt(d2) + digits.charAt(d3) + digits.charAt(d4);
  49781. }
  49782. return buffer;
  49783. };
  49784. }());
  49785. (function checkWindowAtobCompatibility() {
  49786. if ('atob' in globalScope) {
  49787. return;
  49788. }
  49789. var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  49790. globalScope.atob = function (input) {
  49791. input = input.replace(/=+$/, '');
  49792. if (input.length % 4 === 1) {
  49793. throw new Error('bad atob input');
  49794. }
  49795. 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) {
  49796. buffer = digits.indexOf(buffer);
  49797. }
  49798. return output;
  49799. };
  49800. }());
  49801. (function checkFunctionPrototypeBindCompatibility() {
  49802. if (typeof Function.prototype.bind !== 'undefined') {
  49803. return;
  49804. }
  49805. Function.prototype.bind = function functionPrototypeBind(obj) {
  49806. var fn = this, headArgs = Array.prototype.slice.call(arguments, 1);
  49807. var bound = function functionPrototypeBindBound() {
  49808. var args = headArgs.concat(Array.prototype.slice.call(arguments));
  49809. return fn.apply(obj, args);
  49810. };
  49811. return bound;
  49812. };
  49813. }());
  49814. (function checkDatasetProperty() {
  49815. if (!hasDOM) {
  49816. return;
  49817. }
  49818. var div = document.createElement('div');
  49819. if ('dataset' in div) {
  49820. return;
  49821. }
  49822. Object.defineProperty(HTMLElement.prototype, 'dataset', {
  49823. get: function () {
  49824. if (this._dataset) {
  49825. return this._dataset;
  49826. }
  49827. var dataset = {};
  49828. for (var j = 0, jj = this.attributes.length; j < jj; j++) {
  49829. var attribute = this.attributes[j];
  49830. if (attribute.name.substring(0, 5) !== 'data-') {
  49831. continue;
  49832. }
  49833. var key = attribute.name.substring(5).replace(/\-([a-z])/g, function (all, ch) {
  49834. return ch.toUpperCase();
  49835. });
  49836. dataset[key] = attribute.value;
  49837. }
  49838. Object.defineProperty(this, '_dataset', {
  49839. value: dataset,
  49840. writable: false,
  49841. enumerable: false
  49842. });
  49843. return dataset;
  49844. },
  49845. enumerable: true
  49846. });
  49847. }());
  49848. (function checkClassListProperty() {
  49849. function changeList(element, itemName, add, remove) {
  49850. var s = element.className || '';
  49851. var list = s.split(/\s+/g);
  49852. if (list[0] === '') {
  49853. list.shift();
  49854. }
  49855. var index = list.indexOf(itemName);
  49856. if (index < 0 && add) {
  49857. list.push(itemName);
  49858. }
  49859. if (index >= 0 && remove) {
  49860. list.splice(index, 1);
  49861. }
  49862. element.className = list.join(' ');
  49863. return index >= 0;
  49864. }
  49865. if (!hasDOM) {
  49866. return;
  49867. }
  49868. var div = document.createElement('div');
  49869. if ('classList' in div) {
  49870. return;
  49871. }
  49872. var classListPrototype = {
  49873. add: function (name) {
  49874. changeList(this.element, name, true, false);
  49875. },
  49876. contains: function (name) {
  49877. return changeList(this.element, name, false, false);
  49878. },
  49879. remove: function (name) {
  49880. changeList(this.element, name, false, true);
  49881. },
  49882. toggle: function (name) {
  49883. changeList(this.element, name, true, true);
  49884. }
  49885. };
  49886. Object.defineProperty(HTMLElement.prototype, 'classList', {
  49887. get: function () {
  49888. if (this._classList) {
  49889. return this._classList;
  49890. }
  49891. var classList = Object.create(classListPrototype, {
  49892. element: {
  49893. value: this,
  49894. writable: false,
  49895. enumerable: true
  49896. }
  49897. });
  49898. Object.defineProperty(this, '_classList', {
  49899. value: classList,
  49900. writable: false,
  49901. enumerable: false
  49902. });
  49903. return classList;
  49904. },
  49905. enumerable: true
  49906. });
  49907. }());
  49908. (function checkWorkerConsoleCompatibility() {
  49909. if (typeof importScripts === 'undefined' || 'console' in globalScope) {
  49910. return;
  49911. }
  49912. var consoleTimer = {};
  49913. var workerConsole = {
  49914. log: function log() {
  49915. var args = Array.prototype.slice.call(arguments);
  49916. globalScope.postMessage({
  49917. targetName: 'main',
  49918. action: 'console_log',
  49919. data: args
  49920. });
  49921. },
  49922. error: function error() {
  49923. var args = Array.prototype.slice.call(arguments);
  49924. globalScope.postMessage({
  49925. targetName: 'main',
  49926. action: 'console_error',
  49927. data: args
  49928. });
  49929. },
  49930. time: function time(name) {
  49931. consoleTimer[name] = Date.now();
  49932. },
  49933. timeEnd: function timeEnd(name) {
  49934. var time = consoleTimer[name];
  49935. if (!time) {
  49936. throw new Error('Unknown timer name ' + name);
  49937. }
  49938. this.log('Timer:', name, Date.now() - time);
  49939. }
  49940. };
  49941. globalScope.console = workerConsole;
  49942. }());
  49943. (function checkConsoleCompatibility() {
  49944. if (!hasDOM) {
  49945. return;
  49946. }
  49947. if (!('console' in window)) {
  49948. window.console = {
  49949. log: function () {
  49950. },
  49951. error: function () {
  49952. },
  49953. warn: function () {
  49954. }
  49955. };
  49956. return;
  49957. }
  49958. if (!('bind' in console.log)) {
  49959. console.log = function (fn) {
  49960. return function (msg) {
  49961. return fn(msg);
  49962. };
  49963. }(console.log);
  49964. console.error = function (fn) {
  49965. return function (msg) {
  49966. return fn(msg);
  49967. };
  49968. }(console.error);
  49969. console.warn = function (fn) {
  49970. return function (msg) {
  49971. return fn(msg);
  49972. };
  49973. }(console.warn);
  49974. return;
  49975. }
  49976. }());
  49977. (function checkOnClickCompatibility() {
  49978. function ignoreIfTargetDisabled(event) {
  49979. if (isDisabled(event.target)) {
  49980. event.stopPropagation();
  49981. }
  49982. }
  49983. function isDisabled(node) {
  49984. return node.disabled || node.parentNode && isDisabled(node.parentNode);
  49985. }
  49986. if (isOpera) {
  49987. document.addEventListener('click', ignoreIfTargetDisabled, true);
  49988. }
  49989. }());
  49990. (function checkOnBlobSupport() {
  49991. if (isIE || isIOSChrome) {
  49992. PDFJS.disableCreateObjectURL = true;
  49993. }
  49994. }());
  49995. (function checkNavigatorLanguage() {
  49996. if (typeof navigator === 'undefined') {
  49997. return;
  49998. }
  49999. if ('language' in navigator) {
  50000. return;
  50001. }
  50002. PDFJS.locale = navigator.userLanguage || 'en-US';
  50003. }());
  50004. (function checkRangeRequests() {
  50005. if (isSafari || isAndroidPre3 || isChromeWithRangeBug || isIOS) {
  50006. PDFJS.disableRange = true;
  50007. PDFJS.disableStream = true;
  50008. }
  50009. }());
  50010. (function checkHistoryManipulation() {
  50011. if (!hasDOM) {
  50012. return;
  50013. }
  50014. if (!history.pushState || isAndroidPre3) {
  50015. PDFJS.disableHistory = true;
  50016. }
  50017. }());
  50018. (function checkSetPresenceInImageData() {
  50019. if (!hasDOM) {
  50020. return;
  50021. }
  50022. if (window.CanvasPixelArray) {
  50023. if (typeof window.CanvasPixelArray.prototype.set !== 'function') {
  50024. window.CanvasPixelArray.prototype.set = function (arr) {
  50025. for (var i = 0, ii = this.length; i < ii; i++) {
  50026. this[i] = arr[i];
  50027. }
  50028. };
  50029. }
  50030. } else {
  50031. var polyfill = false, versionMatch;
  50032. if (isChrome) {
  50033. versionMatch = userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
  50034. polyfill = versionMatch && parseInt(versionMatch[2]) < 21;
  50035. } else if (isAndroid) {
  50036. polyfill = isAndroidPre5;
  50037. } else if (isSafari) {
  50038. versionMatch = userAgent.match(/Version\/([0-9]+)\.([0-9]+)\.([0-9]+) Safari\//);
  50039. polyfill = versionMatch && parseInt(versionMatch[1]) < 6;
  50040. }
  50041. if (polyfill) {
  50042. var contextPrototype = window.CanvasRenderingContext2D.prototype;
  50043. var createImageData = contextPrototype.createImageData;
  50044. contextPrototype.createImageData = function (w, h) {
  50045. var imageData = createImageData.call(this, w, h);
  50046. imageData.data.set = function (arr) {
  50047. for (var i = 0, ii = this.length; i < ii; i++) {
  50048. this[i] = arr[i];
  50049. }
  50050. };
  50051. return imageData;
  50052. };
  50053. contextPrototype = null;
  50054. }
  50055. }
  50056. }());
  50057. (function checkRequestAnimationFrame() {
  50058. function fakeRequestAnimationFrame(callback) {
  50059. window.setTimeout(callback, 20);
  50060. }
  50061. if (!hasDOM) {
  50062. return;
  50063. }
  50064. if (isIOS) {
  50065. window.requestAnimationFrame = fakeRequestAnimationFrame;
  50066. return;
  50067. }
  50068. if ('requestAnimationFrame' in window) {
  50069. return;
  50070. }
  50071. window.requestAnimationFrame = window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || fakeRequestAnimationFrame;
  50072. }());
  50073. (function checkCanvasSizeLimitation() {
  50074. if (isIOS || isAndroid) {
  50075. PDFJS.maxCanvasPixels = 5242880;
  50076. }
  50077. }());
  50078. (function checkFullscreenSupport() {
  50079. if (!hasDOM) {
  50080. return;
  50081. }
  50082. if (isIE && window.parent !== window) {
  50083. PDFJS.disableFullscreen = true;
  50084. }
  50085. }());
  50086. (function checkCurrentScript() {
  50087. if (!hasDOM) {
  50088. return;
  50089. }
  50090. if ('currentScript' in document) {
  50091. return;
  50092. }
  50093. Object.defineProperty(document, 'currentScript', {
  50094. get: function () {
  50095. var scripts = document.getElementsByTagName('script');
  50096. return scripts[scripts.length - 1];
  50097. },
  50098. enumerable: true,
  50099. configurable: true
  50100. });
  50101. }());
  50102. (function checkInputTypeNumberAssign() {
  50103. if (!hasDOM) {
  50104. return;
  50105. }
  50106. var el = document.createElement('input');
  50107. try {
  50108. el.type = 'number';
  50109. } catch (ex) {
  50110. var inputProto = el.constructor.prototype;
  50111. var typeProperty = Object.getOwnPropertyDescriptor(inputProto, 'type');
  50112. Object.defineProperty(inputProto, 'type', {
  50113. get: function () {
  50114. return typeProperty.get.call(this);
  50115. },
  50116. set: function (value) {
  50117. typeProperty.set.call(this, value === 'number' ? 'text' : value);
  50118. },
  50119. enumerable: true,
  50120. configurable: true
  50121. });
  50122. }
  50123. }());
  50124. (function checkDocumentReadyState() {
  50125. if (!hasDOM) {
  50126. return;
  50127. }
  50128. if (!document.attachEvent) {
  50129. return;
  50130. }
  50131. var documentProto = document.constructor.prototype;
  50132. var readyStateProto = Object.getOwnPropertyDescriptor(documentProto, 'readyState');
  50133. Object.defineProperty(documentProto, 'readyState', {
  50134. get: function () {
  50135. var value = readyStateProto.get.call(this);
  50136. return value === 'interactive' ? 'loading' : value;
  50137. },
  50138. set: function (value) {
  50139. readyStateProto.set.call(this, value);
  50140. },
  50141. enumerable: true,
  50142. configurable: true
  50143. });
  50144. }());
  50145. (function checkChildNodeRemove() {
  50146. if (!hasDOM) {
  50147. return;
  50148. }
  50149. if (typeof Element.prototype.remove !== 'undefined') {
  50150. return;
  50151. }
  50152. Element.prototype.remove = function () {
  50153. if (this.parentNode) {
  50154. this.parentNode.removeChild(this);
  50155. }
  50156. };
  50157. }());
  50158. (function checkPromise() {
  50159. if (globalScope.Promise) {
  50160. if (typeof globalScope.Promise.all !== 'function') {
  50161. globalScope.Promise.all = function (iterable) {
  50162. var count = 0, results = [], resolve, reject;
  50163. var promise = new globalScope.Promise(function (resolve_, reject_) {
  50164. resolve = resolve_;
  50165. reject = reject_;
  50166. });
  50167. iterable.forEach(function (p, i) {
  50168. count++;
  50169. p.then(function (result) {
  50170. results[i] = result;
  50171. count--;
  50172. if (count === 0) {
  50173. resolve(results);
  50174. }
  50175. }, reject);
  50176. });
  50177. if (count === 0) {
  50178. resolve(results);
  50179. }
  50180. return promise;
  50181. };
  50182. }
  50183. if (typeof globalScope.Promise.resolve !== 'function') {
  50184. globalScope.Promise.resolve = function (value) {
  50185. return new globalScope.Promise(function (resolve) {
  50186. resolve(value);
  50187. });
  50188. };
  50189. }
  50190. if (typeof globalScope.Promise.reject !== 'function') {
  50191. globalScope.Promise.reject = function (reason) {
  50192. return new globalScope.Promise(function (resolve, reject) {
  50193. reject(reason);
  50194. });
  50195. };
  50196. }
  50197. if (typeof globalScope.Promise.prototype.catch !== 'function') {
  50198. globalScope.Promise.prototype.catch = function (onReject) {
  50199. return globalScope.Promise.prototype.then(undefined, onReject);
  50200. };
  50201. }
  50202. return;
  50203. }
  50204. var STATUS_PENDING = 0;
  50205. var STATUS_RESOLVED = 1;
  50206. var STATUS_REJECTED = 2;
  50207. var REJECTION_TIMEOUT = 500;
  50208. var HandlerManager = {
  50209. handlers: [],
  50210. running: false,
  50211. unhandledRejections: [],
  50212. pendingRejectionCheck: false,
  50213. scheduleHandlers: function scheduleHandlers(promise) {
  50214. if (promise._status === STATUS_PENDING) {
  50215. return;
  50216. }
  50217. this.handlers = this.handlers.concat(promise._handlers);
  50218. promise._handlers = [];
  50219. if (this.running) {
  50220. return;
  50221. }
  50222. this.running = true;
  50223. setTimeout(this.runHandlers.bind(this), 0);
  50224. },
  50225. runHandlers: function runHandlers() {
  50226. var RUN_TIMEOUT = 1;
  50227. var timeoutAt = Date.now() + RUN_TIMEOUT;
  50228. while (this.handlers.length > 0) {
  50229. var handler = this.handlers.shift();
  50230. var nextStatus = handler.thisPromise._status;
  50231. var nextValue = handler.thisPromise._value;
  50232. try {
  50233. if (nextStatus === STATUS_RESOLVED) {
  50234. if (typeof handler.onResolve === 'function') {
  50235. nextValue = handler.onResolve(nextValue);
  50236. }
  50237. } else if (typeof handler.onReject === 'function') {
  50238. nextValue = handler.onReject(nextValue);
  50239. nextStatus = STATUS_RESOLVED;
  50240. if (handler.thisPromise._unhandledRejection) {
  50241. this.removeUnhandeledRejection(handler.thisPromise);
  50242. }
  50243. }
  50244. } catch (ex) {
  50245. nextStatus = STATUS_REJECTED;
  50246. nextValue = ex;
  50247. }
  50248. handler.nextPromise._updateStatus(nextStatus, nextValue);
  50249. if (Date.now() >= timeoutAt) {
  50250. break;
  50251. }
  50252. }
  50253. if (this.handlers.length > 0) {
  50254. setTimeout(this.runHandlers.bind(this), 0);
  50255. return;
  50256. }
  50257. this.running = false;
  50258. },
  50259. addUnhandledRejection: function addUnhandledRejection(promise) {
  50260. this.unhandledRejections.push({
  50261. promise: promise,
  50262. time: Date.now()
  50263. });
  50264. this.scheduleRejectionCheck();
  50265. },
  50266. removeUnhandeledRejection: function removeUnhandeledRejection(promise) {
  50267. promise._unhandledRejection = false;
  50268. for (var i = 0; i < this.unhandledRejections.length; i++) {
  50269. if (this.unhandledRejections[i].promise === promise) {
  50270. this.unhandledRejections.splice(i);
  50271. i--;
  50272. }
  50273. }
  50274. },
  50275. scheduleRejectionCheck: function scheduleRejectionCheck() {
  50276. if (this.pendingRejectionCheck) {
  50277. return;
  50278. }
  50279. this.pendingRejectionCheck = true;
  50280. setTimeout(function rejectionCheck() {
  50281. this.pendingRejectionCheck = false;
  50282. var now = Date.now();
  50283. for (var i = 0; i < this.unhandledRejections.length; i++) {
  50284. if (now - this.unhandledRejections[i].time > REJECTION_TIMEOUT) {
  50285. var unhandled = this.unhandledRejections[i].promise._value;
  50286. var msg = 'Unhandled rejection: ' + unhandled;
  50287. if (unhandled.stack) {
  50288. msg += '\n' + unhandled.stack;
  50289. }
  50290. try {
  50291. throw new Error(msg);
  50292. } catch (_) {
  50293. console.warn(msg);
  50294. }
  50295. this.unhandledRejections.splice(i);
  50296. i--;
  50297. }
  50298. }
  50299. if (this.unhandledRejections.length) {
  50300. this.scheduleRejectionCheck();
  50301. }
  50302. }.bind(this), REJECTION_TIMEOUT);
  50303. }
  50304. };
  50305. var Promise = function Promise(resolver) {
  50306. this._status = STATUS_PENDING;
  50307. this._handlers = [];
  50308. try {
  50309. resolver.call(this, this._resolve.bind(this), this._reject.bind(this));
  50310. } catch (e) {
  50311. this._reject(e);
  50312. }
  50313. };
  50314. Promise.all = function Promise_all(promises) {
  50315. var resolveAll, rejectAll;
  50316. var deferred = new Promise(function (resolve, reject) {
  50317. resolveAll = resolve;
  50318. rejectAll = reject;
  50319. });
  50320. var unresolved = promises.length;
  50321. var results = [];
  50322. if (unresolved === 0) {
  50323. resolveAll(results);
  50324. return deferred;
  50325. }
  50326. function reject(reason) {
  50327. if (deferred._status === STATUS_REJECTED) {
  50328. return;
  50329. }
  50330. results = [];
  50331. rejectAll(reason);
  50332. }
  50333. for (var i = 0, ii = promises.length; i < ii; ++i) {
  50334. var promise = promises[i];
  50335. var resolve = function (i) {
  50336. return function (value) {
  50337. if (deferred._status === STATUS_REJECTED) {
  50338. return;
  50339. }
  50340. results[i] = value;
  50341. unresolved--;
  50342. if (unresolved === 0) {
  50343. resolveAll(results);
  50344. }
  50345. };
  50346. }(i);
  50347. if (Promise.isPromise(promise)) {
  50348. promise.then(resolve, reject);
  50349. } else {
  50350. resolve(promise);
  50351. }
  50352. }
  50353. return deferred;
  50354. };
  50355. Promise.isPromise = function Promise_isPromise(value) {
  50356. return value && typeof value.then === 'function';
  50357. };
  50358. Promise.resolve = function Promise_resolve(value) {
  50359. return new Promise(function (resolve) {
  50360. resolve(value);
  50361. });
  50362. };
  50363. Promise.reject = function Promise_reject(reason) {
  50364. return new Promise(function (resolve, reject) {
  50365. reject(reason);
  50366. });
  50367. };
  50368. Promise.prototype = {
  50369. _status: null,
  50370. _value: null,
  50371. _handlers: null,
  50372. _unhandledRejection: null,
  50373. _updateStatus: function Promise__updateStatus(status, value) {
  50374. if (this._status === STATUS_RESOLVED || this._status === STATUS_REJECTED) {
  50375. return;
  50376. }
  50377. if (status === STATUS_RESOLVED && Promise.isPromise(value)) {
  50378. value.then(this._updateStatus.bind(this, STATUS_RESOLVED), this._updateStatus.bind(this, STATUS_REJECTED));
  50379. return;
  50380. }
  50381. this._status = status;
  50382. this._value = value;
  50383. if (status === STATUS_REJECTED && this._handlers.length === 0) {
  50384. this._unhandledRejection = true;
  50385. HandlerManager.addUnhandledRejection(this);
  50386. }
  50387. HandlerManager.scheduleHandlers(this);
  50388. },
  50389. _resolve: function Promise_resolve(value) {
  50390. this._updateStatus(STATUS_RESOLVED, value);
  50391. },
  50392. _reject: function Promise_reject(reason) {
  50393. this._updateStatus(STATUS_REJECTED, reason);
  50394. },
  50395. then: function Promise_then(onResolve, onReject) {
  50396. var nextPromise = new Promise(function (resolve, reject) {
  50397. this.resolve = resolve;
  50398. this.reject = reject;
  50399. });
  50400. this._handlers.push({
  50401. thisPromise: this,
  50402. onResolve: onResolve,
  50403. onReject: onReject,
  50404. nextPromise: nextPromise
  50405. });
  50406. HandlerManager.scheduleHandlers(this);
  50407. return nextPromise;
  50408. },
  50409. catch: function Promise_catch(onReject) {
  50410. return this.then(undefined, onReject);
  50411. }
  50412. };
  50413. globalScope.Promise = Promise;
  50414. }());
  50415. (function checkWeakMap() {
  50416. if (globalScope.WeakMap) {
  50417. return;
  50418. }
  50419. var id = 0;
  50420. function WeakMap() {
  50421. this.id = '$weakmap' + id++;
  50422. }
  50423. WeakMap.prototype = {
  50424. has: function (obj) {
  50425. return !!Object.getOwnPropertyDescriptor(obj, this.id);
  50426. },
  50427. get: function (obj, defaultValue) {
  50428. return this.has(obj) ? obj[this.id] : defaultValue;
  50429. },
  50430. set: function (obj, value) {
  50431. Object.defineProperty(obj, this.id, {
  50432. value: value,
  50433. enumerable: false,
  50434. configurable: true
  50435. });
  50436. },
  50437. delete: function (obj) {
  50438. delete obj[this.id];
  50439. }
  50440. };
  50441. globalScope.WeakMap = WeakMap;
  50442. }());
  50443. (function checkURLConstructor() {
  50444. var hasWorkingUrl = false;
  50445. try {
  50446. if (typeof URL === 'function' && typeof URL.prototype === 'object' && 'origin' in URL.prototype) {
  50447. var u = new URL('b', 'http://a');
  50448. u.pathname = 'c%20d';
  50449. hasWorkingUrl = u.href === 'http://a/c%20d';
  50450. }
  50451. } catch (e) {
  50452. }
  50453. if (hasWorkingUrl) {
  50454. return;
  50455. }
  50456. var relative = Object.create(null);
  50457. relative['ftp'] = 21;
  50458. relative['file'] = 0;
  50459. relative['gopher'] = 70;
  50460. relative['http'] = 80;
  50461. relative['https'] = 443;
  50462. relative['ws'] = 80;
  50463. relative['wss'] = 443;
  50464. var relativePathDotMapping = Object.create(null);
  50465. relativePathDotMapping['%2e'] = '.';
  50466. relativePathDotMapping['.%2e'] = '..';
  50467. relativePathDotMapping['%2e.'] = '..';
  50468. relativePathDotMapping['%2e%2e'] = '..';
  50469. function isRelativeScheme(scheme) {
  50470. return relative[scheme] !== undefined;
  50471. }
  50472. function invalid() {
  50473. clear.call(this);
  50474. this._isInvalid = true;
  50475. }
  50476. function IDNAToASCII(h) {
  50477. if (h === '') {
  50478. invalid.call(this);
  50479. }
  50480. return h.toLowerCase();
  50481. }
  50482. function percentEscape(c) {
  50483. var unicode = c.charCodeAt(0);
  50484. if (unicode > 0x20 && unicode < 0x7F && [
  50485. 0x22,
  50486. 0x23,
  50487. 0x3C,
  50488. 0x3E,
  50489. 0x3F,
  50490. 0x60
  50491. ].indexOf(unicode) === -1) {
  50492. return c;
  50493. }
  50494. return encodeURIComponent(c);
  50495. }
  50496. function percentEscapeQuery(c) {
  50497. var unicode = c.charCodeAt(0);
  50498. if (unicode > 0x20 && unicode < 0x7F && [
  50499. 0x22,
  50500. 0x23,
  50501. 0x3C,
  50502. 0x3E,
  50503. 0x60
  50504. ].indexOf(unicode) === -1) {
  50505. return c;
  50506. }
  50507. return encodeURIComponent(c);
  50508. }
  50509. var EOF, ALPHA = /[a-zA-Z]/, ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/;
  50510. function parse(input, stateOverride, base) {
  50511. function err(message) {
  50512. errors.push(message);
  50513. }
  50514. var state = stateOverride || 'scheme start', cursor = 0, buffer = '', seenAt = false, seenBracket = false, errors = [];
  50515. loop:
  50516. while ((input[cursor - 1] !== EOF || cursor === 0) && !this._isInvalid) {
  50517. var c = input[cursor];
  50518. switch (state) {
  50519. case 'scheme start':
  50520. if (c && ALPHA.test(c)) {
  50521. buffer += c.toLowerCase();
  50522. state = 'scheme';
  50523. } else if (!stateOverride) {
  50524. buffer = '';
  50525. state = 'no scheme';
  50526. continue;
  50527. } else {
  50528. err('Invalid scheme.');
  50529. break loop;
  50530. }
  50531. break;
  50532. case 'scheme':
  50533. if (c && ALPHANUMERIC.test(c)) {
  50534. buffer += c.toLowerCase();
  50535. } else if (c === ':') {
  50536. this._scheme = buffer;
  50537. buffer = '';
  50538. if (stateOverride) {
  50539. break loop;
  50540. }
  50541. if (isRelativeScheme(this._scheme)) {
  50542. this._isRelative = true;
  50543. }
  50544. if (this._scheme === 'file') {
  50545. state = 'relative';
  50546. } else if (this._isRelative && base && base._scheme === this._scheme) {
  50547. state = 'relative or authority';
  50548. } else if (this._isRelative) {
  50549. state = 'authority first slash';
  50550. } else {
  50551. state = 'scheme data';
  50552. }
  50553. } else if (!stateOverride) {
  50554. buffer = '';
  50555. cursor = 0;
  50556. state = 'no scheme';
  50557. continue;
  50558. } else if (c === EOF) {
  50559. break loop;
  50560. } else {
  50561. err('Code point not allowed in scheme: ' + c);
  50562. break loop;
  50563. }
  50564. break;
  50565. case 'scheme data':
  50566. if (c === '?') {
  50567. this._query = '?';
  50568. state = 'query';
  50569. } else if (c === '#') {
  50570. this._fragment = '#';
  50571. state = 'fragment';
  50572. } else {
  50573. if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') {
  50574. this._schemeData += percentEscape(c);
  50575. }
  50576. }
  50577. break;
  50578. case 'no scheme':
  50579. if (!base || !isRelativeScheme(base._scheme)) {
  50580. err('Missing scheme.');
  50581. invalid.call(this);
  50582. } else {
  50583. state = 'relative';
  50584. continue;
  50585. }
  50586. break;
  50587. case 'relative or authority':
  50588. if (c === '/' && input[cursor + 1] === '/') {
  50589. state = 'authority ignore slashes';
  50590. } else {
  50591. err('Expected /, got: ' + c);
  50592. state = 'relative';
  50593. continue;
  50594. }
  50595. break;
  50596. case 'relative':
  50597. this._isRelative = true;
  50598. if (this._scheme !== 'file') {
  50599. this._scheme = base._scheme;
  50600. }
  50601. if (c === EOF) {
  50602. this._host = base._host;
  50603. this._port = base._port;
  50604. this._path = base._path.slice();
  50605. this._query = base._query;
  50606. this._username = base._username;
  50607. this._password = base._password;
  50608. break loop;
  50609. } else if (c === '/' || c === '\\') {
  50610. if (c === '\\') {
  50611. err('\\ is an invalid code point.');
  50612. }
  50613. state = 'relative slash';
  50614. } else if (c === '?') {
  50615. this._host = base._host;
  50616. this._port = base._port;
  50617. this._path = base._path.slice();
  50618. this._query = '?';
  50619. this._username = base._username;
  50620. this._password = base._password;
  50621. state = 'query';
  50622. } else if (c === '#') {
  50623. this._host = base._host;
  50624. this._port = base._port;
  50625. this._path = base._path.slice();
  50626. this._query = base._query;
  50627. this._fragment = '#';
  50628. this._username = base._username;
  50629. this._password = base._password;
  50630. state = 'fragment';
  50631. } else {
  50632. var nextC = input[cursor + 1];
  50633. var nextNextC = input[cursor + 2];
  50634. if (this._scheme !== 'file' || !ALPHA.test(c) || nextC !== ':' && nextC !== '|' || nextNextC !== EOF && nextNextC !== '/' && nextNextC !== '\\' && nextNextC !== '?' && nextNextC !== '#') {
  50635. this._host = base._host;
  50636. this._port = base._port;
  50637. this._username = base._username;
  50638. this._password = base._password;
  50639. this._path = base._path.slice();
  50640. this._path.pop();
  50641. }
  50642. state = 'relative path';
  50643. continue;
  50644. }
  50645. break;
  50646. case 'relative slash':
  50647. if (c === '/' || c === '\\') {
  50648. if (c === '\\') {
  50649. err('\\ is an invalid code point.');
  50650. }
  50651. if (this._scheme === 'file') {
  50652. state = 'file host';
  50653. } else {
  50654. state = 'authority ignore slashes';
  50655. }
  50656. } else {
  50657. if (this._scheme !== 'file') {
  50658. this._host = base._host;
  50659. this._port = base._port;
  50660. this._username = base._username;
  50661. this._password = base._password;
  50662. }
  50663. state = 'relative path';
  50664. continue;
  50665. }
  50666. break;
  50667. case 'authority first slash':
  50668. if (c === '/') {
  50669. state = 'authority second slash';
  50670. } else {
  50671. err('Expected \'/\', got: ' + c);
  50672. state = 'authority ignore slashes';
  50673. continue;
  50674. }
  50675. break;
  50676. case 'authority second slash':
  50677. state = 'authority ignore slashes';
  50678. if (c !== '/') {
  50679. err('Expected \'/\', got: ' + c);
  50680. continue;
  50681. }
  50682. break;
  50683. case 'authority ignore slashes':
  50684. if (c !== '/' && c !== '\\') {
  50685. state = 'authority';
  50686. continue;
  50687. } else {
  50688. err('Expected authority, got: ' + c);
  50689. }
  50690. break;
  50691. case 'authority':
  50692. if (c === '@') {
  50693. if (seenAt) {
  50694. err('@ already seen.');
  50695. buffer += '%40';
  50696. }
  50697. seenAt = true;
  50698. for (var i = 0; i < buffer.length; i++) {
  50699. var cp = buffer[i];
  50700. if (cp === '\t' || cp === '\n' || cp === '\r') {
  50701. err('Invalid whitespace in authority.');
  50702. continue;
  50703. }
  50704. if (cp === ':' && this._password === null) {
  50705. this._password = '';
  50706. continue;
  50707. }
  50708. var tempC = percentEscape(cp);
  50709. if (this._password !== null) {
  50710. this._password += tempC;
  50711. } else {
  50712. this._username += tempC;
  50713. }
  50714. }
  50715. buffer = '';
  50716. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  50717. cursor -= buffer.length;
  50718. buffer = '';
  50719. state = 'host';
  50720. continue;
  50721. } else {
  50722. buffer += c;
  50723. }
  50724. break;
  50725. case 'file host':
  50726. if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  50727. if (buffer.length === 2 && ALPHA.test(buffer[0]) && (buffer[1] === ':' || buffer[1] === '|')) {
  50728. state = 'relative path';
  50729. } else if (buffer.length === 0) {
  50730. state = 'relative path start';
  50731. } else {
  50732. this._host = IDNAToASCII.call(this, buffer);
  50733. buffer = '';
  50734. state = 'relative path start';
  50735. }
  50736. continue;
  50737. } else if (c === '\t' || c === '\n' || c === '\r') {
  50738. err('Invalid whitespace in file host.');
  50739. } else {
  50740. buffer += c;
  50741. }
  50742. break;
  50743. case 'host':
  50744. case 'hostname':
  50745. if (c === ':' && !seenBracket) {
  50746. this._host = IDNAToASCII.call(this, buffer);
  50747. buffer = '';
  50748. state = 'port';
  50749. if (stateOverride === 'hostname') {
  50750. break loop;
  50751. }
  50752. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
  50753. this._host = IDNAToASCII.call(this, buffer);
  50754. buffer = '';
  50755. state = 'relative path start';
  50756. if (stateOverride) {
  50757. break loop;
  50758. }
  50759. continue;
  50760. } else if (c !== '\t' && c !== '\n' && c !== '\r') {
  50761. if (c === '[') {
  50762. seenBracket = true;
  50763. } else if (c === ']') {
  50764. seenBracket = false;
  50765. }
  50766. buffer += c;
  50767. } else {
  50768. err('Invalid code point in host/hostname: ' + c);
  50769. }
  50770. break;
  50771. case 'port':
  50772. if (/[0-9]/.test(c)) {
  50773. buffer += c;
  50774. } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#' || stateOverride) {
  50775. if (buffer !== '') {
  50776. var temp = parseInt(buffer, 10);
  50777. if (temp !== relative[this._scheme]) {
  50778. this._port = temp + '';
  50779. }
  50780. buffer = '';
  50781. }
  50782. if (stateOverride) {
  50783. break loop;
  50784. }
  50785. state = 'relative path start';
  50786. continue;
  50787. } else if (c === '\t' || c === '\n' || c === '\r') {
  50788. err('Invalid code point in port: ' + c);
  50789. } else {
  50790. invalid.call(this);
  50791. }
  50792. break;
  50793. case 'relative path start':
  50794. if (c === '\\') {
  50795. err('\'\\\' not allowed in path.');
  50796. }
  50797. state = 'relative path';
  50798. if (c !== '/' && c !== '\\') {
  50799. continue;
  50800. }
  50801. break;
  50802. case 'relative path':
  50803. if (c === EOF || c === '/' || c === '\\' || !stateOverride && (c === '?' || c === '#')) {
  50804. if (c === '\\') {
  50805. err('\\ not allowed in relative path.');
  50806. }
  50807. var tmp;
  50808. if (tmp = relativePathDotMapping[buffer.toLowerCase()]) {
  50809. buffer = tmp;
  50810. }
  50811. if (buffer === '..') {
  50812. this._path.pop();
  50813. if (c !== '/' && c !== '\\') {
  50814. this._path.push('');
  50815. }
  50816. } else if (buffer === '.' && c !== '/' && c !== '\\') {
  50817. this._path.push('');
  50818. } else if (buffer !== '.') {
  50819. if (this._scheme === 'file' && this._path.length === 0 && buffer.length === 2 && ALPHA.test(buffer[0]) && buffer[1] === '|') {
  50820. buffer = buffer[0] + ':';
  50821. }
  50822. this._path.push(buffer);
  50823. }
  50824. buffer = '';
  50825. if (c === '?') {
  50826. this._query = '?';
  50827. state = 'query';
  50828. } else if (c === '#') {
  50829. this._fragment = '#';
  50830. state = 'fragment';
  50831. }
  50832. } else if (c !== '\t' && c !== '\n' && c !== '\r') {
  50833. buffer += percentEscape(c);
  50834. }
  50835. break;
  50836. case 'query':
  50837. if (!stateOverride && c === '#') {
  50838. this._fragment = '#';
  50839. state = 'fragment';
  50840. } else if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') {
  50841. this._query += percentEscapeQuery(c);
  50842. }
  50843. break;
  50844. case 'fragment':
  50845. if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') {
  50846. this._fragment += c;
  50847. }
  50848. break;
  50849. }
  50850. cursor++;
  50851. }
  50852. }
  50853. function clear() {
  50854. this._scheme = '';
  50855. this._schemeData = '';
  50856. this._username = '';
  50857. this._password = null;
  50858. this._host = '';
  50859. this._port = '';
  50860. this._path = [];
  50861. this._query = '';
  50862. this._fragment = '';
  50863. this._isInvalid = false;
  50864. this._isRelative = false;
  50865. }
  50866. function JURL(url, base) {
  50867. if (base !== undefined && !(base instanceof JURL)) {
  50868. base = new JURL(String(base));
  50869. }
  50870. this._url = url;
  50871. clear.call(this);
  50872. var input = url.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g, '');
  50873. parse.call(this, input, null, base);
  50874. }
  50875. JURL.prototype = {
  50876. toString: function () {
  50877. return this.href;
  50878. },
  50879. get href() {
  50880. if (this._isInvalid) {
  50881. return this._url;
  50882. }
  50883. var authority = '';
  50884. if (this._username !== '' || this._password !== null) {
  50885. authority = this._username + (this._password !== null ? ':' + this._password : '') + '@';
  50886. }
  50887. return this.protocol + (this._isRelative ? '//' + authority + this.host : '') + this.pathname + this._query + this._fragment;
  50888. },
  50889. set href(href) {
  50890. clear.call(this);
  50891. parse.call(this, href);
  50892. },
  50893. get protocol() {
  50894. return this._scheme + ':';
  50895. },
  50896. set protocol(protocol) {
  50897. if (this._isInvalid) {
  50898. return;
  50899. }
  50900. parse.call(this, protocol + ':', 'scheme start');
  50901. },
  50902. get host() {
  50903. return this._isInvalid ? '' : this._port ? this._host + ':' + this._port : this._host;
  50904. },
  50905. set host(host) {
  50906. if (this._isInvalid || !this._isRelative) {
  50907. return;
  50908. }
  50909. parse.call(this, host, 'host');
  50910. },
  50911. get hostname() {
  50912. return this._host;
  50913. },
  50914. set hostname(hostname) {
  50915. if (this._isInvalid || !this._isRelative) {
  50916. return;
  50917. }
  50918. parse.call(this, hostname, 'hostname');
  50919. },
  50920. get port() {
  50921. return this._port;
  50922. },
  50923. set port(port) {
  50924. if (this._isInvalid || !this._isRelative) {
  50925. return;
  50926. }
  50927. parse.call(this, port, 'port');
  50928. },
  50929. get pathname() {
  50930. return this._isInvalid ? '' : this._isRelative ? '/' + this._path.join('/') : this._schemeData;
  50931. },
  50932. set pathname(pathname) {
  50933. if (this._isInvalid || !this._isRelative) {
  50934. return;
  50935. }
  50936. this._path = [];
  50937. parse.call(this, pathname, 'relative path start');
  50938. },
  50939. get search() {
  50940. return this._isInvalid || !this._query || this._query === '?' ? '' : this._query;
  50941. },
  50942. set search(search) {
  50943. if (this._isInvalid || !this._isRelative) {
  50944. return;
  50945. }
  50946. this._query = '?';
  50947. if (search[0] === '?') {
  50948. search = search.slice(1);
  50949. }
  50950. parse.call(this, search, 'query');
  50951. },
  50952. get hash() {
  50953. return this._isInvalid || !this._fragment || this._fragment === '#' ? '' : this._fragment;
  50954. },
  50955. set hash(hash) {
  50956. if (this._isInvalid) {
  50957. return;
  50958. }
  50959. this._fragment = '#';
  50960. if (hash[0] === '#') {
  50961. hash = hash.slice(1);
  50962. }
  50963. parse.call(this, hash, 'fragment');
  50964. },
  50965. get origin() {
  50966. var host;
  50967. if (this._isInvalid || !this._scheme) {
  50968. return '';
  50969. }
  50970. switch (this._scheme) {
  50971. case 'data':
  50972. case 'file':
  50973. case 'javascript':
  50974. case 'mailto':
  50975. return 'null';
  50976. }
  50977. host = this.host;
  50978. if (!host) {
  50979. return '';
  50980. }
  50981. return this._scheme + '://' + host;
  50982. }
  50983. };
  50984. var OriginalURL = globalScope.URL;
  50985. if (OriginalURL) {
  50986. JURL.createObjectURL = function (blob) {
  50987. return OriginalURL.createObjectURL.apply(OriginalURL, arguments);
  50988. };
  50989. JURL.revokeObjectURL = function (url) {
  50990. OriginalURL.revokeObjectURL(url);
  50991. };
  50992. }
  50993. globalScope.URL = JURL;
  50994. }());
  50995. }
  50996. /* WEBPACK VAR INJECTION */}.call(exports, __w_pdfjs_require__(9)))
  50997. /***/ })
  50998. /******/ ]);
  50999. });