luckyexcel.umd.js 340 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424
  1. (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.LuckyExcel = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
  2. 'use strict'
  3. exports.byteLength = byteLength
  4. exports.toByteArray = toByteArray
  5. exports.fromByteArray = fromByteArray
  6. var lookup = []
  7. var revLookup = []
  8. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  9. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  10. for (var i = 0, len = code.length; i < len; ++i) {
  11. lookup[i] = code[i]
  12. revLookup[code.charCodeAt(i)] = i
  13. }
  14. // Support decoding URL-safe base64 strings, as Node.js does.
  15. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  16. revLookup['-'.charCodeAt(0)] = 62
  17. revLookup['_'.charCodeAt(0)] = 63
  18. function getLens (b64) {
  19. var len = b64.length
  20. if (len % 4 > 0) {
  21. throw new Error('Invalid string. Length must be a multiple of 4')
  22. }
  23. // Trim off extra bytes after placeholder bytes are found
  24. // See: https://github.com/beatgammit/base64-js/issues/42
  25. var validLen = b64.indexOf('=')
  26. if (validLen === -1) validLen = len
  27. var placeHoldersLen = validLen === len
  28. ? 0
  29. : 4 - (validLen % 4)
  30. return [validLen, placeHoldersLen]
  31. }
  32. // base64 is 4/3 + up to two characters of the original data
  33. function byteLength (b64) {
  34. var lens = getLens(b64)
  35. var validLen = lens[0]
  36. var placeHoldersLen = lens[1]
  37. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  38. }
  39. function _byteLength (b64, validLen, placeHoldersLen) {
  40. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  41. }
  42. function toByteArray (b64) {
  43. var tmp
  44. var lens = getLens(b64)
  45. var validLen = lens[0]
  46. var placeHoldersLen = lens[1]
  47. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  48. var curByte = 0
  49. // if there are placeholders, only get up to the last complete 4 chars
  50. var len = placeHoldersLen > 0
  51. ? validLen - 4
  52. : validLen
  53. var i
  54. for (i = 0; i < len; i += 4) {
  55. tmp =
  56. (revLookup[b64.charCodeAt(i)] << 18) |
  57. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  58. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  59. revLookup[b64.charCodeAt(i + 3)]
  60. arr[curByte++] = (tmp >> 16) & 0xFF
  61. arr[curByte++] = (tmp >> 8) & 0xFF
  62. arr[curByte++] = tmp & 0xFF
  63. }
  64. if (placeHoldersLen === 2) {
  65. tmp =
  66. (revLookup[b64.charCodeAt(i)] << 2) |
  67. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  68. arr[curByte++] = tmp & 0xFF
  69. }
  70. if (placeHoldersLen === 1) {
  71. tmp =
  72. (revLookup[b64.charCodeAt(i)] << 10) |
  73. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  74. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  75. arr[curByte++] = (tmp >> 8) & 0xFF
  76. arr[curByte++] = tmp & 0xFF
  77. }
  78. return arr
  79. }
  80. function tripletToBase64 (num) {
  81. return lookup[num >> 18 & 0x3F] +
  82. lookup[num >> 12 & 0x3F] +
  83. lookup[num >> 6 & 0x3F] +
  84. lookup[num & 0x3F]
  85. }
  86. function encodeChunk (uint8, start, end) {
  87. var tmp
  88. var output = []
  89. for (var i = start; i < end; i += 3) {
  90. tmp =
  91. ((uint8[i] << 16) & 0xFF0000) +
  92. ((uint8[i + 1] << 8) & 0xFF00) +
  93. (uint8[i + 2] & 0xFF)
  94. output.push(tripletToBase64(tmp))
  95. }
  96. return output.join('')
  97. }
  98. function fromByteArray (uint8) {
  99. var tmp
  100. var len = uint8.length
  101. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  102. var parts = []
  103. var maxChunkLength = 16383 // must be multiple of 3
  104. // go through the array every three bytes, we'll deal with trailing stuff later
  105. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  106. parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
  107. }
  108. // pad the end with zeros, but make sure to not forget the extra bytes
  109. if (extraBytes === 1) {
  110. tmp = uint8[len - 1]
  111. parts.push(
  112. lookup[tmp >> 2] +
  113. lookup[(tmp << 4) & 0x3F] +
  114. '=='
  115. )
  116. } else if (extraBytes === 2) {
  117. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  118. parts.push(
  119. lookup[tmp >> 10] +
  120. lookup[(tmp >> 4) & 0x3F] +
  121. lookup[(tmp << 2) & 0x3F] +
  122. '='
  123. )
  124. }
  125. return parts.join('')
  126. }
  127. },{}],2:[function(require,module,exports){
  128. (function (global,Buffer){(function (){
  129. /*!
  130. * The buffer module from node.js, for the browser.
  131. *
  132. * @author Feross Aboukhadijeh <http://feross.org>
  133. * @license MIT
  134. */
  135. /* eslint-disable no-proto */
  136. 'use strict'
  137. var base64 = require('base64-js')
  138. var ieee754 = require('ieee754')
  139. var isArray = require('isarray')
  140. exports.Buffer = Buffer
  141. exports.SlowBuffer = SlowBuffer
  142. exports.INSPECT_MAX_BYTES = 50
  143. /**
  144. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  145. * === true Use Uint8Array implementation (fastest)
  146. * === false Use Object implementation (most compatible, even IE6)
  147. *
  148. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  149. * Opera 11.6+, iOS 4.2+.
  150. *
  151. * Due to various browser bugs, sometimes the Object implementation will be used even
  152. * when the browser supports typed arrays.
  153. *
  154. * Note:
  155. *
  156. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  157. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  158. *
  159. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  160. *
  161. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  162. * incorrect length in some situations.
  163. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  164. * get the Object implementation, which is slower but behaves correctly.
  165. */
  166. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  167. ? global.TYPED_ARRAY_SUPPORT
  168. : typedArraySupport()
  169. /*
  170. * Export kMaxLength after typed array support is determined.
  171. */
  172. exports.kMaxLength = kMaxLength()
  173. function typedArraySupport () {
  174. try {
  175. var arr = new Uint8Array(1)
  176. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  177. return arr.foo() === 42 && // typed array instances can be augmented
  178. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  179. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  180. } catch (e) {
  181. return false
  182. }
  183. }
  184. function kMaxLength () {
  185. return Buffer.TYPED_ARRAY_SUPPORT
  186. ? 0x7fffffff
  187. : 0x3fffffff
  188. }
  189. function createBuffer (that, length) {
  190. if (kMaxLength() < length) {
  191. throw new RangeError('Invalid typed array length')
  192. }
  193. if (Buffer.TYPED_ARRAY_SUPPORT) {
  194. // Return an augmented `Uint8Array` instance, for best performance
  195. that = new Uint8Array(length)
  196. that.__proto__ = Buffer.prototype
  197. } else {
  198. // Fallback: Return an object instance of the Buffer class
  199. if (that === null) {
  200. that = new Buffer(length)
  201. }
  202. that.length = length
  203. }
  204. return that
  205. }
  206. /**
  207. * The Buffer constructor returns instances of `Uint8Array` that have their
  208. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  209. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  210. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  211. * returns a single octet.
  212. *
  213. * The `Uint8Array` prototype remains unmodified.
  214. */
  215. function Buffer (arg, encodingOrOffset, length) {
  216. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  217. return new Buffer(arg, encodingOrOffset, length)
  218. }
  219. // Common case.
  220. if (typeof arg === 'number') {
  221. if (typeof encodingOrOffset === 'string') {
  222. throw new Error(
  223. 'If encoding is specified then the first argument must be a string'
  224. )
  225. }
  226. return allocUnsafe(this, arg)
  227. }
  228. return from(this, arg, encodingOrOffset, length)
  229. }
  230. Buffer.poolSize = 8192 // not used by this implementation
  231. // TODO: Legacy, not needed anymore. Remove in next major version.
  232. Buffer._augment = function (arr) {
  233. arr.__proto__ = Buffer.prototype
  234. return arr
  235. }
  236. function from (that, value, encodingOrOffset, length) {
  237. if (typeof value === 'number') {
  238. throw new TypeError('"value" argument must not be a number')
  239. }
  240. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  241. return fromArrayBuffer(that, value, encodingOrOffset, length)
  242. }
  243. if (typeof value === 'string') {
  244. return fromString(that, value, encodingOrOffset)
  245. }
  246. return fromObject(that, value)
  247. }
  248. /**
  249. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  250. * if value is a number.
  251. * Buffer.from(str[, encoding])
  252. * Buffer.from(array)
  253. * Buffer.from(buffer)
  254. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  255. **/
  256. Buffer.from = function (value, encodingOrOffset, length) {
  257. return from(null, value, encodingOrOffset, length)
  258. }
  259. if (Buffer.TYPED_ARRAY_SUPPORT) {
  260. Buffer.prototype.__proto__ = Uint8Array.prototype
  261. Buffer.__proto__ = Uint8Array
  262. if (typeof Symbol !== 'undefined' && Symbol.species &&
  263. Buffer[Symbol.species] === Buffer) {
  264. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  265. Object.defineProperty(Buffer, Symbol.species, {
  266. value: null,
  267. configurable: true
  268. })
  269. }
  270. }
  271. function assertSize (size) {
  272. if (typeof size !== 'number') {
  273. throw new TypeError('"size" argument must be a number')
  274. } else if (size < 0) {
  275. throw new RangeError('"size" argument must not be negative')
  276. }
  277. }
  278. function alloc (that, size, fill, encoding) {
  279. assertSize(size)
  280. if (size <= 0) {
  281. return createBuffer(that, size)
  282. }
  283. if (fill !== undefined) {
  284. // Only pay attention to encoding if it's a string. This
  285. // prevents accidentally sending in a number that would
  286. // be interpretted as a start offset.
  287. return typeof encoding === 'string'
  288. ? createBuffer(that, size).fill(fill, encoding)
  289. : createBuffer(that, size).fill(fill)
  290. }
  291. return createBuffer(that, size)
  292. }
  293. /**
  294. * Creates a new filled Buffer instance.
  295. * alloc(size[, fill[, encoding]])
  296. **/
  297. Buffer.alloc = function (size, fill, encoding) {
  298. return alloc(null, size, fill, encoding)
  299. }
  300. function allocUnsafe (that, size) {
  301. assertSize(size)
  302. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  303. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  304. for (var i = 0; i < size; ++i) {
  305. that[i] = 0
  306. }
  307. }
  308. return that
  309. }
  310. /**
  311. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  312. * */
  313. Buffer.allocUnsafe = function (size) {
  314. return allocUnsafe(null, size)
  315. }
  316. /**
  317. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  318. */
  319. Buffer.allocUnsafeSlow = function (size) {
  320. return allocUnsafe(null, size)
  321. }
  322. function fromString (that, string, encoding) {
  323. if (typeof encoding !== 'string' || encoding === '') {
  324. encoding = 'utf8'
  325. }
  326. if (!Buffer.isEncoding(encoding)) {
  327. throw new TypeError('"encoding" must be a valid string encoding')
  328. }
  329. var length = byteLength(string, encoding) | 0
  330. that = createBuffer(that, length)
  331. var actual = that.write(string, encoding)
  332. if (actual !== length) {
  333. // Writing a hex string, for example, that contains invalid characters will
  334. // cause everything after the first invalid character to be ignored. (e.g.
  335. // 'abxxcd' will be treated as 'ab')
  336. that = that.slice(0, actual)
  337. }
  338. return that
  339. }
  340. function fromArrayLike (that, array) {
  341. var length = array.length < 0 ? 0 : checked(array.length) | 0
  342. that = createBuffer(that, length)
  343. for (var i = 0; i < length; i += 1) {
  344. that[i] = array[i] & 255
  345. }
  346. return that
  347. }
  348. function fromArrayBuffer (that, array, byteOffset, length) {
  349. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  350. if (byteOffset < 0 || array.byteLength < byteOffset) {
  351. throw new RangeError('\'offset\' is out of bounds')
  352. }
  353. if (array.byteLength < byteOffset + (length || 0)) {
  354. throw new RangeError('\'length\' is out of bounds')
  355. }
  356. if (byteOffset === undefined && length === undefined) {
  357. array = new Uint8Array(array)
  358. } else if (length === undefined) {
  359. array = new Uint8Array(array, byteOffset)
  360. } else {
  361. array = new Uint8Array(array, byteOffset, length)
  362. }
  363. if (Buffer.TYPED_ARRAY_SUPPORT) {
  364. // Return an augmented `Uint8Array` instance, for best performance
  365. that = array
  366. that.__proto__ = Buffer.prototype
  367. } else {
  368. // Fallback: Return an object instance of the Buffer class
  369. that = fromArrayLike(that, array)
  370. }
  371. return that
  372. }
  373. function fromObject (that, obj) {
  374. if (Buffer.isBuffer(obj)) {
  375. var len = checked(obj.length) | 0
  376. that = createBuffer(that, len)
  377. if (that.length === 0) {
  378. return that
  379. }
  380. obj.copy(that, 0, 0, len)
  381. return that
  382. }
  383. if (obj) {
  384. if ((typeof ArrayBuffer !== 'undefined' &&
  385. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  386. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  387. return createBuffer(that, 0)
  388. }
  389. return fromArrayLike(that, obj)
  390. }
  391. if (obj.type === 'Buffer' && isArray(obj.data)) {
  392. return fromArrayLike(that, obj.data)
  393. }
  394. }
  395. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  396. }
  397. function checked (length) {
  398. // Note: cannot use `length < kMaxLength()` here because that fails when
  399. // length is NaN (which is otherwise coerced to zero.)
  400. if (length >= kMaxLength()) {
  401. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  402. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  403. }
  404. return length | 0
  405. }
  406. function SlowBuffer (length) {
  407. if (+length != length) { // eslint-disable-line eqeqeq
  408. length = 0
  409. }
  410. return Buffer.alloc(+length)
  411. }
  412. Buffer.isBuffer = function isBuffer (b) {
  413. return !!(b != null && b._isBuffer)
  414. }
  415. Buffer.compare = function compare (a, b) {
  416. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  417. throw new TypeError('Arguments must be Buffers')
  418. }
  419. if (a === b) return 0
  420. var x = a.length
  421. var y = b.length
  422. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  423. if (a[i] !== b[i]) {
  424. x = a[i]
  425. y = b[i]
  426. break
  427. }
  428. }
  429. if (x < y) return -1
  430. if (y < x) return 1
  431. return 0
  432. }
  433. Buffer.isEncoding = function isEncoding (encoding) {
  434. switch (String(encoding).toLowerCase()) {
  435. case 'hex':
  436. case 'utf8':
  437. case 'utf-8':
  438. case 'ascii':
  439. case 'latin1':
  440. case 'binary':
  441. case 'base64':
  442. case 'ucs2':
  443. case 'ucs-2':
  444. case 'utf16le':
  445. case 'utf-16le':
  446. return true
  447. default:
  448. return false
  449. }
  450. }
  451. Buffer.concat = function concat (list, length) {
  452. if (!isArray(list)) {
  453. throw new TypeError('"list" argument must be an Array of Buffers')
  454. }
  455. if (list.length === 0) {
  456. return Buffer.alloc(0)
  457. }
  458. var i
  459. if (length === undefined) {
  460. length = 0
  461. for (i = 0; i < list.length; ++i) {
  462. length += list[i].length
  463. }
  464. }
  465. var buffer = Buffer.allocUnsafe(length)
  466. var pos = 0
  467. for (i = 0; i < list.length; ++i) {
  468. var buf = list[i]
  469. if (!Buffer.isBuffer(buf)) {
  470. throw new TypeError('"list" argument must be an Array of Buffers')
  471. }
  472. buf.copy(buffer, pos)
  473. pos += buf.length
  474. }
  475. return buffer
  476. }
  477. function byteLength (string, encoding) {
  478. if (Buffer.isBuffer(string)) {
  479. return string.length
  480. }
  481. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  482. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  483. return string.byteLength
  484. }
  485. if (typeof string !== 'string') {
  486. string = '' + string
  487. }
  488. var len = string.length
  489. if (len === 0) return 0
  490. // Use a for loop to avoid recursion
  491. var loweredCase = false
  492. for (;;) {
  493. switch (encoding) {
  494. case 'ascii':
  495. case 'latin1':
  496. case 'binary':
  497. return len
  498. case 'utf8':
  499. case 'utf-8':
  500. case undefined:
  501. return utf8ToBytes(string).length
  502. case 'ucs2':
  503. case 'ucs-2':
  504. case 'utf16le':
  505. case 'utf-16le':
  506. return len * 2
  507. case 'hex':
  508. return len >>> 1
  509. case 'base64':
  510. return base64ToBytes(string).length
  511. default:
  512. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  513. encoding = ('' + encoding).toLowerCase()
  514. loweredCase = true
  515. }
  516. }
  517. }
  518. Buffer.byteLength = byteLength
  519. function slowToString (encoding, start, end) {
  520. var loweredCase = false
  521. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  522. // property of a typed array.
  523. // This behaves neither like String nor Uint8Array in that we set start/end
  524. // to their upper/lower bounds if the value passed is out of range.
  525. // undefined is handled specially as per ECMA-262 6th Edition,
  526. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  527. if (start === undefined || start < 0) {
  528. start = 0
  529. }
  530. // Return early if start > this.length. Done here to prevent potential uint32
  531. // coercion fail below.
  532. if (start > this.length) {
  533. return ''
  534. }
  535. if (end === undefined || end > this.length) {
  536. end = this.length
  537. }
  538. if (end <= 0) {
  539. return ''
  540. }
  541. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  542. end >>>= 0
  543. start >>>= 0
  544. if (end <= start) {
  545. return ''
  546. }
  547. if (!encoding) encoding = 'utf8'
  548. while (true) {
  549. switch (encoding) {
  550. case 'hex':
  551. return hexSlice(this, start, end)
  552. case 'utf8':
  553. case 'utf-8':
  554. return utf8Slice(this, start, end)
  555. case 'ascii':
  556. return asciiSlice(this, start, end)
  557. case 'latin1':
  558. case 'binary':
  559. return latin1Slice(this, start, end)
  560. case 'base64':
  561. return base64Slice(this, start, end)
  562. case 'ucs2':
  563. case 'ucs-2':
  564. case 'utf16le':
  565. case 'utf-16le':
  566. return utf16leSlice(this, start, end)
  567. default:
  568. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  569. encoding = (encoding + '').toLowerCase()
  570. loweredCase = true
  571. }
  572. }
  573. }
  574. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  575. // Buffer instances.
  576. Buffer.prototype._isBuffer = true
  577. function swap (b, n, m) {
  578. var i = b[n]
  579. b[n] = b[m]
  580. b[m] = i
  581. }
  582. Buffer.prototype.swap16 = function swap16 () {
  583. var len = this.length
  584. if (len % 2 !== 0) {
  585. throw new RangeError('Buffer size must be a multiple of 16-bits')
  586. }
  587. for (var i = 0; i < len; i += 2) {
  588. swap(this, i, i + 1)
  589. }
  590. return this
  591. }
  592. Buffer.prototype.swap32 = function swap32 () {
  593. var len = this.length
  594. if (len % 4 !== 0) {
  595. throw new RangeError('Buffer size must be a multiple of 32-bits')
  596. }
  597. for (var i = 0; i < len; i += 4) {
  598. swap(this, i, i + 3)
  599. swap(this, i + 1, i + 2)
  600. }
  601. return this
  602. }
  603. Buffer.prototype.swap64 = function swap64 () {
  604. var len = this.length
  605. if (len % 8 !== 0) {
  606. throw new RangeError('Buffer size must be a multiple of 64-bits')
  607. }
  608. for (var i = 0; i < len; i += 8) {
  609. swap(this, i, i + 7)
  610. swap(this, i + 1, i + 6)
  611. swap(this, i + 2, i + 5)
  612. swap(this, i + 3, i + 4)
  613. }
  614. return this
  615. }
  616. Buffer.prototype.toString = function toString () {
  617. var length = this.length | 0
  618. if (length === 0) return ''
  619. if (arguments.length === 0) return utf8Slice(this, 0, length)
  620. return slowToString.apply(this, arguments)
  621. }
  622. Buffer.prototype.equals = function equals (b) {
  623. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  624. if (this === b) return true
  625. return Buffer.compare(this, b) === 0
  626. }
  627. Buffer.prototype.inspect = function inspect () {
  628. var str = ''
  629. var max = exports.INSPECT_MAX_BYTES
  630. if (this.length > 0) {
  631. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  632. if (this.length > max) str += ' ... '
  633. }
  634. return '<Buffer ' + str + '>'
  635. }
  636. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  637. if (!Buffer.isBuffer(target)) {
  638. throw new TypeError('Argument must be a Buffer')
  639. }
  640. if (start === undefined) {
  641. start = 0
  642. }
  643. if (end === undefined) {
  644. end = target ? target.length : 0
  645. }
  646. if (thisStart === undefined) {
  647. thisStart = 0
  648. }
  649. if (thisEnd === undefined) {
  650. thisEnd = this.length
  651. }
  652. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  653. throw new RangeError('out of range index')
  654. }
  655. if (thisStart >= thisEnd && start >= end) {
  656. return 0
  657. }
  658. if (thisStart >= thisEnd) {
  659. return -1
  660. }
  661. if (start >= end) {
  662. return 1
  663. }
  664. start >>>= 0
  665. end >>>= 0
  666. thisStart >>>= 0
  667. thisEnd >>>= 0
  668. if (this === target) return 0
  669. var x = thisEnd - thisStart
  670. var y = end - start
  671. var len = Math.min(x, y)
  672. var thisCopy = this.slice(thisStart, thisEnd)
  673. var targetCopy = target.slice(start, end)
  674. for (var i = 0; i < len; ++i) {
  675. if (thisCopy[i] !== targetCopy[i]) {
  676. x = thisCopy[i]
  677. y = targetCopy[i]
  678. break
  679. }
  680. }
  681. if (x < y) return -1
  682. if (y < x) return 1
  683. return 0
  684. }
  685. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  686. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  687. //
  688. // Arguments:
  689. // - buffer - a Buffer to search
  690. // - val - a string, Buffer, or number
  691. // - byteOffset - an index into `buffer`; will be clamped to an int32
  692. // - encoding - an optional encoding, relevant is val is a string
  693. // - dir - true for indexOf, false for lastIndexOf
  694. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  695. // Empty buffer means no match
  696. if (buffer.length === 0) return -1
  697. // Normalize byteOffset
  698. if (typeof byteOffset === 'string') {
  699. encoding = byteOffset
  700. byteOffset = 0
  701. } else if (byteOffset > 0x7fffffff) {
  702. byteOffset = 0x7fffffff
  703. } else if (byteOffset < -0x80000000) {
  704. byteOffset = -0x80000000
  705. }
  706. byteOffset = +byteOffset // Coerce to Number.
  707. if (isNaN(byteOffset)) {
  708. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  709. byteOffset = dir ? 0 : (buffer.length - 1)
  710. }
  711. // Normalize byteOffset: negative offsets start from the end of the buffer
  712. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  713. if (byteOffset >= buffer.length) {
  714. if (dir) return -1
  715. else byteOffset = buffer.length - 1
  716. } else if (byteOffset < 0) {
  717. if (dir) byteOffset = 0
  718. else return -1
  719. }
  720. // Normalize val
  721. if (typeof val === 'string') {
  722. val = Buffer.from(val, encoding)
  723. }
  724. // Finally, search either indexOf (if dir is true) or lastIndexOf
  725. if (Buffer.isBuffer(val)) {
  726. // Special case: looking for empty string/buffer always fails
  727. if (val.length === 0) {
  728. return -1
  729. }
  730. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  731. } else if (typeof val === 'number') {
  732. val = val & 0xFF // Search for a byte value [0-255]
  733. if (Buffer.TYPED_ARRAY_SUPPORT &&
  734. typeof Uint8Array.prototype.indexOf === 'function') {
  735. if (dir) {
  736. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  737. } else {
  738. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  739. }
  740. }
  741. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  742. }
  743. throw new TypeError('val must be string, number or Buffer')
  744. }
  745. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  746. var indexSize = 1
  747. var arrLength = arr.length
  748. var valLength = val.length
  749. if (encoding !== undefined) {
  750. encoding = String(encoding).toLowerCase()
  751. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  752. encoding === 'utf16le' || encoding === 'utf-16le') {
  753. if (arr.length < 2 || val.length < 2) {
  754. return -1
  755. }
  756. indexSize = 2
  757. arrLength /= 2
  758. valLength /= 2
  759. byteOffset /= 2
  760. }
  761. }
  762. function read (buf, i) {
  763. if (indexSize === 1) {
  764. return buf[i]
  765. } else {
  766. return buf.readUInt16BE(i * indexSize)
  767. }
  768. }
  769. var i
  770. if (dir) {
  771. var foundIndex = -1
  772. for (i = byteOffset; i < arrLength; i++) {
  773. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  774. if (foundIndex === -1) foundIndex = i
  775. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  776. } else {
  777. if (foundIndex !== -1) i -= i - foundIndex
  778. foundIndex = -1
  779. }
  780. }
  781. } else {
  782. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  783. for (i = byteOffset; i >= 0; i--) {
  784. var found = true
  785. for (var j = 0; j < valLength; j++) {
  786. if (read(arr, i + j) !== read(val, j)) {
  787. found = false
  788. break
  789. }
  790. }
  791. if (found) return i
  792. }
  793. }
  794. return -1
  795. }
  796. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  797. return this.indexOf(val, byteOffset, encoding) !== -1
  798. }
  799. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  800. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  801. }
  802. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  803. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  804. }
  805. function hexWrite (buf, string, offset, length) {
  806. offset = Number(offset) || 0
  807. var remaining = buf.length - offset
  808. if (!length) {
  809. length = remaining
  810. } else {
  811. length = Number(length)
  812. if (length > remaining) {
  813. length = remaining
  814. }
  815. }
  816. // must be an even number of digits
  817. var strLen = string.length
  818. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  819. if (length > strLen / 2) {
  820. length = strLen / 2
  821. }
  822. for (var i = 0; i < length; ++i) {
  823. var parsed = parseInt(string.substr(i * 2, 2), 16)
  824. if (isNaN(parsed)) return i
  825. buf[offset + i] = parsed
  826. }
  827. return i
  828. }
  829. function utf8Write (buf, string, offset, length) {
  830. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  831. }
  832. function asciiWrite (buf, string, offset, length) {
  833. return blitBuffer(asciiToBytes(string), buf, offset, length)
  834. }
  835. function latin1Write (buf, string, offset, length) {
  836. return asciiWrite(buf, string, offset, length)
  837. }
  838. function base64Write (buf, string, offset, length) {
  839. return blitBuffer(base64ToBytes(string), buf, offset, length)
  840. }
  841. function ucs2Write (buf, string, offset, length) {
  842. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  843. }
  844. Buffer.prototype.write = function write (string, offset, length, encoding) {
  845. // Buffer#write(string)
  846. if (offset === undefined) {
  847. encoding = 'utf8'
  848. length = this.length
  849. offset = 0
  850. // Buffer#write(string, encoding)
  851. } else if (length === undefined && typeof offset === 'string') {
  852. encoding = offset
  853. length = this.length
  854. offset = 0
  855. // Buffer#write(string, offset[, length][, encoding])
  856. } else if (isFinite(offset)) {
  857. offset = offset | 0
  858. if (isFinite(length)) {
  859. length = length | 0
  860. if (encoding === undefined) encoding = 'utf8'
  861. } else {
  862. encoding = length
  863. length = undefined
  864. }
  865. // legacy write(string, encoding, offset, length) - remove in v0.13
  866. } else {
  867. throw new Error(
  868. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  869. )
  870. }
  871. var remaining = this.length - offset
  872. if (length === undefined || length > remaining) length = remaining
  873. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  874. throw new RangeError('Attempt to write outside buffer bounds')
  875. }
  876. if (!encoding) encoding = 'utf8'
  877. var loweredCase = false
  878. for (;;) {
  879. switch (encoding) {
  880. case 'hex':
  881. return hexWrite(this, string, offset, length)
  882. case 'utf8':
  883. case 'utf-8':
  884. return utf8Write(this, string, offset, length)
  885. case 'ascii':
  886. return asciiWrite(this, string, offset, length)
  887. case 'latin1':
  888. case 'binary':
  889. return latin1Write(this, string, offset, length)
  890. case 'base64':
  891. // Warning: maxLength not taken into account in base64Write
  892. return base64Write(this, string, offset, length)
  893. case 'ucs2':
  894. case 'ucs-2':
  895. case 'utf16le':
  896. case 'utf-16le':
  897. return ucs2Write(this, string, offset, length)
  898. default:
  899. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  900. encoding = ('' + encoding).toLowerCase()
  901. loweredCase = true
  902. }
  903. }
  904. }
  905. Buffer.prototype.toJSON = function toJSON () {
  906. return {
  907. type: 'Buffer',
  908. data: Array.prototype.slice.call(this._arr || this, 0)
  909. }
  910. }
  911. function base64Slice (buf, start, end) {
  912. if (start === 0 && end === buf.length) {
  913. return base64.fromByteArray(buf)
  914. } else {
  915. return base64.fromByteArray(buf.slice(start, end))
  916. }
  917. }
  918. function utf8Slice (buf, start, end) {
  919. end = Math.min(buf.length, end)
  920. var res = []
  921. var i = start
  922. while (i < end) {
  923. var firstByte = buf[i]
  924. var codePoint = null
  925. var bytesPerSequence = (firstByte > 0xEF) ? 4
  926. : (firstByte > 0xDF) ? 3
  927. : (firstByte > 0xBF) ? 2
  928. : 1
  929. if (i + bytesPerSequence <= end) {
  930. var secondByte, thirdByte, fourthByte, tempCodePoint
  931. switch (bytesPerSequence) {
  932. case 1:
  933. if (firstByte < 0x80) {
  934. codePoint = firstByte
  935. }
  936. break
  937. case 2:
  938. secondByte = buf[i + 1]
  939. if ((secondByte & 0xC0) === 0x80) {
  940. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  941. if (tempCodePoint > 0x7F) {
  942. codePoint = tempCodePoint
  943. }
  944. }
  945. break
  946. case 3:
  947. secondByte = buf[i + 1]
  948. thirdByte = buf[i + 2]
  949. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  950. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  951. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  952. codePoint = tempCodePoint
  953. }
  954. }
  955. break
  956. case 4:
  957. secondByte = buf[i + 1]
  958. thirdByte = buf[i + 2]
  959. fourthByte = buf[i + 3]
  960. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  961. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  962. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  963. codePoint = tempCodePoint
  964. }
  965. }
  966. }
  967. }
  968. if (codePoint === null) {
  969. // we did not generate a valid codePoint so insert a
  970. // replacement char (U+FFFD) and advance only 1 byte
  971. codePoint = 0xFFFD
  972. bytesPerSequence = 1
  973. } else if (codePoint > 0xFFFF) {
  974. // encode to utf16 (surrogate pair dance)
  975. codePoint -= 0x10000
  976. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  977. codePoint = 0xDC00 | codePoint & 0x3FF
  978. }
  979. res.push(codePoint)
  980. i += bytesPerSequence
  981. }
  982. return decodeCodePointsArray(res)
  983. }
  984. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  985. // the lowest limit is Chrome, with 0x10000 args.
  986. // We go 1 magnitude less, for safety
  987. var MAX_ARGUMENTS_LENGTH = 0x1000
  988. function decodeCodePointsArray (codePoints) {
  989. var len = codePoints.length
  990. if (len <= MAX_ARGUMENTS_LENGTH) {
  991. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  992. }
  993. // Decode in chunks to avoid "call stack size exceeded".
  994. var res = ''
  995. var i = 0
  996. while (i < len) {
  997. res += String.fromCharCode.apply(
  998. String,
  999. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  1000. )
  1001. }
  1002. return res
  1003. }
  1004. function asciiSlice (buf, start, end) {
  1005. var ret = ''
  1006. end = Math.min(buf.length, end)
  1007. for (var i = start; i < end; ++i) {
  1008. ret += String.fromCharCode(buf[i] & 0x7F)
  1009. }
  1010. return ret
  1011. }
  1012. function latin1Slice (buf, start, end) {
  1013. var ret = ''
  1014. end = Math.min(buf.length, end)
  1015. for (var i = start; i < end; ++i) {
  1016. ret += String.fromCharCode(buf[i])
  1017. }
  1018. return ret
  1019. }
  1020. function hexSlice (buf, start, end) {
  1021. var len = buf.length
  1022. if (!start || start < 0) start = 0
  1023. if (!end || end < 0 || end > len) end = len
  1024. var out = ''
  1025. for (var i = start; i < end; ++i) {
  1026. out += toHex(buf[i])
  1027. }
  1028. return out
  1029. }
  1030. function utf16leSlice (buf, start, end) {
  1031. var bytes = buf.slice(start, end)
  1032. var res = ''
  1033. for (var i = 0; i < bytes.length; i += 2) {
  1034. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  1035. }
  1036. return res
  1037. }
  1038. Buffer.prototype.slice = function slice (start, end) {
  1039. var len = this.length
  1040. start = ~~start
  1041. end = end === undefined ? len : ~~end
  1042. if (start < 0) {
  1043. start += len
  1044. if (start < 0) start = 0
  1045. } else if (start > len) {
  1046. start = len
  1047. }
  1048. if (end < 0) {
  1049. end += len
  1050. if (end < 0) end = 0
  1051. } else if (end > len) {
  1052. end = len
  1053. }
  1054. if (end < start) end = start
  1055. var newBuf
  1056. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1057. newBuf = this.subarray(start, end)
  1058. newBuf.__proto__ = Buffer.prototype
  1059. } else {
  1060. var sliceLen = end - start
  1061. newBuf = new Buffer(sliceLen, undefined)
  1062. for (var i = 0; i < sliceLen; ++i) {
  1063. newBuf[i] = this[i + start]
  1064. }
  1065. }
  1066. return newBuf
  1067. }
  1068. /*
  1069. * Need to make sure that buffer isn't trying to write out of bounds.
  1070. */
  1071. function checkOffset (offset, ext, length) {
  1072. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  1073. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  1074. }
  1075. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  1076. offset = offset | 0
  1077. byteLength = byteLength | 0
  1078. if (!noAssert) checkOffset(offset, byteLength, this.length)
  1079. var val = this[offset]
  1080. var mul = 1
  1081. var i = 0
  1082. while (++i < byteLength && (mul *= 0x100)) {
  1083. val += this[offset + i] * mul
  1084. }
  1085. return val
  1086. }
  1087. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  1088. offset = offset | 0
  1089. byteLength = byteLength | 0
  1090. if (!noAssert) {
  1091. checkOffset(offset, byteLength, this.length)
  1092. }
  1093. var val = this[offset + --byteLength]
  1094. var mul = 1
  1095. while (byteLength > 0 && (mul *= 0x100)) {
  1096. val += this[offset + --byteLength] * mul
  1097. }
  1098. return val
  1099. }
  1100. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  1101. if (!noAssert) checkOffset(offset, 1, this.length)
  1102. return this[offset]
  1103. }
  1104. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  1105. if (!noAssert) checkOffset(offset, 2, this.length)
  1106. return this[offset] | (this[offset + 1] << 8)
  1107. }
  1108. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  1109. if (!noAssert) checkOffset(offset, 2, this.length)
  1110. return (this[offset] << 8) | this[offset + 1]
  1111. }
  1112. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  1113. if (!noAssert) checkOffset(offset, 4, this.length)
  1114. return ((this[offset]) |
  1115. (this[offset + 1] << 8) |
  1116. (this[offset + 2] << 16)) +
  1117. (this[offset + 3] * 0x1000000)
  1118. }
  1119. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  1120. if (!noAssert) checkOffset(offset, 4, this.length)
  1121. return (this[offset] * 0x1000000) +
  1122. ((this[offset + 1] << 16) |
  1123. (this[offset + 2] << 8) |
  1124. this[offset + 3])
  1125. }
  1126. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  1127. offset = offset | 0
  1128. byteLength = byteLength | 0
  1129. if (!noAssert) checkOffset(offset, byteLength, this.length)
  1130. var val = this[offset]
  1131. var mul = 1
  1132. var i = 0
  1133. while (++i < byteLength && (mul *= 0x100)) {
  1134. val += this[offset + i] * mul
  1135. }
  1136. mul *= 0x80
  1137. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  1138. return val
  1139. }
  1140. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  1141. offset = offset | 0
  1142. byteLength = byteLength | 0
  1143. if (!noAssert) checkOffset(offset, byteLength, this.length)
  1144. var i = byteLength
  1145. var mul = 1
  1146. var val = this[offset + --i]
  1147. while (i > 0 && (mul *= 0x100)) {
  1148. val += this[offset + --i] * mul
  1149. }
  1150. mul *= 0x80
  1151. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  1152. return val
  1153. }
  1154. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  1155. if (!noAssert) checkOffset(offset, 1, this.length)
  1156. if (!(this[offset] & 0x80)) return (this[offset])
  1157. return ((0xff - this[offset] + 1) * -1)
  1158. }
  1159. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  1160. if (!noAssert) checkOffset(offset, 2, this.length)
  1161. var val = this[offset] | (this[offset + 1] << 8)
  1162. return (val & 0x8000) ? val | 0xFFFF0000 : val
  1163. }
  1164. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  1165. if (!noAssert) checkOffset(offset, 2, this.length)
  1166. var val = this[offset + 1] | (this[offset] << 8)
  1167. return (val & 0x8000) ? val | 0xFFFF0000 : val
  1168. }
  1169. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  1170. if (!noAssert) checkOffset(offset, 4, this.length)
  1171. return (this[offset]) |
  1172. (this[offset + 1] << 8) |
  1173. (this[offset + 2] << 16) |
  1174. (this[offset + 3] << 24)
  1175. }
  1176. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  1177. if (!noAssert) checkOffset(offset, 4, this.length)
  1178. return (this[offset] << 24) |
  1179. (this[offset + 1] << 16) |
  1180. (this[offset + 2] << 8) |
  1181. (this[offset + 3])
  1182. }
  1183. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  1184. if (!noAssert) checkOffset(offset, 4, this.length)
  1185. return ieee754.read(this, offset, true, 23, 4)
  1186. }
  1187. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  1188. if (!noAssert) checkOffset(offset, 4, this.length)
  1189. return ieee754.read(this, offset, false, 23, 4)
  1190. }
  1191. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  1192. if (!noAssert) checkOffset(offset, 8, this.length)
  1193. return ieee754.read(this, offset, true, 52, 8)
  1194. }
  1195. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  1196. if (!noAssert) checkOffset(offset, 8, this.length)
  1197. return ieee754.read(this, offset, false, 52, 8)
  1198. }
  1199. function checkInt (buf, value, offset, ext, max, min) {
  1200. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  1201. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  1202. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  1203. }
  1204. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  1205. value = +value
  1206. offset = offset | 0
  1207. byteLength = byteLength | 0
  1208. if (!noAssert) {
  1209. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  1210. checkInt(this, value, offset, byteLength, maxBytes, 0)
  1211. }
  1212. var mul = 1
  1213. var i = 0
  1214. this[offset] = value & 0xFF
  1215. while (++i < byteLength && (mul *= 0x100)) {
  1216. this[offset + i] = (value / mul) & 0xFF
  1217. }
  1218. return offset + byteLength
  1219. }
  1220. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  1221. value = +value
  1222. offset = offset | 0
  1223. byteLength = byteLength | 0
  1224. if (!noAssert) {
  1225. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  1226. checkInt(this, value, offset, byteLength, maxBytes, 0)
  1227. }
  1228. var i = byteLength - 1
  1229. var mul = 1
  1230. this[offset + i] = value & 0xFF
  1231. while (--i >= 0 && (mul *= 0x100)) {
  1232. this[offset + i] = (value / mul) & 0xFF
  1233. }
  1234. return offset + byteLength
  1235. }
  1236. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  1237. value = +value
  1238. offset = offset | 0
  1239. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  1240. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  1241. this[offset] = (value & 0xff)
  1242. return offset + 1
  1243. }
  1244. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  1245. if (value < 0) value = 0xffff + value + 1
  1246. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  1247. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  1248. (littleEndian ? i : 1 - i) * 8
  1249. }
  1250. }
  1251. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  1252. value = +value
  1253. offset = offset | 0
  1254. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  1255. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1256. this[offset] = (value & 0xff)
  1257. this[offset + 1] = (value >>> 8)
  1258. } else {
  1259. objectWriteUInt16(this, value, offset, true)
  1260. }
  1261. return offset + 2
  1262. }
  1263. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  1264. value = +value
  1265. offset = offset | 0
  1266. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  1267. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1268. this[offset] = (value >>> 8)
  1269. this[offset + 1] = (value & 0xff)
  1270. } else {
  1271. objectWriteUInt16(this, value, offset, false)
  1272. }
  1273. return offset + 2
  1274. }
  1275. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  1276. if (value < 0) value = 0xffffffff + value + 1
  1277. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  1278. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  1279. }
  1280. }
  1281. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  1282. value = +value
  1283. offset = offset | 0
  1284. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  1285. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1286. this[offset + 3] = (value >>> 24)
  1287. this[offset + 2] = (value >>> 16)
  1288. this[offset + 1] = (value >>> 8)
  1289. this[offset] = (value & 0xff)
  1290. } else {
  1291. objectWriteUInt32(this, value, offset, true)
  1292. }
  1293. return offset + 4
  1294. }
  1295. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  1296. value = +value
  1297. offset = offset | 0
  1298. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  1299. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1300. this[offset] = (value >>> 24)
  1301. this[offset + 1] = (value >>> 16)
  1302. this[offset + 2] = (value >>> 8)
  1303. this[offset + 3] = (value & 0xff)
  1304. } else {
  1305. objectWriteUInt32(this, value, offset, false)
  1306. }
  1307. return offset + 4
  1308. }
  1309. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  1310. value = +value
  1311. offset = offset | 0
  1312. if (!noAssert) {
  1313. var limit = Math.pow(2, 8 * byteLength - 1)
  1314. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  1315. }
  1316. var i = 0
  1317. var mul = 1
  1318. var sub = 0
  1319. this[offset] = value & 0xFF
  1320. while (++i < byteLength && (mul *= 0x100)) {
  1321. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  1322. sub = 1
  1323. }
  1324. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  1325. }
  1326. return offset + byteLength
  1327. }
  1328. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  1329. value = +value
  1330. offset = offset | 0
  1331. if (!noAssert) {
  1332. var limit = Math.pow(2, 8 * byteLength - 1)
  1333. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  1334. }
  1335. var i = byteLength - 1
  1336. var mul = 1
  1337. var sub = 0
  1338. this[offset + i] = value & 0xFF
  1339. while (--i >= 0 && (mul *= 0x100)) {
  1340. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  1341. sub = 1
  1342. }
  1343. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  1344. }
  1345. return offset + byteLength
  1346. }
  1347. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  1348. value = +value
  1349. offset = offset | 0
  1350. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  1351. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  1352. if (value < 0) value = 0xff + value + 1
  1353. this[offset] = (value & 0xff)
  1354. return offset + 1
  1355. }
  1356. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  1357. value = +value
  1358. offset = offset | 0
  1359. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  1360. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1361. this[offset] = (value & 0xff)
  1362. this[offset + 1] = (value >>> 8)
  1363. } else {
  1364. objectWriteUInt16(this, value, offset, true)
  1365. }
  1366. return offset + 2
  1367. }
  1368. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  1369. value = +value
  1370. offset = offset | 0
  1371. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  1372. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1373. this[offset] = (value >>> 8)
  1374. this[offset + 1] = (value & 0xff)
  1375. } else {
  1376. objectWriteUInt16(this, value, offset, false)
  1377. }
  1378. return offset + 2
  1379. }
  1380. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  1381. value = +value
  1382. offset = offset | 0
  1383. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  1384. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1385. this[offset] = (value & 0xff)
  1386. this[offset + 1] = (value >>> 8)
  1387. this[offset + 2] = (value >>> 16)
  1388. this[offset + 3] = (value >>> 24)
  1389. } else {
  1390. objectWriteUInt32(this, value, offset, true)
  1391. }
  1392. return offset + 4
  1393. }
  1394. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  1395. value = +value
  1396. offset = offset | 0
  1397. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  1398. if (value < 0) value = 0xffffffff + value + 1
  1399. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1400. this[offset] = (value >>> 24)
  1401. this[offset + 1] = (value >>> 16)
  1402. this[offset + 2] = (value >>> 8)
  1403. this[offset + 3] = (value & 0xff)
  1404. } else {
  1405. objectWriteUInt32(this, value, offset, false)
  1406. }
  1407. return offset + 4
  1408. }
  1409. function checkIEEE754 (buf, value, offset, ext, max, min) {
  1410. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  1411. if (offset < 0) throw new RangeError('Index out of range')
  1412. }
  1413. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  1414. if (!noAssert) {
  1415. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  1416. }
  1417. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  1418. return offset + 4
  1419. }
  1420. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  1421. return writeFloat(this, value, offset, true, noAssert)
  1422. }
  1423. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  1424. return writeFloat(this, value, offset, false, noAssert)
  1425. }
  1426. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  1427. if (!noAssert) {
  1428. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  1429. }
  1430. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  1431. return offset + 8
  1432. }
  1433. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  1434. return writeDouble(this, value, offset, true, noAssert)
  1435. }
  1436. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  1437. return writeDouble(this, value, offset, false, noAssert)
  1438. }
  1439. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  1440. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  1441. if (!start) start = 0
  1442. if (!end && end !== 0) end = this.length
  1443. if (targetStart >= target.length) targetStart = target.length
  1444. if (!targetStart) targetStart = 0
  1445. if (end > 0 && end < start) end = start
  1446. // Copy 0 bytes; we're done
  1447. if (end === start) return 0
  1448. if (target.length === 0 || this.length === 0) return 0
  1449. // Fatal error conditions
  1450. if (targetStart < 0) {
  1451. throw new RangeError('targetStart out of bounds')
  1452. }
  1453. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  1454. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  1455. // Are we oob?
  1456. if (end > this.length) end = this.length
  1457. if (target.length - targetStart < end - start) {
  1458. end = target.length - targetStart + start
  1459. }
  1460. var len = end - start
  1461. var i
  1462. if (this === target && start < targetStart && targetStart < end) {
  1463. // descending copy from end
  1464. for (i = len - 1; i >= 0; --i) {
  1465. target[i + targetStart] = this[i + start]
  1466. }
  1467. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  1468. // ascending copy from start
  1469. for (i = 0; i < len; ++i) {
  1470. target[i + targetStart] = this[i + start]
  1471. }
  1472. } else {
  1473. Uint8Array.prototype.set.call(
  1474. target,
  1475. this.subarray(start, start + len),
  1476. targetStart
  1477. )
  1478. }
  1479. return len
  1480. }
  1481. // Usage:
  1482. // buffer.fill(number[, offset[, end]])
  1483. // buffer.fill(buffer[, offset[, end]])
  1484. // buffer.fill(string[, offset[, end]][, encoding])
  1485. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  1486. // Handle string cases:
  1487. if (typeof val === 'string') {
  1488. if (typeof start === 'string') {
  1489. encoding = start
  1490. start = 0
  1491. end = this.length
  1492. } else if (typeof end === 'string') {
  1493. encoding = end
  1494. end = this.length
  1495. }
  1496. if (val.length === 1) {
  1497. var code = val.charCodeAt(0)
  1498. if (code < 256) {
  1499. val = code
  1500. }
  1501. }
  1502. if (encoding !== undefined && typeof encoding !== 'string') {
  1503. throw new TypeError('encoding must be a string')
  1504. }
  1505. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  1506. throw new TypeError('Unknown encoding: ' + encoding)
  1507. }
  1508. } else if (typeof val === 'number') {
  1509. val = val & 255
  1510. }
  1511. // Invalid ranges are not set to a default, so can range check early.
  1512. if (start < 0 || this.length < start || this.length < end) {
  1513. throw new RangeError('Out of range index')
  1514. }
  1515. if (end <= start) {
  1516. return this
  1517. }
  1518. start = start >>> 0
  1519. end = end === undefined ? this.length : end >>> 0
  1520. if (!val) val = 0
  1521. var i
  1522. if (typeof val === 'number') {
  1523. for (i = start; i < end; ++i) {
  1524. this[i] = val
  1525. }
  1526. } else {
  1527. var bytes = Buffer.isBuffer(val)
  1528. ? val
  1529. : utf8ToBytes(new Buffer(val, encoding).toString())
  1530. var len = bytes.length
  1531. for (i = 0; i < end - start; ++i) {
  1532. this[i + start] = bytes[i % len]
  1533. }
  1534. }
  1535. return this
  1536. }
  1537. // HELPER FUNCTIONS
  1538. // ================
  1539. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  1540. function base64clean (str) {
  1541. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  1542. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  1543. // Node converts strings with length < 2 to ''
  1544. if (str.length < 2) return ''
  1545. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  1546. while (str.length % 4 !== 0) {
  1547. str = str + '='
  1548. }
  1549. return str
  1550. }
  1551. function stringtrim (str) {
  1552. if (str.trim) return str.trim()
  1553. return str.replace(/^\s+|\s+$/g, '')
  1554. }
  1555. function toHex (n) {
  1556. if (n < 16) return '0' + n.toString(16)
  1557. return n.toString(16)
  1558. }
  1559. function utf8ToBytes (string, units) {
  1560. units = units || Infinity
  1561. var codePoint
  1562. var length = string.length
  1563. var leadSurrogate = null
  1564. var bytes = []
  1565. for (var i = 0; i < length; ++i) {
  1566. codePoint = string.charCodeAt(i)
  1567. // is surrogate component
  1568. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  1569. // last char was a lead
  1570. if (!leadSurrogate) {
  1571. // no lead yet
  1572. if (codePoint > 0xDBFF) {
  1573. // unexpected trail
  1574. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  1575. continue
  1576. } else if (i + 1 === length) {
  1577. // unpaired lead
  1578. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  1579. continue
  1580. }
  1581. // valid lead
  1582. leadSurrogate = codePoint
  1583. continue
  1584. }
  1585. // 2 leads in a row
  1586. if (codePoint < 0xDC00) {
  1587. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  1588. leadSurrogate = codePoint
  1589. continue
  1590. }
  1591. // valid surrogate pair
  1592. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  1593. } else if (leadSurrogate) {
  1594. // valid bmp char, but last char was a lead
  1595. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  1596. }
  1597. leadSurrogate = null
  1598. // encode utf8
  1599. if (codePoint < 0x80) {
  1600. if ((units -= 1) < 0) break
  1601. bytes.push(codePoint)
  1602. } else if (codePoint < 0x800) {
  1603. if ((units -= 2) < 0) break
  1604. bytes.push(
  1605. codePoint >> 0x6 | 0xC0,
  1606. codePoint & 0x3F | 0x80
  1607. )
  1608. } else if (codePoint < 0x10000) {
  1609. if ((units -= 3) < 0) break
  1610. bytes.push(
  1611. codePoint >> 0xC | 0xE0,
  1612. codePoint >> 0x6 & 0x3F | 0x80,
  1613. codePoint & 0x3F | 0x80
  1614. )
  1615. } else if (codePoint < 0x110000) {
  1616. if ((units -= 4) < 0) break
  1617. bytes.push(
  1618. codePoint >> 0x12 | 0xF0,
  1619. codePoint >> 0xC & 0x3F | 0x80,
  1620. codePoint >> 0x6 & 0x3F | 0x80,
  1621. codePoint & 0x3F | 0x80
  1622. )
  1623. } else {
  1624. throw new Error('Invalid code point')
  1625. }
  1626. }
  1627. return bytes
  1628. }
  1629. function asciiToBytes (str) {
  1630. var byteArray = []
  1631. for (var i = 0; i < str.length; ++i) {
  1632. // Node's code seems to be doing this and not & 0x7F..
  1633. byteArray.push(str.charCodeAt(i) & 0xFF)
  1634. }
  1635. return byteArray
  1636. }
  1637. function utf16leToBytes (str, units) {
  1638. var c, hi, lo
  1639. var byteArray = []
  1640. for (var i = 0; i < str.length; ++i) {
  1641. if ((units -= 2) < 0) break
  1642. c = str.charCodeAt(i)
  1643. hi = c >> 8
  1644. lo = c % 256
  1645. byteArray.push(lo)
  1646. byteArray.push(hi)
  1647. }
  1648. return byteArray
  1649. }
  1650. function base64ToBytes (str) {
  1651. return base64.toByteArray(base64clean(str))
  1652. }
  1653. function blitBuffer (src, dst, offset, length) {
  1654. for (var i = 0; i < length; ++i) {
  1655. if ((i + offset >= dst.length) || (i >= src.length)) break
  1656. dst[i + offset] = src[i]
  1657. }
  1658. return i
  1659. }
  1660. function isnan (val) {
  1661. return val !== val // eslint-disable-line no-self-compare
  1662. }
  1663. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer)
  1664. },{"base64-js":1,"buffer":2,"ieee754":4,"isarray":5}],3:[function(require,module,exports){
  1665. !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).dayjs=e()}(this,(function(){"use strict";var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return+(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return b},m.isValid=function(){return!(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
  1666. },{}],4:[function(require,module,exports){
  1667. /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
  1668. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  1669. var e, m
  1670. var eLen = (nBytes * 8) - mLen - 1
  1671. var eMax = (1 << eLen) - 1
  1672. var eBias = eMax >> 1
  1673. var nBits = -7
  1674. var i = isLE ? (nBytes - 1) : 0
  1675. var d = isLE ? -1 : 1
  1676. var s = buffer[offset + i]
  1677. i += d
  1678. e = s & ((1 << (-nBits)) - 1)
  1679. s >>= (-nBits)
  1680. nBits += eLen
  1681. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  1682. m = e & ((1 << (-nBits)) - 1)
  1683. e >>= (-nBits)
  1684. nBits += mLen
  1685. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  1686. if (e === 0) {
  1687. e = 1 - eBias
  1688. } else if (e === eMax) {
  1689. return m ? NaN : ((s ? -1 : 1) * Infinity)
  1690. } else {
  1691. m = m + Math.pow(2, mLen)
  1692. e = e - eBias
  1693. }
  1694. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  1695. }
  1696. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  1697. var e, m, c
  1698. var eLen = (nBytes * 8) - mLen - 1
  1699. var eMax = (1 << eLen) - 1
  1700. var eBias = eMax >> 1
  1701. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  1702. var i = isLE ? 0 : (nBytes - 1)
  1703. var d = isLE ? 1 : -1
  1704. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  1705. value = Math.abs(value)
  1706. if (isNaN(value) || value === Infinity) {
  1707. m = isNaN(value) ? 1 : 0
  1708. e = eMax
  1709. } else {
  1710. e = Math.floor(Math.log(value) / Math.LN2)
  1711. if (value * (c = Math.pow(2, -e)) < 1) {
  1712. e--
  1713. c *= 2
  1714. }
  1715. if (e + eBias >= 1) {
  1716. value += rt / c
  1717. } else {
  1718. value += rt * Math.pow(2, 1 - eBias)
  1719. }
  1720. if (value * c >= 2) {
  1721. e++
  1722. c /= 2
  1723. }
  1724. if (e + eBias >= eMax) {
  1725. m = 0
  1726. e = eMax
  1727. } else if (e + eBias >= 1) {
  1728. m = ((value * c) - 1) * Math.pow(2, mLen)
  1729. e = e + eBias
  1730. } else {
  1731. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  1732. e = 0
  1733. }
  1734. }
  1735. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  1736. e = (e << mLen) | m
  1737. eLen += mLen
  1738. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  1739. buffer[offset + i - d] |= s * 128
  1740. }
  1741. },{}],5:[function(require,module,exports){
  1742. var toString = {}.toString;
  1743. module.exports = Array.isArray || function (arr) {
  1744. return toString.call(arr) == '[object Array]';
  1745. };
  1746. },{}],6:[function(require,module,exports){
  1747. (function (process,global,Buffer,__argument0,__argument1,__argument2,__argument3,setImmediate){(function (){
  1748. /*!
  1749. JSZip v3.10.1 - A JavaScript class for generating and reading zip files
  1750. <http://stuartk.com/jszip>
  1751. (c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
  1752. Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
  1753. JSZip uses the library pako released under the MIT license :
  1754. https://github.com/nodeca/pako/blob/main/LICENSE
  1755. */
  1756. !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).JSZip=e()}}(function(){return function s(a,o,h){function u(r,e){if(!o[r]){if(!a[r]){var t="function"==typeof require&&require;if(!e&&t)return t(r,!0);if(l)return l(r,!0);var n=new Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}var i=o[r]={exports:{}};a[r][0].call(i.exports,function(e){var t=a[r][1][e];return u(t||e)},i,i.exports,s,a,o,h)}return o[r].exports}for(var l="function"==typeof require&&require,e=0;e<h.length;e++)u(h[e]);return u}({1:[function(e,t,r){"use strict";var d=e("./utils"),c=e("./support"),p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(e){for(var t,r,n,i,s,a,o,h=[],u=0,l=e.length,f=l,c="string"!==d.getTypeOf(e);u<e.length;)f=l-u,n=c?(t=e[u++],r=u<l?e[u++]:0,u<l?e[u++]:0):(t=e.charCodeAt(u++),r=u<l?e.charCodeAt(u++):0,u<l?e.charCodeAt(u++):0),i=t>>2,s=(3&t)<<4|r>>4,a=1<f?(15&r)<<2|n>>6:64,o=2<f?63&n:64,h.push(p.charAt(i)+p.charAt(s)+p.charAt(a)+p.charAt(o));return h.join("")},r.decode=function(e){var t,r,n,i,s,a,o=0,h=0,u="data:";if(e.substr(0,u.length)===u)throw new Error("Invalid base64 input, it looks like a data url.");var l,f=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===p.charAt(64)&&f--,e.charAt(e.length-2)===p.charAt(64)&&f--,f%1!=0)throw new Error("Invalid base64 input, bad content length.");for(l=c.uint8array?new Uint8Array(0|f):new Array(0|f);o<e.length;)t=p.indexOf(e.charAt(o++))<<2|(i=p.indexOf(e.charAt(o++)))>>4,r=(15&i)<<4|(s=p.indexOf(e.charAt(o++)))>>2,n=(3&s)<<6|(a=p.indexOf(e.charAt(o++))),l[h++]=t,64!==s&&(l[h++]=r),64!==a&&(l[h++]=n);return l}},{"./support":30,"./utils":32}],2:[function(e,t,r){"use strict";var n=e("./external"),i=e("./stream/DataWorker"),s=e("./stream/Crc32Probe"),a=e("./stream/DataLengthProbe");function o(e,t,r,n,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=n,this.compressedContent=i}o.prototype={getContentWorker:function(){var e=new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},o.createWorkerFrom=function(e,t,r){return e.pipe(new s).pipe(new a("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new a("compressedSize")).withStreamInfo("compression",t)},t.exports=o},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,r){"use strict";var n=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,r){"use strict";var n=e("./utils");var o=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==n.getTypeOf(e)?function(e,t,r,n){var i=o,s=n+r;e^=-1;for(var a=n;a<s;a++)e=e>>>8^i[255&(e^t[a])];return-1^e}(0|t,e,e.length,0):function(e,t,r,n){var i=o,s=n+r;e^=-1;for(var a=n;a<s;a++)e=e>>>8^i[255&(e^t.charCodeAt(a))];return-1^e}(0|t,e,e.length,0):0}},{"./utils":32}],5:[function(e,t,r){"use strict";r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){"use strict";var n=null;n="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:n}},{lie:37}],7:[function(e,t,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,i=e("pako"),s=e("./utils"),a=e("./stream/GenericWorker"),o=n?"uint8array":"array";function h(e,t){a.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}r.magic="\b\0",s.inherits(h,a),h.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(o,e.data),!1)},h.prototype.flush=function(){a.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=function(e){t.push({data:e,meta:t.meta})}},r.compressWorker=function(e){return new h("Deflate",e)},r.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,r){"use strict";function A(e,t){var r,n="";for(r=0;r<t;r++)n+=String.fromCharCode(255&e),e>>>=8;return n}function n(e,t,r,n,i,s){var a,o,h=e.file,u=e.compression,l=s!==O.utf8encode,f=I.transformTo("string",s(h.name)),c=I.transformTo("string",O.utf8encode(h.name)),d=h.comment,p=I.transformTo("string",s(d)),m=I.transformTo("string",O.utf8encode(d)),_=c.length!==h.name.length,g=m.length!==d.length,b="",v="",y="",w=h.dir,k=h.date,x={crc32:0,compressedSize:0,uncompressedSize:0};t&&!r||(x.crc32=e.crc32,x.compressedSize=e.compressedSize,x.uncompressedSize=e.uncompressedSize);var S=0;t&&(S|=8),l||!_&&!g||(S|=2048);var z=0,C=0;w&&(z|=16),"UNIX"===i?(C=798,z|=function(e,t){var r=e;return e||(r=t?16893:33204),(65535&r)<<16}(h.unixPermissions,w)):(C=20,z|=function(e){return 63&(e||0)}(h.dosPermissions)),a=k.getUTCHours(),a<<=6,a|=k.getUTCMinutes(),a<<=5,a|=k.getUTCSeconds()/2,o=k.getUTCFullYear()-1980,o<<=4,o|=k.getUTCMonth()+1,o<<=5,o|=k.getUTCDate(),_&&(v=A(1,1)+A(B(f),4)+c,b+="up"+A(v.length,2)+v),g&&(y=A(1,1)+A(B(p),4)+m,b+="uc"+A(y.length,2)+y);var E="";return E+="\n\0",E+=A(S,2),E+=u.magic,E+=A(a,2),E+=A(o,2),E+=A(x.crc32,4),E+=A(x.compressedSize,4),E+=A(x.uncompressedSize,4),E+=A(f.length,2),E+=A(b.length,2),{fileRecord:R.LOCAL_FILE_HEADER+E+f+b,dirRecord:R.CENTRAL_FILE_HEADER+A(C,2)+E+A(p.length,2)+"\0\0\0\0"+A(z,4)+A(n,4)+f+b+p}}var I=e("../utils"),i=e("../stream/GenericWorker"),O=e("../utf8"),B=e("../crc32"),R=e("../signature");function s(e,t,r,n){i.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=n,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}I.inherits(s,i),s.prototype.push=function(e){var t=e.meta.percent||0,r=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,i.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:r?(t+100*(r-n-1))/r:100}}))},s.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var r=n(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0},s.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,r=n(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),t)this.push({data:function(e){return R.DATA_DESCRIPTOR+A(e.crc32,4)+A(e.compressedSize,4)+A(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},s.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var r=this.bytesWritten-e,n=function(e,t,r,n,i){var s=I.transformTo("string",i(n));return R.CENTRAL_DIRECTORY_END+"\0\0\0\0"+A(e,2)+A(e,2)+A(t,4)+A(r,4)+A(s.length,2)+s}(this.dirRecords.length,r,e,this.zipComment,this.encodeFileName);this.push({data:n,meta:{percent:100}})},s.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},s.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(e){t.error(e)}),this},s.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},s.prototype.error=function(e){var t=this._sources;if(!i.prototype.error.call(this,e))return!1;for(var r=0;r<t.length;r++)try{t[r].error(e)}catch(e){}return!0},s.prototype.lock=function(){i.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=s},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,r){"use strict";var u=e("../compressions"),n=e("./ZipFileWorker");r.generateWorker=function(e,a,t){var o=new n(a.streamFiles,t,a.platform,a.encodeFileName),h=0;try{e.forEach(function(e,t){h++;var r=function(e,t){var r=e||t,n=u[r];if(!n)throw new Error(r+" is not a valid compression method !");return n}(t.options.compression,a.compression),n=t.options.compressionOptions||a.compressionOptions||{},i=t.dir,s=t.date;t._compressWorker(r,n).withStreamInfo("file",{name:e,dir:i,date:s,comment:t.comment||"",unixPermissions:t.unixPermissions,dosPermissions:t.dosPermissions}).pipe(o)}),o.entriesCount=h}catch(e){o.error(e)}return o}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,r){"use strict";function n(){if(!(this instanceof n))return new n;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new n;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}(n.prototype=e("./object")).loadAsync=e("./load"),n.support=e("./support"),n.defaults=e("./defaults"),n.version="3.10.1",n.loadAsync=function(e,t){return(new n).loadAsync(e,t)},n.external=e("./external"),t.exports=n},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,r){"use strict";var u=e("./utils"),i=e("./external"),n=e("./utf8"),s=e("./zipEntries"),a=e("./stream/Crc32Probe"),l=e("./nodejsUtils");function f(n){return new i.Promise(function(e,t){var r=n.decompressed.getContentWorker().pipe(new a);r.on("error",function(e){t(e)}).on("end",function(){r.streamInfo.crc32!==n.decompressed.crc32?t(new Error("Corrupted zip : CRC32 mismatch")):e()}).resume()})}t.exports=function(e,o){var h=this;return o=u.extend(o||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:n.utf8decode}),l.isNode&&l.isStream(e)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):u.prepareContent("the loaded zip file",e,!0,o.optimizedBinaryString,o.base64).then(function(e){var t=new s(o);return t.load(e),t}).then(function(e){var t=[i.Promise.resolve(e)],r=e.files;if(o.checkCRC32)for(var n=0;n<r.length;n++)t.push(f(r[n]));return i.Promise.all(t)}).then(function(e){for(var t=e.shift(),r=t.files,n=0;n<r.length;n++){var i=r[n],s=i.fileNameStr,a=u.resolve(i.fileNameStr);h.file(a,i.decompressed,{binary:!0,optimizedBinaryString:!0,date:i.date,dir:i.dir,comment:i.fileCommentStr.length?i.fileCommentStr:null,unixPermissions:i.unixPermissions,dosPermissions:i.dosPermissions,createFolders:o.createFolders}),i.dir||(h.file(a).unsafeOriginalName=s)}return t.zipComment.length&&(h.comment=t.zipComment),h})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,r){"use strict";var n=e("../utils"),i=e("../stream/GenericWorker");function s(e,t){i.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}n.inherits(s,i),s.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",function(e){t.push({data:e,meta:{percent:0}})}).on("error",function(e){t.isPaused?this.generatedError=e:t.error(e)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})},s.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},s.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=s},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,r){"use strict";var i=e("readable-stream").Readable;function n(e,t,r){i.call(this,t),this._helper=e;var n=this;e.on("data",function(e,t){n.push(e)||n._helper.pause(),r&&r(t)}).on("error",function(e){n.emit("error",e)}).on("end",function(){n.push(null)})}e("../utils").inherits(n,i),n.prototype._read=function(){this._helper.resume()},t.exports=n},{"../utils":32,"readable-stream":16}],14:[function(e,t,r){"use strict";t.exports={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,r){"use strict";function s(e,t,r){var n,i=u.getTypeOf(t),s=u.extend(r||{},f);s.date=s.date||new Date,null!==s.compression&&(s.compression=s.compression.toUpperCase()),"string"==typeof s.unixPermissions&&(s.unixPermissions=parseInt(s.unixPermissions,8)),s.unixPermissions&&16384&s.unixPermissions&&(s.dir=!0),s.dosPermissions&&16&s.dosPermissions&&(s.dir=!0),s.dir&&(e=g(e)),s.createFolders&&(n=_(e))&&b.call(this,n,!0);var a="string"===i&&!1===s.binary&&!1===s.base64;r&&void 0!==r.binary||(s.binary=!a),(t instanceof c&&0===t.uncompressedSize||s.dir||!t||0===t.length)&&(s.base64=!1,s.binary=!0,t="",s.compression="STORE",i="string");var o=null;o=t instanceof c||t instanceof l?t:p.isNode&&p.isStream(t)?new m(e,t):u.prepareContent(e,t,s.binary,s.optimizedBinaryString,s.base64);var h=new d(e,o,s);this.files[e]=h}var i=e("./utf8"),u=e("./utils"),l=e("./stream/GenericWorker"),a=e("./stream/StreamHelper"),f=e("./defaults"),c=e("./compressedObject"),d=e("./zipObject"),o=e("./generate"),p=e("./nodejsUtils"),m=e("./nodejs/NodejsStreamInputAdapter"),_=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0<t?e.substring(0,t):""},g=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},b=function(e,t){return t=void 0!==t?t:f.createFolders,e=g(e),this.files[e]||s.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function h(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var n={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,r,n;for(t in this.files)n=this.files[t],(r=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(r,n)},filter:function(r){var n=[];return this.forEach(function(e,t){r(e,t)&&n.push(t)}),n},file:function(e,t,r){if(1!==arguments.length)return e=this.root+e,s.call(this,e,t,r),this;if(h(e)){var n=e;return this.filter(function(e,t){return!t.dir&&n.test(e)})}var i=this.files[this.root+e];return i&&!i.dir?i:null},folder:function(r){if(!r)return this;if(h(r))return this.filter(function(e,t){return t.dir&&r.test(e)});var e=this.root+r,t=b.call(this,e),n=this.clone();return n.root=t.name,n},remove:function(r){r=this.root+r;var e=this.files[r];if(e||("/"!==r.slice(-1)&&(r+="/"),e=this.files[r]),e&&!e.dir)delete this.files[r];else for(var t=this.filter(function(e,t){return t.name.slice(0,r.length)===r}),n=0;n<t.length;n++)delete this.files[t[n].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,r={};try{if((r=u.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=r.type.toLowerCase(),r.compression=r.compression.toUpperCase(),"binarystring"===r.type&&(r.type="string"),!r.type)throw new Error("No output type specified.");u.checkSupport(r.type),"darwin"!==r.platform&&"freebsd"!==r.platform&&"linux"!==r.platform&&"sunos"!==r.platform||(r.platform="UNIX"),"win32"===r.platform&&(r.platform="DOS");var n=r.comment||this.comment||"";t=o.generateWorker(this,r,n)}catch(e){(t=new l("error")).error(e)}return new a(t,r.type||"string",r.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=n},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,r){"use strict";t.exports=e("stream")},{stream:void 0}],17:[function(e,t,r){"use strict";var n=e("./DataReader");function i(e){n.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(i,n),i.prototype.byteAt=function(e){return this.data[this.zero+e]},i.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),r=e.charCodeAt(1),n=e.charCodeAt(2),i=e.charCodeAt(3),s=this.length-4;0<=s;--s)if(this.data[s]===t&&this.data[s+1]===r&&this.data[s+2]===n&&this.data[s+3]===i)return s-this.zero;return-1},i.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1),n=e.charCodeAt(2),i=e.charCodeAt(3),s=this.readData(4);return t===s[0]&&r===s[1]&&n===s[2]&&i===s[3]},i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],18:[function(e,t,r){"use strict";var n=e("../utils");function i(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,r=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)r=(r<<8)+this.byteAt(t);return this.index+=e,r},readString:function(e){return n.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,r){"use strict";var n=e("./Uint8ArrayReader");function i(e){n.call(this,e)}e("../utils").inherits(i,n),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,r){"use strict";var n=e("./DataReader");function i(e){n.call(this,e)}e("../utils").inherits(i,n),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,r){"use strict";var n=e("./ArrayReader");function i(e){n.call(this,e)}e("../utils").inherits(i,n),i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,r){"use strict";var n=e("../utils"),i=e("../support"),s=e("./ArrayReader"),a=e("./StringReader"),o=e("./NodeBufferReader"),h=e("./Uint8ArrayReader");t.exports=function(e){var t=n.getTypeOf(e);return n.checkSupport(t),"string"!==t||i.uint8array?"nodebuffer"===t?new o(e):i.uint8array?new h(n.transformTo("uint8array",e)):new s(n.transformTo("array",e)):new a(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,r){"use strict";r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,r){"use strict";var n=e("./GenericWorker"),i=e("../utils");function s(e){n.call(this,"ConvertWorker to "+e),this.destType=e}i.inherits(s,n),s.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,r){"use strict";var n=e("./GenericWorker"),i=e("../crc32");function s(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(s,n),s.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./GenericWorker");function s(e){i.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}n.inherits(s,i),s.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./GenericWorker");function s(e){i.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=n.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}n.inherits(s,i),s.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,r){"use strict";function n(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var r=0;r<this._listeners[e].length;r++)this._listeners[e][r].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.end()}),e.on("error",function(e){t.error(e)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var e=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=n},{}],29:[function(e,t,r){"use strict";var h=e("../utils"),i=e("./ConvertWorker"),s=e("./GenericWorker"),u=e("../base64"),n=e("../support"),a=e("../external"),o=null;if(n.nodestream)try{o=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function l(e,o){return new a.Promise(function(t,r){var n=[],i=e._internalType,s=e._outputType,a=e._mimeType;e.on("data",function(e,t){n.push(e),o&&o(t)}).on("error",function(e){n=[],r(e)}).on("end",function(){try{var e=function(e,t,r){switch(e){case"blob":return h.newBlob(h.transformTo("arraybuffer",t),r);case"base64":return u.encode(t);default:return h.transformTo(e,t)}}(s,function(e,t){var r,n=0,i=null,s=0;for(r=0;r<t.length;r++)s+=t[r].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(i=new Uint8Array(s),r=0;r<t.length;r++)i.set(t[r],n),n+=t[r].length;return i;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(i,n),a);t(e)}catch(e){r(e)}n=[]}).resume()})}function f(e,t,r){var n=t;switch(t){case"blob":case"arraybuffer":n="uint8array";break;case"base64":n="string"}try{this._internalType=n,this._outputType=t,this._mimeType=r,h.checkSupport(n),this._worker=e.pipe(new i(n)),e.lock()}catch(e){this._worker=new s("error"),this._worker.error(e)}}f.prototype={accumulate:function(e){return l(this,e)},on:function(e,t){var r=this;return"data"===e?this._worker.on(e,function(e){t.call(r,e.data,e.meta)}):this._worker.on(e,function(){h.delay(t,arguments,r)}),this},resume:function(){return h.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(h.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new o(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=f},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,r){"use strict";if(r.base64=!0,r.array=!0,r.string=!0,r.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,r.nodebuffer="undefined"!=typeof Buffer,r.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)r.blob=!1;else{var n=new ArrayBuffer(0);try{r.blob=0===new Blob([n],{type:"application/zip"}).size}catch(e){try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(n),r.blob=0===i.getBlob("application/zip").size}catch(e){r.blob=!1}}}try{r.nodestream=!!e("readable-stream").Readable}catch(e){r.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,s){"use strict";for(var o=e("./utils"),h=e("./support"),r=e("./nodejsUtils"),n=e("./stream/GenericWorker"),u=new Array(256),i=0;i<256;i++)u[i]=252<=i?6:248<=i?5:240<=i?4:224<=i?3:192<=i?2:1;u[254]=u[254]=1;function a(){n.call(this,"utf-8 decode"),this.leftOver=null}function l(){n.call(this,"utf-8 encode")}s.utf8encode=function(e){return h.nodebuffer?r.newBufferFrom(e,"utf-8"):function(e){var t,r,n,i,s,a=e.length,o=0;for(i=0;i<a;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),o+=r<128?1:r<2048?2:r<65536?3:4;for(t=h.uint8array?new Uint8Array(o):new Array(o),i=s=0;s<o;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),r<128?t[s++]=r:(r<2048?t[s++]=192|r>>>6:(r<65536?t[s++]=224|r>>>12:(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63),t[s++]=128|r>>>6&63),t[s++]=128|63&r);return t}(e)},s.utf8decode=function(e){return h.nodebuffer?o.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,r,n,i,s=e.length,a=new Array(2*s);for(t=r=0;t<s;)if((n=e[t++])<128)a[r++]=n;else if(4<(i=u[n]))a[r++]=65533,t+=i-1;else{for(n&=2===i?31:3===i?15:7;1<i&&t<s;)n=n<<6|63&e[t++],i--;1<i?a[r++]=65533:n<65536?a[r++]=n:(n-=65536,a[r++]=55296|n>>10&1023,a[r++]=56320|1023&n)}return a.length!==r&&(a.subarray?a=a.subarray(0,r):a.length=r),o.applyFromCharCode(a)}(e=o.transformTo(h.uint8array?"uint8array":"array",e))},o.inherits(a,n),a.prototype.processChunk=function(e){var t=o.transformTo(h.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(h.uint8array){var r=t;(t=new Uint8Array(r.length+this.leftOver.length)).set(this.leftOver,0),t.set(r,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var n=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0?t:0===r?t:r+u[e[r]]>t?r:t}(t),i=t;n!==t.length&&(h.uint8array?(i=t.subarray(0,n),this.leftOver=t.subarray(n,t.length)):(i=t.slice(0,n),this.leftOver=t.slice(n,t.length))),this.push({data:s.utf8decode(i),meta:e.meta})},a.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=a,o.inherits(l,n),l.prototype.processChunk=function(e){this.push({data:s.utf8encode(e.data),meta:e.meta})},s.Utf8EncodeWorker=l},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,a){"use strict";var o=e("./support"),h=e("./base64"),r=e("./nodejsUtils"),u=e("./external");function n(e){return e}function l(e,t){for(var r=0;r<e.length;++r)t[r]=255&e.charCodeAt(r);return t}e("setimmediate"),a.newBlob=function(t,r){a.checkSupport("blob");try{return new Blob([t],{type:r})}catch(e){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return n.append(t),n.getBlob(r)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var i={stringifyByChunk:function(e,t,r){var n=[],i=0,s=e.length;if(s<=r)return String.fromCharCode.apply(null,e);for(;i<s;)"array"===t||"nodebuffer"===t?n.push(String.fromCharCode.apply(null,e.slice(i,Math.min(i+r,s)))):n.push(String.fromCharCode.apply(null,e.subarray(i,Math.min(i+r,s)))),i+=r;return n.join("")},stringifyByChar:function(e){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},applyCanBeUsed:{uint8array:function(){try{return o.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return o.nodebuffer&&1===String.fromCharCode.apply(null,r.allocBuffer(1)).length}catch(e){return!1}}()}};function s(e){var t=65536,r=a.getTypeOf(e),n=!0;if("uint8array"===r?n=i.applyCanBeUsed.uint8array:"nodebuffer"===r&&(n=i.applyCanBeUsed.nodebuffer),n)for(;1<t;)try{return i.stringifyByChunk(e,r,t)}catch(e){t=Math.floor(t/2)}return i.stringifyByChar(e)}function f(e,t){for(var r=0;r<e.length;r++)t[r]=e[r];return t}a.applyFromCharCode=s;var c={};c.string={string:n,array:function(e){return l(e,new Array(e.length))},arraybuffer:function(e){return c.string.uint8array(e).buffer},uint8array:function(e){return l(e,new Uint8Array(e.length))},nodebuffer:function(e){return l(e,r.allocBuffer(e.length))}},c.array={string:s,array:n,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return r.newBufferFrom(e)}},c.arraybuffer={string:function(e){return s(new Uint8Array(e))},array:function(e){return f(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:n,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return r.newBufferFrom(new Uint8Array(e))}},c.uint8array={string:s,array:function(e){return f(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:n,nodebuffer:function(e){return r.newBufferFrom(e)}},c.nodebuffer={string:s,array:function(e){return f(e,new Array(e.length))},arraybuffer:function(e){return c.nodebuffer.uint8array(e).buffer},uint8array:function(e){return f(e,new Uint8Array(e.length))},nodebuffer:n},a.transformTo=function(e,t){if(t=t||"",!e)return t;a.checkSupport(e);var r=a.getTypeOf(t);return c[r][e](t)},a.resolve=function(e){for(var t=e.split("/"),r=[],n=0;n<t.length;n++){var i=t[n];"."===i||""===i&&0!==n&&n!==t.length-1||(".."===i?r.pop():r.push(i))}return r.join("/")},a.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":o.nodebuffer&&r.isBuffer(e)?"nodebuffer":o.uint8array&&e instanceof Uint8Array?"uint8array":o.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},a.checkSupport=function(e){if(!o[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},a.MAX_VALUE_16BITS=65535,a.MAX_VALUE_32BITS=-1,a.pretty=function(e){var t,r,n="";for(r=0;r<(e||"").length;r++)n+="\\x"+((t=e.charCodeAt(r))<16?"0":"")+t.toString(16).toUpperCase();return n},a.delay=function(e,t,r){setImmediate(function(){e.apply(r||null,t||[])})},a.inherits=function(e,t){function r(){}r.prototype=t.prototype,e.prototype=new r},a.extend=function(){var e,t,r={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===r[t]&&(r[t]=arguments[e][t]);return r},a.prepareContent=function(r,e,n,i,s){return u.Promise.resolve(e).then(function(n){return o.blob&&(n instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(n)))&&"undefined"!=typeof FileReader?new u.Promise(function(t,r){var e=new FileReader;e.onload=function(e){t(e.target.result)},e.onerror=function(e){r(e.target.error)},e.readAsArrayBuffer(n)}):n}).then(function(e){var t=a.getTypeOf(e);return t?("arraybuffer"===t?e=a.transformTo("uint8array",e):"string"===t&&(s?e=h.decode(e):n&&!0!==i&&(e=function(e){return l(e,o.uint8array?new Uint8Array(e.length):new Array(e.length))}(e))),e):u.Promise.reject(new Error("Can't read the data of '"+r+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,r){"use strict";var n=e("./reader/readerFor"),i=e("./utils"),s=e("./signature"),a=e("./zipEntry"),o=e("./support");function h(e){this.files=[],this.loadOptions=e}h.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(t)+", expected "+i.pretty(e)+")")}},isSignature:function(e,t){var r=this.reader.index;this.reader.setIndex(e);var n=this.reader.readString(4)===t;return this.reader.setIndex(r),n},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=o.uint8array?"uint8array":"array",r=i.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(r)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,r,n=this.zip64EndOfCentralSize-44;0<n;)e=this.reader.readInt(2),t=this.reader.readInt(4),r=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:r}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(s.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER);)(e=new a({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);if(e<0)throw!this.isSignature(0,s.LOCAL_FILE_HEADER)?new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory");this.reader.setIndex(e);var t=e;if(this.checkSignature(s.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,s.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var r=this.centralDirOffset+this.centralDirSize;this.zip64&&(r+=20,r+=12+this.zip64EndOfCentralSize);var n=t-r;if(0<n)this.isSignature(t,s.CENTRAL_FILE_HEADER)||(this.reader.zero=n);else if(n<0)throw new Error("Corrupted zip: missing "+Math.abs(n)+" bytes.")},prepareReader:function(e){this.reader=n(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=h},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,r){"use strict";var n=e("./reader/readerFor"),s=e("./utils"),i=e("./compressedObject"),a=e("./crc32"),o=e("./utf8"),h=e("./compressions"),u=e("./support");function l(e,t){this.options=e,this.loadOptions=t}l.prototype={isEncrypted:function(){return 1==(1&this.bitFlag)},useUTF8:function(){return 2048==(2048&this.bitFlag)},readLocalPart:function(e){var t,r;if(e.skip(22),this.fileNameLength=e.readInt(2),r=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(r),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in h)if(Object.prototype.hasOwnProperty.call(h,t)&&h[t].magic===e)return h[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new i(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=n(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,r,n,i=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<i;)t=e.readInt(2),r=e.readInt(2),n=e.readData(r),this.extraFields[t]={id:t,length:r,value:n};e.setIndex(i)},handleUTF8:function(){var e=u.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=o.utf8decode(this.fileName),this.fileCommentStr=o.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var r=s.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(r)}var n=this.findExtraFieldUnicodeComment();if(null!==n)this.fileCommentStr=n;else{var i=s.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(i)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=n(e.value);return 1!==t.readInt(1)?null:a(this.fileName)!==t.readInt(4)?null:o.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=n(e.value);return 1!==t.readInt(1)?null:a(this.fileComment)!==t.readInt(4)?null:o.utf8decode(t.readData(e.length-5))}return null}},t.exports=l},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,r){"use strict";function n(e,t,r){this.name=e,this.dir=r.dir,this.date=r.date,this.comment=r.comment,this.unixPermissions=r.unixPermissions,this.dosPermissions=r.dosPermissions,this._data=t,this._dataBinary=r.binary,this.options={compression:r.compression,compressionOptions:r.compressionOptions}}var s=e("./stream/StreamHelper"),i=e("./stream/DataWorker"),a=e("./utf8"),o=e("./compressedObject"),h=e("./stream/GenericWorker");n.prototype={internalStream:function(e){var t=null,r="string";try{if(!e)throw new Error("No output type specified.");var n="string"===(r=e.toLowerCase())||"text"===r;"binarystring"!==r&&"text"!==r||(r="string"),t=this._decompressWorker();var i=!this._dataBinary;i&&!n&&(t=t.pipe(new a.Utf8EncodeWorker)),!i&&n&&(t=t.pipe(new a.Utf8DecodeWorker))}catch(e){(t=new h("error")).error(e)}return new s(t,r,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof o&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var r=this._decompressWorker();return this._dataBinary||(r=r.pipe(new a.Utf8EncodeWorker)),o.createWorkerFrom(r,e,t)},_decompressWorker:function(){return this._data instanceof o?this._data.getContentWorker():this._data instanceof h?this._data:new i(this._data)}};for(var u=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],l=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},f=0;f<u.length;f++)n.prototype[u[f]]=l;t.exports=n},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,l,t){(function(t){"use strict";var r,n,e=t.MutationObserver||t.WebKitMutationObserver;if(e){var i=0,s=new e(u),a=t.document.createTextNode("");s.observe(a,{characterData:!0}),r=function(){a.data=i=++i%2}}else if(t.setImmediate||void 0===t.MessageChannel)r="document"in t&&"onreadystatechange"in t.document.createElement("script")?function(){var e=t.document.createElement("script");e.onreadystatechange=function(){u(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},t.document.documentElement.appendChild(e)}:function(){setTimeout(u,0)};else{var o=new t.MessageChannel;o.port1.onmessage=u,r=function(){o.port2.postMessage(0)}}var h=[];function u(){var e,t;n=!0;for(var r=h.length;r;){for(t=h,h=[],e=-1;++e<r;)t[e]();r=h.length}n=!1}l.exports=function(e){1!==h.push(e)||n||r()}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,r){"use strict";var i=e("immediate");function u(){}var l={},s=["REJECTED"],a=["FULFILLED"],n=["PENDING"];function o(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=n,this.queue=[],this.outcome=void 0,e!==u&&d(this,e)}function h(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function f(t,r,n){i(function(){var e;try{e=r(n)}catch(e){return l.reject(t,e)}e===t?l.reject(t,new TypeError("Cannot resolve promise with itself")):l.resolve(t,e)})}function c(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function d(t,e){var r=!1;function n(e){r||(r=!0,l.reject(t,e))}function i(e){r||(r=!0,l.resolve(t,e))}var s=p(function(){e(i,n)});"error"===s.status&&n(s.value)}function p(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}(t.exports=o).prototype.finally=function(t){if("function"!=typeof t)return this;var r=this.constructor;return this.then(function(e){return r.resolve(t()).then(function(){return e})},function(e){return r.resolve(t()).then(function(){throw e})})},o.prototype.catch=function(e){return this.then(null,e)},o.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===s)return this;var r=new this.constructor(u);this.state!==n?f(r,this.state===a?e:t,this.outcome):this.queue.push(new h(r,e,t));return r},h.prototype.callFulfilled=function(e){l.resolve(this.promise,e)},h.prototype.otherCallFulfilled=function(e){f(this.promise,this.onFulfilled,e)},h.prototype.callRejected=function(e){l.reject(this.promise,e)},h.prototype.otherCallRejected=function(e){f(this.promise,this.onRejected,e)},l.resolve=function(e,t){var r=p(c,t);if("error"===r.status)return l.reject(e,r.value);var n=r.value;if(n)d(e,n);else{e.state=a,e.outcome=t;for(var i=-1,s=e.queue.length;++i<s;)e.queue[i].callFulfilled(t)}return e},l.reject=function(e,t){e.state=s,e.outcome=t;for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e},o.resolve=function(e){if(e instanceof this)return e;return l.resolve(new this(u),e)},o.reject=function(e){var t=new this(u);return l.reject(t,e)},o.all=function(e){var r=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);var s=new Array(n),a=0,t=-1,o=new this(u);for(;++t<n;)h(e[t],t);return o;function h(e,t){r.resolve(e).then(function(e){s[t]=e,++a!==n||i||(i=!0,l.resolve(o,s))},function(e){i||(i=!0,l.reject(o,e))})}},o.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);var i=-1,s=new this(u);for(;++i<r;)a=e[i],t.resolve(a).then(function(e){n||(n=!0,l.resolve(s,e))},function(e){n||(n=!0,l.reject(s,e))});var a;return s}},{immediate:36}],38:[function(e,t,r){"use strict";var n={};(0,e("./lib/utils/common").assign)(n,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=n},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,r){"use strict";var a=e("./zlib/deflate"),o=e("./utils/common"),h=e("./utils/strings"),i=e("./zlib/messages"),s=e("./zlib/zstream"),u=Object.prototype.toString,l=0,f=-1,c=0,d=8;function p(e){if(!(this instanceof p))return new p(e);this.options=o.assign({level:f,method:d,chunkSize:16384,windowBits:15,memLevel:8,strategy:c,to:""},e||{});var t=this.options;t.raw&&0<t.windowBits?t.windowBits=-t.windowBits:t.gzip&&0<t.windowBits&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new s,this.strm.avail_out=0;var r=a.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==l)throw new Error(i[r]);if(t.header&&a.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?h.string2buf(t.dictionary):"[object ArrayBuffer]"===u.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(r=a.deflateSetDictionary(this.strm,n))!==l)throw new Error(i[r]);this._dict_set=!0}}function n(e,t){var r=new p(t);if(r.push(e,!0),r.err)throw r.msg||i[r.err];return r.result}p.prototype.push=function(e,t){var r,n,i=this.strm,s=this.options.chunkSize;if(this.ended)return!1;n=t===~~t?t:!0===t?4:0,"string"==typeof e?i.input=h.string2buf(e):"[object ArrayBuffer]"===u.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(0===i.avail_out&&(i.output=new o.Buf8(s),i.next_out=0,i.avail_out=s),1!==(r=a.deflate(i,n))&&r!==l)return this.onEnd(r),!(this.ended=!0);0!==i.avail_out&&(0!==i.avail_in||4!==n&&2!==n)||("string"===this.options.to?this.onData(h.buf2binstring(o.shrinkBuf(i.output,i.next_out))):this.onData(o.shrinkBuf(i.output,i.next_out)))}while((0<i.avail_in||0===i.avail_out)&&1!==r);return 4===n?(r=a.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===l):2!==n||(this.onEnd(l),!(i.avail_out=0))},p.prototype.onData=function(e){this.chunks.push(e)},p.prototype.onEnd=function(e){e===l&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},r.Deflate=p,r.deflate=n,r.deflateRaw=function(e,t){return(t=t||{}).raw=!0,n(e,t)},r.gzip=function(e,t){return(t=t||{}).gzip=!0,n(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,r){"use strict";var c=e("./zlib/inflate"),d=e("./utils/common"),p=e("./utils/strings"),m=e("./zlib/constants"),n=e("./zlib/messages"),i=e("./zlib/zstream"),s=e("./zlib/gzheader"),_=Object.prototype.toString;function a(e){if(!(this instanceof a))return new a(e);this.options=d.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new i,this.strm.avail_out=0;var r=c.inflateInit2(this.strm,t.windowBits);if(r!==m.Z_OK)throw new Error(n[r]);this.header=new s,c.inflateGetHeader(this.strm,this.header)}function o(e,t){var r=new a(t);if(r.push(e,!0),r.err)throw r.msg||n[r.err];return r.result}a.prototype.push=function(e,t){var r,n,i,s,a,o,h=this.strm,u=this.options.chunkSize,l=this.options.dictionary,f=!1;if(this.ended)return!1;n=t===~~t?t:!0===t?m.Z_FINISH:m.Z_NO_FLUSH,"string"==typeof e?h.input=p.binstring2buf(e):"[object ArrayBuffer]"===_.call(e)?h.input=new Uint8Array(e):h.input=e,h.next_in=0,h.avail_in=h.input.length;do{if(0===h.avail_out&&(h.output=new d.Buf8(u),h.next_out=0,h.avail_out=u),(r=c.inflate(h,m.Z_NO_FLUSH))===m.Z_NEED_DICT&&l&&(o="string"==typeof l?p.string2buf(l):"[object ArrayBuffer]"===_.call(l)?new Uint8Array(l):l,r=c.inflateSetDictionary(this.strm,o)),r===m.Z_BUF_ERROR&&!0===f&&(r=m.Z_OK,f=!1),r!==m.Z_STREAM_END&&r!==m.Z_OK)return this.onEnd(r),!(this.ended=!0);h.next_out&&(0!==h.avail_out&&r!==m.Z_STREAM_END&&(0!==h.avail_in||n!==m.Z_FINISH&&n!==m.Z_SYNC_FLUSH)||("string"===this.options.to?(i=p.utf8border(h.output,h.next_out),s=h.next_out-i,a=p.buf2string(h.output,i),h.next_out=s,h.avail_out=u-s,s&&d.arraySet(h.output,h.output,i,s,0),this.onData(a)):this.onData(d.shrinkBuf(h.output,h.next_out)))),0===h.avail_in&&0===h.avail_out&&(f=!0)}while((0<h.avail_in||0===h.avail_out)&&r!==m.Z_STREAM_END);return r===m.Z_STREAM_END&&(n=m.Z_FINISH),n===m.Z_FINISH?(r=c.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===m.Z_OK):n!==m.Z_SYNC_FLUSH||(this.onEnd(m.Z_OK),!(h.avail_out=0))},a.prototype.onData=function(e){this.chunks.push(e)},a.prototype.onEnd=function(e){e===m.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=d.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},r.Inflate=a,r.inflate=o,r.inflateRaw=function(e,t){return(t=t||{}).raw=!0,o(e,t)},r.ungzip=o},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;r.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])}}return e},r.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var i={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),i);else for(var s=0;s<n;s++)e[i+s]=t[r+s]},flattenChunks:function(e){var t,r,n,i,s,a;for(t=n=0,r=e.length;t<r;t++)n+=e[t].length;for(a=new Uint8Array(n),t=i=0,r=e.length;t<r;t++)s=e[t],a.set(s,i),i+=s.length;return a}},s={arraySet:function(e,t,r,n,i){for(var s=0;s<n;s++)e[i+s]=t[r+s]},flattenChunks:function(e){return[].concat.apply([],e)}};r.setTyped=function(e){e?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,i)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,s))},r.setTyped(n)},{}],42:[function(e,t,r){"use strict";var h=e("./common"),i=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){s=!1}for(var u=new h.Buf8(256),n=0;n<256;n++)u[n]=252<=n?6:248<=n?5:240<=n?4:224<=n?3:192<=n?2:1;function l(e,t){if(t<65537&&(e.subarray&&s||!e.subarray&&i))return String.fromCharCode.apply(null,h.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}u[254]=u[254]=1,r.string2buf=function(e){var t,r,n,i,s,a=e.length,o=0;for(i=0;i<a;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),o+=r<128?1:r<2048?2:r<65536?3:4;for(t=new h.Buf8(o),i=s=0;s<o;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),r<128?t[s++]=r:(r<2048?t[s++]=192|r>>>6:(r<65536?t[s++]=224|r>>>12:(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63),t[s++]=128|r>>>6&63),t[s++]=128|63&r);return t},r.buf2binstring=function(e){return l(e,e.length)},r.binstring2buf=function(e){for(var t=new h.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},r.buf2string=function(e,t){var r,n,i,s,a=t||e.length,o=new Array(2*a);for(r=n=0;r<a;)if((i=e[r++])<128)o[n++]=i;else if(4<(s=u[i]))o[n++]=65533,r+=s-1;else{for(i&=2===s?31:3===s?15:7;1<s&&r<a;)i=i<<6|63&e[r++],s--;1<s?o[n++]=65533:i<65536?o[n++]=i:(i-=65536,o[n++]=55296|i>>10&1023,o[n++]=56320|1023&i)}return l(o,n)},r.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0?t:0===r?t:r+u[e[r]]>t?r:t}},{"./common":41}],43:[function(e,t,r){"use strict";t.exports=function(e,t,r,n){for(var i=65535&e|0,s=e>>>16&65535|0,a=0;0!==r;){for(r-=a=2e3<r?2e3:r;s=s+(i=i+t[n++]|0)|0,--a;);i%=65521,s%=65521}return i|s<<16|0}},{}],44:[function(e,t,r){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,t,r){"use strict";var o=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t,r,n){var i=o,s=n+r;e^=-1;for(var a=n;a<s;a++)e=e>>>8^i[255&(e^t[a])];return-1^e}},{}],46:[function(e,t,r){"use strict";var h,c=e("../utils/common"),u=e("./trees"),d=e("./adler32"),p=e("./crc32"),n=e("./messages"),l=0,f=4,m=0,_=-2,g=-1,b=4,i=2,v=8,y=9,s=286,a=30,o=19,w=2*s+1,k=15,x=3,S=258,z=S+x+1,C=42,E=113,A=1,I=2,O=3,B=4;function R(e,t){return e.msg=n[t],t}function T(e){return(e<<1)-(4<e?9:0)}function D(e){for(var t=e.length;0<=--t;)e[t]=0}function F(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(c.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function N(e,t){u._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,F(e.strm)}function U(e,t){e.pending_buf[e.pending++]=t}function P(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function L(e,t){var r,n,i=e.max_chain_length,s=e.strstart,a=e.prev_length,o=e.nice_match,h=e.strstart>e.w_size-z?e.strstart-(e.w_size-z):0,u=e.window,l=e.w_mask,f=e.prev,c=e.strstart+S,d=u[s+a-1],p=u[s+a];e.prev_length>=e.good_match&&(i>>=2),o>e.lookahead&&(o=e.lookahead);do{if(u[(r=t)+a]===p&&u[r+a-1]===d&&u[r]===u[s]&&u[++r]===u[s+1]){s+=2,r++;do{}while(u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&s<c);if(n=S-(c-s),s=c-S,a<n){if(e.match_start=t,o<=(a=n))break;d=u[s+a-1],p=u[s+a]}}}while((t=f[t&l])>h&&0!=--i);return a<=e.lookahead?a:e.lookahead}function j(e){var t,r,n,i,s,a,o,h,u,l,f=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=f+(f-z)){for(c.arraySet(e.window,e.window,f,f,0),e.match_start-=f,e.strstart-=f,e.block_start-=f,t=r=e.hash_size;n=e.head[--t],e.head[t]=f<=n?n-f:0,--r;);for(t=r=f;n=e.prev[--t],e.prev[t]=f<=n?n-f:0,--r;);i+=f}if(0===e.strm.avail_in)break;if(a=e.strm,o=e.window,h=e.strstart+e.lookahead,u=i,l=void 0,l=a.avail_in,u<l&&(l=u),r=0===l?0:(a.avail_in-=l,c.arraySet(o,a.input,a.next_in,l,h),1===a.state.wrap?a.adler=d(a.adler,o,l,h):2===a.state.wrap&&(a.adler=p(a.adler,o,l,h)),a.next_in+=l,a.total_in+=l,l),e.lookahead+=r,e.lookahead+e.insert>=x)for(s=e.strstart-e.insert,e.ins_h=e.window[s],e.ins_h=(e.ins_h<<e.hash_shift^e.window[s+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[s+x-1])&e.hash_mask,e.prev[s&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=s,s++,e.insert--,!(e.lookahead+e.insert<x)););}while(e.lookahead<z&&0!==e.strm.avail_in)}function Z(e,t){for(var r,n;;){if(e.lookahead<z){if(j(e),e.lookahead<z&&t===l)return A;if(0===e.lookahead)break}if(r=0,e.lookahead>=x&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+x-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-z&&(e.match_length=L(e,r)),e.match_length>=x)if(n=u._tr_tally(e,e.strstart-e.match_start,e.match_length-x),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=x){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+x-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=u._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(N(e,!1),0===e.strm.avail_out))return A}return e.insert=e.strstart<x-1?e.strstart:x-1,t===f?(N(e,!0),0===e.strm.avail_out?O:B):e.last_lit&&(N(e,!1),0===e.strm.avail_out)?A:I}function W(e,t){for(var r,n,i;;){if(e.lookahead<z){if(j(e),e.lookahead<z&&t===l)return A;if(0===e.lookahead)break}if(r=0,e.lookahead>=x&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+x-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=x-1,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-z&&(e.match_length=L(e,r),e.match_length<=5&&(1===e.strategy||e.match_length===x&&4096<e.strstart-e.match_start)&&(e.match_length=x-1)),e.prev_length>=x&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-x,n=u._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-x),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+x-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=x-1,e.strstart++,n&&(N(e,!1),0===e.strm.avail_out))return A}else if(e.match_available){if((n=u._tr_tally(e,0,e.window[e.strstart-1]))&&N(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return A}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=u._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<x-1?e.strstart:x-1,t===f?(N(e,!0),0===e.strm.avail_out?O:B):e.last_lit&&(N(e,!1),0===e.strm.avail_out)?A:I}function M(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}function H(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=v,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new c.Buf16(2*w),this.dyn_dtree=new c.Buf16(2*(2*a+1)),this.bl_tree=new c.Buf16(2*(2*o+1)),D(this.dyn_ltree),D(this.dyn_dtree),D(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new c.Buf16(k+1),this.heap=new c.Buf16(2*s+1),D(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new c.Buf16(2*s+1),D(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function G(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=i,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?C:E,e.adler=2===t.wrap?0:1,t.last_flush=l,u._tr_init(t),m):R(e,_)}function K(e){var t=G(e);return t===m&&function(e){e.window_size=2*e.w_size,D(e.head),e.max_lazy_match=h[e.level].max_lazy,e.good_match=h[e.level].good_length,e.nice_match=h[e.level].nice_length,e.max_chain_length=h[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=x-1,e.match_available=0,e.ins_h=0}(e.state),t}function Y(e,t,r,n,i,s){if(!e)return _;var a=1;if(t===g&&(t=6),n<0?(a=0,n=-n):15<n&&(a=2,n-=16),i<1||y<i||r!==v||n<8||15<n||t<0||9<t||s<0||b<s)return R(e,_);8===n&&(n=9);var o=new H;return(e.state=o).strm=e,o.wrap=a,o.gzhead=null,o.w_bits=n,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=i+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+x-1)/x),o.window=new c.Buf8(2*o.w_size),o.head=new c.Buf16(o.hash_size),o.prev=new c.Buf16(o.w_size),o.lit_bufsize=1<<i+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new c.Buf8(o.pending_buf_size),o.d_buf=1*o.lit_bufsize,o.l_buf=3*o.lit_bufsize,o.level=t,o.strategy=s,o.method=r,K(e)}h=[new M(0,0,0,0,function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(j(e),0===e.lookahead&&t===l)return A;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,N(e,!1),0===e.strm.avail_out))return A;if(e.strstart-e.block_start>=e.w_size-z&&(N(e,!1),0===e.strm.avail_out))return A}return e.insert=0,t===f?(N(e,!0),0===e.strm.avail_out?O:B):(e.strstart>e.block_start&&(N(e,!1),e.strm.avail_out),A)}),new M(4,4,8,4,Z),new M(4,5,16,8,Z),new M(4,6,32,32,Z),new M(4,4,16,16,W),new M(8,16,32,32,W),new M(8,16,128,128,W),new M(8,32,128,256,W),new M(32,128,258,1024,W),new M(32,258,258,4096,W)],r.deflateInit=function(e,t){return Y(e,t,v,15,8,0)},r.deflateInit2=Y,r.deflateReset=K,r.deflateResetKeep=G,r.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?_:(e.state.gzhead=t,m):_},r.deflate=function(e,t){var r,n,i,s;if(!e||!e.state||5<t||t<0)return e?R(e,_):_;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||666===n.status&&t!==f)return R(e,0===e.avail_out?-5:_);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===C)if(2===n.wrap)e.adler=0,U(n,31),U(n,139),U(n,8),n.gzhead?(U(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),U(n,255&n.gzhead.time),U(n,n.gzhead.time>>8&255),U(n,n.gzhead.time>>16&255),U(n,n.gzhead.time>>24&255),U(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),U(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(U(n,255&n.gzhead.extra.length),U(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(U(n,0),U(n,0),U(n,0),U(n,0),U(n,0),U(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),U(n,3),n.status=E);else{var a=v+(n.w_bits-8<<4)<<8;a|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(a|=32),a+=31-a%31,n.status=E,P(n,a),0!==n.strstart&&(P(n,e.adler>>>16),P(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),F(e),i=n.pending,n.pending!==n.pending_buf_size));)U(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),F(e),i=n.pending,n.pending===n.pending_buf_size)){s=1;break}s=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,U(n,s)}while(0!==s);n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===s&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),F(e),i=n.pending,n.pending===n.pending_buf_size)){s=1;break}s=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,U(n,s)}while(0!==s);n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===s&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&F(e),n.pending+2<=n.pending_buf_size&&(U(n,255&e.adler),U(n,e.adler>>8&255),e.adler=0,n.status=E)):n.status=E),0!==n.pending){if(F(e),0===e.avail_out)return n.last_flush=-1,m}else if(0===e.avail_in&&T(t)<=T(r)&&t!==f)return R(e,-5);if(666===n.status&&0!==e.avail_in)return R(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==l&&666!==n.status){var o=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(j(e),0===e.lookahead)){if(t===l)return A;break}if(e.match_length=0,r=u._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(N(e,!1),0===e.strm.avail_out))return A}return e.insert=0,t===f?(N(e,!0),0===e.strm.avail_out?O:B):e.last_lit&&(N(e,!1),0===e.strm.avail_out)?A:I}(n,t):3===n.strategy?function(e,t){for(var r,n,i,s,a=e.window;;){if(e.lookahead<=S){if(j(e),e.lookahead<=S&&t===l)return A;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=x&&0<e.strstart&&(n=a[i=e.strstart-1])===a[++i]&&n===a[++i]&&n===a[++i]){s=e.strstart+S;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<s);e.match_length=S-(s-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=x?(r=u._tr_tally(e,1,e.match_length-x),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=u._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(N(e,!1),0===e.strm.avail_out))return A}return e.insert=0,t===f?(N(e,!0),0===e.strm.avail_out?O:B):e.last_lit&&(N(e,!1),0===e.strm.avail_out)?A:I}(n,t):h[n.level].func(n,t);if(o!==O&&o!==B||(n.status=666),o===A||o===O)return 0===e.avail_out&&(n.last_flush=-1),m;if(o===I&&(1===t?u._tr_align(n):5!==t&&(u._tr_stored_block(n,0,0,!1),3===t&&(D(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),F(e),0===e.avail_out))return n.last_flush=-1,m}return t!==f?m:n.wrap<=0?1:(2===n.wrap?(U(n,255&e.adler),U(n,e.adler>>8&255),U(n,e.adler>>16&255),U(n,e.adler>>24&255),U(n,255&e.total_in),U(n,e.total_in>>8&255),U(n,e.total_in>>16&255),U(n,e.total_in>>24&255)):(P(n,e.adler>>>16),P(n,65535&e.adler)),F(e),0<n.wrap&&(n.wrap=-n.wrap),0!==n.pending?m:1)},r.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==C&&69!==t&&73!==t&&91!==t&&103!==t&&t!==E&&666!==t?R(e,_):(e.state=null,t===E?R(e,-3):m):_},r.deflateSetDictionary=function(e,t){var r,n,i,s,a,o,h,u,l=t.length;if(!e||!e.state)return _;if(2===(s=(r=e.state).wrap)||1===s&&r.status!==C||r.lookahead)return _;for(1===s&&(e.adler=d(e.adler,t,l,0)),r.wrap=0,l>=r.w_size&&(0===s&&(D(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new c.Buf8(r.w_size),c.arraySet(u,t,l-r.w_size,r.w_size,0),t=u,l=r.w_size),a=e.avail_in,o=e.next_in,h=e.input,e.avail_in=l,e.next_in=0,e.input=t,j(r);r.lookahead>=x;){for(n=r.strstart,i=r.lookahead-(x-1);r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+x-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++,--i;);r.strstart=n,r.lookahead=x-1,j(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=x-1,r.match_available=0,e.next_in=o,e.input=h,e.avail_in=a,r.wrap=s,m},r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,r){"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,t,r){"use strict";t.exports=function(e,t){var r,n,i,s,a,o,h,u,l,f,c,d,p,m,_,g,b,v,y,w,k,x,S,z,C;r=e.state,n=e.next_in,z=e.input,i=n+(e.avail_in-5),s=e.next_out,C=e.output,a=s-(t-e.avail_out),o=s+(e.avail_out-257),h=r.dmax,u=r.wsize,l=r.whave,f=r.wnext,c=r.window,d=r.hold,p=r.bits,m=r.lencode,_=r.distcode,g=(1<<r.lenbits)-1,b=(1<<r.distbits)-1;e:do{p<15&&(d+=z[n++]<<p,p+=8,d+=z[n++]<<p,p+=8),v=m[d&g];t:for(;;){if(d>>>=y=v>>>24,p-=y,0===(y=v>>>16&255))C[s++]=65535&v;else{if(!(16&y)){if(0==(64&y)){v=m[(65535&v)+(d&(1<<y)-1)];continue t}if(32&y){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}w=65535&v,(y&=15)&&(p<y&&(d+=z[n++]<<p,p+=8),w+=d&(1<<y)-1,d>>>=y,p-=y),p<15&&(d+=z[n++]<<p,p+=8,d+=z[n++]<<p,p+=8),v=_[d&b];r:for(;;){if(d>>>=y=v>>>24,p-=y,!(16&(y=v>>>16&255))){if(0==(64&y)){v=_[(65535&v)+(d&(1<<y)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(k=65535&v,p<(y&=15)&&(d+=z[n++]<<p,(p+=8)<y&&(d+=z[n++]<<p,p+=8)),h<(k+=d&(1<<y)-1)){e.msg="invalid distance too far back",r.mode=30;break e}if(d>>>=y,p-=y,(y=s-a)<k){if(l<(y=k-y)&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(S=c,(x=0)===f){if(x+=u-y,y<w){for(w-=y;C[s++]=c[x++],--y;);x=s-k,S=C}}else if(f<y){if(x+=u+f-y,(y-=f)<w){for(w-=y;C[s++]=c[x++],--y;);if(x=0,f<w){for(w-=y=f;C[s++]=c[x++],--y;);x=s-k,S=C}}}else if(x+=f-y,y<w){for(w-=y;C[s++]=c[x++],--y;);x=s-k,S=C}for(;2<w;)C[s++]=S[x++],C[s++]=S[x++],C[s++]=S[x++],w-=3;w&&(C[s++]=S[x++],1<w&&(C[s++]=S[x++]))}else{for(x=s-k;C[s++]=C[x++],C[s++]=C[x++],C[s++]=C[x++],2<(w-=3););w&&(C[s++]=C[x++],1<w&&(C[s++]=C[x++]))}break}}break}}while(n<i&&s<o);n-=w=p>>3,d&=(1<<(p-=w<<3))-1,e.next_in=n,e.next_out=s,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=s<o?o-s+257:257-(s-o),r.hold=d,r.bits=p}},{}],49:[function(e,t,r){"use strict";var I=e("../utils/common"),O=e("./adler32"),B=e("./crc32"),R=e("./inffast"),T=e("./inftrees"),D=1,F=2,N=0,U=-2,P=1,n=852,i=592;function L(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function s(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new I.Buf16(320),this.work=new I.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function a(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=P,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new I.Buf32(n),t.distcode=t.distdyn=new I.Buf32(i),t.sane=1,t.back=-1,N):U}function o(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,a(e)):U}function h(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?U:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,o(e))):U}function u(e,t){var r,n;return e?(n=new s,(e.state=n).window=null,(r=h(e,t))!==N&&(e.state=null),r):U}var l,f,c=!0;function j(e){if(c){var t;for(l=new I.Buf32(512),f=new I.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(T(D,e.lens,0,288,l,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;T(F,e.lens,0,32,f,0,e.work,{bits:5}),c=!1}e.lencode=l,e.lenbits=9,e.distcode=f,e.distbits=5}function Z(e,t,r,n){var i,s=e.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new I.Buf8(s.wsize)),n>=s.wsize?(I.arraySet(s.window,t,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(n<(i=s.wsize-s.wnext)&&(i=n),I.arraySet(s.window,t,r-n,i,s.wnext),(n-=i)?(I.arraySet(s.window,t,r-n,n,0),s.wnext=n,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=i))),0}r.inflateReset=o,r.inflateReset2=h,r.inflateResetKeep=a,r.inflateInit=function(e){return u(e,15)},r.inflateInit2=u,r.inflate=function(e,t){var r,n,i,s,a,o,h,u,l,f,c,d,p,m,_,g,b,v,y,w,k,x,S,z,C=0,E=new I.Buf8(4),A=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return U;12===(r=e.state).mode&&(r.mode=13),a=e.next_out,i=e.output,h=e.avail_out,s=e.next_in,n=e.input,o=e.avail_in,u=r.hold,l=r.bits,f=o,c=h,x=N;e:for(;;)switch(r.mode){case P:if(0===r.wrap){r.mode=13;break}for(;l<16;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}if(2&r.wrap&&35615===u){E[r.check=0]=255&u,E[1]=u>>>8&255,r.check=B(r.check,E,2,0),l=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;break}if(l-=4,k=8+(15&(u>>>=4)),0===r.wbits)r.wbits=k;else if(k>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<<k,e.adler=r.check=1,r.mode=512&u?10:12,l=u=0;break;case 2:for(;l<16;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}if(r.flags=u,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,r.check=B(r.check,E,2,0)),l=u=0,r.mode=3;case 3:for(;l<32;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}r.head&&(r.head.time=u),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,E[2]=u>>>16&255,E[3]=u>>>24&255,r.check=B(r.check,E,4,0)),l=u=0,r.mode=4;case 4:for(;l<16;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,r.check=B(r.check,E,2,0)),l=u=0,r.mode=5;case 5:if(1024&r.flags){for(;l<16;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,r.check=B(r.check,E,2,0)),l=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(o<(d=r.length)&&(d=o),d&&(r.head&&(k=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),I.arraySet(r.head.extra,n,s,d,k)),512&r.flags&&(r.check=B(r.check,n,d,s)),o-=d,s+=d,r.length-=d),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===o)break e;for(d=0;k=n[s+d++],r.head&&k&&r.length<65536&&(r.head.name+=String.fromCharCode(k)),k&&d<o;);if(512&r.flags&&(r.check=B(r.check,n,d,s)),o-=d,s+=d,k)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===o)break e;for(d=0;k=n[s+d++],r.head&&k&&r.length<65536&&(r.head.comment+=String.fromCharCode(k)),k&&d<o;);if(512&r.flags&&(r.check=B(r.check,n,d,s)),o-=d,s+=d,k)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;l<16;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}if(u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=30;break}l=u=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;l<32;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}e.adler=r.check=L(u),l=u=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=a,e.avail_out=h,e.next_in=s,e.avail_in=o,r.hold=u,r.bits=l,2;e.adler=r.check=1,r.mode=12;case 12:if(5===t||6===t)break e;case 13:if(r.last){u>>>=7&l,l-=7&l,r.mode=27;break}for(;l<3;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}switch(r.last=1&u,l-=1,3&(u>>>=1)){case 0:r.mode=14;break;case 1:if(j(r),r.mode=20,6!==t)break;u>>>=2,l-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}u>>>=2,l-=2;break;case 14:for(u>>>=7&l,l-=7&l;l<32;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&u,l=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(d=r.length){if(o<d&&(d=o),h<d&&(d=h),0===d)break e;I.arraySet(i,n,s,d,a),o-=d,s+=d,h-=d,a+=d,r.length-=d;break}r.mode=12;break;case 17:for(;l<14;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}if(r.nlen=257+(31&u),u>>>=5,l-=5,r.ndist=1+(31&u),u>>>=5,l-=5,r.ncode=4+(15&u),u>>>=4,l-=4,286<r.nlen||30<r.ndist){e.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;l<3;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}r.lens[A[r.have++]]=7&u,u>>>=3,l-=3}for(;r.have<19;)r.lens[A[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,S={bits:r.lenbits},x=T(0,r.lens,0,19,r.lencode,0,r.work,S),r.lenbits=S.bits,x){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;g=(C=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,b=65535&C,!((_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}if(b<16)u>>>=_,l-=_,r.lens[r.have++]=b;else{if(16===b){for(z=_+2;l<z;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}if(u>>>=_,l-=_,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}k=r.lens[r.have-1],d=3+(3&u),u>>>=2,l-=2}else if(17===b){for(z=_+3;l<z;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}l-=_,k=0,d=3+(7&(u>>>=_)),u>>>=3,l-=3}else{for(z=_+7;l<z;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}l-=_,k=0,d=11+(127&(u>>>=_)),u>>>=7,l-=7}if(r.have+d>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;d--;)r.lens[r.have++]=k}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,S={bits:r.lenbits},x=T(D,r.lens,0,r.nlen,r.lencode,0,r.work,S),r.lenbits=S.bits,x){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,S={bits:r.distbits},x=T(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,S),r.distbits=S.bits,x){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=o&&258<=h){e.next_out=a,e.avail_out=h,e.next_in=s,e.avail_in=o,r.hold=u,r.bits=l,R(e,c),a=e.next_out,i=e.output,h=e.avail_out,s=e.next_in,n=e.input,o=e.avail_in,u=r.hold,l=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;g=(C=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,b=65535&C,!((_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}if(g&&0==(240&g)){for(v=_,y=g,w=b;g=(C=r.lencode[w+((u&(1<<v+y)-1)>>v)])>>>16&255,b=65535&C,!(v+(_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}u>>>=v,l-=v,r.back+=v}if(u>>>=_,l-=_,r.back+=_,r.length=b,0===g){r.mode=26;break}if(32&g){r.back=-1,r.mode=12;break}if(64&g){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&g,r.mode=22;case 22:if(r.extra){for(z=r.extra;l<z;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;g=(C=r.distcode[u&(1<<r.distbits)-1])>>>16&255,b=65535&C,!((_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}if(0==(240&g)){for(v=_,y=g,w=b;g=(C=r.distcode[w+((u&(1<<v+y)-1)>>v)])>>>16&255,b=65535&C,!(v+(_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}u>>>=v,l-=v,r.back+=v}if(u>>>=_,l-=_,r.back+=_,64&g){e.msg="invalid distance code",r.mode=30;break}r.offset=b,r.extra=15&g,r.mode=24;case 24:if(r.extra){for(z=r.extra;l<z;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===h)break e;if(d=c-h,r.offset>d){if((d=r.offset-d)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}p=d>r.wnext?(d-=r.wnext,r.wsize-d):r.wnext-d,d>r.length&&(d=r.length),m=r.window}else m=i,p=a-r.offset,d=r.length;for(h<d&&(d=h),h-=d,r.length-=d;i[a++]=m[p++],--d;);0===r.length&&(r.mode=21);break;case 26:if(0===h)break e;i[a++]=r.length,h--,r.mode=21;break;case 27:if(r.wrap){for(;l<32;){if(0===o)break e;o--,u|=n[s++]<<l,l+=8}if(c-=h,e.total_out+=c,r.total+=c,c&&(e.adler=r.check=r.flags?B(r.check,i,c,a-c):O(r.check,i,c,a-c)),c=h,(r.flags?u:L(u))!==r.check){e.msg="incorrect data check",r.mode=30;break}l=u=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;l<32;){if(0===o)break e;o--,u+=n[s++]<<l,l+=8}if(u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=30;break}l=u=0}r.mode=29;case 29:x=1;break e;case 30:x=-3;break e;case 31:return-4;case 32:default:return U}return e.next_out=a,e.avail_out=h,e.next_in=s,e.avail_in=o,r.hold=u,r.bits=l,(r.wsize||c!==e.avail_out&&r.mode<30&&(r.mode<27||4!==t))&&Z(e,e.output,e.next_out,c-e.avail_out)?(r.mode=31,-4):(f-=e.avail_in,c-=e.avail_out,e.total_in+=f,e.total_out+=c,r.total+=c,r.wrap&&c&&(e.adler=r.check=r.flags?B(r.check,i,c,e.next_out-c):O(r.check,i,c,e.next_out-c)),e.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0==f&&0===c||4===t)&&x===N&&(x=-5),x)},r.inflateEnd=function(e){if(!e||!e.state)return U;var t=e.state;return t.window&&(t.window=null),e.state=null,N},r.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?U:((r.head=t).done=!1,N):U},r.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?U:11===r.mode&&O(1,t,n,0)!==r.check?-3:Z(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,N):U},r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,r){"use strict";var D=e("../utils/common"),F=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],N=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],U=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],P=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,r,n,i,s,a,o){var h,u,l,f,c,d,p,m,_,g=o.bits,b=0,v=0,y=0,w=0,k=0,x=0,S=0,z=0,C=0,E=0,A=null,I=0,O=new D.Buf16(16),B=new D.Buf16(16),R=null,T=0;for(b=0;b<=15;b++)O[b]=0;for(v=0;v<n;v++)O[t[r+v]]++;for(k=g,w=15;1<=w&&0===O[w];w--);if(w<k&&(k=w),0===w)return i[s++]=20971520,i[s++]=20971520,o.bits=1,0;for(y=1;y<w&&0===O[y];y++);for(k<y&&(k=y),b=z=1;b<=15;b++)if(z<<=1,(z-=O[b])<0)return-1;if(0<z&&(0===e||1!==w))return-1;for(B[1]=0,b=1;b<15;b++)B[b+1]=B[b]+O[b];for(v=0;v<n;v++)0!==t[r+v]&&(a[B[t[r+v]]++]=v);if(d=0===e?(A=R=a,19):1===e?(A=F,I-=257,R=N,T-=257,256):(A=U,R=P,-1),b=y,c=s,S=v=E=0,l=-1,f=(C=1<<(x=k))-1,1===e&&852<C||2===e&&592<C)return 1;for(;;){for(p=b-S,_=a[v]<d?(m=0,a[v]):a[v]>d?(m=R[T+a[v]],A[I+a[v]]):(m=96,0),h=1<<b-S,y=u=1<<x;i[c+(E>>S)+(u-=h)]=p<<24|m<<16|_|0,0!==u;);for(h=1<<b-1;E&h;)h>>=1;if(0!==h?(E&=h-1,E+=h):E=0,v++,0==--O[b]){if(b===w)break;b=t[r+a[v]]}if(k<b&&(E&f)!==l){for(0===S&&(S=k),c+=y,z=1<<(x=b-S);x+S<w&&!((z-=O[x+S])<=0);)x++,z<<=1;if(C+=1<<x,1===e&&852<C||2===e&&592<C)return 1;i[l=E&f]=k<<24|x<<16|c-s|0}}return 0!==E&&(i[c+E]=b-S<<24|64<<16|0),o.bits=k,0}},{"../utils/common":41}],51:[function(e,t,r){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,t,r){"use strict";var i=e("../utils/common"),o=0,h=1;function n(e){for(var t=e.length;0<=--t;)e[t]=0}var s=0,a=29,u=256,l=u+1+a,f=30,c=19,_=2*l+1,g=15,d=16,p=7,m=256,b=16,v=17,y=18,w=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],k=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],x=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],S=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],z=new Array(2*(l+2));n(z);var C=new Array(2*f);n(C);var E=new Array(512);n(E);var A=new Array(256);n(A);var I=new Array(a);n(I);var O,B,R,T=new Array(f);function D(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}function F(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function N(e){return e<256?E[e]:E[256+(e>>>7)]}function U(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function P(e,t,r){e.bi_valid>d-r?(e.bi_buf|=t<<e.bi_valid&65535,U(e,e.bi_buf),e.bi_buf=t>>d-e.bi_valid,e.bi_valid+=r-d):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function L(e,t,r){P(e,r[2*t],r[2*t+1])}function j(e,t){for(var r=0;r|=1&e,e>>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){var n,i,s=new Array(g+1),a=0;for(n=1;n<=g;n++)s[n]=a=a+r[n-1]<<1;for(i=0;i<=t;i++){var o=e[2*i+1];0!==o&&(e[2*i]=j(s[o]++,o))}}function W(e){var t;for(t=0;t<l;t++)e.dyn_ltree[2*t]=0;for(t=0;t<f;t++)e.dyn_dtree[2*t]=0;for(t=0;t<c;t++)e.bl_tree[2*t]=0;e.dyn_ltree[2*m]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function M(e){8<e.bi_valid?U(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function H(e,t,r,n){var i=2*t,s=2*r;return e[i]<e[s]||e[i]===e[s]&&n[t]<=n[r]}function G(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&H(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!H(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function K(e,t,r){var n,i,s,a,o=0;if(0!==e.last_lit)for(;n=e.pending_buf[e.d_buf+2*o]<<8|e.pending_buf[e.d_buf+2*o+1],i=e.pending_buf[e.l_buf+o],o++,0===n?L(e,i,t):(L(e,(s=A[i])+u+1,t),0!==(a=w[s])&&P(e,i-=I[s],a),L(e,s=N(--n),r),0!==(a=k[s])&&P(e,n-=T[s],a)),o<e.last_lit;);L(e,m,t)}function Y(e,t){var r,n,i,s=t.dyn_tree,a=t.stat_desc.static_tree,o=t.stat_desc.has_stree,h=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=_,r=0;r<h;r++)0!==s[2*r]?(e.heap[++e.heap_len]=u=r,e.depth[r]=0):s[2*r+1]=0;for(;e.heap_len<2;)s[2*(i=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[i]=0,e.opt_len--,o&&(e.static_len-=a[2*i+1]);for(t.max_code=u,r=e.heap_len>>1;1<=r;r--)G(e,s,r);for(i=h;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],G(e,s,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,s[2*i]=s[2*r]+s[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,s[2*r+1]=s[2*n+1]=i,e.heap[1]=i++,G(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,s,a,o,h=t.dyn_tree,u=t.max_code,l=t.stat_desc.static_tree,f=t.stat_desc.has_stree,c=t.stat_desc.extra_bits,d=t.stat_desc.extra_base,p=t.stat_desc.max_length,m=0;for(s=0;s<=g;s++)e.bl_count[s]=0;for(h[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<_;r++)p<(s=h[2*h[2*(n=e.heap[r])+1]+1]+1)&&(s=p,m++),h[2*n+1]=s,u<n||(e.bl_count[s]++,a=0,d<=n&&(a=c[n-d]),o=h[2*n],e.opt_len+=o*(s+a),f&&(e.static_len+=o*(l[2*n+1]+a)));if(0!==m){do{for(s=p-1;0===e.bl_count[s];)s--;e.bl_count[s]--,e.bl_count[s+1]+=2,e.bl_count[p]--,m-=2}while(0<m);for(s=p;0!==s;s--)for(n=e.bl_count[s];0!==n;)u<(i=e.heap[--r])||(h[2*i+1]!==s&&(e.opt_len+=(s-h[2*i+1])*h[2*i],h[2*i+1]=s),n--)}}(e,t),Z(s,u,e.bl_count)}function X(e,t,r){var n,i,s=-1,a=t[1],o=0,h=7,u=4;for(0===a&&(h=138,u=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++o<h&&i===a||(o<u?e.bl_tree[2*i]+=o:0!==i?(i!==s&&e.bl_tree[2*i]++,e.bl_tree[2*b]++):o<=10?e.bl_tree[2*v]++:e.bl_tree[2*y]++,s=i,u=(o=0)===a?(h=138,3):i===a?(h=6,3):(h=7,4))}function V(e,t,r){var n,i,s=-1,a=t[1],o=0,h=7,u=4;for(0===a&&(h=138,u=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++o<h&&i===a)){if(o<u)for(;L(e,i,e.bl_tree),0!=--o;);else 0!==i?(i!==s&&(L(e,i,e.bl_tree),o--),L(e,b,e.bl_tree),P(e,o-3,2)):o<=10?(L(e,v,e.bl_tree),P(e,o-3,3)):(L(e,y,e.bl_tree),P(e,o-11,7));s=i,u=(o=0)===a?(h=138,3):i===a?(h=6,3):(h=7,4)}}n(T);var q=!1;function J(e,t,r,n){P(e,(s<<1)+(n?1:0),3),function(e,t,r,n){M(e),n&&(U(e,r),U(e,~r)),i.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}r._tr_init=function(e){q||(function(){var e,t,r,n,i,s=new Array(g+1);for(n=r=0;n<a-1;n++)for(I[n]=r,e=0;e<1<<w[n];e++)A[r++]=n;for(A[r-1]=n,n=i=0;n<16;n++)for(T[n]=i,e=0;e<1<<k[n];e++)E[i++]=n;for(i>>=7;n<f;n++)for(T[n]=i<<7,e=0;e<1<<k[n]-7;e++)E[256+i++]=n;for(t=0;t<=g;t++)s[t]=0;for(e=0;e<=143;)z[2*e+1]=8,e++,s[8]++;for(;e<=255;)z[2*e+1]=9,e++,s[9]++;for(;e<=279;)z[2*e+1]=7,e++,s[7]++;for(;e<=287;)z[2*e+1]=8,e++,s[8]++;for(Z(z,l+1,s),e=0;e<f;e++)C[2*e+1]=5,C[2*e]=j(e,5);O=new D(z,w,u+1,l,g),B=new D(C,k,0,f,g),R=new D(new Array(0),x,0,c,p)}(),q=!0),e.l_desc=new F(e.dyn_ltree,O),e.d_desc=new F(e.dyn_dtree,B),e.bl_desc=new F(e.bl_tree,R),e.bi_buf=0,e.bi_valid=0,W(e)},r._tr_stored_block=J,r._tr_flush_block=function(e,t,r,n){var i,s,a=0;0<e.level?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return o;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return h;for(t=32;t<u;t++)if(0!==e.dyn_ltree[2*t])return h;return o}(e)),Y(e,e.l_desc),Y(e,e.d_desc),a=function(e){var t;for(X(e,e.dyn_ltree,e.l_desc.max_code),X(e,e.dyn_dtree,e.d_desc.max_code),Y(e,e.bl_desc),t=c-1;3<=t&&0===e.bl_tree[2*S[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(s=e.static_len+3+7>>>3)<=i&&(i=s)):i=s=r+5,r+4<=i&&-1!==t?J(e,t,r,n):4===e.strategy||s===i?(P(e,2+(n?1:0),3),K(e,z,C)):(P(e,4+(n?1:0),3),function(e,t,r,n){var i;for(P(e,t-257,5),P(e,r-1,5),P(e,n-4,4),i=0;i<n;i++)P(e,e.bl_tree[2*S[i]+1],3);V(e,e.dyn_ltree,t-1),V(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),K(e,e.dyn_ltree,e.dyn_dtree)),W(e),n&&M(e)},r._tr_tally=function(e,t,r){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(A[r]+u+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},r._tr_align=function(e){P(e,2,3),L(e,m,z),function(e){16===e.bi_valid?(U(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,r){(function(e){!function(r,n){"use strict";if(!r.setImmediate){var i,s,t,a,o=1,h={},u=!1,l=r.document,e=Object.getPrototypeOf&&Object.getPrototypeOf(r);e=e&&e.setTimeout?e:r,i="[object process]"==={}.toString.call(r.process)?function(e){process.nextTick(function(){c(e)})}:function(){if(r.postMessage&&!r.importScripts){var e=!0,t=r.onmessage;return r.onmessage=function(){e=!1},r.postMessage("","*"),r.onmessage=t,e}}()?(a="setImmediate$"+Math.random()+"$",r.addEventListener?r.addEventListener("message",d,!1):r.attachEvent("onmessage",d),function(e){r.postMessage(a+e,"*")}):r.MessageChannel?((t=new MessageChannel).port1.onmessage=function(e){c(e.data)},function(e){t.port2.postMessage(e)}):l&&"onreadystatechange"in l.createElement("script")?(s=l.documentElement,function(e){var t=l.createElement("script");t.onreadystatechange=function(){c(e),t.onreadystatechange=null,s.removeChild(t),t=null},s.appendChild(t)}):function(e){setTimeout(c,0,e)},e.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r<t.length;r++)t[r]=arguments[r+1];var n={callback:e,args:t};return h[o]=n,i(o),o++},e.clearImmediate=f}function f(e){delete h[e]}function c(e){if(u)setTimeout(c,0,e);else{var t=h[e];if(t){u=!0;try{!function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(n,r)}}(t)}finally{f(e),u=!1}}}}function d(e){e.source===r&&"string"==typeof e.data&&0===e.data.indexOf(a)&&c(+e.data.slice(a.length))}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10)});
  1757. }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],require("timers").setImmediate)
  1758. },{"_process":7,"buffer":2,"timers":8}],7:[function(require,module,exports){
  1759. // shim for using process in browser
  1760. var process = module.exports = {};
  1761. // cached from whatever global is present so that test runners that stub it
  1762. // don't break things. But we need to wrap it in a try catch in case it is
  1763. // wrapped in strict mode code which doesn't define any globals. It's inside a
  1764. // function because try/catches deoptimize in certain engines.
  1765. var cachedSetTimeout;
  1766. var cachedClearTimeout;
  1767. function defaultSetTimout() {
  1768. throw new Error('setTimeout has not been defined');
  1769. }
  1770. function defaultClearTimeout () {
  1771. throw new Error('clearTimeout has not been defined');
  1772. }
  1773. (function () {
  1774. try {
  1775. if (typeof setTimeout === 'function') {
  1776. cachedSetTimeout = setTimeout;
  1777. } else {
  1778. cachedSetTimeout = defaultSetTimout;
  1779. }
  1780. } catch (e) {
  1781. cachedSetTimeout = defaultSetTimout;
  1782. }
  1783. try {
  1784. if (typeof clearTimeout === 'function') {
  1785. cachedClearTimeout = clearTimeout;
  1786. } else {
  1787. cachedClearTimeout = defaultClearTimeout;
  1788. }
  1789. } catch (e) {
  1790. cachedClearTimeout = defaultClearTimeout;
  1791. }
  1792. } ())
  1793. function runTimeout(fun) {
  1794. if (cachedSetTimeout === setTimeout) {
  1795. //normal enviroments in sane situations
  1796. return setTimeout(fun, 0);
  1797. }
  1798. // if setTimeout wasn't available but was latter defined
  1799. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  1800. cachedSetTimeout = setTimeout;
  1801. return setTimeout(fun, 0);
  1802. }
  1803. try {
  1804. // when when somebody has screwed with setTimeout but no I.E. maddness
  1805. return cachedSetTimeout(fun, 0);
  1806. } catch(e){
  1807. try {
  1808. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  1809. return cachedSetTimeout.call(null, fun, 0);
  1810. } catch(e){
  1811. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
  1812. return cachedSetTimeout.call(this, fun, 0);
  1813. }
  1814. }
  1815. }
  1816. function runClearTimeout(marker) {
  1817. if (cachedClearTimeout === clearTimeout) {
  1818. //normal enviroments in sane situations
  1819. return clearTimeout(marker);
  1820. }
  1821. // if clearTimeout wasn't available but was latter defined
  1822. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  1823. cachedClearTimeout = clearTimeout;
  1824. return clearTimeout(marker);
  1825. }
  1826. try {
  1827. // when when somebody has screwed with setTimeout but no I.E. maddness
  1828. return cachedClearTimeout(marker);
  1829. } catch (e){
  1830. try {
  1831. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  1832. return cachedClearTimeout.call(null, marker);
  1833. } catch (e){
  1834. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
  1835. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  1836. return cachedClearTimeout.call(this, marker);
  1837. }
  1838. }
  1839. }
  1840. var queue = [];
  1841. var draining = false;
  1842. var currentQueue;
  1843. var queueIndex = -1;
  1844. function cleanUpNextTick() {
  1845. if (!draining || !currentQueue) {
  1846. return;
  1847. }
  1848. draining = false;
  1849. if (currentQueue.length) {
  1850. queue = currentQueue.concat(queue);
  1851. } else {
  1852. queueIndex = -1;
  1853. }
  1854. if (queue.length) {
  1855. drainQueue();
  1856. }
  1857. }
  1858. function drainQueue() {
  1859. if (draining) {
  1860. return;
  1861. }
  1862. var timeout = runTimeout(cleanUpNextTick);
  1863. draining = true;
  1864. var len = queue.length;
  1865. while(len) {
  1866. currentQueue = queue;
  1867. queue = [];
  1868. while (++queueIndex < len) {
  1869. if (currentQueue) {
  1870. currentQueue[queueIndex].run();
  1871. }
  1872. }
  1873. queueIndex = -1;
  1874. len = queue.length;
  1875. }
  1876. currentQueue = null;
  1877. draining = false;
  1878. runClearTimeout(timeout);
  1879. }
  1880. process.nextTick = function (fun) {
  1881. var args = new Array(arguments.length - 1);
  1882. if (arguments.length > 1) {
  1883. for (var i = 1; i < arguments.length; i++) {
  1884. args[i - 1] = arguments[i];
  1885. }
  1886. }
  1887. queue.push(new Item(fun, args));
  1888. if (queue.length === 1 && !draining) {
  1889. runTimeout(drainQueue);
  1890. }
  1891. };
  1892. // v8 likes predictible objects
  1893. function Item(fun, array) {
  1894. this.fun = fun;
  1895. this.array = array;
  1896. }
  1897. Item.prototype.run = function () {
  1898. this.fun.apply(null, this.array);
  1899. };
  1900. process.title = 'browser';
  1901. process.browser = true;
  1902. process.env = {};
  1903. process.argv = [];
  1904. process.version = ''; // empty string to avoid regexp issues
  1905. process.versions = {};
  1906. function noop() {}
  1907. process.on = noop;
  1908. process.addListener = noop;
  1909. process.once = noop;
  1910. process.off = noop;
  1911. process.removeListener = noop;
  1912. process.removeAllListeners = noop;
  1913. process.emit = noop;
  1914. process.prependListener = noop;
  1915. process.prependOnceListener = noop;
  1916. process.listeners = function (name) { return [] }
  1917. process.binding = function (name) {
  1918. throw new Error('process.binding is not supported');
  1919. };
  1920. process.cwd = function () { return '/' };
  1921. process.chdir = function (dir) {
  1922. throw new Error('process.chdir is not supported');
  1923. };
  1924. process.umask = function() { return 0; };
  1925. },{}],8:[function(require,module,exports){
  1926. (function (setImmediate,clearImmediate){(function (){
  1927. var nextTick = require('process/browser.js').nextTick;
  1928. var apply = Function.prototype.apply;
  1929. var slice = Array.prototype.slice;
  1930. var immediateIds = {};
  1931. var nextImmediateId = 0;
  1932. // DOM APIs, for completeness
  1933. exports.setTimeout = function() {
  1934. return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
  1935. };
  1936. exports.setInterval = function() {
  1937. return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
  1938. };
  1939. exports.clearTimeout =
  1940. exports.clearInterval = function(timeout) { timeout.close(); };
  1941. function Timeout(id, clearFn) {
  1942. this._id = id;
  1943. this._clearFn = clearFn;
  1944. }
  1945. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  1946. Timeout.prototype.close = function() {
  1947. this._clearFn.call(window, this._id);
  1948. };
  1949. // Does not start the time, just sets up the members needed.
  1950. exports.enroll = function(item, msecs) {
  1951. clearTimeout(item._idleTimeoutId);
  1952. item._idleTimeout = msecs;
  1953. };
  1954. exports.unenroll = function(item) {
  1955. clearTimeout(item._idleTimeoutId);
  1956. item._idleTimeout = -1;
  1957. };
  1958. exports._unrefActive = exports.active = function(item) {
  1959. clearTimeout(item._idleTimeoutId);
  1960. var msecs = item._idleTimeout;
  1961. if (msecs >= 0) {
  1962. item._idleTimeoutId = setTimeout(function onTimeout() {
  1963. if (item._onTimeout)
  1964. item._onTimeout();
  1965. }, msecs);
  1966. }
  1967. };
  1968. // That's not how node.js implements it but the exposed api is the same.
  1969. exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {
  1970. var id = nextImmediateId++;
  1971. var args = arguments.length < 2 ? false : slice.call(arguments, 1);
  1972. immediateIds[id] = true;
  1973. nextTick(function onNextTick() {
  1974. if (immediateIds[id]) {
  1975. // fn.call() is faster so we optimize for the common use-case
  1976. // @see http://jsperf.com/call-apply-segu
  1977. if (args) {
  1978. fn.apply(null, args);
  1979. } else {
  1980. fn.call(null);
  1981. }
  1982. // Prevent ids from leaking
  1983. exports.clearImmediate(id);
  1984. }
  1985. });
  1986. return id;
  1987. };
  1988. exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) {
  1989. delete immediateIds[id];
  1990. };
  1991. }).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate)
  1992. },{"process/browser.js":7,"timers":8}],9:[function(require,module,exports){
  1993. "use strict";
  1994. var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
  1995. return mod && mod.__esModule ? mod : {
  1996. "default": mod
  1997. };
  1998. };
  1999. Object.defineProperty(exports, "__esModule", {
  2000. value: true
  2001. });
  2002. exports.HandleZip = void 0;
  2003. var jszip_1 = __importDefault(require("jszip"));
  2004. var method_1 = require("./common/method");
  2005. var HandleZip = /** @class */function () {
  2006. function HandleZip(file) {
  2007. // Support nodejs fs to read files
  2008. // if(file instanceof File){
  2009. this.uploadFile = file;
  2010. // }
  2011. }
  2012. HandleZip.prototype.unzipFile = function (successFunc, errorFunc) {
  2013. // var new_zip:JSZip = new JSZip();
  2014. jszip_1["default"].loadAsync(this.uploadFile) // 1) read the Blob
  2015. .then(function (zip) {
  2016. var fileList = {},
  2017. lastIndex = Object.keys(zip.files).length,
  2018. index = 0;
  2019. zip.forEach(function (relativePath, zipEntry) {
  2020. var fileName = zipEntry.name;
  2021. var fileNameArr = fileName.split(".");
  2022. var suffix = fileNameArr[fileNameArr.length - 1].toLowerCase();
  2023. var fileType = "string";
  2024. if (suffix in {
  2025. "png": 1,
  2026. "jpeg": 1,
  2027. "jpg": 1,
  2028. "gif": 1,
  2029. "bmp": 1,
  2030. "tif": 1,
  2031. "webp": 1
  2032. }) {
  2033. fileType = "base64";
  2034. } else if (suffix == "emf") {
  2035. fileType = "arraybuffer";
  2036. }
  2037. zipEntry.async(fileType).then(function (data) {
  2038. if (fileType == "base64") {
  2039. data = "data:image/" + suffix + ";base64," + data;
  2040. }
  2041. fileList[zipEntry.name] = data;
  2042. // console.log(lastIndex, index);
  2043. if (lastIndex == index + 1) {
  2044. successFunc(fileList);
  2045. }
  2046. index++;
  2047. });
  2048. });
  2049. }, function (e) {
  2050. errorFunc(e);
  2051. });
  2052. };
  2053. HandleZip.prototype.unzipFileByUrl = function (url, successFunc, errorFunc) {
  2054. var new_zip = new jszip_1["default"]();
  2055. method_1.getBinaryContent(url, function (err, data) {
  2056. if (err) {
  2057. throw err; // or handle err
  2058. }
  2059. jszip_1["default"].loadAsync(data).then(function (zip) {
  2060. var fileList = {},
  2061. lastIndex = Object.keys(zip.files).length,
  2062. index = 0;
  2063. zip.forEach(function (relativePath, zipEntry) {
  2064. var fileName = zipEntry.name;
  2065. var fileNameArr = fileName.split(".");
  2066. var suffix = fileNameArr[fileNameArr.length - 1].toLowerCase();
  2067. var fileType = "string";
  2068. if (suffix in {
  2069. "png": 1,
  2070. "jpeg": 1,
  2071. "jpg": 1,
  2072. "gif": 1,
  2073. "bmp": 1,
  2074. "tif": 1,
  2075. "webp": 1
  2076. }) {
  2077. fileType = "base64";
  2078. } else if (suffix == "emf") {
  2079. fileType = "arraybuffer";
  2080. }
  2081. zipEntry.async(fileType).then(function (data) {
  2082. if (fileType == "base64") {
  2083. data = "data:image/" + suffix + ";base64," + data;
  2084. }
  2085. fileList[zipEntry.name] = data;
  2086. // console.log(lastIndex, index);
  2087. if (lastIndex == index + 1) {
  2088. successFunc(fileList);
  2089. }
  2090. index++;
  2091. });
  2092. });
  2093. }, function (e) {
  2094. errorFunc(e);
  2095. });
  2096. });
  2097. };
  2098. HandleZip.prototype.newZipFile = function () {
  2099. var zip = new jszip_1["default"]();
  2100. this.workBook = zip;
  2101. };
  2102. //title:"nested/hello.txt", content:"Hello Worldasdfasfasdfasfasfasfasfasdfas"
  2103. HandleZip.prototype.addToZipFile = function (title, content) {
  2104. if (this.workBook == null) {
  2105. var zip = new jszip_1["default"]();
  2106. this.workBook = zip;
  2107. }
  2108. this.workBook.file(title, content);
  2109. };
  2110. return HandleZip;
  2111. }();
  2112. exports.HandleZip = HandleZip;
  2113. },{"./common/method":18,"jszip":6}],10:[function(require,module,exports){
  2114. "use strict";
  2115. Object.defineProperty(exports, "__esModule", {
  2116. value: true
  2117. });
  2118. exports.LuckyImageBase = exports.LuckysheetCalcChain = exports.LuckySheetConfigMerge = exports.LuckySheetborderInfoCellValueStyle = exports.LuckySheetborderInfoCellValue = exports.LuckySheetborderInfoCellForImp = exports.LuckyConfig = exports.LuckyInlineString = exports.LuckySheetCellFormat = exports.LuckySheetCelldataValue = exports.LuckySheetCelldataBase = exports.LuckyFileInfo = exports.LuckySheetBase = exports.LuckyFileBase = void 0;
  2119. var LuckyFileBase = /** @class */function () {
  2120. function LuckyFileBase() {}
  2121. return LuckyFileBase;
  2122. }();
  2123. exports.LuckyFileBase = LuckyFileBase;
  2124. var LuckySheetBase = /** @class */function () {
  2125. function LuckySheetBase() {}
  2126. return LuckySheetBase;
  2127. }();
  2128. exports.LuckySheetBase = LuckySheetBase;
  2129. var LuckyFileInfo = /** @class */function () {
  2130. function LuckyFileInfo() {}
  2131. return LuckyFileInfo;
  2132. }();
  2133. exports.LuckyFileInfo = LuckyFileInfo;
  2134. var LuckySheetCelldataBase = /** @class */function () {
  2135. function LuckySheetCelldataBase() {}
  2136. return LuckySheetCelldataBase;
  2137. }();
  2138. exports.LuckySheetCelldataBase = LuckySheetCelldataBase;
  2139. var LuckySheetCelldataValue = /** @class */function () {
  2140. function LuckySheetCelldataValue() {}
  2141. return LuckySheetCelldataValue;
  2142. }();
  2143. exports.LuckySheetCelldataValue = LuckySheetCelldataValue;
  2144. var LuckySheetCellFormat = /** @class */function () {
  2145. function LuckySheetCellFormat() {}
  2146. return LuckySheetCellFormat;
  2147. }();
  2148. exports.LuckySheetCellFormat = LuckySheetCellFormat;
  2149. var LuckyInlineString = /** @class */function () {
  2150. function LuckyInlineString() {}
  2151. return LuckyInlineString;
  2152. }();
  2153. exports.LuckyInlineString = LuckyInlineString;
  2154. var LuckyConfig = /** @class */function () {
  2155. function LuckyConfig() {}
  2156. return LuckyConfig;
  2157. }();
  2158. exports.LuckyConfig = LuckyConfig;
  2159. var LuckySheetborderInfoCellForImp = /** @class */function () {
  2160. function LuckySheetborderInfoCellForImp() {}
  2161. return LuckySheetborderInfoCellForImp;
  2162. }();
  2163. exports.LuckySheetborderInfoCellForImp = LuckySheetborderInfoCellForImp;
  2164. var LuckySheetborderInfoCellValue = /** @class */function () {
  2165. function LuckySheetborderInfoCellValue() {}
  2166. return LuckySheetborderInfoCellValue;
  2167. }();
  2168. exports.LuckySheetborderInfoCellValue = LuckySheetborderInfoCellValue;
  2169. var LuckySheetborderInfoCellValueStyle = /** @class */function () {
  2170. function LuckySheetborderInfoCellValueStyle() {}
  2171. return LuckySheetborderInfoCellValueStyle;
  2172. }();
  2173. exports.LuckySheetborderInfoCellValueStyle = LuckySheetborderInfoCellValueStyle;
  2174. var LuckySheetConfigMerge = /** @class */function () {
  2175. function LuckySheetConfigMerge() {}
  2176. return LuckySheetConfigMerge;
  2177. }();
  2178. exports.LuckySheetConfigMerge = LuckySheetConfigMerge;
  2179. var LuckysheetCalcChain = /** @class */function () {
  2180. function LuckysheetCalcChain() {}
  2181. return LuckysheetCalcChain;
  2182. }();
  2183. exports.LuckysheetCalcChain = LuckysheetCalcChain;
  2184. var LuckyImageBase = /** @class */function () {
  2185. function LuckyImageBase() {}
  2186. return LuckyImageBase;
  2187. }();
  2188. exports.LuckyImageBase = LuckyImageBase;
  2189. },{}],11:[function(require,module,exports){
  2190. "use strict";
  2191. var __extends = void 0 && (void 0).__extends || function () {
  2192. var _extendStatics = function extendStatics(d, b) {
  2193. _extendStatics = Object.setPrototypeOf || {
  2194. __proto__: []
  2195. } instanceof Array && function (d, b) {
  2196. d.__proto__ = b;
  2197. } || function (d, b) {
  2198. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  2199. };
  2200. return _extendStatics(d, b);
  2201. };
  2202. return function (d, b) {
  2203. _extendStatics(d, b);
  2204. function __() {
  2205. this.constructor = d;
  2206. }
  2207. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  2208. };
  2209. }();
  2210. Object.defineProperty(exports, "__esModule", {
  2211. value: true
  2212. });
  2213. exports.LuckySheetCelldata = void 0;
  2214. var ReadXml_1 = require("./ReadXml");
  2215. var method_1 = require("../common/method");
  2216. var constant_1 = require("../common/constant");
  2217. var LuckyBase_1 = require("./LuckyBase");
  2218. var LuckySheetCelldata = /** @class */function (_super) {
  2219. __extends(LuckySheetCelldata, _super);
  2220. function LuckySheetCelldata(cell, styles, sharedStrings, mergeCells, sheetFile, ReadXml) {
  2221. var _this =
  2222. //Private
  2223. _super.call(this) || this;
  2224. _this.cell = cell;
  2225. _this.sheetFile = sheetFile;
  2226. _this.styles = styles;
  2227. _this.sharedStrings = sharedStrings;
  2228. _this.readXml = ReadXml;
  2229. _this.mergeCells = mergeCells;
  2230. var attrList = cell.attributeList;
  2231. var r = attrList.r,
  2232. s = attrList.s,
  2233. t = attrList.t;
  2234. var range = method_1.getcellrange(r);
  2235. _this.r = range.row[0];
  2236. _this.c = range.column[0];
  2237. _this.v = _this.generateValue(s, t);
  2238. return _this;
  2239. }
  2240. /**
  2241. * @param s Style index ,start 1
  2242. * @param t Cell type, Optional value is ST_CellType, it's found at constat.ts
  2243. */
  2244. LuckySheetCelldata.prototype.generateValue = function (s, t) {
  2245. var _this = this;
  2246. var v = this.cell.getInnerElements("v");
  2247. var f = this.cell.getInnerElements("f");
  2248. if (v == null) {
  2249. v = this.cell.getInnerElements("t");
  2250. }
  2251. var cellXfs = this.styles["cellXfs"];
  2252. var cellStyleXfs = this.styles["cellStyleXfs"];
  2253. var cellStyles = this.styles["cellStyles"];
  2254. var fonts = this.styles["fonts"];
  2255. var fills = this.styles["fills"];
  2256. var borders = this.styles["borders"];
  2257. var numfmts = this.styles["numfmts"];
  2258. var clrScheme = this.styles["clrScheme"];
  2259. var sharedStrings = this.sharedStrings;
  2260. var cellValue = new LuckyBase_1.LuckySheetCelldataValue();
  2261. if (f != null) {
  2262. var formula = f[0],
  2263. attrList = formula.attributeList;
  2264. var t_1 = attrList.t,
  2265. ref = attrList.ref,
  2266. si = attrList.si;
  2267. var formulaValue = f[0].value;
  2268. if (t_1 == "shared") {
  2269. this._fomulaRef = ref;
  2270. this._formulaType = t_1;
  2271. this._formulaSi = si;
  2272. }
  2273. // console.log(ref, t, si);
  2274. if (ref != null || formulaValue != null && formulaValue.length > 0) {
  2275. formulaValue = method_1.escapeCharacter(formulaValue);
  2276. cellValue.f = "=" + formulaValue;
  2277. }
  2278. }
  2279. var familyFont = null;
  2280. var quotePrefix;
  2281. if (s != null) {
  2282. var sNum = parseInt(s);
  2283. var cellXf = cellXfs[sNum];
  2284. var xfId = cellXf.attributeList.xfId;
  2285. var numFmtId = void 0,
  2286. fontId = void 0,
  2287. fillId = void 0,
  2288. borderId = void 0;
  2289. var horizontal = void 0,
  2290. vertical = void 0,
  2291. wrapText = void 0,
  2292. textRotation = void 0,
  2293. shrinkToFit = void 0,
  2294. indent = void 0,
  2295. applyProtection = void 0;
  2296. if (xfId != null) {
  2297. var cellStyleXf = cellStyleXfs[parseInt(xfId)];
  2298. var attrList = cellStyleXf.attributeList;
  2299. var applyNumberFormat_1 = attrList.applyNumberFormat;
  2300. var applyFont_1 = attrList.applyFont;
  2301. var applyFill_1 = attrList.applyFill;
  2302. var applyBorder_1 = attrList.applyBorder;
  2303. var applyAlignment_1 = attrList.applyAlignment;
  2304. // let applyProtection = attrList.applyProtection;
  2305. applyProtection = attrList.applyProtection;
  2306. quotePrefix = attrList.quotePrefix;
  2307. if (applyNumberFormat_1 != "0" && attrList.numFmtId != null) {
  2308. // if(attrList.numFmtId!="0"){
  2309. numFmtId = attrList.numFmtId;
  2310. // }
  2311. }
  2312. if (applyFont_1 != "0" && attrList.fontId != null) {
  2313. fontId = attrList.fontId;
  2314. }
  2315. if (applyFill_1 != "0" && attrList.fillId != null) {
  2316. fillId = attrList.fillId;
  2317. }
  2318. if (applyBorder_1 != "0" && attrList.borderId != null) {
  2319. borderId = attrList.borderId;
  2320. }
  2321. if (applyAlignment_1 != null && applyAlignment_1 != "0") {
  2322. var alignment = cellStyleXf.getInnerElements("alignment");
  2323. if (alignment != null) {
  2324. var attrList_1 = alignment[0].attributeList;
  2325. if (attrList_1.horizontal != null) {
  2326. horizontal = attrList_1.horizontal;
  2327. }
  2328. if (attrList_1.vertical != null) {
  2329. vertical = attrList_1.vertical;
  2330. }
  2331. if (attrList_1.wrapText != null) {
  2332. wrapText = attrList_1.wrapText;
  2333. }
  2334. if (attrList_1.textRotation != null) {
  2335. textRotation = attrList_1.textRotation;
  2336. }
  2337. if (attrList_1.shrinkToFit != null) {
  2338. shrinkToFit = attrList_1.shrinkToFit;
  2339. }
  2340. if (attrList_1.indent != null) {
  2341. indent = attrList_1.indent;
  2342. }
  2343. }
  2344. }
  2345. }
  2346. var applyNumberFormat = cellXf.attributeList.applyNumberFormat;
  2347. var applyFont = cellXf.attributeList.applyFont;
  2348. var applyFill = cellXf.attributeList.applyFill;
  2349. var applyBorder = cellXf.attributeList.applyBorder;
  2350. var applyAlignment = cellXf.attributeList.applyAlignment;
  2351. if (cellXf.attributeList.applyProtection != null) {
  2352. applyProtection = cellXf.attributeList.applyProtection;
  2353. }
  2354. if (cellXf.attributeList.quotePrefix != null) {
  2355. quotePrefix = cellXf.attributeList.quotePrefix;
  2356. }
  2357. if (applyNumberFormat != "0" && cellXf.attributeList.numFmtId != null) {
  2358. numFmtId = cellXf.attributeList.numFmtId;
  2359. }
  2360. if (applyFont != "0") {
  2361. fontId = cellXf.attributeList.fontId;
  2362. }
  2363. if (applyFill != "0") {
  2364. fillId = cellXf.attributeList.fillId;
  2365. }
  2366. if (applyBorder != "0") {
  2367. borderId = cellXf.attributeList.borderId;
  2368. }
  2369. if (applyAlignment != "0") {
  2370. var alignment = cellXf.getInnerElements("alignment");
  2371. if (alignment != null && alignment.length > 0) {
  2372. var attrList = alignment[0].attributeList;
  2373. if (attrList.horizontal != null) {
  2374. horizontal = attrList.horizontal;
  2375. }
  2376. if (attrList.vertical != null) {
  2377. vertical = attrList.vertical;
  2378. }
  2379. if (attrList.wrapText != null) {
  2380. wrapText = attrList.wrapText;
  2381. }
  2382. if (attrList.textRotation != null) {
  2383. textRotation = attrList.textRotation;
  2384. }
  2385. if (attrList.shrinkToFit != null) {
  2386. shrinkToFit = attrList.shrinkToFit;
  2387. }
  2388. if (attrList.indent != null) {
  2389. indent = attrList.indent;
  2390. }
  2391. }
  2392. }
  2393. if (numFmtId != undefined) {
  2394. var numf = numfmts[parseInt(numFmtId)];
  2395. var cellFormat = new LuckyBase_1.LuckySheetCellFormat();
  2396. cellFormat.fa = method_1.escapeCharacter(numf);
  2397. // console.log(numf, numFmtId, this.v);
  2398. cellFormat.t = t || 'd';
  2399. cellValue.ct = cellFormat;
  2400. }
  2401. if (fillId != undefined) {
  2402. var fillIdNum = parseInt(fillId);
  2403. var fill = fills[fillIdNum];
  2404. // console.log(cellValue.v);
  2405. var bg = this.getBackgroundByFill(fill, clrScheme);
  2406. if (bg != null) {
  2407. cellValue.bg = bg;
  2408. }
  2409. }
  2410. if (fontId != undefined) {
  2411. var fontIdNum = parseInt(fontId);
  2412. var font = fonts[fontIdNum];
  2413. if (font != null) {
  2414. var sz = font.getInnerElements("sz"); //font size
  2415. var colors = font.getInnerElements("color"); //font color
  2416. var family = font.getInnerElements("name"); //font family
  2417. var familyOverrides = font.getInnerElements("family"); //font family will be overrided by name
  2418. var charset = font.getInnerElements("charset"); //font charset
  2419. var bolds = font.getInnerElements("b"); //font bold
  2420. var italics = font.getInnerElements("i"); //font italic
  2421. var strikes = font.getInnerElements("strike"); //font italic
  2422. var underlines = font.getInnerElements("u"); //font italic
  2423. if (sz != null && sz.length > 0) {
  2424. var fs = sz[0].attributeList.val;
  2425. if (fs != null) {
  2426. cellValue.fs = parseInt(fs);
  2427. }
  2428. }
  2429. if (colors != null && colors.length > 0) {
  2430. var color = colors[0];
  2431. var fc = ReadXml_1.getColor(color, this.styles, "t");
  2432. if (fc != null) {
  2433. cellValue.fc = fc;
  2434. }
  2435. }
  2436. if (familyOverrides != null && familyOverrides.length > 0) {
  2437. var val = familyOverrides[0].attributeList.val;
  2438. if (val != null) {
  2439. familyFont = constant_1.fontFamilys[val];
  2440. }
  2441. }
  2442. if (family != null && family.length > 0) {
  2443. var val = family[0].attributeList.val;
  2444. if (val != null) {
  2445. cellValue.ff = val;
  2446. }
  2447. }
  2448. if (bolds != null && bolds.length > 0) {
  2449. var bold = bolds[0].attributeList.val;
  2450. if (bold == "0") {
  2451. cellValue.bl = 0;
  2452. } else {
  2453. cellValue.bl = 1;
  2454. }
  2455. }
  2456. if (italics != null && italics.length > 0) {
  2457. var italic = italics[0].attributeList.val;
  2458. if (italic == "0") {
  2459. cellValue.it = 0;
  2460. } else {
  2461. cellValue.it = 1;
  2462. }
  2463. }
  2464. if (strikes != null && strikes.length > 0) {
  2465. var strike = strikes[0].attributeList.val;
  2466. if (strike == "0") {
  2467. cellValue.cl = 0;
  2468. } else {
  2469. cellValue.cl = 1;
  2470. }
  2471. }
  2472. if (underlines != null && underlines.length > 0) {
  2473. var underline = underlines[0].attributeList.val;
  2474. if (underline == "single") {
  2475. cellValue.un = 1;
  2476. } else if (underline == "double") {
  2477. cellValue.un = 2;
  2478. } else if (underline == "singleAccounting") {
  2479. cellValue.un = 3;
  2480. } else if (underline == "doubleAccounting") {
  2481. cellValue.un = 4;
  2482. } else {
  2483. cellValue.un = 0;
  2484. }
  2485. }
  2486. }
  2487. }
  2488. // vt: number | undefined//Vertical alignment, 0 middle, 1 up, 2 down, alignment
  2489. // ht: number | undefined//Horizontal alignment,0 center, 1 left, 2 right, alignment
  2490. // tr: number | undefined //Text rotation,0: 0、1: 45 、2: -45、3 Vertical text、4: 90 、5: -90, alignment
  2491. // tb: number | undefined //Text wrap,0 truncation, 1 overflow, 2 word wrap, alignment
  2492. if (horizontal != undefined) {
  2493. //Horizontal alignment
  2494. if (horizontal == "center") {
  2495. cellValue.ht = 0;
  2496. } else if (horizontal == "centerContinuous") {
  2497. cellValue.ht = 0; //luckysheet unsupport
  2498. } else if (horizontal == "left") {
  2499. cellValue.ht = 1;
  2500. } else if (horizontal == "right") {
  2501. cellValue.ht = 2;
  2502. } else if (horizontal == "distributed") {
  2503. cellValue.ht = 0; //luckysheet unsupport
  2504. } else if (horizontal == "fill") {
  2505. cellValue.ht = 1; //luckysheet unsupport
  2506. } else if (horizontal == "general") {
  2507. cellValue.ht = 1; //luckysheet unsupport
  2508. } else if (horizontal == "justify") {
  2509. cellValue.ht = 0; //luckysheet unsupport
  2510. } else {
  2511. cellValue.ht = 1;
  2512. }
  2513. }
  2514. if (vertical != undefined) {
  2515. //Vertical alignment
  2516. if (vertical == "bottom") {
  2517. cellValue.vt = 2;
  2518. } else if (vertical == "center") {
  2519. cellValue.vt = 0;
  2520. } else if (vertical == "distributed") {
  2521. cellValue.vt = 0; //luckysheet unsupport
  2522. } else if (vertical == "justify") {
  2523. cellValue.vt = 0; //luckysheet unsupport
  2524. } else if (vertical == "top") {
  2525. cellValue.vt = 1;
  2526. } else {
  2527. cellValue.vt = 1;
  2528. }
  2529. } else {
  2530. //sometimes bottom style is lost after setting it in excel
  2531. //when vertical is undefined set it to 2.
  2532. cellValue.vt = 2;
  2533. }
  2534. if (wrapText != undefined) {
  2535. if (wrapText == "1") {
  2536. cellValue.tb = 2;
  2537. } else {
  2538. cellValue.tb = 1;
  2539. }
  2540. } else {
  2541. cellValue.tb = 1;
  2542. }
  2543. if (textRotation != undefined) {
  2544. // tr: number | undefined //Text rotation,0: 0、1: 45 、2: -45、3 Vertical text、4: 90 、5: -90, alignment
  2545. if (textRotation == "255") {
  2546. cellValue.tr = 3;
  2547. }
  2548. // else if(textRotation=="45"){
  2549. // cellValue.tr = 1;
  2550. // }
  2551. // else if(textRotation=="90"){
  2552. // cellValue.tr = 4;
  2553. // }
  2554. // else if(textRotation=="135"){
  2555. // cellValue.tr = 2;
  2556. // }
  2557. // else if(textRotation=="180"){
  2558. // cellValue.tr = 5;
  2559. // }
  2560. else {
  2561. cellValue.tr = 0;
  2562. cellValue.rt = parseInt(textRotation);
  2563. }
  2564. }
  2565. if (shrinkToFit != undefined) {//luckysheet unsupport
  2566. }
  2567. if (indent != undefined) {//luckysheet unsupport
  2568. }
  2569. if (borderId != undefined) {
  2570. var borderIdNum = parseInt(borderId);
  2571. var border = borders[borderIdNum];
  2572. // this._borderId = borderIdNum;
  2573. var borderObject = new LuckyBase_1.LuckySheetborderInfoCellForImp();
  2574. borderObject.rangeType = "cell";
  2575. // borderObject.cells = [];
  2576. var borderCellValue = new LuckyBase_1.LuckySheetborderInfoCellValue();
  2577. borderCellValue.row_index = this.r;
  2578. borderCellValue.col_index = this.c;
  2579. var lefts = border.getInnerElements("left");
  2580. var rights = border.getInnerElements("right");
  2581. var tops = border.getInnerElements("top");
  2582. var bottoms = border.getInnerElements("bottom");
  2583. var diagonals = border.getInnerElements("diagonal");
  2584. var starts = border.getInnerElements("start");
  2585. var ends = border.getInnerElements("end");
  2586. var left = this.getBorderInfo(lefts);
  2587. var right = this.getBorderInfo(rights);
  2588. var top_1 = this.getBorderInfo(tops);
  2589. var bottom = this.getBorderInfo(bottoms);
  2590. var diagonal = this.getBorderInfo(diagonals);
  2591. var start = this.getBorderInfo(starts);
  2592. var end = this.getBorderInfo(ends);
  2593. var isAdd = false;
  2594. if (start != null && start.color != null) {
  2595. borderCellValue.l = start;
  2596. isAdd = true;
  2597. }
  2598. if (end != null && end.color != null) {
  2599. borderCellValue.r = end;
  2600. isAdd = true;
  2601. }
  2602. if (left != null && left.color != null) {
  2603. borderCellValue.l = left;
  2604. isAdd = true;
  2605. }
  2606. if (right != null && right.color != null) {
  2607. borderCellValue.r = right;
  2608. isAdd = true;
  2609. }
  2610. if (top_1 != null && top_1.color != null) {
  2611. borderCellValue.t = top_1;
  2612. isAdd = true;
  2613. }
  2614. if (bottom != null && bottom.color != null) {
  2615. borderCellValue.b = bottom;
  2616. isAdd = true;
  2617. }
  2618. if (isAdd) {
  2619. borderObject.value = borderCellValue;
  2620. // this.config._borderInfo[borderId] = borderObject;
  2621. this._borderObject = borderObject;
  2622. }
  2623. }
  2624. } else {
  2625. cellValue.tb = 1;
  2626. }
  2627. if (v != null) {
  2628. var value = v[0].value;
  2629. if (/&#\d+;/.test(value)) {
  2630. value = this.htmlDecode(value);
  2631. }
  2632. if (t == constant_1.ST_CellType["SharedString"]) {
  2633. var siIndex = parseInt(v[0].value);
  2634. var sharedSI = sharedStrings[siIndex];
  2635. var rFlag = sharedSI.getInnerElements("r");
  2636. if (rFlag == null) {
  2637. var tFlag = sharedSI.getInnerElements("t");
  2638. if (tFlag != null) {
  2639. var text_1 = "";
  2640. tFlag.forEach(function (t) {
  2641. text_1 += t.value;
  2642. });
  2643. text_1 = method_1.escapeCharacter(text_1);
  2644. //isContainMultiType(text) &&
  2645. if (familyFont == "Roman" && text_1.length > 0) {
  2646. var textArray = text_1.split("");
  2647. var preWordType = null,
  2648. wordText = "",
  2649. preWholef = null;
  2650. var wholef = "Times New Roman";
  2651. if (cellValue.ff != null) {
  2652. wholef = cellValue.ff;
  2653. }
  2654. var cellFormat = cellValue.ct;
  2655. if (cellFormat == null) {
  2656. cellFormat = new LuckyBase_1.LuckySheetCellFormat();
  2657. }
  2658. if (cellFormat.s == null) {
  2659. cellFormat.s = [];
  2660. }
  2661. for (var i = 0; i < textArray.length; i++) {
  2662. var w = textArray[i];
  2663. var type = null,
  2664. ff = wholef;
  2665. if (method_1.isChinese(w)) {
  2666. type = "c";
  2667. ff = "宋体";
  2668. } else if (method_1.isJapanese(w)) {
  2669. type = "j";
  2670. ff = "Yu Gothic";
  2671. } else if (method_1.isKoera(w)) {
  2672. type = "k";
  2673. ff = "Malgun Gothic";
  2674. } else {
  2675. type = "e";
  2676. }
  2677. if (type != preWordType && preWordType != null || i == textArray.length - 1) {
  2678. var InlineString = new LuckyBase_1.LuckyInlineString();
  2679. InlineString.ff = preWholef;
  2680. if (cellValue.fc != null) {
  2681. InlineString.fc = cellValue.fc;
  2682. }
  2683. if (cellValue.fs != null) {
  2684. InlineString.fs = cellValue.fs;
  2685. }
  2686. if (cellValue.cl != null) {
  2687. InlineString.cl = cellValue.cl;
  2688. }
  2689. if (cellValue.un != null) {
  2690. InlineString.un = cellValue.un;
  2691. }
  2692. if (cellValue.bl != null) {
  2693. InlineString.bl = cellValue.bl;
  2694. }
  2695. if (cellValue.it != null) {
  2696. InlineString.it = cellValue.it;
  2697. }
  2698. if (i == textArray.length - 1) {
  2699. if (type == preWordType) {
  2700. InlineString.ff = ff;
  2701. InlineString.v = wordText + w;
  2702. } else {
  2703. InlineString.ff = preWholef;
  2704. InlineString.v = wordText;
  2705. cellFormat.s.push(InlineString);
  2706. var InlineStringLast = new LuckyBase_1.LuckyInlineString();
  2707. InlineStringLast.ff = ff;
  2708. InlineStringLast.v = w;
  2709. if (cellValue.fc != null) {
  2710. InlineStringLast.fc = cellValue.fc;
  2711. }
  2712. if (cellValue.fs != null) {
  2713. InlineStringLast.fs = cellValue.fs;
  2714. }
  2715. if (cellValue.cl != null) {
  2716. InlineStringLast.cl = cellValue.cl;
  2717. }
  2718. if (cellValue.un != null) {
  2719. InlineStringLast.un = cellValue.un;
  2720. }
  2721. if (cellValue.bl != null) {
  2722. InlineStringLast.bl = cellValue.bl;
  2723. }
  2724. if (cellValue.it != null) {
  2725. InlineStringLast.it = cellValue.it;
  2726. }
  2727. cellFormat.s.push(InlineStringLast);
  2728. break;
  2729. }
  2730. } else {
  2731. InlineString.v = wordText;
  2732. }
  2733. cellFormat.s.push(InlineString);
  2734. wordText = w;
  2735. } else {
  2736. wordText += w;
  2737. }
  2738. preWordType = type;
  2739. preWholef = ff;
  2740. }
  2741. cellFormat.t = "inlineStr";
  2742. // cellFormat.s = [InlineString];
  2743. cellValue.ct = cellFormat;
  2744. // console.log(cellValue);
  2745. } else {
  2746. text_1 = this.replaceSpecialWrap(text_1);
  2747. if (text_1.indexOf("\r\n") > -1 || text_1.indexOf("\n") > -1) {
  2748. var InlineString = new LuckyBase_1.LuckyInlineString();
  2749. InlineString.v = text_1;
  2750. var cellFormat = cellValue.ct;
  2751. if (cellFormat == null) {
  2752. cellFormat = new LuckyBase_1.LuckySheetCellFormat();
  2753. }
  2754. if (cellValue.ff != null) {
  2755. InlineString.ff = cellValue.ff;
  2756. }
  2757. if (cellValue.fc != null) {
  2758. InlineString.fc = cellValue.fc;
  2759. }
  2760. if (cellValue.fs != null) {
  2761. InlineString.fs = cellValue.fs;
  2762. }
  2763. if (cellValue.cl != null) {
  2764. InlineString.cl = cellValue.cl;
  2765. }
  2766. if (cellValue.un != null) {
  2767. InlineString.un = cellValue.un;
  2768. }
  2769. if (cellValue.bl != null) {
  2770. InlineString.bl = cellValue.bl;
  2771. }
  2772. if (cellValue.it != null) {
  2773. InlineString.it = cellValue.it;
  2774. }
  2775. cellFormat.t = "inlineStr";
  2776. cellFormat.s = [InlineString];
  2777. cellValue.ct = cellFormat;
  2778. } else {
  2779. cellValue.v = text_1;
  2780. quotePrefix = "1";
  2781. }
  2782. }
  2783. }
  2784. } else {
  2785. var styles_1 = [];
  2786. rFlag.forEach(function (r) {
  2787. var tFlag = r.getInnerElements("t");
  2788. var rPr = r.getInnerElements("rPr");
  2789. var InlineString = new LuckyBase_1.LuckyInlineString();
  2790. if (tFlag != null && tFlag.length > 0) {
  2791. var text = tFlag[0].value;
  2792. text = _this.replaceSpecialWrap(text);
  2793. text = method_1.escapeCharacter(text);
  2794. InlineString.v = text;
  2795. }
  2796. if (rPr != null && rPr.length > 0) {
  2797. var frpr = rPr[0];
  2798. var sz = ReadXml_1.getlineStringAttr(frpr, "sz"),
  2799. rFont = ReadXml_1.getlineStringAttr(frpr, "rFont"),
  2800. family = ReadXml_1.getlineStringAttr(frpr, "family"),
  2801. charset = ReadXml_1.getlineStringAttr(frpr, "charset"),
  2802. scheme = ReadXml_1.getlineStringAttr(frpr, "scheme"),
  2803. b = ReadXml_1.getlineStringAttr(frpr, "b"),
  2804. i = ReadXml_1.getlineStringAttr(frpr, "i"),
  2805. u = ReadXml_1.getlineStringAttr(frpr, "u"),
  2806. strike = ReadXml_1.getlineStringAttr(frpr, "strike"),
  2807. vertAlign = ReadXml_1.getlineStringAttr(frpr, "vertAlign"),
  2808. color = void 0;
  2809. var cEle = frpr.getInnerElements("color");
  2810. if (cEle != null && cEle.length > 0) {
  2811. color = ReadXml_1.getColor(cEle[0], _this.styles, "t");
  2812. }
  2813. var ff = void 0;
  2814. // if(family!=null){
  2815. // ff = fontFamilys[family];
  2816. // }
  2817. if (rFont != null) {
  2818. ff = rFont;
  2819. }
  2820. if (ff != null) {
  2821. InlineString.ff = ff;
  2822. } else if (cellValue.ff != null) {
  2823. InlineString.ff = cellValue.ff;
  2824. }
  2825. if (color != null) {
  2826. InlineString.fc = color;
  2827. } else if (cellValue.fc != null) {
  2828. InlineString.fc = cellValue.fc;
  2829. }
  2830. if (sz != null) {
  2831. InlineString.fs = parseInt(sz);
  2832. } else if (cellValue.fs != null) {
  2833. InlineString.fs = cellValue.fs;
  2834. }
  2835. if (strike != null) {
  2836. InlineString.cl = parseInt(strike);
  2837. } else if (cellValue.cl != null) {
  2838. InlineString.cl = cellValue.cl;
  2839. }
  2840. if (u != null) {
  2841. InlineString.un = parseInt(u);
  2842. } else if (cellValue.un != null) {
  2843. InlineString.un = cellValue.un;
  2844. }
  2845. if (b != null) {
  2846. InlineString.bl = parseInt(b);
  2847. } else if (cellValue.bl != null) {
  2848. InlineString.bl = cellValue.bl;
  2849. }
  2850. if (i != null) {
  2851. InlineString.it = parseInt(i);
  2852. } else if (cellValue.it != null) {
  2853. InlineString.it = cellValue.it;
  2854. }
  2855. if (vertAlign != null) {
  2856. InlineString.va = parseInt(vertAlign);
  2857. }
  2858. // ff:string | undefined //font family
  2859. // fc:string | undefined//font color
  2860. // fs:number | undefined//font size
  2861. // cl:number | undefined//strike
  2862. // un:number | undefined//underline
  2863. // bl:number | undefined//blod
  2864. // it:number | undefined//italic
  2865. // v:string | undefined
  2866. } else {
  2867. if (InlineString.ff == null && cellValue.ff != null) {
  2868. InlineString.ff = cellValue.ff;
  2869. }
  2870. if (InlineString.fc == null && cellValue.fc != null) {
  2871. InlineString.fc = cellValue.fc;
  2872. }
  2873. if (InlineString.fs == null && cellValue.fs != null) {
  2874. InlineString.fs = cellValue.fs;
  2875. }
  2876. if (InlineString.cl == null && cellValue.cl != null) {
  2877. InlineString.cl = cellValue.cl;
  2878. }
  2879. if (InlineString.un == null && cellValue.un != null) {
  2880. InlineString.un = cellValue.un;
  2881. }
  2882. if (InlineString.bl == null && cellValue.bl != null) {
  2883. InlineString.bl = cellValue.bl;
  2884. }
  2885. if (InlineString.it == null && cellValue.it != null) {
  2886. InlineString.it = cellValue.it;
  2887. }
  2888. }
  2889. styles_1.push(InlineString);
  2890. });
  2891. var cellFormat = cellValue.ct;
  2892. if (cellFormat == null) {
  2893. cellFormat = new LuckyBase_1.LuckySheetCellFormat();
  2894. }
  2895. cellFormat.t = "inlineStr";
  2896. cellFormat.s = styles_1;
  2897. cellValue.ct = cellFormat;
  2898. }
  2899. }
  2900. // to be confirmed
  2901. else if (t == constant_1.ST_CellType["InlineString"] && v != null) {
  2902. cellValue.v = "'" + value;
  2903. } else {
  2904. value = method_1.escapeCharacter(value);
  2905. cellValue.v = value;
  2906. }
  2907. }
  2908. if (quotePrefix != null) {
  2909. cellValue.qp = parseInt(quotePrefix);
  2910. }
  2911. return cellValue;
  2912. };
  2913. LuckySheetCelldata.prototype.replaceSpecialWrap = function (text) {
  2914. text = text.replace(/_x000D_/g, "").replace(/&#13;&#10;/g, "\r\n").replace(/&#13;/g, "\r").replace(/&#10;/g, "\n");
  2915. return text;
  2916. };
  2917. LuckySheetCelldata.prototype.getBackgroundByFill = function (fill, clrScheme) {
  2918. var patternFills = fill.getInnerElements("patternFill");
  2919. if (patternFills != null) {
  2920. var patternFill = patternFills[0];
  2921. var fgColors = patternFill.getInnerElements("fgColor");
  2922. var bgColors = patternFill.getInnerElements("bgColor");
  2923. var fg = void 0,
  2924. bg = void 0;
  2925. if (fgColors != null) {
  2926. var fgColor = fgColors[0];
  2927. fg = ReadXml_1.getColor(fgColor, this.styles);
  2928. }
  2929. if (bgColors != null) {
  2930. var bgColor = bgColors[0];
  2931. bg = ReadXml_1.getColor(bgColor, this.styles);
  2932. }
  2933. // console.log(fgColors,bgColors,clrScheme);
  2934. if (fg != null) {
  2935. return fg;
  2936. } else if (bg != null) {
  2937. return bg;
  2938. }
  2939. } else {
  2940. var gradientfills = fill.getInnerElements("gradientFill");
  2941. if (gradientfills != null) {
  2942. //graient color fill handler
  2943. return null;
  2944. }
  2945. }
  2946. };
  2947. LuckySheetCelldata.prototype.getBorderInfo = function (borders) {
  2948. if (borders == null) {
  2949. return null;
  2950. }
  2951. var border = borders[0],
  2952. attrList = border.attributeList;
  2953. var clrScheme = this.styles["clrScheme"];
  2954. var style = attrList.style;
  2955. if (style == null || style == "none") {
  2956. return null;
  2957. }
  2958. var colors = border.getInnerElements("color");
  2959. var colorRet = "#000000";
  2960. if (colors != null) {
  2961. var color = colors[0];
  2962. colorRet = ReadXml_1.getColor(color, this.styles, "b");
  2963. if (colorRet == null) {
  2964. colorRet = "#000000";
  2965. }
  2966. }
  2967. var ret = new LuckyBase_1.LuckySheetborderInfoCellValueStyle();
  2968. ret.style = constant_1.borderTypes[style];
  2969. ret.color = colorRet;
  2970. return ret;
  2971. };
  2972. LuckySheetCelldata.prototype.htmlDecode = function (str) {
  2973. return str.replace(/&#(x)?([^&]{1,5});/g, function ($, $1, $2) {
  2974. return String.fromCharCode(parseInt($2, $1 ? 16 : 10));
  2975. });
  2976. };
  2977. ;
  2978. return LuckySheetCelldata;
  2979. }(LuckyBase_1.LuckySheetCelldataBase);
  2980. exports.LuckySheetCelldata = LuckySheetCelldata;
  2981. },{"../common/constant":16,"../common/method":18,"./LuckyBase":10,"./ReadXml":15}],12:[function(require,module,exports){
  2982. "use strict";
  2983. var __extends = void 0 && (void 0).__extends || function () {
  2984. var _extendStatics = function extendStatics(d, b) {
  2985. _extendStatics = Object.setPrototypeOf || {
  2986. __proto__: []
  2987. } instanceof Array && function (d, b) {
  2988. d.__proto__ = b;
  2989. } || function (d, b) {
  2990. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  2991. };
  2992. return _extendStatics(d, b);
  2993. };
  2994. return function (d, b) {
  2995. _extendStatics(d, b);
  2996. function __() {
  2997. this.constructor = d;
  2998. }
  2999. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3000. };
  3001. }();
  3002. Object.defineProperty(exports, "__esModule", {
  3003. value: true
  3004. });
  3005. exports.LuckyFile = void 0;
  3006. var LuckySheet_1 = require("./LuckySheet");
  3007. var constant_1 = require("../common/constant");
  3008. var ReadXml_1 = require("./ReadXml");
  3009. var method_1 = require("../common/method");
  3010. var LuckyBase_1 = require("./LuckyBase");
  3011. var LuckyImage_1 = require("./LuckyImage");
  3012. var LuckyFile = /** @class */function (_super) {
  3013. __extends(LuckyFile, _super);
  3014. function LuckyFile(files, fileName, dataVerificationSelectCount) {
  3015. var _this = _super.call(this) || this;
  3016. _this.columnWidthSet = [];
  3017. _this.rowHeightSet = [];
  3018. _this.files = files;
  3019. _this.fileName = fileName;
  3020. _this.dataVerificationSelectCount = dataVerificationSelectCount;
  3021. _this.readXml = new ReadXml_1.ReadXml(files);
  3022. _this.getSheetNameList();
  3023. _this.sharedStrings = _this.readXml.getElementsByTagName("sst/si", constant_1.sharedStringsFile);
  3024. _this.calcChain = _this.readXml.getElementsByTagName("calcChain/c", constant_1.calcChainFile);
  3025. _this.styles = {};
  3026. _this.styles["cellXfs"] = _this.readXml.getElementsByTagName("cellXfs/xf", constant_1.stylesFile);
  3027. _this.styles["cellStyleXfs"] = _this.readXml.getElementsByTagName("cellStyleXfs/xf", constant_1.stylesFile);
  3028. _this.styles["cellStyles"] = _this.readXml.getElementsByTagName("cellStyles/cellStyle", constant_1.stylesFile);
  3029. _this.styles["fonts"] = _this.readXml.getElementsByTagName("fonts/font", constant_1.stylesFile);
  3030. _this.styles["fills"] = _this.readXml.getElementsByTagName("fills/fill", constant_1.stylesFile);
  3031. _this.styles["borders"] = _this.readXml.getElementsByTagName("borders/border", constant_1.stylesFile);
  3032. _this.styles["clrScheme"] = _this.readXml.getElementsByTagName("a:clrScheme/a:dk1|a:lt1|a:dk2|a:lt2|a:accent1|a:accent2|a:accent3|a:accent4|a:accent5|a:accent6|a:hlink|a:folHlink", constant_1.theme1File);
  3033. _this.styles["indexedColors"] = _this.readXml.getElementsByTagName("colors/indexedColors/rgbColor", constant_1.stylesFile);
  3034. _this.styles["mruColors"] = _this.readXml.getElementsByTagName("colors/mruColors/color", constant_1.stylesFile);
  3035. _this.imageList = new LuckyImage_1.ImageList(files);
  3036. var numfmts = _this.readXml.getElementsByTagName("numFmt/numFmt", constant_1.stylesFile);
  3037. var numFmtDefaultC = JSON.parse(JSON.stringify(constant_1.numFmtDefault));
  3038. for (var i = 0; i < numfmts.length; i++) {
  3039. var attrList = numfmts[i].attributeList;
  3040. var numfmtid = method_1.getXmlAttibute(attrList, "numFmtId", "49");
  3041. var formatcode = method_1.getXmlAttibute(attrList, "formatCode", "@");
  3042. // console.log(numfmtid, formatcode);
  3043. if (!(numfmtid in constant_1.numFmtDefault)) {
  3044. numFmtDefaultC[numfmtid] = constant_1.numFmtDefaultMap[formatcode] || formatcode;
  3045. }
  3046. }
  3047. // console.log(JSON.stringify(numFmtDefaultC), numfmts);
  3048. _this.styles["numfmts"] = numFmtDefaultC;
  3049. return _this;
  3050. }
  3051. /**
  3052. * @return All sheet name of workbook
  3053. */
  3054. LuckyFile.prototype.getSheetNameList = function () {
  3055. var workbookRelList = this.readXml.getElementsByTagName("Relationships/Relationship", constant_1.workbookRels);
  3056. if (workbookRelList == null) {
  3057. return;
  3058. }
  3059. var regex = new RegExp("worksheets/[^/]*?.xml");
  3060. var sheetNames = {};
  3061. for (var i = 0; i < workbookRelList.length; i++) {
  3062. var rel = workbookRelList[i],
  3063. attrList = rel.attributeList;
  3064. var id = attrList["Id"],
  3065. target = attrList["Target"];
  3066. if (regex.test(target)) {
  3067. if (target.indexOf('/xl') === 0) {
  3068. sheetNames[id] = target.substr(1);
  3069. } else {
  3070. sheetNames[id] = "xl/" + target;
  3071. }
  3072. }
  3073. }
  3074. this.sheetNameList = sheetNames;
  3075. };
  3076. /**
  3077. * @param sheetName WorkSheet'name
  3078. * @return sheet file name and path in zip
  3079. */
  3080. LuckyFile.prototype.getSheetFileBysheetId = function (sheetId) {
  3081. // for(let i=0;i<this.sheetNameList.length;i++){
  3082. // let sheetFileName = this.sheetNameList[i];
  3083. // if(sheetFileName.indexOf("sheet"+sheetId)>-1){
  3084. // return sheetFileName;
  3085. // }
  3086. // }
  3087. return this.sheetNameList[sheetId];
  3088. };
  3089. /**
  3090. * @return workBook information
  3091. */
  3092. LuckyFile.prototype.getWorkBookInfo = function () {
  3093. var Company = this.readXml.getElementsByTagName("Company", constant_1.appFile);
  3094. var AppVersion = this.readXml.getElementsByTagName("AppVersion", constant_1.appFile);
  3095. var creator = this.readXml.getElementsByTagName("dc:creator", constant_1.coreFile);
  3096. var lastModifiedBy = this.readXml.getElementsByTagName("cp:lastModifiedBy", constant_1.coreFile);
  3097. var created = this.readXml.getElementsByTagName("dcterms:created", constant_1.coreFile);
  3098. var modified = this.readXml.getElementsByTagName("dcterms:modified", constant_1.coreFile);
  3099. this.info = new LuckyBase_1.LuckyFileInfo();
  3100. this.info.name = this.fileName;
  3101. this.info.creator = creator.length > 0 ? creator[0].value : "";
  3102. this.info.lastmodifiedby = lastModifiedBy.length > 0 ? lastModifiedBy[0].value : "";
  3103. this.info.createdTime = created.length > 0 ? created[0].value : "";
  3104. this.info.modifiedTime = modified.length > 0 ? modified[0].value : "";
  3105. this.info.company = Company.length > 0 ? Company[0].value : "";
  3106. this.info.appversion = AppVersion.length > 0 ? AppVersion[0].value : "";
  3107. };
  3108. /**
  3109. * @return All sheet , include whole information
  3110. */
  3111. LuckyFile.prototype.getSheetsFull = function (isInitialCell) {
  3112. if (isInitialCell === void 0) {
  3113. isInitialCell = true;
  3114. }
  3115. var sheets = this.readXml.getElementsByTagName("sheets/sheet", constant_1.workBookFile);
  3116. var sheetList = {};
  3117. for (var key in sheets) {
  3118. var sheet = sheets[key];
  3119. sheetList[sheet.attributeList.name] = sheet.attributeList["sheetId"];
  3120. }
  3121. this.sheets = [];
  3122. var order = 0;
  3123. for (var key in sheets) {
  3124. var sheet = sheets[key];
  3125. var sheetName = sheet.attributeList.name;
  3126. var sheetId = sheet.attributeList["sheetId"];
  3127. var rid = sheet.attributeList["r:id"];
  3128. var sheetFile = this.getSheetFileBysheetId(rid);
  3129. var hide = sheet.attributeList.state === "hidden" ? 1 : 0;
  3130. var drawing = this.readXml.getElementsByTagName("worksheet/drawing", sheetFile),
  3131. drawingFile = void 0,
  3132. drawingRelsFile = void 0;
  3133. if (drawing != null && drawing.length > 0) {
  3134. var attrList = drawing[0].attributeList;
  3135. var rid_1 = method_1.getXmlAttibute(attrList, "r:id", null);
  3136. if (rid_1 != null) {
  3137. drawingFile = this.getDrawingFile(rid_1, sheetFile);
  3138. drawingRelsFile = this.getDrawingRelsFile(drawingFile);
  3139. }
  3140. }
  3141. if (sheetFile != null) {
  3142. var sheet_1 = new LuckySheet_1.LuckySheet(sheetName, sheetId, order, isInitialCell, {
  3143. sheetFile: sheetFile,
  3144. readXml: this.readXml,
  3145. sheetList: sheetList,
  3146. styles: this.styles,
  3147. sharedStrings: this.sharedStrings,
  3148. calcChain: this.calcChain,
  3149. imageList: this.imageList,
  3150. drawingFile: drawingFile,
  3151. drawingRelsFile: drawingRelsFile,
  3152. hide: hide,
  3153. dataVerificationSelectCount: this.dataVerificationSelectCount
  3154. });
  3155. this.columnWidthSet = [];
  3156. this.rowHeightSet = [];
  3157. this.imagePositionCaculation(sheet_1);
  3158. this.sheets.push(sheet_1);
  3159. order++;
  3160. }
  3161. }
  3162. };
  3163. LuckyFile.prototype.extendArray = function (index, sets, def, hidden, lens) {
  3164. if (index < sets.length) {
  3165. return;
  3166. }
  3167. var startIndex = sets.length,
  3168. endIndex = index;
  3169. var allGap = 0;
  3170. if (startIndex > 0) {
  3171. allGap = sets[startIndex - 1];
  3172. }
  3173. // else{
  3174. // sets.push(0);
  3175. // }
  3176. for (var i = startIndex; i <= endIndex; i++) {
  3177. var gap = def,
  3178. istring = i.toString();
  3179. if (istring in hidden) {
  3180. gap = 0;
  3181. } else if (istring in lens) {
  3182. gap = lens[istring];
  3183. }
  3184. allGap += Math.round(gap + 1);
  3185. sets.push(allGap);
  3186. }
  3187. };
  3188. LuckyFile.prototype.imagePositionCaculation = function (sheet) {
  3189. var images = sheet.images,
  3190. defaultColWidth = sheet.defaultColWidth,
  3191. defaultRowHeight = sheet.defaultRowHeight;
  3192. var colhidden = {};
  3193. if (sheet.config.colhidden) {
  3194. colhidden = sheet.config.colhidden;
  3195. }
  3196. var columnlen = {};
  3197. if (sheet.config.columnlen) {
  3198. columnlen = sheet.config.columnlen;
  3199. }
  3200. var rowhidden = {};
  3201. if (sheet.config.rowhidden) {
  3202. rowhidden = sheet.config.rowhidden;
  3203. }
  3204. var rowlen = {};
  3205. if (sheet.config.rowlen) {
  3206. rowlen = sheet.config.rowlen;
  3207. }
  3208. for (var key in images) {
  3209. var imageObject = images[key]; //Image, luckyImage
  3210. var fromCol = imageObject.fromCol;
  3211. var fromColOff = imageObject.fromColOff;
  3212. var fromRow = imageObject.fromRow;
  3213. var fromRowOff = imageObject.fromRowOff;
  3214. var toCol = imageObject.toCol;
  3215. var toColOff = imageObject.toColOff;
  3216. var toRow = imageObject.toRow;
  3217. var toRowOff = imageObject.toRowOff;
  3218. var x_n = 0,
  3219. y_n = 0;
  3220. var cx_n = 0,
  3221. cy_n = 0;
  3222. if (fromCol >= this.columnWidthSet.length) {
  3223. this.extendArray(fromCol, this.columnWidthSet, defaultColWidth, colhidden, columnlen);
  3224. }
  3225. if (fromCol == 0) {
  3226. x_n = 0;
  3227. } else {
  3228. x_n = this.columnWidthSet[fromCol - 1];
  3229. }
  3230. x_n = x_n + fromColOff;
  3231. if (fromRow >= this.rowHeightSet.length) {
  3232. this.extendArray(fromRow, this.rowHeightSet, defaultRowHeight, rowhidden, rowlen);
  3233. }
  3234. if (fromRow == 0) {
  3235. y_n = 0;
  3236. } else {
  3237. y_n = this.rowHeightSet[fromRow - 1];
  3238. }
  3239. y_n = y_n + fromRowOff;
  3240. if (toCol >= this.columnWidthSet.length) {
  3241. this.extendArray(toCol, this.columnWidthSet, defaultColWidth, colhidden, columnlen);
  3242. }
  3243. if (toCol == 0) {
  3244. cx_n = 0;
  3245. } else {
  3246. cx_n = this.columnWidthSet[toCol - 1];
  3247. }
  3248. cx_n = cx_n + toColOff - x_n;
  3249. if (toRow >= this.rowHeightSet.length) {
  3250. this.extendArray(toRow, this.rowHeightSet, defaultRowHeight, rowhidden, rowlen);
  3251. }
  3252. if (toRow == 0) {
  3253. cy_n = 0;
  3254. } else {
  3255. cy_n = this.rowHeightSet[toRow - 1];
  3256. }
  3257. cy_n = cy_n + toRowOff - y_n;
  3258. console.log(defaultColWidth, colhidden, columnlen);
  3259. console.log(fromCol, this.columnWidthSet[fromCol], fromColOff);
  3260. console.log(toCol, this.columnWidthSet[toCol], toColOff, JSON.stringify(this.columnWidthSet));
  3261. imageObject.originWidth = cx_n;
  3262. imageObject.originHeight = cy_n;
  3263. imageObject.crop.height = cy_n;
  3264. imageObject.crop.width = cx_n;
  3265. imageObject["default"].height = cy_n;
  3266. imageObject["default"].left = x_n;
  3267. imageObject["default"].top = y_n;
  3268. imageObject["default"].width = cx_n;
  3269. }
  3270. //console.log(this.columnWidthSet, this.rowHeightSet);
  3271. };
  3272. /**
  3273. * @return drawing file string
  3274. */
  3275. LuckyFile.prototype.getDrawingFile = function (rid, sheetFile) {
  3276. var sheetRelsPath = "xl/worksheets/_rels/";
  3277. var sheetFileArr = sheetFile.split("/");
  3278. var sheetRelsName = sheetFileArr[sheetFileArr.length - 1];
  3279. var sheetRelsFile = sheetRelsPath + sheetRelsName + ".rels";
  3280. var drawing = this.readXml.getElementsByTagName("Relationships/Relationship", sheetRelsFile);
  3281. if (drawing.length > 0) {
  3282. for (var i = 0; i < drawing.length; i++) {
  3283. var relationship = drawing[i];
  3284. var attrList = relationship.attributeList;
  3285. var relationshipId = method_1.getXmlAttibute(attrList, "Id", null);
  3286. if (relationshipId == rid) {
  3287. var target = method_1.getXmlAttibute(attrList, "Target", null);
  3288. if (target != null) {
  3289. return target.replace(/\.\.\//g, "");
  3290. }
  3291. }
  3292. }
  3293. }
  3294. return null;
  3295. };
  3296. LuckyFile.prototype.getDrawingRelsFile = function (drawingFile) {
  3297. var drawingRelsPath = "xl/drawings/_rels/";
  3298. var drawingFileArr = drawingFile.split("/");
  3299. var drawingRelsName = drawingFileArr[drawingFileArr.length - 1];
  3300. var drawingRelsFile = drawingRelsPath + drawingRelsName + ".rels";
  3301. return drawingRelsFile;
  3302. };
  3303. /**
  3304. * @return All sheet base information widthout cell and config
  3305. */
  3306. LuckyFile.prototype.getSheetsWithoutCell = function () {
  3307. this.getSheetsFull(false);
  3308. };
  3309. /**
  3310. * @return LuckySheet file json
  3311. */
  3312. LuckyFile.prototype.Parse = function () {
  3313. // let xml = this.readXml;
  3314. // for(let key in this.sheetNameList){
  3315. // let sheetName=this.sheetNameList[key];
  3316. // let sheetColumns = xml.getElementsByTagName("row/c/f", sheetName);
  3317. // console.log(sheetColumns);
  3318. // }
  3319. // return "";
  3320. this.getWorkBookInfo();
  3321. this.getSheetsFull();
  3322. // for(let i=0;i<this.sheets.length;i++){
  3323. // let sheet = this.sheets[i];
  3324. // let _borderInfo = sheet.config._borderInfo;
  3325. // if(_borderInfo==null){
  3326. // continue;
  3327. // }
  3328. // let _borderInfoKeys = Object.keys(_borderInfo);
  3329. // _borderInfoKeys.sort();
  3330. // for(let a=0;a<_borderInfoKeys.length;a++){
  3331. // let key = parseInt(_borderInfoKeys[a]);
  3332. // let b = _borderInfo[key];
  3333. // if(b.cells.length==0){
  3334. // continue;
  3335. // }
  3336. // if(sheet.config.borderInfo==null){
  3337. // sheet.config.borderInfo = [];
  3338. // }
  3339. // sheet.config.borderInfo.push(b);
  3340. // }
  3341. // }
  3342. return this.toJsonString(this);
  3343. };
  3344. LuckyFile.prototype.toJsonString = function (file) {
  3345. var LuckyOutPutFile = new LuckyBase_1.LuckyFileBase();
  3346. LuckyOutPutFile.info = file.info;
  3347. LuckyOutPutFile.sheets = [];
  3348. file.sheets.forEach(function (sheet) {
  3349. var sheetout = new LuckyBase_1.LuckySheetBase();
  3350. //let attrName = ["name","color","config","index","status","order","row","column","luckysheet_select_save","scrollLeft","scrollTop","zoomRatio","showGridLines","defaultColWidth","defaultRowHeight","celldata","chart","isPivotTable","pivotTable","luckysheet_conditionformat_save","freezen","calcChain"];
  3351. if (sheet.name != null) {
  3352. sheetout.name = sheet.name;
  3353. }
  3354. if (sheet.color != null) {
  3355. sheetout.color = sheet.color;
  3356. }
  3357. if (sheet.config != null) {
  3358. sheetout.config = sheet.config;
  3359. // if(sheetout.config._borderInfo!=null){
  3360. // delete sheetout.config._borderInfo;
  3361. // }
  3362. }
  3363. if (sheet.index != null) {
  3364. sheetout.index = sheet.index;
  3365. }
  3366. if (sheet.status != null) {
  3367. sheetout.status = sheet.status;
  3368. }
  3369. if (sheet.order != null) {
  3370. sheetout.order = sheet.order;
  3371. }
  3372. if (sheet.row != null) {
  3373. sheetout.row = sheet.row;
  3374. }
  3375. if (sheet.column != null) {
  3376. sheetout.column = sheet.column;
  3377. }
  3378. if (sheet.luckysheet_select_save != null) {
  3379. sheetout.luckysheet_select_save = sheet.luckysheet_select_save;
  3380. }
  3381. if (sheet.scrollLeft != null) {
  3382. sheetout.scrollLeft = sheet.scrollLeft;
  3383. }
  3384. if (sheet.scrollTop != null) {
  3385. sheetout.scrollTop = sheet.scrollTop;
  3386. }
  3387. if (sheet.zoomRatio != null) {
  3388. sheetout.zoomRatio = sheet.zoomRatio;
  3389. }
  3390. if (sheet.showGridLines != null) {
  3391. sheetout.showGridLines = sheet.showGridLines;
  3392. }
  3393. if (sheet.defaultColWidth != null) {
  3394. sheetout.defaultColWidth = sheet.defaultColWidth;
  3395. }
  3396. if (sheet.defaultRowHeight != null) {
  3397. sheetout.defaultRowHeight = sheet.defaultRowHeight;
  3398. }
  3399. if (sheet.celldata != null) {
  3400. // sheetout.celldata = sheet.celldata;
  3401. sheetout.celldata = [];
  3402. sheet.celldata.forEach(function (cell) {
  3403. var cellout = new LuckyBase_1.LuckySheetCelldataBase();
  3404. cellout.r = cell.r;
  3405. cellout.c = cell.c;
  3406. cellout.v = cell.v;
  3407. sheetout.celldata.push(cellout);
  3408. });
  3409. }
  3410. if (sheet.chart != null) {
  3411. sheetout.chart = sheet.chart;
  3412. }
  3413. if (sheet.isPivotTable != null) {
  3414. sheetout.isPivotTable = sheet.isPivotTable;
  3415. }
  3416. if (sheet.pivotTable != null) {
  3417. sheetout.pivotTable = sheet.pivotTable;
  3418. }
  3419. if (sheet.luckysheet_conditionformat_save != null) {
  3420. sheetout.luckysheet_conditionformat_save = sheet.luckysheet_conditionformat_save;
  3421. }
  3422. if (sheet.freezen != null) {
  3423. sheetout.freezen = sheet.freezen;
  3424. }
  3425. if (sheet.calcChain != null) {
  3426. sheetout.calcChain = sheet.calcChain;
  3427. }
  3428. if (sheet.images != null) {
  3429. sheetout.images = sheet.images;
  3430. }
  3431. if (sheet.dataVerification != null) {
  3432. sheetout.dataVerification = sheet.dataVerification;
  3433. }
  3434. if (sheet.hyperlink != null) {
  3435. sheetout.hyperlink = sheet.hyperlink;
  3436. }
  3437. if (sheet.hide != null) {
  3438. sheetout.hide = sheet.hide;
  3439. }
  3440. LuckyOutPutFile.sheets.push(sheetout);
  3441. });
  3442. return JSON.stringify(LuckyOutPutFile);
  3443. };
  3444. return LuckyFile;
  3445. }(LuckyBase_1.LuckyFileBase);
  3446. exports.LuckyFile = LuckyFile;
  3447. },{"../common/constant":16,"../common/method":18,"./LuckyBase":10,"./LuckyImage":13,"./LuckySheet":14,"./ReadXml":15}],13:[function(require,module,exports){
  3448. "use strict";
  3449. var __extends = void 0 && (void 0).__extends || function () {
  3450. var _extendStatics = function extendStatics(d, b) {
  3451. _extendStatics = Object.setPrototypeOf || {
  3452. __proto__: []
  3453. } instanceof Array && function (d, b) {
  3454. d.__proto__ = b;
  3455. } || function (d, b) {
  3456. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  3457. };
  3458. return _extendStatics(d, b);
  3459. };
  3460. return function (d, b) {
  3461. _extendStatics(d, b);
  3462. function __() {
  3463. this.constructor = d;
  3464. }
  3465. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3466. };
  3467. }();
  3468. Object.defineProperty(exports, "__esModule", {
  3469. value: true
  3470. });
  3471. exports.ImageList = void 0;
  3472. var LuckyBase_1 = require("./LuckyBase");
  3473. var emf_1 = require("../common/emf");
  3474. var ImageList = /** @class */function () {
  3475. function ImageList(files) {
  3476. if (files == null) {
  3477. return;
  3478. }
  3479. this.images = {};
  3480. for (var fileKey in files) {
  3481. // let reg = new RegExp("xl/media/image1.png", "g");
  3482. if (fileKey.indexOf("xl/media/") > -1) {
  3483. var fileNameArr = fileKey.split(".");
  3484. var suffix = fileNameArr[fileNameArr.length - 1].toLowerCase();
  3485. if (suffix in {
  3486. "png": 1,
  3487. "jpeg": 1,
  3488. "jpg": 1,
  3489. "gif": 1,
  3490. "bmp": 1,
  3491. "tif": 1,
  3492. "webp": 1,
  3493. "emf": 1
  3494. }) {
  3495. if (suffix == "emf") {
  3496. var pNum = 0; // number of the page, that you want to render
  3497. var scale = 1; // the scale of the document
  3498. var wrt = new emf_1.ToContext2D(pNum, scale);
  3499. var inp, out, stt;
  3500. emf_1.FromEMF.K = [];
  3501. inp = emf_1.FromEMF.C;
  3502. out = emf_1.FromEMF.K;
  3503. stt = 4;
  3504. for (var p in inp) out[inp[p]] = p.slice(stt);
  3505. try {
  3506. emf_1.FromEMF.Parse(files[fileKey], wrt);
  3507. this.images[fileKey] = wrt.canvas.toDataURL("image/png");
  3508. } catch (error) {
  3509. this.images[fileKey] = files[fileKey];
  3510. }
  3511. } else {
  3512. this.images[fileKey] = files[fileKey];
  3513. }
  3514. }
  3515. }
  3516. }
  3517. }
  3518. ImageList.prototype.getImageByName = function (pathName) {
  3519. if (pathName in this.images) {
  3520. var base64 = this.images[pathName];
  3521. return new Image(pathName, base64);
  3522. }
  3523. return null;
  3524. };
  3525. return ImageList;
  3526. }();
  3527. exports.ImageList = ImageList;
  3528. var Image = /** @class */function (_super) {
  3529. __extends(Image, _super);
  3530. function Image(pathName, base64) {
  3531. var _this = _super.call(this) || this;
  3532. _this.src = base64;
  3533. return _this;
  3534. }
  3535. Image.prototype.setDefault = function () {};
  3536. return Image;
  3537. }(LuckyBase_1.LuckyImageBase);
  3538. },{"../common/emf":17,"./LuckyBase":10}],14:[function(require,module,exports){
  3539. "use strict";
  3540. var __extends = void 0 && (void 0).__extends || function () {
  3541. var _extendStatics = function extendStatics(d, b) {
  3542. _extendStatics = Object.setPrototypeOf || {
  3543. __proto__: []
  3544. } instanceof Array && function (d, b) {
  3545. d.__proto__ = b;
  3546. } || function (d, b) {
  3547. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  3548. };
  3549. return _extendStatics(d, b);
  3550. };
  3551. return function (d, b) {
  3552. _extendStatics(d, b);
  3553. function __() {
  3554. this.constructor = d;
  3555. }
  3556. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3557. };
  3558. }();
  3559. var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
  3560. return mod && mod.__esModule ? mod : {
  3561. "default": mod
  3562. };
  3563. };
  3564. Object.defineProperty(exports, "__esModule", {
  3565. value: true
  3566. });
  3567. exports.LuckySheet = void 0;
  3568. var LuckyCell_1 = require("./LuckyCell");
  3569. var method_1 = require("../common/method");
  3570. var constant_1 = require("../common/constant");
  3571. var ReadXml_1 = require("./ReadXml");
  3572. var LuckyBase_1 = require("./LuckyBase");
  3573. var dayjs_1 = __importDefault(require("dayjs"));
  3574. var LuckySheet = /** @class */function (_super) {
  3575. __extends(LuckySheet, _super);
  3576. function LuckySheet(sheetName, sheetId, sheetOrder, isInitialCell, allFileOption) {
  3577. if (isInitialCell === void 0) {
  3578. isInitialCell = false;
  3579. }
  3580. var _this =
  3581. //Private
  3582. _super.call(this) || this;
  3583. _this.isInitialCell = isInitialCell;
  3584. _this.readXml = allFileOption.readXml;
  3585. _this.sheetFile = allFileOption.sheetFile;
  3586. _this.styles = allFileOption.styles;
  3587. _this.sharedStrings = allFileOption.sharedStrings;
  3588. _this.calcChainEles = allFileOption.calcChain;
  3589. _this.sheetList = allFileOption.sheetList;
  3590. _this.imageList = allFileOption.imageList;
  3591. _this.hide = allFileOption.hide;
  3592. console.log(allFileOption, 'allFileOption');
  3593. _this.dataVerificationSelectCount = allFileOption.dataVerificationSelectCount;
  3594. //Output
  3595. _this.name = sheetName;
  3596. _this.index = sheetId;
  3597. _this.order = sheetOrder.toString();
  3598. _this.config = new LuckyBase_1.LuckyConfig();
  3599. _this.celldata = [];
  3600. _this.mergeCells = _this.readXml.getElementsByTagName("mergeCells/mergeCell", _this.sheetFile);
  3601. var clrScheme = _this.styles["clrScheme"];
  3602. var sheetView = _this.readXml.getElementsByTagName("sheetViews/sheetView", _this.sheetFile);
  3603. var showGridLines = "1",
  3604. tabSelected = "0",
  3605. zoomScale = "100",
  3606. activeCell = "A1";
  3607. if (sheetView.length > 0) {
  3608. var attrList = sheetView[0].attributeList;
  3609. showGridLines = method_1.getXmlAttibute(attrList, "showGridLines", "1");
  3610. tabSelected = method_1.getXmlAttibute(attrList, "tabSelected", "0");
  3611. zoomScale = method_1.getXmlAttibute(attrList, "zoomScale", "100");
  3612. // let colorId = getXmlAttibute(attrList, "colorId", "0");
  3613. var selections = sheetView[0].getInnerElements("selection");
  3614. if (selections != null && selections.length > 0) {
  3615. activeCell = method_1.getXmlAttibute(selections[0].attributeList, "activeCell", "A1");
  3616. var range = method_1.getcellrange(activeCell, _this.sheetList, sheetId);
  3617. _this.luckysheet_select_save = [];
  3618. _this.luckysheet_select_save.push(range);
  3619. }
  3620. }
  3621. _this.showGridLines = showGridLines;
  3622. _this.status = tabSelected;
  3623. _this.zoomRatio = parseInt(zoomScale) / 100;
  3624. var tabColors = _this.readXml.getElementsByTagName("sheetPr/tabColor", _this.sheetFile);
  3625. if (tabColors != null && tabColors.length > 0) {
  3626. var tabColor = tabColors[0],
  3627. attrList = tabColor.attributeList;
  3628. // if(attrList.rgb!=null){
  3629. var tc = ReadXml_1.getColor(tabColor, _this.styles, "b");
  3630. _this.color = tc;
  3631. // }
  3632. }
  3633. var sheetFormatPr = _this.readXml.getElementsByTagName("sheetFormatPr", _this.sheetFile);
  3634. var defaultColWidth, defaultRowHeight;
  3635. if (sheetFormatPr.length > 0) {
  3636. var attrList = sheetFormatPr[0].attributeList;
  3637. defaultColWidth = method_1.getXmlAttibute(attrList, "defaultColWidth", "9.21");
  3638. defaultRowHeight = method_1.getXmlAttibute(attrList, "defaultRowHeight", "19");
  3639. }
  3640. _this.defaultColWidth = method_1.getColumnWidthPixel(parseFloat(defaultColWidth));
  3641. _this.defaultRowHeight = method_1.getRowHeightPixel(parseFloat(defaultRowHeight));
  3642. _this.generateConfigColumnLenAndHidden();
  3643. var cellOtherInfo = _this.generateConfigRowLenAndHiddenAddCell();
  3644. if (_this.calcChain == null) {
  3645. _this.calcChain = [];
  3646. }
  3647. var formulaListExist = {};
  3648. for (var c = 0; c < _this.calcChainEles.length; c++) {
  3649. var calcChainEle = _this.calcChainEles[c],
  3650. attrList = calcChainEle.attributeList;
  3651. if (attrList.i != sheetId) {
  3652. continue;
  3653. }
  3654. var r = attrList.r,
  3655. i = attrList.i,
  3656. l = attrList.l,
  3657. s = attrList.s,
  3658. a = attrList.a,
  3659. t = attrList.t;
  3660. var range = method_1.getcellrange(r);
  3661. var chain = new LuckyBase_1.LuckysheetCalcChain();
  3662. chain.r = range.row[0];
  3663. chain.c = range.column[0];
  3664. chain.index = _this.index;
  3665. _this.calcChain.push(chain);
  3666. formulaListExist["r" + r + "c" + c] = null;
  3667. }
  3668. if (_this.formulaRefList != null) {
  3669. for (var key in _this.formulaRefList) {
  3670. var funclist = _this.formulaRefList[key];
  3671. var mainFunc = funclist["mainRef"],
  3672. mainCellValue = mainFunc.cellValue;
  3673. var formulaTxt = mainFunc.fv;
  3674. var mainR = mainCellValue.r,
  3675. mainC = mainCellValue.c;
  3676. // let refRange = getcellrange(ref);
  3677. for (var name_1 in funclist) {
  3678. if (name_1 == "mainRef") {
  3679. continue;
  3680. }
  3681. var funcValue = funclist[name_1],
  3682. cellValue = funcValue.cellValue;
  3683. if (cellValue == null) {
  3684. continue;
  3685. }
  3686. var r = cellValue.r,
  3687. c = cellValue.c;
  3688. var func = formulaTxt;
  3689. var offsetRow = r - mainR,
  3690. offsetCol = c - mainC;
  3691. if (offsetRow > 0) {
  3692. func = "=" + method_1.fromulaRef.functionCopy(func, "down", offsetRow);
  3693. } else if (offsetRow < 0) {
  3694. func = "=" + method_1.fromulaRef.functionCopy(func, "up", Math.abs(offsetRow));
  3695. }
  3696. if (offsetCol > 0) {
  3697. func = "=" + method_1.fromulaRef.functionCopy(func, "right", offsetCol);
  3698. } else if (offsetCol < 0) {
  3699. func = "=" + method_1.fromulaRef.functionCopy(func, "left", Math.abs(offsetCol));
  3700. }
  3701. // console.log(offsetRow, offsetCol, func);
  3702. cellValue.v.f = func;
  3703. //添加共享公式链
  3704. var chain = new LuckyBase_1.LuckysheetCalcChain();
  3705. chain.r = cellValue.r;
  3706. chain.c = cellValue.c;
  3707. chain.index = _this.index;
  3708. _this.calcChain.push(chain);
  3709. }
  3710. }
  3711. }
  3712. //There may be formulas that do not appear in calcChain
  3713. for (var key in cellOtherInfo.formulaList) {
  3714. if (!(key in formulaListExist)) {
  3715. var formulaListItem = cellOtherInfo.formulaList[key];
  3716. var chain = new LuckyBase_1.LuckysheetCalcChain();
  3717. chain.r = formulaListItem.r;
  3718. chain.c = formulaListItem.c;
  3719. chain.index = _this.index;
  3720. _this.calcChain.push(chain);
  3721. }
  3722. }
  3723. // dataVerification config
  3724. _this.dataVerification = _this.generateConfigDataValidations();
  3725. // hyperlink config
  3726. _this.hyperlink = _this.generateConfigHyperlinks();
  3727. // sheet hide
  3728. _this.hide = _this.hide;
  3729. if (_this.mergeCells != null) {
  3730. for (var i = 0; i < _this.mergeCells.length; i++) {
  3731. var merge = _this.mergeCells[i],
  3732. attrList = merge.attributeList;
  3733. var ref = attrList.ref;
  3734. if (ref == null) {
  3735. continue;
  3736. }
  3737. var range = method_1.getcellrange(ref, _this.sheetList, sheetId);
  3738. var mergeValue = new LuckyBase_1.LuckySheetConfigMerge();
  3739. mergeValue.r = range.row[0];
  3740. mergeValue.c = range.column[0];
  3741. mergeValue.rs = range.row[1] - range.row[0] + 1;
  3742. mergeValue.cs = range.column[1] - range.column[0] + 1;
  3743. if (_this.config.merge == null) {
  3744. _this.config.merge = {};
  3745. }
  3746. _this.config.merge[range.row[0] + "_" + range.column[0]] = mergeValue;
  3747. }
  3748. }
  3749. var drawingFile = allFileOption.drawingFile,
  3750. drawingRelsFile = allFileOption.drawingRelsFile;
  3751. if (drawingFile != null && drawingRelsFile != null) {
  3752. var twoCellAnchors = _this.readXml.getElementsByTagName("xdr:twoCellAnchor", drawingFile);
  3753. if (twoCellAnchors != null && twoCellAnchors.length > 0) {
  3754. for (var i = 0; i < twoCellAnchors.length; i++) {
  3755. var twoCellAnchor = twoCellAnchors[i];
  3756. var editAs = method_1.getXmlAttibute(twoCellAnchor.attributeList, "editAs", "twoCell");
  3757. var xdrFroms = twoCellAnchor.getInnerElements("xdr:from"),
  3758. xdrTos = twoCellAnchor.getInnerElements("xdr:to");
  3759. var xdr_blipfills = twoCellAnchor.getInnerElements("a:blip");
  3760. if (xdrFroms != null && xdr_blipfills != null && xdrFroms.length > 0 && xdr_blipfills.length > 0) {
  3761. var xdrFrom = xdrFroms[0],
  3762. xdrTo = xdrTos[0],
  3763. xdr_blipfill = xdr_blipfills[0];
  3764. var rembed = method_1.getXmlAttibute(xdr_blipfill.attributeList, "r:embed", null);
  3765. var imageObject = _this.getBase64ByRid(rembed, drawingRelsFile);
  3766. // let aoff = xdr_xfrm.getInnerElements("a:off"), aext = xdr_xfrm.getInnerElements("a:ext");
  3767. // if(aoff!=null && aext!=null && aoff.length>0 && aext.length>0){
  3768. // let aoffAttribute = aoff[0].attributeList, aextAttribute = aext[0].attributeList;
  3769. // let x = getXmlAttibute(aoffAttribute, "x", null);
  3770. // let y = getXmlAttibute(aoffAttribute, "y", null);
  3771. // let cx = getXmlAttibute(aextAttribute, "cx", null);
  3772. // let cy = getXmlAttibute(aextAttribute, "cy", null);
  3773. // if(x!=null && y!=null && cx!=null && cy!=null && imageObject !=null){
  3774. // let x_n = getPxByEMUs(parseInt(x), "c"),y_n = getPxByEMUs(parseInt(y));
  3775. // let cx_n = getPxByEMUs(parseInt(cx), "c"),cy_n = getPxByEMUs(parseInt(cy));
  3776. var x_n = 0,
  3777. y_n = 0;
  3778. var cx_n = 0,
  3779. cy_n = 0;
  3780. imageObject.fromCol = _this.getXdrValue(xdrFrom.getInnerElements("xdr:col"));
  3781. imageObject.fromColOff = method_1.getPxByEMUs(_this.getXdrValue(xdrFrom.getInnerElements("xdr:colOff")));
  3782. imageObject.fromRow = _this.getXdrValue(xdrFrom.getInnerElements("xdr:row"));
  3783. imageObject.fromRowOff = method_1.getPxByEMUs(_this.getXdrValue(xdrFrom.getInnerElements("xdr:rowOff")));
  3784. imageObject.toCol = _this.getXdrValue(xdrTo.getInnerElements("xdr:col"));
  3785. imageObject.toColOff = method_1.getPxByEMUs(_this.getXdrValue(xdrTo.getInnerElements("xdr:colOff")));
  3786. imageObject.toRow = _this.getXdrValue(xdrTo.getInnerElements("xdr:row"));
  3787. imageObject.toRowOff = method_1.getPxByEMUs(_this.getXdrValue(xdrTo.getInnerElements("xdr:rowOff")));
  3788. imageObject.originWidth = cx_n;
  3789. imageObject.originHeight = cy_n;
  3790. if (editAs == "absolute") {
  3791. imageObject.type = "3";
  3792. } else if (editAs == "oneCell") {
  3793. imageObject.type = "2";
  3794. } else {
  3795. imageObject.type = "1";
  3796. }
  3797. imageObject.isFixedPos = false;
  3798. imageObject.fixedLeft = 0;
  3799. imageObject.fixedTop = 0;
  3800. var imageBorder = {
  3801. color: "#000",
  3802. radius: 0,
  3803. style: "solid",
  3804. width: 0
  3805. };
  3806. imageObject.border = imageBorder;
  3807. var imageCrop = {
  3808. height: cy_n,
  3809. offsetLeft: 0,
  3810. offsetTop: 0,
  3811. width: cx_n
  3812. };
  3813. imageObject.crop = imageCrop;
  3814. var imageDefault = {
  3815. height: cy_n,
  3816. left: x_n,
  3817. top: y_n,
  3818. width: cx_n
  3819. };
  3820. imageObject["default"] = imageDefault;
  3821. if (_this.images == null) {
  3822. _this.images = {};
  3823. }
  3824. _this.images[method_1.generateRandomIndex("image")] = imageObject;
  3825. // }
  3826. // }
  3827. }
  3828. }
  3829. }
  3830. }
  3831. return _this;
  3832. }
  3833. LuckySheet.prototype.getXdrValue = function (ele) {
  3834. if (ele == null || ele.length == 0) {
  3835. return null;
  3836. }
  3837. return parseInt(ele[0].value);
  3838. };
  3839. LuckySheet.prototype.getBase64ByRid = function (rid, drawingRelsFile) {
  3840. var Relationships = this.readXml.getElementsByTagName("Relationships/Relationship", drawingRelsFile);
  3841. if (Relationships != null && Relationships.length > 0) {
  3842. for (var i = 0; i < Relationships.length; i++) {
  3843. var Relationship = Relationships[i];
  3844. var attrList = Relationship.attributeList;
  3845. var Id = method_1.getXmlAttibute(attrList, "Id", null);
  3846. var src = method_1.getXmlAttibute(attrList, "Target", null);
  3847. if (Id == rid) {
  3848. src = src.replace(/\.\.\//g, "");
  3849. src = "xl/" + src;
  3850. var imgage = this.imageList.getImageByName(src);
  3851. return imgage;
  3852. }
  3853. }
  3854. }
  3855. return null;
  3856. };
  3857. /**
  3858. * @desc This will convert cols/col to luckysheet config of column'width
  3859. */
  3860. LuckySheet.prototype.generateConfigColumnLenAndHidden = function () {
  3861. var cols = this.readXml.getElementsByTagName("cols/col", this.sheetFile);
  3862. for (var i = 0; i < cols.length; i++) {
  3863. var col = cols[i],
  3864. attrList = col.attributeList;
  3865. var min = method_1.getXmlAttibute(attrList, "min", null);
  3866. var max = method_1.getXmlAttibute(attrList, "max", null);
  3867. var width = method_1.getXmlAttibute(attrList, "width", null);
  3868. var hidden = method_1.getXmlAttibute(attrList, "hidden", null);
  3869. var customWidth = method_1.getXmlAttibute(attrList, "customWidth", null);
  3870. if (min == null || max == null) {
  3871. continue;
  3872. }
  3873. var minNum = parseInt(min) - 1,
  3874. maxNum = parseInt(max) - 1,
  3875. widthNum = parseFloat(width);
  3876. for (var m = minNum; m <= maxNum; m++) {
  3877. if (width != null) {
  3878. if (this.config.columnlen == null) {
  3879. this.config.columnlen = {};
  3880. }
  3881. this.config.columnlen[m] = method_1.getColumnWidthPixel(widthNum);
  3882. }
  3883. if (hidden == "1") {
  3884. if (this.config.colhidden == null) {
  3885. this.config.colhidden = {};
  3886. }
  3887. this.config.colhidden[m] = 0;
  3888. if (this.config.columnlen) {
  3889. delete this.config.columnlen[m];
  3890. }
  3891. }
  3892. if (customWidth != null) {
  3893. if (this.config.customWidth == null) {
  3894. this.config.customWidth = {};
  3895. }
  3896. this.config.customWidth[m] = 1;
  3897. }
  3898. }
  3899. }
  3900. };
  3901. /**
  3902. * @desc This will convert cols/col to luckysheet config of column'width
  3903. */
  3904. LuckySheet.prototype.generateConfigRowLenAndHiddenAddCell = function () {
  3905. var rows = this.readXml.getElementsByTagName("sheetData/row", this.sheetFile);
  3906. var cellOtherInfo = {};
  3907. var formulaList = {};
  3908. cellOtherInfo.formulaList = formulaList;
  3909. for (var i = 0; i < rows.length; i++) {
  3910. var row = rows[i],
  3911. attrList = row.attributeList;
  3912. var rowNo = method_1.getXmlAttibute(attrList, "r", null);
  3913. var height = method_1.getXmlAttibute(attrList, "ht", null);
  3914. var hidden = method_1.getXmlAttibute(attrList, "hidden", null);
  3915. var customHeight = method_1.getXmlAttibute(attrList, "customHeight", null);
  3916. if (rowNo == null) {
  3917. continue;
  3918. }
  3919. var rowNoNum = parseInt(rowNo) - 1;
  3920. if (height != null) {
  3921. var heightNum = parseFloat(height);
  3922. if (this.config.rowlen == null) {
  3923. this.config.rowlen = {};
  3924. }
  3925. this.config.rowlen[rowNoNum] = method_1.getRowHeightPixel(heightNum);
  3926. }
  3927. if (hidden == "1") {
  3928. if (this.config.rowhidden == null) {
  3929. this.config.rowhidden = {};
  3930. }
  3931. this.config.rowhidden[rowNoNum] = 0;
  3932. if (this.config.rowlen) {
  3933. delete this.config.rowlen[rowNoNum];
  3934. }
  3935. }
  3936. if (customHeight != null) {
  3937. if (this.config.customHeight == null) {
  3938. this.config.customHeight = {};
  3939. }
  3940. this.config.customHeight[rowNoNum] = 1;
  3941. }
  3942. if (this.isInitialCell) {
  3943. var cells = row.getInnerElements("c");
  3944. for (var key in cells) {
  3945. var cell = cells[key];
  3946. var cellValue = new LuckyCell_1.LuckySheetCelldata(cell, this.styles, this.sharedStrings, this.mergeCells, this.sheetFile, this.readXml);
  3947. if (cellValue._borderObject != null) {
  3948. if (this.config.borderInfo == null) {
  3949. this.config.borderInfo = [];
  3950. }
  3951. this.config.borderInfo.push(cellValue._borderObject);
  3952. delete cellValue._borderObject;
  3953. }
  3954. // let borderId = cellValue._borderId;
  3955. // if(borderId!=null){
  3956. // let borders = this.styles["borders"] as Element[];
  3957. // if(this.config._borderInfo==null){
  3958. // this.config._borderInfo = {};
  3959. // }
  3960. // if( borderId in this.config._borderInfo){
  3961. // this.config._borderInfo[borderId].cells.push(cellValue.r + "_" + cellValue.c);
  3962. // }
  3963. // else{
  3964. // let border = borders[borderId];
  3965. // let borderObject = new LuckySheetborderInfoCellForImp();
  3966. // borderObject.rangeType = "cellGroup";
  3967. // borderObject.cells = [];
  3968. // let borderCellValue = new LuckySheetborderInfoCellValue();
  3969. // let lefts = border.getInnerElements("left");
  3970. // let rights = border.getInnerElements("right");
  3971. // let tops = border.getInnerElements("top");
  3972. // let bottoms = border.getInnerElements("bottom");
  3973. // let diagonals = border.getInnerElements("diagonal");
  3974. // let left = this.getBorderInfo(lefts);
  3975. // let right = this.getBorderInfo(rights);
  3976. // let top = this.getBorderInfo(tops);
  3977. // let bottom = this.getBorderInfo(bottoms);
  3978. // let diagonal = this.getBorderInfo(diagonals);
  3979. // let isAdd = false;
  3980. // if(left!=null && left.color!=null){
  3981. // borderCellValue.l = left;
  3982. // isAdd = true;
  3983. // }
  3984. // if(right!=null && right.color!=null){
  3985. // borderCellValue.r = right;
  3986. // isAdd = true;
  3987. // }
  3988. // if(top!=null && top.color!=null){
  3989. // borderCellValue.t = top;
  3990. // isAdd = true;
  3991. // }
  3992. // if(bottom!=null && bottom.color!=null){
  3993. // borderCellValue.b = bottom;
  3994. // isAdd = true;
  3995. // }
  3996. // if(isAdd){
  3997. // borderObject.value = borderCellValue;
  3998. // this.config._borderInfo[borderId] = borderObject;
  3999. // }
  4000. // }
  4001. // }
  4002. if (cellValue._formulaType == "shared") {
  4003. if (this.formulaRefList == null) {
  4004. this.formulaRefList = {};
  4005. }
  4006. if (this.formulaRefList[cellValue._formulaSi] == null) {
  4007. this.formulaRefList[cellValue._formulaSi] = {};
  4008. }
  4009. var fv = void 0;
  4010. if (cellValue.v != null) {
  4011. fv = cellValue.v.f;
  4012. }
  4013. var refValue = {
  4014. t: cellValue._formulaType,
  4015. ref: cellValue._fomulaRef,
  4016. si: cellValue._formulaSi,
  4017. fv: fv,
  4018. cellValue: cellValue
  4019. };
  4020. if (cellValue._fomulaRef != null) {
  4021. this.formulaRefList[cellValue._formulaSi]["mainRef"] = refValue;
  4022. } else {
  4023. this.formulaRefList[cellValue._formulaSi][cellValue.r + "_" + cellValue.c] = refValue;
  4024. }
  4025. // console.log(refValue, this.formulaRefList);
  4026. }
  4027. //There may be formulas that do not appear in calcChain
  4028. if (cellValue.v != null && cellValue.v.f != null) {
  4029. var formulaCell = {
  4030. r: cellValue.r,
  4031. c: cellValue.c
  4032. };
  4033. cellOtherInfo.formulaList["r" + cellValue.r + "c" + cellValue.c] = formulaCell;
  4034. }
  4035. this.celldata.push(cellValue);
  4036. }
  4037. }
  4038. }
  4039. return cellOtherInfo;
  4040. };
  4041. /**
  4042. * luckysheet config of dataValidations
  4043. *
  4044. * @returns {IluckysheetDataVerification} - dataValidations config
  4045. */
  4046. LuckySheet.prototype.generateConfigDataValidations = function () {
  4047. var rows = this.readXml.getElementsByTagName("dataValidations/dataValidation", this.sheetFile);
  4048. var extLst = this.readXml.getElementsByTagName("extLst/ext/x14:dataValidations/x14:dataValidation", this.sheetFile) || [];
  4049. rows = rows.concat(extLst);
  4050. var dataVerification = {};
  4051. for (var i = 0; i < rows.length; i++) {
  4052. var row = rows[i];
  4053. var attrList = row.attributeList;
  4054. var formulaValue = row.value;
  4055. var type = method_1.getXmlAttibute(attrList, "type", null);
  4056. if (!type) {
  4057. continue;
  4058. }
  4059. var operator = "",
  4060. sqref = "",
  4061. sqrefIndexArr = [],
  4062. valueArr = [];
  4063. var _prohibitInput = method_1.getXmlAttibute(attrList, "allowBlank", null) !== "1" ? false : true;
  4064. // x14 processing
  4065. var formulaReg = new RegExp(/<x14:formula1>|<xm:sqref>/g);
  4066. if (formulaReg.test(formulaValue) && (extLst === null || extLst === void 0 ? void 0 : extLst.length) >= 0) {
  4067. operator = method_1.getXmlAttibute(attrList, "operator", null);
  4068. var peelOffData = method_1.getPeelOffX14(formulaValue);
  4069. sqref = peelOffData === null || peelOffData === void 0 ? void 0 : peelOffData.sqref;
  4070. sqrefIndexArr = method_1.getMultiSequenceToNum(sqref, this.dataVerificationSelectCount);
  4071. valueArr = method_1.getMultiFormulaValue(peelOffData === null || peelOffData === void 0 ? void 0 : peelOffData.formula);
  4072. } else {
  4073. operator = method_1.getXmlAttibute(attrList, "operator", null);
  4074. sqref = method_1.getXmlAttibute(attrList, "sqref", null);
  4075. // sqrefIndexArr = getMultiSequenceToNum(sqref, this.dataVerificationSelectCount);
  4076. valueArr = method_1.getMultiFormulaValue(formulaValue);
  4077. }
  4078. var _type = constant_1.DATA_VERIFICATION_MAP[type];
  4079. var _type2 = null;
  4080. var _value1 = (valueArr === null || valueArr === void 0 ? void 0 : valueArr.length) >= 1 ? valueArr[0] : "";
  4081. var _value2 = (valueArr === null || valueArr === void 0 ? void 0 : valueArr.length) === 2 ? valueArr[1] : "";
  4082. var _hint = method_1.getXmlAttibute(attrList, "prompt", null);
  4083. var _hintShow = _hint ? true : false;
  4084. var matchType = constant_1.COMMON_TYPE2.includes(_type) ? "common" : _type;
  4085. _type2 = operator ? constant_1.DATA_VERIFICATION_TYPE2_MAP[matchType][operator] : "bw";
  4086. // mobile phone number processing
  4087. if (_type === "text_content" && ((_value1 === null || _value1 === void 0 ? void 0 : _value1.includes("LEN")) || (_value1 === null || _value1 === void 0 ? void 0 : _value1.includes("len"))) && (_value1 === null || _value1 === void 0 ? void 0 : _value1.includes("=11"))) {
  4088. _type = "validity";
  4089. _type2 = "phone";
  4090. }
  4091. // date processing
  4092. if (_type === "date") {
  4093. var D1900 = new Date(1899, 11, 30, 0, 0, 0);
  4094. _value1 = dayjs_1["default"](D1900).clone().add(Number(_value1), "day").format("YYYY-MM-DD");
  4095. _value2 = dayjs_1["default"](D1900).clone().add(Number(_value2), "day").format("YYYY-MM-DD");
  4096. }
  4097. // checkbox and dropdown processing
  4098. if (_type === "checkbox" || _type === "dropdown") {
  4099. _type2 = null;
  4100. }
  4101. // dynamically add dataVerifications
  4102. for (var _i = 0, sqrefIndexArr_1 = sqrefIndexArr; _i < sqrefIndexArr_1.length; _i++) {
  4103. var ref = sqrefIndexArr_1[_i];
  4104. dataVerification[ref] = {
  4105. type: _type,
  4106. type2: _type2,
  4107. value1: _value1,
  4108. value2: _value2,
  4109. checked: false,
  4110. remote: false,
  4111. prohibitInput: _prohibitInput,
  4112. hintShow: _hintShow,
  4113. hintText: _hint
  4114. };
  4115. }
  4116. }
  4117. return dataVerification;
  4118. };
  4119. /**
  4120. * luckysheet config of hyperlink
  4121. *
  4122. * @returns {IluckysheetHyperlink} - hyperlink config
  4123. */
  4124. LuckySheet.prototype.generateConfigHyperlinks = function () {
  4125. var _a;
  4126. var rows = this.readXml.getElementsByTagName("hyperlinks/hyperlink", this.sheetFile);
  4127. var hyperlink = {};
  4128. var _loop_1 = function _loop_1(i) {
  4129. var row = rows[i];
  4130. var attrList = row.attributeList;
  4131. var ref = method_1.getXmlAttibute(attrList, "ref", null),
  4132. refArr = method_1.getMultiSequenceToNum(ref),
  4133. _display = method_1.getXmlAttibute(attrList, "display", null),
  4134. _address = method_1.getXmlAttibute(attrList, "location", null),
  4135. _tooltip = method_1.getXmlAttibute(attrList, "tooltip", null);
  4136. var _type = _address ? "internal" : "external";
  4137. // external hyperlink
  4138. if (!_address) {
  4139. var rid_1 = attrList["r:id"];
  4140. var sheetFile = this_1.sheetFile;
  4141. var relationshipList = this_1.readXml.getElementsByTagName("Relationships/Relationship", "xl/worksheets/_rels/" + sheetFile.replace(constant_1.worksheetFilePath, "") + ".rels");
  4142. var findRid = relationshipList === null || relationshipList === void 0 ? void 0 : relationshipList.find(function (e) {
  4143. return e.attributeList["Id"] === rid_1;
  4144. });
  4145. if (findRid) {
  4146. _address = findRid.attributeList["Target"];
  4147. _type = (_a = findRid.attributeList["TargetMode"]) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase();
  4148. }
  4149. }
  4150. // match R1C1
  4151. var addressReg = new RegExp(/^.*!R([\d$])+C([\d$])*$/g);
  4152. if (addressReg.test(_address)) {
  4153. _address = method_1.getTransR1C1ToSequence(_address);
  4154. }
  4155. // dynamically add hyperlinks
  4156. for (var _i = 0, refArr_1 = refArr; _i < refArr_1.length; _i++) {
  4157. var ref_1 = refArr_1[_i];
  4158. hyperlink[ref_1] = {
  4159. linkAddress: _address,
  4160. linkTooltip: _tooltip || "",
  4161. linkType: _type,
  4162. display: _display || ""
  4163. };
  4164. }
  4165. };
  4166. var this_1 = this;
  4167. for (var i = 0; i < rows.length; i++) {
  4168. _loop_1(i);
  4169. }
  4170. return hyperlink;
  4171. };
  4172. return LuckySheet;
  4173. }(LuckyBase_1.LuckySheetBase);
  4174. exports.LuckySheet = LuckySheet;
  4175. },{"../common/constant":16,"../common/method":18,"./LuckyBase":10,"./LuckyCell":11,"./ReadXml":15,"dayjs":3}],15:[function(require,module,exports){
  4176. "use strict";
  4177. var __extends = void 0 && (void 0).__extends || function () {
  4178. var _extendStatics = function extendStatics(d, b) {
  4179. _extendStatics = Object.setPrototypeOf || {
  4180. __proto__: []
  4181. } instanceof Array && function (d, b) {
  4182. d.__proto__ = b;
  4183. } || function (d, b) {
  4184. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  4185. };
  4186. return _extendStatics(d, b);
  4187. };
  4188. return function (d, b) {
  4189. _extendStatics(d, b);
  4190. function __() {
  4191. this.constructor = d;
  4192. }
  4193. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4194. };
  4195. }();
  4196. Object.defineProperty(exports, "__esModule", {
  4197. value: true
  4198. });
  4199. exports.getlineStringAttr = exports.getColor = exports.Element = exports.ReadXml = void 0;
  4200. var constant_1 = require("../common/constant");
  4201. var method_1 = require("../common/method");
  4202. var xmloperation = /** @class */function () {
  4203. function xmloperation() {}
  4204. /**
  4205. * @param tag Search xml tag name , div,title etc.
  4206. * @param file Xml string
  4207. * @return Xml element string
  4208. */
  4209. xmloperation.prototype.getElementsByOneTag = function (tag, file) {
  4210. //<a:[^/>: ]+?>.*?</a:[^/>: ]+?>
  4211. var readTagReg;
  4212. if (tag.indexOf("|") > -1) {
  4213. var tags = tag.split("|"),
  4214. tagsRegTxt = "";
  4215. for (var i = 0; i < tags.length; i++) {
  4216. var t = tags[i];
  4217. tagsRegTxt += "|<" + t + " [^>]+?[^/]>[\\s\\S]*?</" + t + ">|<" + t + " [^>]+?/>|<" + t + ">[\\s\\S]*?</" + t + ">|<" + t + "/>";
  4218. }
  4219. tagsRegTxt = tagsRegTxt.substr(1, tagsRegTxt.length);
  4220. readTagReg = new RegExp(tagsRegTxt, "g");
  4221. } else {
  4222. readTagReg = new RegExp("<" + tag + " [^>]+?[^/]>[\\s\\S]*?</" + tag + ">|<" + tag + " [^>]+?/>|<" + tag + ">[\\s\\S]*?</" + tag + ">|<" + tag + "/>", "g");
  4223. }
  4224. var ret = file.match(readTagReg);
  4225. if (ret == null) {
  4226. return [];
  4227. } else {
  4228. return ret;
  4229. }
  4230. };
  4231. return xmloperation;
  4232. }();
  4233. var ReadXml = /** @class */function (_super) {
  4234. __extends(ReadXml, _super);
  4235. function ReadXml(files) {
  4236. var _this = _super.call(this) || this;
  4237. _this.originFile = files;
  4238. return _this;
  4239. }
  4240. /**
  4241. * @param path Search xml tag group , div,title etc.
  4242. * @param fileName One of uploadfileList, uploadfileList is file group, {key:value}
  4243. * @return Xml element calss
  4244. */
  4245. ReadXml.prototype.getElementsByTagName = function (path, fileName) {
  4246. var file = this.getFileByName(fileName);
  4247. var pathArr = path.split("/"),
  4248. ret;
  4249. for (var key in pathArr) {
  4250. var path_1 = pathArr[key];
  4251. if (ret == undefined) {
  4252. ret = this.getElementsByOneTag(path_1, file);
  4253. } else {
  4254. if (ret instanceof Array) {
  4255. var items = [];
  4256. for (var key_1 in ret) {
  4257. var item = ret[key_1];
  4258. items = items.concat(this.getElementsByOneTag(path_1, item));
  4259. }
  4260. ret = items;
  4261. } else {
  4262. ret = this.getElementsByOneTag(path_1, ret);
  4263. }
  4264. }
  4265. }
  4266. var elements = [];
  4267. for (var i = 0; i < ret.length; i++) {
  4268. var ele = new Element(ret[i]);
  4269. elements.push(ele);
  4270. }
  4271. return elements;
  4272. };
  4273. /**
  4274. * @param name One of uploadfileList's name, search for file by this parameter
  4275. * @retrun Select a file from uploadfileList
  4276. */
  4277. ReadXml.prototype.getFileByName = function (name) {
  4278. for (var fileKey in this.originFile) {
  4279. if (fileKey.indexOf(name) > -1) {
  4280. return this.originFile[fileKey];
  4281. }
  4282. }
  4283. return "";
  4284. };
  4285. return ReadXml;
  4286. }(xmloperation);
  4287. exports.ReadXml = ReadXml;
  4288. var Element = /** @class */function (_super) {
  4289. __extends(Element, _super);
  4290. function Element(str) {
  4291. var _this = _super.call(this) || this;
  4292. _this.elementString = str;
  4293. _this.setValue();
  4294. var readAttrReg = new RegExp('[a-zA-Z0-9_:]*?=".*?"', "g");
  4295. var attrList = _this.container.match(readAttrReg);
  4296. _this.attributeList = {};
  4297. if (attrList != null) {
  4298. for (var key in attrList) {
  4299. var attrFull = attrList[key];
  4300. // let al= attrFull.split("=");
  4301. if (attrFull.length == 0) {
  4302. continue;
  4303. }
  4304. var attrKey = attrFull.substr(0, attrFull.indexOf('='));
  4305. var attrValue = attrFull.substr(attrFull.indexOf('=') + 1);
  4306. if (attrKey == null || attrValue == null || attrKey.length == 0 || attrValue.length == 0) {
  4307. continue;
  4308. }
  4309. _this.attributeList[attrKey] = attrValue.substr(1, attrValue.length - 2);
  4310. }
  4311. }
  4312. return _this;
  4313. }
  4314. /**
  4315. * @param name Get attribute by key in element
  4316. * @return Single attribute
  4317. */
  4318. Element.prototype.get = function (name) {
  4319. return this.attributeList[name];
  4320. };
  4321. /**
  4322. * @param tag Get elements by tag in elementString
  4323. * @return Element group
  4324. */
  4325. Element.prototype.getInnerElements = function (tag) {
  4326. var ret = this.getElementsByOneTag(tag, this.elementString);
  4327. var elements = [];
  4328. for (var i = 0; i < ret.length; i++) {
  4329. var ele = new Element(ret[i]);
  4330. elements.push(ele);
  4331. }
  4332. if (elements.length == 0) {
  4333. return null;
  4334. }
  4335. return elements;
  4336. };
  4337. /**
  4338. * @desc get xml dom value and container, <container>value</container>
  4339. */
  4340. Element.prototype.setValue = function () {
  4341. var str = this.elementString;
  4342. if (str.substr(str.length - 2, 2) == "/>") {
  4343. this.value = "";
  4344. this.container = str;
  4345. } else {
  4346. var firstTag = this.getFirstTag();
  4347. var firstTagReg = new RegExp("(<" + firstTag + " [^>]+?[^/]>)([\\s\\S]*?)</" + firstTag + ">|(<" + firstTag + ">)([\\s\\S]*?)</" + firstTag + ">", "g");
  4348. var result = firstTagReg.exec(str);
  4349. if (result != null) {
  4350. if (result[1] != null) {
  4351. this.container = result[1];
  4352. this.value = result[2];
  4353. } else {
  4354. this.container = result[3];
  4355. this.value = result[4];
  4356. }
  4357. }
  4358. }
  4359. };
  4360. /**
  4361. * @desc get xml dom first tag, <a><b></b></a>, get a
  4362. */
  4363. Element.prototype.getFirstTag = function () {
  4364. var str = this.elementString;
  4365. var firstTag = str.substr(0, str.indexOf(' '));
  4366. if (firstTag == "" || firstTag.indexOf(">") > -1) {
  4367. firstTag = str.substr(0, str.indexOf('>'));
  4368. }
  4369. firstTag = firstTag.substr(1, firstTag.length);
  4370. return firstTag;
  4371. };
  4372. return Element;
  4373. }(xmloperation);
  4374. exports.Element = Element;
  4375. function combineIndexedColor(indexedColorsInner, indexedColors) {
  4376. var ret = {};
  4377. if (indexedColorsInner == null || indexedColorsInner.length == 0) {
  4378. return indexedColors;
  4379. }
  4380. for (var key in indexedColors) {
  4381. var value = indexedColors[key],
  4382. kn = parseInt(key);
  4383. var inner = indexedColorsInner[kn];
  4384. if (inner == null) {
  4385. ret[key] = value;
  4386. } else {
  4387. var rgb = inner.attributeList.rgb;
  4388. ret[key] = rgb;
  4389. }
  4390. }
  4391. return ret;
  4392. }
  4393. //clrScheme:Element[]
  4394. function getColor(color, styles, type) {
  4395. if (type === void 0) {
  4396. type = "g";
  4397. }
  4398. var attrList = color.attributeList;
  4399. var clrScheme = styles["clrScheme"];
  4400. var indexedColorsInner = styles["indexedColors"];
  4401. var mruColorsInner = styles["mruColors"];
  4402. var indexedColorsList = combineIndexedColor(indexedColorsInner, constant_1.indexedColors);
  4403. var indexed = attrList.indexed,
  4404. rgb = attrList.rgb,
  4405. theme = attrList.theme,
  4406. tint = attrList.tint;
  4407. var bg;
  4408. if (indexed != null) {
  4409. var indexedNum = parseInt(indexed);
  4410. bg = indexedColorsList[indexedNum];
  4411. if (bg != null) {
  4412. bg = bg.substring(bg.length - 6, bg.length);
  4413. bg = "#" + bg;
  4414. }
  4415. } else if (rgb != null) {
  4416. rgb = rgb.substring(rgb.length - 6, rgb.length);
  4417. bg = "#" + rgb;
  4418. } else if (theme != null) {
  4419. var themeNum = parseInt(theme);
  4420. if (themeNum == 0) {
  4421. themeNum = 1;
  4422. } else if (themeNum == 1) {
  4423. themeNum = 0;
  4424. } else if (themeNum == 2) {
  4425. themeNum = 3;
  4426. } else if (themeNum == 3) {
  4427. themeNum = 2;
  4428. }
  4429. var clrSchemeElement = clrScheme[themeNum];
  4430. if (clrSchemeElement != null) {
  4431. var clrs = clrSchemeElement.getInnerElements("a:sysClr|a:srgbClr");
  4432. if (clrs != null) {
  4433. var clr = clrs[0];
  4434. var clrAttrList = clr.attributeList;
  4435. // console.log(clr.container, );
  4436. if (clr.container.indexOf("sysClr") > -1) {
  4437. // if(type=="g" && clrAttrList.val=="windowText"){
  4438. // bg = null;
  4439. // }
  4440. // else if((type=="t" || type=="b") && clrAttrList.val=="window"){
  4441. // bg = null;
  4442. // }
  4443. // else
  4444. if (clrAttrList.lastClr != null) {
  4445. bg = "#" + clrAttrList.lastClr;
  4446. } else if (clrAttrList.val != null) {
  4447. bg = "#" + clrAttrList.val;
  4448. }
  4449. } else if (clr.container.indexOf("srgbClr") > -1) {
  4450. // console.log(clrAttrList.val);
  4451. bg = "#" + clrAttrList.val;
  4452. }
  4453. }
  4454. }
  4455. }
  4456. if (tint != null) {
  4457. var tintNum = parseFloat(tint);
  4458. if (bg != null) {
  4459. bg = method_1.LightenDarkenColor(bg, tintNum);
  4460. }
  4461. }
  4462. return bg;
  4463. }
  4464. exports.getColor = getColor;
  4465. /**
  4466. * @dom xml attribute object
  4467. * @attr attribute name
  4468. * @d if attribute is null, return default value
  4469. * @return attribute value
  4470. */
  4471. function getlineStringAttr(frpr, attr) {
  4472. var attrEle = frpr.getInnerElements(attr),
  4473. value;
  4474. if (attrEle != null && attrEle.length > 0) {
  4475. if (attr == "b" || attr == "i" || attr == "strike") {
  4476. value = "1";
  4477. } else if (attr == "u") {
  4478. var v = attrEle[0].attributeList.val;
  4479. if (v == "double") {
  4480. value = "2";
  4481. } else if (v == "singleAccounting") {
  4482. value = "3";
  4483. } else if (v == "doubleAccounting") {
  4484. value = "4";
  4485. } else {
  4486. value = "1";
  4487. }
  4488. } else if (attr == "vertAlign") {
  4489. var v = attrEle[0].attributeList.val;
  4490. if (v == "subscript") {
  4491. value = "1";
  4492. } else if (v == "superscript") {
  4493. value = "2";
  4494. }
  4495. } else {
  4496. value = attrEle[0].attributeList.val;
  4497. }
  4498. }
  4499. return value;
  4500. }
  4501. exports.getlineStringAttr = getlineStringAttr;
  4502. },{"../common/constant":16,"../common/method":18}],16:[function(require,module,exports){
  4503. "use strict";
  4504. Object.defineProperty(exports, "__esModule", {
  4505. value: true
  4506. });
  4507. exports.DATA_VERIFICATION_TYPE2_MAP = exports.COMMON_TYPE2 = exports.DATA_VERIFICATION_MAP = exports.fontFamilys = exports.numFmtDefaultMap = exports.borderTypes = exports.OEM_CHARSET = exports.indexedColors = exports.numFmtDefault = exports.BuiltInCellStyles = exports.ST_CellType = exports.workbookRels = exports.theme1File = exports.worksheetFilePath = exports.sharedStringsFile = exports.stylesFile = exports.calcChainFile = exports.workBookFile = exports.contentTypesFile = exports.appFile = exports.coreFile = exports.columeHeader_word_index = exports.columeHeader_word = void 0;
  4508. exports.columeHeader_word = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
  4509. exports.columeHeader_word_index = {
  4510. 'A': 0,
  4511. 'B': 1,
  4512. 'C': 2,
  4513. 'D': 3,
  4514. 'E': 4,
  4515. 'F': 5,
  4516. 'G': 6,
  4517. 'H': 7,
  4518. 'I': 8,
  4519. 'J': 9,
  4520. 'K': 10,
  4521. 'L': 11,
  4522. 'M': 12,
  4523. 'N': 13,
  4524. 'O': 14,
  4525. 'P': 15,
  4526. 'Q': 16,
  4527. 'R': 17,
  4528. 'S': 18,
  4529. 'T': 19,
  4530. 'U': 20,
  4531. 'V': 21,
  4532. 'W': 22,
  4533. 'X': 23,
  4534. 'Y': 24,
  4535. 'Z': 25
  4536. };
  4537. exports.coreFile = "docProps/core.xml";
  4538. exports.appFile = "docProps/app.xml";
  4539. exports.contentTypesFile = "[Content_Types].xml";
  4540. exports.workBookFile = "xl/workbook.xml";
  4541. exports.calcChainFile = "xl/calcChain.xml";
  4542. exports.stylesFile = "xl/styles.xml";
  4543. exports.sharedStringsFile = "xl/sharedStrings.xml";
  4544. exports.worksheetFilePath = "xl/worksheets/";
  4545. exports.theme1File = "xl/theme/theme1.xml";
  4546. exports.workbookRels = "xl/_rels/workbook.xml.rels";
  4547. //Excel Built-In cell type
  4548. exports.ST_CellType = {
  4549. "Boolean": "b",
  4550. "Date": "d",
  4551. "Error": "e",
  4552. "InlineString": "inlineStr",
  4553. "Number": "n",
  4554. "SharedString": "s",
  4555. "String": "str"
  4556. };
  4557. //Excel Built-In cell style
  4558. exports.BuiltInCellStyles = {
  4559. "0": "Normal"
  4560. };
  4561. exports.numFmtDefault = {
  4562. "0": 'General',
  4563. "1": '0',
  4564. "2": '0.00',
  4565. "3": '#,##0',
  4566. "4": '#,##0.00',
  4567. "9": '0%',
  4568. "10": '0.00%',
  4569. "11": '0.00E+00',
  4570. "12": '# ?/?',
  4571. "13": '# ??/??',
  4572. "14": 'm/d/yy',
  4573. "15": 'd-mmm-yy',
  4574. "16": 'd-mmm',
  4575. "17": 'mmm-yy',
  4576. "18": 'h:mm AM/PM',
  4577. "19": 'h:mm:ss AM/PM',
  4578. "20": 'h:mm',
  4579. "21": 'h:mm:ss',
  4580. "22": 'm/d/yy h:mm',
  4581. "37": '#,##0 ;(#,##0)',
  4582. "38": '#,##0 ;[Red](#,##0)',
  4583. "39": '#,##0.00;(#,##0.00)',
  4584. "40": '#,##0.00;[Red](#,##0.00)',
  4585. "45": 'mm:ss',
  4586. "46": '[h]:mm:ss',
  4587. "47": 'mmss.0',
  4588. "48": '##0.0E+0',
  4589. "49": '@'
  4590. };
  4591. exports.indexedColors = {
  4592. "0": '00000000',
  4593. "1": '00FFFFFF',
  4594. "2": '00FF0000',
  4595. "3": '0000FF00',
  4596. "4": '000000FF',
  4597. "5": '00FFFF00',
  4598. "6": '00FF00FF',
  4599. "7": '0000FFFF',
  4600. "8": '00000000',
  4601. "9": '00FFFFFF',
  4602. "10": '00FF0000',
  4603. "11": '0000FF00',
  4604. "12": '000000FF',
  4605. "13": '00FFFF00',
  4606. "14": '00FF00FF',
  4607. "15": '0000FFFF',
  4608. "16": '00800000',
  4609. "17": '00008000',
  4610. "18": '00000080',
  4611. "19": '00808000',
  4612. "20": '00800080',
  4613. "21": '00008080',
  4614. "22": '00C0C0C0',
  4615. "23": '00808080',
  4616. "24": '009999FF',
  4617. "25": '00993366',
  4618. "26": '00FFFFCC',
  4619. "27": '00CCFFFF',
  4620. "28": '00660066',
  4621. "29": '00FF8080',
  4622. "30": '000066CC',
  4623. "31": '00CCCCFF',
  4624. "32": '00000080',
  4625. "33": '00FF00FF',
  4626. "34": '00FFFF00',
  4627. "35": '0000FFFF',
  4628. "36": '00800080',
  4629. "37": '00800000',
  4630. "38": '00008080',
  4631. "39": '000000FF',
  4632. "40": '0000CCFF',
  4633. "41": '00CCFFFF',
  4634. "42": '00CCFFCC',
  4635. "43": '00FFFF99',
  4636. "44": '0099CCFF',
  4637. "45": '00FF99CC',
  4638. "46": '00CC99FF',
  4639. "47": '00FFCC99',
  4640. "48": '003366FF',
  4641. "49": '0033CCCC',
  4642. "50": '0099CC00',
  4643. "51": '00FFCC00',
  4644. "52": '00FF9900',
  4645. "53": '00FF6600',
  4646. "54": '00666699',
  4647. "55": '00969696',
  4648. "56": '00003366',
  4649. "57": '00339966',
  4650. "58": '00003300',
  4651. "59": '00333300',
  4652. "60": '00993300',
  4653. "61": '00993366',
  4654. "62": '00333399',
  4655. "63": '00333333',
  4656. "64": null,
  4657. "65": null
  4658. };
  4659. exports.OEM_CHARSET = {
  4660. "0": "ANSI_CHARSET",
  4661. "1": "DEFAULT_CHARSET",
  4662. "2": "SYMBOL_CHARSET",
  4663. "77": "MAC_CHARSET",
  4664. "128": "SHIFTJIS_CHARSET",
  4665. "129": "HANGUL_CHARSET",
  4666. "130": "JOHAB_CHARSET",
  4667. "134": "GB2312_CHARSET",
  4668. "136": "CHINESEBIG5_CHARSET",
  4669. "161": "GREEK_CHARSET",
  4670. "162": "TURKISH_CHARSET",
  4671. "163": "VIETNAMESE_CHARSET",
  4672. "177": "HEBREW_CHARSET",
  4673. "178": "ARABIC_CHARSET",
  4674. "186": "BALTIC_CHARSET",
  4675. "204": "RUSSIAN_CHARSET",
  4676. "222": "THAI_CHARSET",
  4677. "238": "EASTEUROPE_CHARSET",
  4678. "255": "OEM_CHARSET"
  4679. };
  4680. exports.borderTypes = {
  4681. "none": 0,
  4682. "thin": 1,
  4683. "hair": 2,
  4684. "dotted": 3,
  4685. "dashed": 4,
  4686. "dashDot": 5,
  4687. "dashDotDot": 6,
  4688. "double": 7,
  4689. "medium": 8,
  4690. "mediumDashed": 9,
  4691. "mediumDashDot": 10,
  4692. "mediumDashDotDot": 11,
  4693. "slantDashDot": 12,
  4694. "thick": 13
  4695. };
  4696. exports.numFmtDefaultMap = {
  4697. "yyyy/m/d;@": "yyyy/MM/dd",
  4698. "yyyy&quot;年&quot;m&quot;月&quot;d&quot;日&quot;;@": "yyyy&quot;年&quot;MM&quot;月&quot;dd&quot;日&quot;",
  4699. "[$-409]yyyy/m/d\\ h:mm\\ AM/PM;@": "yyyy/MM/dd hh:mm AM/PM"
  4700. };
  4701. exports.fontFamilys = {
  4702. "0": "defualt",
  4703. "1": "Roman",
  4704. "2": "Swiss",
  4705. "3": "Modern",
  4706. "4": "Script",
  4707. "5": "Decorative"
  4708. };
  4709. exports.DATA_VERIFICATION_MAP = {
  4710. list: "dropdown",
  4711. whole: "number_integer",
  4712. decimal: "number_decimal",
  4713. custom: "text_content",
  4714. textLength: "text_length",
  4715. date: "date",
  4716. "unknown1": "number",
  4717. "unknown2": "checkbox",
  4718. "unknown3": "validity"
  4719. };
  4720. exports.COMMON_TYPE2 = ["number", "number_integer", "number_decimal", "text_length"];
  4721. exports.DATA_VERIFICATION_TYPE2_MAP = {
  4722. common: {
  4723. between: "bw",
  4724. notBetween: "nb",
  4725. equal: "eq",
  4726. notEqualTo: "ne",
  4727. moreThanThe: "gt",
  4728. lessThan: "lt",
  4729. greaterOrEqualTo: "gte",
  4730. lessThanOrEqualTo: "lte"
  4731. },
  4732. text_content: {
  4733. include: "include",
  4734. exclude: "exclude",
  4735. equal: "equal"
  4736. },
  4737. date: {
  4738. between: "bw",
  4739. notBetween: "nb",
  4740. equal: "eq",
  4741. notEqualTo: "ne",
  4742. earlierThan: "bf",
  4743. noEarlierThan: "nbf",
  4744. laterThan: "af",
  4745. noLaterThan: "naf"
  4746. },
  4747. validity: {
  4748. card: "card",
  4749. phone: "phone"
  4750. }
  4751. };
  4752. },{}],17:[function(require,module,exports){
  4753. "use strict";
  4754. Object.defineProperty(exports, "__esModule", {
  4755. value: true
  4756. });
  4757. exports.ToContext2D = exports.FromEMF = exports.UDOC = void 0;
  4758. exports.UDOC = {};
  4759. exports.UDOC.G = {
  4760. concat: function concat(p, r) {
  4761. for (var i = 0; i < r.cmds.length; i++) p.cmds.push(r.cmds[i]);
  4762. for (var i = 0; i < r.crds.length; i++) p.crds.push(r.crds[i]);
  4763. },
  4764. getBB: function getBB(ps) {
  4765. var x0 = 1e99,
  4766. y0 = 1e99,
  4767. x1 = -x0,
  4768. y1 = -y0;
  4769. for (var i = 0; i < ps.length; i += 2) {
  4770. var x = ps[i],
  4771. y = ps[i + 1];
  4772. if (x < x0) x0 = x;else if (x > x1) x1 = x;
  4773. if (y < y0) y0 = y;else if (y > y1) y1 = y;
  4774. }
  4775. return [x0, y0, x1, y1];
  4776. },
  4777. rectToPath: function rectToPath(r) {
  4778. return {
  4779. cmds: ["M", "L", "L", "L", "Z"],
  4780. crds: [r[0], r[1], r[2], r[1], r[2], r[3], r[0], r[3]]
  4781. };
  4782. },
  4783. // a inside b
  4784. insideBox: function insideBox(a, b) {
  4785. return b[0] <= a[0] && b[1] <= a[1] && a[2] <= b[2] && a[3] <= b[3];
  4786. },
  4787. isBox: function isBox(p, bb) {
  4788. var sameCrd8 = function sameCrd8(pcrd, crds) {
  4789. for (var o = 0; o < 8; o += 2) {
  4790. var eq = true;
  4791. for (var j = 0; j < 8; j++) if (Math.abs(crds[j] - pcrd[j + o & 7]) >= 2) {
  4792. eq = false;
  4793. break;
  4794. }
  4795. if (eq) return true;
  4796. }
  4797. return false;
  4798. };
  4799. if (p.cmds.length > 10) return false;
  4800. var cmds = p.cmds.join(""),
  4801. crds = p.crds;
  4802. var sameRect = false;
  4803. if (cmds == "MLLLZ" && crds.length == 8 || cmds == "MLLLLZ" && crds.length == 10) {
  4804. if (crds.length == 10) crds = crds.slice(0, 8);
  4805. var x0 = bb[0],
  4806. y0 = bb[1],
  4807. x1 = bb[2],
  4808. y1 = bb[3];
  4809. if (!sameRect) sameRect = sameCrd8(crds, [x0, y0, x1, y0, x1, y1, x0, y1]);
  4810. if (!sameRect) sameRect = sameCrd8(crds, [x0, y1, x1, y1, x1, y0, x0, y0]);
  4811. }
  4812. return sameRect;
  4813. },
  4814. boxArea: function boxArea(a) {
  4815. var w = a[2] - a[0],
  4816. h = a[3] - a[1];
  4817. return w * h;
  4818. },
  4819. newPath: function newPath(gst) {
  4820. gst.pth = {
  4821. cmds: [],
  4822. crds: []
  4823. };
  4824. },
  4825. moveTo: function moveTo(gst, x, y) {
  4826. var p = exports.UDOC.M.multPoint(gst.ctm, [x, y]); //if(gst.cpos[0]==p[0] && gst.cpos[1]==p[1]) return;
  4827. gst.pth.cmds.push("M");
  4828. gst.pth.crds.push(p[0], p[1]);
  4829. gst.cpos = p;
  4830. },
  4831. lineTo: function lineTo(gst, x, y) {
  4832. var p = exports.UDOC.M.multPoint(gst.ctm, [x, y]);
  4833. if (gst.cpos[0] == p[0] && gst.cpos[1] == p[1]) return;
  4834. gst.pth.cmds.push("L");
  4835. gst.pth.crds.push(p[0], p[1]);
  4836. gst.cpos = p;
  4837. },
  4838. curveTo: function curveTo(gst, x1, y1, x2, y2, x3, y3) {
  4839. var p;
  4840. p = exports.UDOC.M.multPoint(gst.ctm, [x1, y1]);
  4841. x1 = p[0];
  4842. y1 = p[1];
  4843. p = exports.UDOC.M.multPoint(gst.ctm, [x2, y2]);
  4844. x2 = p[0];
  4845. y2 = p[1];
  4846. p = exports.UDOC.M.multPoint(gst.ctm, [x3, y3]);
  4847. x3 = p[0];
  4848. y3 = p[1];
  4849. gst.cpos = p;
  4850. gst.pth.cmds.push("C");
  4851. gst.pth.crds.push(x1, y1, x2, y2, x3, y3);
  4852. },
  4853. closePath: function closePath(gst) {
  4854. gst.pth.cmds.push("Z");
  4855. },
  4856. arc: function arc(gst, x, y, r, a0, a1, neg) {
  4857. // circle from a0 counter-clock-wise to a1
  4858. if (neg) while (a1 > a0) a1 -= 2 * Math.PI;else while (a1 < a0) a1 += 2 * Math.PI;
  4859. var th = (a1 - a0) / 4;
  4860. var x0 = Math.cos(th / 2),
  4861. y0 = -Math.sin(th / 2);
  4862. var x1 = (4 - x0) / 3,
  4863. y1 = y0 == 0 ? y0 : (1 - x0) * (3 - x0) / (3 * y0);
  4864. var x2 = x1,
  4865. y2 = -y1;
  4866. var x3 = x0,
  4867. y3 = -y0;
  4868. var p0 = [x0, y0],
  4869. p1 = [x1, y1],
  4870. p2 = [x2, y2],
  4871. p3 = [x3, y3];
  4872. var pth = {
  4873. cmds: [gst.pth.cmds.length == 0 ? "M" : "L", "C", "C", "C", "C"],
  4874. crds: [x0, y0, x1, y1, x2, y2, x3, y3]
  4875. };
  4876. var rot = [1, 0, 0, 1, 0, 0];
  4877. exports.UDOC.M.rotate(rot, -th);
  4878. for (var i = 0; i < 3; i++) {
  4879. p1 = exports.UDOC.M.multPoint(rot, p1);
  4880. p2 = exports.UDOC.M.multPoint(rot, p2);
  4881. p3 = exports.UDOC.M.multPoint(rot, p3);
  4882. pth.crds.push(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]);
  4883. }
  4884. var sc = [r, 0, 0, r, x, y];
  4885. exports.UDOC.M.rotate(rot, -a0 + th / 2);
  4886. exports.UDOC.M.concat(rot, sc);
  4887. exports.UDOC.M.multArray(rot, pth.crds);
  4888. exports.UDOC.M.multArray(gst.ctm, pth.crds);
  4889. exports.UDOC.G.concat(gst.pth, pth);
  4890. var y = pth.crds.pop();
  4891. x = pth.crds.pop();
  4892. gst.cpos = [x, y];
  4893. },
  4894. toPoly: function toPoly(p) {
  4895. if (p.cmds[0] != "M" || p.cmds[p.cmds.length - 1] != "Z") return null;
  4896. for (var i = 1; i < p.cmds.length - 1; i++) if (p.cmds[i] != "L") return null;
  4897. var out = [],
  4898. cl = p.crds.length;
  4899. if (p.crds[0] == p.crds[cl - 2] && p.crds[1] == p.crds[cl - 1]) cl -= 2;
  4900. for (var i = 0; i < cl; i += 2) out.push([p.crds[i], p.crds[i + 1]]);
  4901. if (exports.UDOC.G.polyArea(p.crds) < 0) out.reverse();
  4902. return out;
  4903. },
  4904. fromPoly: function fromPoly(p) {
  4905. var o = {
  4906. cmds: [],
  4907. crds: []
  4908. };
  4909. for (var i = 0; i < p.length; i++) {
  4910. o.crds.push(p[i][0], p[i][1]);
  4911. o.cmds.push(i == 0 ? "M" : "L");
  4912. }
  4913. o.cmds.push("Z");
  4914. return o;
  4915. },
  4916. polyArea: function polyArea(p) {
  4917. if (p.length < 6) return 0;
  4918. var l = p.length - 2;
  4919. var sum = (p[0] - p[l]) * (p[l + 1] + p[1]);
  4920. for (var i = 0; i < l; i += 2) sum += (p[i + 2] - p[i]) * (p[i + 1] + p[i + 3]);
  4921. return -sum * 0.5;
  4922. },
  4923. polyClip: function polyClip(p0, p1) {
  4924. var cp1, cp2, s, e;
  4925. var inside = function inside(p) {
  4926. return (cp2[0] - cp1[0]) * (p[1] - cp1[1]) > (cp2[1] - cp1[1]) * (p[0] - cp1[0]);
  4927. };
  4928. var isc = function isc() {
  4929. var dc = [cp1[0] - cp2[0], cp1[1] - cp2[1]],
  4930. dp = [s[0] - e[0], s[1] - e[1]],
  4931. n1 = cp1[0] * cp2[1] - cp1[1] * cp2[0],
  4932. n2 = s[0] * e[1] - s[1] * e[0],
  4933. n3 = 1.0 / (dc[0] * dp[1] - dc[1] * dp[0]);
  4934. return [(n1 * dp[0] - n2 * dc[0]) * n3, (n1 * dp[1] - n2 * dc[1]) * n3];
  4935. };
  4936. var out = p0;
  4937. cp1 = p1[p1.length - 1];
  4938. for (var j in p1) {
  4939. var cp2 = p1[j];
  4940. var inp = out;
  4941. out = [];
  4942. s = inp[inp.length - 1]; //last on the input list
  4943. for (var i in inp) {
  4944. var e = inp[i];
  4945. if (inside(e)) {
  4946. if (!inside(s)) {
  4947. out.push(isc());
  4948. }
  4949. out.push(e);
  4950. } else if (inside(s)) {
  4951. out.push(isc());
  4952. }
  4953. s = e;
  4954. }
  4955. cp1 = cp2;
  4956. }
  4957. return out;
  4958. }
  4959. };
  4960. exports.UDOC.M = {
  4961. getScale: function getScale(m) {
  4962. return Math.sqrt(Math.abs(m[0] * m[3] - m[1] * m[2]));
  4963. },
  4964. translate: function translate(m, x, y) {
  4965. exports.UDOC.M.concat(m, [1, 0, 0, 1, x, y]);
  4966. },
  4967. rotate: function rotate(m, a) {
  4968. exports.UDOC.M.concat(m, [Math.cos(a), -Math.sin(a), Math.sin(a), Math.cos(a), 0, 0]);
  4969. },
  4970. scale: function scale(m, x, y) {
  4971. exports.UDOC.M.concat(m, [x, 0, 0, y, 0, 0]);
  4972. },
  4973. concat: function concat(m, w) {
  4974. var a = m[0],
  4975. b = m[1],
  4976. c = m[2],
  4977. d = m[3],
  4978. tx = m[4],
  4979. ty = m[5];
  4980. m[0] = a * w[0] + b * w[2];
  4981. m[1] = a * w[1] + b * w[3];
  4982. m[2] = c * w[0] + d * w[2];
  4983. m[3] = c * w[1] + d * w[3];
  4984. m[4] = tx * w[0] + ty * w[2] + w[4];
  4985. m[5] = tx * w[1] + ty * w[3] + w[5];
  4986. },
  4987. invert: function invert(m) {
  4988. var a = m[0],
  4989. b = m[1],
  4990. c = m[2],
  4991. d = m[3],
  4992. tx = m[4],
  4993. ty = m[5],
  4994. adbc = a * d - b * c;
  4995. m[0] = d / adbc;
  4996. m[1] = -b / adbc;
  4997. m[2] = -c / adbc;
  4998. m[3] = a / adbc;
  4999. m[4] = (c * ty - d * tx) / adbc;
  5000. m[5] = (b * tx - a * ty) / adbc;
  5001. },
  5002. multPoint: function multPoint(m, p) {
  5003. var x = p[0],
  5004. y = p[1];
  5005. return [x * m[0] + y * m[2] + m[4], x * m[1] + y * m[3] + m[5]];
  5006. },
  5007. multArray: function multArray(m, a) {
  5008. for (var i = 0; i < a.length; i += 2) {
  5009. var x = a[i],
  5010. y = a[i + 1];
  5011. a[i] = x * m[0] + y * m[2] + m[4];
  5012. a[i + 1] = x * m[1] + y * m[3] + m[5];
  5013. }
  5014. }
  5015. };
  5016. exports.UDOC.C = {
  5017. srgbGamma: function srgbGamma(x) {
  5018. return x < 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1.0 / 2.4) - 0.055;
  5019. },
  5020. cmykToRgb: function cmykToRgb(clr) {
  5021. var c = clr[0],
  5022. m = clr[1],
  5023. y = clr[2],
  5024. k = clr[3];
  5025. // return [1-Math.min(1,c+k), 1-Math.min(1, m+k), 1-Math.min(1,y+k)];
  5026. var r = 255 + c * (-4.387332384609988 * c + 54.48615194189176 * m + 18.82290502165302 * y + 212.25662451639585 * k + -285.2331026137004) + m * (1.7149763477362134 * m - 5.6096736904047315 * y + -17.873870861415444 * k - 5.497006427196366) + y * (-2.5217340131683033 * y - 21.248923337353073 * k + 17.5119270841813) + k * (-21.86122147463605 * k - 189.48180835922747);
  5027. var g = 255 + c * (8.841041422036149 * c + 60.118027045597366 * m + 6.871425592049007 * y + 31.159100130055922 * k + -79.2970844816548) + m * (-15.310361306967817 * m + 17.575251261109482 * y + 131.35250912493976 * k - 190.9453302588951) + y * (4.444339102852739 * y + 9.8632861493405 * k - 24.86741582555878) + k * (-20.737325471181034 * k - 187.80453709719578);
  5028. var b = 255 + c * (0.8842522430003296 * c + 8.078677503112928 * m + 30.89978309703729 * y - 0.23883238689178934 * k + -14.183576799673286) + m * (10.49593273432072 * m + 63.02378494754052 * y + 50.606957656360734 * k - 112.23884253719248) + y * (0.03296041114873217 * y + 115.60384449646641 * k + -193.58209356861505) + k * (-22.33816807309886 * k - 180.12613974708367);
  5029. return [Math.max(0, Math.min(1, r / 255)), Math.max(0, Math.min(1, g / 255)), Math.max(0, Math.min(1, b / 255))];
  5030. //var iK = 1-c[3];
  5031. //return [(1-c[0])*iK, (1-c[1])*iK, (1-c[2])*iK];
  5032. },
  5033. labToRgb: function labToRgb(lab) {
  5034. var k = 903.3,
  5035. e = 0.008856,
  5036. L = lab[0],
  5037. a = lab[1],
  5038. b = lab[2];
  5039. var fy = (L + 16) / 116,
  5040. fy3 = fy * fy * fy;
  5041. var fz = fy - b / 200,
  5042. fz3 = fz * fz * fz;
  5043. var fx = a / 500 + fy,
  5044. fx3 = fx * fx * fx;
  5045. var zr = fz3 > e ? fz3 : (116 * fz - 16) / k;
  5046. var yr = fy3 > e ? fy3 : (116 * fy - 16) / k;
  5047. var xr = fx3 > e ? fx3 : (116 * fx - 16) / k;
  5048. var X = xr * 96.72,
  5049. Y = yr * 100,
  5050. Z = zr * 81.427,
  5051. xyz = [X / 100, Y / 100, Z / 100];
  5052. var x2s = [3.1338561, -1.6168667, -0.4906146, -0.9787684, 1.9161415, 0.0334540, 0.0719453, -0.2289914, 1.4052427];
  5053. var rgb = [x2s[0] * xyz[0] + x2s[1] * xyz[1] + x2s[2] * xyz[2], x2s[3] * xyz[0] + x2s[4] * xyz[1] + x2s[5] * xyz[2], x2s[6] * xyz[0] + x2s[7] * xyz[1] + x2s[8] * xyz[2]];
  5054. for (var i = 0; i < 3; i++) rgb[i] = Math.max(0, Math.min(1, exports.UDOC.C.srgbGamma(rgb[i])));
  5055. return rgb;
  5056. }
  5057. };
  5058. exports.UDOC.getState = function (crds) {
  5059. return {
  5060. font: exports.UDOC.getFont(),
  5061. dd: {
  5062. flat: 1
  5063. },
  5064. space: "/DeviceGray",
  5065. // fill
  5066. ca: 1,
  5067. colr: [0, 0, 0],
  5068. sspace: "/DeviceGray",
  5069. // stroke
  5070. CA: 1,
  5071. COLR: [0, 0, 0],
  5072. bmode: "/Normal",
  5073. SA: false,
  5074. OPM: 0,
  5075. AIS: false,
  5076. OP: false,
  5077. op: false,
  5078. SMask: "/None",
  5079. lwidth: 1,
  5080. lcap: 0,
  5081. ljoin: 0,
  5082. mlimit: 10,
  5083. SM: 0.1,
  5084. doff: 0,
  5085. dash: [],
  5086. ctm: [1, 0, 0, 1, 0, 0],
  5087. cpos: [0, 0],
  5088. pth: {
  5089. cmds: [],
  5090. crds: []
  5091. },
  5092. cpth: crds ? exports.UDOC.G.rectToPath(crds) : null // clipping path
  5093. };
  5094. };
  5095. exports.UDOC.getFont = function () {
  5096. return {
  5097. Tc: 0,
  5098. Tw: 0,
  5099. Th: 100,
  5100. Tl: 0,
  5101. Tf: "Helvetica-Bold",
  5102. Tfs: 1,
  5103. Tmode: 0,
  5104. Trise: 0,
  5105. Tk: 0,
  5106. Tal: 0,
  5107. Tun: 0,
  5108. Tm: [1, 0, 0, 1, 0, 0],
  5109. Tlm: [1, 0, 0, 1, 0, 0],
  5110. Trm: [1, 0, 0, 1, 0, 0]
  5111. };
  5112. };
  5113. exports.FromEMF = function () {};
  5114. exports.FromEMF.Parse = function (buff, genv) {
  5115. buff = new Uint8Array(buff);
  5116. var off = 0;
  5117. //console.log(buff.slice(0,32));
  5118. var prms = {
  5119. fill: false,
  5120. strk: false,
  5121. bb: [0, 0, 1, 1],
  5122. wbb: [0, 0, 1, 1],
  5123. fnt: {
  5124. nam: "Arial",
  5125. hgh: 25,
  5126. und: false,
  5127. orn: 0
  5128. },
  5129. tclr: [0, 0, 0],
  5130. talg: 0
  5131. },
  5132. gst,
  5133. tab = [],
  5134. sts = [];
  5135. var rI = exports.FromEMF.B.readShort,
  5136. rU = exports.FromEMF.B.readUshort,
  5137. rI32 = exports.FromEMF.B.readInt,
  5138. rU32 = exports.FromEMF.B.readUint,
  5139. rF32 = exports.FromEMF.B.readFloat;
  5140. var opn = 0;
  5141. while (true) {
  5142. var fnc = rU32(buff, off);
  5143. off += 4;
  5144. var fnm = exports.FromEMF.K[fnc];
  5145. var siz = rU32(buff, off);
  5146. off += 4;
  5147. //if(gst && isNaN(gst.ctm[0])) throw "e";
  5148. //console.log(fnc,fnm,siz);
  5149. var loff = off;
  5150. //if(opn++==253) break;
  5151. var obj = null,
  5152. oid = 0;
  5153. //console.log(fnm, siz);
  5154. if (false) {} else if (fnm == "EOF") {
  5155. break;
  5156. } else if (fnm == "HEADER") {
  5157. prms.bb = exports.FromEMF._readBox(buff, loff);
  5158. loff += 16; //console.log(fnm, prms.bb);
  5159. genv.StartPage(prms.bb[0], prms.bb[1], prms.bb[2], prms.bb[3]);
  5160. gst = exports.UDOC.getState(prms.bb);
  5161. } else if (fnm == "SAVEDC") sts.push(JSON.stringify(gst), JSON.stringify(prms));else if (fnm == "RESTOREDC") {
  5162. var dif = rI32(buff, loff);
  5163. loff += 4;
  5164. while (dif < -1) {
  5165. sts.pop();
  5166. sts.pop();
  5167. }
  5168. prms = JSON.parse(sts.pop());
  5169. gst = JSON.parse(sts.pop());
  5170. } else if (fnm == "SELECTCLIPPATH") {
  5171. gst.cpth = JSON.parse(JSON.stringify(gst.pth));
  5172. } else if (["SETMAPMODE", "SETPOLYFILLMODE", "SETBKMODE" /*,"SETVIEWPORTEXTEX"*/, "SETICMMODE", "SETROP2", "EXTSELECTCLIPRGN"].indexOf(fnm) != -1) {}
  5173. //else if(fnm=="INTERSECTCLIPRECT") { var r=prms.crct=FromEMF._readBox(buff, loff); /*var y0=r[1],y1=r[3]; if(y0>y1){r[1]=y1; r[3]=y0;}*/ console.log(prms.crct); }
  5174. else if (fnm == "SETMITERLIMIT") gst.mlimit = rU32(buff, loff);else if (fnm == "SETTEXTCOLOR") prms.tclr = [buff[loff] / 255, buff[loff + 1] / 255, buff[loff + 2] / 255];else if (fnm == "SETTEXTALIGN") prms.talg = rU32(buff, loff);else if (fnm == "SETVIEWPORTEXTEX" || fnm == "SETVIEWPORTORGEX") {
  5175. if (prms.vbb == null) prms.vbb = [];
  5176. var coff = fnm == "SETVIEWPORTORGEX" ? 0 : 2;
  5177. prms.vbb[coff] = rI32(buff, loff);
  5178. loff += 4;
  5179. prms.vbb[coff + 1] = rI32(buff, loff);
  5180. loff += 4;
  5181. //console.log(prms.vbb);
  5182. if (fnm == "SETVIEWPORTEXTEX") exports.FromEMF._updateCtm(prms, gst);
  5183. } else if (fnm == "SETWINDOWEXTEX" || fnm == "SETWINDOWORGEX") {
  5184. var coff = fnm == "SETWINDOWORGEX" ? 0 : 2;
  5185. prms.wbb[coff] = rI32(buff, loff);
  5186. loff += 4;
  5187. prms.wbb[coff + 1] = rI32(buff, loff);
  5188. loff += 4;
  5189. if (fnm == "SETWINDOWEXTEX") exports.FromEMF._updateCtm(prms, gst);
  5190. }
  5191. //else if(fnm=="SETMETARGN") {}
  5192. else if (fnm == "COMMENT") {
  5193. var ds = rU32(buff, loff);
  5194. loff += 4;
  5195. } else if (fnm == "SELECTOBJECT") {
  5196. var ind = rU32(buff, loff);
  5197. loff += 4;
  5198. //console.log(ind.toString(16), tab, tab[ind]);
  5199. if (ind == 0x80000000) {
  5200. prms.fill = true;
  5201. gst.colr = [1, 1, 1];
  5202. } // white brush
  5203. else if (ind == 0x80000005) {
  5204. prms.fill = false;
  5205. } // null brush
  5206. else if (ind == 0x80000007) {
  5207. prms.strk = true;
  5208. prms.lwidth = 1;
  5209. gst.COLR = [0, 0, 0];
  5210. } // black pen
  5211. else if (ind == 0x80000008) {
  5212. prms.strk = false;
  5213. } // null pen
  5214. else if (ind == 0x8000000d) {} // system font
  5215. else if (ind == 0x8000000e) {} // device default font
  5216. else {
  5217. var co = tab[ind]; //console.log(ind, co);
  5218. if (co.t == "b") {
  5219. prms.fill = co.stl != 1;
  5220. if (co.stl == 0) {} else if (co.stl == 1) {} else throw co.stl + " e";
  5221. gst.colr = co.clr;
  5222. } else if (co.t == "p") {
  5223. prms.strk = co.stl != 5;
  5224. gst.lwidth = co.wid;
  5225. gst.COLR = co.clr;
  5226. } else if (co.t == "f") {
  5227. prms.fnt = co;
  5228. gst.font.Tf = co.nam;
  5229. gst.font.Tfs = Math.abs(co.hgh);
  5230. gst.font.Tun = co.und;
  5231. } else throw "e";
  5232. }
  5233. } else if (fnm == "DELETEOBJECT") {
  5234. var ind = rU32(buff, loff);
  5235. loff += 4;
  5236. if (tab[ind] != null) tab[ind] = null;else throw "e";
  5237. } else if (fnm == "CREATEBRUSHINDIRECT") {
  5238. oid = rU32(buff, loff);
  5239. loff += 4;
  5240. obj = {
  5241. t: "b"
  5242. };
  5243. obj.stl = rU32(buff, loff);
  5244. loff += 4;
  5245. obj.clr = [buff[loff] / 255, buff[loff + 1] / 255, buff[loff + 2] / 255];
  5246. loff += 4;
  5247. obj.htc = rU32(buff, loff);
  5248. loff += 4;
  5249. //console.log(oid, obj);
  5250. } else if (fnm == "CREATEPEN" || fnm == "EXTCREATEPEN") {
  5251. oid = rU32(buff, loff);
  5252. loff += 4;
  5253. obj = {
  5254. t: "p"
  5255. };
  5256. if (fnm == "EXTCREATEPEN") {
  5257. loff += 16;
  5258. obj.stl = rU32(buff, loff);
  5259. loff += 4;
  5260. obj.wid = rU32(buff, loff);
  5261. loff += 4;
  5262. //obj.stl = rU32(buff, loff);
  5263. loff += 4;
  5264. } else {
  5265. obj.stl = rU32(buff, loff);
  5266. loff += 4;
  5267. obj.wid = rU32(buff, loff);
  5268. loff += 4;
  5269. loff += 4;
  5270. }
  5271. obj.clr = [buff[loff] / 255, buff[loff + 1] / 255, buff[loff + 2] / 255];
  5272. loff += 4;
  5273. } else if (fnm == "EXTCREATEFONTINDIRECTW") {
  5274. oid = rU32(buff, loff);
  5275. loff += 4;
  5276. obj = {
  5277. t: "f",
  5278. nam: ""
  5279. };
  5280. obj.hgh = rI32(buff, loff);
  5281. loff += 4;
  5282. loff += 4 * 2;
  5283. obj.orn = rI32(buff, loff) / 10;
  5284. loff += 4;
  5285. var wgh = rU32(buff, loff);
  5286. loff += 4; //console.log(fnm, obj.orn, wgh);
  5287. //console.log(rU32(buff,loff), rU32(buff,loff+4), buff.slice(loff,loff+8));
  5288. obj.und = buff[loff + 1];
  5289. obj.stk = buff[loff + 2];
  5290. loff += 4 * 2;
  5291. while (rU(buff, loff) != 0) {
  5292. obj.nam += String.fromCharCode(rU(buff, loff));
  5293. loff += 2;
  5294. }
  5295. if (wgh > 500) obj.nam += "-Bold";
  5296. //console.log(wgh, obj.nam);
  5297. } else if (fnm == "EXTTEXTOUTW") {
  5298. //console.log(buff.slice(loff-8, loff-8+siz));
  5299. loff += 16;
  5300. var mod = rU32(buff, loff);
  5301. loff += 4; //console.log(mod);
  5302. var scx = rF32(buff, loff);
  5303. loff += 4;
  5304. var scy = rF32(buff, loff);
  5305. loff += 4;
  5306. var rfx = rI32(buff, loff);
  5307. loff += 4;
  5308. var rfy = rI32(buff, loff);
  5309. loff += 4;
  5310. //console.log(mod, scx, scy,rfx,rfy);
  5311. gst.font.Tm = [1, 0, 0, -1, 0, 0];
  5312. exports.UDOC.M.rotate(gst.font.Tm, prms.fnt.orn * Math.PI / 180);
  5313. exports.UDOC.M.translate(gst.font.Tm, rfx, rfy);
  5314. var alg = prms.talg; //console.log(alg.toString(2));
  5315. if ((alg & 6) == 6) gst.font.Tal = 2;else if ((alg & 7) == 0) gst.font.Tal = 0;else throw alg + " e";
  5316. if ((alg & 24) == 24) {} // baseline
  5317. else if ((alg & 24) == 0) exports.UDOC.M.translate(gst.font.Tm, 0, gst.font.Tfs);else throw "e";
  5318. var crs = rU32(buff, loff);
  5319. loff += 4;
  5320. var ofs = rU32(buff, loff);
  5321. loff += 4;
  5322. var ops = rU32(buff, loff);
  5323. loff += 4; //if(ops!=0) throw "e";
  5324. //console.log(ofs,ops,crs);
  5325. loff += 16;
  5326. var ofD = rU32(buff, loff);
  5327. loff += 4; //console.log(ops, ofD, loff, ofs+off-8);
  5328. ofs += off - 8; //console.log(crs, ops);
  5329. var str = "";
  5330. for (var i = 0; i < crs; i++) {
  5331. var cc = rU(buff, ofs + i * 2);
  5332. str += String.fromCharCode(cc);
  5333. }
  5334. ;
  5335. var oclr = gst.colr;
  5336. gst.colr = prms.tclr;
  5337. //console.log(str, gst.colr, gst.font.Tm);
  5338. //var otfs = gst.font.Tfs; gst.font.Tfs *= 1/gst.ctm[0];
  5339. genv.PutText(gst, str, str.length * gst.font.Tfs * 0.5);
  5340. gst.colr = oclr;
  5341. //gst.font.Tfs = otfs;
  5342. //console.log(rfx, rfy, scx, ops, rcX, rcY, rcW, rcH, offDx, str);
  5343. } else if (fnm == "BEGINPATH") {
  5344. exports.UDOC.G.newPath(gst);
  5345. } else if (fnm == "ENDPATH") {} else if (fnm == "CLOSEFIGURE") exports.UDOC.G.closePath(gst);else if (fnm == "MOVETOEX") {
  5346. exports.UDOC.G.moveTo(gst, rI32(buff, loff), rI32(buff, loff + 4));
  5347. } else if (fnm == "LINETO") {
  5348. if (gst.pth.cmds.length == 0) {
  5349. var im = gst.ctm.slice(0);
  5350. exports.UDOC.M.invert(im);
  5351. var p = exports.UDOC.M.multPoint(im, gst.cpos);
  5352. exports.UDOC.G.moveTo(gst, p[0], p[1]);
  5353. }
  5354. exports.UDOC.G.lineTo(gst, rI32(buff, loff), rI32(buff, loff + 4));
  5355. } else if (fnm == "POLYGON" || fnm == "POLYGON16" || fnm == "POLYLINE" || fnm == "POLYLINE16" || fnm == "POLYLINETO" || fnm == "POLYLINETO16") {
  5356. loff += 16;
  5357. var ndf = fnm.startsWith("POLYGON"),
  5358. isTo = fnm.indexOf("TO") != -1;
  5359. var cnt = rU32(buff, loff);
  5360. loff += 4;
  5361. if (!isTo) exports.UDOC.G.newPath(gst);
  5362. loff = exports.FromEMF._drawPoly(buff, loff, cnt, gst, fnm.endsWith("16") ? 2 : 4, ndf, isTo);
  5363. if (!isTo) exports.FromEMF._draw(genv, gst, prms, ndf);
  5364. //console.log(prms, gst.lwidth);
  5365. //console.log(JSON.parse(JSON.stringify(gst.pth)));
  5366. } else if (fnm == "POLYPOLYGON16") {
  5367. loff += 16;
  5368. var ndf = fnm.startsWith("POLYPOLYGON"),
  5369. isTo = fnm.indexOf("TO") != -1;
  5370. var nop = rU32(buff, loff);
  5371. loff += 4;
  5372. loff += 4;
  5373. var pi = loff;
  5374. loff += nop * 4;
  5375. if (!isTo) exports.UDOC.G.newPath(gst);
  5376. for (var i = 0; i < nop; i++) {
  5377. var ppp = rU(buff, pi + i * 4);
  5378. loff = exports.FromEMF._drawPoly(buff, loff, ppp, gst, fnm.endsWith("16") ? 2 : 4, ndf, isTo);
  5379. }
  5380. if (!isTo) exports.FromEMF._draw(genv, gst, prms, ndf);
  5381. } else if (fnm == "POLYBEZIER" || fnm == "POLYBEZIER16" || fnm == "POLYBEZIERTO" || fnm == "POLYBEZIERTO16") {
  5382. loff += 16;
  5383. var is16 = fnm.endsWith("16"),
  5384. rC = is16 ? rI : rI32,
  5385. nl = is16 ? 2 : 4;
  5386. var cnt = rU32(buff, loff);
  5387. loff += 4;
  5388. if (fnm.indexOf("TO") == -1) {
  5389. exports.UDOC.G.moveTo(gst, rC(buff, loff), rC(buff, loff + nl));
  5390. loff += 2 * nl;
  5391. cnt--;
  5392. }
  5393. while (cnt > 0) {
  5394. exports.UDOC.G.curveTo(gst, rC(buff, loff), rC(buff, loff + nl), rC(buff, loff + 2 * nl), rC(buff, loff + 3 * nl), rC(buff, loff + 4 * nl), rC(buff, loff + 5 * nl));
  5395. loff += 6 * nl;
  5396. cnt -= 3;
  5397. }
  5398. //console.log(JSON.parse(JSON.stringify(gst.pth)));
  5399. } else if (fnm == "RECTANGLE" || fnm == "ELLIPSE") {
  5400. exports.UDOC.G.newPath(gst);
  5401. var bx = exports.FromEMF._readBox(buff, loff);
  5402. if (fnm == "RECTANGLE") {
  5403. exports.UDOC.G.moveTo(gst, bx[0], bx[1]);
  5404. exports.UDOC.G.lineTo(gst, bx[2], bx[1]);
  5405. exports.UDOC.G.lineTo(gst, bx[2], bx[3]);
  5406. exports.UDOC.G.lineTo(gst, bx[0], bx[3]);
  5407. } else {
  5408. var x = (bx[0] + bx[2]) / 2,
  5409. y = (bx[1] + bx[3]) / 2;
  5410. exports.UDOC.G.arc(gst, x, y, (bx[2] - bx[0]) / 2, 0, 2 * Math.PI, false);
  5411. }
  5412. exports.UDOC.G.closePath(gst);
  5413. exports.FromEMF._draw(genv, gst, prms, true);
  5414. //console.log(prms, gst.lwidth);
  5415. } else if (fnm == "FILLPATH") genv.Fill(gst, false);else if (fnm == "STROKEPATH") genv.Stroke(gst);else if (fnm == "STROKEANDFILLPATH") {
  5416. genv.Fill(gst, false);
  5417. genv.Stroke(gst);
  5418. } else if (fnm == "SETWORLDTRANSFORM" || fnm == "MODIFYWORLDTRANSFORM") {
  5419. var mat = [];
  5420. for (var i = 0; i < 6; i++) mat.push(rF32(buff, loff + i * 4));
  5421. loff += 24;
  5422. //console.log(fnm, gst.ctm.slice(0), mat);
  5423. if (fnm == "SETWORLDTRANSFORM") gst.ctm = mat;else {
  5424. var mod = rU32(buff, loff);
  5425. loff += 4;
  5426. if (mod == 2) {
  5427. var om = gst.ctm;
  5428. gst.ctm = mat;
  5429. exports.UDOC.M.concat(gst.ctm, om);
  5430. } else throw "e";
  5431. }
  5432. } else if (fnm == "SETSTRETCHBLTMODE") {
  5433. var sm = rU32(buff, loff);
  5434. loff += 4;
  5435. } else if (fnm == "STRETCHDIBITS") {
  5436. var bx = exports.FromEMF._readBox(buff, loff);
  5437. loff += 16;
  5438. var xD = rI32(buff, loff);
  5439. loff += 4;
  5440. var yD = rI32(buff, loff);
  5441. loff += 4;
  5442. var xS = rI32(buff, loff);
  5443. loff += 4;
  5444. var yS = rI32(buff, loff);
  5445. loff += 4;
  5446. var wS = rI32(buff, loff);
  5447. loff += 4;
  5448. var hS = rI32(buff, loff);
  5449. loff += 4;
  5450. var ofH = rU32(buff, loff) + off - 8;
  5451. loff += 4;
  5452. var szH = rU32(buff, loff);
  5453. loff += 4;
  5454. var ofB = rU32(buff, loff) + off - 8;
  5455. loff += 4;
  5456. var szB = rU32(buff, loff);
  5457. loff += 4;
  5458. var usg = rU32(buff, loff);
  5459. loff += 4;
  5460. if (usg != 0) throw "e";
  5461. var bop = rU32(buff, loff);
  5462. loff += 4;
  5463. var wD = rI32(buff, loff);
  5464. loff += 4;
  5465. var hD = rI32(buff, loff);
  5466. loff += 4; //console.log(bop, wD, hD);
  5467. //console.log(ofH, szH, ofB, szB, ofH+40);
  5468. //console.log(bx, xD,yD,wD,hD);
  5469. //console.log(xS,yS,wS,hS);
  5470. //console.log(ofH,szH,ofB,szB,usg,bop);
  5471. var hl = rU32(buff, ofH);
  5472. ofH += 4;
  5473. var w = rU32(buff, ofH);
  5474. ofH += 4;
  5475. var h = rU32(buff, ofH);
  5476. ofH += 4;
  5477. if (w != wS || h != hS) throw "e";
  5478. var ps = rU(buff, ofH);
  5479. ofH += 2;
  5480. var bc = rU(buff, ofH);
  5481. ofH += 2;
  5482. if (bc != 8 && bc != 24 && bc != 32) throw bc + " e";
  5483. var cpr = rU32(buff, ofH);
  5484. ofH += 4;
  5485. if (cpr != 0) throw cpr + " e";
  5486. var sz = rU32(buff, ofH);
  5487. ofH += 4;
  5488. var xpm = rU32(buff, ofH);
  5489. ofH += 4;
  5490. var ypm = rU32(buff, ofH);
  5491. ofH += 4;
  5492. var cu = rU32(buff, ofH);
  5493. ofH += 4;
  5494. var ci = rU32(buff, ofH);
  5495. ofH += 4; //console.log(hl, w, h, ps, bc, cpr, sz, xpm, ypm, cu, ci);
  5496. //console.log(hl,w,h,",",xS,yS,wS,hS,",",xD,yD,wD,hD,",",xpm,ypm);
  5497. var rl = Math.floor((w * ps * bc + 31 & ~31) / 8);
  5498. var img = new Uint8Array(w * h * 4);
  5499. if (bc == 8) {
  5500. for (var y = 0; y < h; y++) for (var x = 0; x < w; x++) {
  5501. var qi = y * w + x << 2,
  5502. ind = buff[ofB + (h - 1 - y) * rl + x] << 2;
  5503. img[qi] = buff[ofH + ind + 2];
  5504. img[qi + 1] = buff[ofH + ind + 1];
  5505. img[qi + 2] = buff[ofH + ind + 0];
  5506. img[qi + 3] = 255;
  5507. }
  5508. }
  5509. if (bc == 24) {
  5510. for (var y = 0; y < h; y++) for (var x = 0; x < w; x++) {
  5511. var qi = y * w + x << 2,
  5512. ti = ofB + (h - 1 - y) * rl + x * 3;
  5513. img[qi] = buff[ti + 2];
  5514. img[qi + 1] = buff[ti + 1];
  5515. img[qi + 2] = buff[ti + 0];
  5516. img[qi + 3] = 255;
  5517. }
  5518. }
  5519. if (bc == 32) {
  5520. for (var y = 0; y < h; y++) for (var x = 0; x < w; x++) {
  5521. var qi = y * w + x << 2,
  5522. ti = ofB + (h - 1 - y) * rl + x * 4;
  5523. img[qi] = buff[ti + 2];
  5524. img[qi + 1] = buff[ti + 1];
  5525. img[qi + 2] = buff[ti + 0];
  5526. img[qi + 3] = buff[ti + 3];
  5527. }
  5528. }
  5529. var ctm = gst.ctm.slice(0);
  5530. gst.ctm = [1, 0, 0, 1, 0, 0];
  5531. exports.UDOC.M.scale(gst.ctm, wD, -hD);
  5532. exports.UDOC.M.translate(gst.ctm, xD, yD + hD);
  5533. exports.UDOC.M.concat(gst.ctm, ctm);
  5534. genv.PutImage(gst, img, w, h);
  5535. gst.ctm = ctm;
  5536. } else {
  5537. console.log(fnm, siz);
  5538. }
  5539. if (obj != null) tab[oid] = obj;
  5540. off += siz - 8;
  5541. }
  5542. //genv.Stroke(gst);
  5543. genv.ShowPage();
  5544. genv.Done();
  5545. };
  5546. exports.FromEMF._readBox = function (buff, off) {
  5547. var b = [];
  5548. for (var i = 0; i < 4; i++) b[i] = exports.FromEMF.B.readInt(buff, off + i * 4);
  5549. return b;
  5550. };
  5551. exports.FromEMF._updateCtm = function (prms, gst) {
  5552. var mat = [1, 0, 0, 1, 0, 0];
  5553. var wbb = prms.wbb,
  5554. bb = prms.bb,
  5555. vbb = prms.vbb && prms.vbb.length == 4 ? prms.vbb : prms.bb;
  5556. //var y0 = bb[1], y1 = bb[3]; bb[1]=Math.min(y0,y1); bb[3]=Math.max(y0,y1);
  5557. exports.UDOC.M.translate(mat, -wbb[0], -wbb[1]);
  5558. exports.UDOC.M.scale(mat, 1 / wbb[2], 1 / wbb[3]);
  5559. exports.UDOC.M.scale(mat, vbb[2], vbb[3]);
  5560. //UDOC.M.scale(mat, vbb[2]/(bb[2]-bb[0]), vbb[3]/(bb[3]-bb[1]));
  5561. //UDOC.M.scale(mat, bb[2]-bb[0],bb[3]-bb[1]);
  5562. gst.ctm = mat;
  5563. };
  5564. exports.FromEMF._draw = function (genv, gst, prms, needFill) {
  5565. if (prms.fill && needFill) genv.Fill(gst, false);
  5566. if (prms.strk && gst.lwidth != 0) genv.Stroke(gst);
  5567. };
  5568. exports.FromEMF._drawPoly = function (buff, off, ppp, gst, nl, clos, justLine) {
  5569. var rS = nl == 2 ? exports.FromEMF.B.readShort : exports.FromEMF.B.readInt;
  5570. for (var j = 0; j < ppp; j++) {
  5571. var px = rS(buff, off);
  5572. off += nl;
  5573. var py = rS(buff, off);
  5574. off += nl;
  5575. if (j == 0 && !justLine) exports.UDOC.G.moveTo(gst, px, py);else exports.UDOC.G.lineTo(gst, px, py);
  5576. }
  5577. if (clos) exports.UDOC.G.closePath(gst);
  5578. return off;
  5579. };
  5580. exports.FromEMF.B = {
  5581. uint8: new Uint8Array(4),
  5582. readShort: function readShort(buff, p) {
  5583. var u8 = exports.FromEMF.B.uint8;
  5584. u8[0] = buff[p];
  5585. u8[1] = buff[p + 1];
  5586. return exports.FromEMF.B.int16[0];
  5587. },
  5588. readUshort: function readUshort(buff, p) {
  5589. var u8 = exports.FromEMF.B.uint8;
  5590. u8[0] = buff[p];
  5591. u8[1] = buff[p + 1];
  5592. return exports.FromEMF.B.uint16[0];
  5593. },
  5594. readInt: function readInt(buff, p) {
  5595. var u8 = exports.FromEMF.B.uint8;
  5596. u8[0] = buff[p];
  5597. u8[1] = buff[p + 1];
  5598. u8[2] = buff[p + 2];
  5599. u8[3] = buff[p + 3];
  5600. return exports.FromEMF.B.int32[0];
  5601. },
  5602. readUint: function readUint(buff, p) {
  5603. var u8 = exports.FromEMF.B.uint8;
  5604. u8[0] = buff[p];
  5605. u8[1] = buff[p + 1];
  5606. u8[2] = buff[p + 2];
  5607. u8[3] = buff[p + 3];
  5608. return exports.FromEMF.B.uint32[0];
  5609. },
  5610. readFloat: function readFloat(buff, p) {
  5611. var u8 = exports.FromEMF.B.uint8;
  5612. u8[0] = buff[p];
  5613. u8[1] = buff[p + 1];
  5614. u8[2] = buff[p + 2];
  5615. u8[3] = buff[p + 3];
  5616. return exports.FromEMF.B.flot32[0];
  5617. },
  5618. readASCII: function readASCII(buff, p, l) {
  5619. var s = "";
  5620. for (var i = 0; i < l; i++) s += String.fromCharCode(buff[p + i]);
  5621. return s;
  5622. }
  5623. };
  5624. exports.FromEMF.B.int16 = new Int16Array(exports.FromEMF.B.uint8.buffer);
  5625. exports.FromEMF.B.uint16 = new Uint16Array(exports.FromEMF.B.uint8.buffer);
  5626. exports.FromEMF.B.int32 = new Int32Array(exports.FromEMF.B.uint8.buffer);
  5627. exports.FromEMF.B.uint32 = new Uint32Array(exports.FromEMF.B.uint8.buffer);
  5628. exports.FromEMF.B.flot32 = new Float32Array(exports.FromEMF.B.uint8.buffer);
  5629. exports.FromEMF.C = {
  5630. EMR_HEADER: 0x00000001,
  5631. EMR_POLYBEZIER: 0x00000002,
  5632. EMR_POLYGON: 0x00000003,
  5633. EMR_POLYLINE: 0x00000004,
  5634. EMR_POLYBEZIERTO: 0x00000005,
  5635. EMR_POLYLINETO: 0x00000006,
  5636. EMR_POLYPOLYLINE: 0x00000007,
  5637. EMR_POLYPOLYGON: 0x00000008,
  5638. EMR_SETWINDOWEXTEX: 0x00000009,
  5639. EMR_SETWINDOWORGEX: 0x0000000A,
  5640. EMR_SETVIEWPORTEXTEX: 0x0000000B,
  5641. EMR_SETVIEWPORTORGEX: 0x0000000C,
  5642. EMR_SETBRUSHORGEX: 0x0000000D,
  5643. EMR_EOF: 0x0000000E,
  5644. EMR_SETPIXELV: 0x0000000F,
  5645. EMR_SETMAPPERFLAGS: 0x00000010,
  5646. EMR_SETMAPMODE: 0x00000011,
  5647. EMR_SETBKMODE: 0x00000012,
  5648. EMR_SETPOLYFILLMODE: 0x00000013,
  5649. EMR_SETROP2: 0x00000014,
  5650. EMR_SETSTRETCHBLTMODE: 0x00000015,
  5651. EMR_SETTEXTALIGN: 0x00000016,
  5652. EMR_SETCOLORADJUSTMENT: 0x00000017,
  5653. EMR_SETTEXTCOLOR: 0x00000018,
  5654. EMR_SETBKCOLOR: 0x00000019,
  5655. EMR_OFFSETCLIPRGN: 0x0000001A,
  5656. EMR_MOVETOEX: 0x0000001B,
  5657. EMR_SETMETARGN: 0x0000001C,
  5658. EMR_EXCLUDECLIPRECT: 0x0000001D,
  5659. EMR_INTERSECTCLIPRECT: 0x0000001E,
  5660. EMR_SCALEVIEWPORTEXTEX: 0x0000001F,
  5661. EMR_SCALEWINDOWEXTEX: 0x00000020,
  5662. EMR_SAVEDC: 0x00000021,
  5663. EMR_RESTOREDC: 0x00000022,
  5664. EMR_SETWORLDTRANSFORM: 0x00000023,
  5665. EMR_MODIFYWORLDTRANSFORM: 0x00000024,
  5666. EMR_SELECTOBJECT: 0x00000025,
  5667. EMR_CREATEPEN: 0x00000026,
  5668. EMR_CREATEBRUSHINDIRECT: 0x00000027,
  5669. EMR_DELETEOBJECT: 0x00000028,
  5670. EMR_ANGLEARC: 0x00000029,
  5671. EMR_ELLIPSE: 0x0000002A,
  5672. EMR_RECTANGLE: 0x0000002B,
  5673. EMR_ROUNDRECT: 0x0000002C,
  5674. EMR_ARC: 0x0000002D,
  5675. EMR_CHORD: 0x0000002E,
  5676. EMR_PIE: 0x0000002F,
  5677. EMR_SELECTPALETTE: 0x00000030,
  5678. EMR_CREATEPALETTE: 0x00000031,
  5679. EMR_SETPALETTEENTRIES: 0x00000032,
  5680. EMR_RESIZEPALETTE: 0x00000033,
  5681. EMR_REALIZEPALETTE: 0x00000034,
  5682. EMR_EXTFLOODFILL: 0x00000035,
  5683. EMR_LINETO: 0x00000036,
  5684. EMR_ARCTO: 0x00000037,
  5685. EMR_POLYDRAW: 0x00000038,
  5686. EMR_SETARCDIRECTION: 0x00000039,
  5687. EMR_SETMITERLIMIT: 0x0000003A,
  5688. EMR_BEGINPATH: 0x0000003B,
  5689. EMR_ENDPATH: 0x0000003C,
  5690. EMR_CLOSEFIGURE: 0x0000003D,
  5691. EMR_FILLPATH: 0x0000003E,
  5692. EMR_STROKEANDFILLPATH: 0x0000003F,
  5693. EMR_STROKEPATH: 0x00000040,
  5694. EMR_FLATTENPATH: 0x00000041,
  5695. EMR_WIDENPATH: 0x00000042,
  5696. EMR_SELECTCLIPPATH: 0x00000043,
  5697. EMR_ABORTPATH: 0x00000044,
  5698. EMR_COMMENT: 0x00000046,
  5699. EMR_FILLRGN: 0x00000047,
  5700. EMR_FRAMERGN: 0x00000048,
  5701. EMR_INVERTRGN: 0x00000049,
  5702. EMR_PAINTRGN: 0x0000004A,
  5703. EMR_EXTSELECTCLIPRGN: 0x0000004B,
  5704. EMR_BITBLT: 0x0000004C,
  5705. EMR_STRETCHBLT: 0x0000004D,
  5706. EMR_MASKBLT: 0x0000004E,
  5707. EMR_PLGBLT: 0x0000004F,
  5708. EMR_SETDIBITSTODEVICE: 0x00000050,
  5709. EMR_STRETCHDIBITS: 0x00000051,
  5710. EMR_EXTCREATEFONTINDIRECTW: 0x00000052,
  5711. EMR_EXTTEXTOUTA: 0x00000053,
  5712. EMR_EXTTEXTOUTW: 0x00000054,
  5713. EMR_POLYBEZIER16: 0x00000055,
  5714. EMR_POLYGON16: 0x00000056,
  5715. EMR_POLYLINE16: 0x00000057,
  5716. EMR_POLYBEZIERTO16: 0x00000058,
  5717. EMR_POLYLINETO16: 0x00000059,
  5718. EMR_POLYPOLYLINE16: 0x0000005A,
  5719. EMR_POLYPOLYGON16: 0x0000005B,
  5720. EMR_POLYDRAW16: 0x0000005C,
  5721. EMR_CREATEMONOBRUSH: 0x0000005D,
  5722. EMR_CREATEDIBPATTERNBRUSHPT: 0x0000005E,
  5723. EMR_EXTCREATEPEN: 0x0000005F,
  5724. EMR_POLYTEXTOUTA: 0x00000060,
  5725. EMR_POLYTEXTOUTW: 0x00000061,
  5726. EMR_SETICMMODE: 0x00000062,
  5727. EMR_CREATECOLORSPACE: 0x00000063,
  5728. EMR_SETCOLORSPACE: 0x00000064,
  5729. EMR_DELETECOLORSPACE: 0x00000065,
  5730. EMR_GLSRECORD: 0x00000066,
  5731. EMR_GLSBOUNDEDRECORD: 0x00000067,
  5732. EMR_PIXELFORMAT: 0x00000068,
  5733. EMR_DRAWESCAPE: 0x00000069,
  5734. EMR_EXTESCAPE: 0x0000006A,
  5735. EMR_SMALLTEXTOUT: 0x0000006C,
  5736. EMR_FORCEUFIMAPPING: 0x0000006D,
  5737. EMR_NAMEDESCAPE: 0x0000006E,
  5738. EMR_COLORCORRECTPALETTE: 0x0000006F,
  5739. EMR_SETICMPROFILEA: 0x00000070,
  5740. EMR_SETICMPROFILEW: 0x00000071,
  5741. EMR_ALPHABLEND: 0x00000072,
  5742. EMR_SETLAYOUT: 0x00000073,
  5743. EMR_TRANSPARENTBLT: 0x00000074,
  5744. EMR_GRADIENTFILL: 0x00000076,
  5745. EMR_SETLINKEDUFIS: 0x00000077,
  5746. EMR_SETTEXTJUSTIFICATION: 0x00000078,
  5747. EMR_COLORMATCHTOTARGETW: 0x00000079,
  5748. EMR_CREATECOLORSPACEW: 0x0000007A
  5749. };
  5750. exports.FromEMF.K = [];
  5751. // (function() {
  5752. // var inp, out, stt;
  5753. // inp = FromEMF.C; out = FromEMF.K; stt=4;
  5754. // for(var p in inp) out[inp[p]] = p.slice(stt);
  5755. // } )();
  5756. exports.ToContext2D = function (needPage, scale) {
  5757. this.canvas = document.createElement("canvas");
  5758. this.ctx = this.canvas.getContext("2d");
  5759. this.bb = null;
  5760. this.currPage = 0;
  5761. this.needPage = needPage;
  5762. this.scale = scale;
  5763. };
  5764. exports.ToContext2D.prototype.StartPage = function (x, y, w, h) {
  5765. if (this.currPage != this.needPage) return;
  5766. this.bb = [x, y, w, h];
  5767. var scl = this.scale,
  5768. dpr = window.devicePixelRatio;
  5769. var cnv = this.canvas,
  5770. ctx = this.ctx;
  5771. cnv.width = Math.round(w * scl);
  5772. cnv.height = Math.round(h * scl);
  5773. ctx.translate(0, h * scl);
  5774. ctx.scale(scl, -scl);
  5775. cnv.setAttribute("style", "border:1px solid; width:" + cnv.width / dpr + "px; height:" + cnv.height / dpr + "px");
  5776. };
  5777. exports.ToContext2D.prototype.Fill = function (gst, evenOdd) {
  5778. if (this.currPage != this.needPage) return;
  5779. var ctx = this.ctx;
  5780. ctx.beginPath();
  5781. this._setStyle(gst, ctx);
  5782. this._draw(gst.pth, ctx);
  5783. ctx.fill();
  5784. };
  5785. exports.ToContext2D.prototype.Stroke = function (gst) {
  5786. if (this.currPage != this.needPage) return;
  5787. var ctx = this.ctx;
  5788. ctx.beginPath();
  5789. this._setStyle(gst, ctx);
  5790. this._draw(gst.pth, ctx);
  5791. ctx.stroke();
  5792. };
  5793. exports.ToContext2D.prototype.PutText = function (gst, str, stw) {
  5794. if (this.currPage != this.needPage) return;
  5795. var scl = this._scale(gst.ctm);
  5796. var ctx = this.ctx;
  5797. this._setStyle(gst, ctx);
  5798. ctx.save();
  5799. var m = [1, 0, 0, -1, 0, 0];
  5800. this._concat(m, gst.font.Tm);
  5801. this._concat(m, gst.ctm);
  5802. //console.log(str, m, gst); throw "e";
  5803. ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
  5804. ctx.fillText(str, 0, 0);
  5805. ctx.restore();
  5806. };
  5807. exports.ToContext2D.prototype.PutImage = function (gst, buff, w, h, msk) {
  5808. if (this.currPage != this.needPage) return;
  5809. var ctx = this.ctx;
  5810. if (buff.length == w * h * 4) {
  5811. buff = buff.slice(0);
  5812. if (msk && msk.length == w * h * 4) for (var i = 0; i < buff.length; i += 4) buff[i + 3] = msk[i + 1];
  5813. var cnv = document.createElement("canvas"),
  5814. cctx = cnv.getContext("2d");
  5815. cnv.width = w;
  5816. cnv.height = h;
  5817. var imgd = cctx.createImageData(w, h);
  5818. for (var i = 0; i < buff.length; i++) imgd.data[i] = buff[i];
  5819. cctx.putImageData(imgd, 0, 0);
  5820. ctx.save();
  5821. var m = [1, 0, 0, 1, 0, 0];
  5822. this._concat(m, [1 / w, 0, 0, -1 / h, 0, 1]);
  5823. this._concat(m, gst.ctm);
  5824. ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
  5825. ctx.drawImage(cnv, 0, 0);
  5826. ctx.restore();
  5827. }
  5828. };
  5829. exports.ToContext2D.prototype.ShowPage = function () {
  5830. this.currPage++;
  5831. };
  5832. exports.ToContext2D.prototype.Done = function () {};
  5833. function _flt(n) {
  5834. return "" + parseFloat(n.toFixed(2));
  5835. }
  5836. exports.ToContext2D.prototype._setStyle = function (gst, ctx) {
  5837. var scl = this._scale(gst.ctm);
  5838. ctx.fillStyle = this._getFill(gst.colr, gst.ca, ctx);
  5839. ctx.strokeStyle = this._getFill(gst.COLR, gst.CA, ctx);
  5840. ctx.lineCap = ["butt", "round", "square"][gst.lcap];
  5841. ctx.lineJoin = ["miter", "round", "bevel"][gst.ljoin];
  5842. ctx.lineWidth = gst.lwidth * scl;
  5843. var dsh = gst.dash.slice(0);
  5844. for (var i = 0; i < dsh.length; i++) dsh[i] = _flt(dsh[i] * scl);
  5845. ctx.setLineDash(dsh);
  5846. ctx.miterLimit = gst.mlimit * scl;
  5847. var fn = gst.font.Tf,
  5848. ln = fn.toLowerCase();
  5849. var p0 = ln.indexOf("bold") != -1 ? "bold " : "";
  5850. var p1 = ln.indexOf("italic") != -1 || ln.indexOf("oblique") != -1 ? "italic " : "";
  5851. ctx.font = p0 + p1 + gst.font.Tfs + "px \"" + fn + "\"";
  5852. };
  5853. exports.ToContext2D.prototype._getFill = function (colr, ca, ctx) {
  5854. if (colr.typ == null) return this._colr(colr, ca);else {
  5855. var grd = colr,
  5856. crd = grd.crds,
  5857. mat = grd.mat,
  5858. scl = this._scale(mat),
  5859. gf;
  5860. if (grd.typ == "lin") {
  5861. var p0 = this._multPoint(mat, crd.slice(0, 2)),
  5862. p1 = this._multPoint(mat, crd.slice(2));
  5863. gf = ctx.createLinearGradient(p0[0], p0[1], p1[0], p1[1]);
  5864. } else if (grd.typ == "rad") {
  5865. var p0 = this._multPoint(mat, crd.slice(0, 2)),
  5866. p1 = this._multPoint(mat, crd.slice(3));
  5867. gf = ctx.createRadialGradient(p0[0], p0[1], crd[2] * scl, p1[0], p1[1], crd[5] * scl);
  5868. }
  5869. for (var i = 0; i < grd.grad.length; i++) gf.addColorStop(grd.grad[i][0], this._colr(grd.grad[i][1], ca));
  5870. return gf;
  5871. }
  5872. };
  5873. exports.ToContext2D.prototype._colr = function (c, a) {
  5874. return "rgba(" + Math.round(c[0] * 255) + "," + Math.round(c[1] * 255) + "," + Math.round(c[2] * 255) + "," + a + ")";
  5875. };
  5876. exports.ToContext2D.prototype._scale = function (m) {
  5877. return Math.sqrt(Math.abs(m[0] * m[3] - m[1] * m[2]));
  5878. };
  5879. exports.ToContext2D.prototype._concat = function (m, w) {
  5880. var a = m[0],
  5881. b = m[1],
  5882. c = m[2],
  5883. d = m[3],
  5884. tx = m[4],
  5885. ty = m[5];
  5886. m[0] = a * w[0] + b * w[2];
  5887. m[1] = a * w[1] + b * w[3];
  5888. m[2] = c * w[0] + d * w[2];
  5889. m[3] = c * w[1] + d * w[3];
  5890. m[4] = tx * w[0] + ty * w[2] + w[4];
  5891. m[5] = tx * w[1] + ty * w[3] + w[5];
  5892. };
  5893. exports.ToContext2D.prototype._multPoint = function (m, p) {
  5894. var x = p[0],
  5895. y = p[1];
  5896. return [x * m[0] + y * m[2] + m[4], x * m[1] + y * m[3] + m[5]];
  5897. }, exports.ToContext2D.prototype._draw = function (path, ctx) {
  5898. var c = 0,
  5899. crds = path.crds;
  5900. for (var j = 0; j < path.cmds.length; j++) {
  5901. var cmd = path.cmds[j];
  5902. if (cmd == "M") {
  5903. ctx.moveTo(crds[c], crds[c + 1]);
  5904. c += 2;
  5905. } else if (cmd == "L") {
  5906. ctx.lineTo(crds[c], crds[c + 1]);
  5907. c += 2;
  5908. } else if (cmd == "C") {
  5909. ctx.bezierCurveTo(crds[c], crds[c + 1], crds[c + 2], crds[c + 3], crds[c + 4], crds[c + 5]);
  5910. c += 6;
  5911. } else if (cmd == "Q") {
  5912. ctx.quadraticCurveTo(crds[c], crds[c + 1], crds[c + 2], crds[c + 3]);
  5913. c += 4;
  5914. } else if (cmd == "Z") {
  5915. ctx.closePath();
  5916. }
  5917. }
  5918. };
  5919. },{}],18:[function(require,module,exports){
  5920. "use strict";
  5921. Object.defineProperty(exports, "__esModule", {
  5922. value: true
  5923. });
  5924. exports.getMultiFormulaValue = exports.getPeelOffX14 = exports.getTransR1C1ToSequence = exports.getSingleSequenceToNum = exports.getSqrefRawArrFormat = exports.getRegionSequence = exports.getMultiSequenceToNum = exports.getBinaryContent = exports.isContainMultiType = exports.isKoera = exports.isJapanese = exports.isChinese = exports.fromulaRef = exports.escapeCharacter = exports.generateRandomIndex = exports.LightenDarkenColor = exports.getRowHeightPixel = exports.getColumnWidthPixel = exports.getXmlAttibute = exports.getPxByEMUs = exports.getptToPxRatioByDPI = exports.getcellrange = exports.getRangetxt = void 0;
  5925. var constant_1 = require("./constant");
  5926. function getRangetxt(range, sheettxt) {
  5927. var row0 = range["row"][0],
  5928. row1 = range["row"][1];
  5929. var column0 = range["column"][0],
  5930. column1 = range["column"][1];
  5931. if (row0 == null && row1 == null) {
  5932. return sheettxt + chatatABC(column0) + ":" + chatatABC(column1);
  5933. } else if (column0 == null && column1 == null) {
  5934. return sheettxt + (row0 + 1) + ":" + (row1 + 1);
  5935. } else {
  5936. if (column0 == column1 && row0 == row1) {
  5937. return sheettxt + chatatABC(column0) + (row0 + 1);
  5938. } else {
  5939. return sheettxt + chatatABC(column0) + (row0 + 1) + ":" + chatatABC(column1) + (row1 + 1);
  5940. }
  5941. }
  5942. }
  5943. exports.getRangetxt = getRangetxt;
  5944. function getcellrange(txt, sheets, sheetId) {
  5945. if (sheets === void 0) {
  5946. sheets = {};
  5947. }
  5948. if (sheetId === void 0) {
  5949. sheetId = "1";
  5950. }
  5951. var val = txt.split("!");
  5952. var sheettxt = "",
  5953. rangetxt = "",
  5954. sheetIndex = -1;
  5955. if (val.length > 1) {
  5956. sheettxt = val[0];
  5957. rangetxt = val[1];
  5958. var si = sheets[sheettxt];
  5959. if (si == null) {
  5960. sheetIndex = parseInt(sheetId);
  5961. } else {
  5962. sheetIndex = parseInt(si);
  5963. }
  5964. } else {
  5965. sheetIndex = parseInt(sheetId);
  5966. rangetxt = val[0];
  5967. }
  5968. if (rangetxt.indexOf(":") == -1) {
  5969. var row = parseInt(rangetxt.replace(/[^0-9]/g, "")) - 1;
  5970. var col = ABCatNum(rangetxt.replace(/[^A-Za-z]/g, ""));
  5971. if (!isNaN(row) && !isNaN(col)) {
  5972. return {
  5973. "row": [row, row],
  5974. "column": [col, col],
  5975. "sheetIndex": sheetIndex
  5976. };
  5977. } else {
  5978. return null;
  5979. }
  5980. } else {
  5981. var rangetxtArray = rangetxt.split(":");
  5982. var row = [],
  5983. col = [];
  5984. row[0] = parseInt(rangetxtArray[0].replace(/[^0-9]/g, "")) - 1;
  5985. row[1] = parseInt(rangetxtArray[1].replace(/[^0-9]/g, "")) - 1;
  5986. // if (isNaN(row[0])) {
  5987. // row[0] = 0;
  5988. // }
  5989. // if (isNaN(row[1])) {
  5990. // row[1] = sheetdata.length - 1;
  5991. // }
  5992. if (row[0] > row[1]) {
  5993. return null;
  5994. }
  5995. col[0] = ABCatNum(rangetxtArray[0].replace(/[^A-Za-z]/g, ""));
  5996. col[1] = ABCatNum(rangetxtArray[1].replace(/[^A-Za-z]/g, ""));
  5997. // if (isNaN(col[0])) {
  5998. // col[0] = 0;
  5999. // }
  6000. // if (isNaN(col[1])) {
  6001. // col[1] = sheetdata[0].length - 1;
  6002. // }
  6003. if (col[0] > col[1]) {
  6004. return null;
  6005. }
  6006. return {
  6007. "row": row,
  6008. "column": col,
  6009. "sheetIndex": sheetIndex
  6010. };
  6011. }
  6012. }
  6013. exports.getcellrange = getcellrange;
  6014. //列下标 字母转数字
  6015. function ABCatNum(abc) {
  6016. abc = abc.toUpperCase();
  6017. var abc_len = abc.length;
  6018. if (abc_len == 0) {
  6019. return NaN;
  6020. }
  6021. var abc_array = abc.split("");
  6022. var wordlen = constant_1.columeHeader_word.length;
  6023. var ret = 0;
  6024. for (var i = abc_len - 1; i >= 0; i--) {
  6025. if (i == abc_len - 1) {
  6026. ret += constant_1.columeHeader_word_index[abc_array[i]];
  6027. } else {
  6028. ret += Math.pow(wordlen, abc_len - i - 1) * (constant_1.columeHeader_word_index[abc_array[i]] + 1);
  6029. }
  6030. }
  6031. return ret;
  6032. }
  6033. //列下标 数字转字母
  6034. function chatatABC(index) {
  6035. var wordlen = constant_1.columeHeader_word.length;
  6036. if (index < wordlen) {
  6037. return constant_1.columeHeader_word[index];
  6038. } else {
  6039. var last = 0,
  6040. pre = 0,
  6041. ret = "";
  6042. var i = 1,
  6043. n = 0;
  6044. while (index >= wordlen / (wordlen - 1) * (Math.pow(wordlen, i++) - 1)) {
  6045. n = i;
  6046. }
  6047. var index_ab = index - wordlen / (wordlen - 1) * (Math.pow(wordlen, n - 1) - 1); //970
  6048. last = index_ab + 1;
  6049. for (var x = n; x > 0; x--) {
  6050. var last1 = last,
  6051. x1 = x; //-702=268, 3
  6052. if (x == 1) {
  6053. last1 = last1 % wordlen;
  6054. if (last1 == 0) {
  6055. last1 = 26;
  6056. }
  6057. return ret + constant_1.columeHeader_word[last1 - 1];
  6058. }
  6059. last1 = Math.ceil(last1 / Math.pow(wordlen, x - 1));
  6060. //last1 = last1 % wordlen;
  6061. ret += constant_1.columeHeader_word[last1 - 1];
  6062. if (x > 1) {
  6063. last = last - (last1 - 1) * wordlen;
  6064. }
  6065. }
  6066. }
  6067. }
  6068. /**
  6069. * @return ratio, default 0.75 1in = 2.54cm = 25.4mm = 72pt = 6pc, pt = 1/72 In, px = 1/dpi In
  6070. */
  6071. function getptToPxRatioByDPI() {
  6072. return 72 / 96;
  6073. }
  6074. exports.getptToPxRatioByDPI = getptToPxRatioByDPI;
  6075. /**
  6076. * @emus EMUs, Excel drawing unit
  6077. * @return pixel
  6078. */
  6079. function getPxByEMUs(emus) {
  6080. if (emus == null) {
  6081. return 0;
  6082. }
  6083. var inch = emus / 914400;
  6084. var pt = inch * 72;
  6085. var px = pt / getptToPxRatioByDPI();
  6086. return px;
  6087. }
  6088. exports.getPxByEMUs = getPxByEMUs;
  6089. /**
  6090. * @dom xml attribute object
  6091. * @attr attribute name
  6092. * @d if attribute is null, return default value
  6093. * @return attribute value
  6094. */
  6095. function getXmlAttibute(dom, attr, d) {
  6096. var value = dom[attr];
  6097. value = value == null ? d : value;
  6098. return value;
  6099. }
  6100. exports.getXmlAttibute = getXmlAttibute;
  6101. /**
  6102. * @columnWidth Excel column width
  6103. * @return pixel column width
  6104. */
  6105. function getColumnWidthPixel(columnWidth) {
  6106. var pix = Math.round((columnWidth - 0.83) * 8 + 5);
  6107. return pix;
  6108. }
  6109. exports.getColumnWidthPixel = getColumnWidthPixel;
  6110. /**
  6111. * @rowHeight Excel row height
  6112. * @return pixel row height
  6113. */
  6114. function getRowHeightPixel(rowHeight) {
  6115. var pix = Math.round(rowHeight / getptToPxRatioByDPI());
  6116. return pix;
  6117. }
  6118. exports.getRowHeightPixel = getRowHeightPixel;
  6119. function LightenDarkenColor(sixColor, tint) {
  6120. var hex = sixColor.substring(sixColor.length - 6, sixColor.length);
  6121. var rgbArray = hexToRgbArray("#" + hex);
  6122. var hslArray = rgbToHsl(rgbArray[0], rgbArray[1], rgbArray[2]);
  6123. if (tint > 0) {
  6124. hslArray[2] = hslArray[2] * (1.0 - tint) + tint;
  6125. } else if (tint < 0) {
  6126. hslArray[2] = hslArray[2] * (1.0 + tint);
  6127. } else {
  6128. return "#" + hex;
  6129. }
  6130. var newRgbArray = hslToRgb(hslArray[0], hslArray[1], hslArray[2]);
  6131. return rgbToHex("RGB(" + newRgbArray.join(",") + ")");
  6132. }
  6133. exports.LightenDarkenColor = LightenDarkenColor;
  6134. function rgbToHex(rgb) {
  6135. //十六进制颜色值的正则表达式
  6136. var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
  6137. // 如果是rgb颜色表示
  6138. if (/^(rgb|RGB)/.test(rgb)) {
  6139. var aColor = rgb.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",");
  6140. var strHex = "#";
  6141. for (var i = 0; i < aColor.length; i++) {
  6142. var hex = Number(aColor[i]).toString(16);
  6143. if (hex.length < 2) {
  6144. hex = '0' + hex;
  6145. }
  6146. strHex += hex;
  6147. }
  6148. if (strHex.length !== 7) {
  6149. strHex = rgb;
  6150. }
  6151. return strHex;
  6152. } else if (reg.test(rgb)) {
  6153. var aNum = rgb.replace(/#/, "").split("");
  6154. if (aNum.length === 6) {
  6155. return rgb;
  6156. } else if (aNum.length === 3) {
  6157. var numHex = "#";
  6158. for (var i = 0; i < aNum.length; i += 1) {
  6159. numHex += aNum[i] + aNum[i];
  6160. }
  6161. return numHex;
  6162. }
  6163. }
  6164. return rgb;
  6165. }
  6166. function hexToRgb(hex) {
  6167. var sColor = hex.toLowerCase();
  6168. //十六进制颜色值的正则表达式
  6169. var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
  6170. // 如果是16进制颜色
  6171. if (sColor && reg.test(sColor)) {
  6172. if (sColor.length === 4) {
  6173. var sColorNew = "#";
  6174. for (var i = 1; i < 4; i += 1) {
  6175. sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));
  6176. }
  6177. sColor = sColorNew;
  6178. }
  6179. //处理六位的颜色值
  6180. var sColorChange = [];
  6181. for (var i = 1; i < 7; i += 2) {
  6182. sColorChange.push(parseInt("0x" + sColor.slice(i, i + 2)));
  6183. }
  6184. return "RGB(" + sColorChange.join(",") + ")";
  6185. }
  6186. return sColor;
  6187. }
  6188. function hexToRgbArray(hex) {
  6189. var sColor = hex.toLowerCase();
  6190. //十六进制颜色值的正则表达式
  6191. var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
  6192. // 如果是16进制颜色
  6193. if (sColor && reg.test(sColor)) {
  6194. if (sColor.length === 4) {
  6195. var sColorNew = "#";
  6196. for (var i = 1; i < 4; i += 1) {
  6197. sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));
  6198. }
  6199. sColor = sColorNew;
  6200. }
  6201. //处理六位的颜色值
  6202. var sColorChange = [];
  6203. for (var i = 1; i < 7; i += 2) {
  6204. sColorChange.push(parseInt("0x" + sColor.slice(i, i + 2)));
  6205. }
  6206. return sColorChange;
  6207. }
  6208. return null;
  6209. }
  6210. /**
  6211. * HSL颜色值转换为RGB.
  6212. * 换算公式改编自 http://en.wikipedia.org/wiki/HSL_color_space.
  6213. * h, s, 和 l 设定在 [0, 1] 之间
  6214. * 返回的 r, g, 和 b 在 [0, 255]之间
  6215. *
  6216. * @param Number h 色相
  6217. * @param Number s 饱和度
  6218. * @param Number l 亮度
  6219. * @return Array RGB色值数值
  6220. */
  6221. function hslToRgb(h, s, l) {
  6222. var r, g, b;
  6223. if (s == 0) {
  6224. r = g = b = l; // achromatic
  6225. } else {
  6226. var hue2rgb = function hue2rgb(p, q, t) {
  6227. if (t < 0) t += 1;
  6228. if (t > 1) t -= 1;
  6229. if (t < 1 / 6) return p + (q - p) * 6 * t;
  6230. if (t < 1 / 2) return q;
  6231. if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
  6232. return p;
  6233. };
  6234. var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
  6235. var p = 2 * l - q;
  6236. r = hue2rgb(p, q, h + 1 / 3);
  6237. g = hue2rgb(p, q, h);
  6238. b = hue2rgb(p, q, h - 1 / 3);
  6239. }
  6240. return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
  6241. }
  6242. /**
  6243. * RGB 颜色值转换为 HSL.
  6244. * 转换公式参考自 http://en.wikipedia.org/wiki/HSL_color_space.
  6245. * r, g, 和 b 需要在 [0, 255] 范围内
  6246. * 返回的 h, s, 和 l 在 [0, 1] 之间
  6247. *
  6248. * @param Number r 红色色值
  6249. * @param Number g 绿色色值
  6250. * @param Number b 蓝色色值
  6251. * @return Array HSL各值数组
  6252. */
  6253. function rgbToHsl(r, g, b) {
  6254. r /= 255, g /= 255, b /= 255;
  6255. var max = Math.max(r, g, b),
  6256. min = Math.min(r, g, b);
  6257. var h,
  6258. s,
  6259. l = (max + min) / 2;
  6260. if (max == min) {
  6261. h = s = 0; // achromatic
  6262. } else {
  6263. var d = max - min;
  6264. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  6265. switch (max) {
  6266. case r:
  6267. h = (g - b) / d + (g < b ? 6 : 0);
  6268. break;
  6269. case g:
  6270. h = (b - r) / d + 2;
  6271. break;
  6272. case b:
  6273. h = (r - g) / d + 4;
  6274. break;
  6275. }
  6276. h /= 6;
  6277. }
  6278. return [h, s, l];
  6279. }
  6280. function generateRandomIndex(prefix) {
  6281. if (prefix == null) {
  6282. prefix = "Sheet";
  6283. }
  6284. var userAgent = window.navigator.userAgent.replace(/[^a-zA-Z0-9]/g, "").split("");
  6285. var mid = "";
  6286. for (var i = 0; i < 5; i++) {
  6287. mid += userAgent[Math.round(Math.random() * (userAgent.length - 1))];
  6288. }
  6289. var time = new Date().getTime();
  6290. return prefix + "_" + mid + "_" + time;
  6291. }
  6292. exports.generateRandomIndex = generateRandomIndex;
  6293. function escapeCharacter(str) {
  6294. if (str == null || str.length == 0) {
  6295. return str;
  6296. }
  6297. return str.replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&nbsp;/g, ' ').replace(/&apos;/g, "'").replace(/&iexcl;/g, "¡").replace(/&cent;/g, "¢").replace(/&pound;/g, "£").replace(/&curren;/g, "¤").replace(/&yen;/g, "¥").replace(/&brvbar;/g, "¦").replace(/&sect;/g, "§").replace(/&uml;/g, "¨").replace(/&copy;/g, "©").replace(/&ordf;/g, "ª").replace(/&laquo;/g, "«").replace(/&not;/g, "¬").replace(/&shy;/g, "­").replace(/&reg;/g, "®").replace(/&macr;/g, "¯").replace(/&deg;/g, "°").replace(/&plusmn;/g, "±").replace(/&sup2;/g, "²").replace(/&sup3;/g, "³").replace(/&acute;/g, "´").replace(/&micro;/g, "µ").replace(/&para;/g, "¶").replace(/&middot;/g, "·").replace(/&cedil;/g, "¸").replace(/&sup1;/g, "¹").replace(/&ordm;/g, "º").replace(/&raquo;/g, "»").replace(/&frac14;/g, "¼").replace(/&frac12;/g, "½").replace(/&frac34;/g, "¾").replace(/&iquest;/g, "¿").replace(/&times;/g, "×").replace(/&divide;/g, "÷").replace(/&Agrave;/g, "À").replace(/&Aacute;/g, "Á").replace(/&Acirc;/g, "Â").replace(/&Atilde;/g, "Ã").replace(/&Auml;/g, "Ä").replace(/&Aring;/g, "Å").replace(/&AElig;/g, "Æ").replace(/&Ccedil;/g, "Ç").replace(/&Egrave;/g, "È").replace(/&Eacute;/g, "É").replace(/&Ecirc;/g, "Ê").replace(/&Euml;/g, "Ë").replace(/&Igrave;/g, "Ì").replace(/&Iacute;/g, "Í").replace(/&Icirc;/g, "Î").replace(/&Iuml;/g, "Ï").replace(/&ETH;/g, "Ð").replace(/&Ntilde;/g, "Ñ").replace(/&Ograve;/g, "Ò").replace(/&Oacute;/g, "Ó").replace(/&Ocirc;/g, "Ô").replace(/&Otilde;/g, "Õ").replace(/&Ouml;/g, "Ö").replace(/&Oslash;/g, "Ø").replace(/&Ugrave;/g, "Ù").replace(/&Uacute;/g, "Ú").replace(/&Ucirc;/g, "Û").replace(/&Uuml;/g, "Ü").replace(/&Yacute;/g, "Ý").replace(/&THORN;/g, "Þ").replace(/&szlig;/g, "ß").replace(/&agrave;/g, "à").replace(/&aacute;/g, "á").replace(/&acirc;/g, "â").replace(/&atilde;/g, "ã").replace(/&auml;/g, "ä").replace(/&aring;/g, "å").replace(/&aelig;/g, "æ").replace(/&ccedil;/g, "ç").replace(/&egrave;/g, "è").replace(/&eacute;/g, "é").replace(/&ecirc;/g, "ê").replace(/&euml;/g, "ë").replace(/&igrave;/g, "ì").replace(/&iacute;/g, "í").replace(/&icirc;/g, "î").replace(/&iuml;/g, "ï").replace(/&eth;/g, "ð").replace(/&ntilde;/g, "ñ").replace(/&ograve;/g, "ò").replace(/&oacute;/g, "ó").replace(/&ocirc;/g, "ô").replace(/&otilde;/g, "õ").replace(/&ouml;/g, "ö").replace(/&oslash;/g, "ø").replace(/&ugrave;/g, "ù").replace(/&uacute;/g, "ú").replace(/&ucirc;/g, "û").replace(/&uuml;/g, "ü").replace(/&yacute;/g, "ý").replace(/&thorn;/g, "þ").replace(/&yuml;/g, "ÿ");
  6298. }
  6299. exports.escapeCharacter = escapeCharacter;
  6300. var fromulaRef = /** @class */function () {
  6301. function fromulaRef() {}
  6302. fromulaRef.trim = function (str) {
  6303. if (str == null) {
  6304. str = "";
  6305. }
  6306. return str.replace(/(^\s*)|(\s*$)/g, "");
  6307. };
  6308. fromulaRef.functionCopy = function (txt, mode, step) {
  6309. var _this = this;
  6310. if (_this.operatorjson == null) {
  6311. var arr = _this.operator.split("|"),
  6312. op = {};
  6313. for (var i_1 = 0; i_1 < arr.length; i_1++) {
  6314. op[arr[i_1].toString()] = 1;
  6315. }
  6316. _this.operatorjson = op;
  6317. }
  6318. if (mode == null) {
  6319. mode = "down";
  6320. }
  6321. if (step == null) {
  6322. step = 1;
  6323. }
  6324. if (txt.substr(0, 1) == "=") {
  6325. txt = txt.substr(1);
  6326. }
  6327. var funcstack = txt.split("");
  6328. var i = 0,
  6329. str = "",
  6330. function_str = "",
  6331. ispassby = true;
  6332. var matchConfig = {
  6333. "bracket": 0,
  6334. "comma": 0,
  6335. "squote": 0,
  6336. "dquote": 0
  6337. };
  6338. while (i < funcstack.length) {
  6339. var s = funcstack[i];
  6340. if (s == "(" && matchConfig.dquote == 0) {
  6341. matchConfig.bracket += 1;
  6342. if (str.length > 0) {
  6343. function_str += str + "(";
  6344. } else {
  6345. function_str += "(";
  6346. }
  6347. str = "";
  6348. } else if (s == ")" && matchConfig.dquote == 0) {
  6349. matchConfig.bracket -= 1;
  6350. function_str += _this.functionCopy(str, mode, step) + ")";
  6351. str = "";
  6352. } else if (s == '"' && matchConfig.squote == 0) {
  6353. if (matchConfig.dquote > 0) {
  6354. function_str += str + '"';
  6355. matchConfig.dquote -= 1;
  6356. str = "";
  6357. } else {
  6358. matchConfig.dquote += 1;
  6359. str += '"';
  6360. }
  6361. } else if (s == ',' && matchConfig.dquote == 0) {
  6362. function_str += _this.functionCopy(str, mode, step) + ',';
  6363. str = "";
  6364. } else if (s == '&' && matchConfig.dquote == 0) {
  6365. if (str.length > 0) {
  6366. function_str += _this.functionCopy(str, mode, step) + "&";
  6367. str = "";
  6368. } else {
  6369. function_str += "&";
  6370. }
  6371. } else if (s in _this.operatorjson && matchConfig.dquote == 0) {
  6372. var s_next = "";
  6373. if (i + 1 < funcstack.length) {
  6374. s_next = funcstack[i + 1];
  6375. }
  6376. var p = i - 1,
  6377. s_pre = null;
  6378. if (p >= 0) {
  6379. do {
  6380. s_pre = funcstack[p--];
  6381. } while (p >= 0 && s_pre == " ");
  6382. }
  6383. if (s + s_next in _this.operatorjson) {
  6384. if (str.length > 0) {
  6385. function_str += _this.functionCopy(str, mode, step) + s + s_next;
  6386. str = "";
  6387. } else {
  6388. function_str += s + s_next;
  6389. }
  6390. i++;
  6391. } else if (!/[^0-9]/.test(s_next) && s == "-" && (s_pre == "(" || s_pre == null || s_pre == "," || s_pre == " " || s_pre in _this.operatorjson)) {
  6392. str += s;
  6393. } else {
  6394. if (str.length > 0) {
  6395. function_str += _this.functionCopy(str, mode, step) + s;
  6396. str = "";
  6397. } else {
  6398. function_str += s;
  6399. }
  6400. }
  6401. } else {
  6402. str += s;
  6403. }
  6404. if (i == funcstack.length - 1) {
  6405. if (_this.iscelldata(_this.trim(str))) {
  6406. if (mode == "down") {
  6407. function_str += _this.downparam(_this.trim(str), step);
  6408. } else if (mode == "up") {
  6409. function_str += _this.upparam(_this.trim(str), step);
  6410. } else if (mode == "left") {
  6411. function_str += _this.leftparam(_this.trim(str), step);
  6412. } else if (mode == "right") {
  6413. function_str += _this.rightparam(_this.trim(str), step);
  6414. }
  6415. } else {
  6416. function_str += _this.trim(str);
  6417. }
  6418. }
  6419. i++;
  6420. }
  6421. return function_str;
  6422. };
  6423. fromulaRef.downparam = function (txt, step) {
  6424. return this.updateparam("d", txt, step);
  6425. };
  6426. fromulaRef.upparam = function (txt, step) {
  6427. return this.updateparam("u", txt, step);
  6428. };
  6429. fromulaRef.leftparam = function (txt, step) {
  6430. return this.updateparam("l", txt, step);
  6431. };
  6432. fromulaRef.rightparam = function (txt, step) {
  6433. return this.updateparam("r", txt, step);
  6434. };
  6435. fromulaRef.updateparam = function (orient, txt, step) {
  6436. var _this = this;
  6437. var val = txt.split("!"),
  6438. rangetxt,
  6439. prefix = "";
  6440. if (val.length > 1) {
  6441. rangetxt = val[1];
  6442. prefix = val[0] + "!";
  6443. } else {
  6444. rangetxt = val[0];
  6445. }
  6446. if (rangetxt.indexOf(":") == -1) {
  6447. var row = parseInt(rangetxt.replace(/[^0-9]/g, ""));
  6448. var col = ABCatNum(rangetxt.replace(/[^A-Za-z]/g, ""));
  6449. var freezonFuc = _this.isfreezonFuc(rangetxt);
  6450. var $row = freezonFuc[0] ? "$" : "",
  6451. $col = freezonFuc[1] ? "$" : "";
  6452. if (orient == "u" && !freezonFuc[0]) {
  6453. row -= step;
  6454. } else if (orient == "r" && !freezonFuc[1]) {
  6455. col += step;
  6456. } else if (orient == "l" && !freezonFuc[1]) {
  6457. col -= step;
  6458. } else if (!freezonFuc[0]) {
  6459. row += step;
  6460. }
  6461. if (row < 0 || col < 0) {
  6462. return _this.error.r;
  6463. }
  6464. if (!isNaN(row) && !isNaN(col)) {
  6465. return prefix + $col + chatatABC(col) + $row + row;
  6466. } else if (!isNaN(row)) {
  6467. return prefix + $row + row;
  6468. } else if (!isNaN(col)) {
  6469. return prefix + $col + chatatABC(col);
  6470. } else {
  6471. return txt;
  6472. }
  6473. } else {
  6474. rangetxt = rangetxt.split(":");
  6475. var row = [],
  6476. col = [];
  6477. row[0] = parseInt(rangetxt[0].replace(/[^0-9]/g, ""));
  6478. row[1] = parseInt(rangetxt[1].replace(/[^0-9]/g, ""));
  6479. if (row[0] > row[1]) {
  6480. return txt;
  6481. }
  6482. col[0] = ABCatNum(rangetxt[0].replace(/[^A-Za-z]/g, ""));
  6483. col[1] = ABCatNum(rangetxt[1].replace(/[^A-Za-z]/g, ""));
  6484. if (col[0] > col[1]) {
  6485. return txt;
  6486. }
  6487. var freezonFuc0 = _this.isfreezonFuc(rangetxt[0]);
  6488. var freezonFuc1 = _this.isfreezonFuc(rangetxt[1]);
  6489. var $row0 = freezonFuc0[0] ? "$" : "",
  6490. $col0 = freezonFuc0[1] ? "$" : "";
  6491. var $row1 = freezonFuc1[0] ? "$" : "",
  6492. $col1 = freezonFuc1[1] ? "$" : "";
  6493. if (orient == "u") {
  6494. if (!freezonFuc0[0]) {
  6495. row[0] -= step;
  6496. }
  6497. if (!freezonFuc1[0]) {
  6498. row[1] -= step;
  6499. }
  6500. } else if (orient == "r") {
  6501. if (!freezonFuc0[1]) {
  6502. col[0] += step;
  6503. }
  6504. if (!freezonFuc1[1]) {
  6505. col[1] += step;
  6506. }
  6507. } else if (orient == "l") {
  6508. if (!freezonFuc0[1]) {
  6509. col[0] -= step;
  6510. }
  6511. if (!freezonFuc1[1]) {
  6512. col[1] -= step;
  6513. }
  6514. } else {
  6515. if (!freezonFuc0[0]) {
  6516. row[0] += step;
  6517. }
  6518. if (!freezonFuc1[0]) {
  6519. row[1] += step;
  6520. }
  6521. }
  6522. if (row[0] < 0 || col[0] < 0) {
  6523. return _this.error.r;
  6524. }
  6525. if (isNaN(col[0]) && isNaN(col[1])) {
  6526. return prefix + $row0 + row[0] + ":" + $row1 + row[1];
  6527. } else if (isNaN(row[0]) && isNaN(row[1])) {
  6528. return prefix + $col0 + chatatABC(col[0]) + ":" + $col1 + chatatABC(col[1]);
  6529. } else {
  6530. return prefix + $col0 + chatatABC(col[0]) + $row0 + row[0] + ":" + $col1 + chatatABC(col[1]) + $row1 + row[1];
  6531. }
  6532. }
  6533. };
  6534. fromulaRef.iscelldata = function (txt) {
  6535. var val = txt.split("!"),
  6536. rangetxt;
  6537. if (val.length > 1) {
  6538. rangetxt = val[1];
  6539. } else {
  6540. rangetxt = val[0];
  6541. }
  6542. var reg_cell = /^(([a-zA-Z]+)|([$][a-zA-Z]+))(([0-9]+)|([$][0-9]+))$/g; //增加正则判断单元格为字母+数字的格式:如 A1:B3
  6543. var reg_cellRange = /^(((([a-zA-Z]+)|([$][a-zA-Z]+))(([0-9]+)|([$][0-9]+)))|((([a-zA-Z]+)|([$][a-zA-Z]+))))$/g; //增加正则判断单元格为字母+数字或字母的格式:如 A1:B3,A:A
  6544. if (rangetxt.indexOf(":") == -1) {
  6545. var row = parseInt(rangetxt.replace(/[^0-9]/g, "")) - 1;
  6546. var col = ABCatNum(rangetxt.replace(/[^A-Za-z]/g, ""));
  6547. if (!isNaN(row) && !isNaN(col) && rangetxt.toString().match(reg_cell)) {
  6548. return true;
  6549. } else if (!isNaN(row)) {
  6550. return false;
  6551. } else if (!isNaN(col)) {
  6552. return false;
  6553. } else {
  6554. return false;
  6555. }
  6556. } else {
  6557. reg_cellRange = /^(((([a-zA-Z]+)|([$][a-zA-Z]+))(([0-9]+)|([$][0-9]+)))|((([a-zA-Z]+)|([$][a-zA-Z]+)))|((([0-9]+)|([$][0-9]+s))))$/g;
  6558. rangetxt = rangetxt.split(":");
  6559. var row = [],
  6560. col = [];
  6561. row[0] = parseInt(rangetxt[0].replace(/[^0-9]/g, "")) - 1;
  6562. row[1] = parseInt(rangetxt[1].replace(/[^0-9]/g, "")) - 1;
  6563. if (row[0] > row[1]) {
  6564. return false;
  6565. }
  6566. col[0] = ABCatNum(rangetxt[0].replace(/[^A-Za-z]/g, ""));
  6567. col[1] = ABCatNum(rangetxt[1].replace(/[^A-Za-z]/g, ""));
  6568. if (col[0] > col[1]) {
  6569. return false;
  6570. }
  6571. if (rangetxt[0].toString().match(reg_cellRange) && rangetxt[1].toString().match(reg_cellRange)) {
  6572. return true;
  6573. } else {
  6574. return false;
  6575. }
  6576. }
  6577. };
  6578. fromulaRef.isfreezonFuc = function (txt) {
  6579. var row = txt.replace(/[^0-9]/g, "");
  6580. var col = txt.replace(/[^A-Za-z]/g, "");
  6581. var row$ = txt.substr(txt.indexOf(row) - 1, 1);
  6582. var col$ = txt.substr(txt.indexOf(col) - 1, 1);
  6583. var ret = [false, false];
  6584. if (row$ == "$") {
  6585. ret[0] = true;
  6586. }
  6587. if (col$ == "$") {
  6588. ret[1] = true;
  6589. }
  6590. return ret;
  6591. };
  6592. fromulaRef.operator = '==|!=|<>|<=|>=|=|+|-|>|<|/|*|%|&|^';
  6593. fromulaRef.error = {
  6594. v: "#VALUE!",
  6595. n: "#NAME?",
  6596. na: "#N/A",
  6597. r: "#REF!",
  6598. d: "#DIV/0!",
  6599. nm: "#NUM!",
  6600. nl: "#NULL!",
  6601. sp: "#SPILL!" //数组范围有其它值
  6602. };
  6603. fromulaRef.operatorjson = null;
  6604. return fromulaRef;
  6605. }();
  6606. exports.fromulaRef = fromulaRef;
  6607. function isChinese(temp) {
  6608. var re = /[^\u4e00-\u9fa5]/;
  6609. var reg = /[\u3002|\uff1f|\uff01|\uff0c|\u3001|\uff1b|\uff1a|\u201c|\u201d|\u2018|\u2019|\uff08|\uff09|\u300a|\u300b|\u3008|\u3009|\u3010|\u3011|\u300e|\u300f|\u300c|\u300d|\ufe43|\ufe44|\u3014|\u3015|\u2026|\u2014|\uff5e|\ufe4f|\uffe5]/;
  6610. if (reg.test(temp)) return true;
  6611. if (re.test(temp)) return false;
  6612. return true;
  6613. }
  6614. exports.isChinese = isChinese;
  6615. function isJapanese(temp) {
  6616. var re = /[^\u0800-\u4e00]/;
  6617. if (re.test(temp)) return false;
  6618. return true;
  6619. }
  6620. exports.isJapanese = isJapanese;
  6621. function isKoera(chr) {
  6622. if (chr > 0x3130 && chr < 0x318F || chr >= 0xAC00 && chr <= 0xD7A3) {
  6623. return true;
  6624. }
  6625. return false;
  6626. }
  6627. exports.isKoera = isKoera;
  6628. function isContainMultiType(str) {
  6629. var isUnicode = false;
  6630. if (escape(str).indexOf("%u") > -1) {
  6631. isUnicode = true;
  6632. }
  6633. var isNot = false;
  6634. var reg = /[0-9a-z]/gi;
  6635. if (reg.test(str)) {
  6636. isNot = true;
  6637. }
  6638. var reEnSign = /[\x00-\xff]+/g;
  6639. if (reEnSign.test(str)) {
  6640. isNot = true;
  6641. }
  6642. if (isUnicode && isNot) {
  6643. return true;
  6644. }
  6645. return false;
  6646. }
  6647. exports.isContainMultiType = isContainMultiType;
  6648. function getBinaryContent(path, options) {
  6649. var promise, resolve, reject;
  6650. var callback;
  6651. if (!options) {
  6652. options = {};
  6653. }
  6654. // taken from jQuery
  6655. var createStandardXHR = function createStandardXHR() {
  6656. try {
  6657. return new window.XMLHttpRequest();
  6658. } catch (e) {}
  6659. };
  6660. var createActiveXHR = function createActiveXHR() {
  6661. try {
  6662. return new window.ActiveXObject("Microsoft.XMLHTTP");
  6663. } catch (e) {}
  6664. };
  6665. // Create the request object
  6666. var createXHR = typeof window !== "undefined" && window.ActiveXObject ?
  6667. /* Microsoft failed to properly
  6668. * implement the XMLHttpRequest in IE7 (can't request local files),
  6669. * so we use the ActiveXObject when it is available
  6670. * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
  6671. * we need a fallback.
  6672. */
  6673. function () {
  6674. return createStandardXHR() || createActiveXHR();
  6675. } :
  6676. // For all other browsers, use the standard XMLHttpRequest object
  6677. createStandardXHR;
  6678. // backward compatible callback
  6679. if (typeof options === "function") {
  6680. callback = options;
  6681. options = {};
  6682. } else if (typeof options.callback === 'function') {
  6683. // callback inside options object
  6684. callback = options.callback;
  6685. }
  6686. resolve = function resolve(data) {
  6687. callback(null, data);
  6688. };
  6689. reject = function reject(err) {
  6690. callback(err, null);
  6691. };
  6692. try {
  6693. var xhr = createXHR();
  6694. xhr.open('GET', path, true);
  6695. // recent browsers
  6696. if ("responseType" in xhr) {
  6697. xhr.responseType = "arraybuffer";
  6698. }
  6699. // older browser
  6700. if (xhr.overrideMimeType) {
  6701. xhr.overrideMimeType("text/plain; charset=x-user-defined");
  6702. }
  6703. xhr.onreadystatechange = function (event) {
  6704. // use `xhr` and not `this`... thanks IE
  6705. if (xhr.readyState === 4) {
  6706. if (xhr.status === 200 || xhr.status === 0) {
  6707. try {
  6708. resolve(function (xhr) {
  6709. // for xhr.responseText, the 0xFF mask is applied by JSZip
  6710. return xhr.response || xhr.responseText;
  6711. }(xhr));
  6712. } catch (err) {
  6713. reject(new Error(err));
  6714. }
  6715. } else {
  6716. reject(new Error("Ajax error for " + path + " : " + this.status + " " + this.statusText));
  6717. }
  6718. }
  6719. };
  6720. if (options.progress) {
  6721. xhr.onprogress = function (e) {
  6722. options.progress({
  6723. path: path,
  6724. originalEvent: e,
  6725. percent: e.loaded / e.total * 100,
  6726. loaded: e.loaded,
  6727. total: e.total
  6728. });
  6729. };
  6730. }
  6731. xhr.send();
  6732. } catch (e) {
  6733. reject(new Error(e), null);
  6734. }
  6735. // returns a promise or undefined depending on whether a callback was
  6736. // provided
  6737. return promise;
  6738. }
  6739. exports.getBinaryContent = getBinaryContent;
  6740. /**
  6741. * multi sequence conversion
  6742. * example:
  6743. * 1、E14 -> 13_4
  6744. * 2、E14 J14 O14 T14 Y14 AD14 AI14 AN14 AS14 AX14 ->
  6745. * ['13_4', '13_9','13_14', '13_19', '13_24', '13_3', '13_8', '13_13', '13_18', '13_23']
  6746. * 3、E46:E47 -> ['45_4', '46_4']
  6747. *
  6748. * @param {string} sqref - before sequence
  6749. * @returns {string[]}
  6750. */
  6751. function getMultiSequenceToNum(sqref, count) {
  6752. if (!sqref || (sqref === null || sqref === void 0 ? void 0 : sqref.length) <= 0) return [];
  6753. sqref = sqref.toUpperCase();
  6754. var sqrefRawArr = sqref.split(" ");
  6755. var sqrefArr = sqrefRawArr.filter(function (e) {
  6756. return e && e.trim();
  6757. });
  6758. var sqrefLastArr = getSqrefRawArrFormat(sqrefArr, count);
  6759. var resArr = [];
  6760. for (var i = 0; i < sqrefLastArr.length; i++) {
  6761. var _res = getSingleSequenceToNum(sqrefLastArr[i]);
  6762. if (_res) resArr.push(_res);
  6763. }
  6764. return resArr;
  6765. }
  6766. exports.getMultiSequenceToNum = getMultiSequenceToNum;
  6767. /**
  6768. * get region sequence
  6769. * example:
  6770. * 1、[A1:C2'] -> ['A1', 'A2', 'B1', 'B2', 'C1', 'C2']
  6771. *
  6772. * @param {string[]} arr - formats arr
  6773. * @returns {string[]} - after arr
  6774. */
  6775. function getRegionSequence(arr, count) {
  6776. var _a, _b;
  6777. var formatArr = [];
  6778. var regEn = new RegExp(/[A-Z]+|[0-9]+/g);
  6779. var startArr = (_a = arr[0]) === null || _a === void 0 ? void 0 : _a.match(regEn);
  6780. var lastArr = (_b = arr[1]) === null || _b === void 0 ? void 0 : _b.match(regEn);
  6781. var columnMax = Math.max.apply(Math, [ABCatNum(startArr[0]), ABCatNum(lastArr[0])]);
  6782. var columnMin = Math.min.apply(Math, [ABCatNum(startArr[0]), ABCatNum(lastArr[0])]);
  6783. var rowMax = Math.max.apply(Math, [parseInt(startArr[1]), parseInt(lastArr[1])]);
  6784. var rowMin = Math.min.apply(Math, [parseInt(startArr[1]), parseInt(lastArr[1])]);
  6785. // 处理最大设置行和列
  6786. var countNum = count || 10000;
  6787. var coMax = Math.min(columnMin + countNum, columnMax);
  6788. var roMax = Math.min(rowMin + countNum, rowMax);
  6789. for (var i = columnMin; i <= coMax; i++) {
  6790. for (var j = rowMin; j <= roMax; j++) {
  6791. formatArr.push("" + chatatABC(i) + j);
  6792. }
  6793. }
  6794. return formatArr;
  6795. }
  6796. exports.getRegionSequence = getRegionSequence;
  6797. /**
  6798. * unified processing of conversion formats
  6799. * example:
  6800. * 1、['E38', 'A1:C2'] -> ['E38', 'A1', 'A2', 'B1', 'B2', 'C1', 'C2']
  6801. *
  6802. * @param {string[]} arr - formats arr
  6803. * @returns {string[]} - after arr
  6804. */
  6805. function getSqrefRawArrFormat(arr, count) {
  6806. arr === null || arr === void 0 ? void 0 : arr.map(function (el) {
  6807. if (el.includes(":")) {
  6808. var tempArr = el.split(":");
  6809. if ((tempArr === null || tempArr === void 0 ? void 0 : tempArr.length) === 2) {
  6810. arr = arr.concat(getRegionSequence(tempArr, count));
  6811. arr.splice(arr.indexOf(el), 1);
  6812. }
  6813. }
  6814. });
  6815. var resultArr = arr.filter(function (value, index, array) {
  6816. return array.indexOf(value) === index;
  6817. });
  6818. return resultArr;
  6819. }
  6820. exports.getSqrefRawArrFormat = getSqrefRawArrFormat;
  6821. /**
  6822. * single sequence to number
  6823. * example:
  6824. * 1、A1 -> 0_0
  6825. * 2、ES14 -> 13_4
  6826. *
  6827. * @param {string} sqref - before sequence
  6828. * @returns {string} - after sequence
  6829. */
  6830. function getSingleSequenceToNum(sqref) {
  6831. var sqrefArray = sqref.match(/[A-Z]+|[0-9]+/g);
  6832. var sqrefLen = sqrefArray.length;
  6833. var regEn = new RegExp("^[A-Z]+$");
  6834. var ret = "";
  6835. for (var i = sqrefLen - 1; i >= 0; i--) {
  6836. var cur = sqrefArray[i];
  6837. if (regEn.test(cur)) {
  6838. ret += ABCatNum(cur) + "_";
  6839. } else {
  6840. ret += parseInt(cur) - 1 + "_";
  6841. }
  6842. }
  6843. return ret.substring(0, ret.length - 1);
  6844. }
  6845. exports.getSingleSequenceToNum = getSingleSequenceToNum;
  6846. /**
  6847. * R1C1 to Sequence
  6848. * example: sheet2!R1C1 => sheet!A1
  6849. *
  6850. * @param {string} value - R1C1 value
  6851. * @returns
  6852. */
  6853. function getTransR1C1ToSequence(value) {
  6854. if (!value && (value === null || value === void 0 ? void 0 : value.length) <= 0) return "";
  6855. var len = value.length;
  6856. var index = value.lastIndexOf("!");
  6857. var valueArr = [value.slice(0, index), value.slice(index + 1, len)];
  6858. var repStr = valueArr[1] || "";
  6859. var indexR = repStr.indexOf("R");
  6860. var indexC = repStr.indexOf("C");
  6861. var row = Number(repStr.slice(indexR + 1, indexC));
  6862. var column = chatatABC(Number(repStr.slice(indexC + 1, repStr === null || repStr === void 0 ? void 0 : repStr.length)) - 1);
  6863. return valueArr[0] + "!" + column + row;
  6864. }
  6865. exports.getTransR1C1ToSequence = getTransR1C1ToSequence;
  6866. /**
  6867. * strip x14 format data
  6868. *
  6869. * @param {string} value
  6870. * @returns {Object} - { formula, sqref }
  6871. */
  6872. function getPeelOffX14(value) {
  6873. var _a;
  6874. if (!value || (value === null || value === void 0 ? void 0 : value.length) <= 0) return {};
  6875. // formula
  6876. var formulaReg = new RegExp("</x14:formula[^]>", "g");
  6877. var lastIndex = (_a = value.match(formulaReg)) === null || _a === void 0 ? void 0 : _a.length;
  6878. var lastValue = "</x14:formula" + lastIndex + ">";
  6879. var lastValueEnd = value.indexOf(lastValue);
  6880. var formulaValue = value.substring(0, lastValueEnd + lastValue.length);
  6881. formulaValue = formulaValue.replace(/<xm:f>/g, "").replace(/<\/xm:f>/g, "").replace(/x14:/g, "").replace(/\/x14:/g, "");
  6882. var formula = formulaValue;
  6883. // sqref
  6884. var xmSqrefLen = "<xm:sqref>".length;
  6885. var sqrefStart = value.indexOf("<xm:sqref>");
  6886. var sqrefEnd = value.indexOf("</xm:sqref>");
  6887. var sqref = value.substring(sqrefStart + xmSqrefLen, sqrefEnd);
  6888. return {
  6889. formula: formula,
  6890. sqref: sqref
  6891. };
  6892. }
  6893. exports.getPeelOffX14 = getPeelOffX14;
  6894. /**
  6895. * get the value in the formula
  6896. *
  6897. * @param {string} value - extracted value
  6898. * @returns {string[]}
  6899. */
  6900. function getMultiFormulaValue(value) {
  6901. var _a, _b;
  6902. if (!value || (value === null || value === void 0 ? void 0 : value.length) <= 0) return [];
  6903. var lenReg = new RegExp("formula", "g");
  6904. var len = (((_a = value.match(lenReg)) === null || _a === void 0 ? void 0 : _a.length) || 0) / 2;
  6905. if (len === 0) return [];
  6906. var retArr = [];
  6907. for (var i = 1; i <= len; i++) {
  6908. var startLen = (_b = "<formula" + i + ">") === null || _b === void 0 ? void 0 : _b.length;
  6909. var start = value.indexOf("<formula" + i + ">");
  6910. var end = value.indexOf("</formula" + i + ">");
  6911. var _value = value.substring(start + startLen, end);
  6912. retArr.push(escapeCharacter(_value.replace(/&quot;|^\"|\"$/g, "")));
  6913. }
  6914. return retArr;
  6915. }
  6916. exports.getMultiFormulaValue = getMultiFormulaValue;
  6917. },{"./constant":16}],19:[function(require,module,exports){
  6918. "use strict";
  6919. Object.defineProperty(exports, "__esModule", {
  6920. value: true
  6921. });
  6922. exports.LuckyExcel = void 0;
  6923. var LuckyFile_1 = require("./ToLuckySheet/LuckyFile");
  6924. // import {SecurityDoor,Car} from './content';
  6925. var HandleZip_1 = require("./HandleZip");
  6926. // //demo
  6927. // function demoHandler(){
  6928. // let upload = document.getElementById("Luckyexcel-demo-file");
  6929. // let selectADemo = document.getElementById("Luckyexcel-select-demo");
  6930. // let downlodDemo = document.getElementById("Luckyexcel-downlod-file");
  6931. // let mask = document.getElementById("lucky-mask-demo");
  6932. // if(upload){
  6933. // window.onload = () => {
  6934. // upload.addEventListener("change", function(evt){
  6935. // var files:FileList = (evt.target as any).files;
  6936. // if(files==null || files.length==0){
  6937. // alert("No files wait for import");
  6938. // return;
  6939. // }
  6940. // let name = files[0].name;
  6941. // let suffixArr = name.split("."), suffix = suffixArr[suffixArr.length-1];
  6942. // if(suffix!="xlsx"){
  6943. // alert("Currently only supports the import of xlsx files");
  6944. // return;
  6945. // }
  6946. // LuckyExcel.transformExcelToLucky(files[0], function(exportJson:any, luckysheetfile:string){
  6947. // if(exportJson.sheets==null || exportJson.sheets.length==0){
  6948. // alert("Failed to read the content of the excel file, currently does not support xls files!");
  6949. // return;
  6950. // }
  6951. // console.log(exportJson, luckysheetfile);
  6952. // window.luckysheet.destroy();
  6953. // window.luckysheet.create({
  6954. // container: 'luckysheet', //luckysheet is the container id
  6955. // showinfobar:false,
  6956. // data:exportJson.sheets,
  6957. // title:exportJson.info.name,
  6958. // userInfo:exportJson.info.name.creator
  6959. // });
  6960. // });
  6961. // });
  6962. // selectADemo.addEventListener("change", function(evt){
  6963. // var obj:any = selectADemo;
  6964. // var index = obj.selectedIndex;
  6965. // var value = obj.options[index].value;
  6966. // var name = obj.options[index].innerHTML;
  6967. // if(value==""){
  6968. // return;
  6969. // }
  6970. // mask.style.display = "flex";
  6971. // LuckyExcel.transformExcelToLuckyByUrl(value, name, function(exportJson:any, luckysheetfile:string){
  6972. // if(exportJson.sheets==null || exportJson.sheets.length==0){
  6973. // alert("Failed to read the content of the excel file, currently does not support xls files!");
  6974. // return;
  6975. // }
  6976. // console.log(exportJson, luckysheetfile);
  6977. // mask.style.display = "none";
  6978. // window.luckysheet.destroy();
  6979. // window.luckysheet.create({
  6980. // container: 'luckysheet', //luckysheet is the container id
  6981. // showinfobar:false,
  6982. // data:exportJson.sheets,
  6983. // title:exportJson.info.name,
  6984. // userInfo:exportJson.info.name.creator
  6985. // });
  6986. // });
  6987. // });
  6988. // downlodDemo.addEventListener("click", function(evt){
  6989. // var obj:any = selectADemo;
  6990. // var index = obj.selectedIndex;
  6991. // var value = obj.options[index].value;
  6992. // if(value.length==0){
  6993. // alert("Please select a demo file");
  6994. // return;
  6995. // }
  6996. // var elemIF:any = document.getElementById("Lucky-download-frame");
  6997. // if(elemIF==null){
  6998. // elemIF = document.createElement("iframe");
  6999. // elemIF.style.display = "none";
  7000. // elemIF.id = "Lucky-download-frame";
  7001. // document.body.appendChild(elemIF);
  7002. // }
  7003. // elemIF.src = value;
  7004. // // elemIF.parentNode.removeChild(elemIF);
  7005. // });
  7006. // }
  7007. // }
  7008. // }
  7009. // demoHandler();
  7010. // api
  7011. var LuckyExcel = /** @class */function () {
  7012. function LuckyExcel() {}
  7013. LuckyExcel.transformExcelToLucky = function (excelFile, callback, dataVerificationSelectCount, errorHandler) {
  7014. var handleZip = new HandleZip_1.HandleZip(excelFile);
  7015. handleZip.unzipFile(function (files) {
  7016. var luckyFile = new LuckyFile_1.LuckyFile(files, excelFile.name, dataVerificationSelectCount);
  7017. var luckysheetfile = luckyFile.Parse();
  7018. var exportJson = JSON.parse(luckysheetfile);
  7019. if (callback != undefined) {
  7020. callback(exportJson, luckysheetfile);
  7021. }
  7022. }, function (err) {
  7023. if (errorHandler) {
  7024. errorHandler(err);
  7025. } else {
  7026. console.error(err);
  7027. }
  7028. });
  7029. };
  7030. LuckyExcel.transformExcelToLuckyByUrl = function (url, name, callBack, errorHandler) {
  7031. var handleZip = new HandleZip_1.HandleZip();
  7032. handleZip.unzipFileByUrl(url, function (files) {
  7033. var luckyFile = new LuckyFile_1.LuckyFile(files, name);
  7034. var luckysheetfile = luckyFile.Parse();
  7035. var exportJson = JSON.parse(luckysheetfile);
  7036. if (callBack != undefined) {
  7037. callBack(exportJson, luckysheetfile);
  7038. }
  7039. }, function (err) {
  7040. if (errorHandler) {
  7041. errorHandler(err);
  7042. } else {
  7043. console.error(err);
  7044. }
  7045. });
  7046. };
  7047. LuckyExcel.transformLuckyToExcel = function (LuckyFile, callBack, errorHandler) {};
  7048. return LuckyExcel;
  7049. }();
  7050. exports.LuckyExcel = LuckyExcel;
  7051. },{"./HandleZip":9,"./ToLuckySheet/LuckyFile":12}],20:[function(require,module,exports){
  7052. "use strict";
  7053. var main_1 = require("./main");
  7054. module.exports = main_1.LuckyExcel;
  7055. },{"./main":19}]},{},[20])(20)
  7056. });