stream.js 76 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572
  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. 'use strict';
  16. var sharedUtil = require('../shared/util.js');
  17. var corePrimitives = require('./primitives.js');
  18. var coreJbig2 = require('./jbig2.js');
  19. var coreJpg = require('./jpg.js');
  20. var coreJpx = require('./jpx.js');
  21. var Util = sharedUtil.Util;
  22. var error = sharedUtil.error;
  23. var info = sharedUtil.info;
  24. var isInt = sharedUtil.isInt;
  25. var isArray = sharedUtil.isArray;
  26. var createObjectURL = sharedUtil.createObjectURL;
  27. var shadow = sharedUtil.shadow;
  28. var isSpace = sharedUtil.isSpace;
  29. var Dict = corePrimitives.Dict;
  30. var isDict = corePrimitives.isDict;
  31. var isStream = corePrimitives.isStream;
  32. var Jbig2Image = coreJbig2.Jbig2Image;
  33. var JpegImage = coreJpg.JpegImage;
  34. var JpxImage = coreJpx.JpxImage;
  35. var Stream = function StreamClosure() {
  36. function Stream(arrayBuffer, start, length, dict) {
  37. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  38. this.start = start || 0;
  39. this.pos = this.start;
  40. this.end = start + length || this.bytes.length;
  41. this.dict = dict;
  42. }
  43. Stream.prototype = {
  44. get length() {
  45. return this.end - this.start;
  46. },
  47. get isEmpty() {
  48. return this.length === 0;
  49. },
  50. getByte: function Stream_getByte() {
  51. if (this.pos >= this.end) {
  52. return -1;
  53. }
  54. return this.bytes[this.pos++];
  55. },
  56. getUint16: function Stream_getUint16() {
  57. var b0 = this.getByte();
  58. var b1 = this.getByte();
  59. if (b0 === -1 || b1 === -1) {
  60. return -1;
  61. }
  62. return (b0 << 8) + b1;
  63. },
  64. getInt32: function Stream_getInt32() {
  65. var b0 = this.getByte();
  66. var b1 = this.getByte();
  67. var b2 = this.getByte();
  68. var b3 = this.getByte();
  69. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  70. },
  71. getBytes: function Stream_getBytes(length) {
  72. var bytes = this.bytes;
  73. var pos = this.pos;
  74. var strEnd = this.end;
  75. if (!length) {
  76. return bytes.subarray(pos, strEnd);
  77. }
  78. var end = pos + length;
  79. if (end > strEnd) {
  80. end = strEnd;
  81. }
  82. this.pos = end;
  83. return bytes.subarray(pos, end);
  84. },
  85. peekByte: function Stream_peekByte() {
  86. var peekedByte = this.getByte();
  87. this.pos--;
  88. return peekedByte;
  89. },
  90. peekBytes: function Stream_peekBytes(length) {
  91. var bytes = this.getBytes(length);
  92. this.pos -= bytes.length;
  93. return bytes;
  94. },
  95. skip: function Stream_skip(n) {
  96. if (!n) {
  97. n = 1;
  98. }
  99. this.pos += n;
  100. },
  101. reset: function Stream_reset() {
  102. this.pos = this.start;
  103. },
  104. moveStart: function Stream_moveStart() {
  105. this.start = this.pos;
  106. },
  107. makeSubStream: function Stream_makeSubStream(start, length, dict) {
  108. return new Stream(this.bytes.buffer, start, length, dict);
  109. }
  110. };
  111. return Stream;
  112. }();
  113. var StringStream = function StringStreamClosure() {
  114. function StringStream(str) {
  115. var length = str.length;
  116. var bytes = new Uint8Array(length);
  117. for (var n = 0; n < length; ++n) {
  118. bytes[n] = str.charCodeAt(n);
  119. }
  120. Stream.call(this, bytes);
  121. }
  122. StringStream.prototype = Stream.prototype;
  123. return StringStream;
  124. }();
  125. var DecodeStream = function DecodeStreamClosure() {
  126. var emptyBuffer = new Uint8Array(0);
  127. function DecodeStream(maybeMinBufferLength) {
  128. this.pos = 0;
  129. this.bufferLength = 0;
  130. this.eof = false;
  131. this.buffer = emptyBuffer;
  132. this.minBufferLength = 512;
  133. if (maybeMinBufferLength) {
  134. while (this.minBufferLength < maybeMinBufferLength) {
  135. this.minBufferLength *= 2;
  136. }
  137. }
  138. }
  139. DecodeStream.prototype = {
  140. get isEmpty() {
  141. while (!this.eof && this.bufferLength === 0) {
  142. this.readBlock();
  143. }
  144. return this.bufferLength === 0;
  145. },
  146. ensureBuffer: function DecodeStream_ensureBuffer(requested) {
  147. var buffer = this.buffer;
  148. if (requested <= buffer.byteLength) {
  149. return buffer;
  150. }
  151. var size = this.minBufferLength;
  152. while (size < requested) {
  153. size *= 2;
  154. }
  155. var buffer2 = new Uint8Array(size);
  156. buffer2.set(buffer);
  157. return this.buffer = buffer2;
  158. },
  159. getByte: function DecodeStream_getByte() {
  160. var pos = this.pos;
  161. while (this.bufferLength <= pos) {
  162. if (this.eof) {
  163. return -1;
  164. }
  165. this.readBlock();
  166. }
  167. return this.buffer[this.pos++];
  168. },
  169. getUint16: function DecodeStream_getUint16() {
  170. var b0 = this.getByte();
  171. var b1 = this.getByte();
  172. if (b0 === -1 || b1 === -1) {
  173. return -1;
  174. }
  175. return (b0 << 8) + b1;
  176. },
  177. getInt32: function DecodeStream_getInt32() {
  178. var b0 = this.getByte();
  179. var b1 = this.getByte();
  180. var b2 = this.getByte();
  181. var b3 = this.getByte();
  182. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  183. },
  184. getBytes: function DecodeStream_getBytes(length) {
  185. var end, pos = this.pos;
  186. if (length) {
  187. this.ensureBuffer(pos + length);
  188. end = pos + length;
  189. while (!this.eof && this.bufferLength < end) {
  190. this.readBlock();
  191. }
  192. var bufEnd = this.bufferLength;
  193. if (end > bufEnd) {
  194. end = bufEnd;
  195. }
  196. } else {
  197. while (!this.eof) {
  198. this.readBlock();
  199. }
  200. end = this.bufferLength;
  201. }
  202. this.pos = end;
  203. return this.buffer.subarray(pos, end);
  204. },
  205. peekByte: function DecodeStream_peekByte() {
  206. var peekedByte = this.getByte();
  207. this.pos--;
  208. return peekedByte;
  209. },
  210. peekBytes: function DecodeStream_peekBytes(length) {
  211. var bytes = this.getBytes(length);
  212. this.pos -= bytes.length;
  213. return bytes;
  214. },
  215. makeSubStream: function DecodeStream_makeSubStream(start, length, dict) {
  216. var end = start + length;
  217. while (this.bufferLength <= end && !this.eof) {
  218. this.readBlock();
  219. }
  220. return new Stream(this.buffer, start, length, dict);
  221. },
  222. skip: function DecodeStream_skip(n) {
  223. if (!n) {
  224. n = 1;
  225. }
  226. this.pos += n;
  227. },
  228. reset: function DecodeStream_reset() {
  229. this.pos = 0;
  230. },
  231. getBaseStreams: function DecodeStream_getBaseStreams() {
  232. if (this.str && this.str.getBaseStreams) {
  233. return this.str.getBaseStreams();
  234. }
  235. return [];
  236. }
  237. };
  238. return DecodeStream;
  239. }();
  240. var StreamsSequenceStream = function StreamsSequenceStreamClosure() {
  241. function StreamsSequenceStream(streams) {
  242. this.streams = streams;
  243. DecodeStream.call(this, null);
  244. }
  245. StreamsSequenceStream.prototype = Object.create(DecodeStream.prototype);
  246. StreamsSequenceStream.prototype.readBlock = function streamSequenceStreamReadBlock() {
  247. var streams = this.streams;
  248. if (streams.length === 0) {
  249. this.eof = true;
  250. return;
  251. }
  252. var stream = streams.shift();
  253. var chunk = stream.getBytes();
  254. var bufferLength = this.bufferLength;
  255. var newLength = bufferLength + chunk.length;
  256. var buffer = this.ensureBuffer(newLength);
  257. buffer.set(chunk, bufferLength);
  258. this.bufferLength = newLength;
  259. };
  260. StreamsSequenceStream.prototype.getBaseStreams = function StreamsSequenceStream_getBaseStreams() {
  261. var baseStreams = [];
  262. for (var i = 0, ii = this.streams.length; i < ii; i++) {
  263. var stream = this.streams[i];
  264. if (stream.getBaseStreams) {
  265. Util.appendToArray(baseStreams, stream.getBaseStreams());
  266. }
  267. }
  268. return baseStreams;
  269. };
  270. return StreamsSequenceStream;
  271. }();
  272. var FlateStream = function FlateStreamClosure() {
  273. var codeLenCodeMap = new Int32Array([
  274. 16,
  275. 17,
  276. 18,
  277. 0,
  278. 8,
  279. 7,
  280. 9,
  281. 6,
  282. 10,
  283. 5,
  284. 11,
  285. 4,
  286. 12,
  287. 3,
  288. 13,
  289. 2,
  290. 14,
  291. 1,
  292. 15
  293. ]);
  294. var lengthDecode = new Int32Array([
  295. 0x00003,
  296. 0x00004,
  297. 0x00005,
  298. 0x00006,
  299. 0x00007,
  300. 0x00008,
  301. 0x00009,
  302. 0x0000a,
  303. 0x1000b,
  304. 0x1000d,
  305. 0x1000f,
  306. 0x10011,
  307. 0x20013,
  308. 0x20017,
  309. 0x2001b,
  310. 0x2001f,
  311. 0x30023,
  312. 0x3002b,
  313. 0x30033,
  314. 0x3003b,
  315. 0x40043,
  316. 0x40053,
  317. 0x40063,
  318. 0x40073,
  319. 0x50083,
  320. 0x500a3,
  321. 0x500c3,
  322. 0x500e3,
  323. 0x00102,
  324. 0x00102,
  325. 0x00102
  326. ]);
  327. var distDecode = new Int32Array([
  328. 0x00001,
  329. 0x00002,
  330. 0x00003,
  331. 0x00004,
  332. 0x10005,
  333. 0x10007,
  334. 0x20009,
  335. 0x2000d,
  336. 0x30011,
  337. 0x30019,
  338. 0x40021,
  339. 0x40031,
  340. 0x50041,
  341. 0x50061,
  342. 0x60081,
  343. 0x600c1,
  344. 0x70101,
  345. 0x70181,
  346. 0x80201,
  347. 0x80301,
  348. 0x90401,
  349. 0x90601,
  350. 0xa0801,
  351. 0xa0c01,
  352. 0xb1001,
  353. 0xb1801,
  354. 0xc2001,
  355. 0xc3001,
  356. 0xd4001,
  357. 0xd6001
  358. ]);
  359. var fixedLitCodeTab = [
  360. new Int32Array([
  361. 0x70100,
  362. 0x80050,
  363. 0x80010,
  364. 0x80118,
  365. 0x70110,
  366. 0x80070,
  367. 0x80030,
  368. 0x900c0,
  369. 0x70108,
  370. 0x80060,
  371. 0x80020,
  372. 0x900a0,
  373. 0x80000,
  374. 0x80080,
  375. 0x80040,
  376. 0x900e0,
  377. 0x70104,
  378. 0x80058,
  379. 0x80018,
  380. 0x90090,
  381. 0x70114,
  382. 0x80078,
  383. 0x80038,
  384. 0x900d0,
  385. 0x7010c,
  386. 0x80068,
  387. 0x80028,
  388. 0x900b0,
  389. 0x80008,
  390. 0x80088,
  391. 0x80048,
  392. 0x900f0,
  393. 0x70102,
  394. 0x80054,
  395. 0x80014,
  396. 0x8011c,
  397. 0x70112,
  398. 0x80074,
  399. 0x80034,
  400. 0x900c8,
  401. 0x7010a,
  402. 0x80064,
  403. 0x80024,
  404. 0x900a8,
  405. 0x80004,
  406. 0x80084,
  407. 0x80044,
  408. 0x900e8,
  409. 0x70106,
  410. 0x8005c,
  411. 0x8001c,
  412. 0x90098,
  413. 0x70116,
  414. 0x8007c,
  415. 0x8003c,
  416. 0x900d8,
  417. 0x7010e,
  418. 0x8006c,
  419. 0x8002c,
  420. 0x900b8,
  421. 0x8000c,
  422. 0x8008c,
  423. 0x8004c,
  424. 0x900f8,
  425. 0x70101,
  426. 0x80052,
  427. 0x80012,
  428. 0x8011a,
  429. 0x70111,
  430. 0x80072,
  431. 0x80032,
  432. 0x900c4,
  433. 0x70109,
  434. 0x80062,
  435. 0x80022,
  436. 0x900a4,
  437. 0x80002,
  438. 0x80082,
  439. 0x80042,
  440. 0x900e4,
  441. 0x70105,
  442. 0x8005a,
  443. 0x8001a,
  444. 0x90094,
  445. 0x70115,
  446. 0x8007a,
  447. 0x8003a,
  448. 0x900d4,
  449. 0x7010d,
  450. 0x8006a,
  451. 0x8002a,
  452. 0x900b4,
  453. 0x8000a,
  454. 0x8008a,
  455. 0x8004a,
  456. 0x900f4,
  457. 0x70103,
  458. 0x80056,
  459. 0x80016,
  460. 0x8011e,
  461. 0x70113,
  462. 0x80076,
  463. 0x80036,
  464. 0x900cc,
  465. 0x7010b,
  466. 0x80066,
  467. 0x80026,
  468. 0x900ac,
  469. 0x80006,
  470. 0x80086,
  471. 0x80046,
  472. 0x900ec,
  473. 0x70107,
  474. 0x8005e,
  475. 0x8001e,
  476. 0x9009c,
  477. 0x70117,
  478. 0x8007e,
  479. 0x8003e,
  480. 0x900dc,
  481. 0x7010f,
  482. 0x8006e,
  483. 0x8002e,
  484. 0x900bc,
  485. 0x8000e,
  486. 0x8008e,
  487. 0x8004e,
  488. 0x900fc,
  489. 0x70100,
  490. 0x80051,
  491. 0x80011,
  492. 0x80119,
  493. 0x70110,
  494. 0x80071,
  495. 0x80031,
  496. 0x900c2,
  497. 0x70108,
  498. 0x80061,
  499. 0x80021,
  500. 0x900a2,
  501. 0x80001,
  502. 0x80081,
  503. 0x80041,
  504. 0x900e2,
  505. 0x70104,
  506. 0x80059,
  507. 0x80019,
  508. 0x90092,
  509. 0x70114,
  510. 0x80079,
  511. 0x80039,
  512. 0x900d2,
  513. 0x7010c,
  514. 0x80069,
  515. 0x80029,
  516. 0x900b2,
  517. 0x80009,
  518. 0x80089,
  519. 0x80049,
  520. 0x900f2,
  521. 0x70102,
  522. 0x80055,
  523. 0x80015,
  524. 0x8011d,
  525. 0x70112,
  526. 0x80075,
  527. 0x80035,
  528. 0x900ca,
  529. 0x7010a,
  530. 0x80065,
  531. 0x80025,
  532. 0x900aa,
  533. 0x80005,
  534. 0x80085,
  535. 0x80045,
  536. 0x900ea,
  537. 0x70106,
  538. 0x8005d,
  539. 0x8001d,
  540. 0x9009a,
  541. 0x70116,
  542. 0x8007d,
  543. 0x8003d,
  544. 0x900da,
  545. 0x7010e,
  546. 0x8006d,
  547. 0x8002d,
  548. 0x900ba,
  549. 0x8000d,
  550. 0x8008d,
  551. 0x8004d,
  552. 0x900fa,
  553. 0x70101,
  554. 0x80053,
  555. 0x80013,
  556. 0x8011b,
  557. 0x70111,
  558. 0x80073,
  559. 0x80033,
  560. 0x900c6,
  561. 0x70109,
  562. 0x80063,
  563. 0x80023,
  564. 0x900a6,
  565. 0x80003,
  566. 0x80083,
  567. 0x80043,
  568. 0x900e6,
  569. 0x70105,
  570. 0x8005b,
  571. 0x8001b,
  572. 0x90096,
  573. 0x70115,
  574. 0x8007b,
  575. 0x8003b,
  576. 0x900d6,
  577. 0x7010d,
  578. 0x8006b,
  579. 0x8002b,
  580. 0x900b6,
  581. 0x8000b,
  582. 0x8008b,
  583. 0x8004b,
  584. 0x900f6,
  585. 0x70103,
  586. 0x80057,
  587. 0x80017,
  588. 0x8011f,
  589. 0x70113,
  590. 0x80077,
  591. 0x80037,
  592. 0x900ce,
  593. 0x7010b,
  594. 0x80067,
  595. 0x80027,
  596. 0x900ae,
  597. 0x80007,
  598. 0x80087,
  599. 0x80047,
  600. 0x900ee,
  601. 0x70107,
  602. 0x8005f,
  603. 0x8001f,
  604. 0x9009e,
  605. 0x70117,
  606. 0x8007f,
  607. 0x8003f,
  608. 0x900de,
  609. 0x7010f,
  610. 0x8006f,
  611. 0x8002f,
  612. 0x900be,
  613. 0x8000f,
  614. 0x8008f,
  615. 0x8004f,
  616. 0x900fe,
  617. 0x70100,
  618. 0x80050,
  619. 0x80010,
  620. 0x80118,
  621. 0x70110,
  622. 0x80070,
  623. 0x80030,
  624. 0x900c1,
  625. 0x70108,
  626. 0x80060,
  627. 0x80020,
  628. 0x900a1,
  629. 0x80000,
  630. 0x80080,
  631. 0x80040,
  632. 0x900e1,
  633. 0x70104,
  634. 0x80058,
  635. 0x80018,
  636. 0x90091,
  637. 0x70114,
  638. 0x80078,
  639. 0x80038,
  640. 0x900d1,
  641. 0x7010c,
  642. 0x80068,
  643. 0x80028,
  644. 0x900b1,
  645. 0x80008,
  646. 0x80088,
  647. 0x80048,
  648. 0x900f1,
  649. 0x70102,
  650. 0x80054,
  651. 0x80014,
  652. 0x8011c,
  653. 0x70112,
  654. 0x80074,
  655. 0x80034,
  656. 0x900c9,
  657. 0x7010a,
  658. 0x80064,
  659. 0x80024,
  660. 0x900a9,
  661. 0x80004,
  662. 0x80084,
  663. 0x80044,
  664. 0x900e9,
  665. 0x70106,
  666. 0x8005c,
  667. 0x8001c,
  668. 0x90099,
  669. 0x70116,
  670. 0x8007c,
  671. 0x8003c,
  672. 0x900d9,
  673. 0x7010e,
  674. 0x8006c,
  675. 0x8002c,
  676. 0x900b9,
  677. 0x8000c,
  678. 0x8008c,
  679. 0x8004c,
  680. 0x900f9,
  681. 0x70101,
  682. 0x80052,
  683. 0x80012,
  684. 0x8011a,
  685. 0x70111,
  686. 0x80072,
  687. 0x80032,
  688. 0x900c5,
  689. 0x70109,
  690. 0x80062,
  691. 0x80022,
  692. 0x900a5,
  693. 0x80002,
  694. 0x80082,
  695. 0x80042,
  696. 0x900e5,
  697. 0x70105,
  698. 0x8005a,
  699. 0x8001a,
  700. 0x90095,
  701. 0x70115,
  702. 0x8007a,
  703. 0x8003a,
  704. 0x900d5,
  705. 0x7010d,
  706. 0x8006a,
  707. 0x8002a,
  708. 0x900b5,
  709. 0x8000a,
  710. 0x8008a,
  711. 0x8004a,
  712. 0x900f5,
  713. 0x70103,
  714. 0x80056,
  715. 0x80016,
  716. 0x8011e,
  717. 0x70113,
  718. 0x80076,
  719. 0x80036,
  720. 0x900cd,
  721. 0x7010b,
  722. 0x80066,
  723. 0x80026,
  724. 0x900ad,
  725. 0x80006,
  726. 0x80086,
  727. 0x80046,
  728. 0x900ed,
  729. 0x70107,
  730. 0x8005e,
  731. 0x8001e,
  732. 0x9009d,
  733. 0x70117,
  734. 0x8007e,
  735. 0x8003e,
  736. 0x900dd,
  737. 0x7010f,
  738. 0x8006e,
  739. 0x8002e,
  740. 0x900bd,
  741. 0x8000e,
  742. 0x8008e,
  743. 0x8004e,
  744. 0x900fd,
  745. 0x70100,
  746. 0x80051,
  747. 0x80011,
  748. 0x80119,
  749. 0x70110,
  750. 0x80071,
  751. 0x80031,
  752. 0x900c3,
  753. 0x70108,
  754. 0x80061,
  755. 0x80021,
  756. 0x900a3,
  757. 0x80001,
  758. 0x80081,
  759. 0x80041,
  760. 0x900e3,
  761. 0x70104,
  762. 0x80059,
  763. 0x80019,
  764. 0x90093,
  765. 0x70114,
  766. 0x80079,
  767. 0x80039,
  768. 0x900d3,
  769. 0x7010c,
  770. 0x80069,
  771. 0x80029,
  772. 0x900b3,
  773. 0x80009,
  774. 0x80089,
  775. 0x80049,
  776. 0x900f3,
  777. 0x70102,
  778. 0x80055,
  779. 0x80015,
  780. 0x8011d,
  781. 0x70112,
  782. 0x80075,
  783. 0x80035,
  784. 0x900cb,
  785. 0x7010a,
  786. 0x80065,
  787. 0x80025,
  788. 0x900ab,
  789. 0x80005,
  790. 0x80085,
  791. 0x80045,
  792. 0x900eb,
  793. 0x70106,
  794. 0x8005d,
  795. 0x8001d,
  796. 0x9009b,
  797. 0x70116,
  798. 0x8007d,
  799. 0x8003d,
  800. 0x900db,
  801. 0x7010e,
  802. 0x8006d,
  803. 0x8002d,
  804. 0x900bb,
  805. 0x8000d,
  806. 0x8008d,
  807. 0x8004d,
  808. 0x900fb,
  809. 0x70101,
  810. 0x80053,
  811. 0x80013,
  812. 0x8011b,
  813. 0x70111,
  814. 0x80073,
  815. 0x80033,
  816. 0x900c7,
  817. 0x70109,
  818. 0x80063,
  819. 0x80023,
  820. 0x900a7,
  821. 0x80003,
  822. 0x80083,
  823. 0x80043,
  824. 0x900e7,
  825. 0x70105,
  826. 0x8005b,
  827. 0x8001b,
  828. 0x90097,
  829. 0x70115,
  830. 0x8007b,
  831. 0x8003b,
  832. 0x900d7,
  833. 0x7010d,
  834. 0x8006b,
  835. 0x8002b,
  836. 0x900b7,
  837. 0x8000b,
  838. 0x8008b,
  839. 0x8004b,
  840. 0x900f7,
  841. 0x70103,
  842. 0x80057,
  843. 0x80017,
  844. 0x8011f,
  845. 0x70113,
  846. 0x80077,
  847. 0x80037,
  848. 0x900cf,
  849. 0x7010b,
  850. 0x80067,
  851. 0x80027,
  852. 0x900af,
  853. 0x80007,
  854. 0x80087,
  855. 0x80047,
  856. 0x900ef,
  857. 0x70107,
  858. 0x8005f,
  859. 0x8001f,
  860. 0x9009f,
  861. 0x70117,
  862. 0x8007f,
  863. 0x8003f,
  864. 0x900df,
  865. 0x7010f,
  866. 0x8006f,
  867. 0x8002f,
  868. 0x900bf,
  869. 0x8000f,
  870. 0x8008f,
  871. 0x8004f,
  872. 0x900ff
  873. ]),
  874. 9
  875. ];
  876. var fixedDistCodeTab = [
  877. new Int32Array([
  878. 0x50000,
  879. 0x50010,
  880. 0x50008,
  881. 0x50018,
  882. 0x50004,
  883. 0x50014,
  884. 0x5000c,
  885. 0x5001c,
  886. 0x50002,
  887. 0x50012,
  888. 0x5000a,
  889. 0x5001a,
  890. 0x50006,
  891. 0x50016,
  892. 0x5000e,
  893. 0x00000,
  894. 0x50001,
  895. 0x50011,
  896. 0x50009,
  897. 0x50019,
  898. 0x50005,
  899. 0x50015,
  900. 0x5000d,
  901. 0x5001d,
  902. 0x50003,
  903. 0x50013,
  904. 0x5000b,
  905. 0x5001b,
  906. 0x50007,
  907. 0x50017,
  908. 0x5000f,
  909. 0x00000
  910. ]),
  911. 5
  912. ];
  913. function FlateStream(str, maybeLength) {
  914. this.str = str;
  915. this.dict = str.dict;
  916. var cmf = str.getByte();
  917. var flg = str.getByte();
  918. if (cmf === -1 || flg === -1) {
  919. error('Invalid header in flate stream: ' + cmf + ', ' + flg);
  920. }
  921. if ((cmf & 0x0f) !== 0x08) {
  922. error('Unknown compression method in flate stream: ' + cmf + ', ' + flg);
  923. }
  924. if (((cmf << 8) + flg) % 31 !== 0) {
  925. error('Bad FCHECK in flate stream: ' + cmf + ', ' + flg);
  926. }
  927. if (flg & 0x20) {
  928. error('FDICT bit set in flate stream: ' + cmf + ', ' + flg);
  929. }
  930. this.codeSize = 0;
  931. this.codeBuf = 0;
  932. DecodeStream.call(this, maybeLength);
  933. }
  934. FlateStream.prototype = Object.create(DecodeStream.prototype);
  935. FlateStream.prototype.getBits = function FlateStream_getBits(bits) {
  936. var str = this.str;
  937. var codeSize = this.codeSize;
  938. var codeBuf = this.codeBuf;
  939. var b;
  940. while (codeSize < bits) {
  941. if ((b = str.getByte()) === -1) {
  942. error('Bad encoding in flate stream');
  943. }
  944. codeBuf |= b << codeSize;
  945. codeSize += 8;
  946. }
  947. b = codeBuf & (1 << bits) - 1;
  948. this.codeBuf = codeBuf >> bits;
  949. this.codeSize = codeSize -= bits;
  950. return b;
  951. };
  952. FlateStream.prototype.getCode = function FlateStream_getCode(table) {
  953. var str = this.str;
  954. var codes = table[0];
  955. var maxLen = table[1];
  956. var codeSize = this.codeSize;
  957. var codeBuf = this.codeBuf;
  958. var b;
  959. while (codeSize < maxLen) {
  960. if ((b = str.getByte()) === -1) {
  961. break;
  962. }
  963. codeBuf |= b << codeSize;
  964. codeSize += 8;
  965. }
  966. var code = codes[codeBuf & (1 << maxLen) - 1];
  967. var codeLen = code >> 16;
  968. var codeVal = code & 0xffff;
  969. if (codeLen < 1 || codeSize < codeLen) {
  970. error('Bad encoding in flate stream');
  971. }
  972. this.codeBuf = codeBuf >> codeLen;
  973. this.codeSize = codeSize - codeLen;
  974. return codeVal;
  975. };
  976. FlateStream.prototype.generateHuffmanTable = function flateStreamGenerateHuffmanTable(lengths) {
  977. var n = lengths.length;
  978. var maxLen = 0;
  979. var i;
  980. for (i = 0; i < n; ++i) {
  981. if (lengths[i] > maxLen) {
  982. maxLen = lengths[i];
  983. }
  984. }
  985. var size = 1 << maxLen;
  986. var codes = new Int32Array(size);
  987. for (var len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  988. for (var val = 0; val < n; ++val) {
  989. if (lengths[val] === len) {
  990. var code2 = 0;
  991. var t = code;
  992. for (i = 0; i < len; ++i) {
  993. code2 = code2 << 1 | t & 1;
  994. t >>= 1;
  995. }
  996. for (i = code2; i < size; i += skip) {
  997. codes[i] = len << 16 | val;
  998. }
  999. ++code;
  1000. }
  1001. }
  1002. }
  1003. return [
  1004. codes,
  1005. maxLen
  1006. ];
  1007. };
  1008. FlateStream.prototype.readBlock = function FlateStream_readBlock() {
  1009. var buffer, len;
  1010. var str = this.str;
  1011. var hdr = this.getBits(3);
  1012. if (hdr & 1) {
  1013. this.eof = true;
  1014. }
  1015. hdr >>= 1;
  1016. if (hdr === 0) {
  1017. var b;
  1018. if ((b = str.getByte()) === -1) {
  1019. error('Bad block header in flate stream');
  1020. }
  1021. var blockLen = b;
  1022. if ((b = str.getByte()) === -1) {
  1023. error('Bad block header in flate stream');
  1024. }
  1025. blockLen |= b << 8;
  1026. if ((b = str.getByte()) === -1) {
  1027. error('Bad block header in flate stream');
  1028. }
  1029. var check = b;
  1030. if ((b = str.getByte()) === -1) {
  1031. error('Bad block header in flate stream');
  1032. }
  1033. check |= b << 8;
  1034. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  1035. error('Bad uncompressed block length in flate stream');
  1036. }
  1037. this.codeBuf = 0;
  1038. this.codeSize = 0;
  1039. var bufferLength = this.bufferLength;
  1040. buffer = this.ensureBuffer(bufferLength + blockLen);
  1041. var end = bufferLength + blockLen;
  1042. this.bufferLength = end;
  1043. if (blockLen === 0) {
  1044. if (str.peekByte() === -1) {
  1045. this.eof = true;
  1046. }
  1047. } else {
  1048. for (var n = bufferLength; n < end; ++n) {
  1049. if ((b = str.getByte()) === -1) {
  1050. this.eof = true;
  1051. break;
  1052. }
  1053. buffer[n] = b;
  1054. }
  1055. }
  1056. return;
  1057. }
  1058. var litCodeTable;
  1059. var distCodeTable;
  1060. if (hdr === 1) {
  1061. litCodeTable = fixedLitCodeTab;
  1062. distCodeTable = fixedDistCodeTab;
  1063. } else if (hdr === 2) {
  1064. var numLitCodes = this.getBits(5) + 257;
  1065. var numDistCodes = this.getBits(5) + 1;
  1066. var numCodeLenCodes = this.getBits(4) + 4;
  1067. var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  1068. var i;
  1069. for (i = 0; i < numCodeLenCodes; ++i) {
  1070. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  1071. }
  1072. var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  1073. len = 0;
  1074. i = 0;
  1075. var codes = numLitCodes + numDistCodes;
  1076. var codeLengths = new Uint8Array(codes);
  1077. var bitsLength, bitsOffset, what;
  1078. while (i < codes) {
  1079. var code = this.getCode(codeLenCodeTab);
  1080. if (code === 16) {
  1081. bitsLength = 2;
  1082. bitsOffset = 3;
  1083. what = len;
  1084. } else if (code === 17) {
  1085. bitsLength = 3;
  1086. bitsOffset = 3;
  1087. what = len = 0;
  1088. } else if (code === 18) {
  1089. bitsLength = 7;
  1090. bitsOffset = 11;
  1091. what = len = 0;
  1092. } else {
  1093. codeLengths[i++] = len = code;
  1094. continue;
  1095. }
  1096. var repeatLength = this.getBits(bitsLength) + bitsOffset;
  1097. while (repeatLength-- > 0) {
  1098. codeLengths[i++] = what;
  1099. }
  1100. }
  1101. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  1102. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  1103. } else {
  1104. error('Unknown block type in flate stream');
  1105. }
  1106. buffer = this.buffer;
  1107. var limit = buffer ? buffer.length : 0;
  1108. var pos = this.bufferLength;
  1109. while (true) {
  1110. var code1 = this.getCode(litCodeTable);
  1111. if (code1 < 256) {
  1112. if (pos + 1 >= limit) {
  1113. buffer = this.ensureBuffer(pos + 1);
  1114. limit = buffer.length;
  1115. }
  1116. buffer[pos++] = code1;
  1117. continue;
  1118. }
  1119. if (code1 === 256) {
  1120. this.bufferLength = pos;
  1121. return;
  1122. }
  1123. code1 -= 257;
  1124. code1 = lengthDecode[code1];
  1125. var code2 = code1 >> 16;
  1126. if (code2 > 0) {
  1127. code2 = this.getBits(code2);
  1128. }
  1129. len = (code1 & 0xffff) + code2;
  1130. code1 = this.getCode(distCodeTable);
  1131. code1 = distDecode[code1];
  1132. code2 = code1 >> 16;
  1133. if (code2 > 0) {
  1134. code2 = this.getBits(code2);
  1135. }
  1136. var dist = (code1 & 0xffff) + code2;
  1137. if (pos + len >= limit) {
  1138. buffer = this.ensureBuffer(pos + len);
  1139. limit = buffer.length;
  1140. }
  1141. for (var k = 0; k < len; ++k, ++pos) {
  1142. buffer[pos] = buffer[pos - dist];
  1143. }
  1144. }
  1145. };
  1146. return FlateStream;
  1147. }();
  1148. var PredictorStream = function PredictorStreamClosure() {
  1149. function PredictorStream(str, maybeLength, params) {
  1150. if (!isDict(params)) {
  1151. return str;
  1152. }
  1153. var predictor = this.predictor = params.get('Predictor') || 1;
  1154. if (predictor <= 1) {
  1155. return str;
  1156. }
  1157. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  1158. error('Unsupported predictor: ' + predictor);
  1159. }
  1160. if (predictor === 2) {
  1161. this.readBlock = this.readBlockTiff;
  1162. } else {
  1163. this.readBlock = this.readBlockPng;
  1164. }
  1165. this.str = str;
  1166. this.dict = str.dict;
  1167. var colors = this.colors = params.get('Colors') || 1;
  1168. var bits = this.bits = params.get('BitsPerComponent') || 8;
  1169. var columns = this.columns = params.get('Columns') || 1;
  1170. this.pixBytes = colors * bits + 7 >> 3;
  1171. this.rowBytes = columns * colors * bits + 7 >> 3;
  1172. DecodeStream.call(this, maybeLength);
  1173. return this;
  1174. }
  1175. PredictorStream.prototype = Object.create(DecodeStream.prototype);
  1176. PredictorStream.prototype.readBlockTiff = function predictorStreamReadBlockTiff() {
  1177. var rowBytes = this.rowBytes;
  1178. var bufferLength = this.bufferLength;
  1179. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  1180. var bits = this.bits;
  1181. var colors = this.colors;
  1182. var rawBytes = this.str.getBytes(rowBytes);
  1183. this.eof = !rawBytes.length;
  1184. if (this.eof) {
  1185. return;
  1186. }
  1187. var inbuf = 0, outbuf = 0;
  1188. var inbits = 0, outbits = 0;
  1189. var pos = bufferLength;
  1190. var i;
  1191. if (bits === 1 && colors === 1) {
  1192. for (i = 0; i < rowBytes; ++i) {
  1193. var c = rawBytes[i] ^ inbuf;
  1194. c ^= c >> 1;
  1195. c ^= c >> 2;
  1196. c ^= c >> 4;
  1197. inbuf = (c & 1) << 7;
  1198. buffer[pos++] = c;
  1199. }
  1200. } else if (bits === 8) {
  1201. for (i = 0; i < colors; ++i) {
  1202. buffer[pos++] = rawBytes[i];
  1203. }
  1204. for (; i < rowBytes; ++i) {
  1205. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  1206. pos++;
  1207. }
  1208. } else {
  1209. var compArray = new Uint8Array(colors + 1);
  1210. var bitMask = (1 << bits) - 1;
  1211. var j = 0, k = bufferLength;
  1212. var columns = this.columns;
  1213. for (i = 0; i < columns; ++i) {
  1214. for (var kk = 0; kk < colors; ++kk) {
  1215. if (inbits < bits) {
  1216. inbuf = inbuf << 8 | rawBytes[j++] & 0xFF;
  1217. inbits += 8;
  1218. }
  1219. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  1220. inbits -= bits;
  1221. outbuf = outbuf << bits | compArray[kk];
  1222. outbits += bits;
  1223. if (outbits >= 8) {
  1224. buffer[k++] = outbuf >> outbits - 8 & 0xFF;
  1225. outbits -= 8;
  1226. }
  1227. }
  1228. }
  1229. if (outbits > 0) {
  1230. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  1231. }
  1232. }
  1233. this.bufferLength += rowBytes;
  1234. };
  1235. PredictorStream.prototype.readBlockPng = function predictorStreamReadBlockPng() {
  1236. var rowBytes = this.rowBytes;
  1237. var pixBytes = this.pixBytes;
  1238. var predictor = this.str.getByte();
  1239. var rawBytes = this.str.getBytes(rowBytes);
  1240. this.eof = !rawBytes.length;
  1241. if (this.eof) {
  1242. return;
  1243. }
  1244. var bufferLength = this.bufferLength;
  1245. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  1246. var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  1247. if (prevRow.length === 0) {
  1248. prevRow = new Uint8Array(rowBytes);
  1249. }
  1250. var i, j = bufferLength, up, c;
  1251. switch (predictor) {
  1252. case 0:
  1253. for (i = 0; i < rowBytes; ++i) {
  1254. buffer[j++] = rawBytes[i];
  1255. }
  1256. break;
  1257. case 1:
  1258. for (i = 0; i < pixBytes; ++i) {
  1259. buffer[j++] = rawBytes[i];
  1260. }
  1261. for (; i < rowBytes; ++i) {
  1262. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xFF;
  1263. j++;
  1264. }
  1265. break;
  1266. case 2:
  1267. for (i = 0; i < rowBytes; ++i) {
  1268. buffer[j++] = prevRow[i] + rawBytes[i] & 0xFF;
  1269. }
  1270. break;
  1271. case 3:
  1272. for (i = 0; i < pixBytes; ++i) {
  1273. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  1274. }
  1275. for (; i < rowBytes; ++i) {
  1276. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xFF;
  1277. j++;
  1278. }
  1279. break;
  1280. case 4:
  1281. for (i = 0; i < pixBytes; ++i) {
  1282. up = prevRow[i];
  1283. c = rawBytes[i];
  1284. buffer[j++] = up + c;
  1285. }
  1286. for (; i < rowBytes; ++i) {
  1287. up = prevRow[i];
  1288. var upLeft = prevRow[i - pixBytes];
  1289. var left = buffer[j - pixBytes];
  1290. var p = left + up - upLeft;
  1291. var pa = p - left;
  1292. if (pa < 0) {
  1293. pa = -pa;
  1294. }
  1295. var pb = p - up;
  1296. if (pb < 0) {
  1297. pb = -pb;
  1298. }
  1299. var pc = p - upLeft;
  1300. if (pc < 0) {
  1301. pc = -pc;
  1302. }
  1303. c = rawBytes[i];
  1304. if (pa <= pb && pa <= pc) {
  1305. buffer[j++] = left + c;
  1306. } else if (pb <= pc) {
  1307. buffer[j++] = up + c;
  1308. } else {
  1309. buffer[j++] = upLeft + c;
  1310. }
  1311. }
  1312. break;
  1313. default:
  1314. error('Unsupported predictor: ' + predictor);
  1315. }
  1316. this.bufferLength += rowBytes;
  1317. };
  1318. return PredictorStream;
  1319. }();
  1320. var JpegStream = function JpegStreamClosure() {
  1321. function JpegStream(stream, maybeLength, dict, params) {
  1322. var ch;
  1323. while ((ch = stream.getByte()) !== -1) {
  1324. if (ch === 0xFF) {
  1325. stream.skip(-1);
  1326. break;
  1327. }
  1328. }
  1329. this.stream = stream;
  1330. this.maybeLength = maybeLength;
  1331. this.dict = dict;
  1332. this.params = params;
  1333. DecodeStream.call(this, maybeLength);
  1334. }
  1335. JpegStream.prototype = Object.create(DecodeStream.prototype);
  1336. Object.defineProperty(JpegStream.prototype, 'bytes', {
  1337. get: function JpegStream_bytes() {
  1338. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  1339. },
  1340. configurable: true
  1341. });
  1342. JpegStream.prototype.ensureBuffer = function JpegStream_ensureBuffer(req) {
  1343. if (this.bufferLength) {
  1344. return;
  1345. }
  1346. var jpegImage = new JpegImage();
  1347. var decodeArr = this.dict.getArray('Decode', 'D');
  1348. if (this.forceRGB && isArray(decodeArr)) {
  1349. var bitsPerComponent = this.dict.get('BitsPerComponent') || 8;
  1350. var decodeArrLength = decodeArr.length;
  1351. var transform = new Int32Array(decodeArrLength);
  1352. var transformNeeded = false;
  1353. var maxValue = (1 << bitsPerComponent) - 1;
  1354. for (var i = 0; i < decodeArrLength; i += 2) {
  1355. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  1356. transform[i + 1] = decodeArr[i] * maxValue | 0;
  1357. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  1358. transformNeeded = true;
  1359. }
  1360. }
  1361. if (transformNeeded) {
  1362. jpegImage.decodeTransform = transform;
  1363. }
  1364. }
  1365. if (isDict(this.params)) {
  1366. var colorTransform = this.params.get('ColorTransform');
  1367. if (isInt(colorTransform)) {
  1368. jpegImage.colorTransform = colorTransform;
  1369. }
  1370. }
  1371. jpegImage.parse(this.bytes);
  1372. var data = jpegImage.getData(this.drawWidth, this.drawHeight, this.forceRGB);
  1373. this.buffer = data;
  1374. this.bufferLength = data.length;
  1375. this.eof = true;
  1376. };
  1377. JpegStream.prototype.getBytes = function JpegStream_getBytes(length) {
  1378. this.ensureBuffer();
  1379. return this.buffer;
  1380. };
  1381. JpegStream.prototype.getIR = function JpegStream_getIR(forceDataSchema) {
  1382. return createObjectURL(this.bytes, 'image/jpeg', forceDataSchema);
  1383. };
  1384. return JpegStream;
  1385. }();
  1386. var JpxStream = function JpxStreamClosure() {
  1387. function JpxStream(stream, maybeLength, dict, params) {
  1388. this.stream = stream;
  1389. this.maybeLength = maybeLength;
  1390. this.dict = dict;
  1391. this.params = params;
  1392. DecodeStream.call(this, maybeLength);
  1393. }
  1394. JpxStream.prototype = Object.create(DecodeStream.prototype);
  1395. Object.defineProperty(JpxStream.prototype, 'bytes', {
  1396. get: function JpxStream_bytes() {
  1397. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  1398. },
  1399. configurable: true
  1400. });
  1401. JpxStream.prototype.ensureBuffer = function JpxStream_ensureBuffer(req) {
  1402. if (this.bufferLength) {
  1403. return;
  1404. }
  1405. var jpxImage = new JpxImage();
  1406. jpxImage.parse(this.bytes);
  1407. var width = jpxImage.width;
  1408. var height = jpxImage.height;
  1409. var componentsCount = jpxImage.componentsCount;
  1410. var tileCount = jpxImage.tiles.length;
  1411. if (tileCount === 1) {
  1412. this.buffer = jpxImage.tiles[0].items;
  1413. } else {
  1414. var data = new Uint8Array(width * height * componentsCount);
  1415. for (var k = 0; k < tileCount; k++) {
  1416. var tileComponents = jpxImage.tiles[k];
  1417. var tileWidth = tileComponents.width;
  1418. var tileHeight = tileComponents.height;
  1419. var tileLeft = tileComponents.left;
  1420. var tileTop = tileComponents.top;
  1421. var src = tileComponents.items;
  1422. var srcPosition = 0;
  1423. var dataPosition = (width * tileTop + tileLeft) * componentsCount;
  1424. var imgRowSize = width * componentsCount;
  1425. var tileRowSize = tileWidth * componentsCount;
  1426. for (var j = 0; j < tileHeight; j++) {
  1427. var rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  1428. data.set(rowBytes, dataPosition);
  1429. srcPosition += tileRowSize;
  1430. dataPosition += imgRowSize;
  1431. }
  1432. }
  1433. this.buffer = data;
  1434. }
  1435. this.bufferLength = this.buffer.length;
  1436. this.eof = true;
  1437. };
  1438. return JpxStream;
  1439. }();
  1440. var Jbig2Stream = function Jbig2StreamClosure() {
  1441. function Jbig2Stream(stream, maybeLength, dict, params) {
  1442. this.stream = stream;
  1443. this.maybeLength = maybeLength;
  1444. this.dict = dict;
  1445. this.params = params;
  1446. DecodeStream.call(this, maybeLength);
  1447. }
  1448. Jbig2Stream.prototype = Object.create(DecodeStream.prototype);
  1449. Object.defineProperty(Jbig2Stream.prototype, 'bytes', {
  1450. get: function Jbig2Stream_bytes() {
  1451. return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength));
  1452. },
  1453. configurable: true
  1454. });
  1455. Jbig2Stream.prototype.ensureBuffer = function Jbig2Stream_ensureBuffer(req) {
  1456. if (this.bufferLength) {
  1457. return;
  1458. }
  1459. var jbig2Image = new Jbig2Image();
  1460. var chunks = [];
  1461. if (isDict(this.params)) {
  1462. var globalsStream = this.params.get('JBIG2Globals');
  1463. if (isStream(globalsStream)) {
  1464. var globals = globalsStream.getBytes();
  1465. chunks.push({
  1466. data: globals,
  1467. start: 0,
  1468. end: globals.length
  1469. });
  1470. }
  1471. }
  1472. chunks.push({
  1473. data: this.bytes,
  1474. start: 0,
  1475. end: this.bytes.length
  1476. });
  1477. var data = jbig2Image.parseChunks(chunks);
  1478. var dataLength = data.length;
  1479. for (var i = 0; i < dataLength; i++) {
  1480. data[i] ^= 0xFF;
  1481. }
  1482. this.buffer = data;
  1483. this.bufferLength = dataLength;
  1484. this.eof = true;
  1485. };
  1486. return Jbig2Stream;
  1487. }();
  1488. var DecryptStream = function DecryptStreamClosure() {
  1489. function DecryptStream(str, maybeLength, decrypt) {
  1490. this.str = str;
  1491. this.dict = str.dict;
  1492. this.decrypt = decrypt;
  1493. this.nextChunk = null;
  1494. this.initialized = false;
  1495. DecodeStream.call(this, maybeLength);
  1496. }
  1497. var chunkSize = 512;
  1498. DecryptStream.prototype = Object.create(DecodeStream.prototype);
  1499. DecryptStream.prototype.readBlock = function DecryptStream_readBlock() {
  1500. var chunk;
  1501. if (this.initialized) {
  1502. chunk = this.nextChunk;
  1503. } else {
  1504. chunk = this.str.getBytes(chunkSize);
  1505. this.initialized = true;
  1506. }
  1507. if (!chunk || chunk.length === 0) {
  1508. this.eof = true;
  1509. return;
  1510. }
  1511. this.nextChunk = this.str.getBytes(chunkSize);
  1512. var hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  1513. var decrypt = this.decrypt;
  1514. chunk = decrypt(chunk, !hasMoreData);
  1515. var bufferLength = this.bufferLength;
  1516. var i, n = chunk.length;
  1517. var buffer = this.ensureBuffer(bufferLength + n);
  1518. for (i = 0; i < n; i++) {
  1519. buffer[bufferLength++] = chunk[i];
  1520. }
  1521. this.bufferLength = bufferLength;
  1522. };
  1523. return DecryptStream;
  1524. }();
  1525. var Ascii85Stream = function Ascii85StreamClosure() {
  1526. function Ascii85Stream(str, maybeLength) {
  1527. this.str = str;
  1528. this.dict = str.dict;
  1529. this.input = new Uint8Array(5);
  1530. if (maybeLength) {
  1531. maybeLength = 0.8 * maybeLength;
  1532. }
  1533. DecodeStream.call(this, maybeLength);
  1534. }
  1535. Ascii85Stream.prototype = Object.create(DecodeStream.prototype);
  1536. Ascii85Stream.prototype.readBlock = function Ascii85Stream_readBlock() {
  1537. var TILDA_CHAR = 0x7E;
  1538. var Z_LOWER_CHAR = 0x7A;
  1539. var EOF = -1;
  1540. var str = this.str;
  1541. var c = str.getByte();
  1542. while (isSpace(c)) {
  1543. c = str.getByte();
  1544. }
  1545. if (c === EOF || c === TILDA_CHAR) {
  1546. this.eof = true;
  1547. return;
  1548. }
  1549. var bufferLength = this.bufferLength, buffer;
  1550. var i;
  1551. if (c === Z_LOWER_CHAR) {
  1552. buffer = this.ensureBuffer(bufferLength + 4);
  1553. for (i = 0; i < 4; ++i) {
  1554. buffer[bufferLength + i] = 0;
  1555. }
  1556. this.bufferLength += 4;
  1557. } else {
  1558. var input = this.input;
  1559. input[0] = c;
  1560. for (i = 1; i < 5; ++i) {
  1561. c = str.getByte();
  1562. while (isSpace(c)) {
  1563. c = str.getByte();
  1564. }
  1565. input[i] = c;
  1566. if (c === EOF || c === TILDA_CHAR) {
  1567. break;
  1568. }
  1569. }
  1570. buffer = this.ensureBuffer(bufferLength + i - 1);
  1571. this.bufferLength += i - 1;
  1572. if (i < 5) {
  1573. for (; i < 5; ++i) {
  1574. input[i] = 0x21 + 84;
  1575. }
  1576. this.eof = true;
  1577. }
  1578. var t = 0;
  1579. for (i = 0; i < 5; ++i) {
  1580. t = t * 85 + (input[i] - 0x21);
  1581. }
  1582. for (i = 3; i >= 0; --i) {
  1583. buffer[bufferLength + i] = t & 0xFF;
  1584. t >>= 8;
  1585. }
  1586. }
  1587. };
  1588. return Ascii85Stream;
  1589. }();
  1590. var AsciiHexStream = function AsciiHexStreamClosure() {
  1591. function AsciiHexStream(str, maybeLength) {
  1592. this.str = str;
  1593. this.dict = str.dict;
  1594. this.firstDigit = -1;
  1595. if (maybeLength) {
  1596. maybeLength = 0.5 * maybeLength;
  1597. }
  1598. DecodeStream.call(this, maybeLength);
  1599. }
  1600. AsciiHexStream.prototype = Object.create(DecodeStream.prototype);
  1601. AsciiHexStream.prototype.readBlock = function AsciiHexStream_readBlock() {
  1602. var UPSTREAM_BLOCK_SIZE = 8000;
  1603. var bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  1604. if (!bytes.length) {
  1605. this.eof = true;
  1606. return;
  1607. }
  1608. var maxDecodeLength = bytes.length + 1 >> 1;
  1609. var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  1610. var bufferLength = this.bufferLength;
  1611. var firstDigit = this.firstDigit;
  1612. for (var i = 0, ii = bytes.length; i < ii; i++) {
  1613. var ch = bytes[i], digit;
  1614. if (ch >= 0x30 && ch <= 0x39) {
  1615. digit = ch & 0x0F;
  1616. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  1617. digit = (ch & 0x0F) + 9;
  1618. } else if (ch === 0x3E) {
  1619. this.eof = true;
  1620. break;
  1621. } else {
  1622. continue;
  1623. }
  1624. if (firstDigit < 0) {
  1625. firstDigit = digit;
  1626. } else {
  1627. buffer[bufferLength++] = firstDigit << 4 | digit;
  1628. firstDigit = -1;
  1629. }
  1630. }
  1631. if (firstDigit >= 0 && this.eof) {
  1632. buffer[bufferLength++] = firstDigit << 4;
  1633. firstDigit = -1;
  1634. }
  1635. this.firstDigit = firstDigit;
  1636. this.bufferLength = bufferLength;
  1637. };
  1638. return AsciiHexStream;
  1639. }();
  1640. var RunLengthStream = function RunLengthStreamClosure() {
  1641. function RunLengthStream(str, maybeLength) {
  1642. this.str = str;
  1643. this.dict = str.dict;
  1644. DecodeStream.call(this, maybeLength);
  1645. }
  1646. RunLengthStream.prototype = Object.create(DecodeStream.prototype);
  1647. RunLengthStream.prototype.readBlock = function RunLengthStream_readBlock() {
  1648. var repeatHeader = this.str.getBytes(2);
  1649. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  1650. this.eof = true;
  1651. return;
  1652. }
  1653. var buffer;
  1654. var bufferLength = this.bufferLength;
  1655. var n = repeatHeader[0];
  1656. if (n < 128) {
  1657. buffer = this.ensureBuffer(bufferLength + n + 1);
  1658. buffer[bufferLength++] = repeatHeader[1];
  1659. if (n > 0) {
  1660. var source = this.str.getBytes(n);
  1661. buffer.set(source, bufferLength);
  1662. bufferLength += n;
  1663. }
  1664. } else {
  1665. n = 257 - n;
  1666. var b = repeatHeader[1];
  1667. buffer = this.ensureBuffer(bufferLength + n + 1);
  1668. for (var i = 0; i < n; i++) {
  1669. buffer[bufferLength++] = b;
  1670. }
  1671. }
  1672. this.bufferLength = bufferLength;
  1673. };
  1674. return RunLengthStream;
  1675. }();
  1676. var CCITTFaxStream = function CCITTFaxStreamClosure() {
  1677. var ccittEOL = -2;
  1678. var ccittEOF = -1;
  1679. var twoDimPass = 0;
  1680. var twoDimHoriz = 1;
  1681. var twoDimVert0 = 2;
  1682. var twoDimVertR1 = 3;
  1683. var twoDimVertL1 = 4;
  1684. var twoDimVertR2 = 5;
  1685. var twoDimVertL2 = 6;
  1686. var twoDimVertR3 = 7;
  1687. var twoDimVertL3 = 8;
  1688. var twoDimTable = [
  1689. [
  1690. -1,
  1691. -1
  1692. ],
  1693. [
  1694. -1,
  1695. -1
  1696. ],
  1697. [
  1698. 7,
  1699. twoDimVertL3
  1700. ],
  1701. [
  1702. 7,
  1703. twoDimVertR3
  1704. ],
  1705. [
  1706. 6,
  1707. twoDimVertL2
  1708. ],
  1709. [
  1710. 6,
  1711. twoDimVertL2
  1712. ],
  1713. [
  1714. 6,
  1715. twoDimVertR2
  1716. ],
  1717. [
  1718. 6,
  1719. twoDimVertR2
  1720. ],
  1721. [
  1722. 4,
  1723. twoDimPass
  1724. ],
  1725. [
  1726. 4,
  1727. twoDimPass
  1728. ],
  1729. [
  1730. 4,
  1731. twoDimPass
  1732. ],
  1733. [
  1734. 4,
  1735. twoDimPass
  1736. ],
  1737. [
  1738. 4,
  1739. twoDimPass
  1740. ],
  1741. [
  1742. 4,
  1743. twoDimPass
  1744. ],
  1745. [
  1746. 4,
  1747. twoDimPass
  1748. ],
  1749. [
  1750. 4,
  1751. twoDimPass
  1752. ],
  1753. [
  1754. 3,
  1755. twoDimHoriz
  1756. ],
  1757. [
  1758. 3,
  1759. twoDimHoriz
  1760. ],
  1761. [
  1762. 3,
  1763. twoDimHoriz
  1764. ],
  1765. [
  1766. 3,
  1767. twoDimHoriz
  1768. ],
  1769. [
  1770. 3,
  1771. twoDimHoriz
  1772. ],
  1773. [
  1774. 3,
  1775. twoDimHoriz
  1776. ],
  1777. [
  1778. 3,
  1779. twoDimHoriz
  1780. ],
  1781. [
  1782. 3,
  1783. twoDimHoriz
  1784. ],
  1785. [
  1786. 3,
  1787. twoDimHoriz
  1788. ],
  1789. [
  1790. 3,
  1791. twoDimHoriz
  1792. ],
  1793. [
  1794. 3,
  1795. twoDimHoriz
  1796. ],
  1797. [
  1798. 3,
  1799. twoDimHoriz
  1800. ],
  1801. [
  1802. 3,
  1803. twoDimHoriz
  1804. ],
  1805. [
  1806. 3,
  1807. twoDimHoriz
  1808. ],
  1809. [
  1810. 3,
  1811. twoDimHoriz
  1812. ],
  1813. [
  1814. 3,
  1815. twoDimHoriz
  1816. ],
  1817. [
  1818. 3,
  1819. twoDimVertL1
  1820. ],
  1821. [
  1822. 3,
  1823. twoDimVertL1
  1824. ],
  1825. [
  1826. 3,
  1827. twoDimVertL1
  1828. ],
  1829. [
  1830. 3,
  1831. twoDimVertL1
  1832. ],
  1833. [
  1834. 3,
  1835. twoDimVertL1
  1836. ],
  1837. [
  1838. 3,
  1839. twoDimVertL1
  1840. ],
  1841. [
  1842. 3,
  1843. twoDimVertL1
  1844. ],
  1845. [
  1846. 3,
  1847. twoDimVertL1
  1848. ],
  1849. [
  1850. 3,
  1851. twoDimVertL1
  1852. ],
  1853. [
  1854. 3,
  1855. twoDimVertL1
  1856. ],
  1857. [
  1858. 3,
  1859. twoDimVertL1
  1860. ],
  1861. [
  1862. 3,
  1863. twoDimVertL1
  1864. ],
  1865. [
  1866. 3,
  1867. twoDimVertL1
  1868. ],
  1869. [
  1870. 3,
  1871. twoDimVertL1
  1872. ],
  1873. [
  1874. 3,
  1875. twoDimVertL1
  1876. ],
  1877. [
  1878. 3,
  1879. twoDimVertL1
  1880. ],
  1881. [
  1882. 3,
  1883. twoDimVertR1
  1884. ],
  1885. [
  1886. 3,
  1887. twoDimVertR1
  1888. ],
  1889. [
  1890. 3,
  1891. twoDimVertR1
  1892. ],
  1893. [
  1894. 3,
  1895. twoDimVertR1
  1896. ],
  1897. [
  1898. 3,
  1899. twoDimVertR1
  1900. ],
  1901. [
  1902. 3,
  1903. twoDimVertR1
  1904. ],
  1905. [
  1906. 3,
  1907. twoDimVertR1
  1908. ],
  1909. [
  1910. 3,
  1911. twoDimVertR1
  1912. ],
  1913. [
  1914. 3,
  1915. twoDimVertR1
  1916. ],
  1917. [
  1918. 3,
  1919. twoDimVertR1
  1920. ],
  1921. [
  1922. 3,
  1923. twoDimVertR1
  1924. ],
  1925. [
  1926. 3,
  1927. twoDimVertR1
  1928. ],
  1929. [
  1930. 3,
  1931. twoDimVertR1
  1932. ],
  1933. [
  1934. 3,
  1935. twoDimVertR1
  1936. ],
  1937. [
  1938. 3,
  1939. twoDimVertR1
  1940. ],
  1941. [
  1942. 3,
  1943. twoDimVertR1
  1944. ],
  1945. [
  1946. 1,
  1947. twoDimVert0
  1948. ],
  1949. [
  1950. 1,
  1951. twoDimVert0
  1952. ],
  1953. [
  1954. 1,
  1955. twoDimVert0
  1956. ],
  1957. [
  1958. 1,
  1959. twoDimVert0
  1960. ],
  1961. [
  1962. 1,
  1963. twoDimVert0
  1964. ],
  1965. [
  1966. 1,
  1967. twoDimVert0
  1968. ],
  1969. [
  1970. 1,
  1971. twoDimVert0
  1972. ],
  1973. [
  1974. 1,
  1975. twoDimVert0
  1976. ],
  1977. [
  1978. 1,
  1979. twoDimVert0
  1980. ],
  1981. [
  1982. 1,
  1983. twoDimVert0
  1984. ],
  1985. [
  1986. 1,
  1987. twoDimVert0
  1988. ],
  1989. [
  1990. 1,
  1991. twoDimVert0
  1992. ],
  1993. [
  1994. 1,
  1995. twoDimVert0
  1996. ],
  1997. [
  1998. 1,
  1999. twoDimVert0
  2000. ],
  2001. [
  2002. 1,
  2003. twoDimVert0
  2004. ],
  2005. [
  2006. 1,
  2007. twoDimVert0
  2008. ],
  2009. [
  2010. 1,
  2011. twoDimVert0
  2012. ],
  2013. [
  2014. 1,
  2015. twoDimVert0
  2016. ],
  2017. [
  2018. 1,
  2019. twoDimVert0
  2020. ],
  2021. [
  2022. 1,
  2023. twoDimVert0
  2024. ],
  2025. [
  2026. 1,
  2027. twoDimVert0
  2028. ],
  2029. [
  2030. 1,
  2031. twoDimVert0
  2032. ],
  2033. [
  2034. 1,
  2035. twoDimVert0
  2036. ],
  2037. [
  2038. 1,
  2039. twoDimVert0
  2040. ],
  2041. [
  2042. 1,
  2043. twoDimVert0
  2044. ],
  2045. [
  2046. 1,
  2047. twoDimVert0
  2048. ],
  2049. [
  2050. 1,
  2051. twoDimVert0
  2052. ],
  2053. [
  2054. 1,
  2055. twoDimVert0
  2056. ],
  2057. [
  2058. 1,
  2059. twoDimVert0
  2060. ],
  2061. [
  2062. 1,
  2063. twoDimVert0
  2064. ],
  2065. [
  2066. 1,
  2067. twoDimVert0
  2068. ],
  2069. [
  2070. 1,
  2071. twoDimVert0
  2072. ],
  2073. [
  2074. 1,
  2075. twoDimVert0
  2076. ],
  2077. [
  2078. 1,
  2079. twoDimVert0
  2080. ],
  2081. [
  2082. 1,
  2083. twoDimVert0
  2084. ],
  2085. [
  2086. 1,
  2087. twoDimVert0
  2088. ],
  2089. [
  2090. 1,
  2091. twoDimVert0
  2092. ],
  2093. [
  2094. 1,
  2095. twoDimVert0
  2096. ],
  2097. [
  2098. 1,
  2099. twoDimVert0
  2100. ],
  2101. [
  2102. 1,
  2103. twoDimVert0
  2104. ],
  2105. [
  2106. 1,
  2107. twoDimVert0
  2108. ],
  2109. [
  2110. 1,
  2111. twoDimVert0
  2112. ],
  2113. [
  2114. 1,
  2115. twoDimVert0
  2116. ],
  2117. [
  2118. 1,
  2119. twoDimVert0
  2120. ],
  2121. [
  2122. 1,
  2123. twoDimVert0
  2124. ],
  2125. [
  2126. 1,
  2127. twoDimVert0
  2128. ],
  2129. [
  2130. 1,
  2131. twoDimVert0
  2132. ],
  2133. [
  2134. 1,
  2135. twoDimVert0
  2136. ],
  2137. [
  2138. 1,
  2139. twoDimVert0
  2140. ],
  2141. [
  2142. 1,
  2143. twoDimVert0
  2144. ],
  2145. [
  2146. 1,
  2147. twoDimVert0
  2148. ],
  2149. [
  2150. 1,
  2151. twoDimVert0
  2152. ],
  2153. [
  2154. 1,
  2155. twoDimVert0
  2156. ],
  2157. [
  2158. 1,
  2159. twoDimVert0
  2160. ],
  2161. [
  2162. 1,
  2163. twoDimVert0
  2164. ],
  2165. [
  2166. 1,
  2167. twoDimVert0
  2168. ],
  2169. [
  2170. 1,
  2171. twoDimVert0
  2172. ],
  2173. [
  2174. 1,
  2175. twoDimVert0
  2176. ],
  2177. [
  2178. 1,
  2179. twoDimVert0
  2180. ],
  2181. [
  2182. 1,
  2183. twoDimVert0
  2184. ],
  2185. [
  2186. 1,
  2187. twoDimVert0
  2188. ],
  2189. [
  2190. 1,
  2191. twoDimVert0
  2192. ],
  2193. [
  2194. 1,
  2195. twoDimVert0
  2196. ],
  2197. [
  2198. 1,
  2199. twoDimVert0
  2200. ]
  2201. ];
  2202. var whiteTable1 = [
  2203. [
  2204. -1,
  2205. -1
  2206. ],
  2207. [
  2208. 12,
  2209. ccittEOL
  2210. ],
  2211. [
  2212. -1,
  2213. -1
  2214. ],
  2215. [
  2216. -1,
  2217. -1
  2218. ],
  2219. [
  2220. -1,
  2221. -1
  2222. ],
  2223. [
  2224. -1,
  2225. -1
  2226. ],
  2227. [
  2228. -1,
  2229. -1
  2230. ],
  2231. [
  2232. -1,
  2233. -1
  2234. ],
  2235. [
  2236. -1,
  2237. -1
  2238. ],
  2239. [
  2240. -1,
  2241. -1
  2242. ],
  2243. [
  2244. -1,
  2245. -1
  2246. ],
  2247. [
  2248. -1,
  2249. -1
  2250. ],
  2251. [
  2252. -1,
  2253. -1
  2254. ],
  2255. [
  2256. -1,
  2257. -1
  2258. ],
  2259. [
  2260. -1,
  2261. -1
  2262. ],
  2263. [
  2264. -1,
  2265. -1
  2266. ],
  2267. [
  2268. 11,
  2269. 1792
  2270. ],
  2271. [
  2272. 11,
  2273. 1792
  2274. ],
  2275. [
  2276. 12,
  2277. 1984
  2278. ],
  2279. [
  2280. 12,
  2281. 2048
  2282. ],
  2283. [
  2284. 12,
  2285. 2112
  2286. ],
  2287. [
  2288. 12,
  2289. 2176
  2290. ],
  2291. [
  2292. 12,
  2293. 2240
  2294. ],
  2295. [
  2296. 12,
  2297. 2304
  2298. ],
  2299. [
  2300. 11,
  2301. 1856
  2302. ],
  2303. [
  2304. 11,
  2305. 1856
  2306. ],
  2307. [
  2308. 11,
  2309. 1920
  2310. ],
  2311. [
  2312. 11,
  2313. 1920
  2314. ],
  2315. [
  2316. 12,
  2317. 2368
  2318. ],
  2319. [
  2320. 12,
  2321. 2432
  2322. ],
  2323. [
  2324. 12,
  2325. 2496
  2326. ],
  2327. [
  2328. 12,
  2329. 2560
  2330. ]
  2331. ];
  2332. var whiteTable2 = [
  2333. [
  2334. -1,
  2335. -1
  2336. ],
  2337. [
  2338. -1,
  2339. -1
  2340. ],
  2341. [
  2342. -1,
  2343. -1
  2344. ],
  2345. [
  2346. -1,
  2347. -1
  2348. ],
  2349. [
  2350. 8,
  2351. 29
  2352. ],
  2353. [
  2354. 8,
  2355. 29
  2356. ],
  2357. [
  2358. 8,
  2359. 30
  2360. ],
  2361. [
  2362. 8,
  2363. 30
  2364. ],
  2365. [
  2366. 8,
  2367. 45
  2368. ],
  2369. [
  2370. 8,
  2371. 45
  2372. ],
  2373. [
  2374. 8,
  2375. 46
  2376. ],
  2377. [
  2378. 8,
  2379. 46
  2380. ],
  2381. [
  2382. 7,
  2383. 22
  2384. ],
  2385. [
  2386. 7,
  2387. 22
  2388. ],
  2389. [
  2390. 7,
  2391. 22
  2392. ],
  2393. [
  2394. 7,
  2395. 22
  2396. ],
  2397. [
  2398. 7,
  2399. 23
  2400. ],
  2401. [
  2402. 7,
  2403. 23
  2404. ],
  2405. [
  2406. 7,
  2407. 23
  2408. ],
  2409. [
  2410. 7,
  2411. 23
  2412. ],
  2413. [
  2414. 8,
  2415. 47
  2416. ],
  2417. [
  2418. 8,
  2419. 47
  2420. ],
  2421. [
  2422. 8,
  2423. 48
  2424. ],
  2425. [
  2426. 8,
  2427. 48
  2428. ],
  2429. [
  2430. 6,
  2431. 13
  2432. ],
  2433. [
  2434. 6,
  2435. 13
  2436. ],
  2437. [
  2438. 6,
  2439. 13
  2440. ],
  2441. [
  2442. 6,
  2443. 13
  2444. ],
  2445. [
  2446. 6,
  2447. 13
  2448. ],
  2449. [
  2450. 6,
  2451. 13
  2452. ],
  2453. [
  2454. 6,
  2455. 13
  2456. ],
  2457. [
  2458. 6,
  2459. 13
  2460. ],
  2461. [
  2462. 7,
  2463. 20
  2464. ],
  2465. [
  2466. 7,
  2467. 20
  2468. ],
  2469. [
  2470. 7,
  2471. 20
  2472. ],
  2473. [
  2474. 7,
  2475. 20
  2476. ],
  2477. [
  2478. 8,
  2479. 33
  2480. ],
  2481. [
  2482. 8,
  2483. 33
  2484. ],
  2485. [
  2486. 8,
  2487. 34
  2488. ],
  2489. [
  2490. 8,
  2491. 34
  2492. ],
  2493. [
  2494. 8,
  2495. 35
  2496. ],
  2497. [
  2498. 8,
  2499. 35
  2500. ],
  2501. [
  2502. 8,
  2503. 36
  2504. ],
  2505. [
  2506. 8,
  2507. 36
  2508. ],
  2509. [
  2510. 8,
  2511. 37
  2512. ],
  2513. [
  2514. 8,
  2515. 37
  2516. ],
  2517. [
  2518. 8,
  2519. 38
  2520. ],
  2521. [
  2522. 8,
  2523. 38
  2524. ],
  2525. [
  2526. 7,
  2527. 19
  2528. ],
  2529. [
  2530. 7,
  2531. 19
  2532. ],
  2533. [
  2534. 7,
  2535. 19
  2536. ],
  2537. [
  2538. 7,
  2539. 19
  2540. ],
  2541. [
  2542. 8,
  2543. 31
  2544. ],
  2545. [
  2546. 8,
  2547. 31
  2548. ],
  2549. [
  2550. 8,
  2551. 32
  2552. ],
  2553. [
  2554. 8,
  2555. 32
  2556. ],
  2557. [
  2558. 6,
  2559. 1
  2560. ],
  2561. [
  2562. 6,
  2563. 1
  2564. ],
  2565. [
  2566. 6,
  2567. 1
  2568. ],
  2569. [
  2570. 6,
  2571. 1
  2572. ],
  2573. [
  2574. 6,
  2575. 1
  2576. ],
  2577. [
  2578. 6,
  2579. 1
  2580. ],
  2581. [
  2582. 6,
  2583. 1
  2584. ],
  2585. [
  2586. 6,
  2587. 1
  2588. ],
  2589. [
  2590. 6,
  2591. 12
  2592. ],
  2593. [
  2594. 6,
  2595. 12
  2596. ],
  2597. [
  2598. 6,
  2599. 12
  2600. ],
  2601. [
  2602. 6,
  2603. 12
  2604. ],
  2605. [
  2606. 6,
  2607. 12
  2608. ],
  2609. [
  2610. 6,
  2611. 12
  2612. ],
  2613. [
  2614. 6,
  2615. 12
  2616. ],
  2617. [
  2618. 6,
  2619. 12
  2620. ],
  2621. [
  2622. 8,
  2623. 53
  2624. ],
  2625. [
  2626. 8,
  2627. 53
  2628. ],
  2629. [
  2630. 8,
  2631. 54
  2632. ],
  2633. [
  2634. 8,
  2635. 54
  2636. ],
  2637. [
  2638. 7,
  2639. 26
  2640. ],
  2641. [
  2642. 7,
  2643. 26
  2644. ],
  2645. [
  2646. 7,
  2647. 26
  2648. ],
  2649. [
  2650. 7,
  2651. 26
  2652. ],
  2653. [
  2654. 8,
  2655. 39
  2656. ],
  2657. [
  2658. 8,
  2659. 39
  2660. ],
  2661. [
  2662. 8,
  2663. 40
  2664. ],
  2665. [
  2666. 8,
  2667. 40
  2668. ],
  2669. [
  2670. 8,
  2671. 41
  2672. ],
  2673. [
  2674. 8,
  2675. 41
  2676. ],
  2677. [
  2678. 8,
  2679. 42
  2680. ],
  2681. [
  2682. 8,
  2683. 42
  2684. ],
  2685. [
  2686. 8,
  2687. 43
  2688. ],
  2689. [
  2690. 8,
  2691. 43
  2692. ],
  2693. [
  2694. 8,
  2695. 44
  2696. ],
  2697. [
  2698. 8,
  2699. 44
  2700. ],
  2701. [
  2702. 7,
  2703. 21
  2704. ],
  2705. [
  2706. 7,
  2707. 21
  2708. ],
  2709. [
  2710. 7,
  2711. 21
  2712. ],
  2713. [
  2714. 7,
  2715. 21
  2716. ],
  2717. [
  2718. 7,
  2719. 28
  2720. ],
  2721. [
  2722. 7,
  2723. 28
  2724. ],
  2725. [
  2726. 7,
  2727. 28
  2728. ],
  2729. [
  2730. 7,
  2731. 28
  2732. ],
  2733. [
  2734. 8,
  2735. 61
  2736. ],
  2737. [
  2738. 8,
  2739. 61
  2740. ],
  2741. [
  2742. 8,
  2743. 62
  2744. ],
  2745. [
  2746. 8,
  2747. 62
  2748. ],
  2749. [
  2750. 8,
  2751. 63
  2752. ],
  2753. [
  2754. 8,
  2755. 63
  2756. ],
  2757. [
  2758. 8,
  2759. 0
  2760. ],
  2761. [
  2762. 8,
  2763. 0
  2764. ],
  2765. [
  2766. 8,
  2767. 320
  2768. ],
  2769. [
  2770. 8,
  2771. 320
  2772. ],
  2773. [
  2774. 8,
  2775. 384
  2776. ],
  2777. [
  2778. 8,
  2779. 384
  2780. ],
  2781. [
  2782. 5,
  2783. 10
  2784. ],
  2785. [
  2786. 5,
  2787. 10
  2788. ],
  2789. [
  2790. 5,
  2791. 10
  2792. ],
  2793. [
  2794. 5,
  2795. 10
  2796. ],
  2797. [
  2798. 5,
  2799. 10
  2800. ],
  2801. [
  2802. 5,
  2803. 10
  2804. ],
  2805. [
  2806. 5,
  2807. 10
  2808. ],
  2809. [
  2810. 5,
  2811. 10
  2812. ],
  2813. [
  2814. 5,
  2815. 10
  2816. ],
  2817. [
  2818. 5,
  2819. 10
  2820. ],
  2821. [
  2822. 5,
  2823. 10
  2824. ],
  2825. [
  2826. 5,
  2827. 10
  2828. ],
  2829. [
  2830. 5,
  2831. 10
  2832. ],
  2833. [
  2834. 5,
  2835. 10
  2836. ],
  2837. [
  2838. 5,
  2839. 10
  2840. ],
  2841. [
  2842. 5,
  2843. 10
  2844. ],
  2845. [
  2846. 5,
  2847. 11
  2848. ],
  2849. [
  2850. 5,
  2851. 11
  2852. ],
  2853. [
  2854. 5,
  2855. 11
  2856. ],
  2857. [
  2858. 5,
  2859. 11
  2860. ],
  2861. [
  2862. 5,
  2863. 11
  2864. ],
  2865. [
  2866. 5,
  2867. 11
  2868. ],
  2869. [
  2870. 5,
  2871. 11
  2872. ],
  2873. [
  2874. 5,
  2875. 11
  2876. ],
  2877. [
  2878. 5,
  2879. 11
  2880. ],
  2881. [
  2882. 5,
  2883. 11
  2884. ],
  2885. [
  2886. 5,
  2887. 11
  2888. ],
  2889. [
  2890. 5,
  2891. 11
  2892. ],
  2893. [
  2894. 5,
  2895. 11
  2896. ],
  2897. [
  2898. 5,
  2899. 11
  2900. ],
  2901. [
  2902. 5,
  2903. 11
  2904. ],
  2905. [
  2906. 5,
  2907. 11
  2908. ],
  2909. [
  2910. 7,
  2911. 27
  2912. ],
  2913. [
  2914. 7,
  2915. 27
  2916. ],
  2917. [
  2918. 7,
  2919. 27
  2920. ],
  2921. [
  2922. 7,
  2923. 27
  2924. ],
  2925. [
  2926. 8,
  2927. 59
  2928. ],
  2929. [
  2930. 8,
  2931. 59
  2932. ],
  2933. [
  2934. 8,
  2935. 60
  2936. ],
  2937. [
  2938. 8,
  2939. 60
  2940. ],
  2941. [
  2942. 9,
  2943. 1472
  2944. ],
  2945. [
  2946. 9,
  2947. 1536
  2948. ],
  2949. [
  2950. 9,
  2951. 1600
  2952. ],
  2953. [
  2954. 9,
  2955. 1728
  2956. ],
  2957. [
  2958. 7,
  2959. 18
  2960. ],
  2961. [
  2962. 7,
  2963. 18
  2964. ],
  2965. [
  2966. 7,
  2967. 18
  2968. ],
  2969. [
  2970. 7,
  2971. 18
  2972. ],
  2973. [
  2974. 7,
  2975. 24
  2976. ],
  2977. [
  2978. 7,
  2979. 24
  2980. ],
  2981. [
  2982. 7,
  2983. 24
  2984. ],
  2985. [
  2986. 7,
  2987. 24
  2988. ],
  2989. [
  2990. 8,
  2991. 49
  2992. ],
  2993. [
  2994. 8,
  2995. 49
  2996. ],
  2997. [
  2998. 8,
  2999. 50
  3000. ],
  3001. [
  3002. 8,
  3003. 50
  3004. ],
  3005. [
  3006. 8,
  3007. 51
  3008. ],
  3009. [
  3010. 8,
  3011. 51
  3012. ],
  3013. [
  3014. 8,
  3015. 52
  3016. ],
  3017. [
  3018. 8,
  3019. 52
  3020. ],
  3021. [
  3022. 7,
  3023. 25
  3024. ],
  3025. [
  3026. 7,
  3027. 25
  3028. ],
  3029. [
  3030. 7,
  3031. 25
  3032. ],
  3033. [
  3034. 7,
  3035. 25
  3036. ],
  3037. [
  3038. 8,
  3039. 55
  3040. ],
  3041. [
  3042. 8,
  3043. 55
  3044. ],
  3045. [
  3046. 8,
  3047. 56
  3048. ],
  3049. [
  3050. 8,
  3051. 56
  3052. ],
  3053. [
  3054. 8,
  3055. 57
  3056. ],
  3057. [
  3058. 8,
  3059. 57
  3060. ],
  3061. [
  3062. 8,
  3063. 58
  3064. ],
  3065. [
  3066. 8,
  3067. 58
  3068. ],
  3069. [
  3070. 6,
  3071. 192
  3072. ],
  3073. [
  3074. 6,
  3075. 192
  3076. ],
  3077. [
  3078. 6,
  3079. 192
  3080. ],
  3081. [
  3082. 6,
  3083. 192
  3084. ],
  3085. [
  3086. 6,
  3087. 192
  3088. ],
  3089. [
  3090. 6,
  3091. 192
  3092. ],
  3093. [
  3094. 6,
  3095. 192
  3096. ],
  3097. [
  3098. 6,
  3099. 192
  3100. ],
  3101. [
  3102. 6,
  3103. 1664
  3104. ],
  3105. [
  3106. 6,
  3107. 1664
  3108. ],
  3109. [
  3110. 6,
  3111. 1664
  3112. ],
  3113. [
  3114. 6,
  3115. 1664
  3116. ],
  3117. [
  3118. 6,
  3119. 1664
  3120. ],
  3121. [
  3122. 6,
  3123. 1664
  3124. ],
  3125. [
  3126. 6,
  3127. 1664
  3128. ],
  3129. [
  3130. 6,
  3131. 1664
  3132. ],
  3133. [
  3134. 8,
  3135. 448
  3136. ],
  3137. [
  3138. 8,
  3139. 448
  3140. ],
  3141. [
  3142. 8,
  3143. 512
  3144. ],
  3145. [
  3146. 8,
  3147. 512
  3148. ],
  3149. [
  3150. 9,
  3151. 704
  3152. ],
  3153. [
  3154. 9,
  3155. 768
  3156. ],
  3157. [
  3158. 8,
  3159. 640
  3160. ],
  3161. [
  3162. 8,
  3163. 640
  3164. ],
  3165. [
  3166. 8,
  3167. 576
  3168. ],
  3169. [
  3170. 8,
  3171. 576
  3172. ],
  3173. [
  3174. 9,
  3175. 832
  3176. ],
  3177. [
  3178. 9,
  3179. 896
  3180. ],
  3181. [
  3182. 9,
  3183. 960
  3184. ],
  3185. [
  3186. 9,
  3187. 1024
  3188. ],
  3189. [
  3190. 9,
  3191. 1088
  3192. ],
  3193. [
  3194. 9,
  3195. 1152
  3196. ],
  3197. [
  3198. 9,
  3199. 1216
  3200. ],
  3201. [
  3202. 9,
  3203. 1280
  3204. ],
  3205. [
  3206. 9,
  3207. 1344
  3208. ],
  3209. [
  3210. 9,
  3211. 1408
  3212. ],
  3213. [
  3214. 7,
  3215. 256
  3216. ],
  3217. [
  3218. 7,
  3219. 256
  3220. ],
  3221. [
  3222. 7,
  3223. 256
  3224. ],
  3225. [
  3226. 7,
  3227. 256
  3228. ],
  3229. [
  3230. 4,
  3231. 2
  3232. ],
  3233. [
  3234. 4,
  3235. 2
  3236. ],
  3237. [
  3238. 4,
  3239. 2
  3240. ],
  3241. [
  3242. 4,
  3243. 2
  3244. ],
  3245. [
  3246. 4,
  3247. 2
  3248. ],
  3249. [
  3250. 4,
  3251. 2
  3252. ],
  3253. [
  3254. 4,
  3255. 2
  3256. ],
  3257. [
  3258. 4,
  3259. 2
  3260. ],
  3261. [
  3262. 4,
  3263. 2
  3264. ],
  3265. [
  3266. 4,
  3267. 2
  3268. ],
  3269. [
  3270. 4,
  3271. 2
  3272. ],
  3273. [
  3274. 4,
  3275. 2
  3276. ],
  3277. [
  3278. 4,
  3279. 2
  3280. ],
  3281. [
  3282. 4,
  3283. 2
  3284. ],
  3285. [
  3286. 4,
  3287. 2
  3288. ],
  3289. [
  3290. 4,
  3291. 2
  3292. ],
  3293. [
  3294. 4,
  3295. 2
  3296. ],
  3297. [
  3298. 4,
  3299. 2
  3300. ],
  3301. [
  3302. 4,
  3303. 2
  3304. ],
  3305. [
  3306. 4,
  3307. 2
  3308. ],
  3309. [
  3310. 4,
  3311. 2
  3312. ],
  3313. [
  3314. 4,
  3315. 2
  3316. ],
  3317. [
  3318. 4,
  3319. 2
  3320. ],
  3321. [
  3322. 4,
  3323. 2
  3324. ],
  3325. [
  3326. 4,
  3327. 2
  3328. ],
  3329. [
  3330. 4,
  3331. 2
  3332. ],
  3333. [
  3334. 4,
  3335. 2
  3336. ],
  3337. [
  3338. 4,
  3339. 2
  3340. ],
  3341. [
  3342. 4,
  3343. 2
  3344. ],
  3345. [
  3346. 4,
  3347. 2
  3348. ],
  3349. [
  3350. 4,
  3351. 2
  3352. ],
  3353. [
  3354. 4,
  3355. 2
  3356. ],
  3357. [
  3358. 4,
  3359. 3
  3360. ],
  3361. [
  3362. 4,
  3363. 3
  3364. ],
  3365. [
  3366. 4,
  3367. 3
  3368. ],
  3369. [
  3370. 4,
  3371. 3
  3372. ],
  3373. [
  3374. 4,
  3375. 3
  3376. ],
  3377. [
  3378. 4,
  3379. 3
  3380. ],
  3381. [
  3382. 4,
  3383. 3
  3384. ],
  3385. [
  3386. 4,
  3387. 3
  3388. ],
  3389. [
  3390. 4,
  3391. 3
  3392. ],
  3393. [
  3394. 4,
  3395. 3
  3396. ],
  3397. [
  3398. 4,
  3399. 3
  3400. ],
  3401. [
  3402. 4,
  3403. 3
  3404. ],
  3405. [
  3406. 4,
  3407. 3
  3408. ],
  3409. [
  3410. 4,
  3411. 3
  3412. ],
  3413. [
  3414. 4,
  3415. 3
  3416. ],
  3417. [
  3418. 4,
  3419. 3
  3420. ],
  3421. [
  3422. 4,
  3423. 3
  3424. ],
  3425. [
  3426. 4,
  3427. 3
  3428. ],
  3429. [
  3430. 4,
  3431. 3
  3432. ],
  3433. [
  3434. 4,
  3435. 3
  3436. ],
  3437. [
  3438. 4,
  3439. 3
  3440. ],
  3441. [
  3442. 4,
  3443. 3
  3444. ],
  3445. [
  3446. 4,
  3447. 3
  3448. ],
  3449. [
  3450. 4,
  3451. 3
  3452. ],
  3453. [
  3454. 4,
  3455. 3
  3456. ],
  3457. [
  3458. 4,
  3459. 3
  3460. ],
  3461. [
  3462. 4,
  3463. 3
  3464. ],
  3465. [
  3466. 4,
  3467. 3
  3468. ],
  3469. [
  3470. 4,
  3471. 3
  3472. ],
  3473. [
  3474. 4,
  3475. 3
  3476. ],
  3477. [
  3478. 4,
  3479. 3
  3480. ],
  3481. [
  3482. 4,
  3483. 3
  3484. ],
  3485. [
  3486. 5,
  3487. 128
  3488. ],
  3489. [
  3490. 5,
  3491. 128
  3492. ],
  3493. [
  3494. 5,
  3495. 128
  3496. ],
  3497. [
  3498. 5,
  3499. 128
  3500. ],
  3501. [
  3502. 5,
  3503. 128
  3504. ],
  3505. [
  3506. 5,
  3507. 128
  3508. ],
  3509. [
  3510. 5,
  3511. 128
  3512. ],
  3513. [
  3514. 5,
  3515. 128
  3516. ],
  3517. [
  3518. 5,
  3519. 128
  3520. ],
  3521. [
  3522. 5,
  3523. 128
  3524. ],
  3525. [
  3526. 5,
  3527. 128
  3528. ],
  3529. [
  3530. 5,
  3531. 128
  3532. ],
  3533. [
  3534. 5,
  3535. 128
  3536. ],
  3537. [
  3538. 5,
  3539. 128
  3540. ],
  3541. [
  3542. 5,
  3543. 128
  3544. ],
  3545. [
  3546. 5,
  3547. 128
  3548. ],
  3549. [
  3550. 5,
  3551. 8
  3552. ],
  3553. [
  3554. 5,
  3555. 8
  3556. ],
  3557. [
  3558. 5,
  3559. 8
  3560. ],
  3561. [
  3562. 5,
  3563. 8
  3564. ],
  3565. [
  3566. 5,
  3567. 8
  3568. ],
  3569. [
  3570. 5,
  3571. 8
  3572. ],
  3573. [
  3574. 5,
  3575. 8
  3576. ],
  3577. [
  3578. 5,
  3579. 8
  3580. ],
  3581. [
  3582. 5,
  3583. 8
  3584. ],
  3585. [
  3586. 5,
  3587. 8
  3588. ],
  3589. [
  3590. 5,
  3591. 8
  3592. ],
  3593. [
  3594. 5,
  3595. 8
  3596. ],
  3597. [
  3598. 5,
  3599. 8
  3600. ],
  3601. [
  3602. 5,
  3603. 8
  3604. ],
  3605. [
  3606. 5,
  3607. 8
  3608. ],
  3609. [
  3610. 5,
  3611. 8
  3612. ],
  3613. [
  3614. 5,
  3615. 9
  3616. ],
  3617. [
  3618. 5,
  3619. 9
  3620. ],
  3621. [
  3622. 5,
  3623. 9
  3624. ],
  3625. [
  3626. 5,
  3627. 9
  3628. ],
  3629. [
  3630. 5,
  3631. 9
  3632. ],
  3633. [
  3634. 5,
  3635. 9
  3636. ],
  3637. [
  3638. 5,
  3639. 9
  3640. ],
  3641. [
  3642. 5,
  3643. 9
  3644. ],
  3645. [
  3646. 5,
  3647. 9
  3648. ],
  3649. [
  3650. 5,
  3651. 9
  3652. ],
  3653. [
  3654. 5,
  3655. 9
  3656. ],
  3657. [
  3658. 5,
  3659. 9
  3660. ],
  3661. [
  3662. 5,
  3663. 9
  3664. ],
  3665. [
  3666. 5,
  3667. 9
  3668. ],
  3669. [
  3670. 5,
  3671. 9
  3672. ],
  3673. [
  3674. 5,
  3675. 9
  3676. ],
  3677. [
  3678. 6,
  3679. 16
  3680. ],
  3681. [
  3682. 6,
  3683. 16
  3684. ],
  3685. [
  3686. 6,
  3687. 16
  3688. ],
  3689. [
  3690. 6,
  3691. 16
  3692. ],
  3693. [
  3694. 6,
  3695. 16
  3696. ],
  3697. [
  3698. 6,
  3699. 16
  3700. ],
  3701. [
  3702. 6,
  3703. 16
  3704. ],
  3705. [
  3706. 6,
  3707. 16
  3708. ],
  3709. [
  3710. 6,
  3711. 17
  3712. ],
  3713. [
  3714. 6,
  3715. 17
  3716. ],
  3717. [
  3718. 6,
  3719. 17
  3720. ],
  3721. [
  3722. 6,
  3723. 17
  3724. ],
  3725. [
  3726. 6,
  3727. 17
  3728. ],
  3729. [
  3730. 6,
  3731. 17
  3732. ],
  3733. [
  3734. 6,
  3735. 17
  3736. ],
  3737. [
  3738. 6,
  3739. 17
  3740. ],
  3741. [
  3742. 4,
  3743. 4
  3744. ],
  3745. [
  3746. 4,
  3747. 4
  3748. ],
  3749. [
  3750. 4,
  3751. 4
  3752. ],
  3753. [
  3754. 4,
  3755. 4
  3756. ],
  3757. [
  3758. 4,
  3759. 4
  3760. ],
  3761. [
  3762. 4,
  3763. 4
  3764. ],
  3765. [
  3766. 4,
  3767. 4
  3768. ],
  3769. [
  3770. 4,
  3771. 4
  3772. ],
  3773. [
  3774. 4,
  3775. 4
  3776. ],
  3777. [
  3778. 4,
  3779. 4
  3780. ],
  3781. [
  3782. 4,
  3783. 4
  3784. ],
  3785. [
  3786. 4,
  3787. 4
  3788. ],
  3789. [
  3790. 4,
  3791. 4
  3792. ],
  3793. [
  3794. 4,
  3795. 4
  3796. ],
  3797. [
  3798. 4,
  3799. 4
  3800. ],
  3801. [
  3802. 4,
  3803. 4
  3804. ],
  3805. [
  3806. 4,
  3807. 4
  3808. ],
  3809. [
  3810. 4,
  3811. 4
  3812. ],
  3813. [
  3814. 4,
  3815. 4
  3816. ],
  3817. [
  3818. 4,
  3819. 4
  3820. ],
  3821. [
  3822. 4,
  3823. 4
  3824. ],
  3825. [
  3826. 4,
  3827. 4
  3828. ],
  3829. [
  3830. 4,
  3831. 4
  3832. ],
  3833. [
  3834. 4,
  3835. 4
  3836. ],
  3837. [
  3838. 4,
  3839. 4
  3840. ],
  3841. [
  3842. 4,
  3843. 4
  3844. ],
  3845. [
  3846. 4,
  3847. 4
  3848. ],
  3849. [
  3850. 4,
  3851. 4
  3852. ],
  3853. [
  3854. 4,
  3855. 4
  3856. ],
  3857. [
  3858. 4,
  3859. 4
  3860. ],
  3861. [
  3862. 4,
  3863. 4
  3864. ],
  3865. [
  3866. 4,
  3867. 4
  3868. ],
  3869. [
  3870. 4,
  3871. 5
  3872. ],
  3873. [
  3874. 4,
  3875. 5
  3876. ],
  3877. [
  3878. 4,
  3879. 5
  3880. ],
  3881. [
  3882. 4,
  3883. 5
  3884. ],
  3885. [
  3886. 4,
  3887. 5
  3888. ],
  3889. [
  3890. 4,
  3891. 5
  3892. ],
  3893. [
  3894. 4,
  3895. 5
  3896. ],
  3897. [
  3898. 4,
  3899. 5
  3900. ],
  3901. [
  3902. 4,
  3903. 5
  3904. ],
  3905. [
  3906. 4,
  3907. 5
  3908. ],
  3909. [
  3910. 4,
  3911. 5
  3912. ],
  3913. [
  3914. 4,
  3915. 5
  3916. ],
  3917. [
  3918. 4,
  3919. 5
  3920. ],
  3921. [
  3922. 4,
  3923. 5
  3924. ],
  3925. [
  3926. 4,
  3927. 5
  3928. ],
  3929. [
  3930. 4,
  3931. 5
  3932. ],
  3933. [
  3934. 4,
  3935. 5
  3936. ],
  3937. [
  3938. 4,
  3939. 5
  3940. ],
  3941. [
  3942. 4,
  3943. 5
  3944. ],
  3945. [
  3946. 4,
  3947. 5
  3948. ],
  3949. [
  3950. 4,
  3951. 5
  3952. ],
  3953. [
  3954. 4,
  3955. 5
  3956. ],
  3957. [
  3958. 4,
  3959. 5
  3960. ],
  3961. [
  3962. 4,
  3963. 5
  3964. ],
  3965. [
  3966. 4,
  3967. 5
  3968. ],
  3969. [
  3970. 4,
  3971. 5
  3972. ],
  3973. [
  3974. 4,
  3975. 5
  3976. ],
  3977. [
  3978. 4,
  3979. 5
  3980. ],
  3981. [
  3982. 4,
  3983. 5
  3984. ],
  3985. [
  3986. 4,
  3987. 5
  3988. ],
  3989. [
  3990. 4,
  3991. 5
  3992. ],
  3993. [
  3994. 4,
  3995. 5
  3996. ],
  3997. [
  3998. 6,
  3999. 14
  4000. ],
  4001. [
  4002. 6,
  4003. 14
  4004. ],
  4005. [
  4006. 6,
  4007. 14
  4008. ],
  4009. [
  4010. 6,
  4011. 14
  4012. ],
  4013. [
  4014. 6,
  4015. 14
  4016. ],
  4017. [
  4018. 6,
  4019. 14
  4020. ],
  4021. [
  4022. 6,
  4023. 14
  4024. ],
  4025. [
  4026. 6,
  4027. 14
  4028. ],
  4029. [
  4030. 6,
  4031. 15
  4032. ],
  4033. [
  4034. 6,
  4035. 15
  4036. ],
  4037. [
  4038. 6,
  4039. 15
  4040. ],
  4041. [
  4042. 6,
  4043. 15
  4044. ],
  4045. [
  4046. 6,
  4047. 15
  4048. ],
  4049. [
  4050. 6,
  4051. 15
  4052. ],
  4053. [
  4054. 6,
  4055. 15
  4056. ],
  4057. [
  4058. 6,
  4059. 15
  4060. ],
  4061. [
  4062. 5,
  4063. 64
  4064. ],
  4065. [
  4066. 5,
  4067. 64
  4068. ],
  4069. [
  4070. 5,
  4071. 64
  4072. ],
  4073. [
  4074. 5,
  4075. 64
  4076. ],
  4077. [
  4078. 5,
  4079. 64
  4080. ],
  4081. [
  4082. 5,
  4083. 64
  4084. ],
  4085. [
  4086. 5,
  4087. 64
  4088. ],
  4089. [
  4090. 5,
  4091. 64
  4092. ],
  4093. [
  4094. 5,
  4095. 64
  4096. ],
  4097. [
  4098. 5,
  4099. 64
  4100. ],
  4101. [
  4102. 5,
  4103. 64
  4104. ],
  4105. [
  4106. 5,
  4107. 64
  4108. ],
  4109. [
  4110. 5,
  4111. 64
  4112. ],
  4113. [
  4114. 5,
  4115. 64
  4116. ],
  4117. [
  4118. 5,
  4119. 64
  4120. ],
  4121. [
  4122. 5,
  4123. 64
  4124. ],
  4125. [
  4126. 4,
  4127. 6
  4128. ],
  4129. [
  4130. 4,
  4131. 6
  4132. ],
  4133. [
  4134. 4,
  4135. 6
  4136. ],
  4137. [
  4138. 4,
  4139. 6
  4140. ],
  4141. [
  4142. 4,
  4143. 6
  4144. ],
  4145. [
  4146. 4,
  4147. 6
  4148. ],
  4149. [
  4150. 4,
  4151. 6
  4152. ],
  4153. [
  4154. 4,
  4155. 6
  4156. ],
  4157. [
  4158. 4,
  4159. 6
  4160. ],
  4161. [
  4162. 4,
  4163. 6
  4164. ],
  4165. [
  4166. 4,
  4167. 6
  4168. ],
  4169. [
  4170. 4,
  4171. 6
  4172. ],
  4173. [
  4174. 4,
  4175. 6
  4176. ],
  4177. [
  4178. 4,
  4179. 6
  4180. ],
  4181. [
  4182. 4,
  4183. 6
  4184. ],
  4185. [
  4186. 4,
  4187. 6
  4188. ],
  4189. [
  4190. 4,
  4191. 6
  4192. ],
  4193. [
  4194. 4,
  4195. 6
  4196. ],
  4197. [
  4198. 4,
  4199. 6
  4200. ],
  4201. [
  4202. 4,
  4203. 6
  4204. ],
  4205. [
  4206. 4,
  4207. 6
  4208. ],
  4209. [
  4210. 4,
  4211. 6
  4212. ],
  4213. [
  4214. 4,
  4215. 6
  4216. ],
  4217. [
  4218. 4,
  4219. 6
  4220. ],
  4221. [
  4222. 4,
  4223. 6
  4224. ],
  4225. [
  4226. 4,
  4227. 6
  4228. ],
  4229. [
  4230. 4,
  4231. 6
  4232. ],
  4233. [
  4234. 4,
  4235. 6
  4236. ],
  4237. [
  4238. 4,
  4239. 6
  4240. ],
  4241. [
  4242. 4,
  4243. 6
  4244. ],
  4245. [
  4246. 4,
  4247. 6
  4248. ],
  4249. [
  4250. 4,
  4251. 6
  4252. ],
  4253. [
  4254. 4,
  4255. 7
  4256. ],
  4257. [
  4258. 4,
  4259. 7
  4260. ],
  4261. [
  4262. 4,
  4263. 7
  4264. ],
  4265. [
  4266. 4,
  4267. 7
  4268. ],
  4269. [
  4270. 4,
  4271. 7
  4272. ],
  4273. [
  4274. 4,
  4275. 7
  4276. ],
  4277. [
  4278. 4,
  4279. 7
  4280. ],
  4281. [
  4282. 4,
  4283. 7
  4284. ],
  4285. [
  4286. 4,
  4287. 7
  4288. ],
  4289. [
  4290. 4,
  4291. 7
  4292. ],
  4293. [
  4294. 4,
  4295. 7
  4296. ],
  4297. [
  4298. 4,
  4299. 7
  4300. ],
  4301. [
  4302. 4,
  4303. 7
  4304. ],
  4305. [
  4306. 4,
  4307. 7
  4308. ],
  4309. [
  4310. 4,
  4311. 7
  4312. ],
  4313. [
  4314. 4,
  4315. 7
  4316. ],
  4317. [
  4318. 4,
  4319. 7
  4320. ],
  4321. [
  4322. 4,
  4323. 7
  4324. ],
  4325. [
  4326. 4,
  4327. 7
  4328. ],
  4329. [
  4330. 4,
  4331. 7
  4332. ],
  4333. [
  4334. 4,
  4335. 7
  4336. ],
  4337. [
  4338. 4,
  4339. 7
  4340. ],
  4341. [
  4342. 4,
  4343. 7
  4344. ],
  4345. [
  4346. 4,
  4347. 7
  4348. ],
  4349. [
  4350. 4,
  4351. 7
  4352. ],
  4353. [
  4354. 4,
  4355. 7
  4356. ],
  4357. [
  4358. 4,
  4359. 7
  4360. ],
  4361. [
  4362. 4,
  4363. 7
  4364. ],
  4365. [
  4366. 4,
  4367. 7
  4368. ],
  4369. [
  4370. 4,
  4371. 7
  4372. ],
  4373. [
  4374. 4,
  4375. 7
  4376. ],
  4377. [
  4378. 4,
  4379. 7
  4380. ]
  4381. ];
  4382. var blackTable1 = [
  4383. [
  4384. -1,
  4385. -1
  4386. ],
  4387. [
  4388. -1,
  4389. -1
  4390. ],
  4391. [
  4392. 12,
  4393. ccittEOL
  4394. ],
  4395. [
  4396. 12,
  4397. ccittEOL
  4398. ],
  4399. [
  4400. -1,
  4401. -1
  4402. ],
  4403. [
  4404. -1,
  4405. -1
  4406. ],
  4407. [
  4408. -1,
  4409. -1
  4410. ],
  4411. [
  4412. -1,
  4413. -1
  4414. ],
  4415. [
  4416. -1,
  4417. -1
  4418. ],
  4419. [
  4420. -1,
  4421. -1
  4422. ],
  4423. [
  4424. -1,
  4425. -1
  4426. ],
  4427. [
  4428. -1,
  4429. -1
  4430. ],
  4431. [
  4432. -1,
  4433. -1
  4434. ],
  4435. [
  4436. -1,
  4437. -1
  4438. ],
  4439. [
  4440. -1,
  4441. -1
  4442. ],
  4443. [
  4444. -1,
  4445. -1
  4446. ],
  4447. [
  4448. -1,
  4449. -1
  4450. ],
  4451. [
  4452. -1,
  4453. -1
  4454. ],
  4455. [
  4456. -1,
  4457. -1
  4458. ],
  4459. [
  4460. -1,
  4461. -1
  4462. ],
  4463. [
  4464. -1,
  4465. -1
  4466. ],
  4467. [
  4468. -1,
  4469. -1
  4470. ],
  4471. [
  4472. -1,
  4473. -1
  4474. ],
  4475. [
  4476. -1,
  4477. -1
  4478. ],
  4479. [
  4480. -1,
  4481. -1
  4482. ],
  4483. [
  4484. -1,
  4485. -1
  4486. ],
  4487. [
  4488. -1,
  4489. -1
  4490. ],
  4491. [
  4492. -1,
  4493. -1
  4494. ],
  4495. [
  4496. -1,
  4497. -1
  4498. ],
  4499. [
  4500. -1,
  4501. -1
  4502. ],
  4503. [
  4504. -1,
  4505. -1
  4506. ],
  4507. [
  4508. -1,
  4509. -1
  4510. ],
  4511. [
  4512. 11,
  4513. 1792
  4514. ],
  4515. [
  4516. 11,
  4517. 1792
  4518. ],
  4519. [
  4520. 11,
  4521. 1792
  4522. ],
  4523. [
  4524. 11,
  4525. 1792
  4526. ],
  4527. [
  4528. 12,
  4529. 1984
  4530. ],
  4531. [
  4532. 12,
  4533. 1984
  4534. ],
  4535. [
  4536. 12,
  4537. 2048
  4538. ],
  4539. [
  4540. 12,
  4541. 2048
  4542. ],
  4543. [
  4544. 12,
  4545. 2112
  4546. ],
  4547. [
  4548. 12,
  4549. 2112
  4550. ],
  4551. [
  4552. 12,
  4553. 2176
  4554. ],
  4555. [
  4556. 12,
  4557. 2176
  4558. ],
  4559. [
  4560. 12,
  4561. 2240
  4562. ],
  4563. [
  4564. 12,
  4565. 2240
  4566. ],
  4567. [
  4568. 12,
  4569. 2304
  4570. ],
  4571. [
  4572. 12,
  4573. 2304
  4574. ],
  4575. [
  4576. 11,
  4577. 1856
  4578. ],
  4579. [
  4580. 11,
  4581. 1856
  4582. ],
  4583. [
  4584. 11,
  4585. 1856
  4586. ],
  4587. [
  4588. 11,
  4589. 1856
  4590. ],
  4591. [
  4592. 11,
  4593. 1920
  4594. ],
  4595. [
  4596. 11,
  4597. 1920
  4598. ],
  4599. [
  4600. 11,
  4601. 1920
  4602. ],
  4603. [
  4604. 11,
  4605. 1920
  4606. ],
  4607. [
  4608. 12,
  4609. 2368
  4610. ],
  4611. [
  4612. 12,
  4613. 2368
  4614. ],
  4615. [
  4616. 12,
  4617. 2432
  4618. ],
  4619. [
  4620. 12,
  4621. 2432
  4622. ],
  4623. [
  4624. 12,
  4625. 2496
  4626. ],
  4627. [
  4628. 12,
  4629. 2496
  4630. ],
  4631. [
  4632. 12,
  4633. 2560
  4634. ],
  4635. [
  4636. 12,
  4637. 2560
  4638. ],
  4639. [
  4640. 10,
  4641. 18
  4642. ],
  4643. [
  4644. 10,
  4645. 18
  4646. ],
  4647. [
  4648. 10,
  4649. 18
  4650. ],
  4651. [
  4652. 10,
  4653. 18
  4654. ],
  4655. [
  4656. 10,
  4657. 18
  4658. ],
  4659. [
  4660. 10,
  4661. 18
  4662. ],
  4663. [
  4664. 10,
  4665. 18
  4666. ],
  4667. [
  4668. 10,
  4669. 18
  4670. ],
  4671. [
  4672. 12,
  4673. 52
  4674. ],
  4675. [
  4676. 12,
  4677. 52
  4678. ],
  4679. [
  4680. 13,
  4681. 640
  4682. ],
  4683. [
  4684. 13,
  4685. 704
  4686. ],
  4687. [
  4688. 13,
  4689. 768
  4690. ],
  4691. [
  4692. 13,
  4693. 832
  4694. ],
  4695. [
  4696. 12,
  4697. 55
  4698. ],
  4699. [
  4700. 12,
  4701. 55
  4702. ],
  4703. [
  4704. 12,
  4705. 56
  4706. ],
  4707. [
  4708. 12,
  4709. 56
  4710. ],
  4711. [
  4712. 13,
  4713. 1280
  4714. ],
  4715. [
  4716. 13,
  4717. 1344
  4718. ],
  4719. [
  4720. 13,
  4721. 1408
  4722. ],
  4723. [
  4724. 13,
  4725. 1472
  4726. ],
  4727. [
  4728. 12,
  4729. 59
  4730. ],
  4731. [
  4732. 12,
  4733. 59
  4734. ],
  4735. [
  4736. 12,
  4737. 60
  4738. ],
  4739. [
  4740. 12,
  4741. 60
  4742. ],
  4743. [
  4744. 13,
  4745. 1536
  4746. ],
  4747. [
  4748. 13,
  4749. 1600
  4750. ],
  4751. [
  4752. 11,
  4753. 24
  4754. ],
  4755. [
  4756. 11,
  4757. 24
  4758. ],
  4759. [
  4760. 11,
  4761. 24
  4762. ],
  4763. [
  4764. 11,
  4765. 24
  4766. ],
  4767. [
  4768. 11,
  4769. 25
  4770. ],
  4771. [
  4772. 11,
  4773. 25
  4774. ],
  4775. [
  4776. 11,
  4777. 25
  4778. ],
  4779. [
  4780. 11,
  4781. 25
  4782. ],
  4783. [
  4784. 13,
  4785. 1664
  4786. ],
  4787. [
  4788. 13,
  4789. 1728
  4790. ],
  4791. [
  4792. 12,
  4793. 320
  4794. ],
  4795. [
  4796. 12,
  4797. 320
  4798. ],
  4799. [
  4800. 12,
  4801. 384
  4802. ],
  4803. [
  4804. 12,
  4805. 384
  4806. ],
  4807. [
  4808. 12,
  4809. 448
  4810. ],
  4811. [
  4812. 12,
  4813. 448
  4814. ],
  4815. [
  4816. 13,
  4817. 512
  4818. ],
  4819. [
  4820. 13,
  4821. 576
  4822. ],
  4823. [
  4824. 12,
  4825. 53
  4826. ],
  4827. [
  4828. 12,
  4829. 53
  4830. ],
  4831. [
  4832. 12,
  4833. 54
  4834. ],
  4835. [
  4836. 12,
  4837. 54
  4838. ],
  4839. [
  4840. 13,
  4841. 896
  4842. ],
  4843. [
  4844. 13,
  4845. 960
  4846. ],
  4847. [
  4848. 13,
  4849. 1024
  4850. ],
  4851. [
  4852. 13,
  4853. 1088
  4854. ],
  4855. [
  4856. 13,
  4857. 1152
  4858. ],
  4859. [
  4860. 13,
  4861. 1216
  4862. ],
  4863. [
  4864. 10,
  4865. 64
  4866. ],
  4867. [
  4868. 10,
  4869. 64
  4870. ],
  4871. [
  4872. 10,
  4873. 64
  4874. ],
  4875. [
  4876. 10,
  4877. 64
  4878. ],
  4879. [
  4880. 10,
  4881. 64
  4882. ],
  4883. [
  4884. 10,
  4885. 64
  4886. ],
  4887. [
  4888. 10,
  4889. 64
  4890. ],
  4891. [
  4892. 10,
  4893. 64
  4894. ]
  4895. ];
  4896. var blackTable2 = [
  4897. [
  4898. 8,
  4899. 13
  4900. ],
  4901. [
  4902. 8,
  4903. 13
  4904. ],
  4905. [
  4906. 8,
  4907. 13
  4908. ],
  4909. [
  4910. 8,
  4911. 13
  4912. ],
  4913. [
  4914. 8,
  4915. 13
  4916. ],
  4917. [
  4918. 8,
  4919. 13
  4920. ],
  4921. [
  4922. 8,
  4923. 13
  4924. ],
  4925. [
  4926. 8,
  4927. 13
  4928. ],
  4929. [
  4930. 8,
  4931. 13
  4932. ],
  4933. [
  4934. 8,
  4935. 13
  4936. ],
  4937. [
  4938. 8,
  4939. 13
  4940. ],
  4941. [
  4942. 8,
  4943. 13
  4944. ],
  4945. [
  4946. 8,
  4947. 13
  4948. ],
  4949. [
  4950. 8,
  4951. 13
  4952. ],
  4953. [
  4954. 8,
  4955. 13
  4956. ],
  4957. [
  4958. 8,
  4959. 13
  4960. ],
  4961. [
  4962. 11,
  4963. 23
  4964. ],
  4965. [
  4966. 11,
  4967. 23
  4968. ],
  4969. [
  4970. 12,
  4971. 50
  4972. ],
  4973. [
  4974. 12,
  4975. 51
  4976. ],
  4977. [
  4978. 12,
  4979. 44
  4980. ],
  4981. [
  4982. 12,
  4983. 45
  4984. ],
  4985. [
  4986. 12,
  4987. 46
  4988. ],
  4989. [
  4990. 12,
  4991. 47
  4992. ],
  4993. [
  4994. 12,
  4995. 57
  4996. ],
  4997. [
  4998. 12,
  4999. 58
  5000. ],
  5001. [
  5002. 12,
  5003. 61
  5004. ],
  5005. [
  5006. 12,
  5007. 256
  5008. ],
  5009. [
  5010. 10,
  5011. 16
  5012. ],
  5013. [
  5014. 10,
  5015. 16
  5016. ],
  5017. [
  5018. 10,
  5019. 16
  5020. ],
  5021. [
  5022. 10,
  5023. 16
  5024. ],
  5025. [
  5026. 10,
  5027. 17
  5028. ],
  5029. [
  5030. 10,
  5031. 17
  5032. ],
  5033. [
  5034. 10,
  5035. 17
  5036. ],
  5037. [
  5038. 10,
  5039. 17
  5040. ],
  5041. [
  5042. 12,
  5043. 48
  5044. ],
  5045. [
  5046. 12,
  5047. 49
  5048. ],
  5049. [
  5050. 12,
  5051. 62
  5052. ],
  5053. [
  5054. 12,
  5055. 63
  5056. ],
  5057. [
  5058. 12,
  5059. 30
  5060. ],
  5061. [
  5062. 12,
  5063. 31
  5064. ],
  5065. [
  5066. 12,
  5067. 32
  5068. ],
  5069. [
  5070. 12,
  5071. 33
  5072. ],
  5073. [
  5074. 12,
  5075. 40
  5076. ],
  5077. [
  5078. 12,
  5079. 41
  5080. ],
  5081. [
  5082. 11,
  5083. 22
  5084. ],
  5085. [
  5086. 11,
  5087. 22
  5088. ],
  5089. [
  5090. 8,
  5091. 14
  5092. ],
  5093. [
  5094. 8,
  5095. 14
  5096. ],
  5097. [
  5098. 8,
  5099. 14
  5100. ],
  5101. [
  5102. 8,
  5103. 14
  5104. ],
  5105. [
  5106. 8,
  5107. 14
  5108. ],
  5109. [
  5110. 8,
  5111. 14
  5112. ],
  5113. [
  5114. 8,
  5115. 14
  5116. ],
  5117. [
  5118. 8,
  5119. 14
  5120. ],
  5121. [
  5122. 8,
  5123. 14
  5124. ],
  5125. [
  5126. 8,
  5127. 14
  5128. ],
  5129. [
  5130. 8,
  5131. 14
  5132. ],
  5133. [
  5134. 8,
  5135. 14
  5136. ],
  5137. [
  5138. 8,
  5139. 14
  5140. ],
  5141. [
  5142. 8,
  5143. 14
  5144. ],
  5145. [
  5146. 8,
  5147. 14
  5148. ],
  5149. [
  5150. 8,
  5151. 14
  5152. ],
  5153. [
  5154. 7,
  5155. 10
  5156. ],
  5157. [
  5158. 7,
  5159. 10
  5160. ],
  5161. [
  5162. 7,
  5163. 10
  5164. ],
  5165. [
  5166. 7,
  5167. 10
  5168. ],
  5169. [
  5170. 7,
  5171. 10
  5172. ],
  5173. [
  5174. 7,
  5175. 10
  5176. ],
  5177. [
  5178. 7,
  5179. 10
  5180. ],
  5181. [
  5182. 7,
  5183. 10
  5184. ],
  5185. [
  5186. 7,
  5187. 10
  5188. ],
  5189. [
  5190. 7,
  5191. 10
  5192. ],
  5193. [
  5194. 7,
  5195. 10
  5196. ],
  5197. [
  5198. 7,
  5199. 10
  5200. ],
  5201. [
  5202. 7,
  5203. 10
  5204. ],
  5205. [
  5206. 7,
  5207. 10
  5208. ],
  5209. [
  5210. 7,
  5211. 10
  5212. ],
  5213. [
  5214. 7,
  5215. 10
  5216. ],
  5217. [
  5218. 7,
  5219. 10
  5220. ],
  5221. [
  5222. 7,
  5223. 10
  5224. ],
  5225. [
  5226. 7,
  5227. 10
  5228. ],
  5229. [
  5230. 7,
  5231. 10
  5232. ],
  5233. [
  5234. 7,
  5235. 10
  5236. ],
  5237. [
  5238. 7,
  5239. 10
  5240. ],
  5241. [
  5242. 7,
  5243. 10
  5244. ],
  5245. [
  5246. 7,
  5247. 10
  5248. ],
  5249. [
  5250. 7,
  5251. 10
  5252. ],
  5253. [
  5254. 7,
  5255. 10
  5256. ],
  5257. [
  5258. 7,
  5259. 10
  5260. ],
  5261. [
  5262. 7,
  5263. 10
  5264. ],
  5265. [
  5266. 7,
  5267. 10
  5268. ],
  5269. [
  5270. 7,
  5271. 10
  5272. ],
  5273. [
  5274. 7,
  5275. 10
  5276. ],
  5277. [
  5278. 7,
  5279. 10
  5280. ],
  5281. [
  5282. 7,
  5283. 11
  5284. ],
  5285. [
  5286. 7,
  5287. 11
  5288. ],
  5289. [
  5290. 7,
  5291. 11
  5292. ],
  5293. [
  5294. 7,
  5295. 11
  5296. ],
  5297. [
  5298. 7,
  5299. 11
  5300. ],
  5301. [
  5302. 7,
  5303. 11
  5304. ],
  5305. [
  5306. 7,
  5307. 11
  5308. ],
  5309. [
  5310. 7,
  5311. 11
  5312. ],
  5313. [
  5314. 7,
  5315. 11
  5316. ],
  5317. [
  5318. 7,
  5319. 11
  5320. ],
  5321. [
  5322. 7,
  5323. 11
  5324. ],
  5325. [
  5326. 7,
  5327. 11
  5328. ],
  5329. [
  5330. 7,
  5331. 11
  5332. ],
  5333. [
  5334. 7,
  5335. 11
  5336. ],
  5337. [
  5338. 7,
  5339. 11
  5340. ],
  5341. [
  5342. 7,
  5343. 11
  5344. ],
  5345. [
  5346. 7,
  5347. 11
  5348. ],
  5349. [
  5350. 7,
  5351. 11
  5352. ],
  5353. [
  5354. 7,
  5355. 11
  5356. ],
  5357. [
  5358. 7,
  5359. 11
  5360. ],
  5361. [
  5362. 7,
  5363. 11
  5364. ],
  5365. [
  5366. 7,
  5367. 11
  5368. ],
  5369. [
  5370. 7,
  5371. 11
  5372. ],
  5373. [
  5374. 7,
  5375. 11
  5376. ],
  5377. [
  5378. 7,
  5379. 11
  5380. ],
  5381. [
  5382. 7,
  5383. 11
  5384. ],
  5385. [
  5386. 7,
  5387. 11
  5388. ],
  5389. [
  5390. 7,
  5391. 11
  5392. ],
  5393. [
  5394. 7,
  5395. 11
  5396. ],
  5397. [
  5398. 7,
  5399. 11
  5400. ],
  5401. [
  5402. 7,
  5403. 11
  5404. ],
  5405. [
  5406. 7,
  5407. 11
  5408. ],
  5409. [
  5410. 9,
  5411. 15
  5412. ],
  5413. [
  5414. 9,
  5415. 15
  5416. ],
  5417. [
  5418. 9,
  5419. 15
  5420. ],
  5421. [
  5422. 9,
  5423. 15
  5424. ],
  5425. [
  5426. 9,
  5427. 15
  5428. ],
  5429. [
  5430. 9,
  5431. 15
  5432. ],
  5433. [
  5434. 9,
  5435. 15
  5436. ],
  5437. [
  5438. 9,
  5439. 15
  5440. ],
  5441. [
  5442. 12,
  5443. 128
  5444. ],
  5445. [
  5446. 12,
  5447. 192
  5448. ],
  5449. [
  5450. 12,
  5451. 26
  5452. ],
  5453. [
  5454. 12,
  5455. 27
  5456. ],
  5457. [
  5458. 12,
  5459. 28
  5460. ],
  5461. [
  5462. 12,
  5463. 29
  5464. ],
  5465. [
  5466. 11,
  5467. 19
  5468. ],
  5469. [
  5470. 11,
  5471. 19
  5472. ],
  5473. [
  5474. 11,
  5475. 20
  5476. ],
  5477. [
  5478. 11,
  5479. 20
  5480. ],
  5481. [
  5482. 12,
  5483. 34
  5484. ],
  5485. [
  5486. 12,
  5487. 35
  5488. ],
  5489. [
  5490. 12,
  5491. 36
  5492. ],
  5493. [
  5494. 12,
  5495. 37
  5496. ],
  5497. [
  5498. 12,
  5499. 38
  5500. ],
  5501. [
  5502. 12,
  5503. 39
  5504. ],
  5505. [
  5506. 11,
  5507. 21
  5508. ],
  5509. [
  5510. 11,
  5511. 21
  5512. ],
  5513. [
  5514. 12,
  5515. 42
  5516. ],
  5517. [
  5518. 12,
  5519. 43
  5520. ],
  5521. [
  5522. 10,
  5523. 0
  5524. ],
  5525. [
  5526. 10,
  5527. 0
  5528. ],
  5529. [
  5530. 10,
  5531. 0
  5532. ],
  5533. [
  5534. 10,
  5535. 0
  5536. ],
  5537. [
  5538. 7,
  5539. 12
  5540. ],
  5541. [
  5542. 7,
  5543. 12
  5544. ],
  5545. [
  5546. 7,
  5547. 12
  5548. ],
  5549. [
  5550. 7,
  5551. 12
  5552. ],
  5553. [
  5554. 7,
  5555. 12
  5556. ],
  5557. [
  5558. 7,
  5559. 12
  5560. ],
  5561. [
  5562. 7,
  5563. 12
  5564. ],
  5565. [
  5566. 7,
  5567. 12
  5568. ],
  5569. [
  5570. 7,
  5571. 12
  5572. ],
  5573. [
  5574. 7,
  5575. 12
  5576. ],
  5577. [
  5578. 7,
  5579. 12
  5580. ],
  5581. [
  5582. 7,
  5583. 12
  5584. ],
  5585. [
  5586. 7,
  5587. 12
  5588. ],
  5589. [
  5590. 7,
  5591. 12
  5592. ],
  5593. [
  5594. 7,
  5595. 12
  5596. ],
  5597. [
  5598. 7,
  5599. 12
  5600. ],
  5601. [
  5602. 7,
  5603. 12
  5604. ],
  5605. [
  5606. 7,
  5607. 12
  5608. ],
  5609. [
  5610. 7,
  5611. 12
  5612. ],
  5613. [
  5614. 7,
  5615. 12
  5616. ],
  5617. [
  5618. 7,
  5619. 12
  5620. ],
  5621. [
  5622. 7,
  5623. 12
  5624. ],
  5625. [
  5626. 7,
  5627. 12
  5628. ],
  5629. [
  5630. 7,
  5631. 12
  5632. ],
  5633. [
  5634. 7,
  5635. 12
  5636. ],
  5637. [
  5638. 7,
  5639. 12
  5640. ],
  5641. [
  5642. 7,
  5643. 12
  5644. ],
  5645. [
  5646. 7,
  5647. 12
  5648. ],
  5649. [
  5650. 7,
  5651. 12
  5652. ],
  5653. [
  5654. 7,
  5655. 12
  5656. ],
  5657. [
  5658. 7,
  5659. 12
  5660. ],
  5661. [
  5662. 7,
  5663. 12
  5664. ]
  5665. ];
  5666. var blackTable3 = [
  5667. [
  5668. -1,
  5669. -1
  5670. ],
  5671. [
  5672. -1,
  5673. -1
  5674. ],
  5675. [
  5676. -1,
  5677. -1
  5678. ],
  5679. [
  5680. -1,
  5681. -1
  5682. ],
  5683. [
  5684. 6,
  5685. 9
  5686. ],
  5687. [
  5688. 6,
  5689. 8
  5690. ],
  5691. [
  5692. 5,
  5693. 7
  5694. ],
  5695. [
  5696. 5,
  5697. 7
  5698. ],
  5699. [
  5700. 4,
  5701. 6
  5702. ],
  5703. [
  5704. 4,
  5705. 6
  5706. ],
  5707. [
  5708. 4,
  5709. 6
  5710. ],
  5711. [
  5712. 4,
  5713. 6
  5714. ],
  5715. [
  5716. 4,
  5717. 5
  5718. ],
  5719. [
  5720. 4,
  5721. 5
  5722. ],
  5723. [
  5724. 4,
  5725. 5
  5726. ],
  5727. [
  5728. 4,
  5729. 5
  5730. ],
  5731. [
  5732. 3,
  5733. 1
  5734. ],
  5735. [
  5736. 3,
  5737. 1
  5738. ],
  5739. [
  5740. 3,
  5741. 1
  5742. ],
  5743. [
  5744. 3,
  5745. 1
  5746. ],
  5747. [
  5748. 3,
  5749. 1
  5750. ],
  5751. [
  5752. 3,
  5753. 1
  5754. ],
  5755. [
  5756. 3,
  5757. 1
  5758. ],
  5759. [
  5760. 3,
  5761. 1
  5762. ],
  5763. [
  5764. 3,
  5765. 4
  5766. ],
  5767. [
  5768. 3,
  5769. 4
  5770. ],
  5771. [
  5772. 3,
  5773. 4
  5774. ],
  5775. [
  5776. 3,
  5777. 4
  5778. ],
  5779. [
  5780. 3,
  5781. 4
  5782. ],
  5783. [
  5784. 3,
  5785. 4
  5786. ],
  5787. [
  5788. 3,
  5789. 4
  5790. ],
  5791. [
  5792. 3,
  5793. 4
  5794. ],
  5795. [
  5796. 2,
  5797. 3
  5798. ],
  5799. [
  5800. 2,
  5801. 3
  5802. ],
  5803. [
  5804. 2,
  5805. 3
  5806. ],
  5807. [
  5808. 2,
  5809. 3
  5810. ],
  5811. [
  5812. 2,
  5813. 3
  5814. ],
  5815. [
  5816. 2,
  5817. 3
  5818. ],
  5819. [
  5820. 2,
  5821. 3
  5822. ],
  5823. [
  5824. 2,
  5825. 3
  5826. ],
  5827. [
  5828. 2,
  5829. 3
  5830. ],
  5831. [
  5832. 2,
  5833. 3
  5834. ],
  5835. [
  5836. 2,
  5837. 3
  5838. ],
  5839. [
  5840. 2,
  5841. 3
  5842. ],
  5843. [
  5844. 2,
  5845. 3
  5846. ],
  5847. [
  5848. 2,
  5849. 3
  5850. ],
  5851. [
  5852. 2,
  5853. 3
  5854. ],
  5855. [
  5856. 2,
  5857. 3
  5858. ],
  5859. [
  5860. 2,
  5861. 2
  5862. ],
  5863. [
  5864. 2,
  5865. 2
  5866. ],
  5867. [
  5868. 2,
  5869. 2
  5870. ],
  5871. [
  5872. 2,
  5873. 2
  5874. ],
  5875. [
  5876. 2,
  5877. 2
  5878. ],
  5879. [
  5880. 2,
  5881. 2
  5882. ],
  5883. [
  5884. 2,
  5885. 2
  5886. ],
  5887. [
  5888. 2,
  5889. 2
  5890. ],
  5891. [
  5892. 2,
  5893. 2
  5894. ],
  5895. [
  5896. 2,
  5897. 2
  5898. ],
  5899. [
  5900. 2,
  5901. 2
  5902. ],
  5903. [
  5904. 2,
  5905. 2
  5906. ],
  5907. [
  5908. 2,
  5909. 2
  5910. ],
  5911. [
  5912. 2,
  5913. 2
  5914. ],
  5915. [
  5916. 2,
  5917. 2
  5918. ],
  5919. [
  5920. 2,
  5921. 2
  5922. ]
  5923. ];
  5924. function CCITTFaxStream(str, maybeLength, params) {
  5925. this.str = str;
  5926. this.dict = str.dict;
  5927. params = params || Dict.empty;
  5928. this.encoding = params.get('K') || 0;
  5929. this.eoline = params.get('EndOfLine') || false;
  5930. this.byteAlign = params.get('EncodedByteAlign') || false;
  5931. this.columns = params.get('Columns') || 1728;
  5932. this.rows = params.get('Rows') || 0;
  5933. var eoblock = params.get('EndOfBlock');
  5934. if (eoblock === null || eoblock === undefined) {
  5935. eoblock = true;
  5936. }
  5937. this.eoblock = eoblock;
  5938. this.black = params.get('BlackIs1') || false;
  5939. this.codingLine = new Uint32Array(this.columns + 1);
  5940. this.refLine = new Uint32Array(this.columns + 2);
  5941. this.codingLine[0] = this.columns;
  5942. this.codingPos = 0;
  5943. this.row = 0;
  5944. this.nextLine2D = this.encoding < 0;
  5945. this.inputBits = 0;
  5946. this.inputBuf = 0;
  5947. this.outputBits = 0;
  5948. var code1;
  5949. while ((code1 = this.lookBits(12)) === 0) {
  5950. this.eatBits(1);
  5951. }
  5952. if (code1 === 1) {
  5953. this.eatBits(12);
  5954. }
  5955. if (this.encoding > 0) {
  5956. this.nextLine2D = !this.lookBits(1);
  5957. this.eatBits(1);
  5958. }
  5959. DecodeStream.call(this, maybeLength);
  5960. }
  5961. CCITTFaxStream.prototype = Object.create(DecodeStream.prototype);
  5962. CCITTFaxStream.prototype.readBlock = function CCITTFaxStream_readBlock() {
  5963. while (!this.eof) {
  5964. var c = this.lookChar();
  5965. this.ensureBuffer(this.bufferLength + 1);
  5966. this.buffer[this.bufferLength++] = c;
  5967. }
  5968. };
  5969. CCITTFaxStream.prototype.addPixels = function ccittFaxStreamAddPixels(a1, blackPixels) {
  5970. var codingLine = this.codingLine;
  5971. var codingPos = this.codingPos;
  5972. if (a1 > codingLine[codingPos]) {
  5973. if (a1 > this.columns) {
  5974. info('row is wrong length');
  5975. this.err = true;
  5976. a1 = this.columns;
  5977. }
  5978. if (codingPos & 1 ^ blackPixels) {
  5979. ++codingPos;
  5980. }
  5981. codingLine[codingPos] = a1;
  5982. }
  5983. this.codingPos = codingPos;
  5984. };
  5985. CCITTFaxStream.prototype.addPixelsNeg = function ccittFaxStreamAddPixelsNeg(a1, blackPixels) {
  5986. var codingLine = this.codingLine;
  5987. var codingPos = this.codingPos;
  5988. if (a1 > codingLine[codingPos]) {
  5989. if (a1 > this.columns) {
  5990. info('row is wrong length');
  5991. this.err = true;
  5992. a1 = this.columns;
  5993. }
  5994. if (codingPos & 1 ^ blackPixels) {
  5995. ++codingPos;
  5996. }
  5997. codingLine[codingPos] = a1;
  5998. } else if (a1 < codingLine[codingPos]) {
  5999. if (a1 < 0) {
  6000. info('invalid code');
  6001. this.err = true;
  6002. a1 = 0;
  6003. }
  6004. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  6005. --codingPos;
  6006. }
  6007. codingLine[codingPos] = a1;
  6008. }
  6009. this.codingPos = codingPos;
  6010. };
  6011. CCITTFaxStream.prototype.lookChar = function CCITTFaxStream_lookChar() {
  6012. var refLine = this.refLine;
  6013. var codingLine = this.codingLine;
  6014. var columns = this.columns;
  6015. var refPos, blackPixels, bits, i;
  6016. if (this.outputBits === 0) {
  6017. if (this.eof) {
  6018. return null;
  6019. }
  6020. this.err = false;
  6021. var code1, code2, code3;
  6022. if (this.nextLine2D) {
  6023. for (i = 0; codingLine[i] < columns; ++i) {
  6024. refLine[i] = codingLine[i];
  6025. }
  6026. refLine[i++] = columns;
  6027. refLine[i] = columns;
  6028. codingLine[0] = 0;
  6029. this.codingPos = 0;
  6030. refPos = 0;
  6031. blackPixels = 0;
  6032. while (codingLine[this.codingPos] < columns) {
  6033. code1 = this.getTwoDimCode();
  6034. switch (code1) {
  6035. case twoDimPass:
  6036. this.addPixels(refLine[refPos + 1], blackPixels);
  6037. if (refLine[refPos + 1] < columns) {
  6038. refPos += 2;
  6039. }
  6040. break;
  6041. case twoDimHoriz:
  6042. code1 = code2 = 0;
  6043. if (blackPixels) {
  6044. do {
  6045. code1 += code3 = this.getBlackCode();
  6046. } while (code3 >= 64);
  6047. do {
  6048. code2 += code3 = this.getWhiteCode();
  6049. } while (code3 >= 64);
  6050. } else {
  6051. do {
  6052. code1 += code3 = this.getWhiteCode();
  6053. } while (code3 >= 64);
  6054. do {
  6055. code2 += code3 = this.getBlackCode();
  6056. } while (code3 >= 64);
  6057. }
  6058. this.addPixels(codingLine[this.codingPos] + code1, blackPixels);
  6059. if (codingLine[this.codingPos] < columns) {
  6060. this.addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  6061. }
  6062. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  6063. refPos += 2;
  6064. }
  6065. break;
  6066. case twoDimVertR3:
  6067. this.addPixels(refLine[refPos] + 3, blackPixels);
  6068. blackPixels ^= 1;
  6069. if (codingLine[this.codingPos] < columns) {
  6070. ++refPos;
  6071. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  6072. refPos += 2;
  6073. }
  6074. }
  6075. break;
  6076. case twoDimVertR2:
  6077. this.addPixels(refLine[refPos] + 2, blackPixels);
  6078. blackPixels ^= 1;
  6079. if (codingLine[this.codingPos] < columns) {
  6080. ++refPos;
  6081. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  6082. refPos += 2;
  6083. }
  6084. }
  6085. break;
  6086. case twoDimVertR1:
  6087. this.addPixels(refLine[refPos] + 1, blackPixels);
  6088. blackPixels ^= 1;
  6089. if (codingLine[this.codingPos] < columns) {
  6090. ++refPos;
  6091. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  6092. refPos += 2;
  6093. }
  6094. }
  6095. break;
  6096. case twoDimVert0:
  6097. this.addPixels(refLine[refPos], blackPixels);
  6098. blackPixels ^= 1;
  6099. if (codingLine[this.codingPos] < columns) {
  6100. ++refPos;
  6101. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  6102. refPos += 2;
  6103. }
  6104. }
  6105. break;
  6106. case twoDimVertL3:
  6107. this.addPixelsNeg(refLine[refPos] - 3, blackPixels);
  6108. blackPixels ^= 1;
  6109. if (codingLine[this.codingPos] < columns) {
  6110. if (refPos > 0) {
  6111. --refPos;
  6112. } else {
  6113. ++refPos;
  6114. }
  6115. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  6116. refPos += 2;
  6117. }
  6118. }
  6119. break;
  6120. case twoDimVertL2:
  6121. this.addPixelsNeg(refLine[refPos] - 2, blackPixels);
  6122. blackPixels ^= 1;
  6123. if (codingLine[this.codingPos] < columns) {
  6124. if (refPos > 0) {
  6125. --refPos;
  6126. } else {
  6127. ++refPos;
  6128. }
  6129. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  6130. refPos += 2;
  6131. }
  6132. }
  6133. break;
  6134. case twoDimVertL1:
  6135. this.addPixelsNeg(refLine[refPos] - 1, blackPixels);
  6136. blackPixels ^= 1;
  6137. if (codingLine[this.codingPos] < columns) {
  6138. if (refPos > 0) {
  6139. --refPos;
  6140. } else {
  6141. ++refPos;
  6142. }
  6143. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  6144. refPos += 2;
  6145. }
  6146. }
  6147. break;
  6148. case ccittEOF:
  6149. this.addPixels(columns, 0);
  6150. this.eof = true;
  6151. break;
  6152. default:
  6153. info('bad 2d code');
  6154. this.addPixels(columns, 0);
  6155. this.err = true;
  6156. }
  6157. }
  6158. } else {
  6159. codingLine[0] = 0;
  6160. this.codingPos = 0;
  6161. blackPixels = 0;
  6162. while (codingLine[this.codingPos] < columns) {
  6163. code1 = 0;
  6164. if (blackPixels) {
  6165. do {
  6166. code1 += code3 = this.getBlackCode();
  6167. } while (code3 >= 64);
  6168. } else {
  6169. do {
  6170. code1 += code3 = this.getWhiteCode();
  6171. } while (code3 >= 64);
  6172. }
  6173. this.addPixels(codingLine[this.codingPos] + code1, blackPixels);
  6174. blackPixels ^= 1;
  6175. }
  6176. }
  6177. var gotEOL = false;
  6178. if (this.byteAlign) {
  6179. this.inputBits &= ~7;
  6180. }
  6181. if (!this.eoblock && this.row === this.rows - 1) {
  6182. this.eof = true;
  6183. } else {
  6184. code1 = this.lookBits(12);
  6185. if (this.eoline) {
  6186. while (code1 !== ccittEOF && code1 !== 1) {
  6187. this.eatBits(1);
  6188. code1 = this.lookBits(12);
  6189. }
  6190. } else {
  6191. while (code1 === 0) {
  6192. this.eatBits(1);
  6193. code1 = this.lookBits(12);
  6194. }
  6195. }
  6196. if (code1 === 1) {
  6197. this.eatBits(12);
  6198. gotEOL = true;
  6199. } else if (code1 === ccittEOF) {
  6200. this.eof = true;
  6201. }
  6202. }
  6203. if (!this.eof && this.encoding > 0) {
  6204. this.nextLine2D = !this.lookBits(1);
  6205. this.eatBits(1);
  6206. }
  6207. if (this.eoblock && gotEOL && this.byteAlign) {
  6208. code1 = this.lookBits(12);
  6209. if (code1 === 1) {
  6210. this.eatBits(12);
  6211. if (this.encoding > 0) {
  6212. this.lookBits(1);
  6213. this.eatBits(1);
  6214. }
  6215. if (this.encoding >= 0) {
  6216. for (i = 0; i < 4; ++i) {
  6217. code1 = this.lookBits(12);
  6218. if (code1 !== 1) {
  6219. info('bad rtc code: ' + code1);
  6220. }
  6221. this.eatBits(12);
  6222. if (this.encoding > 0) {
  6223. this.lookBits(1);
  6224. this.eatBits(1);
  6225. }
  6226. }
  6227. }
  6228. this.eof = true;
  6229. }
  6230. } else if (this.err && this.eoline) {
  6231. while (true) {
  6232. code1 = this.lookBits(13);
  6233. if (code1 === ccittEOF) {
  6234. this.eof = true;
  6235. return null;
  6236. }
  6237. if (code1 >> 1 === 1) {
  6238. break;
  6239. }
  6240. this.eatBits(1);
  6241. }
  6242. this.eatBits(12);
  6243. if (this.encoding > 0) {
  6244. this.eatBits(1);
  6245. this.nextLine2D = !(code1 & 1);
  6246. }
  6247. }
  6248. if (codingLine[0] > 0) {
  6249. this.outputBits = codingLine[this.codingPos = 0];
  6250. } else {
  6251. this.outputBits = codingLine[this.codingPos = 1];
  6252. }
  6253. this.row++;
  6254. }
  6255. var c;
  6256. if (this.outputBits >= 8) {
  6257. c = this.codingPos & 1 ? 0 : 0xFF;
  6258. this.outputBits -= 8;
  6259. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  6260. this.codingPos++;
  6261. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  6262. }
  6263. } else {
  6264. bits = 8;
  6265. c = 0;
  6266. do {
  6267. if (this.outputBits > bits) {
  6268. c <<= bits;
  6269. if (!(this.codingPos & 1)) {
  6270. c |= 0xFF >> 8 - bits;
  6271. }
  6272. this.outputBits -= bits;
  6273. bits = 0;
  6274. } else {
  6275. c <<= this.outputBits;
  6276. if (!(this.codingPos & 1)) {
  6277. c |= 0xFF >> 8 - this.outputBits;
  6278. }
  6279. bits -= this.outputBits;
  6280. this.outputBits = 0;
  6281. if (codingLine[this.codingPos] < columns) {
  6282. this.codingPos++;
  6283. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  6284. } else if (bits > 0) {
  6285. c <<= bits;
  6286. bits = 0;
  6287. }
  6288. }
  6289. } while (bits);
  6290. }
  6291. if (this.black) {
  6292. c ^= 0xFF;
  6293. }
  6294. return c;
  6295. };
  6296. CCITTFaxStream.prototype.findTableCode = function ccittFaxStreamFindTableCode(start, end, table, limit) {
  6297. var limitValue = limit || 0;
  6298. for (var i = start; i <= end; ++i) {
  6299. var code = this.lookBits(i);
  6300. if (code === ccittEOF) {
  6301. return [
  6302. true,
  6303. 1,
  6304. false
  6305. ];
  6306. }
  6307. if (i < end) {
  6308. code <<= end - i;
  6309. }
  6310. if (!limitValue || code >= limitValue) {
  6311. var p = table[code - limitValue];
  6312. if (p[0] === i) {
  6313. this.eatBits(i);
  6314. return [
  6315. true,
  6316. p[1],
  6317. true
  6318. ];
  6319. }
  6320. }
  6321. }
  6322. return [
  6323. false,
  6324. 0,
  6325. false
  6326. ];
  6327. };
  6328. CCITTFaxStream.prototype.getTwoDimCode = function ccittFaxStreamGetTwoDimCode() {
  6329. var code = 0;
  6330. var p;
  6331. if (this.eoblock) {
  6332. code = this.lookBits(7);
  6333. p = twoDimTable[code];
  6334. if (p && p[0] > 0) {
  6335. this.eatBits(p[0]);
  6336. return p[1];
  6337. }
  6338. } else {
  6339. var result = this.findTableCode(1, 7, twoDimTable);
  6340. if (result[0] && result[2]) {
  6341. return result[1];
  6342. }
  6343. }
  6344. info('Bad two dim code');
  6345. return ccittEOF;
  6346. };
  6347. CCITTFaxStream.prototype.getWhiteCode = function ccittFaxStreamGetWhiteCode() {
  6348. var code = 0;
  6349. var p;
  6350. if (this.eoblock) {
  6351. code = this.lookBits(12);
  6352. if (code === ccittEOF) {
  6353. return 1;
  6354. }
  6355. if (code >> 5 === 0) {
  6356. p = whiteTable1[code];
  6357. } else {
  6358. p = whiteTable2[code >> 3];
  6359. }
  6360. if (p[0] > 0) {
  6361. this.eatBits(p[0]);
  6362. return p[1];
  6363. }
  6364. } else {
  6365. var result = this.findTableCode(1, 9, whiteTable2);
  6366. if (result[0]) {
  6367. return result[1];
  6368. }
  6369. result = this.findTableCode(11, 12, whiteTable1);
  6370. if (result[0]) {
  6371. return result[1];
  6372. }
  6373. }
  6374. info('bad white code');
  6375. this.eatBits(1);
  6376. return 1;
  6377. };
  6378. CCITTFaxStream.prototype.getBlackCode = function ccittFaxStreamGetBlackCode() {
  6379. var code, p;
  6380. if (this.eoblock) {
  6381. code = this.lookBits(13);
  6382. if (code === ccittEOF) {
  6383. return 1;
  6384. }
  6385. if (code >> 7 === 0) {
  6386. p = blackTable1[code];
  6387. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  6388. p = blackTable2[(code >> 1) - 64];
  6389. } else {
  6390. p = blackTable3[code >> 7];
  6391. }
  6392. if (p[0] > 0) {
  6393. this.eatBits(p[0]);
  6394. return p[1];
  6395. }
  6396. } else {
  6397. var result = this.findTableCode(2, 6, blackTable3);
  6398. if (result[0]) {
  6399. return result[1];
  6400. }
  6401. result = this.findTableCode(7, 12, blackTable2, 64);
  6402. if (result[0]) {
  6403. return result[1];
  6404. }
  6405. result = this.findTableCode(10, 13, blackTable1);
  6406. if (result[0]) {
  6407. return result[1];
  6408. }
  6409. }
  6410. info('bad black code');
  6411. this.eatBits(1);
  6412. return 1;
  6413. };
  6414. CCITTFaxStream.prototype.lookBits = function CCITTFaxStream_lookBits(n) {
  6415. var c;
  6416. while (this.inputBits < n) {
  6417. if ((c = this.str.getByte()) === -1) {
  6418. if (this.inputBits === 0) {
  6419. return ccittEOF;
  6420. }
  6421. return this.inputBuf << n - this.inputBits & 0xFFFF >> 16 - n;
  6422. }
  6423. this.inputBuf = this.inputBuf << 8 | c;
  6424. this.inputBits += 8;
  6425. }
  6426. return this.inputBuf >> this.inputBits - n & 0xFFFF >> 16 - n;
  6427. };
  6428. CCITTFaxStream.prototype.eatBits = function CCITTFaxStream_eatBits(n) {
  6429. if ((this.inputBits -= n) < 0) {
  6430. this.inputBits = 0;
  6431. }
  6432. };
  6433. return CCITTFaxStream;
  6434. }();
  6435. var LZWStream = function LZWStreamClosure() {
  6436. function LZWStream(str, maybeLength, earlyChange) {
  6437. this.str = str;
  6438. this.dict = str.dict;
  6439. this.cachedData = 0;
  6440. this.bitsCached = 0;
  6441. var maxLzwDictionarySize = 4096;
  6442. var lzwState = {
  6443. earlyChange: earlyChange,
  6444. codeLength: 9,
  6445. nextCode: 258,
  6446. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  6447. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  6448. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  6449. currentSequence: new Uint8Array(maxLzwDictionarySize),
  6450. currentSequenceLength: 0
  6451. };
  6452. for (var i = 0; i < 256; ++i) {
  6453. lzwState.dictionaryValues[i] = i;
  6454. lzwState.dictionaryLengths[i] = 1;
  6455. }
  6456. this.lzwState = lzwState;
  6457. DecodeStream.call(this, maybeLength);
  6458. }
  6459. LZWStream.prototype = Object.create(DecodeStream.prototype);
  6460. LZWStream.prototype.readBits = function LZWStream_readBits(n) {
  6461. var bitsCached = this.bitsCached;
  6462. var cachedData = this.cachedData;
  6463. while (bitsCached < n) {
  6464. var c = this.str.getByte();
  6465. if (c === -1) {
  6466. this.eof = true;
  6467. return null;
  6468. }
  6469. cachedData = cachedData << 8 | c;
  6470. bitsCached += 8;
  6471. }
  6472. this.bitsCached = bitsCached -= n;
  6473. this.cachedData = cachedData;
  6474. this.lastCode = null;
  6475. return cachedData >>> bitsCached & (1 << n) - 1;
  6476. };
  6477. LZWStream.prototype.readBlock = function LZWStream_readBlock() {
  6478. var blockSize = 512;
  6479. var estimatedDecodedSize = blockSize * 2, decodedSizeDelta = blockSize;
  6480. var i, j, q;
  6481. var lzwState = this.lzwState;
  6482. if (!lzwState) {
  6483. return;
  6484. }
  6485. var earlyChange = lzwState.earlyChange;
  6486. var nextCode = lzwState.nextCode;
  6487. var dictionaryValues = lzwState.dictionaryValues;
  6488. var dictionaryLengths = lzwState.dictionaryLengths;
  6489. var dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  6490. var codeLength = lzwState.codeLength;
  6491. var prevCode = lzwState.prevCode;
  6492. var currentSequence = lzwState.currentSequence;
  6493. var currentSequenceLength = lzwState.currentSequenceLength;
  6494. var decodedLength = 0;
  6495. var currentBufferLength = this.bufferLength;
  6496. var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  6497. for (i = 0; i < blockSize; i++) {
  6498. var code = this.readBits(codeLength);
  6499. var hasPrev = currentSequenceLength > 0;
  6500. if (code < 256) {
  6501. currentSequence[0] = code;
  6502. currentSequenceLength = 1;
  6503. } else if (code >= 258) {
  6504. if (code < nextCode) {
  6505. currentSequenceLength = dictionaryLengths[code];
  6506. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  6507. currentSequence[j] = dictionaryValues[q];
  6508. q = dictionaryPrevCodes[q];
  6509. }
  6510. } else {
  6511. currentSequence[currentSequenceLength++] = currentSequence[0];
  6512. }
  6513. } else if (code === 256) {
  6514. codeLength = 9;
  6515. nextCode = 258;
  6516. currentSequenceLength = 0;
  6517. continue;
  6518. } else {
  6519. this.eof = true;
  6520. delete this.lzwState;
  6521. break;
  6522. }
  6523. if (hasPrev) {
  6524. dictionaryPrevCodes[nextCode] = prevCode;
  6525. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  6526. dictionaryValues[nextCode] = currentSequence[0];
  6527. nextCode++;
  6528. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  6529. }
  6530. prevCode = code;
  6531. decodedLength += currentSequenceLength;
  6532. if (estimatedDecodedSize < decodedLength) {
  6533. do {
  6534. estimatedDecodedSize += decodedSizeDelta;
  6535. } while (estimatedDecodedSize < decodedLength);
  6536. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  6537. }
  6538. for (j = 0; j < currentSequenceLength; j++) {
  6539. buffer[currentBufferLength++] = currentSequence[j];
  6540. }
  6541. }
  6542. lzwState.nextCode = nextCode;
  6543. lzwState.codeLength = codeLength;
  6544. lzwState.prevCode = prevCode;
  6545. lzwState.currentSequenceLength = currentSequenceLength;
  6546. this.bufferLength = currentBufferLength;
  6547. };
  6548. return LZWStream;
  6549. }();
  6550. var NullStream = function NullStreamClosure() {
  6551. function NullStream() {
  6552. Stream.call(this, new Uint8Array(0));
  6553. }
  6554. NullStream.prototype = Stream.prototype;
  6555. return NullStream;
  6556. }();
  6557. exports.Ascii85Stream = Ascii85Stream;
  6558. exports.AsciiHexStream = AsciiHexStream;
  6559. exports.CCITTFaxStream = CCITTFaxStream;
  6560. exports.DecryptStream = DecryptStream;
  6561. exports.DecodeStream = DecodeStream;
  6562. exports.FlateStream = FlateStream;
  6563. exports.Jbig2Stream = Jbig2Stream;
  6564. exports.JpegStream = JpegStream;
  6565. exports.JpxStream = JpxStream;
  6566. exports.NullStream = NullStream;
  6567. exports.PredictorStream = PredictorStream;
  6568. exports.RunLengthStream = RunLengthStream;
  6569. exports.Stream = Stream;
  6570. exports.StreamsSequenceStream = StreamsSequenceStream;
  6571. exports.StringStream = StringStream;
  6572. exports.LZWStream = LZWStream;